Printers: Show correct paper names and "source" list in Unix PageSetup dialog. Issue #33427, patch from AlexeyT.

git-svn-id: trunk@57547 -
This commit is contained in:
juha 2018-03-22 08:51:24 +00:00
parent 085dd5ef9f
commit bc26b5cd5f
2 changed files with 20 additions and 5 deletions

View File

@ -88,6 +88,11 @@ var
NDigits, NScale: integer;
NInc: double;
begin
// w/o SetPrinter, list of paper names is different
// (Letter / US Letter, EnvMonarch / Envelope Monarch),
// and list of sources is empty
Printer.SetPrinter(Printer.Printers[Printer.PrinterIndex]);
Dlg:= TDlgPageSetup.Create(nil);
try
if Title<>'' then
@ -166,6 +171,8 @@ begin
Dlg.frmPageSetup.txtRight.Increment:= NInc;
Dlg.frmPageSetup.txtBottom.Increment:= NInc;
Dlg.frmPageSetup.UpdatePageSize;
Result:= Dlg.ShowModal=mrOk;
if Result then
begin

View File

@ -62,7 +62,6 @@ type
FFactorX, FFactorY, FZoom: Double;
function NToInches: double;
procedure RotateMargins(AOrder: boolean);
procedure UpdateMaxValues;
public
UnitInches: boolean;
EnablePreview: boolean;
@ -74,6 +73,7 @@ type
procedure Initialize(AEnablePreview, AEnableMargins, AEnablePapers,
AEnableOrientation: boolean);
procedure UpdatePageSize;
procedure UpdateMaxValues;
procedure SetDefaultMinMargins;
end;
@ -265,13 +265,21 @@ begin
end;
procedure TframePageSetup.UpdateMaxValues;
procedure DoSetMax(Ctl: TFloatSpinEdit; Value: double);
begin
if Ctl.MinValue > Value then
Ctl.MinValue := Value;
Ctl.MaxValue := Value;
end;
const
cMul = 0.45; // max margin is almost 1/2 of page size
begin
txtLeft.MaxValue := CurPageWidth * cMul;
txtRight.MaxValue := CurPageWidth * cMul;
txtTop.MaxValue := CurPageHeight * cMul;
txtBottom.MaxValue := CurPageHeight * cMul;
DoSetMax(txtLeft, CurPageWidth * cMul);
DoSetMax(txtRight, CurPageWidth * cMul);
DoSetMax(txtTop, CurPageHeight * cMul);
DoSetMax(txtBottom, CurPageHeight * cMul);
end;
procedure TframePageSetup.Initialize(AEnablePreview, AEnableMargins, AEnablePapers,