Ignore:
Timestamp:
Apr 30, 2016, 12:16:19 AM (9 years ago)
Author:
chronos
Message:
  • Added: TFileStreamEx experimental class to support flags O_DIRECT and O_SYNC under Linux.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Form/UFormProject.pas

    r15 r31  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Spin,
    9   StdCtrls, UProject;
     9  StdCtrls, UProject, Math;
    1010
    1111type
     
    2222    Label3: TLabel;
    2323    Label4: TLabel;
     24    Label5: TLabel;
     25    Label6: TLabel;
    2426    LabelSectorCount: TLabel;
    2527    SpinEditSectorSize: TSpinEdit;
     28    procedure SpinEditSectorSizeChange(Sender: TObject);
    2629  private
     30    procedure UpdateSectorSize;
    2731  public
    2832    procedure Load(Project: TProject);
     
    4246{ TFormProject }
    4347
     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
    4458procedure TFormProject.Load(Project: TProject);
    4559begin
    4660  Core.DriveList.LoadToStrings(ComboBoxDrive.Items);
    4761  EditName.Text := Project.Name;
    48   SpinEditSectorSize.Value := Project.DriveInfo.SectorSize;
     62  SpinEditSectorSize.Value := Trunc(Log2(Project.DriveInfo.SectorSize));
    4963  ComboBoxDrive.ItemIndex := Core.DriveList.IndexOf(Core.DriveList.FindByModel(Project.DriveInfo.Model));
     64  UpdateSectorSize;
    5065end;
    5166
     
    5368begin
    5469  Project.Name := EditName.Text;
    55   Project.DriveInfo.SectorSize := SpinEditSectorSize.Value;
     70  Project.DriveInfo.SectorSize := Trunc(IntPower(2, SpinEditSectorSize.Value));
    5671end;
    5772
Note: See TracChangeset for help on using the changeset viewer.