Changeset 15 for trunk/StudioModules/LDModuleProject/ULDModuleProject.pas
- Timestamp:
- Aug 6, 2012, 2:35:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StudioModules/LDModuleProject/ULDModuleProject.pas
r14 r15 7 7 uses 8 8 Classes, SysUtils, FileUtil, ActnList, Menus, Dialogs, UModularSystem, 9 U Project;9 ULastOpenedList, UProject, URegistry, USource; 10 10 11 11 type … … 22 22 ANew: TAction; 23 23 ActionList1: TActionList; 24 LastOpenedList1: TLastOpenedList; 24 25 MenuItem1: TMenuItem; 25 26 MenuItem2: TMenuItem; 26 MenuItem 3: TMenuItem;27 MenuItemOpenRecent: TMenuItem; 27 28 MenuItem4: TMenuItem; 28 29 MenuItem5: TMenuItem; … … 36 37 procedure ANewExecute(Sender: TObject); 37 38 procedure AOpenExecute(Sender: TObject); 39 procedure AOpenRecentExecute(Sender: TObject); 38 40 procedure AProjectManagerExecute(Sender: TObject); 39 41 procedure ASaveAsExecute(Sender: TObject); 40 42 procedure ASaveExecute(Sender: TObject); 43 procedure DataModuleCreate(Sender: TObject); 41 44 procedure DataModuleDestroy(Sender: TObject); 45 procedure LastOpenedList1Change(Sender: TObject); 42 46 private 43 47 { private declarations } … … 45 49 Project: TProject; 46 50 procedure UpdateInterface; 51 procedure LoadFromRegistry(Context: TRegistryContext); 52 procedure SaveToRegistry(Context: TRegistryContext); 47 53 end; 48 54 … … 51 57 TLDModuleProject = class(TModule) 52 58 private 59 ProjectFileType: TSourceType; 53 60 public 54 61 constructor Create; override; … … 93 100 end; 94 101 102 procedure TDataModuleProject.DataModuleCreate(Sender: TObject); 103 begin 104 105 end; 106 95 107 procedure TDataModuleProject.DataModuleDestroy(Sender: TObject); 96 108 begin 97 109 AClose.Execute; 110 end; 111 112 procedure TDataModuleProject.LastOpenedList1Change(Sender: TObject); 113 begin 114 LastOpenedList1.LoadToMenuItem(MenuItemOpenRecent, AOpenRecentExecute); 98 115 end; 99 116 … … 103 120 ASaveAs.Enabled := Assigned(Project); 104 121 AClose.Enabled := Assigned(Project); 122 end; 123 124 procedure TDataModuleProject.LoadFromRegistry(Context: TRegistryContext); 125 begin 126 LastOpenedList1.LoadFromRegistry(Context.RootKey, Context.Key + '\RecentFile'); 127 end; 128 129 procedure TDataModuleProject.SaveToRegistry(Context: TRegistryContext); 130 begin 131 LastOpenedList1.SaveToRegistry(Context.RootKey, Context.Key + '\RecentFile'); 105 132 end; 106 133 … … 122 149 procedure TDataModuleProject.AOpenExecute(Sender: TObject); 123 150 begin 124 OpenDialog1.FileName := Project.FileName; 151 if Assigned(Project) then 152 OpenDialog1.FileName := Project.FileName; 125 153 if OpenDialog1.Execute then begin 126 154 Project.FileName := OpenDialog1.FileName; … … 128 156 UpdateInterface; 129 157 end; 158 end; 159 160 procedure TDataModuleProject.AOpenRecentExecute(Sender: TObject); 161 begin 162 130 163 end; 131 164 … … 150 183 DataModuleProject.PopupMenu1.Items.Caption := SProject; 151 184 RegisterMainMenuItem(DataModuleProject.PopupMenu1.Items, nil, 1); 185 DataModuleProject.LoadFromRegistry(RegContext(GetRegistryContext.RootKey, 186 GetRegistryContext.Key + '\Project')); 187 DataModuleProject.UpdateInterface; 188 ProjectFileType := TSourceType.Create; 189 ProjectFileType.Extension := '.ldp'; 190 ProjectFileType.Title := 'LibreDevelop project'; 191 RegisterFileType(ProjectFileType); 152 192 end; 153 193 inherited; … … 158 198 inherited; 159 199 with TLDStudioAPI(API) do begin 200 UnregisterFileType(ProjectFileType); 201 DataModuleProject.SaveToRegistry(RegContext(GetRegistryContext.RootKey, 202 GetRegistryContext.Key + '\Project')); 160 203 UnregisterMainMenuItem(DataModuleProject.PopupMenu1.Items); 161 204 FreeAndNil(DataModuleProject);
Note:
See TracChangeset
for help on using the changeset viewer.