Changeset 8 for trunk


Ignore:
Timestamp:
Apr 1, 2016, 12:04:16 AM (9 years ago)
Author:
chronos
Message:
  • Added: Reopen last openned project file.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/CoolDisk.lpi

    r4 r8  
    6464      </local>
    6565    </RunParams>
    66     <RequiredPackages Count="4">
     66    <RequiredPackages Count="5">
    6767      <Item1>
     68        <PackageName Value="FCL"/>
     69      </Item1>
     70      <Item2>
    6871        <PackageName Value="TemplateGenerics"/>
    6972        <DefaultFilename Value="Packages/TemplateGenerics/TemplateGenerics.lpk" Prefer="True"/>
    70       </Item1>
    71       <Item2>
     73      </Item2>
     74      <Item3>
    7275        <PackageName Value="Common"/>
    7376        <DefaultFilename Value="Packages/Common/Common.lpk" Prefer="True"/>
    74       </Item2>
    75       <Item3>
    76         <PackageName Value="tachartlazaruspkg"/>
    7777      </Item3>
    7878      <Item4>
     79        <PackageName Value="tachartlazaruspkg"/>
     80      </Item4>
     81      <Item5>
    7982        <PackageName Value="LCL"/>
    80       </Item4>
     83      </Item5>
    8184    </RequiredPackages>
    8285    <Units Count="8">
  • trunk/UDriveScan.pas

    r7 r8  
    222222    WriteInteger(Node, 'WritePattern', WritePattern);
    223223    WriteString(Node, 'DriveName', Drive);
     224    WriteDateTime(Node, 'TimeStart', TimeStart);
     225    WriteDateTime(Node, 'TimeEnd', TimeEnd);
    224226
    225227    NewNode := OwnerDocument.CreateElement('SectorMap');
     
    237239    WritePattern := ReadInteger(Node, 'WritePattern', 0);
    238240    Drive := ReadString(Node, 'DriveName', '');
     241    TimeStart := ReadDateTime(Node, 'TimeStart', 0);
     242    TimeEnd := ReadDateTime(Node, 'TimeEnd', 0);
    239243
    240244    NewNode := FindNode('SectorMap');
  • trunk/UFormMain.lfm

    r7 r8  
    322322    end
    323323  end
     324  object XMLConfig1: TXMLConfig
     325    StartEmpty = False
     326    RootName = 'CONFIG'
     327    ReadOnly = False
     328    left = 672
     329    top = 160
     330  end
    324331end
  • trunk/UFormMain.pas

    r7 r8  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    99  Menus, ComCtrls, ExtCtrls, ActnList, dateutils, syncobjs, UProject,
    10   UDriveScan, UPrefixMultiplier;
     10  UDriveScan, UPrefixMultiplier, XMLConf;
    1111
    1212type
     
    6262    SaveDialog1: TSaveDialog;
    6363    Timer1: TTimer;
     64    XMLConfig1: TXMLConfig;
    6465    procedure ABrowseDiskExecute(Sender: TObject);
    6566    procedure AExitExecute(Sender: TObject);
     
    7980    LastBlockPos: Integer;
    8081    RedrawPending: Boolean;
     82    LastProjectFileName: string;
     83    procedure ProjectOpen(FileName: string);
    8184    procedure DriveScanChange(Sender: TObject);
    8285    procedure DriveScanTerminate(Sender: TObject);
     
    8790    DriveScan: TDriveScan;
    8891    Project: TProject;
     92    procedure SaveConfig;
     93    procedure LoadConfig;
    8994    procedure Detect;
    9095    procedure ShowBuffer(Buffer: array of Byte);
     
    105110procedure TFormMain.FormShow(Sender: TObject);
    106111begin
     112  LoadConfig;
     113  if FileExists(LastProjectFileName) then
     114    ProjectOpen(LastProjectFileName);
    107115  Redraw;
    108116  UpdateInterface;
     
    123131  DriveScan.OnTerminate := DriveScanTerminate;
    124132  EditDrive.Text := '/dev/sdb';
     133  XMLConfig1.Filename := 'config.xml';
    125134end;
    126135
     
    169178  OpenDialog1.DefaultExt := '.cdp';
    170179  if OpenDialog1.Execute then begin
    171     Project.LoadFromFile(OpenDialog1.FileName);
     180    ProjectOpen(OpenDialog1.FileName);
    172181  end;
    173182end;
     
    184193procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    185194begin
     195  SaveConfig;
    186196end;
    187197
     
    252262end;
    253263
     264procedure TFormMain.SaveConfig;
     265begin
     266  XMLConfig1.SetValue('DriveName', EditDrive.Text);
     267  XMLConfig1.SetValue('LastProjectFileName', LastProjectFileName);
     268end;
     269
     270procedure TFormMain.LoadConfig;
     271begin
     272  EditDrive.Text := XMLConfig1.GetValue('DriveName', '/dev/sda');
     273  LastProjectFileName := XMLConfig1.GetValue('LastProjectFileName', '');
     274end;
     275
    254276procedure TFormMain.Timer1Timer(Sender: TObject);
    255277begin
    256278  Redraw;
     279end;
     280
     281procedure TFormMain.ProjectOpen(FileName: string);
     282begin
     283  Project.LoadFromFile(FileName);
     284  LastProjectFileName := FileName;
    257285end;
    258286
Note: See TracChangeset for help on using the changeset viewer.