From b1ec8a62c7088700943e7e39c5aa80bf3b703a7e Mon Sep 17 00:00:00 2001 From: tombo Date: Mon, 10 Dec 2007 15:07:11 +0000 Subject: [PATCH] Printers4Lazarus: fixed PrintDialog, especially save to PDF git-svn-id: trunk@13262 - --- components/printers/carbon/carbonprinters.inc | 16 +--------------- components/printers/carbon/carbonprndialogs.inc | 9 ++++++--- components/printers/printersdlgs.pp | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/components/printers/carbon/carbonprinters.inc b/components/printers/carbon/carbonprinters.inc index 8c3a504f74..246b691d08 100644 --- a/components/printers/carbon/carbonprinters.inc +++ b/components/printers/carbon/carbonprinters.inc @@ -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; diff --git a/components/printers/carbon/carbonprndialogs.inc b/components/printers/carbon/carbonprndialogs.inc index e31df6f625..20ecbcebc4 100644 --- a/components/printers/carbon/carbonprndialogs.inc +++ b/components/printers/carbon/carbonprndialogs.inc @@ -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 diff --git a/components/printers/printersdlgs.pp b/components/printers/printersdlgs.pp index 5bf2f0620e..edc7810f33 100644 --- a/components/printers/printersdlgs.pp +++ b/components/printers/printersdlgs.pp @@ -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}