mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 18:12:05 +08:00
Introduce TConnectionParameters.SessionColor property to hold the tree background color, and use that to paint the background of relevant nodes only, instead of the whole tree. See http://www.heidisql.com/forum.php?t=10133
This commit is contained in:
@ -4,7 +4,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, windows, mysql_structures, SynRegExpr, Contnrs, Generics.Collections, Generics.Defaults,
|
Classes, SysUtils, windows, mysql_structures, SynRegExpr, Contnrs, Generics.Collections, Generics.Defaults,
|
||||||
DateUtils, Types, ShellApi, Math, Dialogs, ADODB, DB, DBCommon, ComObj;
|
DateUtils, Types, ShellApi, Math, Dialogs, ADODB, DB, DBCommon, ComObj, Graphics;
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -157,6 +157,7 @@ type
|
|||||||
FSSHHost, FSSHUser, FSSHPassword, FSSHPlinkExe, FSSHPrivateKey: String;
|
FSSHHost, FSSHUser, FSSHPassword, FSSHPlinkExe, FSSHPrivateKey: String;
|
||||||
FPort, FSSHPort, FSSHLocalPort, FSSHTimeout: Integer;
|
FPort, FSSHPort, FSSHLocalPort, FSSHTimeout: Integer;
|
||||||
FLoginPrompt, FCompressed, FWindowsAuth, FWantSSL: Boolean;
|
FLoginPrompt, FCompressed, FWindowsAuth, FWantSSL: Boolean;
|
||||||
|
FSessionColor: TColor;
|
||||||
function GetImageIndex: Integer;
|
function GetImageIndex: Integer;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
@ -176,6 +177,7 @@ type
|
|||||||
property NetTypeGroup: TNetTypeGroup read GetNetTypeGroup;
|
property NetTypeGroup: TNetTypeGroup read GetNetTypeGroup;
|
||||||
property ServerVersion: String read FServerVersion write FServerVersion;
|
property ServerVersion: String read FServerVersion write FServerVersion;
|
||||||
property SessionName: String read FSessionName write FSessionName;
|
property SessionName: String read FSessionName write FSessionName;
|
||||||
|
property SessionColor: TColor read FSessionColor write FSessionColor;
|
||||||
property Hostname: String read FHostname write FHostname;
|
property Hostname: String read FHostname write FHostname;
|
||||||
property Port: Integer read FPort write FPort;
|
property Port: Integer read FPort write FPort;
|
||||||
property Username: String read FUsername write FUsername;
|
property Username: String read FUsername write FUsername;
|
||||||
@ -744,6 +746,7 @@ begin
|
|||||||
else begin
|
else begin
|
||||||
Result := TConnectionParameters.Create;
|
Result := TConnectionParameters.Create;
|
||||||
Result.SessionName := Session;
|
Result.SessionName := Session;
|
||||||
|
Result.SessionColor := GetRegValue(REGNAME_TREEBACKGROUND, clWindow, Session);
|
||||||
Result.NetType := TNetType(GetRegValue(REGNAME_NETTYPE, Integer(ntMySQL_TCPIP), Session));
|
Result.NetType := TNetType(GetRegValue(REGNAME_NETTYPE, Integer(ntMySQL_TCPIP), Session));
|
||||||
Result.Hostname := GetRegValue(REGNAME_HOST, '', Session);
|
Result.Hostname := GetRegValue(REGNAME_HOST, '', Session);
|
||||||
Result.Username := GetRegValue(REGNAME_USER, '', Session);
|
Result.Username := GetRegValue(REGNAME_USER, '', Session);
|
||||||
|
@ -4132,7 +4132,7 @@ var
|
|||||||
begin
|
begin
|
||||||
// Select database tree background color
|
// Select database tree background color
|
||||||
cs := TColorSelect.Create(Self);
|
cs := TColorSelect.Create(Self);
|
||||||
cs.Dialog.Color := DBtree.Color;
|
cs.Dialog.Color := ActiveConnection.Parameters.SessionColor;
|
||||||
// Add custom colors from all sessions
|
// Add custom colors from all sessions
|
||||||
SessionNames := TStringList.Create;
|
SessionNames := TStringList.Create;
|
||||||
MainReg.OpenKey(RegPath + REGKEY_SESSIONS, True);
|
MainReg.OpenKey(RegPath + REGKEY_SESSIONS, True);
|
||||||
@ -4151,7 +4151,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if cs.Execute then begin
|
if cs.Execute then begin
|
||||||
DBtree.Color := cs.Dialog.Color;
|
ActiveConnection.Parameters.SessionColor := cs.Dialog.Color;
|
||||||
OpenRegistry(ActiveConnection.Parameters.SessionName);
|
OpenRegistry(ActiveConnection.Parameters.SessionName);
|
||||||
MainReg.WriteInteger(REGNAME_TREEBACKGROUND, cs.Dialog.Color);
|
MainReg.WriteInteger(REGNAME_TREEBACKGROUND, cs.Dialog.Color);
|
||||||
end;
|
end;
|
||||||
@ -7206,7 +7206,6 @@ begin
|
|||||||
// When clicked node is from a different connection than before, do session specific stuff here:
|
// When clicked node is from a different connection than before, do session specific stuff here:
|
||||||
if (PrevDBObj = nil) or (PrevDBObj.Connection <> FActiveDbObj.Connection) then begin
|
if (PrevDBObj = nil) or (PrevDBObj.Connection <> FActiveDbObj.Connection) then begin
|
||||||
LogSQL('Entering session "'+FActiveDbObj.Connection.Parameters.SessionName+'"', lcInfo);
|
LogSQL('Entering session "'+FActiveDbObj.Connection.Parameters.SessionName+'"', lcInfo);
|
||||||
DBTree.Color := GetRegValue(REGNAME_TREEBACKGROUND, clWindow, FActiveDbObj.Connection.Parameters.SessionName);
|
|
||||||
RefreshHelperNode(HELPERNODE_HISTORY);
|
RefreshHelperNode(HELPERNODE_HISTORY);
|
||||||
case FActiveDbObj.Connection.Parameters.NetTypeGroup of
|
case FActiveDbObj.Connection.Parameters.NetTypeGroup of
|
||||||
ngMySQL:
|
ngMySQL:
|
||||||
@ -9837,9 +9836,11 @@ var
|
|||||||
DBObj: PDBObject;
|
DBObj: PDBObject;
|
||||||
AllObjects: TDBObjectList;
|
AllObjects: TDBObjectList;
|
||||||
begin
|
begin
|
||||||
if (CellPaintMode=cpmPaint) and (Column=1) then begin
|
if CellPaintMode=cpmPaint then begin
|
||||||
DBObj := Sender.GetNodeData(Node);
|
DBObj := Sender.GetNodeData(Node);
|
||||||
if DBObj.Connection.DbObjectsCached(DBObj.Database) then begin
|
TargetCanvas.Brush.Color := DbObj.Connection.Parameters.SessionColor;
|
||||||
|
TargetCanvas.FillRect(CellRect);
|
||||||
|
if (Column=1) and DBObj.Connection.DbObjectsCached(DBObj.Database) then begin
|
||||||
AllObjects := DBObj.Connection.GetDBObjects(DBObj.Database);
|
AllObjects := DBObj.Connection.GetDBObjects(DBObj.Database);
|
||||||
PaintColorBar(DBObj.Size, AllObjects.LargestObjectSize, TargetCanvas, CellRect);
|
PaintColorBar(DBObj.Size, AllObjects.LargestObjectSize, TargetCanvas, CellRect);
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user