Skip to content

Commit f987c81

Browse files
committed
enhance: set font style and color of size column in tree
1 parent 42abf46 commit f987c81

File tree

1 file changed

+30
-40
lines changed

1 file changed

+30
-40
lines changed

source/main.pas

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10041,50 +10041,40 @@ procedure TMainForm.DBtreePaintText(Sender: TBaseVirtualTree; const
1004110041
Exit;
1004210042
end;
1004310043

10044-
case Column of
10045-
0: begin
10046-
// Set bold text if painted node is in focused path
10047-
WalkNode := Sender.FocusedNode;
10048-
while Assigned(WalkNode) do begin
10049-
if WalkNode = Node then begin
10050-
TargetCanvas.Font.Style := TargetCanvas.Font.Style + [fsBold];
10051-
Break;
10052-
end;
10053-
try
10054-
// This crashes in some situations, which I could never reproduce.
10055-
// See uploaded crash reports and issue #1270.
10056-
WalkNode := Sender.NodeParent[WalkNode];
10057-
except
10058-
on E:EAccessViolation do begin
10059-
LogSQL('DBtreePaintText, NodeParent: '+E.Message, lcError);
10060-
Break;
10061-
end;
10062-
end;
10063-
end;
10064-
10065-
// Moved from OnGetImageIndex, where the icon used to be painted lighter if the node was yet unseen
10066-
Ghosted := (DBObj.NodeType = lntNone) and (not DBObj.Connection.Active);
10067-
Ghosted := Ghosted or ((DBObj.NodeType = lntDB)
10068-
and (not DBObj.Connection.DbObjectsCached(DBObj.Database))
10069-
);
10070-
Ghosted := Ghosted or ((DBObj.NodeType = lntGroup)
10071-
and Sender.ChildrenInitialized[Node]
10072-
and (Sender.ChildCount[Node] = 0)
10073-
);
10074-
Ghosted := Ghosted or ((DBObj.NodeType in [lntTable..lntEvent])
10075-
and (not DBObj.WasSelected)
10076-
);
10077-
if Ghosted then
10078-
TargetCanvas.Font.Color := clGrayText;
10079-
10044+
// Set bold text if painted node is in focused path
10045+
WalkNode := Sender.FocusedNode;
10046+
while Assigned(WalkNode) do begin
10047+
if WalkNode = Node then begin
10048+
TargetCanvas.Font.Style := TargetCanvas.Font.Style + [fsBold];
10049+
Break;
1008010050
end;
10081-
10082-
1: begin
10083-
if DBObj.NodeType in [lntTable..lntEvent] then
10084-
TargetCanvas.Font.Color := clGrayText;
10051+
try
10052+
// This crashes in some situations, which I could never reproduce.
10053+
// See uploaded crash reports and issue #1270.
10054+
WalkNode := Sender.NodeParent[WalkNode];
10055+
except
10056+
on E:EAccessViolation do begin
10057+
LogSQL('DBtreePaintText, NodeParent: '+E.Message, lcError);
10058+
Break;
10059+
end;
1008510060
end;
1008610061
end;
1008710062

10063+
// Moved from OnGetImageIndex, where the icon used to be painted lighter if the node was yet unseen
10064+
Ghosted := (DBObj.NodeType = lntNone) and (not DBObj.Connection.Active);
10065+
Ghosted := Ghosted or ((DBObj.NodeType = lntDB)
10066+
and (not DBObj.Connection.DbObjectsCached(DBObj.Database))
10067+
);
10068+
Ghosted := Ghosted or ((DBObj.NodeType = lntGroup)
10069+
and Sender.ChildrenInitialized[Node]
10070+
and (Sender.ChildCount[Node] = 0)
10071+
);
10072+
Ghosted := Ghosted or ((DBObj.NodeType in [lntTable..lntEvent])
10073+
and (not DBObj.WasSelected)
10074+
);
10075+
if Ghosted then
10076+
TargetCanvas.Font.Color := clGrayText;
10077+
1008810078
end;
1008910079

1009010080

0 commit comments

Comments
 (0)