From 72db518cb9c444ddaf35f9faaff059312a963a29 Mon Sep 17 00:00:00 2001 From: skalogryz Date: Sat, 21 Mar 2015 03:41:19 +0000 Subject: [PATCH] richmemo: modified print from pageRect to margins (double) for paragraph's consistency. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4059 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/richmemo/richmemo.pas | 11 ++++++++--- components/richmemo/win32/win32richmemo.pas | 14 ++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/components/richmemo/richmemo.pas b/components/richmemo/richmemo.pas index cb5ea21c9..1aab5fb71 100644 --- a/components/richmemo/richmemo.pas +++ b/components/richmemo/richmemo.pas @@ -104,11 +104,16 @@ type end; type + TRectOffsets = record + Left : Double; + Top : Double; + Right : Double; + Bottom : Double; + end; + TPrintParams = record Title : String; - PageRect : TRect; // position of the printed page in points - // points are relative to the physical page (paper) size - // not DPI of the printer + Margins : TRectOffsets; // margins in points SelStart : Integer; SelLength : Integer; end; diff --git a/components/richmemo/win32/win32richmemo.pas b/components/richmemo/win32/win32richmemo.pas index ff29da87b..7cf42c652 100644 --- a/components/richmemo/win32/win32richmemo.pas +++ b/components/richmemo/win32/win32richmemo.pas @@ -1027,16 +1027,10 @@ begin ,round(APrinter.PageHeight / LogY * TWIP_INCH) ); - if not IsRectEmpty(AParams.PageRect) then begin - Rng.rc.left := round(AParams.PageRect.Left * TWIP_PT); - Rng.rc.top := round(AParams.PageRect.Top * TWIP_PT); - Rng.rc.right := round(AParams.PageRect.Right * TWIP_PT); - Rng.rc.bottom := round(AParams.PageRect.Bottom * TWIP_PT); - end else begin - //todo: use PhysicalOffset? - Rng.rc:=Rng.rcPage; - end; - if not DoPrint then Rng.rcPage.bottom:=Rng.rc.bottom; + Rng.rc.left := round(AParams.Margins.Left * TWIP_PT); + Rng.rc.top := round(AParams.Margins.Top * TWIP_PT); + Rng.rc.right := round(Rng.rcPage.Right - AParams.Margins.Right * TWIP_PT); + Rng.rc.bottom := round(Rng.rcPage.Bottom - AParams.Margins.Bottom * TWIP_PT); SaveRect:=Rng.rc; if AParams.SelLength<=0 then begin