Changeset 34


Ignore:
Timestamp:
Dec 10, 2016, 10:00:19 PM (7 years ago)
Author:
chronos
Message:
  • Added: Interface localization support.
  • Added: Global settings dialog.
Location:
trunk
Files:
6 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/CoolDisk.lpi

    r33 r34  
    8989      </Item6>
    9090    </RequiredPackages>
    91     <Units Count="13">
     91    <Units Count="14">
    9292      <Unit0>
    9393        <Filename Value="CoolDisk.lpr"/>
     
    135135        <Filename Value="Forms/UFormBenchmark.pas"/>
    136136        <IsPartOfProject Value="True"/>
    137         <HasResources Value="True"/>
     137        <ComponentName Value="FormBenchmark"/>
     138        <HasResources Value="True"/>
     139        <ResourceBaseClass Value="Form"/>
    138140      </Unit9>
    139141      <Unit10>
     
    147149        <Filename Value="Forms/UFormOperation.pas"/>
    148150        <IsPartOfProject Value="True"/>
    149         <HasResources Value="True"/>
     151        <ComponentName Value="FormOperation"/>
     152        <HasResources Value="True"/>
     153        <ResourceBaseClass Value="Form"/>
    150154      </Unit11>
    151155      <Unit12>
    152156        <Filename Value="Forms/UFormProject.pas"/>
    153157        <IsPartOfProject Value="True"/>
    154         <HasResources Value="True"/>
     158        <ComponentName Value="FormProject"/>
     159        <HasResources Value="True"/>
     160        <ResourceBaseClass Value="Form"/>
    155161      </Unit12>
     162      <Unit13>
     163        <Filename Value="Forms/UFormSettings.pas"/>
     164        <IsPartOfProject Value="True"/>
     165        <ComponentName Value="FormSettings"/>
     166        <HasResources Value="True"/>
     167        <ResourceBaseClass Value="Form"/>
     168      </Unit13>
    156169    </Units>
    157170  </ProjectOptions>
     
    182195        <StackChecks Value="True"/>
    183196      </Checks>
    184       <VerifyObjMethodCallValidity Value="True"/>
    185197    </CodeGeneration>
    186198    <Linking>
  • trunk/CoolDisk.lpr

    r33 r34  
    99  Interfaces, // this includes the LCL widgetset
    1010  Forms, tachartlazaruspkg, UProject,
    11   UConfig, UBlockMap, UDriveScan, Common, TemplateGenerics,
    12   UPhysDrive, UCore, UFileStreamEx, CoolTranslator, UFormMain;
     11  UConfig, UBlockMap, UDriveScan, Common, TemplateGenerics, UFormProject,
     12  UPhysDrive, UCore, UFileStreamEx, CoolTranslator, UFormMain, UFormBenchmark,
     13  UFormOperation;
    1314
    1415{$R *.res}
     
    1920  Application.CreateForm(TCore, Core);
    2021  Application.CreateForm(TFormMain, FormMain);
     22  Application.CreateForm(TFormProject, FormProject);
     23  Application.CreateForm(TFormOperation, FormOperation);
     24  Application.CreateForm(TFormBenchmark, FormBenchmark);
    2125  Application.Run;
    2226end.
  • trunk/Forms/UFormMain.lfm

    r33 r34  
    1919    Top = 0
    2020    Width = 1703
    21     Caption = 'ToolBar1'
    2221    Images = Core.ImageList1
    2322    TabOrder = 0
     
    482481      OnExecute = AShowAboutExecute
    483482    end
     483    object AShowSettings: TAction
     484      Caption = 'Settings'
     485      OnExecute = AShowSettingsExecute
     486    end
    484487  end
    485488  object OpenDialog1: TOpenDialog
     
    549552      end
    550553    end
     554    object MenuItem22: TMenuItem
     555      Caption = 'Tools'
     556      object MenuItem23: TMenuItem
     557        Action = AShowSettings
     558      end
     559    end
    551560    object MenuItem20: TMenuItem
    552561      Caption = 'Help'
  • trunk/Forms/UFormMain.lrt

    r33 r34  
    11TFORMMAIN.CAPTION=CoolDisk
    2 TFORMMAIN.TOOLBAR1.CAPTION=ToolBar1
    32TFORMMAIN.LABEL1.CAPTION=Sector size:
    43TFORMMAIN.LABELSECTORSIZE.CAPTION= 
     
    4342TFORMMAIN.AOPERATIONADD.CAPTION=Add
    4443TFORMMAIN.ASHOWABOUT.CAPTION=About
     44TFORMMAIN.ASHOWSETTINGS.CAPTION=Settings
    4545TFORMMAIN.MENUITEM1.CAPTION=File
    4646TFORMMAIN.MENUITEMOPENRECENT.CAPTION=Open recent
     
    4949TFORMMAIN.MENUITEM14.CAPTION=-
    5050TFORMMAIN.MENUITEM16.CAPTION=View
     51TFORMMAIN.MENUITEM22.CAPTION=Tools
    5152TFORMMAIN.MENUITEM20.CAPTION=Help
  • trunk/Forms/UFormMain.pas

    r33 r34  
    1515
    1616  TFormMain = class(TForm)
     17    AShowSettings: TAction;
    1718    AShowAbout: TAction;
    1819    AOperationAdd: TAction;
     
    8081    MenuItem20: TMenuItem;
    8182    MenuItem21: TMenuItem;
     83    MenuItem22: TMenuItem;
     84    MenuItem23: TMenuItem;
    8285    MenuItemOpenRecent: TMenuItem;
    8386    MenuItem2: TMenuItem;
     
    119122    procedure AScanStopExecute(Sender: TObject);
    120123    procedure AShowAboutExecute(Sender: TObject);
     124    procedure AShowSettingsExecute(Sender: TObject);
    121125    procedure AViewToolbarExecute(Sender: TObject);
    122126    procedure ComboBoxDriveChange(Sender: TObject);
     
    162166
    163167uses
    164   UCore, UFormProject, UFormOperation, UFormAbout;
     168  UCore, UFormProject, UFormOperation, UFormAbout, UFormSettings;
    165169
    166170resourcestring
     
    180184  Detect;
    181185  LoadConfig;
     186  Core.LoadConfig;
    182187  Core.PersistentForm1.Load(Self);
    183188  if (LastOpenedList1.Items.Count > 0) and FileExists(LastOpenedList1.Items[0]) then
     
    234239
    235240procedure TFormMain.AShowAboutExecute(Sender: TObject);
    236 var
    237   FormAbout: TFormAbout;
    238241begin
    239242  FormAbout := TFormAbout.Create(nil);
     
    243246  finally
    244247    FreeAndNil(FormAbout);
     248  end;
     249end;
     250
     251procedure TFormMain.AShowSettingsExecute(Sender: TObject);
     252begin
     253  FormSettings := TFormSettings.Create(nil);
     254  try
     255    FormSettings.Load;
     256    if FormSettings.ShowModal = mrOK then
     257      FormSettings.Save;
     258  finally
     259    FreeAndNil(FormSettings);
    245260  end;
    246261end;
     
    417432  AFileClose.Execute;
    418433  SaveConfig;
     434  Core.SaveConfig;
    419435  Core.PersistentForm1.Save(Self);
    420436end;
  • trunk/UCore.lfm

    r33 r34  
    4747    top = 56
    4848  end
     49  object ScaleDPI1: TScaleDPI
     50    AutoDetect = False
     51    left = 88
     52    top = 200
     53  end
    4954end
  • trunk/UCore.pas

    r33 r34  
    77uses
    88  Classes, SysUtils, XMLConf, FileUtil, Controls, UProject, UPhysDrive,
    9   UCoolTranslator, UPersistentForm, UApplicationInfo;
     9  UCoolTranslator, UPersistentForm, UApplicationInfo, URegistry, UScaleDPI;
    1010
    1111type
     
    1818    ImageList1: TImageList;
    1919    PersistentForm1: TPersistentForm;
     20    ScaleDPI1: TScaleDPI;
    2021    XMLConfig1: TXMLConfig;
    2122    procedure DataModuleCreate(Sender: TObject);
    2223    procedure DataModuleDestroy(Sender: TObject);
    2324  private
    24     { private declarations }
     25    RegistryContext: TRegistryContext;
    2526  public
     27    DevelMode: Boolean;
    2628    DriveList: TDriveList;
    2729    Project: TProject;
     30    procedure LoadConfig;
     31    procedure SaveConfig;
    2832  end;
    2933
     
    5155end;
    5256
     57procedure TCore.LoadConfig;
     58begin
     59  RegistryContext := RegContext(Integer(ApplicationInfo1.RegistryRoot), ApplicationInfo1.RegistryKey);
     60  PersistentForm1.RegistryContext := RegistryContext;
     61  XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml';
     62
     63  CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(XMLConfig1.GetValue('Language', ''));
     64end;
     65
     66procedure TCore.SaveConfig;
     67begin
     68  XMLConfig1.SetValue('Language', CoolTranslator1.Language.Code);
     69end;
     70
    5371end.
    5472
Note: See TracChangeset for help on using the changeset viewer.