source: trunk/Forms/UFormProject.pas

Last change on this file was 31, checked in by chronos, 9 years ago
  • Added: TFileStreamEx experimental class to support flags O_DIRECT and O_SYNC under Linux.
File size: 1.5 KB
Line 
1unit UFormProject;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Spin,
9 StdCtrls, UProject, Math;
10
11type
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
36var
37 FormProject: TFormProject;
38
39implementation
40
41{$R *.lfm}
42
43uses
44 UCore;
45
46{ TFormProject }
47
48procedure TFormProject.SpinEditSectorSizeChange(Sender: TObject);
49begin
50 UpdateSectorSize;
51end;
52
53procedure TFormProject.UpdateSectorSize;
54begin
55 Label6.Caption := '= ' + IntToStr(Trunc(IntPower(2, SpinEditSectorSize.Value))) + ' bytes';
56end;
57
58procedure TFormProject.Load(Project: TProject);
59begin
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;
65end;
66
67procedure TFormProject.Save(Project: TProject);
68begin
69 Project.Name := EditName.Text;
70 Project.DriveInfo.SectorSize := Trunc(IntPower(2, SpinEditSectorSize.Value));
71end;
72
73end.
74
Note: See TracBrowser for help on using the repository browser.