Permalink
Browse files

Issue #8: Add 39 themes from Redist\Styles\vcl\ directory, and suppor…

…t themes with a new setting in the "General" options tab
  • Loading branch information...
ansgarbecker committed Oct 26, 2018
1 parent 769ebc2 commit 93fe336841da43eec98cc188791781921a6ea9b7
@@ -43,14 +43,17 @@ uses
JumpList in '..\..\source\JumpList.pas',
extra_controls in '..\..\source\extra_controls.pas',
change_password in '..\..\source\change_password.pas' {frmPasswordChange},
Vcl.FormsFix in '..\..\source\Vcl.FormsFix.pas';
Vcl.FormsFix in '..\..\source\Vcl.FormsFix.pas',
Vcl.Themes,
Vcl.Styles;
{.$R *.RES}
{$R ..\..\res\icon.RES}
{$R ..\..\res\icon-question.RES}
{$R ..\..\res\version.RES}
{$R ..\..\res\manifest.RES}
{$R ..\..\res\updater.RES}
{$R ..\..\res\styles.RES}
var
AppLanguage: String;
@@ -74,6 +77,7 @@ begin
Application.Title := APPNAME;
Application.UpdateFormatSettings := False;
AppHelpers.InheritFont(Application.DefaultFont);
TStyleManager.TrySetStyle(AppSettings.ReadString(asTheme));
Application.CreateForm(TMainForm, MainForm);
MainForm.AfterFormCreate;
Application.OnDeactivate := MainForm.ApplicationDeActivate;
@@ -0,0 +1,40 @@
Amakrits VCLSTYLE "styles/Amakrits.vsf"
AmethystKamri VCLSTYLE "styles/AmethystKamri.vsf"
AquaGraphite VCLSTYLE "styles/AquaGraphite.vsf"
AquaLightSlate VCLSTYLE "styles/AquaLightSlate.vsf"
Auric VCLSTYLE "styles/Auric.vsf"
Carbon VCLSTYLE "styles/Carbon.vsf"
CharcoalDarkSlate VCLSTYLE "styles/CharcoalDarkSlate.vsf"
CobaltXEMedia VCLSTYLE "styles/CobaltXEMedia.vsf"
CyanDusk VCLSTYLE "styles/CyanDusk.vsf"
CyanNight VCLSTYLE "styles/CyanNight.vsf"
EmeraldLightSlate VCLSTYLE "styles/EmeraldLightSlate.vsf"
Glossy VCLSTYLE "styles/Glossy.vsf"
Glow VCLSTYLE "styles/Glow.vsf"
GoldenGraphite VCLSTYLE "styles/GoldenGraphite.vsf"
IcebergClassico VCLSTYLE "styles/IcebergClassico.vsf"
LavenderClassico VCLSTYLE "styles/LavenderClassico.vsf"
Light VCLSTYLE "styles/Light.vsf"
Luna VCLSTYLE "styles/Luna.vsf"
MetropolisUIBlack VCLSTYLE "styles/MetropolisUIBlack.vsf"
MetropolisUIBlue VCLSTYLE "styles/MetropolisUIBlue.vsf"
MetropolisUIDark VCLSTYLE "styles/MetropolisUIDark.vsf"
MetropolisUIGreen VCLSTYLE "styles/MetropolisUIGreen.vsf"
Obsidian VCLSTYLE "styles/Obsidian.vsf"
OnyxBlue VCLSTYLE "styles/OnyxBlue.vsf"
RubyGraphite VCLSTYLE "styles/RubyGraphite.vsf"
SapphireKamri VCLSTYLE "styles/SapphireKamri.vsf"
Silver VCLSTYLE "styles/Silver.vsf"
Sky VCLSTYLE "styles/Sky.vsf"
SlateClassico VCLSTYLE "styles/SlateClassico.vsf"
SmokeyQuartzKamri VCLSTYLE "styles/SmokeyQuartzKamri.vsf"
TabletDark VCLSTYLE "styles/TabletDark.vsf"
TabletLight VCLSTYLE "styles/TabletLight.vsf"
TurquoiseGray VCLSTYLE "styles/TurquoiseGray.vsf"
Windows10 VCLSTYLE "styles/Windows10.vsf"
Windows10Blue VCLSTYLE "styles/Windows10Blue.vsf"
Windows10Dark VCLSTYLE "styles/Windows10Dark.vsf"
Windows10Green VCLSTYLE "styles/Windows10Green.vsf"
Windows10Purple VCLSTYLE "styles/Windows10Purple.vsf"
Windows10SlateGray VCLSTYLE "styles/Windows10SlateGray.vsf"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN +73.8 KB res/styles/Auric.vsf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN +68.5 KB res/styles/Glossy.vsf
Binary file not shown.
BIN +63.7 KB res/styles/Glow.vsf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN +79.7 KB res/styles/Luna.vsf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN +71.4 KB res/styles/Sky.vsf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -14,7 +14,7 @@ interface
Registry, DateUtils, Generics.Collections, StrUtils, AnsiStrings, TlHelp32, Types,
dbconnection, mysql_structures, SynMemo, Menus, WinInet, gnugettext, Themes,
Character, ImgList, System.UITypes, ActnList, WinSock, IOUtils, StdCtrls, ComCtrls,
CommCtrl;
CommCtrl, Vcl.Imaging.pngimage;
type
@@ -171,6 +171,7 @@ TQueryThread = class(TThread)
asPromptSaveFileOnTabClose, asWarnUnsafeUpdates, asQueryWarningsMessage,
asCompletionProposal, asCompletionProposalWidth, asCompletionProposalNbLinesInWindow, asAutoUppercase,
asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory, asGUIFontName, asGUIFontSize,
asTheme,
asFindDialogReplaceHistory, asMaxQueryResults, asLogErrors,
asLogUserSQL, asLogSQL, asLogInfos, asLogDebug, asFieldColorNumeric,
asFieldColorReal, asFieldColorText, asFieldColorBinary, asFieldColorDatetime, asFieldColorSpatial,
@@ -3575,6 +3576,7 @@ constructor TAppSettings.Create;
InitSetting(asFindDialogReplaceHistory, 'FindDialogReplaceHistory', 0, False, '');
InitSetting(asGUIFontName, 'GUIFontName', 0, False, '');
InitSetting(asGUIFontSize, 'GUIFontSize', 8);
InitSetting(asTheme, 'Theme', 0, False, 'Windows');
InitSetting(asMaxQueryResults, 'MaxQueryResults', 10);
InitSetting(asLogErrors, 'LogErrors', 0, True);
InitSetting(asLogUserSQL, 'LogUserSQL', 0, True);
@@ -3,7 +3,7 @@ object optionsform: Toptionsform
Top = 163
BorderStyle = bsDialog
Caption = 'Preferences'
ClientHeight = 424
ClientHeight = 470
ClientWidth = 732
Color = clBtnFace
ParentFont = True
@@ -13,14 +13,14 @@ object optionsform: Toptionsform
OnShow = FormShow
DesignSize = (
732
424)
470)
PixelsPerInch = 96
TextHeight = 13
object pagecontrolMain: TPageControl
Left = 8
Top = 8
Width = 718
Height = 381
Height = 427
ActivePage = tabMisc
Anchors = [akLeft, akTop, akRight, akBottom]
Images = MainForm.ImageListMain
@@ -33,7 +33,7 @@ object optionsform: Toptionsform
ImageIndex = 137
DesignSize = (
710
349)
395)
object lblMySQLBinaries: TLabel
Left = 8
Top = 228
@@ -70,6 +70,13 @@ object optionsform: Toptionsform
Anchors = [akTop, akRight]
Caption = 'pt'
end
object lblTheme: TLabel
Left = 8
Top = 336
Width = 63
Height = 13
Caption = 'Style Theme:'
end
object chkAutoReconnect: TCheckBox
Left = 8
Top = 31
@@ -268,13 +275,24 @@ object optionsform: Toptionsform
TabOrder = 8
OnClick = Modified
end
object comboTheme: TComboBox
Left = 272
Top = 333
Width = 435
Height = 21
Style = csDropDownList
Anchors = [akLeft, akTop, akRight]
Sorted = True
TabOrder = 17
OnChange = Modified
end
end
object tabLogging: TTabSheet
Caption = 'Logging'
ImageIndex = 56
DesignSize = (
710
349)
395)
object Label4: TLabel
Left = 8
Top = 11
@@ -478,7 +496,7 @@ object optionsform: Toptionsform
ImageIndex = 57
DesignSize = (
710
349)
395)
object lblFont: TLabel
Left = 8
Top = 11
@@ -686,7 +704,7 @@ object optionsform: Toptionsform
Left = 8
Top = 215
Width = 693
Height = 131
Height = 177
Cursor = crHandPoint
SingleLineMode = False
Anchors = [akLeft, akTop, akRight, akBottom]
@@ -747,7 +765,7 @@ object optionsform: Toptionsform
ImageIndex = 41
DesignSize = (
710
349)
395)
object lblMaxColWidth: TLabel
Left = 8
Top = 11
@@ -996,7 +1014,7 @@ object optionsform: Toptionsform
ImageIndex = 33
DesignSize = (
710
349)
395)
object lblLineBreakStyle: TLabel
Left = 8
Top = 188
@@ -1086,20 +1104,20 @@ object optionsform: Toptionsform
ImageIndex = 13
DesignSize = (
710
349)
395)
object lblShortcut1: TLabel
Left = 306
Top = 64
Width = 45
Height = 12
Height = 59
Anchors = [akLeft, akTop, akBottom]
Caption = 'Shortcut:'
end
object lblShortcutHint: TLabel
Left = 306
Top = 3
Width = 279
Height = 54
Height = 100
Anchors = [akLeft, akTop, akBottom]
AutoSize = False
Caption = 'Please select a shortcut item in the tree.'
@@ -1109,15 +1127,15 @@ object optionsform: Toptionsform
Left = 306
Top = 107
Width = 98
Height = 12
Height = 59
Anchors = [akLeft, akTop, akBottom]
Caption = 'Secondary shortcut:'
end
object TreeShortcutItems: TVirtualStringTree
Left = 0
Top = 0
Width = 300
Height = 349
Height = 395
Align = alLeft
Header.AutoSizeIndex = 0
Header.MainColumn = -1
@@ -1158,7 +1176,7 @@ object optionsform: Toptionsform
end
object btnCancel: TButton
Left = 571
Top = 393
Top = 439
Width = 75
Height = 25
Anchors = [akRight, akBottom]
@@ -1169,7 +1187,7 @@ object optionsform: Toptionsform
end
object btnOK: TButton
Left = 491
Top = 393
Top = 439
Width = 75
Height = 25
Anchors = [akRight, akBottom]
@@ -1181,7 +1199,7 @@ object optionsform: Toptionsform
end
object btnApply: TButton
Left = 651
Top = 393
Top = 439
Width = 75
Height = 25
Anchors = [akRight, akBottom]
@@ -1192,7 +1210,7 @@ object optionsform: Toptionsform
end
object btnRestoreDefaults: TButton
Left = 8
Top = 393
Top = 439
Width = 177
Height = 25
Anchors = [akLeft, akBottom]
@@ -12,7 +12,7 @@ interface
Windows, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls, SynEditHighlighter, SynHighlighterSQL,
SynEdit, SynMemo, VirtualTrees, SynEditKeyCmds, ActnList, SynEditMiscClasses, StdActns, Menus,
mysql_structures, gnugettext;
mysql_structures, gnugettext, Vcl.Themes, Vcl.Styles;
type
TShortcutItemData = record
@@ -144,6 +144,8 @@ Toptionsform = class(TForm)
chkWheelZoom: TCheckBox;
chkQueryWarningsMessage: TCheckBox;
chkAutoUppercase: TCheckBox;
lblTheme: TLabel;
comboTheme: TComboBox;
procedure FormShow(Sender: TObject);
procedure Modified(Sender: TObject);
procedure Apply(Sender: TObject);
@@ -303,6 +305,7 @@ procedure Toptionsform.Apply(Sender: TObject);
else
AppSettings.WriteString(asGUIFontName, comboGUIFont.Text);
AppSettings.WriteInt(asGUIFontSize, updownGUIFontSize.Position);
AppSettings.WriteString(asTheme, comboTheme.Text);
AppSettings.WriteInt(asMaxQueryResults, updownMaxQueryResults.Position);
// Save color settings
@@ -366,6 +369,7 @@ procedure Toptionsform.Apply(Sender: TObject);
// Set relevant properties in mainform
MainForm.ApplyFontToGrids;
TStyleManager.TrySetStyle(comboTheme.Text);
Mainform.LogToFile := chkLogToFile.Checked;
MainForm.actLogHorizontalScrollbar.Checked := chkHorizontalScrollbar.Checked;
MainForm.actLogHorizontalScrollbar.OnExecute(MainForm.actLogHorizontalScrollbar);
@@ -408,6 +412,7 @@ procedure Toptionsform.FormCreate(Sender: TObject);
var
i: Integer;
dtc: TDBDatatypeCategoryIndex;
Styles: TArray<String>;
begin
TranslateComponent(Self);
@@ -426,6 +431,12 @@ procedure Toptionsform.FormCreate(Sender: TObject);
comboGUIFont.Items.Assign(Screen.Fonts);
comboGUIFont.Items.Insert(0, '<'+_('Default system font')+'>');
Styles := TStyleManager.StyleNames;
for i:=Low(Styles) to High(Styles) do begin
comboTheme.Items.Add(Styles[i]);
end;
comboTheme.ItemIndex := comboTheme.Items.IndexOf(AppSettings.GetDefaultString(asTheme));
// Data
// Populate datatype categories pulldown
for dtc:=Low(TDBDatatypeCategoryIndex) to High(TDBDatatypeCategoryIndex) do
@@ -491,6 +502,7 @@ procedure Toptionsform.FormShow(Sender: TObject);
comboGUIFont.ItemIndex := comboGUIFont.Items.IndexOf(GUIFont);
updownGUIFontSize.Position := AppSettings.ReadInt(asGUIFontSize);
comboGUIFont.OnChange(comboGUIFont);
comboTheme.ItemIndex := comboTheme.Items.IndexOf(AppSettings.ReadString(asTheme));
chkAskFileSave.Checked := AppSettings.ReadBool(asPromptSaveFileOnTabClose);
chkQueryWarningsMessage.Checked := AppSettings.ReadBool(asQueryWarningsMessage);

0 comments on commit 93fe336

Please sign in to comment.