You've already forked lazarus-ccr
GridPrinter: Add GUI for printer scaling.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8623 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -15,7 +15,7 @@ type
|
||||
TGridPrintPreviewOption = (ppoNavigationBtns, ppoNavigationEdit,
|
||||
ppoZoomBtns,
|
||||
ppoPageOrientationBtns, ppoMarginsBtn, ppoHeaderFooterBtn,
|
||||
ppoPrintOrderBtns, ppoCenterBtns,
|
||||
ppoPrintOrderBtns, ppoCenterBtns, ppoScalePrinterBtn,
|
||||
ppoPageSetupBtn,
|
||||
ppoPageNumberInfo,
|
||||
ppoZoomLevelInfo
|
||||
@@ -27,7 +27,7 @@ const
|
||||
ppoNavigationBtns, ppoNavigationEdit,
|
||||
ppoZoomBtns,
|
||||
// ppoPageOrientationBtns, ppoMarginsBtn, ppoHeaderFooterBtn,
|
||||
// ppoPrintOrderBtns, ppoCenterBtns,
|
||||
// ppoPrintOrderBtns, ppoCenterBtns, ppoScalePrinterBtn,
|
||||
ppoPageSetupBtn,
|
||||
ppoPageNumberInfo,
|
||||
ppoZoomLevelInfo
|
||||
@@ -51,7 +51,7 @@ type
|
||||
acPrintRowsFirst: TAction;
|
||||
acCenterHor: TAction;
|
||||
acCenterVert: TAction;
|
||||
acScalePrintToPages: TAction;
|
||||
acScalePrinter: TAction;
|
||||
acZoom100: TAction;
|
||||
acZoomToFitWidth: TAction;
|
||||
acZoomToFitHeight: TAction;
|
||||
@@ -106,6 +106,7 @@ type
|
||||
tbCenterVert: TToolButton;
|
||||
tbDivider6: TToolButton;
|
||||
tbDivider7: TToolButton;
|
||||
tbScalePrinter: TToolButton;
|
||||
procedure acCenterHorExecute(Sender: TObject);
|
||||
procedure acCenterVertExecute(Sender: TObject);
|
||||
procedure acCloseExecute(Sender: TObject);
|
||||
@@ -120,7 +121,7 @@ type
|
||||
procedure acPrintColsFirstExecute(Sender: TObject);
|
||||
procedure acPrintExecute(Sender: TObject);
|
||||
procedure acPrintRowsFirstExecute(Sender: TObject);
|
||||
procedure acScalePrintToPagesExecute(Sender: TObject);
|
||||
procedure acScalePrinterExecute(Sender: TObject);
|
||||
procedure ActionListUpdate({%H-}AAction: TBasicAction; var {%H-}Handled: Boolean);
|
||||
procedure acZoom100Execute(Sender: TObject);
|
||||
procedure acZoomInZoomOutExecute(Sender: TObject);
|
||||
@@ -196,7 +197,8 @@ implementation
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
LCLIntf, LCLType, Printers, GridPrnStrings, GridPrnHeaderFooterForm;
|
||||
LCLIntf, LCLType, Printers,
|
||||
GridPrnStrings, GridPrnHeaderFooterForm, GridPrnScalingForm;
|
||||
|
||||
const
|
||||
ZOOM_MULTIPLIER = 1.05;
|
||||
@@ -293,6 +295,7 @@ begin
|
||||
F := TGridPrintHeaderFooterForm.Create(nil);
|
||||
try
|
||||
F.GridPrinter := FGridPrinter;
|
||||
F.Position := poMainFormCenter;
|
||||
if F.ShowModal = mrOK then
|
||||
ShowPage(FPageNumber, FZoom);
|
||||
finally
|
||||
@@ -385,18 +388,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGridPrintPreviewForm.acScalePrintToPagesExecute(Sender: TObject);
|
||||
procedure TGridPrintPreviewForm.acScalePrinterExecute(Sender: TObject);
|
||||
var
|
||||
F: TGridPrinterScalingForm;
|
||||
begin
|
||||
if FGridPrinter <> nil then
|
||||
begin
|
||||
if acScalePrintToPages.Checked then
|
||||
begin
|
||||
FGridPrinter.ScaleToPages(1, 1);
|
||||
ShowPage(1);
|
||||
end else
|
||||
begin
|
||||
FGridPrinter.PrintScaleFactor := 1.0;
|
||||
ShowPage(1);
|
||||
F := TGridPrinterScalingForm.Create(nil);
|
||||
try
|
||||
F.GridPrinter := FGridPrinter;
|
||||
F.Position := poMainFormCenter;
|
||||
if F.ShowModal = mrOK then
|
||||
ShowPage(1);
|
||||
finally
|
||||
F.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@@ -967,7 +972,7 @@ begin
|
||||
tbPrintRowsFirst.Visible := tbPrintRowsFirst.Action <> nil;
|
||||
tbDivider4.Visible := tbPrintColsFirst.Visible;
|
||||
|
||||
// Page centering
|
||||
// Page centering, scaling
|
||||
if ppoCenterBtns in FOptions then
|
||||
begin
|
||||
tbCenterHor.Action := acCenterHor;
|
||||
@@ -977,9 +982,14 @@ begin
|
||||
tbCenterHor.Action := nil;
|
||||
tbCenterVert.Action := nil;
|
||||
end;
|
||||
if ppoScalePrinterBtn in FOptions then
|
||||
tbScalePrinter.Action := acScalePrinter
|
||||
else
|
||||
tbScalePrinter.Action := nil;
|
||||
tbCenterHor.Visible := tbCenterHor.Action <> nil;
|
||||
tbCenterVert.Visible := tbCenterVert.Action <> nil;
|
||||
tbDivider5.Visible := tbCenterHor.Action <> nil;
|
||||
tbScalePrinter.Visible := tbScalePrinter.Action <> nil;
|
||||
tbDivider5.Visible := (tbCenterHor.Action <> nil) or (tbScalePrinter.Action <> nil);
|
||||
|
||||
// Page setup dropdown button
|
||||
tbPageSetup.Visible := ppoPageSetupBtn in FOptions;
|
||||
@@ -1089,6 +1099,7 @@ begin
|
||||
acPrintRowsFirst.Caption := RSPrintRowsFirst;
|
||||
acCenterHor.Caption := RSCenterHor;
|
||||
acCenterVert.Caption := RSCenterVert;
|
||||
acScalePrinter.Caption := RSScalePrinter;
|
||||
|
||||
// Toolbar hints
|
||||
acPrint.Hint := RSPrint;
|
||||
@@ -1111,6 +1122,7 @@ begin
|
||||
acPrintRowsFirst.Hint := RSPrintRowsFirstHint;
|
||||
acCenterHor.Hint := RSCenterHorHint;
|
||||
acCenterVert.Hint := RSCenterVertHint;
|
||||
acScalePrinter.Hint := RSScalePrinterHint;
|
||||
tbPageSetup.Hint := RSPageSetupHint;
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user