You've already forked lazarus-ccr
fpspreadsheet: Add "Auto row height" command to menu of fps_ctrls demo.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5259 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
object MainForm: TMainForm
|
object MainForm: TMainForm
|
||||||
Left = 350
|
Left = 256
|
||||||
Height = 621
|
Height = 621
|
||||||
Top = 121
|
Top = 119
|
||||||
Width = 997
|
Width = 997
|
||||||
Caption = 'demo_ctrls'
|
Caption = 'demo_ctrls'
|
||||||
ClientHeight = 601
|
ClientHeight = 601
|
||||||
@ -662,6 +662,7 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
object ActionList: TActionList
|
object ActionList: TActionList
|
||||||
Images = ImageList
|
Images = ImageList
|
||||||
|
OnUpdate = ActionListUpdate
|
||||||
left = 176
|
left = 176
|
||||||
top = 248
|
top = 248
|
||||||
object AcAddWorksheet: TsWorksheetAddAction
|
object AcAddWorksheet: TsWorksheetAddAction
|
||||||
@ -1835,6 +1836,12 @@ object MainForm: TMainForm
|
|||||||
Hint = 'Zoom factor 500%'
|
Hint = 'Zoom factor 500%'
|
||||||
Zoom = 500
|
Zoom = 500
|
||||||
end
|
end
|
||||||
|
object AcAutoRowHeights: TAction
|
||||||
|
Category = 'Edit'
|
||||||
|
Caption = 'Auto row heights'
|
||||||
|
Hint = 'Automatic row height adjustment'
|
||||||
|
OnExecute = AcAutoRowHeightsExecute
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object ImageList: TImageList
|
object ImageList: TImageList
|
||||||
left = 176
|
left = 176
|
||||||
@ -4416,6 +4423,12 @@ object MainForm: TMainForm
|
|||||||
AutoCheck = True
|
AutoCheck = True
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object MenuItem159: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object MenuItem158: TMenuItem
|
||||||
|
Action = AcAutoRowHeights
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object MnuView: TMenuItem
|
object MnuView: TMenuItem
|
||||||
Caption = 'View'
|
Caption = 'View'
|
||||||
|
@ -27,6 +27,7 @@ type
|
|||||||
AcShowHeaders: TAction;
|
AcShowHeaders: TAction;
|
||||||
AcFrozenRows: TAction;
|
AcFrozenRows: TAction;
|
||||||
AcFrozenCols: TAction;
|
AcFrozenCols: TAction;
|
||||||
|
AcAutoRowHeights: TAction;
|
||||||
AcWorksheetRTL: TAction;
|
AcWorksheetRTL: TAction;
|
||||||
AcViewInspector: TAction;
|
AcViewInspector: TAction;
|
||||||
ActionList: TActionList;
|
ActionList: TActionList;
|
||||||
@ -94,6 +95,8 @@ type
|
|||||||
MenuItem155: TMenuItem;
|
MenuItem155: TMenuItem;
|
||||||
MenuItem156: TMenuItem;
|
MenuItem156: TMenuItem;
|
||||||
MenuItem157: TMenuItem;
|
MenuItem157: TMenuItem;
|
||||||
|
MenuItem158: TMenuItem;
|
||||||
|
MenuItem159: TMenuItem;
|
||||||
MnuZoom: TMenuItem;
|
MnuZoom: TMenuItem;
|
||||||
MenuItem147: TMenuItem;
|
MenuItem147: TMenuItem;
|
||||||
MnuSettings: TMenuItem;
|
MnuSettings: TMenuItem;
|
||||||
@ -373,6 +376,7 @@ type
|
|||||||
WorkbookSource: TsWorkbookSource;
|
WorkbookSource: TsWorkbookSource;
|
||||||
WorkbookTabControl: TsWorkbookTabControl;
|
WorkbookTabControl: TsWorkbookTabControl;
|
||||||
WorksheetGrid: TsWorksheetGrid;
|
WorksheetGrid: TsWorksheetGrid;
|
||||||
|
procedure AcAutoRowHeightsExecute(Sender: TObject);
|
||||||
procedure AcColAddExecute(Sender: TObject);
|
procedure AcColAddExecute(Sender: TObject);
|
||||||
procedure AcColDeleteExecute(Sender: TObject);
|
procedure AcColDeleteExecute(Sender: TObject);
|
||||||
procedure AcFileOpenAccept(Sender: TObject);
|
procedure AcFileOpenAccept(Sender: TObject);
|
||||||
@ -386,6 +390,7 @@ type
|
|||||||
AWorkbook: TsWorkbook; var ANumFormatStr: String);
|
AWorkbook: TsWorkbook; var ANumFormatStr: String);
|
||||||
procedure AcRowAddExecute(Sender: TObject);
|
procedure AcRowAddExecute(Sender: TObject);
|
||||||
procedure AcRowDeleteExecute(Sender: TObject);
|
procedure AcRowDeleteExecute(Sender: TObject);
|
||||||
|
procedure ActionListUpdate(AAction: TBasicAction; var Handled: Boolean);
|
||||||
procedure AcWorksheetRTLExecute(Sender: TObject);
|
procedure AcWorksheetRTLExecute(Sender: TObject);
|
||||||
procedure AcWorksheetRTLUpdate(Sender: TObject);
|
procedure AcWorksheetRTLUpdate(Sender: TObject);
|
||||||
procedure AcSearchExecute(Sender: TObject);
|
procedure AcSearchExecute(Sender: TObject);
|
||||||
@ -448,6 +453,16 @@ end;
|
|||||||
|
|
||||||
{ TMainForm }
|
{ TMainForm }
|
||||||
|
|
||||||
|
procedure TMainForm.AcAutoRowHeightsExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Screen.Cursor := crHourglass;
|
||||||
|
try
|
||||||
|
WorksheetGrid.UpdateRowHeights(0, true);
|
||||||
|
finally
|
||||||
|
Screen.Cursor := crDefault;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Adds a column before the active cell }
|
{ Adds a column before the active cell }
|
||||||
procedure TMainForm.AcColAddExecute(Sender: TObject);
|
procedure TMainForm.AcColAddExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
@ -683,6 +698,13 @@ begin
|
|||||||
AcShowHeaders.Checked := WorksheetGrid.ShowHeaders;
|
AcShowHeaders.Checked := WorksheetGrid.ShowHeaders;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.ActionListUpdate(AAction: TBasicAction; var Handled: Boolean
|
||||||
|
);
|
||||||
|
begin
|
||||||
|
if AAction = AcAutoRowHeights then
|
||||||
|
AcAutoRowHeights.Enabled := WorkbookSource.Worksheet <> nil;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Toggles the spreadsheet inspector on and off }
|
{ Toggles the spreadsheet inspector on and off }
|
||||||
procedure TMainForm.AcViewInspectorExecute(Sender: TObject);
|
procedure TMainForm.AcViewInspectorExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
@ -4849,7 +4849,18 @@ begin
|
|||||||
if (lRow <> nil) then begin
|
if (lRow <> nil) then begin
|
||||||
case lRow^.RowHeightType of
|
case lRow^.RowHeightType of
|
||||||
rhtCustom:
|
rhtCustom:
|
||||||
h := round(CalcRowHeightFromSheet(lRow^.Height) * ZoomFactor);
|
begin
|
||||||
|
h := round(CalcRowHeightFromSheet(lRow^.Height) * ZoomFactor);
|
||||||
|
if AEnforceCalcRowHeight then begin
|
||||||
|
h := CalcAutoRowHeight(ARow);
|
||||||
|
if h = 0 then begin
|
||||||
|
h := DefaultRowHeight;
|
||||||
|
lRow^.RowHeightType := rhtDefault;
|
||||||
|
end else
|
||||||
|
lRow^.RowHeightType := rhtAuto;
|
||||||
|
lRow^.Height := CalcRowHeightToSheet(round(h / ZoomFactor));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
rhtAuto, rhtDefault:
|
rhtAuto, rhtDefault:
|
||||||
begin
|
begin
|
||||||
doCalcRowHeight := AEnforceCalcRowHeight or (lRow^.Height = 0);
|
doCalcRowHeight := AEnforceCalcRowHeight or (lRow^.Height = 0);
|
||||||
|
Reference in New Issue
Block a user