You've already forked lazarus-ccr
fpspreadsheet: Add zoom actions. Make worksheetgrid and spreadsheet inspector react on zoom changes. Update fpsctrls demo.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5242 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -1772,6 +1772,68 @@ object MainForm: TMainForm
|
||||
Hint = 'Delete hyperlink from selected cell'
|
||||
ImageIndex = 58
|
||||
end
|
||||
object AcZoom30: TsWorksheetZoomAction
|
||||
Category = 'FPSpreadsheet'
|
||||
WorkbookSource = WorkbookSource
|
||||
Caption = '30%'
|
||||
Hint = 'Zoom factor 30%'
|
||||
Zoom = 30
|
||||
end
|
||||
object AcZoom50: TsWorksheetZoomAction
|
||||
Category = 'FPSpreadsheet'
|
||||
WorkbookSource = WorkbookSource
|
||||
Caption = '50%'
|
||||
Hint = 'Zoom factor 50%'
|
||||
Zoom = 50
|
||||
end
|
||||
object AcZoom75: TsWorksheetZoomAction
|
||||
Category = 'FPSpreadsheet'
|
||||
WorkbookSource = WorkbookSource
|
||||
Caption = '75%'
|
||||
Hint = 'Zoom factor 75%'
|
||||
Zoom = 75
|
||||
end
|
||||
object AcZoom90: TsWorksheetZoomAction
|
||||
Category = 'FPSpreadsheet'
|
||||
WorkbookSource = WorkbookSource
|
||||
Caption = '90%'
|
||||
Hint = 'Zoom factor 90%'
|
||||
Zoom = 90
|
||||
end
|
||||
object AcZoom100: TsWorksheetZoomAction
|
||||
Category = 'FPSpreadsheet'
|
||||
WorkbookSource = WorkbookSource
|
||||
Caption = '100%'
|
||||
Hint = 'Zoom factor 100%'
|
||||
end
|
||||
object AcZoom150: TsWorksheetZoomAction
|
||||
Category = 'FPSpreadsheet'
|
||||
WorkbookSource = WorkbookSource
|
||||
Caption = '150%'
|
||||
Hint = 'Zoom factor 150%'
|
||||
Zoom = 150
|
||||
end
|
||||
object AcZoom200: TsWorksheetZoomAction
|
||||
Category = 'FPSpreadsheet'
|
||||
WorkbookSource = WorkbookSource
|
||||
Caption = '200%'
|
||||
Hint = 'Zoom factor 200%'
|
||||
Zoom = 200
|
||||
end
|
||||
object AcZoom300: TsWorksheetZoomAction
|
||||
Category = 'FPSpreadsheet'
|
||||
WorkbookSource = WorkbookSource
|
||||
Caption = '300%'
|
||||
Hint = 'Zoom factor 300%'
|
||||
Zoom = 300
|
||||
end
|
||||
object AcZoom500: TsWorksheetZoomAction
|
||||
Category = 'FPSpreadsheet'
|
||||
WorkbookSource = WorkbookSource
|
||||
Caption = '500%'
|
||||
Hint = 'Zoom factor 500%'
|
||||
Zoom = 500
|
||||
end
|
||||
end
|
||||
object ImageList: TImageList
|
||||
left = 176
|
||||
@@ -4367,6 +4429,45 @@ object MainForm: TMainForm
|
||||
object MenuItem133: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object MnuZoom: TMenuItem
|
||||
Caption = 'Zoom'
|
||||
object MenuItem148: TMenuItem
|
||||
Action = AcZoom30
|
||||
end
|
||||
object MenuItem149: TMenuItem
|
||||
Action = AcZoom50
|
||||
end
|
||||
object MenuItem150: TMenuItem
|
||||
Action = AcZoom75
|
||||
end
|
||||
object MenuItem146: TMenuItem
|
||||
Action = AcZoom90
|
||||
end
|
||||
object MenuItem153: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object MenuItem151: TMenuItem
|
||||
Action = AcZoom100
|
||||
end
|
||||
object MenuItem154: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object MenuItem152: TMenuItem
|
||||
Action = AcZoom150
|
||||
end
|
||||
object MenuItem155: TMenuItem
|
||||
Action = AcZoom200
|
||||
end
|
||||
object MenuItem156: TMenuItem
|
||||
Action = AcZoom300
|
||||
end
|
||||
object MenuItem157: TMenuItem
|
||||
Action = AcZoom500
|
||||
end
|
||||
end
|
||||
object MenuItem147: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object MenuItem52: TMenuItem
|
||||
Action = AcViewInspector
|
||||
AutoCheck = True
|
||||
|
@@ -83,6 +83,19 @@ type
|
||||
MenuItem143: TMenuItem;
|
||||
MenuItem144: TMenuItem;
|
||||
MenuItem145: TMenuItem;
|
||||
MenuItem146: TMenuItem;
|
||||
MenuItem148: TMenuItem;
|
||||
MenuItem149: TMenuItem;
|
||||
MenuItem150: TMenuItem;
|
||||
MenuItem151: TMenuItem;
|
||||
MenuItem152: TMenuItem;
|
||||
MenuItem153: TMenuItem;
|
||||
MenuItem154: TMenuItem;
|
||||
MenuItem155: TMenuItem;
|
||||
MenuItem156: TMenuItem;
|
||||
MenuItem157: TMenuItem;
|
||||
MnuZoom: TMenuItem;
|
||||
MenuItem147: TMenuItem;
|
||||
MnuSettings: TMenuItem;
|
||||
MenuItem11: TMenuItem;
|
||||
MenuItem12: TMenuItem;
|
||||
@@ -278,6 +291,15 @@ type
|
||||
AcNumFormatText: TsNumberFormatAction;
|
||||
Splitter2: TSplitter;
|
||||
Splitter3: TSplitter;
|
||||
AcZoom100: TsWorksheetZoomAction;
|
||||
AcZoom90: TsWorksheetZoomAction;
|
||||
AcZoom30: TsWorksheetZoomAction;
|
||||
AcZoom50: TsWorksheetZoomAction;
|
||||
AcZoom75: TsWorksheetZoomAction;
|
||||
AcZoom150: TsWorksheetZoomAction;
|
||||
AcZoom200: TsWorksheetZoomAction;
|
||||
AcZoom300: TsWorksheetZoomAction;
|
||||
AcZoom500: TsWorksheetZoomAction;
|
||||
ToolBar2: TToolBar;
|
||||
ToolBar3: TToolBar;
|
||||
ToolButton1: TToolButton;
|
||||
@@ -666,7 +688,8 @@ procedure TMainForm.AcViewInspectorExecute(Sender: TObject);
|
||||
begin
|
||||
InspectorTabControl.Visible := AcViewInspector.Checked;
|
||||
InspectorSplitter.Visible := AcViewInspector.Checked;
|
||||
InspectorSplitter.Left := 0; // Make sure that the splitter is always at the left of the inspector
|
||||
InspectorSplitter.Left := 0;
|
||||
// Make sure that the splitter is always at the left of the inspector tabcontrol
|
||||
end;
|
||||
|
||||
procedure TMainForm.ColorComboboxAddColors(Sender: TObject);
|
||||
|
@@ -50,6 +50,9 @@ implementation
|
||||
uses
|
||||
fpsRegFileFormats;
|
||||
|
||||
const
|
||||
MOUSEWHEEL_FACTOR = 1.05;
|
||||
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
@@ -60,6 +63,7 @@ begin
|
||||
if FWorkbook <> nil then
|
||||
OpenDialog.InitialDir := ExtractFileDir(FWorkbook.FileName);
|
||||
if OpenDialog.Execute then begin
|
||||
// 3 because FilterIndex is 1-based and there are 2 add'l items at the top.
|
||||
if OpenDialog.FilterIndex < 3 then
|
||||
fmt := sfidUnknown
|
||||
else
|
||||
@@ -110,6 +114,7 @@ begin
|
||||
priorityFormats[7] := ord(sfHTML);
|
||||
|
||||
OpenDialog.Filter := GetFileFormatFilter('|', ';', faRead, priorityFormats, true, true);
|
||||
// true, true --> add "All spreadsheet formats" and "All Excel formats" at top
|
||||
SaveDialog.Filter := GetFileFormatFilter('|', ';', faWrite, priorityFormats);
|
||||
|
||||
FOpenFormats := GetSpreadFormats(faRead, priorityFormats);
|
||||
@@ -123,9 +128,9 @@ procedure TMainForm.GridMouseWheel(Sender: TObject; Shift: TShiftState;
|
||||
begin
|
||||
if ([ssCtrl, ssShift] * Shift = [ssCtrl, ssShift]) then begin
|
||||
if WheelDelta > 0 then
|
||||
Grid.ZoomFactor := Grid.ZoomFactor * 1.05
|
||||
Grid.ZoomFactor := Grid.ZoomFactor * MOUSEWHEEL_FACTOR
|
||||
else
|
||||
Grid.ZoomFactor := Grid.ZoomFactor / 1.05;
|
||||
Grid.ZoomFactor := Grid.ZoomFactor / MOUSEWHEEL_FACTOR;
|
||||
edZoom.Value := round(Grid.ZoomFactor * 100);
|
||||
Handled := true;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user