Ignore:
Timestamp:
Mar 29, 2018, 10:11:06 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Update Common package.
  • Added: Support for color theme.
Location:
ProjectTemplates/FileMenuProject/Forms
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • ProjectTemplates/FileMenuProject/Forms/UFormAbout.lfm

    r497 r507  
    1111  OnShow = FormShow
    1212  Position = poScreenCenter
    13   LCLVersion = '1.8.0.6'
     13  LCLVersion = '1.8.2.0'
    1414  object LabelDescription: TLabel
    1515    Left = 25
  • ProjectTemplates/FileMenuProject/Forms/UFormAbout.pas

    r497 r507  
    4949procedure TFormAbout.FormShow(Sender: TObject);
    5050begin
     51  Core.ThemeManager1.UseTheme(Self);
    5152  if Assigned(ApplicationInfo) then begin
    5253    LabelAppName.Caption := ApplicationInfo.AppName;
  • ProjectTemplates/FileMenuProject/Forms/UFormMain.lfm

    r497 r507  
    1313  OnCreate = FormCreate
    1414  OnShow = FormShow
    15   LCLVersion = '1.8.0.6'
     15  LCLVersion = '1.8.2.0'
    1616  object CoolBar1: TCoolBar
    1717    Left = 0
  • ProjectTemplates/FileMenuProject/Forms/UFormMain.pas

    r499 r507  
    4646    procedure MenuItemToolbarClick(Sender: TObject);
    4747  private
     48    procedure SetToolbarHints;
    4849    procedure UpdateFormTitle;
    4950  public
     
    7071begin
    7172  Core.PersistentForm1.Save(Self);
     73  Core.Finalize;
    7274end;
    7375
     
    7880end;
    7981
    80 procedure TFormMain.FormCreate(Sender: TObject);
     82procedure TFormMain.SetToolbarHints;
    8183var
    8284  I: Integer;
     85  J: Integer;
     86  Control: TControl;
    8387begin
    84   for I := 0 to ToolBarFile.ButtonCount - 1 do
    85     ToolBarFile.Buttons[I].Hint := ToolBarFile.Buttons[I].Caption;
     88 for J := 0 to CoolBar1.ControlCount - 1 do begin
     89    Control := CoolBar1.Controls[J];
     90    if Control is TToolBar then begin
     91      for I := 0 to TToolBar(Control).ButtonCount - 1 do begin
     92        TToolBar(Control).Buttons[I].ShowHint := True;
     93        TToolBar(Control).Buttons[I].Hint := TToolBar(Control).Buttons[I].Caption;
     94      end;
     95    end;
     96  end;
     97end;
     98
     99procedure TFormMain.FormCreate(Sender: TObject);
     100begin
    86101end;
    87102
    88103procedure TFormMain.FormShow(Sender: TObject);
    89104begin
     105  Core.Initialize;
    90106  Core.PersistentForm1.Load(Self);
    91   Core.Initialize;
     107  Core.ThemeManager1.UseTheme(Self);
     108  SetToolbarHints;
    92109end;
    93110
  • ProjectTemplates/FileMenuProject/Forms/UFormSettings.lfm

    r497 r507  
    11object FormSettings: TFormSettings
    2   Left = 798
    3   Height = 300
    4   Top = 367
    5   Width = 481
     2  Left = 429
     3  Height = 336
     4  Top = 289
     5  Width = 530
    66  Caption = 'Settings'
    7   ClientHeight = 300
    8   ClientWidth = 481
     7  ClientHeight = 336
     8  ClientWidth = 530
    99  Constraints.MinHeight = 300
    1010  Constraints.MinWidth = 400
    1111  DesignTimePPI = 120
     12  OnClose = FormClose
    1213  OnCreate = FormCreate
    1314  OnShow = FormShow
    1415  Position = poScreenCenter
    15   LCLVersion = '1.8.0.6'
    16   object ComboBoxLanguage: TComboBox
    17     Left = 160
    18     Height = 28
    19     Top = 30
    20     Width = 260
    21     ItemHeight = 20
    22     Style = csDropDownList
    23     TabOrder = 0
    24   end
    25   object Label1: TLabel
    26     Left = 20
    27     Height = 20
    28     Top = 30
    29     Width = 68
    30     Caption = 'Language:'
    31     ParentColor = False
    32   end
     16  LCLVersion = '1.8.2.0'
    3317  object ButtonOk: TButton
    34     Left = 376
     18    Left = 425
    3519    Height = 31
    36     Top = 256
     20    Top = 292
    3721    Width = 94
    3822    Anchors = [akRight, akBottom]
     
    4024    ModalResult = 1
    4125    OnClick = ButtonOkClick
    42     TabOrder = 2
     26    TabOrder = 1
    4327  end
    4428  object ButtonCancel: TButton
    45     Left = 256
     29    Left = 305
    4630    Height = 31
    47     Top = 256
     31    Top = 292
    4832    Width = 94
    4933    Anchors = [akRight, akBottom]
    5034    Caption = 'Cancel'
    5135    ModalResult = 2
    52     TabOrder = 1
     36    TabOrder = 0
    5337  end
    54   object CheckBoxAutomaticDPI: TCheckBox
    55     Left = 16
    56     Height = 24
    57     Top = 104
    58     Width = 120
    59     Caption = 'Automatic DPI'
    60     OnChange = CheckBoxAutomaticDPIChange
    61     TabOrder = 3
    62     Visible = False
    63   end
    64   object SpinEditDPI: TSpinEdit
    65     Left = 152
    66     Height = 28
    67     Top = 144
    68     Width = 121
    69     MaxValue = 300
    70     MinValue = 96
    71     TabOrder = 4
    72     Value = 96
    73     Visible = False
    74   end
    75   object LabelDPI: TLabel
    76     Left = 80
    77     Height = 20
    78     Top = 152
    79     Width = 26
    80     Caption = 'DPI:'
    81     ParentColor = False
    82     Visible = False
    83   end
    84   object CheckBoxReopenLastFileOnStart: TCheckBox
    85     Left = 16
    86     Height = 24
    87     Top = 72
    88     Width = 181
    89     Caption = 'Reopen last file on start'
    90     TabOrder = 5
    91   end
    92   object Bevel1: TBevel
    93     Left = 10
    94     Height = 2
    95     Top = 240
    96     Width = 456
    97     Anchors = [akLeft, akRight, akBottom]
     38  object PageControl1: TPageControl
     39    Left = 8
     40    Height = 278
     41    Top = 8
     42    Width = 513
     43    ActivePage = TabSheetGeneral
     44    Anchors = [akTop, akLeft, akRight, akBottom]
     45    TabIndex = 0
     46    TabOrder = 2
     47    object TabSheetGeneral: TTabSheet
     48      Caption = 'General'
     49      ClientHeight = 245
     50      ClientWidth = 505
     51      object ComboBoxLanguage: TComboBox
     52        Left = 160
     53        Height = 28
     54        Top = 30
     55        Width = 260
     56        ItemHeight = 20
     57        Style = csDropDownList
     58        TabOrder = 0
     59      end
     60      object Label1: TLabel
     61        Left = 20
     62        Height = 20
     63        Top = 30
     64        Width = 68
     65        Caption = 'Language:'
     66        ParentColor = False
     67      end
     68      object CheckBoxAutomaticDPI: TCheckBox
     69        Left = 16
     70        Height = 24
     71        Top = 104
     72        Width = 120
     73        Caption = 'Automatic DPI'
     74        OnChange = CheckBoxAutomaticDPIChange
     75        TabOrder = 1
     76        Visible = False
     77      end
     78      object SpinEditDPI: TSpinEdit
     79        Left = 152
     80        Height = 28
     81        Top = 144
     82        Width = 121
     83        MaxValue = 300
     84        MinValue = 96
     85        TabOrder = 2
     86        Value = 96
     87        Visible = False
     88      end
     89      object LabelDPI: TLabel
     90        Left = 80
     91        Height = 20
     92        Top = 146
     93        Width = 26
     94        Caption = 'DPI:'
     95        ParentColor = False
     96        Visible = False
     97      end
     98      object CheckBoxReopenLastFileOnStart: TCheckBox
     99        Left = 16
     100        Height = 24
     101        Top = 72
     102        Width = 181
     103        Caption = 'Reopen last file on start'
     104        TabOrder = 3
     105      end
     106      object Label2: TLabel
     107        Left = 20
     108        Height = 20
     109        Top = 184
     110        Width = 48
     111        Caption = 'Theme:'
     112        ParentColor = False
     113      end
     114      object ComboBoxTheme: TComboBox
     115        Left = 160
     116        Height = 28
     117        Top = 184
     118        Width = 260
     119        ItemHeight = 20
     120        Style = csDropDownList
     121        TabOrder = 4
     122      end
     123    end
    98124  end
    99125end
  • ProjectTemplates/FileMenuProject/Forms/UFormSettings.pas

    r497 r507  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   Menus, Spin, ExtCtrls, ULanguages;
     9  Menus, Spin, ExtCtrls, ComCtrls, ULanguages;
    1010
    1111type
     
    1414
    1515  TFormSettings = class(TForm)
    16     Bevel1: TBevel;
    1716    ButtonOk: TButton;
    1817    ButtonCancel: TButton;
     18    CheckBoxAutomaticDPI: TCheckBox;
    1919    CheckBoxReopenLastFileOnStart: TCheckBox;
    20     CheckBoxAutomaticDPI: TCheckBox;
    2120    ComboBoxLanguage: TComboBox;
     21    ComboBoxTheme: TComboBox;
    2222    Label1: TLabel;
     23    Label2: TLabel;
    2324    LabelDPI: TLabel;
     25    PageControl1: TPageControl;
    2426    SpinEditDPI: TSpinEdit;
     27    TabSheetGeneral: TTabSheet;
    2528    procedure ButtonOkClick(Sender: TObject);
    2629    procedure CheckBoxAutomaticDPIChange(Sender: TObject);
    2730    procedure CheckBoxStartOnLogonChange(Sender: TObject);
     31    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2832    procedure FormCreate(Sender: TObject);
    2933    procedure FormShow(Sender: TObject);
     
    4448
    4549uses
    46   UCore;
     50  UCore, UTheme;
    4751
    4852{ TFormSettings }
     
    5054procedure TFormSettings.FormShow(Sender: TObject);
    5155begin
    52   Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
    53   ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
    54   if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
     56  Core.PersistentForm1.Load(Self);
     57  Core.ThemeManager1.UseTheme(Self);
    5558end;
    5659
    5760procedure TFormSettings.ButtonOkClick(Sender: TObject);
    5861begin
    59   if ComboBoxLanguage.ItemIndex <> -1 then
    60     Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
    6162end;
    6263
     
    7172end;
    7273
     74procedure TFormSettings.FormClose(Sender: TObject; var CloseAction: TCloseAction
     75  );
     76begin
     77  Core.PersistentForm1.Save(Self);
     78end;
     79
    7380procedure TFormSettings.FormCreate(Sender: TObject);
    7481begin
     
    8188  SpinEditDPI.Value := Core.ScaleDPI1.DPI.X;
    8289  CheckBoxReopenLastFileOnStart.Checked := Core.ReopenLastFileOnStart;
     90
     91  Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);
     92  ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language);
     93  if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0;
     94
     95  Core.ThemeManager1.Themes.LoadToStrings(ComboBoxTheme.Items);
     96  ComboBoxTheme.ItemIndex := ComboBoxTheme.Items.IndexOfObject(Core.ThemeManager1.Theme);
     97  if ComboBoxTheme.ItemIndex = -1 then ComboBoxTheme.ItemIndex := 0;
     98
    8399  UpdateInterface;
    84100end;
     
    89105  Core.ScaleDPI1.DPI := Point(SpinEditDPI.Value, SpinEditDPI.Value);
    90106  Core.ReopenLastFileOnStart := CheckBoxReopenLastFileOnStart.Checked;
     107  if ComboBoxLanguage.ItemIndex <> -1 then
     108    Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);
     109  if ComboBoxTheme.ItemIndex <> -1 then
     110    Core.ThemeManager1.Theme := TTheme(ComboBoxTheme.Items.Objects[ComboBoxTheme.ItemIndex]);
    91111end;
    92112
Note: See TracChangeset for help on using the changeset viewer.