Printers4Lazarus: fixed PrintDialog, especially save to PDF

git-svn-id: trunk@13262 -
This commit is contained in:
tombo 2007-12-10 15:07:11 +00:00
parent e25982fd40
commit b1ec8a62c7
3 changed files with 8 additions and 19 deletions

View File

@ -292,22 +292,8 @@ begin
end;
procedure TCarbonPrinter.UpdatePrinter;
var
S: TStringList;
P: String;
begin
ValidatePrintSettings;
P := GetCurrentPrinterName;
S := TStringList.Create;
try
DoEnumPrinters(S);
//DebugLn('UpdatePrinter ' + P + ' ' + DbgS(S.IndexOf(P)));
PrinterIndex := S.IndexOf(P);
finally
S.Free;
end;
SetPrinter(GetCurrentPrinterName);
Validate;
end;

View File

@ -45,6 +45,7 @@ var
CarbonPrinter: TCarbonPrinter;
DialogSettings: PMPrintSettings;
V: UInt32;
PFrom, PTo: Integer;
begin
Result := False;
// TODO: Options, Title
@ -65,10 +66,12 @@ begin
OSError(PMSetCopies(DialogSettings, Copies, False), Self, SExecute, 'PMSetCopies');
OSError(PMSetPageRange(DialogSettings, MinPage, MaxPage),
Self, SExecute, 'PMSetPageRange');
OSError(PMSetFirstPage(DialogSettings, FromPage, False), Self, SExecute, 'PMSetFirstPage');
OSError(PMSetLastPage(DialogSettings, ToPage, False), Self, SExecute, 'PMSetLastPage');
PFrom := Max(FromPage, MinPage);
OSError(PMSetFirstPage(DialogSettings, PFrom, False), Self, SExecute, 'PMSetFirstPage');
PTo := Max(PFrom, Min(ToPage, MaxPage));
OSError(PMSetLastPage(DialogSettings, PTo, False), Self, SExecute, 'PMSetLastPage');
if OSError(PMSessionPrintDialog(CarbonPrinter.PrintSession, CarbonPrinter.PrintSettings, CarbonPrinter.PageFormat, Result),
if OSError(PMSessionPrintDialog(CarbonPrinter.PrintSession, DialogSettings, CarbonPrinter.PageFormat, Result),
Self, SExecute, 'PMSessionPrintDialog') then Exit;
if Result then

View File

@ -83,7 +83,7 @@ uses Controls, udlgSelectPrinter, udlgPropertiesPrinter, FileUtil;
{$ELSE}
uses Controls, CarbonProc, FPCMacOSAll, LCLProc;
uses Controls, Math, CarbonProc, FPCMacOSAll, LCLProc;
{$I carbonprndialogs.inc}
{$ENDIF}