@@ -9559,20 +9559,8 @@ procedure TMainForm.DBtreeGetImageIndex(Sender: TBaseVirtualTree; Node:
95599559 Exit;
95609560 DBObj := Sender.GetNodeData(Node);
95619561 case Kind of
9562- ikNormal, ikSelected: begin
9563- ImageIndex := DBObj.ImageIndex;
9564- Ghosted := (DBObj.NodeType = lntNone) and (not DBObj.Connection.Active);
9565- Ghosted := Ghosted or ((DBObj.NodeType = lntDB)
9566- and (not DBObj.Connection.DbObjectsCached(DBObj.Database))
9567- );
9568- Ghosted := Ghosted or ((DBObj.NodeType = lntGroup)
9569- and Sender.ChildrenInitialized[Node]
9570- and (Sender.ChildCount[Node] = 0)
9571- );
9572- Ghosted := Ghosted or ((DBObj.NodeType in [lntTable..lntEvent])
9573- and (not DBObj.WasSelected)
9574- );
9575- end;
9562+ ikNormal, ikSelected:
9563+ ImageIndex := DBObj.ImageIndex;
95769564 ikOverlay:
95779565 ImageIndex := DBObj.OverlayImageIndex;
95789566 end;
@@ -10045,34 +10033,59 @@ procedure TMainForm.DBtreePaintText(Sender: TBaseVirtualTree; const
1004510033var
1004610034 DBObj: PDBObject;
1004710035 WalkNode: PVirtualNode;
10036+ Ghosted: Boolean;
1004810037begin
1004910038 // Grey out non-current connection nodes, and rather unimportant "Size" column
1005010039 DBObj := Sender.GetNodeData(Node);
10051- if DBObj.Connection <> ActiveConnection then
10052- TargetCanvas.Font.Color := clGrayText
10053- else if (Column = 1) and (DBObj.NodeType in [lntTable..lntEvent]) then
10040+ if DBObj.Connection <> ActiveConnection then begin
1005410041 TargetCanvas.Font.Color := clGrayText;
10042+ Exit;
10043+ end;
1005510044
10056- // Set bold text if painted node is in focused path
10057- if (Column = DBtree.Header.MainColumn) then begin
10058- WalkNode := Sender.FocusedNode;
10059- while Assigned(WalkNode) do begin
10060- if WalkNode = Node then begin
10061- TargetCanvas.Font.Style := TargetCanvas.Font.Style + [fsBold];
10062- Break;
10063- end;
10064- try
10065- // This crashes in some situations, which I could never reproduce.
10066- // See uploaded crash reports and issue #1270.
10067- WalkNode := Sender.NodeParent[WalkNode];
10068- except
10069- on E:EAccessViolation do begin
10070- LogSQL('DBtreePaintText, NodeParent: '+E.Message, lcError);
10045+ case Column of
10046+ 0: begin
10047+ // Set bold text if painted node is in focused path
10048+ WalkNode := Sender.FocusedNode;
10049+ while Assigned(WalkNode) do begin
10050+ if WalkNode = Node then begin
10051+ TargetCanvas.Font.Style := TargetCanvas.Font.Style + [fsBold];
1007110052 Break;
1007210053 end;
10054+ try
10055+ // This crashes in some situations, which I could never reproduce.
10056+ // See uploaded crash reports and issue #1270.
10057+ WalkNode := Sender.NodeParent[WalkNode];
10058+ except
10059+ on E:EAccessViolation do begin
10060+ LogSQL('DBtreePaintText, NodeParent: '+E.Message, lcError);
10061+ Break;
10062+ end;
10063+ end;
1007310064 end;
10065+
10066+ // Moved from OnGetImageIndex, where the icon used to be painted lighter if the node was yet unseen
10067+ Ghosted := (DBObj.NodeType = lntNone) and (not DBObj.Connection.Active);
10068+ Ghosted := Ghosted or ((DBObj.NodeType = lntDB)
10069+ and (not DBObj.Connection.DbObjectsCached(DBObj.Database))
10070+ );
10071+ Ghosted := Ghosted or ((DBObj.NodeType = lntGroup)
10072+ and Sender.ChildrenInitialized[Node]
10073+ and (Sender.ChildCount[Node] = 0)
10074+ );
10075+ Ghosted := Ghosted or ((DBObj.NodeType in [lntTable..lntEvent])
10076+ and (not DBObj.WasSelected)
10077+ );
10078+ if Ghosted then
10079+ TargetCanvas.Font.Color := clGrayText;
10080+
10081+ end;
10082+
10083+ 1: begin
10084+ if DBObj.NodeType in [lntTable..lntEvent] then
10085+ TargetCanvas.Font.Color := clGrayText;
1007410086 end;
1007510087 end;
10088+
1007610089end;
1007710090
1007810091
0 commit comments