Changeset 567


Ignore:
Timestamp:
Jun 30, 2023, 10:09:00 PM (17 months ago)
Author:
chronos
Message:
  • Modified: Improved TFormEx class.
Location:
Common
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • Common/FormEx.pas

    r566 r567  
    44
    55uses
    6   Classes, SysUtils, Forms, PersistentForm, Theme, Translator;
     6  Classes, SysUtils, Forms, PersistentForm, Theme, Translator, ScaleDPI;
    77
    88type
     
    1313  private
    1414    FCounter: Integer; static;
     15  protected
     16    procedure DoShow; override;
     17    procedure DoCreate; override;
     18    procedure DoClose(var CloseAction: TCloseAction); override;
     19    procedure DoDestroy; override;
    1520  public
    1621    PersistentForm: TPersistentForm; static;
    1722    ThemeManager: TThemeManager; static;
    1823    Translator: TTranslator; static;
    19     procedure DoShow; override;
    20     procedure DoCreate; override;
    21     procedure DoClose(var CloseAction: TCloseAction); override;
    22     procedure DoDestroy; override;
     24    ScaleDPI: TScaleDPI; static;
     25    OwnsPersistentForm: Boolean; static;
     26    OwnsThemeManager: Boolean; static;
     27    OwnsTranslator: Boolean; static;
     28    OwnsScaleDPI: Boolean; static;
    2329  end;
    2430
     
    4349procedure TFormEx.DoCreate;
    4450begin
    45   if not Assigned(PersistentForm) then
     51  if not Assigned(PersistentForm) then begin
     52    OwnsPersistentForm := True;
    4653    PersistentForm := TPersistentForm.Create(nil);
    47   if not Assigned(ThemeManager) then
     54  end;
     55  if not Assigned(ThemeManager) then begin
     56    OwnsThemeManager := True;
    4857    ThemeManager := TThemeManager.Create(nil);
     58  end;
    4959  if not Assigned(Translator) then begin
    5060    Translator := TTranslator.Create(nil);
    5161    Translator.POFilesFolder := 'Languages';
    5262    Translator.Language := Translator.Languages.SearchByCode('');
     63    OwnsTranslator := True;
    5364  end;
     65  if not Assigned(ScaleDPI) then begin
     66    OwnsScaleDPI := True;
     67    ScaleDPI := TScaleDPI.Create(nil);
     68  end;
     69
    5470  Translator.TranslateComponentRecursive(Self);
    5571  ThemeManager.UseTheme(Self);
     
    6884  Dec(FCounter);
    6985  if FCounter <= 0 then begin
    70     FreeAndNil(PersistentForm);
    71     FreeAndNil(ThemeManager);
    72     FreeAndNil(Translator);
     86    if OwnsPersistentForm then begin
     87      FreeAndNil(PersistentForm);
     88      OwnsPersistentForm := False;
     89    end;
     90    if OwnsThemeManager then begin
     91      FreeAndNil(ThemeManager);
     92      OwnsThemeManager := False;
     93    end;
     94    if OwnsTranslator then begin
     95      FreeAndNil(Translator);
     96      OwnsTranslator := False;
     97    end;
     98    if OwnsScaleDPI then begin
     99      FreeAndNil(ScaleDPI);
     100      OwnsScaleDPI := False;
     101    end;
    73102  end;
    74103  inherited;
  • Common/Languages/FormAbout.cs.po

    r565 r567  
    2626msgid "Version"
    2727msgstr "Verze"
     28
     29#: tformabout.caption
     30msgid "About"
     31msgstr "O aplikaci"
  • Common/Languages/FormAbout.pot

    r563 r567  
    1414msgstr ""
    1515
     16#: tformabout.caption
     17msgid "About"
     18msgstr ""
     19
  • Common/Languages/FormTest.cs.po

    r566 r567  
    1212"X-Generator: Poedit 3.0.1\n"
    1313
    14 #: formtest.snone
    15 msgid "None"
    16 msgstr "Žádný"
    17 
    18 #: formtest.spassed
    19 msgid "Passed"
    20 msgstr "Prošlo"
    21 
    22 #: formabout.sfailed
    23 msgid "Failed"
    24 msgstr "Selhalo"
     14#: tformtest.caption
     15msgid "Test"
     16msgstr "Test"
  • Common/Languages/FormTest.pot

    r566 r567  
    22msgstr "Content-Type: text/plain; charset=UTF-8"
    33
    4 #: formtest.snone
    5 msgid "None"
     4#: tformtest.caption
     5msgid "Test"
    66msgstr ""
    7 
    8 #: formtest.spassed
    9 msgid "Passed"
    10 msgstr ""
    11 
    12 #: formabout.sfailed
    13 msgid "Failed"
    14 msgstr ""
  • Common/Languages/FormTests.cs.po

    r566 r567  
    1313
    1414#: tformtests.caption
    15 msgid "Test"
    16 msgstr "Test"
     15msgid "Tests"
     16msgstr "Testy"
    1717
    1818#: tformtests.listviewtestcases.columns[0].caption
  • Common/Languages/FormTests.pot

    r566 r567  
    33
    44#: tformtests.caption
    5 msgid "Test"
     5msgid "Tests"
    66msgstr ""
    77
Note: See TracChangeset for help on using the changeset viewer.