GridPrinter: Make sure that all printed pages have the same date/time in their header/footer, if applicable. Add xml docs for GrindPrinterActions.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8652 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-12-14 23:22:06 +00:00
parent 3fa0d2ac00
commit 7fcc800de0
2 changed files with 31 additions and 2 deletions

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions><package name="GridPrinterPkg"><module name="GridPrnActions"><element name="TGridPrinterAction"><short>Standard-Action which links to a <var>GridPrinter</var> and calls its <var>Print</var> method to print a grid</short>
</element><element name="TGridPrinterAction.Notification"><short>Inherited procedure which sets the internal <var>FGridPrinter</var> variable to <var>nil</var> when the <var>GridPrinter</var> is deleted.</short>
</element><element name="TGridPrinterAction.Create"><short>Constructor of the <var>TGridPrinterAction</var> class</short>
</element><element name="TGridPrinterAction.ExecuteTarget"><short>Executes the <var>Print()</var> method of the associated <var>TGridPrinter</var> instance if that matches with the <var>Target</var> parameter.</short>
</element><element name="TGridPrinterAction.HandlesTarget"><short>Returns <var>true</var> when the parameter <var>Target</var> is the associated <var>GridPrinter</var>
</short>
</element><element name="TGridPrinterAction.UpdateTarget"><short>Disables the action if no <var>GridPrinter</var> is associated with the action or if the grid associated with the <var>GridPrinter</var> is not visible.</short>
</element><element name="TGridPrinterAction.GridPrinter"><short>Points to the <var>TGridPrinter</var> instance which is associated with the action.</short>
</element><element name="TGridPrintPreviewAction"><short>Standard-Action which links to a <var>GridPrintPreviewDialog</var> and calls its <var>Execute</var> method to display a preview a grid to be printed by a <var>GridPrinter</var>.</short>
</element><element name="TGridPrintPreviewAction.Notification"><short>Inherited procedure which sets the internal <var>FPreviewDlg</var> variable to <var>nil</var> when the associated <var>PrintPreviewDialog</var> is deleted.</short>
</element><element name="TGridPrintPreviewAction.Create"><short>Constructor of the <var>TGridPrintPreviewAction</var> class</short>
</element><element name="TGridPrintPreviewAction.ExecuteTarget"><short>Runs the <var>Execute()</var> method of the associated <var>TGridPrintPreviewDialog</var> instance if that matches with the <var>Target</var> parameter.</short>
</element><element name="TGridPrintPreviewAction.HandlesTarget"><short>Returns <var>true</var> when the parameter <var>Target</var> is the associated <var>GridPrintPreviewDialog</var>
</short>
</element><element name="TGridPrintPreviewAction.UpdateTarget"><short>Disables the action if no <var>PreviewDialog</var> is associated with the action or if that is not associated with a <var>GridPrinter</var>assigned to a visible grid.</short>
</element><element name="TGridPrinterAction.FGridPrinter"><short>Internal variable for the associated <var>TGridPrinter</var> instance.</short>
</element><element name="TGridPrintPreviewAction.FPreviewDlg"><short>Internal variable for the associated <var>TGridPrintPreviewDialog</var> instance.</short>
</element><element name="TGridPrintPreviewAction.PreviewDialog"><short>Points to the <var>TGridPrintPreviewDialog</var> instance which is associated with the action.</short>
</element>
</module>
</package>
</fpdoc-descriptions>

View File

@ -146,6 +146,7 @@ type
FPageHeight: Integer;
FPageWidth: Integer;
FPreviewPercent: Integer; // Scaling factor for preview bitmap
FPrintDateTime: TDateTime;
FPrintOrder: TGridPrnOrder;
FPrintScaleFactor: Double; // Scaling factor for printing
FPrintScaleToNumHorPages: Integer;
@ -277,6 +278,7 @@ type
property Padding: Integer read FPadding;
property PageCount: Integer read GetPageCount;
property PageNumber: Integer read FPageNumber;
property PrintDateTime: TDateTime read FPrintDateTime;
property PrintScaleToNumHorPages: Integer read FPrintScaleToNumHorPages write FPrintScaleToNumHorPages;
property PrintScaleToNumVertPages: Integer read FPrintScaleToNumVertPages write FPrintScaleToNumVertPages;
property PrintScalingMode: TGridPrnScalingMode read FPrintScalingMode write FPrintScalingMode;
@ -486,8 +488,8 @@ const
begin
Result := FSectionText[AIndex];
Result := StringReplace(Result, '$DATE', DateToStr(Now), [rfReplaceAll, rfIgnoreCase]);
Result := StringReplace(Result, '$TIME', TimeToStr(Now), [rfReplaceAll, rfIgnoreCase]);
Result := StringReplace(Result, '$DATE', DateToStr(FOwner.PrintDateTime), [rfReplaceAll, rfIgnoreCase]);
Result := StringReplace(Result, '$TIME', TimeToStr(FOwner.PrintDateTime), [rfReplaceAll, rfIgnoreCase]);
Replace('$PAGECOUNT');
Replace('$PAGE');
Replace('$FULL_FILENAME');
@ -1087,6 +1089,10 @@ begin
Measure(FPageWidth, FPageHeight, FPixelsPerInchX, FPixelsPerInchY);
end;
end;
// Stores the current date/time so that all pages have the same date/time
// in the header/footer.
FPrintDateTime := Now();
end;
procedure TGridPrinter.PrepareCanvas(ACanvas: TCanvas; ACol, ARow: Integer);