Changeset 201
- Timestamp:
- Jan 28, 2026, 9:57:27 PM (3 hours ago)
- Location:
- trunk
- Files:
-
- 11 added
- 29 edited
-
Core.lfm (modified) (8 diffs)
-
Core.pas (modified) (1 diff)
-
Languages/vCardStudio.cs.po (modified) (1 diff)
-
Packages/Common/Common.lpk (modified) (2 diffs)
-
Packages/Common/CommonPackage.pas (modified) (1 diff)
-
Packages/Common/FormEx.pas (modified) (2 diffs)
-
Packages/Common/Forms/FormAbout.lfm (modified) (6 diffs)
-
Packages/Common/Forms/FormAbout.pas (modified) (1 diff)
-
Packages/Common/Forms/FormItem.lfm (added)
-
Packages/Common/Forms/FormItem.lrj (added)
-
Packages/Common/Forms/FormItem.pas (added)
-
Packages/Common/Forms/FormKeyShortcuts.lfm (modified) (3 diffs)
-
Packages/Common/Forms/FormKeyShortcuts.lrj (modified) (1 diff)
-
Packages/Common/Forms/FormKeyShortcuts.pas (modified) (5 diffs)
-
Packages/Common/Forms/FormList.lfm (added)
-
Packages/Common/Forms/FormList.lrj (added)
-
Packages/Common/Forms/FormList.pas (added)
-
Packages/Common/Forms/FormTest.lfm (modified) (2 diffs)
-
Packages/Common/Forms/FormTest.lrj (modified) (1 diff)
-
Packages/Common/Forms/FormTest.pas (modified) (3 diffs)
-
Packages/Common/Forms/FormTests.lfm (modified) (4 diffs)
-
Packages/Common/Forms/FormTests.lrj (modified) (1 diff)
-
Packages/Common/Forms/FormTests.pas (modified) (2 diffs)
-
Packages/Common/ItemList.pas (added)
-
Packages/Common/Languages/Common.cs.po (modified) (1 diff)
-
Packages/Common/Languages/FormAbout.cs.po (modified) (1 diff)
-
Packages/Common/Languages/FormAbout.pot (modified) (1 diff)
-
Packages/Common/Languages/FormKeyShortcuts.cs.po (modified) (1 diff)
-
Packages/Common/Languages/FormKeyShortcuts.pot (modified) (1 diff)
-
Packages/Common/Languages/FormList.cs.po (added)
-
Packages/Common/Languages/FormList.pot (added)
-
Packages/Common/Languages/ItemList.cs.po (added)
-
Packages/Common/Languages/ItemList.pot (added)
-
Packages/Common/Languages/PixelPointer.cs.po (modified) (1 diff)
-
Packages/Common/Languages/Table.cs.po (modified) (1 diff)
-
Packages/Common/MetaCanvas.pas (modified) (2 diffs)
-
Packages/Common/RegistryEx.pas (modified) (2 diffs)
-
Packages/Common/Theme.pas (modified) (12 diffs)
-
Packages/Common/Threading.pas (modified) (2 diffs)
-
Packages/Common/Translator.pas (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Core.lfm
r181 r201 312 312 Caption = 'New' 313 313 ImageIndex = 4 314 ShortCut = 16462 314 315 OnExecute = AFileNewExecute 315 ShortCut = 16462316 316 end 317 317 object AFileOpen: TAction … … 319 319 Caption = 'Open...' 320 320 ImageIndex = 5 321 ShortCut = 16463 321 322 OnExecute = AFileOpenExecute 322 ShortCut = 16463323 323 end 324 324 object AFileOpenRecent: TAction … … 331 331 Caption = 'Save' 332 332 ImageIndex = 7 333 ShortCut = 16467 333 334 OnExecute = AFileSaveExecute 334 ShortCut = 16467335 335 end 336 336 object AFileSaveAs: TAction … … 338 338 Caption = 'Save as...' 339 339 ImageIndex = 7 340 ShortCut = 24659 340 341 OnExecute = AFileSaveAsExecute 341 ShortCut = 24659342 342 end 343 343 object AFileClose: TAction … … 361 361 Caption = 'Settings' 362 362 ImageIndex = 8 363 ShortCut = 121 363 364 OnExecute = ASettingsExecute 364 ShortCut = 121365 365 end 366 366 object AFileCombine: TAction … … 377 377 Caption = 'Generate contacts' 378 378 ImageIndex = 20 379 ShortCut = 116 379 380 OnExecute = AGenerateExecute 380 ShortCut = 116381 381 end 382 382 object AFileSplit: TAction … … 388 388 Caption = 'Find...' 389 389 ImageIndex = 14 390 ShortCut = 16454 390 391 OnExecute = AFindExecute 391 ShortCut = 16454392 392 end 393 393 object ATest: TAction 394 394 Caption = 'Test' 395 ShortCut = 115 395 396 OnExecute = ATestExecute 396 ShortCut = 115397 397 end 398 398 object AViewSource: TAction 399 399 Caption = 'View source' 400 400 ImageIndex = 21 401 ShortCut = 114 401 402 OnExecute = AViewSourceExecute 402 ShortCut = 114403 403 end 404 404 object AFileCompare: TAction … … 433 433 Caption = 'Full screen' 434 434 ImageIndex = 24 435 ShortCut = 122 435 436 OnExecute = AFullScreenExecute 436 ShortCut = 122437 437 end 438 438 object AKeyShortcuts: TAction -
trunk/Core.pas
r194 r201 339 339 if not Assigned(FormKeyShortcuts) then 340 340 FormKeyShortcuts := TFormKeyShortcuts.Create(nil); 341 FormKeyShortcuts.Image List:= ImageList1;341 FormKeyShortcuts.Images := ImageList1; 342 342 FormKeyShortcuts.MainForm := FormMain; 343 343 FormKeyShortcuts.SourceComponents.Clear; -
trunk/Languages/vCardStudio.cs.po
r177 r201 751 751 #: tformcontact.labelorganization10.caption 752 752 msgid "Reddit:" 753 msgstr "R addit:"753 msgstr "Reddit:" 754 754 755 755 #: tformcontact.labelorganization11.caption -
trunk/Packages/Common/Common.lpk
r177 r201 43 43 <License Value="Copy left."/> 44 44 <Version Minor="12"/> 45 <Files Count=" 37">45 <Files Count="40"> 46 46 <Item1> 47 47 <Filename Value="StopWatch.pas"/> … … 205 205 <UnitName Value="FormKeyShortcuts"/> 206 206 </Item37> 207 <Item38> 208 <Filename Value="ItemList.pas"/> 209 <UnitName Value="ItemList"/> 210 </Item38> 211 <Item39> 212 <Filename Value="Forms\FormItem.pas"/> 213 <UnitName Value="FormItem"/> 214 </Item39> 215 <Item40> 216 <Filename Value="Forms\FormList.pas"/> 217 <UnitName Value="FormList"/> 218 </Item40> 207 219 </Files> 208 220 <CompatibilityMode Value="True"/> -
trunk/Packages/Common/CommonPackage.pas
r177 r201 14 14 ScaleDPI, Theme, StringTable, MetaCanvas, Geometric, Translator, Languages, 15 15 PixelPointer, DataFile, TestCase, Generics, Table, FormEx, FormTests, 16 FormTest, FormAbout, FormKeyShortcuts, LazarusPackageIntf; 16 FormTest, FormAbout, FormKeyShortcuts, ItemList, FormItem, FormList, 17 LazarusPackageIntf; 17 18 18 19 implementation -
trunk/Packages/Common/FormEx.pas
r177 r201 50 50 PersistentForm.Load(Self); 51 51 FullScreen := PersistentForm.FormFullScreen; 52 ThemeManager.UseTheme(Self); 52 53 end; 53 54 end; … … 75 76 76 77 Translator.TranslateComponentRecursive(Self); 77 ThemeManager.UseTheme(Self);78 78 Inc(FCounter); 79 79 inherited; -
trunk/Packages/Common/Forms/FormAbout.lfm
r162 r201 1 1 object FormAbout: TFormAbout 2 2 Left = 624 3 Height = 4023 Height = 397 4 4 Top = 622 5 Width = 7 025 Width = 714 6 6 Caption = 'About' 7 ClientHeight = 4028 ClientWidth = 7 027 ClientHeight = 397 8 ClientWidth = 714 9 9 DesignTimePPI = 144 10 10 OnShow = FormShow 11 11 Position = poScreenCenter 12 LCLVersion = ' 2.2.6.0'12 LCLVersion = '3.6.0.0' 13 13 object LabelDescription: TLabel 14 14 Left = 30 15 15 Height = 26 16 16 Top = 135 17 Width = 6 4217 Width = 654 18 18 Align = alTop 19 19 BorderSpacing.Left = 30 … … 29 29 Height = 26 30 30 Top = 191 31 Width = 6 4231 Width = 654 32 32 Align = alTop 33 33 BorderSpacing.Around = 30 … … 40 40 Height = 135 41 41 Top = 0 42 Width = 7 0242 Width = 714 43 43 Align = alTop 44 44 BevelOuter = bvNone 45 45 ClientHeight = 135 46 ClientWidth = 7 0246 ClientWidth = 714 47 47 FullRepaint = False 48 48 ParentFont = False … … 52 52 Height = 84 53 53 Top = 20 54 Width = 5 6454 Width = 576 55 55 Anchors = [akTop, akLeft, akRight] 56 56 AutoSize = False … … 74 74 Left = 0 75 75 Height = 75 76 Top = 32 777 Width = 7 0276 Top = 322 77 Width = 714 78 78 Align = alBottom 79 79 BevelOuter = bvNone 80 80 ClientHeight = 75 81 ClientWidth = 7 0281 ClientWidth = 714 82 82 TabOrder = 1 83 83 object ButtonHomePage: TButton … … 88 88 Anchors = [akLeft, akBottom] 89 89 Caption = 'Home page' 90 OnClick = ButtonHomePageClick91 90 ParentFont = False 92 91 TabOrder = 0 92 OnClick = ButtonHomePageClick 93 93 end 94 94 object ButtonClose: TButton 95 Left = 5 3195 Left = 543 96 96 Height = 38 97 97 Top = 24 -
trunk/Packages/Common/Forms/FormAbout.pas
r162 r201 38 38 SReleaseDate = 'Release date'; 39 39 SLicense = 'License'; 40 // TODO: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41095 41 {$hints off} 42 SHomePage = 'Home page'; 43 SClose = 'Close'; 40 44 41 45 { TFormAbout } -
trunk/Packages/Common/Forms/FormKeyShortcuts.lfm
r178 r201 11 11 OnDestroy = FormDestroy 12 12 OnShow = FormShow 13 LCLVersion = '3. 4.0.0'13 LCLVersion = '3.6.0.0' 14 14 object ListView1: TListView 15 Left = 5 16 Height = 319 17 Top = 5 18 Width = 694 19 Align = alClient 20 BorderSpacing.Around = 5 15 Left = 10 16 Height = 262 17 Top = 10 18 Width = 684 19 Align = alTop 20 Anchors = [akTop, akLeft, akRight, akBottom] 21 BorderSpacing.Around = 10 21 22 Columns = < 22 23 item … … 42 43 OnKeyPress = ListView1KeyPress 43 44 end 45 object ButtonClose: TButton 46 Left = 581 47 Height = 37 48 Top = 284 49 Width = 113 50 Anchors = [akRight, akBottom] 51 Caption = 'Close' 52 ModalResult = 11 53 TabOrder = 1 54 OnClick = ButtonCloseClick 55 end 44 56 object PopupMenu1: TPopupMenu 45 57 Left = 408 … … 55 67 Column = 0 56 68 Order = soNone 57 Left = 2 0058 Top = 1 6069 Left = 221 70 Top = 144 59 71 end 60 72 end -
trunk/Packages/Common/Forms/FormKeyShortcuts.lrj
r177 r201 4 4 {"hash":98585447,"name":"tformkeyshortcuts.listview1.columns[1].caption","sourcebytes":[87,105,110,100,111,119],"value":"Window"}, 5 5 {"hash":258584404,"name":"tformkeyshortcuts.listview1.columns[2].caption","sourcebytes":[83,104,111,114,116,99,117,116],"value":"Shortcut"}, 6 {"hash":4863637,"name":"tformkeyshortcuts.buttonclose.caption","sourcebytes":[67,108,111,115,101],"value":"Close"}, 6 7 {"hash":216771813,"name":"tformkeyshortcuts.menuitem1.caption","sourcebytes":[69,120,101,99,117,116,101],"value":"Execute"} 7 8 ]} -
trunk/Packages/Common/Forms/FormKeyShortcuts.pas
r178 r201 13 13 14 14 TFormKeyShortcuts = class(TFormEx) 15 ButtonClose: TButton; 15 16 ListView1: TListView; 16 17 ListViewSort1: TListViewSort; 17 18 MenuItem1: TMenuItem; 18 19 PopupMenu1: TPopupMenu; 20 procedure ButtonCloseClick(Sender: TObject); 19 21 procedure FormCreate(Sender: TObject); 20 22 procedure FormDestroy(Sender: TObject); … … 25 27 procedure MenuItem1Click(Sender: TObject); 26 28 private 27 function GetImage List: TCustomImageList;28 procedure SetImage List(AValue: TCustomImageList);29 function GetImages: TCustomImageList; 30 procedure SetImages(AValue: TCustomImageList); 29 31 public 30 32 SourceComponents: TObjectList<TComponent>; 31 33 MainForm: TForm; 32 34 procedure LoadFromComponent(C: TComponent); 33 property Image List: TCustomImageList read GetImageList write SetImageList;35 property Images: TCustomImageList read GetImages write SetImages; 34 36 end; 35 37 … … 49 51 SShortcut = 'Shortcut'; 50 52 SKeyShortcuts = 'Key shortcuts'; 53 SClose = 'Close'; 51 54 52 55 { TFormKeyShortcuts } … … 105 108 end; 106 109 110 procedure TFormKeyShortcuts.ButtonCloseClick(Sender: TObject); 111 begin 112 Close; 113 end; 114 107 115 procedure TFormKeyShortcuts.FormDestroy(Sender: TObject); 108 116 begin … … 116 124 end; 117 125 118 function TFormKeyShortcuts.GetImage List: TCustomImageList;126 function TFormKeyShortcuts.GetImages: TCustomImageList; 119 127 begin 120 128 Result := ListView1.SmallImages; 121 129 end; 122 130 123 procedure TFormKeyShortcuts.SetImage List(AValue: TCustomImageList);131 procedure TFormKeyShortcuts.SetImages(AValue: TCustomImageList); 124 132 begin 125 133 ListView1.SmallImages := AValue; -
trunk/Packages/Common/Forms/FormTest.lfm
r162 r201 8 8 ClientWidth = 865 9 9 DesignTimePPI = 144 10 LCLVersion = '2.2.6.0' 10 OnShow = FormShow 11 LCLVersion = '3.6.0.0' 11 12 object MemoLog: TMemo 12 13 Left = 8 13 Height = 50514 Height = 464 14 15 Top = 8 15 16 Width = 849 16 Align = alClient 17 Align = alTop 18 Anchors = [akTop, akLeft, akRight, akBottom] 17 19 BorderSpacing.Around = 8 18 20 ReadOnly = True … … 20 22 TabOrder = 0 21 23 end 24 object ButtonRun: TButton 25 Left = 616 26 Height = 37 27 Top = 480 28 Width = 112 29 Anchors = [akRight, akBottom] 30 Caption = 'Run' 31 TabOrder = 1 32 OnClick = ButtonRunClick 33 end 34 object ButtonClose: TButton 35 Left = 745 36 Height = 37 37 Top = 480 38 Width = 112 39 Anchors = [akRight, akBottom] 40 Caption = 'Close' 41 ModalResult = 11 42 TabOrder = 2 43 OnClick = ButtonRunClick 44 end 22 45 end -
trunk/Packages/Common/Forms/FormTest.lrj
r162 r201 1 1 {"version":1,"strings":[ 2 {"hash":371876,"name":"tformtest.caption","sourcebytes":[84,101,115,116],"value":"Test"} 2 {"hash":371876,"name":"tformtest.caption","sourcebytes":[84,101,115,116],"value":"Test"}, 3 {"hash":22974,"name":"tformtest.buttonrun.caption","sourcebytes":[82,117,110],"value":"Run"}, 4 {"hash":4863637,"name":"tformtest.buttonclose.caption","sourcebytes":[67,108,111,115,101],"value":"Close"} 3 5 ]} -
trunk/Packages/Common/Forms/FormTest.pas
r162 r201 4 4 5 5 uses 6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, FormEx; 6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, FormEx, 7 TestCase; 7 8 8 9 type … … 11 12 12 13 TFormTest = class(TFormEx) 14 ButtonRun: TButton; 15 ButtonClose: TButton; 13 16 MemoLog: TMemo; 17 procedure FormShow(Sender: TObject); 18 procedure ButtonRunClick(Sender: TObject); 19 private 20 FTestCase: TTestCase; 21 procedure SetTestCase(AValue: TTestCase); 22 public 23 property TestCase: TTestCase read FTestCase write SetTestCase; 14 24 end; 15 25 … … 19 29 {$R *.lfm} 20 30 31 { TFormTest } 32 33 procedure TFormTest.FormShow(Sender: TObject); 34 begin 35 if Assigned(FTestCase) then MemoLog.Text := FTestCase.Log; 36 end; 37 38 procedure TFormTest.SetTestCase(AValue: TTestCase); 39 begin 40 if FTestCase = AValue then Exit; 41 FTestCase := AValue; 42 end; 43 44 procedure TFormTest.ButtonRunClick(Sender: TObject); 45 begin 46 if Assigned(FTestCase) then begin 47 FTestCase.Run; 48 MemoLog.Text := FTestCase.Log; 49 end; 50 end; 51 21 52 end. 22 53 -
trunk/Packages/Common/Forms/FormTests.lfm
r162 r201 9 9 DesignTimePPI = 144 10 10 OnShow = FormShow 11 LCLVersion = ' 2.2.6.0'11 LCLVersion = '3.6.0.0' 12 12 object ListViewTestCases: TListView 13 13 Left = 19 … … 36 36 end 37 37 object ButtonRun: TButton 38 Left = 94538 Left = 816 39 39 Height = 37 40 40 Top = 585 … … 42 42 Anchors = [akRight, akBottom] 43 43 Caption = 'Run' 44 TabOrder = 1 44 45 OnClick = ButtonRunClick 45 TabOrder = 146 46 end 47 47 object LabelResult: TLabel … … 53 53 Caption = ' ' 54 54 ParentColor = False 55 end 56 object ButtonClose: TButton 57 Left = 945 58 Height = 37 59 Top = 585 60 Width = 112 61 Anchors = [akRight, akBottom] 62 Caption = 'Close' 63 ModalResult = 11 64 TabOrder = 2 65 OnClick = ButtonRunClick 55 66 end 56 67 object ActionList1: TActionList -
trunk/Packages/Common/Forms/FormTests.lrj
r162 r201 5 5 {"hash":22974,"name":"tformtests.buttonrun.caption","sourcebytes":[82,117,110],"value":"Run"}, 6 6 {"hash":8736,"name":"tformtests.labelresult.caption","sourcebytes":[32,32,32],"value":" "}, 7 {"hash":4863637,"name":"tformtests.buttonclose.caption","sourcebytes":[67,108,111,115,101],"value":"Close"}, 7 8 {"hash":368487,"name":"tformtests.ashow.caption","sourcebytes":[83,104,111,119],"value":"Show"}, 8 9 {"hash":22974,"name":"tformtests.arun.caption","sourcebytes":[82,117,110],"value":"Run"} -
trunk/Packages/Common/Forms/FormTests.pas
r162 r201 16 16 ActionList1: TActionList; 17 17 ButtonRun: TButton; 18 ButtonClose: TButton; 18 19 LabelResult: TLabel; 19 20 ListViewTestCases: TListView; … … 119 120 with TFormTest.Create(nil) do 120 121 try 121 MemoLog.Text := TTestCase(ListViewTestCases.Selected.Data).Log;122 TestCase := TTestCase(ListViewTestCases.Selected.Data); 122 123 ShowModal; 124 ReloadList; 123 125 finally 124 126 Free; -
trunk/Packages/Common/Languages/Common.cs.po
r177 r201 16 16 msgid "Excution error: %s (exit code: %d)" 17 17 msgstr "Chyba vykonání: %s (návratový kód: %d)" 18 -
trunk/Packages/Common/Languages/FormAbout.cs.po
r173 r201 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 3.0.1\n" 12 "X-Generator: Poedit 3.4.2\n" 13 14 #: formabout.sclose 15 msgid "Close" 16 msgstr "Zavřít" 17 18 #: formabout.shomepage 19 msgid "Home page" 20 msgstr "Domovská stránka" 13 21 14 22 #: formabout.slicense -
trunk/Packages/Common/Languages/FormAbout.pot
r173 r201 1 1 msgid "" 2 2 msgstr "Content-Type: text/plain; charset=UTF-8" 3 4 #: formabout.sclose 5 msgid "Close" 6 msgstr "" 7 8 #: formabout.shomepage 9 msgid "Home page" 10 msgstr "" 3 11 4 12 #: formabout.slicense -
trunk/Packages/Common/Languages/FormKeyShortcuts.cs.po
r178 r201 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 3. 4.2\n"12 "X-Generator: Poedit 3.5\n" 13 13 14 14 #: formkeyshortcuts.saction 15 15 msgid "Action" 16 16 msgstr "Akce" 17 18 #: formkeyshortcuts.sclose 19 msgid "Close" 20 msgstr "Zavřít" 17 21 18 22 #: formkeyshortcuts.sexecute -
trunk/Packages/Common/Languages/FormKeyShortcuts.pot
r178 r201 4 4 #: formkeyshortcuts.saction 5 5 msgid "Action" 6 msgstr "" 7 8 #: formkeyshortcuts.sclose 9 msgid "Close" 6 10 msgstr "" 7 11 -
trunk/Packages/Common/Languages/PixelPointer.cs.po
r172 r201 21 21 msgid "Wrong bitmap size [width: %d, height: %d]" 22 22 msgstr "Špatná velikost bitové mapy [šířka: %d, výška: %d]" 23 -
trunk/Packages/Common/Languages/Table.cs.po
r172 r201 15 15 msgid "Unsupported format" 16 16 msgstr "Nepodporovaný formát" 17 -
trunk/Packages/Common/MetaCanvas.pas
r148 r201 150 150 procedure SetWidth(AValue: Integer); override; 151 151 function GetWidth: Integer; override; 152 procedure DoLine (x1,y1,x2,y2:integer); override;152 procedure DoLine(X1, Y1, X2, Y2: Integer); override; 153 153 procedure DoTextOut(X, Y: Integer; Text: string); override; 154 154 procedure DoRectangle(const Bounds: TRect); override; … … 563 563 end; 564 564 565 procedure TMetaCanvas.DoLine( x1, y1, x2, y2: integer);565 procedure TMetaCanvas.DoLine(X1, Y1, X2, Y2: integer); 566 566 var 567 567 NewObj: TCanvasLine; -
trunk/Packages/Common/RegistryEx.pas
r172 r201 36 36 function ReadFloatWithDefault(const Name: string; 37 37 DefaultValue: Double): Double; 38 function ReadDateTimeWithDefault(const Name: string; DefaultValue: TDateTime): TDateTime; 38 39 function DeleteKeyRecursive(const Key: string): Boolean; 39 40 function OpenKey(const Key: string; CanCreate: Boolean): Boolean; … … 110 111 end; 111 112 113 function TRegistryEx.ReadDateTimeWithDefault(const Name: string; 114 DefaultValue: TDateTime): TDateTime; 115 begin 116 if ValueExists(Name) then Result := ReadDateTime(Name) 117 else begin 118 WriteDateTime(Name, DefaultValue); 119 Result := DefaultValue; 120 end; 121 end; 122 112 123 function TRegistryEx.DeleteKeyRecursive(const Key: string): Boolean; 113 124 var -
trunk/Packages/Common/Theme.pas
r148 r201 5 5 uses 6 6 Classes, SysUtils, Graphics, ComCtrls, Controls, ExtCtrls, Menus, StdCtrls, 7 Spin, Forms, Generics.Collections, Grids ;7 Spin, Forms, Generics.Collections, Grids, Registry, LCLType; 8 8 9 9 type … … 25 25 end; 26 26 27 TDwmSetWindowAttribute = function(hwnd: HWND; dwAttribute: DWORD; pvAttribute: Pointer; cbAttribute: DWORD): HRESULT; stdcall; 28 27 29 { TThemeManager } 28 30 … … 30 32 private 31 33 FTheme: TTheme; 34 FActualTheme: TTheme; 35 DwmapiLib: TLibHandle; 36 DwmSetWindowAttribute: TDwmSetWindowAttribute; 37 function Gray(C: TColor): Byte; 32 38 procedure SetTheme(AValue: TTheme); 33 procedure SetThemeName(AValue: TTheme); 39 procedure SetThemeName(Name: string); 40 procedure SetThemedTitleBar(AForm: TForm; Active: Bool); 41 function IsWindows10OrGreater(BuildNumber: Integer): Boolean; 34 42 public 35 43 Used: Boolean; 36 44 Themes: TThemes; 45 function IsDarkTheme: Boolean; 37 46 procedure ApplyTheme(Component: TComponent); 38 47 constructor Create(AOwner: TComponent); override; … … 40 49 procedure UseTheme(Form: TForm); 41 50 property Theme: TTheme read FTheme write SetTheme; 51 property ActualTheme: TTheme read FActualTheme; 42 52 end; 43 53 … … 46 56 ThemeNameLight = 'Light'; 47 57 ThemeNameDark = 'Dark'; 58 DwmapiLibName = 'dwmapi.dll'; 59 DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19; 60 DWMWA_USE_IMMERSIVE_DARK_MODE = 20; 48 61 49 62 procedure Register; … … 95 108 end; 96 109 97 procedure TThemeManager.SetThemeName(AValue: TTheme); 110 { TThemeManager } 111 112 function TThemeManager.Gray(C: TColor): Byte; 113 begin 114 Result := Trunc(Red(C) * 0.3 + Green(C) * 0.59 + Blue(C) * 0.11); 115 end; 116 117 function TThemeManager.IsDarkTheme: Boolean; 118 {$IFDEF WINDOWS} 119 var 120 LightKey: Boolean; 121 Registry: TRegistry; 122 const 123 KeyPath = '\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize'; 124 KeyName = 'AppsUseLightTheme'; 125 {$ELSE} 126 var 127 ColorWindow: TColor; 128 ColorWindowText: TColor; 129 {$ENDIF} 130 begin 131 Result := False; 132 {$IFDEF WINDOWS} 133 Registry := TRegistry.Create; 134 try 135 Registry.RootKey := HKEY_CURRENT_USER; 136 if Registry.OpenKeyReadOnly(KeyPath) then begin 137 if Registry.ValueExists(KeyName) then 138 LightKey := Registry.ReadBool(KeyName) 139 else LightKey := True; 140 end else LightKey := True; 141 Result := not LightKey; 142 finally 143 Registry.Free; 144 end; 145 {$ELSE} 146 ColorWindow := ColorToRGB(clWindow); 147 ColorWindowText := ColorToRGB(clWindowText); 148 Result := Gray(ColorWindow) < Gray(ColorWindowText); 149 {$ENDIF} 150 end; 151 152 procedure TThemeManager.SetThemeName(Name: string); 153 begin 154 Theme := Themes.FindByName(Name); 155 end; 156 157 function TThemeManager.IsWindows10OrGreater(BuildNumber: Integer): Boolean; 158 begin 159 {$IFDEF WINDOWS} 160 Result := (Win32MajorVersion >= 10) and (Win32BuildNumber >= BuildNumber); 161 {$ELSE} 162 Result := False; 163 {$ENDIF} 164 end; 165 166 procedure TThemeManager.SetThemedTitleBar(AForm: TForm; Active: Bool); 167 var 168 Attr: DWord; 169 begin 170 if Assigned(DwmSetWindowAttribute) and IsWindows10OrGreater(17763) then begin 171 Attr := DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1; 172 if IsWindows10OrGreater(18985) then Attr := DWMWA_USE_IMMERSIVE_DARK_MODE; 173 174 DwmSetWindowAttribute(AForm.Handle, Attr, @Active, SizeOf(Active)); 175 end; 176 end; 177 178 procedure TThemeManager.SetTheme(AValue: TTheme); 98 179 begin 99 180 if FTheme = AValue then Exit; 100 181 FTheme := AValue; 101 end; 102 103 procedure TThemeManager.SetTheme(AValue: TTheme); 104 begin 105 if FTheme = AValue then Exit; 106 FTheme := AValue; 182 FActualTheme := FTheme; 183 {$IFDEF WINDOWS} 184 if Assigned(FTheme) and (FTheme = Themes.FindByName(ThemeNameSystem)) and IsDarkTheme then 185 FActualTheme := Themes.FindByName(ThemeNameDark); 186 {$ENDIF} 107 187 end; 108 188 … … 110 190 begin 111 191 inherited; 192 {$IFDEF WINDOWS} 193 DwmapiLib := LoadLibrary(DwmapiLibName); 194 if DwmapiLib <> 0 then DwmSetWindowAttribute := GetProcAddress(DwmapiLib, 'DwmSetWindowAttribute') 195 else DwmSetWindowAttribute := nil; 196 {$ENDIF} 197 112 198 Themes := TThemes.Create; 113 199 with Themes.AddNew(ThemeNameSystem) do begin … … 118 204 ColorControlSelected := clWindow; 119 205 end; 120 Theme := TTheme(Themes.First);121 206 with Themes.AddNew(ThemeNameDark) do begin 122 207 ColorWindow := RGBToColor($20, $20, $20); … … 133 218 ColorControlSelected := RGBToColor(196, 225, 255); 134 219 end; 220 Theme := TTheme(Themes.First); 135 221 end; 136 222 … … 138 224 begin 139 225 FreeAndNil(Themes); 226 {$IFDEF WINDOWS} 227 if DwmapiLib <> 0 then FreeLibrary(DwmapiLib); 228 {$ENDIF} 140 229 inherited; 141 230 end; … … 156 245 (Control is TMemo) or (Control is TListView) or (Control is TCustomDrawGrid) or 157 246 (Control is TCheckBox) or (Control is TPageControl) or (Control is TRadioButton) then begin 158 Control.Color := F Theme.ColorWindow;159 Control.Font.Color := F Theme.ColorWindowText;247 Control.Color := FActualTheme.ColorWindow; 248 Control.Font.Color := FActualTheme.ColorWindowText; 160 249 end else begin 161 Control.Color := F Theme.ColorControl;162 Control.Font.Color := F Theme.ColorControlText;250 Control.Color := FActualTheme.ColorControl; 251 Control.Font.Color := FActualTheme.ColorControlText; 163 252 end; 164 253 165 254 if Control is TCustomDrawGrid then begin 166 (Control as TCustomDrawGrid).Editor.Color := F Theme.ColorWindow;167 (Control as TCustomDrawGrid).Editor.Font.Color := F Theme.ColorWindowText;255 (Control as TCustomDrawGrid).Editor.Color := FActualTheme.ColorWindow; 256 (Control as TCustomDrawGrid).Editor.Font.Color := FActualTheme.ColorWindowText; 168 257 end; 169 258 … … 181 270 procedure TThemeManager.UseTheme(Form: TForm); 182 271 begin 183 if not Used and (F Theme.Name = ThemeNameSystem) then Exit;272 if not Used and (FActualTheme.Name = ThemeNameSystem) then Exit; 184 273 ApplyTheme(Form); 274 SetThemedTitleBar(Form, FActualTheme.Name = ThemeNameDark); 185 275 Used := True; 186 276 end; -
trunk/Packages/Common/Threading.pas
r172 r201 291 291 ThreadListLock.Release; 292 292 end; 293 F Thread.Free;293 FreeAndNil(FThread); 294 294 inherited; 295 295 end; … … 362 362 finalization 363 363 364 ThreadList.Free;365 ThreadListLock.Free;364 FreeAndNil(ThreadList); 365 FreeAndNil(ThreadListLock); 366 366 367 367 end. -
trunk/Packages/Common/Translator.pas
r162 r201 322 322 Result[I] := StringReplace(Result[I], '/', DirectorySeparator, [rfReplaceAll]); 323 323 Result[I] := StringReplace(Result[I], '\', DirectorySeparator, [rfReplaceAll]); 324 if Copy(Result[I], 1, 1) <> DirectorySeparatorthen324 if (Copy(Result[I], 1, 1) <> DirectorySeparator) and (Copy(Result[I], 2, 2) <> ':\') then 325 325 Result[I] := ExtractFileDir(Application.ExeName) + 326 326 DirectorySeparator + Result[I];
Note:
See TracChangeset
for help on using the changeset viewer.
