Move tree background color setting from File menu to the Advanced tab of the session manager. Closes #360

This commit is contained in:
Ansgar Becker
2019-03-30 09:52:08 +01:00
parent 1f30684745
commit 07afefc726
4 changed files with 44 additions and 86 deletions

View File

@ -3,7 +3,7 @@ object connform: Tconnform
Top = 129 Top = 129
BorderIcons = [biSystemMenu, biHelp] BorderIcons = [biSystemMenu, biHelp]
Caption = 'Session manager' Caption = 'Session manager'
ClientHeight = 364 ClientHeight = 448
ClientWidth = 649 ClientWidth = 649
Color = clBtnFace Color = clBtnFace
Constraints.MinHeight = 360 Constraints.MinHeight = 360
@ -18,7 +18,7 @@ object connform: Tconnform
OnShow = FormShow OnShow = FormShow
DesignSize = ( DesignSize = (
649 649
364) 448)
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
object splitterMain: TSplitter object splitterMain: TSplitter
@ -26,7 +26,7 @@ object connform: Tconnform
Left = 208 Left = 208
Top = 8 Top = 8
Width = 8 Width = 8
Height = 316 Height = 400
Cursor = crSizeWE Cursor = crSizeWE
Margins.Left = 0 Margins.Left = 0
Margins.Top = 8 Margins.Top = 8
@ -37,7 +37,7 @@ object connform: Tconnform
end end
object btnSave: TButton object btnSave: TButton
Left = 64 Left = 64
Top = 331 Top = 415
Width = 50 Width = 50
Height = 25 Height = 25
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
@ -47,7 +47,7 @@ object connform: Tconnform
end end
object btnOpen: TButton object btnOpen: TButton
Left = 389 Left = 389
Top = 331 Top = 415
Width = 80 Width = 80
Height = 25 Height = 25
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
@ -59,7 +59,7 @@ object connform: Tconnform
end end
object btnCancel: TButton object btnCancel: TButton
Left = 475 Left = 475
Top = 331 Top = 415
Width = 80 Width = 80
Height = 25 Height = 25
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]
@ -73,7 +73,7 @@ object connform: Tconnform
Left = 8 Left = 8
Top = 8 Top = 8
Width = 200 Width = 200
Height = 316 Height = 400
Margins.Left = 8 Margins.Left = 8
Margins.Top = 8 Margins.Top = 8
Margins.Right = 0 Margins.Right = 0
@ -146,7 +146,7 @@ object connform: Tconnform
end end
object btnNew: TButton object btnNew: TButton
Left = 8 Left = 8
Top = 331 Top = 415
Width = 50 Width = 50
Height = 25 Height = 25
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
@ -158,7 +158,7 @@ object connform: Tconnform
end end
object btnDelete: TButton object btnDelete: TButton
Left = 120 Left = 120
Top = 331 Top = 415
Width = 50 Width = 50
Height = 25 Height = 25
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
@ -171,7 +171,7 @@ object connform: Tconnform
Left = 216 Left = 216
Top = 8 Top = 8
Width = 425 Width = 425
Height = 316 Height = 400
Margins.Left = 0 Margins.Left = 0
Margins.Top = 8 Margins.Top = 8
Margins.Right = 8 Margins.Right = 8
@ -216,7 +216,7 @@ object connform: Tconnform
Left = 0 Left = 0
Top = 0 Top = 0
Width = 417 Width = 417
Height = 287 Height = 371
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
Caption = 'pnlDpiHelperSettings' Caption = 'pnlDpiHelperSettings'
@ -224,7 +224,7 @@ object connform: Tconnform
TabOrder = 0 TabOrder = 0
DesignSize = ( DesignSize = (
417 417
287) 371)
object lblPort: TLabel object lblPort: TLabel
Left = 3 Left = 3
Top = 168 Top = 168
@ -379,7 +379,7 @@ object connform: Tconnform
Left = 120 Left = 120
Top = 238 Top = 238
Width = 294 Width = 294
Height = 35 Height = 119
Anchors = [akLeft, akTop, akRight, akBottom] Anchors = [akLeft, akTop, akRight, akBottom]
ScrollBars = ssVertical ScrollBars = ssVertical
TabOrder = 10 TabOrder = 10
@ -408,7 +408,7 @@ object connform: Tconnform
Left = 0 Left = 0
Top = 0 Top = 0
Width = 417 Width = 417
Height = 287 Height = 371
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
Caption = 'pnlDpiHelperSshTunnel' Caption = 'pnlDpiHelperSshTunnel'
@ -416,7 +416,7 @@ object connform: Tconnform
TabOrder = 0 TabOrder = 0
DesignSize = ( DesignSize = (
417 417
287) 371)
object lblSSHLocalPort: TLabel object lblSSHLocalPort: TLabel
Left = 3 Left = 3
Top = 190 Top = 190
@ -597,7 +597,7 @@ object connform: Tconnform
Left = 0 Left = 0
Top = 0 Top = 0
Width = 417 Width = 417
Height = 287 Height = 371
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
Caption = 'pnlDpiHelperAdvanced' Caption = 'pnlDpiHelperAdvanced'
@ -605,7 +605,7 @@ object connform: Tconnform
TabOrder = 0 TabOrder = 0
DesignSize = ( DesignSize = (
417 417
287) 371)
object lblSSLPrivateKey: TLabel object lblSSLPrivateKey: TLabel
Left = 3 Left = 3
Top = 39 Top = 39
@ -659,6 +659,13 @@ object connform: Tconnform
Height = 13 Height = 13
Caption = 'Ping every X seconds:' Caption = 'Ping every X seconds:'
end end
object lblBackgroundColor: TLabel
Left = 3
Top = 304
Width = 86
Height = 13
Caption = 'Background color:'
end
object editSSLPrivateKey: TButtonedEdit object editSSLPrivateKey: TButtonedEdit
Left = 120 Left = 120
Top = 36 Top = 36
@ -802,6 +809,19 @@ object connform: Tconnform
Max = 86400 Max = 86400
TabOrder = 11 TabOrder = 11
end end
object ColorBoxBackgroundColor: TColorBox
Left = 120
Top = 301
Width = 294
Height = 22
NoneColorColor = clNone
Selected = clNone
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone, cbIncludeDefault, cbCustomColor, cbPrettyNames, cbCustomColors]
Anchors = [akLeft, akTop, akRight]
DropDownCount = 16
TabOrder = 12
OnChange = Modification
end
end end
end end
object tabStatistics: TTabSheet object tabStatistics: TTabSheet
@ -867,7 +887,7 @@ object connform: Tconnform
end end
object btnMore: TButton object btnMore: TButton
Left = 561 Left = 561
Top = 331 Top = 415
Width = 80 Width = 80
Height = 25 Height = 25
Anchors = [akRight, akBottom] Anchors = [akRight, akBottom]

View File

@ -118,6 +118,8 @@ type
pnlDpiHelperSshTunnel: TPanel; pnlDpiHelperSshTunnel: TPanel;
pnlDpiHelperAdvanced: TPanel; pnlDpiHelperAdvanced: TPanel;
TimerButtonAnimation: TTimer; TimerButtonAnimation: TTimer;
lblBackgroundColor: TLabel;
ColorBoxBackgroundColor: TColorBox;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure btnOpenClick(Sender: TObject); procedure btnOpenClick(Sender: TObject);
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
@ -382,6 +384,7 @@ begin
Sess.KeepAlive := updownKeepAlive.Position; Sess.KeepAlive := updownKeepAlive.Position;
Sess.LocalTimeZone := chkLocalTimeZone.Checked; Sess.LocalTimeZone := chkLocalTimeZone.Checked;
Sess.FullTableStatus := chkFullTableStatus.Checked; Sess.FullTableStatus := chkFullTableStatus.Checked;
Sess.SessionColor := ColorBoxBackgroundColor.Selected;
Sess.AllDatabasesStr := editDatabases.Text; Sess.AllDatabasesStr := editDatabases.Text;
Sess.Comment := memoComment.Text; Sess.Comment := memoComment.Text;
Sess.StartupScriptFilename := editStartupScript.Text; Sess.StartupScriptFilename := editStartupScript.Text;
@ -595,6 +598,7 @@ begin
Result.KeepAlive := updownKeepAlive.Position; Result.KeepAlive := updownKeepAlive.Position;
Result.LocalTimeZone := chkLocalTimeZone.Checked; Result.LocalTimeZone := chkLocalTimeZone.Checked;
Result.FullTableStatus := chkFullTableStatus.Checked; Result.FullTableStatus := chkFullTableStatus.Checked;
Result.SessionColor := ColorBoxBackgroundColor.Selected;
end; end;
end; end;
@ -837,6 +841,7 @@ begin
updownKeepAlive.Position := Sess.KeepAlive; updownKeepAlive.Position := Sess.KeepAlive;
chkLocalTimeZone.Checked := Sess.LocalTimeZone; chkLocalTimeZone.Checked := Sess.LocalTimeZone;
chkFullTableStatus.Checked := Sess.FullTableStatus; chkFullTableStatus.Checked := Sess.FullTableStatus;
ColorBoxBackgroundColor.Selected := Sess.SessionColor;
editDatabases.Text := Sess.AllDatabasesStr; editDatabases.Text := Sess.AllDatabasesStr;
memoComment.Text := Sess.Comment; memoComment.Text := Sess.Comment;
editStartupScript.Text := Sess.StartupScriptFilename; editStartupScript.Text := Sess.StartupScriptFilename;
@ -1099,6 +1104,7 @@ begin
or (Sess.KeepAlive <> updownKeepAlive.Position) or (Sess.KeepAlive <> updownKeepAlive.Position)
or (Sess.LocalTimeZone <> chkLocalTimeZone.Checked) or (Sess.LocalTimeZone <> chkLocalTimeZone.Checked)
or (Sess.FullTableStatus <> chkFullTableStatus.Checked) or (Sess.FullTableStatus <> chkFullTableStatus.Checked)
or (Sess.SessionColor <> ColorBoxBackgroundColor.Selected)
or (Sess.NetType <> TNetType(comboNetType.ItemIndex)) or (Sess.NetType <> TNetType(comboNetType.ItemIndex))
or (Sess.StartupScriptFilename <> editStartupScript.Text) or (Sess.StartupScriptFilename <> editStartupScript.Text)
or (Sess.AllDatabasesStr <> editDatabases.Text) or (Sess.AllDatabasesStr <> editDatabases.Text)

View File

@ -1730,9 +1730,6 @@ object MainForm: TMainForm
object N1: TMenuItem object N1: TMenuItem
Caption = '-' Caption = '-'
end end
object actSelectTreeBackground1: TMenuItem
Action = actSelectTreeBackground
end
object ExportSettings1: TMenuItem object ExportSettings1: TMenuItem
Action = actExportSettings Action = actExportSettings
end end
@ -2455,13 +2452,6 @@ object MainForm: TMainForm
ImageIndex = 26 ImageIndex = 26
OnExecute = actRemoveFilterExecute OnExecute = actRemoveFilterExecute
end end
object actSelectTreeBackground: TAction
Category = 'File'
Caption = 'Select session background color ...'
Hint = 'Lets you chose a per session color value for the database tree'
ImageIndex = 115
OnExecute = actSelectTreeBackgroundExecute
end
object actPreviousTab: TPreviousTab object actPreviousTab: TPreviousTab
Category = 'Tools' Category = 'Tools'
TabControl = PageControlMain TabControl = PageControlMain
@ -2889,9 +2879,6 @@ object MainForm: TMainForm
Caption = 'Doubleclick inserts node text' Caption = 'Doubleclick inserts node text'
OnClick = menuDoubleClickInsertsNodeTextClick OnClick = menuDoubleClickInsertsNodeTextClick
end end
object menuSelectBGColor: TMenuItem
Action = actSelectTreeBackground
end
object actFavoriteObjectsOnly1: TMenuItem object actFavoriteObjectsOnly1: TMenuItem
Action = actFavoriteObjectsOnly Action = actFavoriteObjectsOnly
AutoCheck = True AutoCheck = True

View File

@ -238,7 +238,6 @@ type
Cut1: TMenuItem; Cut1: TMenuItem;
actExportSettings: TAction; actExportSettings: TAction;
actImportSettings: TAction; actImportSettings: TAction;
actSelectTreeBackground: TAction;
actPreferences: TAction; actPreferences: TAction;
actFlushHosts: TAction; actFlushHosts: TAction;
actFlushLogs: TAction; actFlushLogs: TAction;
@ -429,7 +428,6 @@ type
Cancelediting1: TMenuItem; Cancelediting1: TMenuItem;
DataPost1: TMenuItem; DataPost1: TMenuItem;
menuShowSizeColumn: TMenuItem; menuShowSizeColumn: TMenuItem;
menuSelectBGColor: TMenuItem;
actPreviousTab: TPreviousTab; actPreviousTab: TPreviousTab;
actNextTab: TNextTab; actNextTab: TNextTab;
Nexttab1: TMenuItem; Nexttab1: TMenuItem;
@ -691,7 +689,6 @@ type
procedure actSQLhelpExecute(Sender: TObject); procedure actSQLhelpExecute(Sender: TObject);
procedure actUpdateCheckExecute(Sender: TObject); procedure actUpdateCheckExecute(Sender: TObject);
procedure actWebbrowse(Sender: TObject); procedure actWebbrowse(Sender: TObject);
procedure actSelectTreeBackgroundExecute(Sender: TObject);
procedure popupQueryPopup(Sender: TObject); procedure popupQueryPopup(Sender: TObject);
procedure btnDataClick(Sender: TObject); procedure btnDataClick(Sender: TObject);
procedure ListTablesChange(Sender: TBaseVirtualTree; Node: PVirtualNode); procedure ListTablesChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
@ -4701,58 +4698,6 @@ begin
end; end;
procedure TMainForm.actSelectTreeBackgroundExecute(Sender: TObject);
var
cs: TColorSelect;
SessionPaths: TStringList;
i: Integer;
Col: TColor;
ColString: String;
CharPostfix: Char;
function ValueExists(Value: String): Boolean;
var
j: Integer;
begin
// Value exists in string list?
Result := False;
for j:=0 to cs.Dialog.CustomColors.Count-1 do begin
if cs.Dialog.CustomColors.ValueFromIndex[j] = Value then begin
Result := True;
break;
end;
end;
end;
begin
// Select database tree background color
cs := TColorSelect.Create(Self);
cs.Dialog.Color := ActiveConnection.Parameters.SessionColor;
// Add custom colors from all sessions
SessionPaths := TStringList.Create;
AppSettings.GetSessionPaths('', SessionPaths);
CharPostfix := 'A';
for i:=0 to SessionPaths.Count-1 do begin
AppSettings.SessionPath := SessionPaths[i];
Col := AppSettings.ReadInt(asTreeBackground);
if Col <> clNone then begin
ColString := IntToHex(ColorToRgb(Col), 6);
if not ValueExists(ColString) then begin
cs.Dialog.CustomColors.Add('Color'+CharPostfix+'='+ColString);
if cs.Dialog.CustomColors.Count >= MaxCustomColors then
break;
CharPostfix := Chr(Ord(CharPostfix)+1);
end;
end;
end;
if cs.Execute then begin
ActiveConnection.Parameters.SessionColor := cs.Dialog.Color;
AppSettings.SessionPath := ActiveConnection.Parameters.SessionPath;
AppSettings.WriteInt(asTreeBackground, cs.Dialog.Color);
end;
end;
{** {**
Add a SQL-command or comment to SynMemoSQLLog Add a SQL-command or comment to SynMemoSQLLog
} }