mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 16:40:55 +02:00
LazReport, cut the objects that fall outside of page boundaries on preview window
git-svn-id: trunk@49625 -
This commit is contained in:
parent
c96d141c52
commit
4eaea7c197
@ -8855,6 +8855,7 @@ var
|
|||||||
sx, sy: Double;
|
sx, sy: Double;
|
||||||
v, IsPrinting: Boolean;
|
v, IsPrinting: Boolean;
|
||||||
h: THandle;
|
h: THandle;
|
||||||
|
oldRgn, pageRgn: HRGN;
|
||||||
begin
|
begin
|
||||||
IsPrinting := Printer.Printing and (Canvas is TPrinterCanvas);
|
IsPrinting := Printer.Printing and (Canvas is TPrinterCanvas);
|
||||||
{$IFDEF DebugLR}
|
{$IFDEF DebugLR}
|
||||||
@ -8862,52 +8863,67 @@ begin
|
|||||||
'CanvasPPI=%d',[ord(IsPrinting), Index, Canvas.ClassName,
|
'CanvasPPI=%d',[ord(IsPrinting), Index, Canvas.ClassName,
|
||||||
Canvas.Font.pixelsPerInch]);
|
Canvas.Font.pixelsPerInch]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
pageRgn := 0;
|
||||||
|
oldRgn := CreateRectRgn(0, 0, 0, 0);
|
||||||
|
LCLIntf.GetClipRgn(Canvas.Handle, oldRgn);
|
||||||
|
try
|
||||||
|
|
||||||
DocMode := dmPrinting;
|
DocMode := dmPrinting;
|
||||||
p := FPages[Index];
|
p := FPages[Index];
|
||||||
with p^ do
|
with p^ do
|
||||||
begin
|
|
||||||
if Visible then
|
|
||||||
begin
|
begin
|
||||||
if Page = nil then
|
if Visible then
|
||||||
ObjectsToPage(Index);
|
|
||||||
|
|
||||||
sx:=(DrawRect.Right-DrawRect.Left)/PrnInfo.PgW;
|
|
||||||
sy:=(DrawRect.Bottom-DrawRect.Top)/PrnInfo.PgH;
|
|
||||||
h:= Canvas.Handle;
|
|
||||||
|
|
||||||
for i := 0 to Page.Objects.Count - 1 do
|
|
||||||
begin
|
begin
|
||||||
t :=TfrView(Page.Objects[i]);
|
if Page = nil then
|
||||||
v := True;
|
ObjectsToPage(Index);
|
||||||
|
|
||||||
if not IsPrinting then
|
sx:=(DrawRect.Right-DrawRect.Left)/PrnInfo.PgW;
|
||||||
|
sy:=(DrawRect.Bottom-DrawRect.Top)/PrnInfo.PgH;
|
||||||
|
h:= Canvas.Handle;
|
||||||
|
pageRgn := CreateRectRgn(DrawRect.Left+1, DrawRect.Top+1, DrawRect.Right-1, DrawRect.Bottom-1);
|
||||||
|
LCLIntf.SelectClipRGN(Canvas.Handle, pageRgn);
|
||||||
|
|
||||||
|
for i := 0 to Page.Objects.Count - 1 do
|
||||||
begin
|
begin
|
||||||
with t, DrawRect do
|
t :=TfrView(Page.Objects[i]);
|
||||||
|
v := True;
|
||||||
|
|
||||||
|
if not IsPrinting then
|
||||||
begin
|
begin
|
||||||
v := RectVisible(h, Rect(Round(x * sx) + Left - 10,
|
with t, DrawRect do
|
||||||
Round(y * sy) + Top - 10,
|
begin
|
||||||
Round((x + dx) * sx) + Left + 10,
|
v := RectVisible(h, Rect(Round(x * sx) + Left - 10,
|
||||||
Round((y + dy) * sy) + Top + 10));
|
Round(y * sy) + Top - 10,
|
||||||
|
Round((x + dx) * sx) + Left + 10,
|
||||||
|
Round((y + dy) * sy) + Top + 10));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if v then
|
||||||
|
begin
|
||||||
|
t.ScaleX := sx;
|
||||||
|
t.ScaleY := sy;
|
||||||
|
t.OffsX := DrawRect.Left;
|
||||||
|
t.OffsY := DrawRect.Top;
|
||||||
|
t.IsPrinting := IsPrinting;
|
||||||
|
t.Draw(Canvas);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if v then
|
LCLIntf.DeleteObject(pageRgn);
|
||||||
begin
|
pageRgn := 0;
|
||||||
t.ScaleX := sx;
|
|
||||||
t.ScaleY := sy;
|
|
||||||
t.OffsX := DrawRect.Left;
|
|
||||||
t.OffsY := DrawRect.Top;
|
|
||||||
t.IsPrinting := IsPrinting;
|
|
||||||
t.Draw(Canvas);
|
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
end
|
{ else
|
||||||
{ else
|
begin
|
||||||
begin
|
Page.Free;
|
||||||
Page.Free;
|
Page := nil;
|
||||||
Page := nil;
|
end;}
|
||||||
end;}
|
end;
|
||||||
|
finally
|
||||||
|
if pageRgn<>0 then
|
||||||
|
LCLIntf.DeleteObject(pageRgn);
|
||||||
|
LCLIntf.SelectClipRGN(Canvas.Handle, oldRgn);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user