mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 18:12:05 +08:00
Set font size per Ctrl + mousewheel in any grid view.
This commit is contained in:
@ -1147,6 +1147,7 @@ type
|
|||||||
procedure TaskDialogHyperLinkClicked(Sender: TObject);
|
procedure TaskDialogHyperLinkClicked(Sender: TObject);
|
||||||
function HasDonated(ForceCheck: Boolean): TThreeStateBoolean;
|
function HasDonated(ForceCheck: Boolean): TThreeStateBoolean;
|
||||||
procedure ApplyVTFilter(FromTimer: Boolean);
|
procedure ApplyVTFilter(FromTimer: Boolean);
|
||||||
|
procedure ApplyFontToGrids;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -7288,6 +7289,28 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TMainForm.ApplyFontToGrids;
|
||||||
|
var
|
||||||
|
i, j: Integer;
|
||||||
|
QueryTab: TQueryTab;
|
||||||
|
Grid: TVirtualStringTree;
|
||||||
|
begin
|
||||||
|
// Apply somehow changed font settings to all existing grids
|
||||||
|
DataGrid.Font.Name := AppSettings.ReadString(asDataFontName);
|
||||||
|
DataGrid.Font.Size := AppSettings.ReadInt(asDataFontSize);
|
||||||
|
FixVT(Mainform.DataGrid, AppSettings.ReadInt(asGridRowLineCount));
|
||||||
|
for i:=Mainform.tabQuery.PageIndex to Mainform.PageControlMain.PageCount-1 do begin
|
||||||
|
QueryTab := Mainform.QueryTabs[i-Mainform.tabQuery.PageIndex];
|
||||||
|
for j:=0 to QueryTab.ResultTabs.Count-1 do begin
|
||||||
|
Grid := QueryTab.ResultTabs[j].Grid;
|
||||||
|
Grid.Font.Name := AppSettings.ReadString(asDataFontName);
|
||||||
|
Grid.Font.Size := AppSettings.ReadInt(asDataFontSize);
|
||||||
|
FixVT(Grid, AppSettings.ReadInt(asGridRowLineCount));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TMainForm.ListVariablesBeforeCellPaint(Sender: TBaseVirtualTree;
|
procedure TMainForm.ListVariablesBeforeCellPaint(Sender: TBaseVirtualTree;
|
||||||
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
|
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
|
||||||
CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
|
CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
|
||||||
@ -8424,10 +8447,11 @@ procedure TMainForm.AnyGridMouseWheel(Sender: TObject; Shift: TShiftState; Wheel
|
|||||||
var
|
var
|
||||||
VT: TVirtualStringTree;
|
VT: TVirtualStringTree;
|
||||||
Node: PVirtualNode;
|
Node: PVirtualNode;
|
||||||
|
NewFontSize: Integer;
|
||||||
begin
|
begin
|
||||||
// Advance to next or previous grid node on Shift+MouseWheel
|
// Advance to next or previous grid node on Shift+MouseWheel
|
||||||
|
VT := Sender as TVirtualStringTree;
|
||||||
if KeyPressed(VK_SHIFT) then begin
|
if KeyPressed(VK_SHIFT) then begin
|
||||||
VT := Sender as TVirtualStringTree;
|
|
||||||
if Assigned(VT.FocusedNode) then begin
|
if Assigned(VT.FocusedNode) then begin
|
||||||
if WheelDelta > 0 then
|
if WheelDelta > 0 then
|
||||||
Node := VT.FocusedNode.PrevSibling
|
Node := VT.FocusedNode.PrevSibling
|
||||||
@ -8438,6 +8462,16 @@ begin
|
|||||||
Handled := True;
|
Handled := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end else if KeyPressed(VK_CONTROL) then begin
|
||||||
|
NewFontSize := VT.Font.Size;
|
||||||
|
if WheelDelta > 0 then
|
||||||
|
NewFontSize := NewFontSize + 1
|
||||||
|
else
|
||||||
|
NewFontSize := NewFontSize - 1;
|
||||||
|
NewFontSize := Max(NewFontSize, 1);
|
||||||
|
AppSettings.ResetPath;
|
||||||
|
AppSettings.WriteInt(asDataFontSize, NewFontSize);
|
||||||
|
ApplyFontToGrids;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -348,18 +348,7 @@ begin
|
|||||||
Mainform.SetupSynEditors;
|
Mainform.SetupSynEditors;
|
||||||
|
|
||||||
// Set relevant properties in mainform
|
// Set relevant properties in mainform
|
||||||
Mainform.DataGrid.Font.Name := comboDataFontName.Text;
|
MainForm.ApplyFontToGrids;
|
||||||
Mainform.DataGrid.Font.Size := updownDataFontSize.Position;
|
|
||||||
FixVT(Mainform.DataGrid, updownGridRowsLineCount.Position);
|
|
||||||
for i:=Mainform.tabQuery.PageIndex to Mainform.PageControlMain.PageCount-1 do begin
|
|
||||||
QueryTab := Mainform.QueryTabs[i-Mainform.tabQuery.PageIndex];
|
|
||||||
for j:=0 to QueryTab.ResultTabs.Count-1 do begin
|
|
||||||
Grid := QueryTab.ResultTabs[j].Grid;
|
|
||||||
Grid.Font.Name := comboDataFontName.Text;
|
|
||||||
Grid.Font.Size := updownDataFontSize.Position;
|
|
||||||
FixVT(Grid, updownGridRowsLineCount.Position);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
Mainform.LogToFile := chkLogToFile.Checked;
|
Mainform.LogToFile := chkLogToFile.Checked;
|
||||||
DatatypeCategories[dtcInteger].Color := FGridTextColors[dtcInteger];
|
DatatypeCategories[dtcInteger].Color := FGridTextColors[dtcInteger];
|
||||||
|
Reference in New Issue
Block a user