You've already forked lazarus-ccr
tvplanit: Print GanttView in multiple pages.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8513 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -918,10 +918,13 @@ end;
|
|||||||
the number of day columns in the view. }
|
the number of day columns in the view. }
|
||||||
function TVpGanttView.GetNumDays: Integer;
|
function TVpGanttView.GetNumDays: Integer;
|
||||||
begin
|
begin
|
||||||
if (FRealStartDate <> NO_DATE) then
|
|
||||||
Result := trunc(FRealEndDate) - trunc(FRealStartDate) + 1
|
|
||||||
else
|
|
||||||
Result := 0;
|
Result := 0;
|
||||||
|
if (FRealStartDate <> NO_DATE) then
|
||||||
|
begin
|
||||||
|
Result := trunc(FRealEndDate) - trunc(FRealStartDate) + 1;
|
||||||
|
if Result < 0 then
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Determines the number of events (= rows) to be displayed in the GanttView. }
|
{ Determines the number of events (= rows) to be displayed in the GanttView. }
|
||||||
|
@ -286,6 +286,7 @@ type
|
|||||||
|
|
||||||
FDayInc: Integer;
|
FDayInc: Integer;
|
||||||
FDayIncUnits: TVpDayUnits;
|
FDayIncUnits: TVpDayUnits;
|
||||||
|
FDefaultDayInc: Integer;
|
||||||
FVisible: Boolean;
|
FVisible: Boolean;
|
||||||
|
|
||||||
protected
|
protected
|
||||||
@ -302,6 +303,8 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
property Collection: TVpPrintFormat read FCollection write FCollection;
|
property Collection: TVpPrintFormat read FCollection write FCollection;
|
||||||
|
// Replacement value used for calculating start date on next page when DayInc is 0
|
||||||
|
property DefaultDayInc: Integer read FDefaultDayInc write FDefaultDayInc;
|
||||||
|
|
||||||
published
|
published
|
||||||
property DayInc: Integer read FDayInc write SetDayInc;
|
property DayInc: Integer read FDayInc write SetDayInc;
|
||||||
@ -316,7 +319,6 @@ type
|
|||||||
TVpPrintFormat = class(TCollection)
|
TVpPrintFormat = class(TCollection)
|
||||||
private
|
private
|
||||||
FOwner: TPersistent;
|
FOwner: TPersistent;
|
||||||
|
|
||||||
protected
|
protected
|
||||||
function GetItem(Index: Integer): TVpPrintFormatItem;
|
function GetItem(Index: Integer): TVpPrintFormatItem;
|
||||||
function GetOwner: TPersistent; override;
|
function GetOwner: TPersistent; override;
|
||||||
@ -326,10 +328,8 @@ type
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
procedure SetItem(Index: Integer; Value: TVpPrintFormatItem);
|
procedure SetItem(Index: Integer; Value: TVpPrintFormatItem);
|
||||||
procedure Update(Item: TCollectionItem); override;
|
procedure Update(Item: TCollectionItem); override;
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TPersistent);
|
constructor Create(AOwner: TPersistent);
|
||||||
|
|
||||||
property Items[Index: Integer]: TVpPrintFormatItem read GetItem write SetItem;
|
property Items[Index: Integer]: TVpPrintFormatItem read GetItem write SetItem;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1056,6 +1056,7 @@ begin
|
|||||||
FDescription := '';
|
FDescription := '';
|
||||||
FDayInc := 0;
|
FDayInc := 0;
|
||||||
FDayIncUnits := duDay;
|
FDayIncUnits := duDay;
|
||||||
|
FDefaultDayInc := 1;
|
||||||
FVisible := True;
|
FVisible := True;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
@ -1555,6 +1556,7 @@ var
|
|||||||
Scale: Extended;
|
Scale: Extended;
|
||||||
StartLine: Integer;
|
StartLine: Integer;
|
||||||
EndLine: Integer;
|
EndLine: Integer;
|
||||||
|
oldGanttStartDate, oldGanttEndDate: TDateTime;
|
||||||
|
|
||||||
procedure GetMeasurements;
|
procedure GetMeasurements;
|
||||||
begin
|
begin
|
||||||
@ -1698,18 +1700,21 @@ var
|
|||||||
|
|
||||||
itGanttView:
|
itGanttView:
|
||||||
begin
|
begin
|
||||||
|
oldGanttStartDate := TVpGanttView(RenderControl).StartDate;
|
||||||
|
TVpGanttView(RenderControl).StartDate := GetDate(Element);
|
||||||
RenderControl.RenderToCanvas(
|
RenderControl.RenderToCanvas(
|
||||||
ACanvas,
|
ACanvas,
|
||||||
Rect(StartX, StartY, StopX, StopY),
|
Rect(StartX, StartY, StopX, StopY),
|
||||||
Element.Rotation,
|
Element.Rotation,
|
||||||
Scale,
|
Scale,
|
||||||
GetDate(Element),
|
TVpGanttView(RenderControl).StartDate,
|
||||||
0, // to be completed...
|
0, // to be completed...
|
||||||
0,
|
0,
|
||||||
Granularity,
|
Granularity,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
Element.DayOffset := TvpGanttView(RenderControl).VisibleCols;
|
FPrintFormats.Items[CurFormat].DefaultDayInc := TVpGanttview(Rendercontrol).VisibleCols;
|
||||||
|
TVpGanttView(RenderControl).StartDate := oldGanttStartDate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -1854,6 +1859,8 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ Advances the date to the next page. The number of days per page is given by
|
||||||
|
the values of DayInc and DayIncUnits of the print format. }
|
||||||
function GetNextDate(ADate: TDateTime): TDateTime;
|
function GetNextDate(ADate: TDateTime): TDateTime;
|
||||||
begin
|
begin
|
||||||
Result := ADate;
|
Result := ADate;
|
||||||
@ -1865,7 +1872,7 @@ var
|
|||||||
duYear : Result := IncYear(Result, PrintFormats.Items[CurFormat].DayInc);
|
duYear : Result := IncYear(Result, PrintFormats.Items[CurFormat].DayInc);
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
Result := Result + 1;
|
Result := Result + PrintFormats.Items[CurFormat].DefaultDayInc;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -2039,7 +2046,7 @@ var
|
|||||||
duYear : Result := IncYear(Result, PrintFormats.Items[CurFormat].DayInc);
|
duYear : Result := IncYear(Result, PrintFormats.Items[CurFormat].DayInc);
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
Result := Result + 1;
|
Result := Result + PrintFormats.Items[CurFormat].DefaultDayInc;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
Reference in New Issue
Block a user