mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 10:36:01 +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
|
||||
CarbonPrinter: TCarbonPrinter;
|
||||
DialogSettings: PMPrintSettings;
|
||||
V: UInt32;
|
||||
PFrom, PTo: Integer;
|
||||
U, V: UInt32;
|
||||
PMin, PMax, PFrom, PTo: Integer;
|
||||
begin
|
||||
Result := False;
|
||||
// TODO: Options, Title
|
||||
@ -64,33 +64,45 @@ begin
|
||||
|
||||
OSError(PMSetCollate(DialogSettings, Collate), Self, SExecute, 'PMSetCollate');
|
||||
OSError(PMSetCopies(DialogSettings, Copies, False), Self, SExecute, 'PMSetCopies');
|
||||
OSError(PMSetPageRange(DialogSettings, MinPage, MaxPage),
|
||||
|
||||
PMin := MinPage;
|
||||
PMax := Max(PMin, MaxPage);
|
||||
PFrom := Min(Max(FromPage, PMin), PMax);
|
||||
PTo := Max(PFrom, Min(ToPage, PMax));
|
||||
|
||||
OSError(PMSetPageRange(DialogSettings, PMin, PMax),
|
||||
Self, SExecute, 'PMSetPageRange');
|
||||
PFrom := Max(FromPage, MinPage);
|
||||
if PrintRange <> prAllPages then
|
||||
begin
|
||||
OSError(PMSetFirstPage(DialogSettings, PFrom, False), Self, SExecute, 'PMSetFirstPage');
|
||||
PTo := Max(PFrom, Min(ToPage, MaxPage));
|
||||
OSError(PMSetLastPage(DialogSettings, PTo, False), Self, SExecute, 'PMSetLastPage');
|
||||
end;
|
||||
|
||||
if OSError(PMSessionPrintDialog(CarbonPrinter.PrintSession, DialogSettings, CarbonPrinter.PageFormat, Result),
|
||||
Self, SExecute, 'PMSessionPrintDialog') then Exit;
|
||||
|
||||
if Result then
|
||||
begin
|
||||
PrintRange := prSelection;
|
||||
|
||||
OSError(PMGetCollate(DialogSettings, Collate), Self, SExecute, 'PMGetCollate');
|
||||
|
||||
V := Copies;
|
||||
OSError(PMGetCopies(DialogSettings, V), Self, SExecute, 'PMGetCopies');
|
||||
Copies := V;
|
||||
|
||||
V := FromPage;
|
||||
OSError(PMGetLastPage(DialogSettings, V), Self, SExecute, 'PMGetLastPage');
|
||||
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;
|
||||
V := ToPage;
|
||||
OSError(PMGetLastPage(DialogSettings, V), Self, SExecute, 'PMGetLastPage');
|
||||
ToPage := V;
|
||||
|
||||
end;
|
||||
|
||||
if OSError(PMCopyPrintSettings(DialogSettings, CarbonPrinter.PrintSettings),
|
||||
Self, SExecute, 'PMCopyPrintSettings') then Exit;
|
||||
|
Loading…
Reference in New Issue
Block a user