From 31a2f25a422d598b610e0a8380aaf7f69d3eed36 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 23 Sep 2022 20:07:48 +0000 Subject: [PATCH] tvplanit: draw month header dividing lines so that they do not run through week headers. Fix showing of month/week/day column headers. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8501 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/source/vpganttview.pas | 13 +++++++++++- .../tvplanit/source/vpganttviewpainter.pas | 20 ++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/components/tvplanit/source/vpganttview.pas b/components/tvplanit/source/vpganttview.pas index 71170aa53..76fba05d4 100644 --- a/components/tvplanit/source/vpganttview.pas +++ b/components/tvplanit/source/vpganttview.pas @@ -1411,10 +1411,15 @@ begin SetLength(FMonthRecords, n); if (Datastore = nil) or (Datastore.Resource = nil) then exit; + if not (gchMonth in FColHeaderAttributes.Visible) then + exit; x1 := FixedColWidth; y1 := 0; - y2 := FTotalColHeaderHeight; + if [gchWeek, gchDay] * FColHeaderAttributes.Visible = [gchWeek, gchDay] then + y2 := FMonthColHeaderHeight + FTextMargin + else + y2 := FTotalColHeaderHeight; if n > 1 then begin @@ -1455,6 +1460,12 @@ var d: TVpDayType; dt1, dt2: TDateTime; begin + if not (gchWeek in FColHeaderAttributes.Visible) then + begin + SetLength(FWeekRecords, 0); + exit; + end; + SetLength(FWeekRecords, GetNumWeeks); x1 := FixedColWidth; y1 := 0; diff --git a/components/tvplanit/source/vpganttviewpainter.pas b/components/tvplanit/source/vpganttviewpainter.pas index 653d76866..7de116965 100644 --- a/components/tvplanit/source/vpganttviewpainter.pas +++ b/components/tvplanit/source/vpganttviewpainter.pas @@ -196,6 +196,9 @@ var R, R1: TRect; P: TPoint; begin + if not (gchDay in FGanttView.ColHeaderAttributes.Visible) then + exit; + // Offset due to scrolling dx := FGanttView.LeftCol * FScaledColWidth; @@ -236,7 +239,8 @@ begin // No dividing line at last day of month because it already has been // drawn as the month divider. - if (DayOf(dayRec.Date) <> DaysInMonth(dayRec.Date)) then + if (DayOf(dayRec.Date) <> DaysInMonth(dayRec.Date)) or + ([gchWeek, gchDay] * FGanttView.ColHeaderAttributes.Visible = [gchWeek, gchDay]) then begin if FGanttView.DrawingStyle = ds3D then DrawBevelLine( @@ -405,6 +409,9 @@ var str: String; strLen: Integer; begin + if not (gchMonth in FGanttView.ColHeaderAttributes.Visible) then + exit; + // Offset due to scrolling dx := FGanttView.LeftCol * FScaledColWidth; @@ -593,6 +600,9 @@ var str: String; strLen: Integer; begin + if not (gchWeek in FGanttView.ColHeaderAttributes.Visible) then + exit; + // Offset due to scrolling dx := FGanttView.LeftCol * FScaledColWidth; @@ -624,14 +634,6 @@ begin BevelShadow, BevelHighlight ) -(* - DrawBevelRect( - RenderCanvas, - TPSRotateRectangle(Angle, RenderIn, R1), - BevelHighlight, - BevelShadow - ) - *) end else begin TPSMoveTo(RenderCanvas, Angle, RenderIn, R.Right, R.Top);