Changeset 6 for trunk/UCore.pas
- Timestamp:
- May 6, 2015, 11:19:49 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.