Changeset 6
- Timestamp:
- May 6, 2015, 11:19:49 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 98 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormBrowse.lfm
r4 r6 7 7 ClientHeight = 526 8 8 ClientWidth = 722 9 LCLVersion = '1. 3'9 LCLVersion = '1.5' 10 10 object TreeView1: TTreeView 11 11 Left = 0 … … 32 32 item 33 33 Caption = 'Name' 34 Width = 300 34 35 end 35 36 item 36 37 Caption = 'Revision' 38 Width = 80 37 39 end 38 40 item 39 41 Caption = 'Last change date' 42 Width = 100 40 43 end 41 44 item 42 45 Caption = 'Last author' 46 Width = 100 43 47 end 44 48 item … … 46 50 Width = 259 47 51 end> 52 OwnerData = True 48 53 ReadOnly = True 49 54 RowSelect = True 50 55 TabOrder = 2 51 56 ViewStyle = vsReport 57 OnData = ListView1Data 52 58 end 53 59 end -
trunk/Forms/UFormBrowse.pas
r3 r6 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 ExtCtrls ;9 ExtCtrls, UFindFile; 10 10 11 11 type … … 17 17 Splitter1: TSplitter; 18 18 TreeView1: TTreeView; 19 procedure ListView1Data(Sender: TObject; Item: TListItem); 19 20 private 20 { private declarations }21 FileList: TStringList; 21 22 public 23 Directory: string; 22 24 procedure ReloadList; 23 25 end; … … 32 34 { TFormBrowse } 33 35 36 procedure TFormBrowse.ListView1Data(Sender: TObject; Item: TListItem); 37 begin 38 if (Item.Index >= 0) and (Item.Index < FileList.Count) then begin 39 Item.Caption := ExtractFileName(FileList[Item.Index]); 40 end; 41 end; 42 34 43 procedure TFormBrowse.ReloadList; 44 var 45 FindFile: TFindFile; 46 I: Integer; 35 47 begin 36 48 FindFile := TFindFile.Create(nil); 49 FindFile.Path := Directory; 50 FindFile.FileMask := '*.*'; 51 FindFile.InSubFolders := False; 52 FileList := FindFile.SearchForFiles; 53 for I := FileList.Count - 1 downto 0 do 54 if ExtractFileName(FileList[I]) = '.' then FileList.Delete(I); 55 ListView1.Items.Count := FileList.Count; 56 ListView1.Refresh; 37 57 end; 38 58 -
trunk/Forms/UFormConsole.lfm
r5 r6 3 3 Height = 727 4 4 Top = 261 5 Width = 9 845 Width = 975 6 6 Caption = 'Console' 7 7 ClientHeight = 727 8 ClientWidth = 9 848 ClientWidth = 975 9 9 OnClose = FormClose 10 10 OnCreate = FormCreate 11 11 OnDestroy = FormDestroy 12 12 OnShow = FormShow 13 LCLVersion = '1.3' 14 object MemoOutput: TMemo 13 Position = poMainFormCenter 14 LCLVersion = '1.5' 15 object Memo1: TMemo 15 16 Left = 4 16 17 Height = 674 17 18 Top = 48 18 Width = 9 7519 Width = 966 19 20 Align = alCustom 20 21 Anchors = [akTop, akLeft, akRight, akBottom] … … 26 27 TabOrder = 0 27 28 end 29 object ButtonAbort: TButton 30 Left = 895 31 Height = 25 32 Top = 8 33 Width = 75 34 Anchors = [akTop, akRight] 35 Caption = 'Abort' 36 OnClick = ButtonAbortClick 37 TabOrder = 1 38 end 28 39 object EditCommand: TEdit 29 40 Left = 4 30 41 Height = 32 31 42 Top = 7 32 Width = 8 9343 Width = 884 33 44 Anchors = [akTop, akLeft, akRight] 34 45 ReadOnly = True 35 TabOrder = 146 TabOrder = 2 36 47 end 37 object ToolBar1: TToolBar 38 Left = 902 39 Height = 34 40 Top = 8 41 Width = 77 42 Align = alCustom 43 Anchors = [akTop, akRight] 44 Caption = 'ToolBar1' 45 EdgeInner = esNone 46 EdgeOuter = esNone 47 ShowCaptions = True 48 TabOrder = 2 49 object ToolButton1: TToolButton 50 Left = 1 51 Top = 0 52 Action = AAbort 53 AutoSize = True 54 DropdownMenu = PopupMenu1 55 Style = tbsDropDown 56 end 57 end 58 object ActionList1: TActionList 59 left = 265 60 top = 130 61 object AAbort: TAction 62 Caption = 'Abort' 63 OnExecute = AAbortExecute 64 end 65 object ARestart: TAction 66 Caption = 'Restart' 67 end 68 end 69 object PopupMenu1: TPopupMenu 70 left = 264 71 top = 232 72 object MenuItem1: TMenuItem 73 Action = AAbort 74 end 75 object MenuItem2: TMenuItem 76 Action = ARestart 77 end 48 object Timer1: TTimer 49 Enabled = False 50 Interval = 1 51 OnTimer = Timer1Timer 52 left = 72 53 top = 112 78 54 end 79 55 end -
trunk/Forms/UFormConsole.pas
r5 r6 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 Buttons, ComCtrls, ActnList, Menus, Process;9 ExtCtrls, Process; 10 10 11 11 type … … 14 14 15 15 TFormConsole = class(TForm) 16 AAbort: TAction; 17 ARestart: TAction; 18 ActionList1: TActionList; 16 ButtonAbort: TButton; 19 17 EditCommand: TEdit; 20 MemoOutput: TMemo; 21 MenuItem1: TMenuItem; 22 MenuItem2: TMenuItem; 23 PopupMenu1: TPopupMenu; 24 ToolBar1: TToolBar; 25 ToolButton1: TToolButton; 26 procedure AAbortExecute(Sender: TObject); 18 Memo1: TMemo; 19 Timer1: TTimer; 20 procedure ButtonAbortClick(Sender: TObject); 27 21 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 28 22 procedure FormCreate(Sender: TObject); 29 23 procedure FormDestroy(Sender: TObject); 30 24 procedure FormShow(Sender: TObject); 25 procedure Timer1Timer(Sender: TObject); 31 26 private 32 27 Process: TProcess; … … 36 31 Parameters: TStringList; 37 32 WorkingDir: string; 38 Environment: TStringList;33 Environment: string; 39 34 Aborted: Boolean; 40 Duration: TDateTime;35 Log: TStringList; 41 36 procedure Perform; 42 37 end; … … 47 42 implementation 48 43 49 uses50 UFormMain;51 52 44 {$R *.lfm} 53 45 … … 57 49 begin 58 50 Parameters := TStringList.Create; 59 Parameters.QuoteChar := ' '; 60 Parameters.Delimiter := ' '; 61 Environment := TStringList.Create; 62 Environment.QuoteChar := ' '; 63 Environment.Delimiter := ' '; 51 Log := TStringList.Create; 64 52 end; 65 53 66 54 procedure TFormConsole.FormDestroy(Sender: TObject); 67 55 begin 68 Environment.Free;56 Log.Free; 69 57 Parameters.Free; 70 58 end; … … 72 60 procedure TFormConsole.FormShow(Sender: TObject); 73 61 begin 74 //FormMain.PersistentForm1.Load(Self);75 MemoOutput.Clear;76 AAbort.Enabled := False;62 Memo1.Clear; 63 ButtonAbort.Enabled := False; 64 Timer1.Enabled := True; 77 65 end; 78 66 79 procedure TFormConsole.AAbortExecute(Sender: TObject); 67 procedure TFormConsole.Timer1Timer(Sender: TObject); 68 begin 69 Timer1.Enabled := False; 70 Perform; 71 end; 72 73 procedure TFormConsole.ButtonAbortClick(Sender: TObject); 80 74 begin 81 75 if Assigned(Process) then begin … … 88 82 ); 89 83 begin 90 AAbort.Execute; 91 //FormMain.PersistentForm1.Save(Self); 84 ButtonAbort.Click; 92 85 end; 93 86 … … 99 92 Line: string; 100 93 CommandLine: string; 101 TimeStart: TDateTime;102 94 begin 103 TimeStart := Now;104 if not Visible then Show;105 95 Text := ''; 106 96 try 107 97 Process := TProcess.Create(nil); 108 98 Aborted := False; 109 AAbort.Enabled := True;99 ButtonAbort.Enabled := True; 110 100 if WorkingDir <> '' then 111 101 Process.CurrentDirectory := WorkingDir; 112 102 //WorkingDir := ''; 113 if Environment .Count <> 0then114 Process.Environment. Assign(Environment);115 //Environment := '';103 if Environment <> '' then 104 Process.Environment.Text := Environment; 105 Environment := ''; 116 106 //Process.Executable := Executable; 117 107 //Process.Parameters.Assign(Parameters); 118 Process.CommandLine := Executable + ' ' + Parameters. DelimitedText;119 CommandLine := Executable + ' ' + Parameters.DelimitedText;120 //if CommandLine[Length(CommandLine)] = #$athen121 //SetLength(CommandLine, Length(CommandLine) - 1);108 Process.CommandLine := Executable + ' ' + Parameters.Text; 109 CommandLine := Executable + ' ' + StringReplace(Parameters.Text, LineEnding, ' ', [rfReplaceAll]); 110 if CommandLine[Length(CommandLine)] = LineEnding then 111 SetLength(CommandLine, Length(CommandLine) - 1); 122 112 EditCommand.Text := CommandLine; 123 113 Process.Options := [poUsePipes, poNoConsole]; … … 135 125 Line := Copy(Text, 1, Pos(LineEnding, Text) - 1); 136 126 Delete(Text, 1, Length(Line) + Length(LineEnding)); 137 Memo Output.Lines.Add(Line);127 Memo1.Lines.Add(Line); 138 128 end; 139 129 end; … … 147 137 Line := Copy(Text, 1, Pos(LineEnding, Text) - 1); 148 138 Delete(Text, 1, Length(Line) + Length(LineEnding)); 149 Memo Output.Lines.Add(Line);139 Memo1.Lines.Add(Line); 150 140 end; 151 141 end; … … 154 144 end; 155 145 finally 156 Memo Output.Lines.Add(Text);146 Memo1.Lines.Add(Text); 157 147 FreeAndNil(Process); 158 148 end; 159 Duration := Now - TimeStart; 160 AAbort.Enabled := False; 161 //ToolButton1.ModalResult := mrOK; 149 Log.Assign(Memo1.Lines); 150 ButtonAbort.Enabled := False; 151 //ModalResult := mrOK; 152 //Close; 162 153 end; 163 154 -
trunk/Forms/UFormMain.lfm
r5 r6 8 8 ClientWidth = 667 9 9 Menu = MainMenu1 10 LCLVersion = '1.3' 10 OnActivate = FormActivate 11 OnClose = FormClose 12 OnShow = FormShow 13 LCLVersion = '1.5' 14 WindowState = wsMaximized 11 15 object ToolBarMain: TToolBar 12 16 Left = 0 … … 33 37 object MenuItem8: TMenuItem 34 38 Action = Core.AProjectOpen 39 end 40 object MenuItemOpenRecent: TMenuItem 41 Caption = 'Open recent' 35 42 end 36 43 object MenuItem10: TMenuItem -
trunk/Forms/UFormMain.pas
r5 r6 23 23 MenuItem15: TMenuItem; 24 24 MenuItem16: TMenuItem; 25 MenuItemOpenRecent: TMenuItem; 25 26 MenuItem2: TMenuItem; 26 27 MenuItem3: TMenuItem; … … 35 36 StatusBar1: TStatusBar; 36 37 ToolBarMain: TToolBar; 38 procedure FormActivate(Sender: TObject); 39 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 40 procedure FormShow(Sender: TObject); 37 41 private 38 { private declarations }42 Initialized: Boolean; 39 43 public 44 procedure OpenRecentExecute(Sender: TObject); 40 45 procedure UpdateInterface; 46 procedure DockInit; 41 47 end; 42 48 … … 49 55 50 56 uses 51 UCore ;57 UCore, UFormBrowse; 52 58 53 59 { TFormMain } 60 61 procedure TFormMain.FormShow(Sender: TObject); 62 begin 63 DockInit; 64 end; 65 66 procedure TFormMain.OpenRecentExecute(Sender: TObject); 67 begin 68 Core.ProjectOpen(Core.LastOpenedList1.Items[TMenuItem(Sender).MenuIndex]); 69 end; 70 71 procedure TFormMain.FormActivate(Sender: TObject); 72 begin 73 if not Initialized then begin 74 Initialized := True; 75 Core.Init; 76 end; 77 end; 78 79 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 80 begin 81 Core.Done; 82 end; 54 83 55 84 procedure TFormMain.UpdateInterface; … … 59 88 if Assigned(Core.Project) then 60 89 Caption := Core.Project.Directory + ' - ' + AppName 61 else Caption := AppName 90 else Caption := AppName; 91 end; 92 93 procedure TFormMain.DockInit; 94 begin 95 FormBrowse.ManualDock(Self, nil, alClient); 96 FormBrowse.Align := alClient; 97 FormBrowse.Show; 62 98 end; 63 99 -
trunk/UCore.lfm
r5 r6 61 61 end 62 62 object OpenDialog1: TOpenDialog 63 left = 396 64 top = 113 63 left = 260 64 top = 96 65 end 66 object XMLConfig1: TXMLConfig 67 Filename = 'Config.xml' 68 StartEmpty = False 69 RootName = 'CONFIG' 70 left = 96 71 top = 96 72 end 73 object LastOpenedList1: TLastOpenedList 74 MaxCount = 10 75 OnChange = LastOpenedList1Change 76 left = 96 77 top = 168 65 78 end 66 79 end -
trunk/UCore.pas
r5 r6 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, ActnList, Controls, UVCS, UProject, Forms,9 Dialogs;8 Classes, SysUtils, XMLConf, FileUtil, ActnList, Controls, UVCS, UProject, 9 ULastOpenedList, Forms, Dialogs; 10 10 11 11 type … … 28 28 AViewFavorites: TAction; 29 29 ImageList1: TImageList; 30 LastOpenedList1: TLastOpenedList; 30 31 OpenDialog1: TOpenDialog; 32 XMLConfig1: TXMLConfig; 31 33 procedure ACommandCheckoutExecute(Sender: TObject); 32 34 procedure ACommandCleanupExecute(Sender: TObject); … … 38 40 procedure DataModuleCreate(Sender: TObject); 39 41 procedure DataModuleDestroy(Sender: TObject); 42 procedure LastOpenedList1Change(Sender: TObject); 40 43 private 41 44 procedure UpdateInterface; 42 45 public 43 46 Project: TProject; 47 procedure LoadConfig; 48 procedure SaveConfig; 49 procedure Init; 50 procedure Done; 51 procedure ProjectOpen(Directory: string); 44 52 end; 45 53 … … 52 60 53 61 uses 54 UFormMain ;62 UFormMain, UFormBrowse; 55 63 56 64 { TCore } … … 71 79 end; 72 80 81 procedure TCore.LastOpenedList1Change(Sender: TObject); 82 begin 83 LastOpenedList1.LoadToMenuItem(FormMain.MenuItemOpenRecent, FormMain.OpenRecentExecute); 84 end; 85 73 86 procedure TCore.UpdateInterface; 74 87 begin 75 88 AProjectClose.Enabled := Assigned(Project); 76 89 FormMain.UpdateInterface; 90 end; 91 92 procedure TCore.LoadConfig; 93 begin 94 LastOpenedList1.LoadFromXMLConfig(XMLConfig1, 'LastOpenedProjects'); 95 end; 96 97 procedure TCore.SaveConfig; 98 begin 99 LastOpenedList1.SaveToXMLConfig(XMLConfig1, 'LastOpenedProjects'); 100 end; 101 102 procedure TCore.Init; 103 begin 104 LoadConfig; 105 if (LastOpenedList1.Items.Count > 0) and DirectoryExistsUTF8(LastOpenedList1.Items[0]) then 106 ProjectOpen(LastOpenedList1.Items[0]); 107 end; 108 109 procedure TCore.Done; 110 begin 111 SaveConfig; 112 end; 113 114 procedure TCore.ProjectOpen(Directory: string); 115 begin 116 AProjectClose.Execute; 117 Project := TProject.Create; 118 Project.VCSType := vtSubversion; 119 Project.Directory := Directory; 120 UpdateInterface; 121 FormBrowse.Directory := Project.Directory; 122 FormBrowse.ReloadList; 123 LastOpenedList1.AddItem(Project.Directory); 77 124 end; 78 125 … … 85 132 else OldDir := ''; 86 133 if SelectDirectory('Open project', OldDir, Dir) then begin 87 AProjectClose.Execute; 88 Project := TProject.Create; 89 Project.Directory := Dir; 90 UpdateInterface; 134 ProjectOpen(Dir); 91 135 end; 92 136 end; -
trunk/Units/USubversion.pas
r5 r6 14 14 TSubversion = class(TWorkingCopy) 15 15 protected 16 procedure Execute( Command: string); override;16 procedure Execute(Parameters: array of string); 17 17 public 18 18 procedure Checkout; override; … … 28 28 { TSubversion } 29 29 30 procedure TSubversion.Execute(Command: string); 30 procedure TSubversion.Execute(Parameters: array of string); 31 var 32 Params: TStringList; 31 33 begin 32 inherited Execute('svn ' + Command); 34 Params := TStringList.Create; 35 try 36 Params.AddStrings(Parameters); 37 ExecuteProcess('svn', Params); 38 finally 39 Params.Free; 40 end; 33 41 end; 34 42 35 43 procedure TSubversion.Checkout; 36 44 begin 37 Execute( 'checkout');45 Execute(['checkout']); 38 46 end; 39 47 40 48 procedure TSubversion.Update; 41 49 begin 42 Execute( 'update');50 Execute(['update']); 43 51 end; 44 52 45 53 procedure TSubversion.CleanUp; 46 54 begin 47 Execute( 'cleanup');55 Execute(['cleanup']); 48 56 end; 49 57 50 58 procedure TSubversion.Commit; 51 59 begin 52 Execute( 'commit');60 Execute(['commit']); 53 61 end; 54 62 55 63 procedure TSubversion.Move; 56 64 begin 57 Execute( 'move');65 Execute(['move']); 58 66 end; 59 67 60 68 procedure TSubversion.Merge; 61 69 begin 62 Execute( 'merge');70 Execute(['merge']); 63 71 end; 64 72 -
trunk/Units/UVCS.pas
r5 r6 17 17 procedure SetPath(AValue: string); 18 18 protected 19 procedure Execute (Command: string); virtual;19 procedure ExecuteProcess(Command: string; Parameters: TStrings); virtual; 20 20 public 21 21 procedure Checkout; virtual; … … 48 48 end; 49 49 50 procedure TWorkingCopy.Execute (Command: string);50 procedure TWorkingCopy.ExecuteProcess(Command: string; Parameters: TStrings); 51 51 begin 52 FormConsole.Executable := 'svn';53 FormConsole.Parameters.A dd(Command);52 FormConsole.Executable := Command; 53 FormConsole.Parameters.Assign(Parameters); 54 54 FormConsole.WorkingDir := Path; 55 FormConsole. Perform;55 FormConsole.ShowModal; 56 56 end; 57 57 -
trunk/VCSCommander.lpi
r5 r6 67 67 </local> 68 68 </RunParams> 69 <RequiredPackages Count=" 1">69 <RequiredPackages Count="4"> 70 70 <Item1> 71 <PackageName Value="TemplateGenerics"/> 72 <DefaultFilename Value="Packages/TemplateGenerics/TemplateGenerics.lpk" Prefer="True"/> 73 </Item1> 74 <Item2> 75 <PackageName Value="FCL"/> 76 </Item2> 77 <Item3> 78 <PackageName Value="Common"/> 79 <DefaultFilename Value="Packages/Common/Common.lpk" Prefer="True"/> 80 </Item3> 81 <Item4> 71 82 <PackageName Value="LCL"/> 72 </Item 1>83 </Item4> 73 84 </RequiredPackages> 74 85 <Units Count="10"> -
trunk/VCSCommander.lpr
r5 r6 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 Forms, UFormMain, UCore, UFormBrowse, UVCS, UFormFavorites, UFormSettings,11 UForm Console, USubversion, UProject10 Forms, UFormMain, UCore, Common, TemplateGenerics, UFormBrowse, UVCS, 11 UFormFavorites, UFormSettings, UFormConsole, USubversion, UProject 12 12 { you can add units after this }; 13 13 … … 22 22 Application.CreateForm(TFormFavorites, FormFavorites); 23 23 Application.CreateForm(TFormSettings, FormSettings); 24 Application.CreateForm(TFormConsole, FormConsole); 24 25 Application.Run; 25 26 end.
Note:
See TracChangeset
for help on using the changeset viewer.