Changeset 8 for trunk/UFormMain.pas
- Timestamp:
- Apr 1, 2016, 12:04:16 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UFormMain.pas
r7 r8 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 9 Menus, ComCtrls, ExtCtrls, ActnList, dateutils, syncobjs, UProject, 10 UDriveScan, UPrefixMultiplier ;10 UDriveScan, UPrefixMultiplier, XMLConf; 11 11 12 12 type … … 62 62 SaveDialog1: TSaveDialog; 63 63 Timer1: TTimer; 64 XMLConfig1: TXMLConfig; 64 65 procedure ABrowseDiskExecute(Sender: TObject); 65 66 procedure AExitExecute(Sender: TObject); … … 79 80 LastBlockPos: Integer; 80 81 RedrawPending: Boolean; 82 LastProjectFileName: string; 83 procedure ProjectOpen(FileName: string); 81 84 procedure DriveScanChange(Sender: TObject); 82 85 procedure DriveScanTerminate(Sender: TObject); … … 87 90 DriveScan: TDriveScan; 88 91 Project: TProject; 92 procedure SaveConfig; 93 procedure LoadConfig; 89 94 procedure Detect; 90 95 procedure ShowBuffer(Buffer: array of Byte); … … 105 110 procedure TFormMain.FormShow(Sender: TObject); 106 111 begin 112 LoadConfig; 113 if FileExists(LastProjectFileName) then 114 ProjectOpen(LastProjectFileName); 107 115 Redraw; 108 116 UpdateInterface; … … 123 131 DriveScan.OnTerminate := DriveScanTerminate; 124 132 EditDrive.Text := '/dev/sdb'; 133 XMLConfig1.Filename := 'config.xml'; 125 134 end; 126 135 … … 169 178 OpenDialog1.DefaultExt := '.cdp'; 170 179 if OpenDialog1.Execute then begin 171 Project .LoadFromFile(OpenDialog1.FileName);180 ProjectOpen(OpenDialog1.FileName); 172 181 end; 173 182 end; … … 184 193 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 185 194 begin 195 SaveConfig; 186 196 end; 187 197 … … 252 262 end; 253 263 264 procedure TFormMain.SaveConfig; 265 begin 266 XMLConfig1.SetValue('DriveName', EditDrive.Text); 267 XMLConfig1.SetValue('LastProjectFileName', LastProjectFileName); 268 end; 269 270 procedure TFormMain.LoadConfig; 271 begin 272 EditDrive.Text := XMLConfig1.GetValue('DriveName', '/dev/sda'); 273 LastProjectFileName := XMLConfig1.GetValue('LastProjectFileName', ''); 274 end; 275 254 276 procedure TFormMain.Timer1Timer(Sender: TObject); 255 277 begin 256 278 Redraw; 279 end; 280 281 procedure TFormMain.ProjectOpen(FileName: string); 282 begin 283 Project.LoadFromFile(FileName); 284 LastProjectFileName := FileName; 257 285 end; 258 286
Note:
See TracChangeset
for help on using the changeset viewer.