Skip to content

Commit f492bed

Browse files
committed
feat: create opt-in option for displaying columns in database tree
Refs #2069
1 parent ed881b3 commit f492bed

4 files changed

Lines changed: 42 additions & 4 deletions

File tree

extra/locale/heidisql.po

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: HeidiSQL\n"
99
"POT-Creation-Date: 2012-11-05 21:40\n"
10-
"PO-Revision-Date: 2026-06-14 12:08+0200\n"
10+
"PO-Revision-Date: 2026-07-27 19:34+0200\n"
1111
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
1212
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
1313
"Language: en\n"
@@ -2364,6 +2364,9 @@ msgstr "Horizontal scrollbar"
23642364
msgid "Group objects by type"
23652365
msgstr "Group objects by type"
23662366

2367+
msgid "Columns below tables in tree"
2368+
msgstr "Columns below tables in tree"
2369+
23672370
#. MainForm..popupDB..menuEditObject..Caption
23682371
#: main.dfm:8573
23692372
msgid "Edit"

source/apphelpers.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ TCustomComboBoxHelper = class helper for TCustomComboBox
228228
asLogUserSQL, asLogSQL, asLogInfos, asLogDebug, asLogScript, asLogTimestamp, asFieldColorNumeric,
229229
asFieldColorReal, asFieldColorText, asFieldColorBinary, asFieldColorDatetime, asFieldColorSpatial,
230230
asFieldColorOther, asFieldEditorBinary, asFieldEditorDatetime, asFieldEditorDatetimePrefill, asFieldEditorEnum,
231-
asFieldEditorSet, asFieldNullBackground, asRowBackgroundEven, asRowBackgroundOdd, asGroupTreeObjects, asDisplayObjectSizeColumn, asSQLfile,
231+
asFieldEditorSet, asFieldNullBackground, asRowBackgroundEven, asRowBackgroundOdd, asGroupTreeObjects, asTreeShowColumns, asDisplayObjectSizeColumn, asSQLfile,
232232
asActionShortcut1, asActionShortcut2, asHighlighterForeground, asHighlighterBackground, asHighlighterStyle,
233233
asListColWidths, asListColsVisible, asListColPositions, asListColSort, asSessionFolder,
234234
asRecentFilter, asTimestampColumns, asDateTimeEditorCursorPos, asAppLanguage, asAutoExpand, asDoubleClickInsertsNodeText, asForeignDropDown,
@@ -3883,6 +3883,7 @@ constructor TAppSettings.Create;
38833883
InitSetting(asRowBackgroundEven, 'RowBackgroundEven', clNone);
38843884
InitSetting(asRowBackgroundOdd, 'RowBackgroundOdd', clNone);
38853885
InitSetting(asGroupTreeObjects, 'GroupTreeObjects', 0, False);
3886+
InitSetting(asTreeShowColumns, 'TreeShowColumns', 0, False);
38863887
InitSetting(asDisplayObjectSizeColumn, 'DisplayObjectSizeColumn', 0, True);
38873888
InitSetting(asDisplayLogPanel, 'DisplayLogPanel', 0, True);
38883889
InitSetting(asDisplayTreeFilters, 'DisplayTreeFilters', 0, True);

source/main.lfm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3693,6 +3693,10 @@ object MainForm: TMainForm
36933693
Action = actDisplayTreeFilters
36943694
AutoCheck = True
36953695
end
3696+
object menuTreeShowColumns1: TMenuItem
3697+
Action = actTreeShowColumns
3698+
AutoCheck = True
3699+
end
36963700
object menuColorScheme: TMenuItem
36973701
Caption = 'Color scheme'
36983702
ImageIndex = 115
@@ -5117,6 +5121,12 @@ object MainForm: TMainForm
51175121
ImageIndex = 58
51185122
OnExecute = actDataEditWithoutLookupExecute
51195123
end
5124+
object actTreeShowColumns: TAction
5125+
Category = 'Various'
5126+
AutoCheck = True
5127+
Caption = 'Columns below tables in tree'
5128+
OnExecute = actTreeShowColumnsExecute
5129+
end
51205130
end
51215131
object ImageListMain: TImageList
51225132
Scaled = True
@@ -20423,6 +20433,10 @@ object MainForm: TMainForm
2042320433
Action = actFavoriteObjectsOnly
2042420434
AutoCheck = True
2042520435
end
20436+
object menuTreeShowColumns2: TMenuItem
20437+
Action = actTreeShowColumns
20438+
AutoCheck = True
20439+
end
2042620440
end
2042720441
object menuPrint: TMenuItem
2042820442
Action = actPrintList

source/main.pas

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ TQueryHistoryItemComparer = class(TComparer<TQueryHistoryItem>)
217217
TMainForm = class(TExtForm)
218218
actCopyColumnNames: TAction;
219219
actDataEditWithoutLookup: TAction;
220+
actTreeShowColumns: TAction;
220221
actPreferencesSQL: TAction;
221222
MainMenu1: TMainMenu;
222223
MainMenuFile: TMenuItem;
@@ -226,6 +227,8 @@ TMainForm = class(TExtForm)
226227
menuColorScheme: TMenuItem;
227228
MenuItem3: TMenuItem;
228229
menuDataEditWithoutLookup: TMenuItem;
230+
menuTreeShowColumns2: TMenuItem;
231+
menuTreeShowColumns1: TMenuItem;
229232
menuRenameSnippet: TMenuItem;
230233
menuSQLpreferences: TMenuItem;
231234
menuQFdummy: TMenuItem;
@@ -837,6 +840,7 @@ TMainForm = class(TExtForm)
837840
procedure actDataEditWithoutLookupExecute(Sender: TObject);
838841
procedure actNextTabExecute(Sender: TObject);
839842
procedure actPreviousTabExecute(Sender: TObject);
843+
procedure actTreeShowColumnsExecute(Sender: TObject);
840844
procedure AnyGridContextPopup(Sender: TObject; MousePos: TPoint;
841845
var Handled: Boolean);
842846
procedure DataGridContextPopup(Sender: TObject; MousePos: TPoint;
@@ -1831,6 +1835,7 @@ procedure TMainForm.FormDestroy(Sender: TObject);
18311835
AppSettings.WriteInt(asCompletionProposalNbLinesInWindow, SynCompletionProposal.TheForm.ScaleFormToDesign(SynCompletionProposal.LinesInWindow));
18321836
AppSettings.WriteInt(asDbtreewidth, ScaleFormToDesign(pnlLeft.width));
18331837
AppSettings.WriteBool(asGroupTreeObjects, actGroupObjects.Checked);
1838+
AppSettings.WriteBool(asTreeShowColumns, actTreeShowColumns.Checked);
18341839
AppSettings.WriteInt(asDataPreviewHeight, ScaleFormToDesign(pnlPreview.Height));
18351840
AppSettings.WriteBool(asDataPreviewEnabled, actDataPreview.Checked);
18361841
AppSettings.WriteInt(asLogHeight, ScaleFormToDesign(SynMemoSQLLog.Height));
@@ -2063,6 +2068,7 @@ procedure TMainForm.FormCreate(Sender: TObject);
20632068

20642069
// Display options, and database tree options
20652070
actGroupObjects.Checked := AppSettings.ReadBool(asGroupTreeObjects);
2071+
actTreeShowColumns.Checked := AppSettings.ReadBool(asTreeShowColumns);
20662072
actDisplayObjectSize.Checked := AppSettings.ReadBool(asDisplayObjectSizeColumn);
20672073
actDisplayObjectSizeExecute(nil);
20682074
actDisplayLogPanel.Checked := AppSettings.ReadBool(asDisplayLogPanel);
@@ -4573,6 +4579,12 @@ procedure TMainForm.actPreviousTabExecute(Sender: TObject);
45734579
PageControlMain.SelectNextPage(False);
45744580
end;
45754581

4582+
procedure TMainForm.actTreeShowColumnsExecute(Sender: TObject);
4583+
begin
4584+
// Show columns in table nodes on tree
4585+
RefreshTree(nil);
4586+
end;
4587+
45764588
procedure TMainForm.AnyGridContextPopup(Sender: TObject; MousePos: TPoint;
45774589
var Handled: Boolean);
45784590
var
@@ -9836,6 +9848,14 @@ procedure TMainForm.DBtreeInitNode(Sender: TBaseVirtualTree; ParentNode, Node:
98369848
Item, ParentObj: PDBObject;
98379849
DBObjects: TDBObjectList;
98389850
Columns: TTableColumnList;
9851+
9852+
function TreeShowColumns: Boolean;
9853+
begin
9854+
Result := Item.NodeType = lntTable;
9855+
if Sender = DBtree then // optional in dbtree
9856+
Result := actTreeShowColumns.Checked;
9857+
end;
9858+
98399859
begin
98409860
Item := Sender.GetNodeData(Node);
98419861
if (not Assigned(ParentNode)) or (ParentNode = nil) then begin
@@ -9868,14 +9888,14 @@ procedure TMainForm.DBtreeInitNode(Sender: TBaseVirtualTree; ParentNode, Node:
98689888
end else begin
98699889
DBObjects := ParentObj.Connection.GetDBObjects(ParentObj.Database);
98709890
Item^ := DBObjects[Node.Index];
9871-
if Item.NodeType = lntTable then
9891+
if TreeShowColumns then
98729892
Include(InitialStates, ivsHasChildren);
98739893
end;
98749894
end;
98759895
lntGroup: begin
98769896
DBObjects := ParentObj.Connection.GetDBObjects(ParentObj.Database, False, ParentObj.GroupType);
98779897
Item^ := DBObjects[Node.Index];
9878-
if Item.NodeType = lntTable then
9898+
if TreeShowColumns then
98799899
Include(InitialStates, ivsHasChildren);
98809900
end;
98819901
lntTable: begin

0 commit comments

Comments
 (0)