You've already forked lazarus-ccr
tvplanit: Implement TVpGanttView.Options (show date, show weekends, show vertical/horizontal grid).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8428 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -291,8 +291,9 @@ var
|
||||
begin
|
||||
with FGanttView do
|
||||
begin
|
||||
if StartDate = NO_DATE then
|
||||
if (StartDate = NO_DATE) then
|
||||
exit;
|
||||
|
||||
nEvents := NumEvents;
|
||||
nDays := NumDays;
|
||||
dx := LeftCol * ColWidth;
|
||||
@ -311,25 +312,28 @@ begin
|
||||
if y2 > RealBottom then
|
||||
y2 := RealBottom;
|
||||
|
||||
RenderCanvas.Brush.Color := FGanttView.WeekendColor;
|
||||
RenderCanvas.Brush.Style := bsSolid;
|
||||
|
||||
while j1 < nDays do
|
||||
if (gvoWeekends in FGanttView.Options) then
|
||||
begin
|
||||
if j1 < nDays-1 then
|
||||
j2 := j1 + 1
|
||||
else
|
||||
j2 := j1;
|
||||
x2 := FGanttView.DayRecords[j2].Rect.Right - dx;
|
||||
if x2 >= FGanttView.FixedColWidth then
|
||||
begin
|
||||
x1 := FGanttView.DayRecords[j1].Rect.Left - dx;
|
||||
if x1 < FGanttView.FixedColWidth then
|
||||
x1 := FGanttView.FixedColWidth;
|
||||
RenderCanvas.FillRect(x1, y1, x2, y2);
|
||||
end;
|
||||
RenderCanvas.Brush.Color := FGanttView.WeekendColor;
|
||||
RenderCanvas.Brush.Style := bsSolid;
|
||||
|
||||
inc(j1, 7);
|
||||
while j1 < nDays do
|
||||
begin
|
||||
if j1 < nDays-1 then
|
||||
j2 := j1 + 1
|
||||
else
|
||||
j2 := j1;
|
||||
x2 := FGanttView.DayRecords[j2].Rect.Right - dx;
|
||||
if x2 >= FGanttView.FixedColWidth then
|
||||
begin
|
||||
x1 := FGanttView.DayRecords[j1].Rect.Left - dx;
|
||||
if x1 < FGanttView.FixedColWidth then
|
||||
x1 := FGanttView.FixedColWidth;
|
||||
RenderCanvas.FillRect(x1, y1, x2, y2);
|
||||
end;
|
||||
|
||||
inc(j1, 7);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -391,7 +395,7 @@ begin
|
||||
dx := FGanttView.LeftCol * FGanttView.ColWidth;
|
||||
dy := FGanttView.TopRow * FGanttView.RowHeight;
|
||||
|
||||
// Horizontal lines
|
||||
// Horizontal line terminating the col header block
|
||||
x1 := RealLeft + FGanttView.FixedColWidth;
|
||||
n := FGanttView.NumMonths;
|
||||
if n > 0 then
|
||||
@ -404,33 +408,40 @@ begin
|
||||
if FGanttView.DrawingStyle = ds3D then dec(y0);
|
||||
RenderCanvas.Line(x1, y0, x2, y0);
|
||||
|
||||
y0 := -dy;
|
||||
if FGanttView.DrawingStyle = ds3D then dec(y0);
|
||||
numEvents := FGanttView.NumEvents;
|
||||
for i := 0 to numEvents - 1 do
|
||||
// Horizontal lines
|
||||
if (gvoHorizGrid in FGanttView.Options) then
|
||||
begin
|
||||
eventRec := FGanttView.EventRecords[i];
|
||||
y1 := y0 + eventRec.EventRect.Bottom;
|
||||
if y1 >= FGanttView.TotalColHeaderHeight then
|
||||
RenderCanvas.Line(x1, y1, x2, y1);
|
||||
y0 := -dy;
|
||||
if FGanttView.DrawingStyle = ds3D then dec(y0);
|
||||
numEvents := FGanttView.NumEvents;
|
||||
for i := 0 to numEvents - 1 do
|
||||
begin
|
||||
eventRec := FGanttView.EventRecords[i];
|
||||
y1 := y0 + eventRec.EventRect.Bottom;
|
||||
if y1 >= FGanttView.TotalColHeaderHeight then
|
||||
RenderCanvas.Line(x1, y1, x2, y1);
|
||||
end;
|
||||
end;
|
||||
|
||||
// Vertical lines
|
||||
y1 := RealTop + FGanttView.TotalColHeaderHeight;
|
||||
if numEvents > 0 then
|
||||
if (gvoVertGrid in FGanttView.Options) then
|
||||
begin
|
||||
eventRec := FGanttView.EventRecords[numEvents-1];
|
||||
y2 := eventRec.EventRect.Bottom - dy;
|
||||
end else
|
||||
y2 := RealBottom;
|
||||
n := FGanttView.NumDays;
|
||||
for i := 0 to n-1 do
|
||||
begin
|
||||
dayRec := FGanttView.DayRecords[i];
|
||||
x1 := dayRec.Rect.Right - dx;
|
||||
x2 := x1;
|
||||
if x1 >= FGanttView.FixedColWidth then
|
||||
RenderCanvas.Line(x1, y1, x2, y2);
|
||||
y1 := RealTop + FGanttView.TotalColHeaderHeight;
|
||||
if numEvents > 0 then
|
||||
begin
|
||||
eventRec := FGanttView.EventRecords[numEvents-1];
|
||||
y2 := eventRec.EventRect.Bottom - dy;
|
||||
end else
|
||||
y2 := RealBottom;
|
||||
n := FGanttView.NumDays;
|
||||
for i := 0 to n-1 do
|
||||
begin
|
||||
dayRec := FGanttView.DayRecords[i];
|
||||
x1 := dayRec.Rect.Right - dx;
|
||||
x2 := x1;
|
||||
if x1 >= FGanttView.FixedColWidth then
|
||||
RenderCanvas.Line(x1, y1, x2, y2);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -571,7 +582,7 @@ begin
|
||||
DrawEvents;
|
||||
|
||||
{ Draw active day rectangle }
|
||||
if FGanttView.ShowActiveDate then
|
||||
if (gvoActiveDate in FGanttView.Options) then
|
||||
DrawActiveDate;
|
||||
|
||||
{ Draw the borders }
|
||||
|
Reference in New Issue
Block a user