Changeset 37 for trunk/UCore.pas


Ignore:
Timestamp:
May 9, 2018, 1:22:44 PM (7 years ago)
Author:
chronos
Message:
  • Added: Multi-lingual support.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        33lib
        44backup
         5LibrePaint.exe
         6*.lrj
  • trunk/UCore.pas

    r36 r37  
    66
    77uses
    8   Classes, SysUtils, FileUtil, ActnList, UProject, UFGraphics, UPersistentForm,
    9   Controls, Graphics, ExtDlgs, ExtCtrls, URegistry, UApplicationInfo, Registry;
     8  Classes, SysUtils, FileUtil, ActnList, UProject, UCoolTranslator, UFGraphics,
     9  UPersistentForm, Controls, Graphics, ExtDlgs, ExtCtrls, URegistry,
     10  UApplicationInfo, Registry;
    1011
    1112const
     
    1617
    1718  TCore = class(TDataModule)
     19    ASettings: TAction;
    1820    AToolMove: TAction;
    1921    AToolPen: TAction;
     
    3638    AFileNew: TAction;
    3739    ActionList1: TActionList;
     40    CoolTranslator1: TCoolTranslator;
    3841    ImageList1: TImageList;
    3942    OpenPictureDialog1: TOpenPictureDialog;
     
    5255    procedure AImageNegativeExecute(Sender: TObject);
    5356    procedure AImageRandomExecute(Sender: TObject);
     57    procedure ASettingsExecute(Sender: TObject);
    5458    procedure AToolMoveExecute(Sender: TObject);
    5559    procedure AToolPenExecute(Sender: TObject);
     
    8286uses
    8387  UFormNew, UFormMain, Forms, UColorRGBA8, UColorGray8, UColorGray1, UColorGray4,
    84   UColorRGB565;
     88  UColorRGB565, UFormSettings;
    8589
    8690{ TCore }
     
    151155    LastImageSize.X := ReadIntegerWithDefault('LastImageSizeX', 600);
    152156    LastImageSize.Y := ReadIntegerWithDefault('LastImageSizeY', 400);
     157    if ValueExists('LanguageCode') then
     158      CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))
     159      else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('');
    153160  finally
    154161    Free;
     
    166173    WriteInteger('LastImageSizeX', LastImageSize.X);
    167174    WriteInteger('LastImageSizeY', LastImageSize.Y);
     175    if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then
     176      WriteString('LanguageCode', CoolTranslator1.Language.Code)
     177      else DeleteValue('LanguageCode');
    168178  finally
    169179    Free;
     
    300310end;
    301311
     312procedure TCore.ASettingsExecute(Sender: TObject);
     313begin
     314  FormSettings := TFormSettings.Create(nil);
     315  try
     316    FormSettings.Load;
     317    if FormSettings.ShowModal = mrOk then begin
     318      FormSettings.Save;
     319    end;
     320  finally
     321    FormSettings.Free;
     322  end;
     323end;
     324
    302325procedure TCore.AToolMoveExecute(Sender: TObject);
    303326begin
Note: See TracChangeset for help on using the changeset viewer.