mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 19:18:14 +02:00
LazReport: moved printer initial setup out of unit's initialization, patch from Zdravko Gabrovski with changes, fix issue #37065
git-svn-id: trunk@63221 -
This commit is contained in:
parent
254e43bb4f
commit
f107619061
@ -71,14 +71,16 @@ type
|
||||
property PrinterIndex: Integer read FPrinterIndex write SetPrinterIndex;
|
||||
end;
|
||||
|
||||
var
|
||||
Prn: TfrPrinter;
|
||||
function Prn : TfrPrinter;
|
||||
|
||||
const
|
||||
MAX_TYP_KNOWN = 118;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
GlobalPrn: TfrPrinter = nil;
|
||||
|
||||
type
|
||||
TPaperInfo = record
|
||||
Typ: Integer;
|
||||
@ -363,6 +365,25 @@ const
|
||||
//
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
|
||||
function Prn: TfrPrinter;
|
||||
begin
|
||||
if Assigned( GlobalPrn ) then
|
||||
Exit( GlobalPrn );
|
||||
|
||||
GlobalPrn := TfrPrinter.Create;
|
||||
try
|
||||
GlobalPrn.Printer:=Printer;
|
||||
except
|
||||
on E: Exception do begin
|
||||
debugln('lazreport: unit lr_prntr: ',E.Message);
|
||||
end;
|
||||
end;
|
||||
Exit( GlobalPrn );
|
||||
end;
|
||||
|
||||
|
||||
{----------------------------------------------------------------------------}
|
||||
constructor TfrPrinter.Create;
|
||||
var
|
||||
@ -1245,16 +1266,9 @@ end;
|
||||
{----------------------------------------------------------------------------}
|
||||
|
||||
initialization
|
||||
Prn := TfrPrinter.Create;
|
||||
try
|
||||
Prn.Printer:=Printer;
|
||||
except
|
||||
on E: Exception do begin
|
||||
debugln('lazreport: unit lr_prntr: ',E.Message);
|
||||
end;
|
||||
end;
|
||||
|
||||
finalization
|
||||
Prn.Free;
|
||||
if Assigned( GlobalPrn ) then
|
||||
GlobalPrn.Free;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user