Changeset 14 for trunk/Form
- Timestamp:
- Apr 2, 2016, 1:15:20 PM (9 years ago)
- Location:
- trunk/Form
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Form/UFormMain.lfm
r13 r14 354 354 Action = AFileOpen 355 355 end 356 object MenuItemOpenRecent: TMenuItem 357 Caption = 'Open recent' 358 end 356 359 object MenuItem9: TMenuItem 357 360 Action = AFileSave … … 403 406 top = 573 404 407 end 408 object LastOpenedList1: TLastOpenedList 409 MaxCount = 10 410 left = 906 411 top = 167 412 end 405 413 end -
trunk/Form/UFormMain.pas
r13 r14 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 9 Menus, ComCtrls, ExtCtrls, ActnList, dateutils, syncobjs, UProject, 10 UDriveScan, UPrefixMultiplier, XMLConf, UPhysDrive;10 UDriveScan, UPrefixMultiplier, ULastOpenedList, XMLConf, UPhysDrive; 11 11 12 12 type … … 54 54 LabelSize: TLabel; 55 55 LabelSectorPerBlock: TLabel; 56 LastOpenedList1: TLastOpenedList; 56 57 ListView1: TListView; 57 58 MainMenu1: TMainMenu; … … 63 64 MenuItem14: TMenuItem; 64 65 MenuItem15: TMenuItem; 66 MenuItemOpenRecent: TMenuItem; 65 67 MenuItem2: TMenuItem; 66 68 MenuItem3: TMenuItem; … … 103 105 LastBlockPos: Integer; 104 106 RedrawPending: Boolean; 105 LastProjectFileName: string;106 107 LastDriveName: string; 108 procedure OpenRecentClick(Sender: TObject); 107 109 procedure ReloadOperationList; 108 110 procedure ProjectOpen(FileName: string); … … 147 149 Detect; 148 150 LoadConfig; 149 if FileExists(LastProjectFileName) then150 ProjectOpen(Last ProjectFileName)151 if (LastOpenedList1.Items.Count > 0) then 152 ProjectOpen(LastOpenedList1.Items[0]) 151 153 else begin 152 154 AFileNew.Execute; … … 279 281 if SaveDialog1.Execute then begin 280 282 Project.SaveToFile(SaveDialog1.FileName); 283 LastOpenedList1.AddItem(SaveDialog1.FileName); 284 LastOpenedList1.LoadToMenuItem(MenuItemOpenRecent, OpenRecentClick); 281 285 UpdateInterface; 282 286 end; … … 289 293 else begin 290 294 Project.SaveToFile(Project.FileName); 295 LastOpenedList1.AddItem(SaveDialog1.FileName); 296 LastOpenedList1.LoadToMenuItem(MenuItemOpenRecent, OpenRecentClick); 291 297 UpdateInterface; 292 298 end; … … 437 443 begin 438 444 XMLConfig1.SetValue('DriveName', LastDriveName); 439 XMLConfig1.SetValue('LastProjectFileName', LastProjectFileName);445 LastOpenedList1.SaveToXMLConfig(XMLConfig1, 'RecentProjects'); 440 446 end; 441 447 … … 443 449 begin 444 450 LastDriveName := XMLConfig1.GetValue('DriveName', ''); 445 Last ProjectFileName := XMLConfig1.GetValue('LastProjectFileName', '');451 LastOpenedList1.LoadFromXMLConfig(XMLConfig1, 'RecentProjects'); 446 452 end; 447 453 … … 449 455 begin 450 456 Redraw; 457 end; 458 459 procedure TFormMain.OpenRecentClick(Sender: TObject); 460 begin 461 ProjectOpen(TMenuItem(Sender).Caption); 451 462 end; 452 463 … … 467 478 ComboBoxDrive.ItemIndex := DriveList.IndexOf(DriveList.FindByModel(Project.DriveInfo.Model)); 468 479 if (ComboBoxDrive.ItemIndex = -1) and (ComboBoxDrive.Items.Count > 0) then ComboBoxDrive.ItemIndex := 0; 469 LastProjectFileName := FileName; 480 LastOpenedList1.AddItem(FileName); 481 LastOpenedList1.LoadToMenuItem(MenuItemOpenRecent, OpenRecentClick); 470 482 UpdateInterface; 471 483 Redraw; … … 483 495 484 496 procedure TFormMain.Detect; 485 var486 I: Integer;487 497 begin 488 498 DriveList.Detect;
Note:
See TracChangeset
for help on using the changeset viewer.