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

View File

@ -535,7 +535,8 @@ begin
R := ScaleRect(dayRec.Rect); R := ScaleRect(dayRec.Rect);
x1 := R.Left - dx; x1 := R.Left - dx;
x2 := R.Right - 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; end;
end; end;

View File

@ -1696,6 +1696,22 @@ var
FLastContact := RenderControl.GetLastPrintLine; FLastContact := RenderControl.GetLastPrintLine;
end; 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 else
RenderControl.RenderToCanvas( RenderControl.RenderToCanvas(
ACanvas, ACanvas,