spready: Add option for automatic row height calculation after file is loaded.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6593 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-08-11 10:39:34 +00:00
parent 5d1ba18b74
commit c3a67dc576
2 changed files with 30 additions and 0 deletions

View File

@ -1928,6 +1928,12 @@ object MainForm: TMainForm
Hint = 'Clear format'
ImageIndex = 74
end
object AcSettingsAutoUpdateRowheights: TAction
Category = 'Settings'
AutoCheck = True
Caption = 'Update row heights after loading'
OnExecute = AcSettingsAutoUpdateRowheightsExecute
end
end
object ImageList: TImageList
left = 176
@ -4803,6 +4809,10 @@ object MainForm: TMainForm
Action = AcSettingsReadFormulas
AutoCheck = True
end
object MenuItem192: TMenuItem
Action = AcSettingsAutoUpdateRowheights
AutoCheck = True
end
end
object MnuHelp: TMenuItem
Caption = 'Help'

View File

@ -38,6 +38,7 @@ type
AcRowHeight: TAction;
AcColWidth: TAction;
AcSettingsReadFormulas: TAction;
AcSettingsAutoUpdateRowheights: TAction;
AcWorksheetProtection: TAction;
AcWorksheetRTL: TAction;
AcViewInspector: TAction;
@ -93,6 +94,7 @@ type
MenuItem189: TMenuItem;
MenuItem190: TMenuItem;
MenuItem191: TMenuItem;
MenuItem192: TMenuItem;
MenuItem2: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
@ -447,6 +449,7 @@ type
procedure AcRowAddExecute(Sender: TObject);
procedure AcRowDeleteExecute(Sender: TObject);
procedure AcRowHeightExecute(Sender: TObject);
procedure AcSettingsAutoUpdateRowheightsExecute(Sender: TObject);
procedure AcSettingsReadFormulasExecute(Sender: TObject);
procedure AcSortColAscExecute(Sender: TObject);
procedure AcSortExecute(Sender: TObject);
@ -493,6 +496,7 @@ type
AWorksheet: TsWorksheet; ARow, ACol: Cardinal);
procedure UpdateCaption;
procedure UpdateInspectorColumns;
procedure UpdateRowHeights;
protected
procedure ReadFromIni;
procedure WriteToIni;
@ -742,6 +746,12 @@ begin
end;
end;
procedure TMainForm.AcSettingsAutoUpdateRowheightsExecute(Sender: TObject);
begin
if AcSettingsAutoUpdateRowHeights.Checked then
UpdateRowHeights;
end;
procedure TMainForm.AcWorksheetRTLExecute(Sender: TObject);
begin
if AcWorksheetRTL.Checked then
@ -1124,6 +1134,8 @@ begin
WorkbookSource.FileName := UTF8ToAnsi(AFileName); // this loads the file
FMRUMenuManager.AddToRecent(AFileName);
UpdateCaption;
if AcSettingsAutoUpdateRowHeights.Checked then
UpdateRowHeights;
finally
Screen.Cursor := crs;
end;
@ -1174,6 +1186,8 @@ begin
AcSettingsReadFormulas.Checked := ini.ReadBool('Settings', 'ReadFormulas', true);
AcSettingsReadFormulasExecute(nil);
AcSettingsAutoUpdateRowHeights.Checked := ini.ReadBool('Settings', 'AutoUpdateRowHeights', false);
finally
ini.Free;
end;
@ -1233,6 +1247,11 @@ begin
Inspector.DisplayOptions := Inspector.DisplayOptions - [doAutoColResize];
end;
procedure TMainForm.UpdateRowHeights;
begin
WorksheetGrid.UpdateRowHeights(-1, true);
end;
procedure TMainForm.WriteToIni;
var
ini: TCustomIniFile;
@ -1252,6 +1271,7 @@ begin
ini.WriteBool('Inspector', 'Visible', InspectorTabControl.Visible);
ini.WriteBool('Settings', 'ReadFormulas', AcSettingsReadFormulas.Checked);
ini.WriteBool('Settings', 'AutoUpdateRowHeights', AcSettingsAutoUpdateRowHeights.Checked);
finally
ini.Free;
end;