mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Issue #1527: Reset height of query tabs and log panel once when area between them is hidden due to a resize. Was previously done in FormResize, now once in FormShow.
This commit is contained in:
@@ -2463,7 +2463,7 @@ begin
|
||||
if not TabCaption.IsEmpty then
|
||||
SetTabCaption(Tab.TabSheet.PageIndex, TabCaption);
|
||||
if EditorHeight > 50 then
|
||||
Tab.Memo.Height := EditorHeight;
|
||||
Tab.pnlMemo.Height := EditorHeight;
|
||||
if HelpersWidth > 50 then
|
||||
Tab.pnlHelpers.Width := HelpersWidth;
|
||||
Tab.ListBindParams.AsText := BindParams;
|
||||
@@ -2654,15 +2654,8 @@ end;
|
||||
procedure TMainForm.FormResize(Sender: TObject);
|
||||
var
|
||||
PanelRect: TRect;
|
||||
Tab: TQueryTab;
|
||||
w0, w1, w2, w3, w4, w5, w6: Integer;
|
||||
|
||||
function GridNeedHeight: Integer;
|
||||
begin
|
||||
// Return missing number of height pixels the query grid needs
|
||||
Result := Max(0, Tab.spltQuery.MinSize - (Tab.TabSheet.Height - Tab.pnlMemo.Height - Tab.spltQuery.Height - Tab.tabsetQuery.Height));
|
||||
end;
|
||||
|
||||
function CalcPanelWidth(SampleText: String; MaxPercentage: Integer): Integer;
|
||||
var
|
||||
MaxPixels: Integer;
|
||||
@@ -2703,15 +2696,6 @@ begin
|
||||
lblDataTop.Width := pnlDataTop.Width - tlbDataButtons.Width - 10;
|
||||
FixQueryTabCloseButtons;
|
||||
|
||||
// Ensure query grids are not overlapped by sql log
|
||||
for Tab in QueryTabs do begin
|
||||
// Decrease height of pnlMemo if grid has not enough height
|
||||
// Disabled for annoyance reasons, see #1113
|
||||
// Tab.pnlMemo.Height := Max(Tab.pnlMemo.Height-GridNeedHeight, Tab.spltQuery.MinSize);
|
||||
// Try again and resize SQLLog if required
|
||||
SynMemoSQLLog.Height := Max(SynMemoSQLLog.Height-GridNeedHeight, spltTopBottom.MinSize);
|
||||
end;
|
||||
|
||||
// Right aligned button
|
||||
if imgDonate.Visible then begin
|
||||
imgDonate.Width := 122;
|
||||
@@ -2722,6 +2706,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormShow(Sender: TObject);
|
||||
var
|
||||
Tab: TQueryTab;
|
||||
ResizeResult: Boolean;
|
||||
begin
|
||||
// Window dimensions
|
||||
if WindowState <> wsMaximized then begin
|
||||
@@ -2729,6 +2716,19 @@ begin
|
||||
Height := AppSettings.ReadIntDpiAware(asMainWinHeight, Self);
|
||||
end;
|
||||
|
||||
// Reset height of query memos and log panel if area between them is hidden through resize
|
||||
ResizeResult := False;
|
||||
for Tab in QueryTabs do begin
|
||||
if Tab.pnlMemo.ClientToScreen(Tab.pnlMemo.ClientRect).Bottom > SynMemoSQLLog.ClientToScreen(SynMemoSQLLog.ClientRect).Top - 50 then begin
|
||||
LogSQL('Reset height of query tab #'+Tab.Number.ToString+' to give result area vertical space.');
|
||||
Tab.pnlMemo.Height := AppSettings.GetDefaultInt(asQuerymemoheight);
|
||||
ResizeResult := True;
|
||||
end;
|
||||
end;
|
||||
if ResizeResult then begin
|
||||
SynMemoSQLLog.Height := AppSettings.GetDefaultInt(asLogHeight);
|
||||
end;
|
||||
|
||||
LogSQL(f_('Scaling controls to screen DPI: %d%%', [Round(ScaleFactor*100)]));
|
||||
if TStyleManager.IsCustomStyleActive and (ScaleFactor<>1) then begin
|
||||
LogSQL(f_('Caution: Style "%s" selected and non-default DPI factor - be aware that some styles appear broken with high DPI settings!', [TStyleManager.ActiveStyle.Name]));
|
||||
|
||||
Reference in New Issue
Block a user