Skip to content

Commit 3e678bc

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 c5201eb commit 3e678bc

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
@@ -1947,10 +1947,14 @@ procedure TfrmTableEditor.treeIndexesBeforeCellPaint(Sender: TBaseVirtualTree;
19471947
var
19481948
Key: TTableKey;
19491949
begin
1950-
// Only paint bar in size column
1951-
if Column in [IndexColNumSize] then begin
1952-
Key := FKeys[Node.Index];
1953-
MainForm.PaintColorBar(Key.Size, FKeys.MaxSize, TargetCanvas, CellRect);
1950+
if Sender.GetNodeLevel(Node) <> 0 then
1951+
Exit;
1952+
case Column of
1953+
IndexColNumSize: begin
1954+
// Paint "progress" bar in size column
1955+
Key := FKeys[Node.Index];
1956+
MainForm.PaintColorBar(Key.Size, FKeys.MaxSize, TargetCanvas, CellRect);
1957+
end;
19541958
end;
19551959
end;
19561960

@@ -2149,41 +2153,40 @@ procedure TfrmTableEditor.treeIndexesGetText(Sender: TBaseVirtualTree;
21492153
TblKey: TTableKey;
21502154
begin
21512155
// Index tree showing cell text
2156+
CellText := '';
21522157
case Sender.GetNodeLevel(Node) of
21532158
0: begin
21542159
TblKey := FKeys[Node.Index];
21552160
case Column of
2156-
IndexColNumName: if TblKey.IsPrimary then
2157-
CellText := TblKey.IndexType + ' KEY' // Fixed name "PRIMARY KEY", cannot be changed
2158-
else
2159-
CellText := TblKey.Name;
2161+
IndexColNumName: begin
2162+
if TblKey.IsPrimary then
2163+
CellText := TblKey.IndexType + ' KEY' // Fixed name "PRIMARY KEY", cannot be changed
2164+
else
2165+
CellText := TblKey.Name;
2166+
end;
21602167
IndexColNumType: CellText := TblKey.IndexType;
21612168
IndexColNumAlgorithm: CellText := TblKey.Algorithm;
21622169
IndexColNumComment: CellText := TblKey.Comment;
2163-
IndexColNumDirection: CellText := ''; // Column collation
21642170
IndexColNumVisibility: CellText := IfThen(
21652171
TblKey.Visible,
21662172
DBObject.Connection.SqlProvider.GetSql(qIndexVisible),
21672173
DBObject.Connection.SqlProvider.GetSql(qIndexInvisible)
21682174
);
2169-
IndexColNumSize: if TblKey.Size >= 0 then
2170-
CellText := FormatByteNumber(TblKey.Size)
2171-
else
2172-
CellText := '';
2175+
IndexColNumSize: begin
2176+
if TblKey.Size >= 0 then
2177+
CellText := FormatByteNumber(TblKey.Size);
2178+
end;
21732179
end;
21742180
end;
21752181
1: begin
21762182
TblKey := FKeys[Node.Parent.Index];
21772183
case Column of
21782184
IndexColNumName: CellText := TblKey.Columns[Node.Index];
21792185
IndexColNumType: CellText := TblKey.SubParts[Node.Index];
2180-
IndexColNumAlgorithm: CellText := ''; // Index algorithm
2181-
IndexColNumComment: CellText := ''; // Index comment
21822186
IndexColNumDirection: begin
21832187
CellText := TblKey.Collations[Node.Index];
21842188
CellText := IfThen(CellText.ToLower = 'a', 'ASC', 'DESC');
21852189
end;
2186-
IndexColNumVisibility: CellText := '';
21872190
end;
21882191
end;
21892192
end;

0 commit comments

Comments
 (0)