mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-06 04:40:35 +01:00
Printers, fixed paper Letter not supported problem issue #9400, fixed Printers4LazIDE untitled printjob
git-svn-id: trunk@12012 -
This commit is contained in:
parent
20ee3f1646
commit
53bd4bff59
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<PathDelim Value="/"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
@ -20,10 +20,10 @@
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="3">
|
||||
<RequiredPackages Count="4">
|
||||
<Item1>
|
||||
<PackageName Value="SynEdit"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
@ -35,6 +35,9 @@
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<PackageName Value="printers4lazide"/>
|
||||
</Item4>
|
||||
</RequiredPackages>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
@ -58,9 +61,8 @@
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<SrcPath Value="$(LazarusDir)\lcl\;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)\"/>
|
||||
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
|
||||
@ -26,7 +26,8 @@ uses
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms
|
||||
{ add your units here }, main, SourcePrinter, Printer4Lazarus;
|
||||
{ add your units here }, main, SourcePrinter, Printer4Lazarus,
|
||||
printers4lazide;
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
|
||||
@ -104,6 +104,7 @@ var
|
||||
begin
|
||||
if PrintDialog.Execute then
|
||||
begin
|
||||
Printer.Title := 'Printers4LazIDE: Source Code Printer Package';
|
||||
Printer.BeginDoc;
|
||||
Printer.Canvas.Font := FFont;
|
||||
|
||||
|
||||
@ -38,7 +38,8 @@ begin
|
||||
fcupsOptions :=nil;
|
||||
fcupsNumOpts :=0;
|
||||
|
||||
FRawModeStream:=nil;
|
||||
FRawModeStream := nil;
|
||||
FCupsPapersCount := -1;
|
||||
end;
|
||||
|
||||
destructor TCUPSPrinter.destroy;
|
||||
@ -193,6 +194,23 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCUPSPrinter.CupsPapersListValid: boolean;
|
||||
var
|
||||
Lst: TStringlist;
|
||||
begin
|
||||
if fCupsPapersCount<=0 then begin
|
||||
// paper list no exists or
|
||||
// paper list is not enumerated yet, try it now.
|
||||
Lst := TStringlist.Create;
|
||||
try
|
||||
DoEnumPapers(Lst);
|
||||
finally
|
||||
Lst.Free;
|
||||
end;
|
||||
end;
|
||||
result := fCupsPapersCount>0;
|
||||
end;
|
||||
|
||||
//Print the file aFileName with a selected printer an options
|
||||
function TCUPSPrinter.PrintFile(aFileName: String): longint;
|
||||
var PrinterName : string;
|
||||
@ -769,28 +787,34 @@ function TCUPSPrinter.DoGetDefaultPaperName: string;
|
||||
begin
|
||||
if not (cpsDefaultPaperNameValid in FStates) then begin
|
||||
fCachedGetDefaultPaperName:=inherited DoGetDefaultPaperName;
|
||||
if FCupsPapersCount=0 then
|
||||
if not CupsPapersListValid then
|
||||
FCachedGetDefaultPaperName:=InternalGetDefPaperName
|
||||
else
|
||||
else begin
|
||||
fCachedGetDefaultPaperName:=
|
||||
GetAttributeString('media-default',fCachedGetDefaultPaperName);
|
||||
{$IFDEF UseCache}
|
||||
Include(FStates,cpsDefaultPaperNameValid);
|
||||
{$ENDIF}
|
||||
{$IFDEF UseCache}
|
||||
Include(FStates,cpsDefaultPaperNameValid);
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
Result:=fCachedGetDefaultPaperName;
|
||||
end;
|
||||
|
||||
function TCUPSPrinter.DoGetPaperName: string;
|
||||
var
|
||||
s: string;
|
||||
begin
|
||||
if not (cpsPaperNameValid in FStates) then begin
|
||||
if FCupsPapersCount=0 then
|
||||
fcachedPaperName:=InternalGetCurPaperName
|
||||
else
|
||||
fCachedPaperName:=cupsGetOption('PageSize');
|
||||
{$IFDEF UseCache}
|
||||
Include(FStates,cpsPaperNameValid);
|
||||
{$ENDIF}
|
||||
// paper is not yet retrieved for first time
|
||||
// first try to see if there is a list of papers available
|
||||
if not CupsPapersListValid then
|
||||
fCachedPaperName := InternalGetCurPaperName
|
||||
else begin
|
||||
fCachedPaperName := cupsGetOption('PageSize');
|
||||
{$IFDEF UseCache}
|
||||
Include(FStates,cpsPaperNameValid);
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
Result:=fCachedPaperName;
|
||||
end;
|
||||
@ -805,7 +829,7 @@ begin
|
||||
{$ENDIF}
|
||||
inherited DoSetPaperName(aName);
|
||||
|
||||
if FCupsPapersCount=0 then begin
|
||||
if FCupsPapersCount<=0 then begin
|
||||
i := IndexOfPaper(aName);
|
||||
if i>=0 then
|
||||
fCurrentPaper := i;
|
||||
|
||||
@ -109,6 +109,7 @@ type
|
||||
function InternalGetDefPaperName: string;
|
||||
function InternalGetCurPaperName: string;
|
||||
procedure InternalGetPaperRect(aPaperName:string; var PaperRect:TPaperRect);
|
||||
function CupsPapersListValid: boolean;
|
||||
|
||||
protected
|
||||
function GetCanvasRef : TPrinterCanvasRef; override;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user