You've already forked lazarus-ccr
GridPrinter: Improved selection of zoom factor and zoom modes in PrintPreviewDialog.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8617 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -10,8 +10,6 @@ uses
|
||||
type
|
||||
TGridPrintPreviewDialog = class; // forward declaration
|
||||
|
||||
TGridPrintPreviewZoom = (gpzOriginal, gpzZoomWidth, gpzZoomHeight);
|
||||
|
||||
TGridPrintPreviewFormParams = class(TPersistent)
|
||||
private
|
||||
FOwner: TGridPrintPreviewDialog;
|
||||
@ -35,7 +33,8 @@ type
|
||||
FGridPrinter: TGridPrinter;
|
||||
FFormParams: TGridPrintPreviewFormParams;
|
||||
FOptions: TGridPrintPreviewOptions;
|
||||
FZoom: TGridPrintPreviewZoom;
|
||||
FZoom: Integer;
|
||||
FZoomMode: TGridPrintPreviewZoomMode;
|
||||
protected
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
public
|
||||
@ -47,7 +46,9 @@ type
|
||||
property GridPrinter: TGridPrinter read FGridPrinter write FGridPrinter;
|
||||
property Options: TGridPrintPreviewOptions
|
||||
read FOptions write FOptions default DEFAULT_GRIDPRN_OPTIONS;
|
||||
property Zoom: TGridPrintPreviewZoom read FZoom write FZoom default gpzOriginal;
|
||||
property Zoom: Integer read FZoom write FZoom default 100;
|
||||
property ZoomMode: TGridPrintPreviewZoomMode
|
||||
read FZoomMode write FZoomMode default zmCustom;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -74,6 +75,7 @@ begin
|
||||
inherited;
|
||||
FOptions := DEFAULT_GRIDPRN_OPTIONS;
|
||||
FFormParams := TGridPrintPreviewFormParams.Create(self);
|
||||
FZoom := 100;
|
||||
end;
|
||||
|
||||
destructor TGridPrintPreviewDialog.Destroy;
|
||||
@ -105,10 +107,11 @@ begin
|
||||
FFormParams.Top := R.Bottom - FFormParams.Height - GetSystemMetrics(SM_CYCAPTION) - GetSystemMetrics(SM_CYSIZEFRAME);
|
||||
F.SetBounds(FFormParams.Left, FFormParams.Top, FFormParams.Width, FFormParams.Height);
|
||||
F.Position := FFormParams.Position;
|
||||
case FZoom of
|
||||
gpzOriginal: F.acZoom100.Checked := true;
|
||||
gpzZoomWidth: F.ZoomToFitWidth;
|
||||
gpzZoomHeight: F.ZoomToFitHeight;
|
||||
F.ZoomMode := FZoomMode;
|
||||
case FZoomMode of
|
||||
zmCustom: F.Zoom := FZoom;
|
||||
zmFitWidth: F.ZoomToFitWidth;
|
||||
zmFitHeight: F.ZoomToFitHeight;
|
||||
end;
|
||||
if (F.ShowModal = mrOK) then
|
||||
FGridPrinter.Print;
|
||||
@ -116,6 +119,8 @@ begin
|
||||
FFormParams.Top := F.RestoredTop;
|
||||
FFormParams.Width := F.RestoredWidth;
|
||||
FormParams.Height := F.RestoredHeight;
|
||||
FZoom := F.Zoom;
|
||||
FZoomMode := F.ZoomMode;
|
||||
finally
|
||||
F.Free;
|
||||
end;
|
||||
|
@ -175,13 +175,13 @@ type
|
||||
procedure UpdateStrings;
|
||||
procedure ZoomToFitHeight;
|
||||
procedure ZoomToFitWidth;
|
||||
property PageNumber: Integer read FPageNumber write SetPageNumber;
|
||||
|
||||
published
|
||||
property GridPrinter: TGridPrinter read FGridPrinter write SetGridPrinter;
|
||||
property Options: TGridPrintPreviewOptions
|
||||
read FOptions write SetOptions default DEFAULT_GRIDPRN_OPTIONS;
|
||||
|
||||
property PageNumber: Integer read FPageNumber write SetPageNumber;
|
||||
property Zoom: Integer read FZoom write FZoom;
|
||||
property ZoomMode: TGridPrintPreviewZoomMode read FZoomMode write FZoomMode;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -304,7 +304,11 @@ begin
|
||||
acLandscape.Caption := MarkAsChecked(RSLandscape, true);
|
||||
acPortrait.Caption := MarkAsChecked(RSPortrait, false);
|
||||
FGridPrinter.Orientation := poLandscape;
|
||||
ShowPage(FPageNumber);
|
||||
case FZoomMode of
|
||||
zmCustom: ShowPage(FPageNumber);
|
||||
zmFitWidth: ZoomToFitWidth;
|
||||
zmFitHeight: ZoomToFitHeight;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -334,7 +338,11 @@ begin
|
||||
acPortrait.Caption := MarkAsChecked(RSPortrait, true);
|
||||
acLandscape.Caption := MarkAsChecked(RSLandscape, false);
|
||||
FGridPrinter.Orientation := poPortrait;
|
||||
ShowPage(FPageNumber);
|
||||
case FZoomMode of
|
||||
zmCustom: ShowPage(FPageNumber);
|
||||
zmFitWidth: ZoomToFitWidth;
|
||||
zmFitHeight: ZoomToFitHeight;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -492,7 +500,7 @@ begin
|
||||
if FActivated then
|
||||
exit;
|
||||
FUpdatePreviewHandler := FGridPrinter.OnUpdatePreview;
|
||||
ShowPage(1);
|
||||
ShowPage(1, FZoom, FZoomMode);
|
||||
FActivated := true;
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user