2008-02-03 12:05:55 +00:00
|
|
|
{*********************************************************}
|
|
|
|
{* VPPRTPRVDLG.PAS 1.03 *}
|
|
|
|
{*********************************************************}
|
|
|
|
|
|
|
|
{* ***** BEGIN LICENSE BLOCK ***** *}
|
|
|
|
{* Version: MPL 1.1 *}
|
|
|
|
{* *}
|
|
|
|
{* The contents of this file are subject to the Mozilla Public License *}
|
|
|
|
{* Version 1.1 (the "License"); you may not use this file except in *}
|
|
|
|
{* compliance with the License. You may obtain a copy of the License at *}
|
|
|
|
{* http://www.mozilla.org/MPL/ *}
|
|
|
|
{* *}
|
|
|
|
{* Software distributed under the License is distributed on an "AS IS" basis, *}
|
|
|
|
{* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License *}
|
|
|
|
{* for the specific language governing rights and limitations under the *}
|
|
|
|
{* License. *}
|
|
|
|
{* *}
|
|
|
|
{* The Original Code is TurboPower Visual PlanIt *}
|
|
|
|
{* *}
|
|
|
|
{* The Initial Developer of the Original Code is TurboPower Software *}
|
|
|
|
{* *}
|
|
|
|
{* Portions created by TurboPower Software Inc. are Copyright (C) 2002 *}
|
|
|
|
{* TurboPower Software Inc. All Rights Reserved. *}
|
|
|
|
{* *}
|
|
|
|
{* Contributor(s): *}
|
|
|
|
{* *}
|
|
|
|
{* ***** END LICENSE BLOCK ***** *}
|
|
|
|
|
|
|
|
unit VpPrtPrvDlg;
|
|
|
|
|
|
|
|
{$I vp.inc}
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
{$IFDEF LCL}
|
2016-07-12 18:00:32 +00:00
|
|
|
LCLProc, LCLType, LCLIntf, LResources,
|
2008-02-03 12:05:55 +00:00
|
|
|
{$ELSE}
|
2016-06-21 13:48:55 +00:00
|
|
|
Windows, Messages,
|
2008-02-03 12:05:55 +00:00
|
|
|
{$ENDIF}
|
2016-07-06 21:49:00 +00:00
|
|
|
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
2016-07-12 18:00:32 +00:00
|
|
|
Buttons, Printers, ComCtrls, ActnList,
|
2008-02-03 12:05:55 +00:00
|
|
|
{$IFDEF VERSION6} Variants, {$ENDIF}
|
2016-07-12 18:00:32 +00:00
|
|
|
VpMisc, VpBase, VpData, VpPrtPrv, VpSR, VpBaseDS, VpDlg,
|
2016-07-06 21:49:00 +00:00
|
|
|
VpPrtFmtCBox;
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
type
|
|
|
|
TVpPrintPreviewDialog = class;
|
|
|
|
|
2016-06-21 13:19:39 +00:00
|
|
|
{ TfrmPrintPreview }
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
TfrmPrintPreview = class(TForm)
|
2016-08-05 22:34:24 +00:00
|
|
|
Bevel1: TBevel;
|
2016-06-21 13:48:55 +00:00
|
|
|
Panel1: TPanel;
|
|
|
|
cboxZoom: TComboBox;
|
|
|
|
btnCancel: TToolButton;
|
2016-08-05 22:34:24 +00:00
|
|
|
Panel2: TPanel;
|
2016-06-21 13:48:55 +00:00
|
|
|
VpPrintPreview1: TVpPrintPreview;
|
|
|
|
VpPrintFormatComboBox1: TVpPrintFormatComboBox;
|
2008-02-03 12:05:55 +00:00
|
|
|
ToolBar1: TToolBar;
|
|
|
|
btnPrint: TToolButton;
|
|
|
|
ToolButton3: TToolButton;
|
|
|
|
btnFirstPage: TToolButton;
|
|
|
|
btnPrevPage: TToolButton;
|
|
|
|
btnNextPage: TToolButton;
|
|
|
|
btnLastPage: TToolButton;
|
|
|
|
imMain: TImageList;
|
|
|
|
ToolButton8: TToolButton;
|
|
|
|
actMain: TActionList;
|
|
|
|
actPrint: TAction;
|
|
|
|
actFirstPage: TAction;
|
|
|
|
actPrevPage: TAction;
|
|
|
|
actNextPage: TAction;
|
|
|
|
actLastPage: TAction;
|
|
|
|
actCancel: TAction;
|
|
|
|
|
2016-07-06 14:23:45 +00:00
|
|
|
procedure FormShow(Sender: TObject);
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure OKBtnClick (Sender : TObject);
|
|
|
|
procedure cboxZoomChange(Sender: TObject);
|
|
|
|
procedure actPrintExecute(Sender: TObject);
|
|
|
|
procedure actFirstPageExecute(Sender: TObject);
|
|
|
|
procedure actPrevPageExecute(Sender: TObject);
|
|
|
|
procedure actNextPageExecute(Sender: TObject);
|
|
|
|
procedure actLastPageExecute(Sender: TObject);
|
|
|
|
procedure actMainUpdate(Action: TBasicAction; var Handled: Boolean);
|
|
|
|
procedure actCancelExecute(Sender: TObject);
|
2016-06-21 13:19:39 +00:00
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
2016-07-03 15:42:06 +00:00
|
|
|
procedure VpPrintFormatComboBox1Change(Sender: TObject);
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
private
|
2016-07-06 21:49:00 +00:00
|
|
|
FDrawingStyle: TVpDrawingStyle;
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure SetCaptions;
|
2016-07-06 21:49:00 +00:00
|
|
|
procedure SetDrawingStyle(AValue: TVpDrawingStyle);
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
public
|
2016-06-21 13:48:55 +00:00
|
|
|
Resource: TVpResource;
|
|
|
|
Contact: TVpContact;
|
|
|
|
ReturnCode: TVpEditorReturnCode;
|
2016-07-06 21:49:00 +00:00
|
|
|
property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle;
|
2008-02-03 12:05:55 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
TVpPrintPreviewDialog = class (TVpBaseDialog)
|
|
|
|
private
|
2016-06-21 13:48:55 +00:00
|
|
|
FControlLink: TVpControlLink;
|
|
|
|
FAutoPrint: Boolean;
|
|
|
|
FBottomMargin: Extended;
|
2016-07-06 21:49:00 +00:00
|
|
|
FDrawingStyle: TVpDrawingStyle;
|
2016-06-21 13:48:55 +00:00
|
|
|
FEndDate: TDateTime;
|
|
|
|
FLeftMargin: Extended;
|
|
|
|
FMarginUnits: TVpItemMeasurement;
|
|
|
|
FRightMargin: Extended;
|
|
|
|
FStartDate: TDateTime;
|
|
|
|
FTopMargin: Extended;
|
|
|
|
FZoomFactor: TVpPPZoomFactor;
|
|
|
|
FWindowState: TWindowState;
|
|
|
|
FPrinter: TPrinter;
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
protected
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
|
|
|
procedure SetAutoPrint(const v: Boolean);
|
|
|
|
procedure SetBottomMargin(const v: Extended);
|
|
|
|
procedure SetControlLink(const v: TVpControlLink);
|
|
|
|
procedure SetEndDate(const v: TDateTime);
|
|
|
|
procedure SetLeftMargin(const v: Extended);
|
|
|
|
procedure SetMarginUnits(const v: TVpItemMeasurement);
|
|
|
|
procedure SetRightMargin(const v: Extended);
|
|
|
|
procedure SetStartDate(const v: TDateTime);
|
|
|
|
procedure SetTopMargin(const v: Extended);
|
|
|
|
procedure SetZoomFactor(const v: TVpPPZoomFactor);
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
public
|
2016-06-21 13:48:55 +00:00
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
function Execute: Boolean; override;
|
2008-02-03 12:05:55 +00:00
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
property Printer: TPrinter read FPrinter write FPrinter;
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
published
|
2016-06-21 13:48:55 +00:00
|
|
|
property AutoPrint: Boolean read FAutoPrint write SetAutoPrint default False;
|
|
|
|
property BottomMargin: Extended read FBottomMargin write SetBottomMargin;
|
|
|
|
property ControlLink: TVpControlLink read FControlLink write SetControlLink;
|
2016-07-06 21:49:00 +00:00
|
|
|
property DrawingStyle: TVpDrawingStyle read FDrawingStyle write FDrawingStyle default ds3D;
|
2016-06-21 13:48:55 +00:00
|
|
|
property EndDate: TDateTime read FEndDate write SetEndDate;
|
|
|
|
property LeftMargin: Extended read FLeftMargin write SetLeftMargin;
|
|
|
|
property MarginUnits: TVpItemMeasurement read FMarginUnits write SetMarginUnits default imInches;
|
|
|
|
property RightMargin: Extended read FRightMargin write SetRightMargin;
|
|
|
|
property StartDate: TDateTime read FStartDate write SetStartDate;
|
|
|
|
property TopMargin: Extended read FTopMargin write SetTopMargin;
|
|
|
|
property WindowState: TWindowState read FWindowState write FWindowState default wsNormal;
|
|
|
|
property ZoomFactor: TVpPPZoomFactor read FZoomFactor write SetZoomFactor default zfFitToControl;
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
property DataStore;
|
|
|
|
property Options;
|
|
|
|
property Placement;
|
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
2016-06-07 16:34:18 +00:00
|
|
|
{$IFDEF LCL}
|
|
|
|
{$R *.lfm}
|
|
|
|
{$ELSE}
|
|
|
|
{$R *.dfm}
|
2008-02-03 12:05:55 +00:00
|
|
|
{$ENDIF}
|
|
|
|
|
2016-07-06 14:23:45 +00:00
|
|
|
uses
|
2018-05-04 22:28:03 +00:00
|
|
|
VpConst, VpPrtFmt;
|
2016-07-06 14:23:45 +00:00
|
|
|
|
2016-07-06 21:49:00 +00:00
|
|
|
{ TfrmPrintPreview }
|
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmPrintPreview.FormCreate(Sender: TObject);
|
|
|
|
begin
|
|
|
|
ReturnCode := rtAbandon;
|
|
|
|
SetCaptions;
|
2016-08-05 22:34:24 +00:00
|
|
|
Toolbar1.ButtonHeight := ScaleY(Toolbar1.ButtonHeight, DesignTimeDPI);
|
2016-08-06 22:18:53 +00:00
|
|
|
Toolbar1.ButtonWidth := Toolbar1.ButtonHeight;
|
2008-02-03 12:05:55 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmPrintPreview.SetCaptions;
|
|
|
|
begin
|
|
|
|
Self.Caption := RSDlgPrintPreview;
|
2016-06-21 13:48:55 +00:00
|
|
|
actPrint.Caption := RSPrintPrvPrint;
|
|
|
|
actPrint.Hint := RSPrintPrvPrintHint;
|
|
|
|
actFirstPage.Caption := RSPrintPrvFirstPage;
|
|
|
|
actFirstPage.Hint := RSPrintPrvFirstPageHint;
|
|
|
|
actPrevPage.Caption := RSPrintPrvPrevPage;
|
|
|
|
actPrevPage.Hint := RsPrintPrvPrevPageHint;
|
|
|
|
actNextPage.Caption := RSPrintPrvNextPage;
|
|
|
|
actNextPage.Hint := RSPrintPrvNextPageHint;
|
|
|
|
actLastPage.Caption := RSPrintPrvLastPage;
|
|
|
|
actLastPage.Hint := RSPrintPrvLastPageHint;
|
|
|
|
actCancel.Caption := RSPrintPrvCancel;
|
|
|
|
actCancel.Hint := RSPrintPrvCancelHint;
|
2008-02-03 12:05:55 +00:00
|
|
|
end;
|
|
|
|
|
2016-07-06 21:49:00 +00:00
|
|
|
procedure TfrmPrintPreview.SetDrawingStyle(AValue: TVpDrawingStyle);
|
|
|
|
begin
|
|
|
|
FDrawingStyle := AValue;
|
|
|
|
if FDrawingStyle = dsNoBorder then
|
|
|
|
VpPrintPreview1.BorderStyle := bsNone else
|
|
|
|
VpPrintPreview1.BorderStyle := bsSingle;
|
|
|
|
VpPrintPreview1.DrawingStyle := FDrawingStyle;
|
|
|
|
end;
|
|
|
|
|
2016-07-03 15:42:06 +00:00
|
|
|
procedure TfrmPrintPreview.VpPrintFormatComboBox1Change(Sender: TObject);
|
|
|
|
begin
|
|
|
|
VpPrintPreview1.ForceUpdate;
|
|
|
|
VpPrintPreview1.FirstPage;
|
|
|
|
end;
|
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmPrintPreview.OKBtnClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
ReturnCode := rtCommit;
|
|
|
|
Close;
|
|
|
|
end;
|
|
|
|
|
2016-07-06 21:49:00 +00:00
|
|
|
|
|
|
|
{ TVpPrintPreviewDialog }
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
constructor TVpPrintPreviewDialog.Create(AOwner: TComponent);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
inherited Create (AOwner);
|
|
|
|
FPlacement.Height := 480;
|
2016-07-03 14:47:03 +00:00
|
|
|
FPlacement.Width := 720;
|
2016-06-21 13:48:55 +00:00
|
|
|
StartDate := Now;
|
|
|
|
EndDate := Now + 7;
|
|
|
|
FZoomFactor := zfFitToControl;
|
|
|
|
FWindowState := wsNormal;
|
|
|
|
FAutoPrint := False;
|
|
|
|
FControlLink := SearchControlLink(Owner);
|
|
|
|
FPrinter := Printer;
|
2016-07-06 21:49:00 +00:00
|
|
|
DrawingStyle := ds3D;
|
2008-02-03 12:05:55 +00:00
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
function TVpPrintPreviewDialog.Execute: Boolean;
|
2008-02-03 12:05:55 +00:00
|
|
|
var
|
2016-06-21 13:48:55 +00:00
|
|
|
EditForm: TfrmPrintPreview;
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
Result := False;
|
2016-07-06 21:49:00 +00:00
|
|
|
EditForm := TfrmPrintPreview.Create(Application);
|
2008-02-03 12:05:55 +00:00
|
|
|
try
|
|
|
|
DoFormPlacement(EditForm);
|
|
|
|
EditForm.WindowState := WindowState;
|
|
|
|
EditForm.VpPrintPreview1.ControlLink := ControlLink;
|
|
|
|
EditForm.VpPrintFormatComboBox1.ControlLink := ControlLink;
|
|
|
|
EditForm.VpPrintPreview1.StartDate := StartDate;
|
|
|
|
EditForm.VpPrintPreview1.EndDate := EndDate;
|
|
|
|
EditForm.VpPrintPreview1.ZoomFactor := ZoomFactor;
|
2016-07-06 14:23:45 +00:00
|
|
|
EditForm.cboxZoom.ItemIndex := Integer(ZoomFactor);
|
2008-02-03 12:05:55 +00:00
|
|
|
EditForm.VpPrintPreview1.Printer := Printer;
|
2016-07-02 21:13:54 +00:00
|
|
|
EditForm.VpPrintPreview1.ForceUpdate;
|
2008-02-03 12:05:55 +00:00
|
|
|
EditForm.VpPrintPreview1.FirstPage;
|
2016-07-06 21:49:00 +00:00
|
|
|
EditForm.DrawingStyle := FDrawingStyle;
|
2008-02-03 12:05:55 +00:00
|
|
|
EditForm.ShowModal;
|
|
|
|
if EditForm.ReturnCode = rtCommit then begin
|
|
|
|
Result := True;
|
|
|
|
end;
|
2016-06-21 13:48:55 +00:00
|
|
|
if AutoPrint and Assigned(FControlLink) and Result then begin
|
2008-02-03 12:05:55 +00:00
|
|
|
Printer.BeginDoc;
|
|
|
|
try
|
2016-06-21 13:48:55 +00:00
|
|
|
FControlLink.Printer.Print(Printer, StartDate, EndDate);
|
2008-02-03 12:05:55 +00:00
|
|
|
finally
|
|
|
|
Printer.EndDoc;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
finally
|
2016-07-06 21:49:00 +00:00
|
|
|
EditForm.Free;
|
2008-02-03 12:05:55 +00:00
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
{ Handle new/deleted components}
|
|
|
|
procedure TVpPrintPreviewDialog.Notification(AComponent: TComponent;
|
|
|
|
Operation : TOperation);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
2016-06-21 13:48:55 +00:00
|
|
|
inherited Notification(AComponent, Operation);
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
if Operation = opRemove then begin
|
|
|
|
{Owned components going away}
|
|
|
|
if AComponent = FControlLink then begin
|
|
|
|
FControlLink := nil;
|
|
|
|
end;
|
2016-06-21 13:48:55 +00:00
|
|
|
end else
|
|
|
|
if Operation = opInsert then begin
|
2008-02-03 12:05:55 +00:00
|
|
|
if AComponent is TVpControlLink then begin
|
|
|
|
if not Assigned (FControlLink) then begin
|
|
|
|
FControlLink := TVpControlLink (AComponent);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure TVpPrintPreviewDialog.SetAutoPrint(const v: Boolean);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
if v <> FAutoPrint then
|
|
|
|
FAutoPrint := v;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure TVpPrintPreviewDialog.SetBottomMargin(const v: Extended);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
if v <> FBottomMargin then
|
|
|
|
FBottomMargin := v;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure TVpPrintPreviewDialog.SetControlLink(const v: TVpControlLink);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
if FControlLink <> v then
|
|
|
|
FControlLink := v;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure TVpPrintPreviewDialog.SetEndDate(const v: TDateTime);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
if v <> FEndDate then
|
|
|
|
FEndDate := v;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure TVpPrintPreviewDialog.SetLeftMargin(const v: Extended);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
if v <> FLeftMargin then
|
|
|
|
FLeftMargin := v;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure TVpPrintPreviewDialog.SetMarginUnits(const v: TVpItemMeasurement);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
if v <> FMarginUnits then
|
|
|
|
FMarginUnits := v;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure TVpPrintPreviewDialog.SetRightMargin(const v: Extended);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
if v <> FRightMargin then
|
|
|
|
FRightMargin := v;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure TVpPrintPreviewDialog.SetStartDate(const v: TDateTime);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
if v <> FStartDate then
|
|
|
|
FStartDate := v;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure TVpPrintPreviewDialog.SetTopMargin(const v: Extended);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
if v <> FTopMargin then
|
|
|
|
FTopMargin := v;
|
|
|
|
end;
|
|
|
|
|
2016-06-21 13:48:55 +00:00
|
|
|
procedure TVpPrintPreviewDialog.SetZoomFactor(const v: TVpPPZoomFactor);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
if v <> FZoomFactor then
|
|
|
|
FZoomFactor := v;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmPrintPreview.cboxZoomChange(Sender: TObject);
|
|
|
|
begin
|
2016-06-21 13:19:39 +00:00
|
|
|
VpPrintPreview1.ZoomFactor := TVpPPZoomFactor(cboxZoom.ItemIndex);
|
2008-02-03 12:05:55 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmPrintPreview.actPrintExecute(Sender: TObject);
|
|
|
|
begin
|
|
|
|
ReturnCode := rtCommit;
|
|
|
|
Close;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmPrintPreview.actFirstPageExecute(Sender: TObject);
|
|
|
|
begin
|
|
|
|
VpPrintPreview1.FirstPage;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmPrintPreview.actPrevPageExecute(Sender: TObject);
|
|
|
|
begin
|
|
|
|
VpPrintPreview1.PrevPage;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmPrintPreview.actNextPageExecute(Sender: TObject);
|
|
|
|
begin
|
|
|
|
VpPrintPreview1.NextPage;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmPrintPreview.actLastPageExecute(Sender: TObject);
|
|
|
|
begin
|
|
|
|
VpPrintPreview1.LastPage;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmPrintPreview.actMainUpdate(Action: TBasicAction;
|
|
|
|
var Handled: Boolean);
|
|
|
|
begin
|
2016-07-12 18:00:32 +00:00
|
|
|
Unused(Action, Handled);
|
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
if VpPrintPreview1.IsFirstPage then begin
|
|
|
|
actFirstPage.Enabled := False;
|
|
|
|
actPrevPage.Enabled := False;
|
|
|
|
end else begin
|
|
|
|
actFirstPage.Enabled := True;
|
|
|
|
actPrevPage.Enabled := True;
|
|
|
|
end;
|
|
|
|
|
|
|
|
if VpPrintPreview1.IsLastPage then begin
|
|
|
|
actLastPage.Enabled := False;
|
|
|
|
actNextPage.Enabled := False;
|
|
|
|
end else begin
|
|
|
|
actLastPage.Enabled := True;
|
|
|
|
actNextPage.Enabled := True;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmPrintPreview.actCancelExecute(Sender: TObject);
|
|
|
|
begin
|
|
|
|
ReturnCode := rtAbandon;
|
|
|
|
Close;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmPrintPreview.FormKeyDown(Sender: TObject; var Key: Word;
|
|
|
|
Shift: TShiftState);
|
|
|
|
begin
|
2016-07-12 18:00:32 +00:00
|
|
|
Unused(Shift);
|
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
if Key = VK_ESCAPE then
|
|
|
|
actCancel.Execute;
|
|
|
|
end;
|
2016-06-07 16:34:18 +00:00
|
|
|
|
2016-07-06 14:23:45 +00:00
|
|
|
procedure TfrmPrintPreview.FormShow(Sender: TObject);
|
2016-11-21 17:12:05 +00:00
|
|
|
{
|
2016-07-06 14:23:45 +00:00
|
|
|
var
|
|
|
|
maxlen: Integer;
|
|
|
|
cnv: TControlCanvas;
|
|
|
|
i: Integer;
|
|
|
|
fmts: TVpPrintFormat;
|
2016-11-21 17:12:05 +00:00
|
|
|
}
|
2016-07-06 14:23:45 +00:00
|
|
|
begin
|
|
|
|
if VpPrintPreview1.ControlLink = nil then
|
|
|
|
exit;
|
2016-08-05 22:34:24 +00:00
|
|
|
(*
|
2016-07-06 14:23:45 +00:00
|
|
|
cnv := TControlCanvas.Create;
|
|
|
|
try
|
|
|
|
cnv.Control := VpPrintFormatCombobox1;
|
|
|
|
cnv.Font.Assign(VpPrintFormatCombobox1.Font);
|
|
|
|
cnv.Font.Height := GetRealFontHeight(cnv.Font);
|
|
|
|
maxlen := 0;
|
|
|
|
fmts := VpPrintPreview1.ControlLink.Printer.PrintFormats;
|
|
|
|
for i:=0 to fmts.Count-1 do
|
|
|
|
maxlen := Max(maxlen, cnv.TextWidth(fmts.Items[i].FormatName));
|
|
|
|
VpPrintFormatCombobox1.Width := maxlen + 30;
|
|
|
|
cboxZoom.Left := VpPrintFormatCombobox1.Left + VpPrintFormatCombobox1.Width + 8;
|
2016-07-14 15:26:55 +00:00
|
|
|
|
2016-07-06 14:23:45 +00:00
|
|
|
finally
|
|
|
|
cnv.Free;
|
2016-08-05 22:34:24 +00:00
|
|
|
end;*)
|
2016-07-06 14:23:45 +00:00
|
|
|
end;
|
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
end.
|
|
|
|
|