diff --git a/components/tvplanit/laz_visualplanit.lpk b/components/tvplanit/laz_visualplanit.lpk index 246fa2cf3..1dfc3a910 100644 --- a/components/tvplanit/laz_visualplanit.lpk +++ b/components/tvplanit/laz_visualplanit.lpk @@ -307,7 +307,7 @@ Contributor(s): "/> - + @@ -316,13 +316,16 @@ Contributor(s): "/> - + - + - + + + + diff --git a/components/tvplanit/source/vpprtprv.pas b/components/tvplanit/source/vpprtprv.pas index 577a8b6bc..bf281e6b3 100644 --- a/components/tvplanit/source/vpprtprv.pas +++ b/components/tvplanit/source/vpprtprv.pas @@ -110,8 +110,8 @@ type function GetPageCount: Integer; protected - function CalculatePageHeight(Printer: TPrinter): Integer; - function CalculatePageWidth(Printer: TPrinter): Integer; + function CalculatePageHeight(APrinter: TPrinter): Integer; + function CalculatePageWidth(APrinter: TPrinter): Integer; procedure ClearPageData; {$IFDEF DELPHI} procedure CMWantSpecialKey(var Msg: TCMWantSpecialKey); message CM_WANTSPECIALKEY; @@ -231,6 +231,9 @@ type implementation +uses + OSPrinters; + constructor TVpPrintPreview.Create(AOwner: TComponent); begin inherited Create(AOwner); @@ -262,7 +265,7 @@ begin FEndDate := Now + 7; FScrollX := 0; FScrollY := 0; - FPrinter := Printer; + FPrinter := Printers.Printer; // Initial size of the control with GetControlClassDefaultSize do @@ -284,39 +287,39 @@ begin inherited Destroy; end; -function TVpPrintPreview.CalculatePageHeight(Printer: TPrinter): Integer; +function TVpPrintPreview.CalculatePageHeight(APrinter: TPrinter): Integer; var ScreenPPI: Integer; PrinterPPI: Integer; begin ScreenPPI := GetDeviceCaps(Canvas.Handle, LOGPIXELSY); {$IFDEF DELPHI} - PrinterPPI := GetDeviceCaps(Printer.Handle, LOGPIXELSY); + PrinterPPI := GetDeviceCaps(APrinter.Handle, LOGPIXELSY); {$ELSE} - PrinterPPI := Printer.XDpi; + PrinterPPI := APrinter.XDpi; {$ENDIF} if PrinterPPI <> 0 then - Result := Round(ScreenPPI / PrinterPPI * Printer.PageHeight) + Result := Round(ScreenPPI / PrinterPPI * APrinter.PageHeight) else - Result := ScreenPPI * Printer.PageHeight; + Result := ScreenPPI * APrinter.PageHeight; end; -function TVpPrintPreview.CalculatePageWidth(Printer: TPrinter) : Integer; +function TVpPrintPreview.CalculatePageWidth(APrinter: TPrinter) : Integer; var ScreenPPI: Integer; PrinterPPI: Integer; begin ScreenPPI := GetDeviceCaps(Canvas.Handle, LOGPIXELSX); {$IFDEF DELPHI} - PrinterPPI := GetDeviceCaps(Printer.Handle, LOGPIXELSX); + PrinterPPI := GetDeviceCaps(APrinter.Handle, LOGPIXELSX); {$ELSE} - PrinterPPI := Printer.XDpi; + PrinterPPI := APrinter.XDpi; if PrinterPPI <> 0 then - Result := Round(ScreenPPI / PrinterPPI * Printer.PageWidth) + Result := Round(ScreenPPI / PrinterPPI * APrinter.PageWidth) else - Result := ScreenPPI * Printer.PageHeight; + Result := ScreenPPI * APrinter.PageHeight; {$ENDIF} end; diff --git a/components/tvplanit/source/vpprtprvdlg.lfm b/components/tvplanit/source/vpprtprvdlg.lfm index 687782a9c..7a30b32b7 100644 --- a/components/tvplanit/source/vpprtprvdlg.lfm +++ b/components/tvplanit/source/vpprtprvdlg.lfm @@ -14,7 +14,6 @@ object frmPrintPreview: TfrmPrintPreview OnCreate = FormCreate OnKeyDown = FormKeyDown OnShow = FormShow - LCLVersion = '2.3.0.0' object Panel1: TPanel Left = 0 Height = 56 @@ -51,7 +50,7 @@ object frmPrintPreview: TfrmPrintPreview end object ToolButton3: TToolButton Left = 55 - Height = 5 + Height = 25 Top = 0 Caption = 'ToolButton3' ImageIndex = 2 @@ -87,7 +86,7 @@ object frmPrintPreview: TfrmPrintPreview end object ToolButton8: TToolButton Left = 152 - Height = 5 + Height = 25 Top = 0 Caption = 'ToolButton8' ImageIndex = 6 diff --git a/components/tvplanit/source/vpprtprvdlg.pas b/components/tvplanit/source/vpprtprvdlg.pas index ed0ab5da1..7b8dc7642 100644 --- a/components/tvplanit/source/vpprtprvdlg.pas +++ b/components/tvplanit/source/vpprtprvdlg.pas @@ -168,6 +168,7 @@ implementation {$ENDIF} uses + OSPrinters, VpConst, // needed for define VP_LCL_SCALING VpPrtFmt; @@ -279,7 +280,7 @@ begin EditForm.VpPrintPreview1.EndDate := EndDate; EditForm.VpPrintPreview1.ZoomFactor := ZoomFactor; EditForm.cboxZoom.ItemIndex := Integer(ZoomFactor); - EditForm.VpPrintPreview1.Printer := Printer; + EditForm.VpPrintPreview1.Printer := Printers.Printer; EditForm.VpPrintPreview1.ForceUpdate; EditForm.VpPrintPreview1.FirstPage; EditForm.DrawingStyle := FDrawingStyle;