mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 20:00:16 +08:00
Do not autofit "size" column in db tree while nodes get initialized. Implicitly calls OnGetText before text is available. Instead, resize that column only at OnChange time, without examining all possible widths. Just assume "1,023.0 KB" as the widest possible text. Should optimize performance for browsing in tree, and fixes issue #1503.
This commit is contained in:
@ -366,8 +366,8 @@ object MainForm: TMainForm
|
||||
TreeOptions.AutoOptions = [toAutoDropExpand, toAutoTristateTracking, toAutoDeleteMovedNodes]
|
||||
TreeOptions.PaintOptions = [toHideFocusRect, toHotTrack, toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages, toUseExplorerTheme, toHideTreeLinesIfThemed]
|
||||
TreeOptions.SelectionOptions = [toRightClickSelect]
|
||||
OnChange = DBtreeChange
|
||||
OnDblClick = DBtreeDblClick
|
||||
OnExpanded = DBtreeExpanded
|
||||
OnFocusChanged = DBtreeFocusChanged
|
||||
OnGetText = DBtreeGetText
|
||||
OnPaintText = DBtreePaintText
|
||||
|
@ -676,7 +676,7 @@ type
|
||||
procedure DataGridScroll(Sender: TBaseVirtualTree; DeltaX, DeltaY: Integer);
|
||||
procedure ListTablesEditing(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
||||
Column: TColumnIndex; var Allowed: Boolean);
|
||||
procedure DBtreeExpanded(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||
procedure DBtreeChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||
procedure actEditObjectExecute(Sender: TObject);
|
||||
procedure ListTablesDblClick(Sender: TObject);
|
||||
procedure panelTopDblClick(Sender: TObject);
|
||||
@ -6146,10 +6146,6 @@ begin
|
||||
ShowStatus( STATUS_MSG_READY );
|
||||
Screen.Cursor := crDefault;
|
||||
end;
|
||||
// Auto resize "Size" column in dbtree when needed
|
||||
// See also OnResize
|
||||
if coVisible in VT.Header.Columns[1].Options then
|
||||
VT.Header.AutoFitColumns(False, smaUseColumnOption, 1, 1);
|
||||
end;
|
||||
else Exit;
|
||||
end;
|
||||
@ -8172,16 +8168,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.DBtreeExpanded(Sender: TBaseVirtualTree;
|
||||
Node: PVirtualNode);
|
||||
begin
|
||||
// Auto resize "Size" column in dbtree when needed
|
||||
// See also OnInitChildren
|
||||
if coVisible in DBtree.Header.Columns[1].Options then
|
||||
DBtree.Header.AutoFitColumns(False, smaUseColumnOption, 1, 1);
|
||||
end;
|
||||
|
||||
|
||||
function TMainForm.PlaceObjectEditor(Which: TListNodeType): TDBObjectEditor;
|
||||
begin
|
||||
// Place the relevant editor frame onto the editor tab, hide all others
|
||||
@ -9045,5 +9031,16 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.DBtreeChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||
var
|
||||
VT: TVirtualStringTree;
|
||||
begin
|
||||
// Resize "Size" column in dbtree to hold widest possible byte numbers without cutting text
|
||||
VT := Sender as TVirtualStringTree;
|
||||
if coVisible in VT.Header.Columns[1].Options then
|
||||
VT.Header.Columns[1].Width := TextWidth(VT.Canvas, FormatByteNumber(SIZE_MB-1))+VT.TextMargin*2;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
@ -90,6 +90,7 @@ object frmTableTools: TfrmTableTools
|
||||
TabOrder = 0
|
||||
TreeOptions.MiscOptions = [toAcceptOLEDrop, toCheckSupport, toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning, toEditOnClick]
|
||||
TreeOptions.PaintOptions = [toHotTrack, toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages, toUseExplorerTheme, toHideTreeLinesIfThemed]
|
||||
OnChange = TreeObjectsChange
|
||||
OnChecked = TreeObjectsChecked
|
||||
OnGetText = TreeObjectsGetText
|
||||
OnPaintText = TreeObjectsPaintText
|
||||
|
@ -100,6 +100,7 @@ type
|
||||
procedure TreeObjectsPaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode;
|
||||
Column: TColumnIndex; TextType: TVSTTextType);
|
||||
procedure chkBulkTableEditCheckComboClick(Sender: TObject);
|
||||
procedure TreeObjectsChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||
private
|
||||
{ Private declarations }
|
||||
FResults: TObjectList;
|
||||
@ -329,6 +330,12 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmTableTools.TreeObjectsChange(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||
begin
|
||||
Mainform.DBtreeChange(Sender, Node);
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmTableTools.TreeObjectsChecked(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||
begin
|
||||
ValidateControls(Sender);
|
||||
|
Reference in New Issue
Block a user