From bb378f95b087c81fd8d9d106e32d7a505411de31 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sun, 28 Aug 2016 09:35:10 +0000 Subject: [PATCH] tvplanit: Fix incorrect hour being displayed after midnight in DayView. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5109 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/source/vpdayviewpainter.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/tvplanit/source/vpdayviewpainter.pas b/components/tvplanit/source/vpdayviewpainter.pas index be954c0b9..30304d79c 100644 --- a/components/tvplanit/source/vpdayviewpainter.pas +++ b/components/tvplanit/source/vpdayviewpainter.pas @@ -1381,7 +1381,7 @@ var lineRect: TRect; lineIndex: Integer; maxIndex: Integer; - hour: Integer; + hour, prevHour: Integer; hourStr, minuteStr, timeStr: String; isFullHour: boolean; begin @@ -1392,6 +1392,7 @@ begin y := LineRect.Top; I := 0; + prevHour := 0; while true do begin lineIndex := StartLine + I; if lineIndex > maxIndex then @@ -1400,10 +1401,13 @@ begin isFullHour := TVpDayViewOpener(FDayView).dvLineMatrix[0, LineIndex].Minute = 0; if isFullHour then begin hour := Ord(TVpDayViewOpener(FDayView).dvLineMatrix[0, LineIndex].Hour); + if (hour < prevHour) then + break; if (hour = 0) and (I > 0) then break; if (StopLine > -1) and (lineIndex >= StopLine) then break; + prevHour := hour; case FDayView.TimeFormat of tf24Hour: minuteStr := '00';