LCL+Printers, patch to allow cupsprinter to use another class of TPrinterCanvas, from Petr Kristan, issue #16101

git-svn-id: trunk@24216 -
This commit is contained in:
jesus 2010-03-25 21:21:55 +00:00
parent a74bc652d2
commit 14e8e2cf01
5 changed files with 21 additions and 8 deletions

View File

@ -699,7 +699,7 @@ end;
function TCUPSPrinter.GetCanvasRef: TPrinterCanvasRef;
begin
Result:=TPostscriptPrinterCanvas;
Result:=CupsCanvasClass;
end;
//Override this methode for assign an
@ -735,7 +735,7 @@ begin
FOutputFileName := FOutputFileName + '.raw'
else begin
FOutputFileName := FOutputFileName + '.ps';
TPostscriptPrinterCanvas(Canvas).OutputFileName := FOutputFileName;
TFilePrinterCanvas(Canvas).OutputFileName := FOutputFileName;
end;
end;
@ -760,7 +760,7 @@ begin
end;
end else
TPostscriptPrinterCanvas(Canvas).OutPutFileName:='';
TFilePrinterCanvas(Canvas).OutPutFileName:='';
if not aAborted and FileExistsUTF8(FOutputFileName) then begin
{$IFDEF LogPrintoutFile}

View File

@ -166,3 +166,6 @@ type
property CupsPPD:Pppd_file_t read fcupsPPD;
end;
Var
CupsCanvasClass : TFilePrinterCanvasClass = TPostscriptPrinterCanvas;

View File

@ -116,6 +116,7 @@ Patrick Chevalley
Paul Ishenin
Paul Michell
Pawel Trochimczuk
Petr Kristan
Peter Dyson
Philip J. Hess
Pierre Gillmann

View File

@ -57,11 +57,10 @@ Type
TPsCanvasState = ( pcsPosValid, pcsClipping, pcsClipSaved );
TPsCanvasStatus = set of TPsCanvasState;
TPostScriptPrinterCanvas = Class(TPrinterCanvas)
TPostScriptPrinterCanvas = Class(TFilePrinterCanvas)
private
fHeader : TStringList; //Header document
fDocument : TstringList; //Current document
fFileName : String; //OutOut fileName
fBuffer : TStringList; //PostScript temporary buffer
@ -182,7 +181,6 @@ Type
const Style: TTextStyle); override;
property OutPutFileName : string read fFileName write fFileName;
end;
TPostScriptCanvas = Class(TPostScriptPrinterCanvas)
@ -1478,8 +1476,8 @@ begin
if I <> -1 then
FHeader[I] := '%%' + Format('Pages: %d', [PageNumber]);
if Trim(fFileName)<>'' then
SaveToFile(ExpandFileNameUTF8(fFileName));
if Trim(OutputFileName)<>'' then
SaveToFile(ExpandFileNameUTF8(OutputFileName));
if Assigned(fPsUnicode) then
FreeAndNil(fPsUnicode);

View File

@ -115,6 +115,17 @@ type
TPrinterCanvasRef = Class of TPrinterCanvas;
{ TFilePrinterCanvas }
TFilePrinterCanvas = class(TPrinterCanvas)
protected
FOutputFileName: string;
public
property OutputFileName : string read FOutputFileName write FOutputFileName;
end;
TFilePrinterCanvasClass = class of TFilePrinterCanvas;
TPaperRect = Record
PhysicalRect : TRect;
WorkRect : TRect;