You've already forked lazarus-ccr
tvplanit: Fix duplicate last page in print-out of TaskList. Add some debugln code, maybe to be removed again later.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8516 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
unit VpTasklistPainter;
|
||||
|
||||
{$I vp.inc}
|
||||
{$DEFINE DEBUG_VP_TASKLISTPAINTER}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF DEBUG_VP_TASKLISTPAINTER}LazLogger{$ENDIF},
|
||||
SysUtils, LCLType, LCLIntf,
|
||||
Classes, Graphics, Types,
|
||||
VpConst, VpBase, VpTaskList, VpBasePainter;
|
||||
@ -330,8 +332,13 @@ var
|
||||
CheckRect: TRect;
|
||||
DisplayStr: string;
|
||||
begin
|
||||
{$IFDEF DEBUG_VP_TASKLISTPAINTER}
|
||||
DebugLn('[TVpTaskListPainter.DrawTasks] ENTER: StartLine = %d', [StartLine]);
|
||||
{$ENDIF}
|
||||
|
||||
xLeft := RealLeft + 2;
|
||||
xRight := xLeft + RealWidth - 3;
|
||||
|
||||
with TVpTaskListOpener(FTaskList) do begin
|
||||
if (DataStore = nil) or
|
||||
(DataStore.Resource = nil) or
|
||||
@ -374,8 +381,10 @@ begin
|
||||
{$IF VP_LCL_SCALING = 0}
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
{$ENDIF}
|
||||
|
||||
for I := StartLine to pred(tlAllTaskList.Count) do begin
|
||||
task := tlAllTaskList[I];
|
||||
// if (LineRect.Top + round(0.5 * RowHeight) <= RealBottom) then begin // wp: here the last row of the page could be truncated in height.
|
||||
if (LineRect.Bottom <= RealBottom) then begin
|
||||
// If this is the selected task and we are not in edit mode,
|
||||
// then set background selection.
|
||||
@ -446,18 +455,31 @@ begin
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
if tlVisibleItems + tlItemsBefore = tlAllTaskList.Count then begin
|
||||
|
||||
{$IFDEF DEBUG_VP_TASKLISTPAINTER}
|
||||
DebugLn('[TVpTaskListPainter.DrawTasks] tlVisibleItems = %d, tlItemsBefore = %d, tlAllTaskList.Count = %d', [
|
||||
tlVisibleItems, tlItemsBefore, tlAllTaskList.Count
|
||||
]);
|
||||
{$ENDIF}
|
||||
|
||||
// if tlVisibleItems + tlItemsBefore = tlAllTaskList.Count then begin // wp: here the last page would be duplicate
|
||||
if Startline + tlVisibleItems >= tlAllTaskList.Count then begin
|
||||
FLastPrintLine := -2;
|
||||
tlItemsAfter := 0;
|
||||
end else begin
|
||||
tlItemsAfter := tlAllTaskList.Count - tlItemsBefore - tlVisibleItems;
|
||||
end;
|
||||
|
||||
{ these are for the syncing the scrollbar }
|
||||
// These are for syncing the scrollbar
|
||||
if StartLine < 0 then
|
||||
tlItemsBefore := 0
|
||||
else
|
||||
tlItemsBefore := StartLine;
|
||||
|
||||
{$IFDEF DEBUG_VP_TASKLISTPAINTER}
|
||||
DebugLn('[TVpTaskListPainter.DrawTasks] EXIT: StartLine = %d, LastPrintLine = %d', [StartLine, FLastPrintLine]);
|
||||
{$ENDIF}
|
||||
|
||||
end; // with TVpTaskListOpener(FTaskList)...
|
||||
end;
|
||||
|
||||
|
Reference in New Issue
Block a user