Show used colors from other sessions in color picker as favorite colors. Fixes issue #2704.

This commit is contained in:
Ansgar Becker
2012-02-05 12:19:05 +00:00
parent b271ea2670
commit bd5ffd8362

View File

@ -3882,10 +3882,28 @@ end;
procedure TMainForm.actSelectTreeBackgroundExecute(Sender: TObject);
var
cs: TColorSelect;
SessionNames: TStringList;
i: Integer;
Col: Integer;
CharPostfix: Char;
begin
// Select database tree background color
cs := TColorSelect.Create(Self);
cs.Dialog.Color := DBtree.Color;
// Add custom colors from all sessions
SessionNames := TStringList.Create;
MainReg.OpenKey(RegPath + REGKEY_SESSIONS, True);
MainReg.GetKeyNames(SessionNames);
CharPostfix := 'A';
for i:=0 to SessionNames.Count-1 do begin
Col := GetRegValue(REGNAME_TREEBACKGROUND, clWhite, SessionNames[i]);
if Col <> clWhite then begin
cs.Dialog.CustomColors.Add('Color'+CharPostfix+'='+Copy(ColorToString(Col),4,8));
if CharPostFix = 'P' then
break;
CharPostfix := Chr(Ord(CharPostfix)+1);
end;
end;
if cs.Execute then begin
DBtree.Color := cs.Dialog.Color;
OpenRegistry(ActiveConnection.Parameters.SessionName);