tvplanit: Fix weekend bars not being rotated when printing rotated Gantt view. Prepare printing a limited Gantt date range.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8461 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-09-08 21:00:40 +00:00
parent e435fdb67d
commit c95d86dba0
3 changed files with 34 additions and 9 deletions

View File

@ -87,8 +87,10 @@ type
FActiveRow: Integer; // Selected row
FActiveEvent: TVpEvent; // Selected event
FActiveDate: TDateTime; // Selected date
FStartDate: TDateTime; // Date of the first event
FEndDate: TDateTime; // Date of the last event
FFirstDate: TDateTime; // Date of the first event in the resource
FLastDate: TDateTime; // Date of the last event in the resource
FStartDate: TDateTime; // Date of the first event to be displayed/printed
FEndDate: TDateTime; // Date of the last event to be displayed/printed
FLeftCol: Integer; // Index of the left-most day column
FTopRow: Integer; // Index of the top-most event row
@ -267,6 +269,8 @@ type
property ActiveEvent: TVpEvent read FActiveEvent write SetActiveEvent;
property ActiveDate: TDateTime read FActiveDate write SetActiveDate;
property ActiveRow: Integer read FActiveRow write SetActiveRow;
property FirstDate: TDateTime read FFirstDate;
property LastDate: TDateTime read FLastDate;
property StartDate: TDateTime read FStartDate write FStartDate;
property EndDate: TDateTime read FEndDate write FEndDate;
property ColCount: Integer read FColCount write FColCount;
@ -440,7 +444,6 @@ begin
FMouseDown := false;
SetActiveDate(Now);
FStartDate := FActiveDate;
FColWidth := DEFAULT_COLWIDTH;
FFixedColWidth := 120;
@ -843,20 +846,25 @@ var
begin
if (Datastore = nil) or (Datastore.Resource = nil) or (Datastore.Resource.Schedule.EventCount = 0) then
begin
FStartDate := NO_DATE;
FEndDate := NO_DATE;
FFirstDate := NO_DATE;
FLastDate := NO_DATE;
end else
begin
event := Datastore.Resource.Schedule.GetEvent(0);
FStartDate := trunc(event.StartTime);
FEndDate := -99999;
FFirstDate := trunc(event.StartTime);
FLastDate := -99999;
for i := 0 to Datastore.Resource.Schedule.EventCount-1 do
begin
event := Datastore.Resource.Schedule.GetEvent(i);
d := trunc(event.EndTime);
if d > FEndDate then FEndDate := d;
if d > FLastDate then FLastDate := d;
end;
end;
if FStartDate = 0 then
FStartDate := FFirstDate;
if FEndDate = 0 then
FEndDate := FLastDate;
end;
function TVpGanttView.GetEventOfRow(ARow: Integer): TVpEvent;

View File

@ -535,7 +535,8 @@ begin
R := ScaleRect(dayRec.Rect);
x1 := R.Left - dx;
x2 := R.Right - dx;
RenderCanvas.FillRect(x1, y1, x2, y2);
TPSFilLRect(RenderCanvas, Angle, RenderIn, Rect(x1, y1, x2, y2));
// RenderCanvas.FillRect(x1, y1, x2, y2);
end;
end;
end;

View File

@ -1696,6 +1696,22 @@ var
FLastContact := RenderControl.GetLastPrintLine;
end;
itGanttView:
begin
RenderControl.RenderToCanvas(
ACanvas,
Rect(StartX, StartY, StopX, StopY),
Element.Rotation,
Scale,
GetDate(Element),
0, // to be completed...
0,
Granularity,
true
);
end;
else
RenderControl.RenderToCanvas(
ACanvas,