Changeset 15 for trunk/StudioPackage/Forms
- Timestamp:
- Aug 6, 2012, 2:35:22 PM (12 years ago)
- Location:
- trunk/StudioPackage/Forms
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/StudioPackage/Forms/UFormMain.lfm
r14 r15 1 1 object FormMain: TFormMain 2 Left = 1502 Left = 240 3 3 Height = 520 4 Top = 1 124 Top = 108 5 5 Width = 747 6 6 Caption = 'LibreDevelop Studio' … … 27 27 Width = 747 28 28 Caption = 'ToolBar1' 29 Images = DataModule1.ImageListMain 29 30 TabOrder = 1 30 31 object ToolButton1: TToolButton 31 32 Left = 1 32 Hint = 'New project'33 33 Top = 2 34 Caption = 'New...' 35 ImageIndex = 4 34 Action = AFileNew 36 35 end 37 36 object ToolButton2: TToolButton 38 37 Left = 24 39 Hint = 'Open project'40 38 Top = 2 41 Caption = 'Open...' 42 ImageIndex = 8 39 Action = AFileOpen 40 DropdownMenu = PopupMenuRecentFiles 41 Style = tbsDropDown 43 42 end 44 43 object ToolButton3: TToolButton 45 Left = 47 46 Hint = 'Save project' 44 Left = 59 47 45 Top = 2 48 Caption = 'Save' 49 ImageIndex = 13 46 Action = AFileSaveAs 50 47 end 51 48 object ToolButton4: TToolButton 52 Left = 70 53 Hint = 'Close project' 49 Left = 82 54 50 Top = 2 55 Caption = 'Close' 56 ImageIndex = 3 51 Action = AFileClose 57 52 end 58 53 end … … 117 112 Action = AFileOpen 118 113 end 119 object MenuItem29: TMenuItem 120 Action = AFileOpenRecent 114 object MenuItemFileOpenRecent: TMenuItem 115 Caption = 'Open recent' 116 ImageIndex = 8 117 OnClick = MenuItemFileOpenRecentClick 121 118 end 122 119 object MenuItem30: TMenuItem … … 313 310 Caption = 'Open recent' 314 311 ImageIndex = 8 312 OnExecute = AFileOpenRecentExecute 315 313 end 316 314 object AFileSave: TAction … … 318 316 Caption = 'Save' 319 317 ImageIndex = 13 318 OnExecute = AFileSaveExecute 320 319 ShortCut = 16467 321 320 end … … 324 323 Caption = 'Save as...' 325 324 ImageIndex = 13 325 OnExecute = AFileSaveAsExecute 326 326 ShortCut = 24659 327 327 end … … 387 387 top = 272 388 388 end 389 object LastOpenedList1: TLastOpenedList 390 MaxCount = 10 391 OnChange = LastOpenedList1Change 392 left = 80 393 top = 160 394 end 395 object PopupMenuRecentFiles: TPopupMenu 396 Images = DataModule1.ImageListMain 397 left = 259 398 top = 69 399 end 389 400 end -
trunk/StudioPackage/Forms/UFormMain.lrt
r14 r15 1 1 TFORMMAIN.CAPTION=LibreDevelop Studio 2 2 TFORMMAIN.TOOLBAR1.CAPTION=ToolBar1 3 TFORMMAIN.TOOLBUTTON1.HINT=New project4 TFORMMAIN.TOOLBUTTON1.CAPTION=New...5 TFORMMAIN.TOOLBUTTON2.HINT=Open project6 TFORMMAIN.TOOLBUTTON2.CAPTION=Open...7 TFORMMAIN.TOOLBUTTON3.HINT=Save project8 TFORMMAIN.TOOLBUTTON3.CAPTION=Save9 TFORMMAIN.TOOLBUTTON4.HINT=Close project10 TFORMMAIN.TOOLBUTTON4.CAPTION=Close11 3 TFORMMAIN.MENUITEM26.CAPTION=File 4 TFORMMAIN.MENUITEMFILEOPENRECENT.CAPTION=Open recent 12 5 TFORMMAIN.MENUITEM33.CAPTION=- 13 6 TFORMMAIN.MENUITEM2.CAPTION=Edit -
trunk/StudioPackage/Forms/UFormMain.pas
r14 r15 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus, 9 ActnList, ComCtrls, ExtCtrls, UDataModule; 9 ActnList, ComCtrls, ExtCtrls, ULastOpenedList, UCoolTranslator, UDataModule, 10 URegistry; 10 11 11 12 type … … 44 45 AClipboardCut: TAction; 45 46 ActionListMain: TActionList; 47 LastOpenedList1: TLastOpenedList; 46 48 MainMenu: TMainMenu; 47 49 MenuItem15: TMenuItem; … … 60 62 MenuItem27: TMenuItem; 61 63 MenuItem28: TMenuItem; 62 MenuItem 29: TMenuItem;64 MenuItemFileOpenRecent: TMenuItem; 63 65 MenuItem30: TMenuItem; 64 66 MenuItem31: TMenuItem; … … 89 91 PageControlBottom: TPageControl; 90 92 PageControlCenter: TPageControl; 93 PopupMenuRecentFiles: TPopupMenu; 91 94 SaveDialogFile: TSaveDialog; 92 95 Splitter1: TSplitter; … … 102 105 procedure AFileNewExecute(Sender: TObject); 103 106 procedure AFileOpenExecute(Sender: TObject); 107 procedure AFileOpenRecentExecute(Sender: TObject); 108 procedure AFileSaveAsExecute(Sender: TObject); 109 procedure AFileSaveExecute(Sender: TObject); 104 110 procedure AViewModulesExecute(Sender: TObject); 105 111 procedure AViewSettingsExecute(Sender: TObject); … … 108 114 procedure FormDestroy(Sender: TObject); 109 115 procedure FormShow(Sender: TObject); 116 procedure LastOpenedList1Change(Sender: TObject); 117 procedure MenuItemFileOpenRecentClick(Sender: TObject); 110 118 private 111 119 procedure DockInit; 112 120 public 121 procedure UpdateInterface; 113 122 procedure OpenedFileChange(Sender: TObject); 123 procedure LoadFromRegistry(Context: TRegistryContext); 124 procedure SaveToRegistry(Context: TRegistryContext); 114 125 end; 115 126 … … 117 128 FormMain: TFormMain; 118 129 130 119 131 implementation 120 132 … … 122 134 123 135 uses 124 UFormSourceCode, UFormSettings, UFormModuleList ;136 UFormSourceCode, UFormSettings, UFormModuleList, UFormNewFile, USource; 125 137 126 138 { TFormMain } … … 133 145 procedure TFormMain.AFileCloseExecute(Sender: TObject); 134 146 begin 135 DataModule1.OpenedFiles.CloseFile(DataModule1.OpenedFiles.Selected .FileName);147 DataModule1.OpenedFiles.CloseFile(DataModule1.OpenedFiles.Selected); 136 148 end; 137 149 138 150 procedure TFormMain.AFileNewExecute(Sender: TObject); 139 begin 140 DataModule1.OpenedFiles.NewFile; 151 var 152 NewFile: TSource; 153 begin 154 if FormNewFile.ShowModal = mrOk then 155 if Assigned(FormNewFile.ListView1.Selected) then begin 156 NewFile := TFileTemplate(FormNewFile.ListView1.Selected.Data).Execute; 157 DataModule1.OpenedFiles.OpenFile(NewFile); 158 end; 141 159 end; 142 160 … … 145 163 OpenDialogFile.Filter := DataModule1.FileTypes.GetDialogFilter; 146 164 if OpenDialogFile.Execute then begin 147 DataModule1.OpenedFiles.OpenFile(OpenDialogFile.FileName); 148 end; 165 LastOpenedList1.AddItem(OpenDialogFile.FileName); 166 DataModule1.OpenedFiles.OpenFileName(OpenDialogFile.FileName); 167 end; 168 end; 169 170 procedure TFormMain.AFileOpenRecentExecute(Sender: TObject); 171 begin 172 if Sender is TMenuItem then 173 DataModule1.OpenedFiles.OpenFileName(TMenuItem(Sender).Caption); 174 end; 175 176 procedure TFormMain.AFileSaveAsExecute(Sender: TObject); 177 begin 178 SaveDialogFile.FileName := DataModule1.OpenedFiles.Selected.Name; 179 if SaveDialogFile.Execute then begin 180 LastOpenedList1.AddItem(SaveDialogFile.FileName); 181 DataModule1.OpenedFiles.Selected.Name := SaveDialogFile.FileName; 182 end; 183 end; 184 185 procedure TFormMain.AFileSaveExecute(Sender: TObject); 186 begin 187 149 188 end; 150 189 … … 177 216 begin 178 217 DockInit; 218 UpdateInterface; 219 end; 220 221 procedure TFormMain.LastOpenedList1Change(Sender: TObject); 222 begin 223 LastOpenedList1.LoadToMenuItem(PopupMenuRecentFiles.Items, AFileOpenRecentExecute); 224 LastOpenedList1.LoadToMenuItem(MenuItemFileOpenRecent, AFileOpenRecentExecute); 225 end; 226 227 procedure TFormMain.MenuItemFileOpenRecentClick(Sender: TObject); 228 begin 229 179 230 end; 180 231 … … 186 237 }end; 187 238 239 procedure TFormMain.UpdateInterface; 240 begin 241 AFileClose.Enabled := Assigned(DataModule1.OpenedFiles.Selected); 242 AFileSave.Enabled := Assigned(DataModule1.OpenedFiles.Selected); 243 AFileSaveAs.Enabled := Assigned(DataModule1.OpenedFiles.Selected); 244 end; 245 188 246 procedure TFormMain.OpenedFileChange(Sender: TObject); 189 247 var … … 193 251 with DataModule1.OpenedFiles do begin 194 252 for I := 0 to Count - 1 do 195 with T OpenedFile(Items[I]) do begin253 with TSource(Items[I]) do begin 196 254 if not Assigned(Form.Parent) then begin 197 255 NewTabSheet := PageControlCenter.AddTabSheet; 198 NewTabSheet.Caption := ExtractFileName( FileName);256 NewTabSheet.Caption := ExtractFileName(Name); 199 257 //NewTabSheet.PopupMenu := ; 200 258 Form.ManualDock(NewTabSheet, nil, alClient); … … 206 264 end; 207 265 266 procedure TFormMain.LoadFromRegistry(Context: TRegistryContext); 267 begin 268 LastOpenedList1.LoadFromRegistry(Context.RootKey, Context.Key + '\RecentFiles'); 269 end; 270 271 procedure TFormMain.SaveToRegistry(Context: TRegistryContext); 272 begin 273 LastOpenedList1.SaveToRegistry(Context.RootKey, Context.Key + '\RecentFiles'); 274 end; 275 208 276 end. 209 277
Note:
See TracChangeset
for help on using the changeset viewer.