1 | unit UFormProject;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Spin,
|
---|
9 | StdCtrls, UProject, Math;
|
---|
10 |
|
---|
11 | type
|
---|
12 |
|
---|
13 | { TFormProject }
|
---|
14 |
|
---|
15 | TFormProject = class(TForm)
|
---|
16 | Button1: TButton;
|
---|
17 | Button2: TButton;
|
---|
18 | ComboBoxDrive: TComboBox;
|
---|
19 | EditName: TEdit;
|
---|
20 | Label1: TLabel;
|
---|
21 | Label2: TLabel;
|
---|
22 | Label3: TLabel;
|
---|
23 | Label4: TLabel;
|
---|
24 | Label5: TLabel;
|
---|
25 | Label6: TLabel;
|
---|
26 | LabelSectorCount: TLabel;
|
---|
27 | SpinEditSectorSize: TSpinEdit;
|
---|
28 | procedure SpinEditSectorSizeChange(Sender: TObject);
|
---|
29 | private
|
---|
30 | procedure UpdateSectorSize;
|
---|
31 | public
|
---|
32 | procedure Load(Project: TProject);
|
---|
33 | procedure Save(Project: TProject);
|
---|
34 | end;
|
---|
35 |
|
---|
36 | var
|
---|
37 | FormProject: TFormProject;
|
---|
38 |
|
---|
39 | implementation
|
---|
40 |
|
---|
41 | {$R *.lfm}
|
---|
42 |
|
---|
43 | uses
|
---|
44 | UCore;
|
---|
45 |
|
---|
46 | { TFormProject }
|
---|
47 |
|
---|
48 | procedure TFormProject.SpinEditSectorSizeChange(Sender: TObject);
|
---|
49 | begin
|
---|
50 | UpdateSectorSize;
|
---|
51 | end;
|
---|
52 |
|
---|
53 | procedure TFormProject.UpdateSectorSize;
|
---|
54 | begin
|
---|
55 | Label6.Caption := '= ' + IntToStr(Trunc(IntPower(2, SpinEditSectorSize.Value))) + ' bytes';
|
---|
56 | end;
|
---|
57 |
|
---|
58 | procedure TFormProject.Load(Project: TProject);
|
---|
59 | begin
|
---|
60 | Core.DriveList.LoadToStrings(ComboBoxDrive.Items);
|
---|
61 | EditName.Text := Project.Name;
|
---|
62 | SpinEditSectorSize.Value := Trunc(Log2(Project.DriveInfo.SectorSize));
|
---|
63 | ComboBoxDrive.ItemIndex := Core.DriveList.IndexOf(Core.DriveList.FindByModel(Project.DriveInfo.Model));
|
---|
64 | UpdateSectorSize;
|
---|
65 | end;
|
---|
66 |
|
---|
67 | procedure TFormProject.Save(Project: TProject);
|
---|
68 | begin
|
---|
69 | Project.Name := EditName.Text;
|
---|
70 | Project.DriveInfo.SectorSize := Trunc(IntPower(2, SpinEditSectorSize.Value));
|
---|
71 | end;
|
---|
72 |
|
---|
73 | end.
|
---|
74 |
|
---|