Skip to content

Commit 5441379

Browse files
committed
fix: do not paint size bar in nodes of level 2, and do not show "-" text there neither
Refs #1500
1 parent 499ee41 commit 5441379

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

source/table_editor.pas

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,10 +1945,14 @@ procedure TfrmTableEditor.treeIndexesBeforeCellPaint(Sender: TBaseVirtualTree;
19451945
var
19461946
Key: TTableKey;
19471947
begin
1948-
// Only paint bar in size column
1949-
if Column in [IndexColNumSize] then begin
1950-
Key := FKeys[Node.Index];
1951-
MainForm.PaintColorBar(Key.Size, FKeys.MaxSize, TargetCanvas, CellRect);
1948+
if Sender.GetNodeLevel(Node) <> 0 then
1949+
Exit;
1950+
case Column of
1951+
IndexColNumSize: begin
1952+
// Paint "progress" bar in size column
1953+
Key := FKeys[Node.Index];
1954+
MainForm.PaintColorBar(Key.Size, FKeys.MaxSize, TargetCanvas, CellRect);
1955+
end;
19521956
end;
19531957
end;
19541958

@@ -2147,41 +2151,40 @@ procedure TfrmTableEditor.treeIndexesGetText(Sender: TBaseVirtualTree;
21472151
TblKey: TTableKey;
21482152
begin
21492153
// Index tree showing cell text
2154+
CellText := '';
21502155
case Sender.GetNodeLevel(Node) of
21512156
0: begin
21522157
TblKey := FKeys[Node.Index];
21532158
case Column of
2154-
IndexColNumName: if TblKey.IsPrimary then
2155-
CellText := TblKey.IndexType + ' KEY' // Fixed name "PRIMARY KEY", cannot be changed
2156-
else
2157-
CellText := TblKey.Name;
2159+
IndexColNumName: begin
2160+
if TblKey.IsPrimary then
2161+
CellText := TblKey.IndexType + ' KEY' // Fixed name "PRIMARY KEY", cannot be changed
2162+
else
2163+
CellText := TblKey.Name;
2164+
end;
21582165
IndexColNumType: CellText := TblKey.IndexType;
21592166
IndexColNumAlgorithm: CellText := TblKey.Algorithm;
21602167
IndexColNumComment: CellText := TblKey.Comment;
2161-
IndexColNumDirection: CellText := ''; // Column collation
21622168
IndexColNumVisibility: CellText := IfThen(
21632169
TblKey.Visible,
21642170
DBObject.Connection.SqlProvider.GetSql(qIndexVisible),
21652171
DBObject.Connection.SqlProvider.GetSql(qIndexInvisible)
21662172
);
2167-
IndexColNumSize: if TblKey.Size >= 0 then
2168-
CellText := FormatByteNumber(TblKey.Size)
2169-
else
2170-
CellText := '';
2173+
IndexColNumSize: begin
2174+
if TblKey.Size >= 0 then
2175+
CellText := FormatByteNumber(TblKey.Size);
2176+
end;
21712177
end;
21722178
end;
21732179
1: begin
21742180
TblKey := FKeys[Node.Parent.Index];
21752181
case Column of
21762182
IndexColNumName: CellText := TblKey.Columns[Node.Index];
21772183
IndexColNumType: CellText := TblKey.SubParts[Node.Index];
2178-
IndexColNumAlgorithm: CellText := ''; // Index algorithm
2179-
IndexColNumComment: CellText := ''; // Index comment
21802184
IndexColNumDirection: begin
21812185
CellText := TblKey.Collations[Node.Index];
21822186
CellText := IfThen(CellText.ToLower = 'a', 'ASC', 'DESC');
21832187
end;
2184-
IndexColNumVisibility: CellText := '';
21852188
end;
21862189
end;
21872190
end;

0 commit comments

Comments
 (0)