mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-25 06:22:45 +02:00
Printers: Paint shadow for preview, implement psoMargins and psoMinMargins in Unix PageSetup dialog. Issue #33427, patch from AlexeyT.
git-svn-id: trunk@57537 -
This commit is contained in:
parent
f3076a3a17
commit
45ea5e6e15
@ -54,7 +54,7 @@ type
|
||||
TPageSetupDialogOptions = set of TPageSetupDialogOption;
|
||||
|
||||
const
|
||||
cDefaultPageSetupDialogOptions = [psoMargins];
|
||||
cDefaultPageSetupDialogOptions = [psoMargins, psoMinMargins];
|
||||
cDefaultPageSetupMargin = 0;
|
||||
cDefaultPageSetupMinMargin = 400; //400: in mm it's 4mm, in inches it's ~10mm
|
||||
|
||||
|
@ -130,16 +130,29 @@ begin
|
||||
Dlg.frmPageSetup.txtRight.DecimalPlaces:= NDigits;
|
||||
Dlg.frmPageSetup.txtBottom.DecimalPlaces:= NDigits;
|
||||
|
||||
// Delphi wiki: MarginNNN holds value in 1/1000 parts of current Unit
|
||||
Dlg.frmPageSetup.txtLeft.Value:= FMarginLeft/NScale;
|
||||
Dlg.frmPageSetup.txtTop.Value:= FMarginTop/NScale;
|
||||
Dlg.frmPageSetup.txtRight.Value:= FMarginRight/NScale;
|
||||
Dlg.frmPageSetup.txtBottom.Value:= FMarginBottom/NScale;
|
||||
if psoMargins in Options then
|
||||
begin
|
||||
Dlg.frmPageSetup.txtLeft.Value:= FMarginLeft/NScale;
|
||||
Dlg.frmPageSetup.txtTop.Value:= FMarginTop/NScale;
|
||||
Dlg.frmPageSetup.txtRight.Value:= FMarginRight/NScale;
|
||||
Dlg.frmPageSetup.txtBottom.Value:= FMarginBottom/NScale;
|
||||
end
|
||||
else
|
||||
begin
|
||||
//if no psoMargins, set margins 1 inch or 10 mm
|
||||
Dlg.frmPageSetup.txtLeft.Value:= 1000/NScale;
|
||||
Dlg.frmPageSetup.txtTop.Value:= 1000/NScale;
|
||||
Dlg.frmPageSetup.txtRight.Value:= 1000/NScale;
|
||||
Dlg.frmPageSetup.txtBottom.Value:= 1000/NScale;
|
||||
end;
|
||||
|
||||
Dlg.frmPageSetup.txtLeft.MinValue:= FMinMarginLeft/NScale;
|
||||
Dlg.frmPageSetup.txtTop.MinValue:= FMinMarginTop/NScale;
|
||||
Dlg.frmPageSetup.txtRight.MinValue:= FMinMarginRight/NScale;
|
||||
Dlg.frmPageSetup.txtBottom.MinValue:= FMinMarginBottom/NScale;
|
||||
if psoMinMargins in Options then
|
||||
begin
|
||||
Dlg.frmPageSetup.txtLeft.MinValue:= FMinMarginLeft/NScale;
|
||||
Dlg.frmPageSetup.txtTop.MinValue:= FMinMarginTop/NScale;
|
||||
Dlg.frmPageSetup.txtRight.MinValue:= FMinMarginRight/NScale;
|
||||
Dlg.frmPageSetup.txtBottom.MinValue:= FMinMarginBottom/NScale;
|
||||
end;
|
||||
|
||||
Dlg.frmPageSetup.txtLeft.Increment:= NInc;
|
||||
Dlg.frmPageSetup.txtTop.Increment:= NInc;
|
||||
|
@ -5,7 +5,6 @@ object framePageSetup: TframePageSetup
|
||||
Width = 448
|
||||
ClientHeight = 435
|
||||
ClientWidth = 448
|
||||
LCLVersion = '1.9.0.0'
|
||||
TabOrder = 0
|
||||
DesignLeft = 350
|
||||
DesignTop = 92
|
||||
@ -252,6 +251,19 @@ object framePageSetup: TframePageSetup
|
||||
TabOrder = 1
|
||||
OnMouseDown = pbPreviewMouseDown
|
||||
OnResize = panPreviewResize
|
||||
object boxShadow: TShape
|
||||
AnchorSideLeft.Control = pbPreview
|
||||
AnchorSideTop.Control = pbPreview
|
||||
AnchorSideRight.Side = asrCenter
|
||||
Left = 180
|
||||
Height = 65
|
||||
Top = 53
|
||||
Width = 124
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Brush.Color = clGrayText
|
||||
Pen.Color = clGrayText
|
||||
end
|
||||
object pbPreview: TPaintBox
|
||||
AnchorSideLeft.Control = panPreview
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
|
@ -27,6 +27,7 @@ type
|
||||
cbPaper: TComboBox;
|
||||
cbSource: TComboBox;
|
||||
panMargins: TPanel;
|
||||
boxShadow: TShape;
|
||||
txtLeft: TFloatSpinEdit;
|
||||
txtTop: TFloatSpinEdit;
|
||||
txtRight: TFloatSpinEdit;
|
||||
@ -242,6 +243,9 @@ begin
|
||||
begin
|
||||
PbPreview.Width := Round(FFactorX * (Right - Left) * FZoom) + 2;
|
||||
PbPreview.Height := Round(FFactorY * (Bottom - Top) * FZoom) + 2;
|
||||
|
||||
boxShadow.Width := pbPreview.Width;
|
||||
boxShadow.Height := pbPreview.Height;
|
||||
end;
|
||||
|
||||
with Printer.PaperSize.PaperRect do
|
||||
|
Loading…
Reference in New Issue
Block a user