From 029833dbf22ee7c73cefb7798f0388cb51d4bb14 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 12 Oct 2022 11:27:47 +0000 Subject: [PATCH] tvplanit: Better variable name for page number in VpPrtPrv git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8538 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/source/vpprtprv.pas | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/components/tvplanit/source/vpprtprv.pas b/components/tvplanit/source/vpprtprv.pas index 5c87dc5f6..6a85f1b60 100644 --- a/components/tvplanit/source/vpprtprv.pas +++ b/components/tvplanit/source/vpprtprv.pas @@ -476,7 +476,7 @@ var lDate: TDateTime; lContact, lTask: Integer; lLastPage: Boolean; - i: Integer; + pageNum: Integer; pageInfo: PVpPageInfo; begin if FPageInfo.Count > 0 then @@ -487,20 +487,22 @@ begin lTask := 0; lLastPage := false; + // The first page uses the start parameters GetMem(pageInfo, SizeOf(TVpPageInfo)); pageInfo.Date := lDate; pageInfo.Contact := lContact; pageInfo.Task := lTask; pageInfo.LastPage := lLastPage; FPageInfo.Add(pageInfo); + pageNum := 0; - i := 0; + // The following pages must be rendered to determine the data for the PageInfo item. while (not lLastPage) do begin - inc(i); + inc(pageNum); FControlLink.Printer.RenderPage( RenderBmp.Canvas, Rect(0, 0, RenderBmp.Width, RenderBmp.Height), - i, + pageNum, lDate, FEndDate, lContact, @@ -508,6 +510,9 @@ begin lLastPage ); + // When lLastPage is true the preceeding rendering process yielded an empty + // page. In all other case store the data returned by Printer.RenderPage in + // the PageInfo list. if not lLastPage then begin GetMem(pageInfo, SizeOf(TVpPageInfo));