mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 06:09:14 +02:00
Printers4Lazarus: implemented TPrintDialog PageRange under Carbon
git-svn-id: trunk@13279 -
This commit is contained in:
parent
46ca875004
commit
48c79a27ca
@ -44,8 +44,8 @@ function TPrintDialog.Execute: Boolean;
|
|||||||
var
|
var
|
||||||
CarbonPrinter: TCarbonPrinter;
|
CarbonPrinter: TCarbonPrinter;
|
||||||
DialogSettings: PMPrintSettings;
|
DialogSettings: PMPrintSettings;
|
||||||
V: UInt32;
|
U, V: UInt32;
|
||||||
PFrom, PTo: Integer;
|
PMin, PMax, PFrom, PTo: Integer;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
// TODO: Options, Title
|
// TODO: Options, Title
|
||||||
@ -64,33 +64,45 @@ begin
|
|||||||
|
|
||||||
OSError(PMSetCollate(DialogSettings, Collate), Self, SExecute, 'PMSetCollate');
|
OSError(PMSetCollate(DialogSettings, Collate), Self, SExecute, 'PMSetCollate');
|
||||||
OSError(PMSetCopies(DialogSettings, Copies, False), Self, SExecute, 'PMSetCopies');
|
OSError(PMSetCopies(DialogSettings, Copies, False), Self, SExecute, 'PMSetCopies');
|
||||||
OSError(PMSetPageRange(DialogSettings, MinPage, MaxPage),
|
|
||||||
Self, SExecute, 'PMSetPageRange');
|
PMin := MinPage;
|
||||||
PFrom := Max(FromPage, MinPage);
|
PMax := Max(PMin, MaxPage);
|
||||||
OSError(PMSetFirstPage(DialogSettings, PFrom, False), Self, SExecute, 'PMSetFirstPage');
|
PFrom := Min(Max(FromPage, PMin), PMax);
|
||||||
PTo := Max(PFrom, Min(ToPage, MaxPage));
|
PTo := Max(PFrom, Min(ToPage, PMax));
|
||||||
OSError(PMSetLastPage(DialogSettings, PTo, False), Self, SExecute, 'PMSetLastPage');
|
|
||||||
|
|
||||||
|
OSError(PMSetPageRange(DialogSettings, PMin, PMax),
|
||||||
|
Self, SExecute, 'PMSetPageRange');
|
||||||
|
if PrintRange <> prAllPages then
|
||||||
|
begin
|
||||||
|
OSError(PMSetFirstPage(DialogSettings, PFrom, False), Self, SExecute, 'PMSetFirstPage');
|
||||||
|
OSError(PMSetLastPage(DialogSettings, PTo, False), Self, SExecute, 'PMSetLastPage');
|
||||||
|
end;
|
||||||
|
|
||||||
if OSError(PMSessionPrintDialog(CarbonPrinter.PrintSession, DialogSettings, CarbonPrinter.PageFormat, Result),
|
if OSError(PMSessionPrintDialog(CarbonPrinter.PrintSession, DialogSettings, CarbonPrinter.PageFormat, Result),
|
||||||
Self, SExecute, 'PMSessionPrintDialog') then Exit;
|
Self, SExecute, 'PMSessionPrintDialog') then Exit;
|
||||||
|
|
||||||
if Result then
|
if Result then
|
||||||
begin
|
begin
|
||||||
PrintRange := prSelection;
|
|
||||||
|
|
||||||
OSError(PMGetCollate(DialogSettings, Collate), Self, SExecute, 'PMGetCollate');
|
OSError(PMGetCollate(DialogSettings, Collate), Self, SExecute, 'PMGetCollate');
|
||||||
|
|
||||||
V := Copies;
|
V := Copies;
|
||||||
OSError(PMGetCopies(DialogSettings, V), Self, SExecute, 'PMGetCopies');
|
OSError(PMGetCopies(DialogSettings, V), Self, SExecute, 'PMGetCopies');
|
||||||
Copies := V;
|
Copies := V;
|
||||||
|
|
||||||
V := FromPage;
|
|
||||||
OSError(PMGetFirstPage(DialogSettings, V), Self, SExecute, 'PMGetFirstPage');
|
|
||||||
FromPage := V;
|
|
||||||
V := ToPage;
|
|
||||||
OSError(PMGetLastPage(DialogSettings, V), Self, SExecute, 'PMGetLastPage');
|
OSError(PMGetLastPage(DialogSettings, V), Self, SExecute, 'PMGetLastPage');
|
||||||
ToPage := V;
|
if V > $FFFF then
|
||||||
|
begin
|
||||||
|
PrintRange := prAllPages;
|
||||||
|
FromPage := PMin;
|
||||||
|
ToPage := PMax;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
PrintRange := prSelection;
|
||||||
|
ToPage := V;
|
||||||
|
OSError(PMGetFirstPage(DialogSettings, V), Self, SExecute, 'PMGetFirstPage');
|
||||||
|
FromPage := V;
|
||||||
|
end;
|
||||||
|
|
||||||
if OSError(PMCopyPrintSettings(DialogSettings, CarbonPrinter.PrintSettings),
|
if OSError(PMCopyPrintSettings(DialogSettings, CarbonPrinter.PrintSettings),
|
||||||
Self, SExecute, 'PMCopyPrintSettings') then Exit;
|
Self, SExecute, 'PMCopyPrintSettings') then Exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user