source: trunk/Forms/UFormOperation.pas

Last change on this file was 29, checked in by chronos, 9 years ago
  • Added: Random data pattern write operation.
  • Modified: Reversed list of operations so new ones are placed at top of the list.
  • Fixed: Error on openning recent file which not exists.
File size: 2.6 KB
Line 
1unit UFormOperation;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
9 Spin, UDriveScan;
10
11type
12
13 { TFormOperation }
14
15 TFormOperation = class(TForm)
16 ButtonOk: TButton;
17 ButtonCancel: TButton;
18 CheckBoxRandomPattern: TCheckBox;
19 ComboBoxRunMode: TComboBox;
20 EditPattern: TEdit;
21 Label2: TLabel;
22 Label3: TLabel;
23 Label9: TLabel;
24 SpinEditFirstSector: TSpinEdit;
25 SpinEditLastSector: TSpinEdit;
26 procedure CheckBoxRandomPatternChange(Sender: TObject);
27 procedure ComboBoxRunModeChange(Sender: TObject);
28 procedure SpinEditFirstSectorChange(Sender: TObject);
29 procedure SpinEditLastSectorChange(Sender: TObject);
30 private
31 procedure UpdateMaxValues;
32 procedure UpdateWritePattern;
33 public
34 procedure Load(DriveScan: TDriveScanProfile);
35 procedure Save(DriveScan: TDriveScanProfile);
36 end;
37
38var
39 FormOperation: TFormOperation;
40
41implementation
42
43{$R *.lfm}
44
45{ TFormOperation }
46
47procedure TFormOperation.SpinEditFirstSectorChange(Sender: TObject);
48begin
49 UpdateMaxValues;
50end;
51
52procedure TFormOperation.ComboBoxRunModeChange(Sender: TObject);
53begin
54 UpdateWritePattern;
55end;
56
57procedure TFormOperation.CheckBoxRandomPatternChange(Sender: TObject);
58begin
59 UpdateWritePattern;
60end;
61
62procedure TFormOperation.SpinEditLastSectorChange(Sender: TObject);
63begin
64 UpdateMaxValues;
65end;
66
67procedure TFormOperation.UpdateMaxValues;
68begin
69 SpinEditFirstSector.MaxValue := SpinEditLastSector.Value;
70 SpinEditLastSector.MinValue := SpinEditFirstSector.Value;
71end;
72
73procedure TFormOperation.UpdateWritePattern;
74begin
75 CheckBoxRandomPattern.Enabled := (ComboBoxRunMode.ItemIndex = Integer(rmWrite));
76 EditPattern.Enabled := not CheckBoxRandomPattern.Checked and (ComboBoxRunMode.ItemIndex = Integer(rmWrite));
77end;
78
79procedure TFormOperation.Load(DriveScan: TDriveScanProfile);
80begin
81 CheckBoxRandomPattern.Checked := DriveScan.WritePatternRandom;
82 UpdateWritePattern;
83 ComboBoxRunMode.ItemIndex := Integer(DriveScan.Mode);
84 EditPattern.Text := '$' + IntToHex(DriveScan.WritePattern, 2);
85 SpinEditLastSector.MaxValue := DriveScan.SectorCount - 1;
86 SpinEditFirstSector.Value := DriveScan.SectorStart;
87 SpinEditLastSector.Value := DriveScan.SectorEnd;
88 UpdateMaxValues;
89end;
90
91procedure TFormOperation.Save(DriveScan: TDriveScanProfile);
92begin
93 DriveScan.Mode := TRunMode(ComboBoxRunMode.ItemIndex);
94 DriveScan.WritePattern := StrToInt(EditPattern.Text);
95 DriveScan.SectorStart := SpinEditFirstSector.Value;
96 DriveScan.SectorEnd := SpinEditLastSector.Value;
97 DriveScan.WritePatternRandom := CheckBoxRandomPattern.Checked;
98end;
99
100end.
101
Note: See TracBrowser for help on using the repository browser.