tvplanit: Holiday support in TVpGanttView.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8434 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-08-31 21:43:14 +00:00
parent 18308fa2bb
commit 1c707883ce
3 changed files with 53 additions and 4 deletions

View File

@ -294,6 +294,9 @@ var
i, j1, j2, nDays, nEvents: Integer;
x1, y1, x2, y2: Integer;
dx, dy: Integer;
clr: TColor;
dayRec: TVpGanttDayRec;
holiday: String;
begin
with FGanttView do
begin
@ -307,8 +310,29 @@ begin
y1 := TotalColHeaderHeight;
y2 := EventRecords[nEvents-1].HeadRect.Bottom - dy;
RenderCanvas.Brush.style := bsSolid;
for i := 0 to nDays-1 do
if IsWeekend(DayRecords[i].Date) then
begin
dayRec := DayRecords[i];
clr := clNone;
if (gvoWeekends in Options) and IsWeekend(dayRec.Date) then
clr := WeekendColor
else
if (gvoHolidays in Options) and IsHoliday(dayRec.Date, holiday) then
clr := HolidayColor;
if clr <> clNone then
begin
RenderCanvas.Brush.Color := clr;
x1 := dayRec.Rect.Left - dx;
x2 := dayRec.Rect.Right - dx;
RenderCanvas.FillRect(x1, y1, x2, y2);
end;
end;
end;
(*
begin
j1 := i;
break;
@ -341,6 +365,7 @@ begin
inc(j1, 7);
end;
end;
*)
end;
procedure TVpGanttViewPainter.DrawEvents;