Skip to content
Permalink
Browse files

Add custom colors from sessions to background color selector. See htt…

  • Loading branch information...
ansgarbecker committed Jul 11, 2019
1 parent 2930df7 commit 7f214ed4eff0e0703b2d350d1c6319338939af7e
Showing with 29 additions and 6 deletions.
  1. +4 −1 out/locale/en/LC_MESSAGES/default.po
  2. +25 −5 source/connections.pas
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2019-07-10 11:44+0200\n"
"PO-Revision-Date: 2019-07-11 21:34+0200\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n"
@@ -170,6 +170,9 @@ msgstr "Select columns"
msgid "Session manager"
msgstr "Session manager"

msgid "Session"
msgstr "Session"

#. connform..btnSave..Caption
#. connform..popupSessions..menuSave..Caption
#. frmEventEditor..btnSave..Caption
@@ -182,6 +182,7 @@ Tconnform = class(TFormWithSizeGrip)
FPopupDatabases: TPopupMenu;
FButtonAnimationStep: Integer;
FLastSelectedNetTypeGroup: TNetTypeGroup;
FCustomBackgroundColors: TStringList;
procedure RefreshSessions(ParentNode: PVirtualNode);
function SelectedSessionPath: String;
function CurrentParams: TConnectionParameters;
@@ -303,22 +304,41 @@ procedure Tconnform.FormCreate(Sender: TObject);
procedure Tconnform.RefreshSessions(ParentNode: PVirtualNode);
var
SessionNames: TStringList;
RegKey: String;
RegKey,
ColorName,
ColorNamePrefix: String;
i: Integer;
Params: TConnectionParameters;
SessNode: PVirtualNode;
begin
// Initialize session tree
if ParentNode=nil then
ListSessions.Clear
else
// And while we're at it, collect custom colors for background color selector
if ParentNode=nil then begin
ListSessions.Clear;
FreeAndNil(FCustomBackgroundColors);
FCustomBackgroundColors := TStringList.Create;
end else begin
ListSessions.DeleteChildren(ParentNode, True);
end;
SessionNames := NodeSessionNames(ParentNode, RegKey);
ColorNamePrefix := _('Session') + ' "';
for i:=0 to SessionNames.Count-1 do begin
Params := TConnectionParameters.Create(RegKey+SessionNames[i]);
SessNode := ListSessions.AddChild(ParentNode, PConnectionParameters(Params));
if Params.IsFolder then
if Params.IsFolder then begin
RefreshSessions(SessNode);
end else begin
ColorName := ColorNamePrefix + Params.SessionPath + '"';
if Params.SessionColor <> clNone then begin
FCustomBackgroundColors.AddObject(ColorName, TObject(Params.SessionColor));
end;
end;
end;

// Add custom colors if not already done before
if (FCustomBackgroundColors.Count > 0)
and (not ColorBoxBackgroundColor.Items.Text.Contains(ColorNamePrefix)) then begin
ColorBoxBackgroundColor.Items.AddStrings(FCustomBackgroundColors);
end;
end;

0 comments on commit 7f214ed

Please sign in to comment.
You can’t perform that action at this time.