mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 08:58:23 +02:00
Printer4Lazarus: Improve Unix Print Dialogs. Issue #38027, patch from Joeny Ang.
git-svn-id: trunk@64107 -
This commit is contained in:
parent
b796837ec3
commit
f38ee04679
@ -47,6 +47,9 @@ resourcestring
|
||||
p4lrsAllPages = 'All';
|
||||
p4lrsPageOdd = 'Odd';
|
||||
p4lrsPageEven = 'Even';
|
||||
p4lrsNotAvailable = 'Not available';
|
||||
p4lrsAbbrevUnitsMm = 'mm';
|
||||
p4lrsAbbrevUnitsInches = '"';
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -18,7 +18,7 @@ uses
|
||||
{$ifdef DebugCUPS}LCLProc,{$endif}
|
||||
StdCtrls, Printers,
|
||||
// Printers
|
||||
OsPrinters, CupsDyn;
|
||||
OsPrinters, CupsDyn, Printer4LazStrConst;
|
||||
|
||||
const
|
||||
C_SPACE = 6;
|
||||
@ -46,36 +46,44 @@ begin
|
||||
combo.Tag:=-1;
|
||||
combo.Enabled:=false;
|
||||
|
||||
if THackCUPSPrinter(Printer).CupsPPD=nil then
|
||||
exit;
|
||||
if Option=nil then
|
||||
begin
|
||||
if OptionStr='' then
|
||||
try
|
||||
if THackCUPSPrinter(Printer).CupsPPD=nil then
|
||||
exit;
|
||||
Option := ppdFindOption(THackCUPSPrinter(Printer).CupsPPD,pchar(OptionStr));
|
||||
if Option=nil then
|
||||
exit;
|
||||
end;
|
||||
begin
|
||||
if OptionStr='' then
|
||||
exit;
|
||||
Option := ppdFindOption(THackCUPSPrinter(Printer).CupsPPD,pchar(OptionStr));
|
||||
if Option=nil then
|
||||
exit;
|
||||
end;
|
||||
|
||||
c := 0;
|
||||
Choice := Option^.choices;
|
||||
St := THackCUPSPrinter(Printer).cupsGetOption(Option^.keyword);
|
||||
{$IFDEF DebugCUPS}
|
||||
DbgOut('Combo: Keyword="%s" Default="%s" CurValue="%s"',
|
||||
[Option^.keyword,Option^.defchoice,St]);
|
||||
{$ENDIF}
|
||||
if St='' then
|
||||
St := Option^.defchoice;
|
||||
while (Choice<>nil) and (c<Option^.num_choices) do
|
||||
begin
|
||||
j := combo.items.AddObject(choice^.Text, TObject(Choice));
|
||||
if strcomp(choice^.choice, pchar(St))=0 then
|
||||
combo.Tag := j;
|
||||
inc(Choice);
|
||||
inc(c);
|
||||
c := 0;
|
||||
Choice := Option^.choices;
|
||||
St := THackCUPSPrinter(Printer).cupsGetOption(Option^.keyword);
|
||||
{$IFDEF DebugCUPS}
|
||||
DbgOut('Combo: Keyword="%s" Default="%s" CurValue="%s"',
|
||||
[Option^.keyword,Option^.defchoice,St]);
|
||||
{$ENDIF}
|
||||
if St='' then
|
||||
St := Option^.defchoice;
|
||||
while (Choice<>nil) and (c<Option^.num_choices) do
|
||||
begin
|
||||
j := combo.items.AddObject(choice^.Text, TObject(Choice));
|
||||
if strcomp(choice^.choice, pchar(St))=0 then
|
||||
combo.Tag := j;
|
||||
inc(Choice);
|
||||
inc(c);
|
||||
end;
|
||||
combo.ItemIndex := combo.Tag;
|
||||
combo.Enabled := combo.Items.Count > 0;
|
||||
finally
|
||||
if not combo.Enabled then
|
||||
begin
|
||||
combo.Items.Text := p4lrsNotAvailable;
|
||||
combo.ItemIndex := 0;
|
||||
end;
|
||||
end;
|
||||
combo.ItemIndex := combo.Tag;
|
||||
combo.Enabled:=combo.Tag<>-1;
|
||||
{$IFDEF DebugCUPS}
|
||||
DebugLn(' SelValue="%s" ItemIndex=%d',[St,combo.ItemIndex]);
|
||||
{$ENDIF}
|
||||
|
@ -32,6 +32,7 @@ begin
|
||||
Dlg.PrintRange := Self.PrintRange;
|
||||
Dlg.cbCollate.Checked := Self.Collate;
|
||||
Dlg.edCopies.Value := Self.Copies;
|
||||
Dlg.cbPrintToFile.Checked := Self.PrintToFile;
|
||||
if Title<>'' then
|
||||
Dlg.Caption := Title
|
||||
else
|
||||
|
@ -1,55 +1,72 @@
|
||||
object framePageSetup: TframePageSetup
|
||||
Left = 0
|
||||
Height = 435
|
||||
Height = 445
|
||||
Top = 0
|
||||
Width = 448
|
||||
ClientHeight = 435
|
||||
ClientHeight = 445
|
||||
ClientWidth = 448
|
||||
TabOrder = 0
|
||||
DesignLeft = 350
|
||||
DesignTop = 92
|
||||
DesignLeft = 326
|
||||
DesignTop = 136
|
||||
object panSetup: TPanel
|
||||
Left = 0
|
||||
Height = 211
|
||||
Top = 224
|
||||
Height = 218
|
||||
Top = 230
|
||||
Width = 448
|
||||
Align = alBottom
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 211
|
||||
ChildSizing.HorizontalSpacing = 8
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 218
|
||||
ClientWidth = 448
|
||||
TabOrder = 0
|
||||
object gpPaper: TGroupBox
|
||||
Left = 6
|
||||
Height = 98
|
||||
Top = 6
|
||||
Width = 436
|
||||
Left = 0
|
||||
Height = 106
|
||||
Top = 0
|
||||
Width = 448
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
AutoSize = True
|
||||
Caption = 'Paper'
|
||||
ClientHeight = 82
|
||||
ClientWidth = 432
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 86
|
||||
ClientWidth = 446
|
||||
TabOrder = 0
|
||||
object lblPaper: TLabel
|
||||
Left = 14
|
||||
Height = 14
|
||||
Top = 11
|
||||
Width = 37
|
||||
Caption = 'Paper:'
|
||||
AnchorSideLeft.Control = gpPaper
|
||||
AnchorSideTop.Control = cbPaper
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 10
|
||||
Width = 39
|
||||
Caption = 'Paper'
|
||||
FocusControl = cbPaper
|
||||
ParentColor = False
|
||||
end
|
||||
object lblSource: TLabel
|
||||
Left = 14
|
||||
Height = 14
|
||||
AnchorSideLeft.Control = gpPaper
|
||||
AnchorSideTop.Control = cbSource
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 51
|
||||
Width = 46
|
||||
Caption = 'Source:'
|
||||
Width = 45
|
||||
Caption = 'Source'
|
||||
FocusControl = cbSource
|
||||
ParentColor = False
|
||||
end
|
||||
object cbPaper: TComboBox
|
||||
Left = 78
|
||||
Height = 28
|
||||
Top = 3
|
||||
Width = 347
|
||||
AnchorSideTop.Control = gpPaper
|
||||
AnchorSideRight.Control = gpPaper
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 90
|
||||
Height = 35
|
||||
Top = 2
|
||||
Width = 348
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
ItemHeight = 0
|
||||
OnChange = cbPaperChange
|
||||
@ -57,32 +74,42 @@ object framePageSetup: TframePageSetup
|
||||
TabOrder = 0
|
||||
end
|
||||
object cbSource: TComboBox
|
||||
Left = 78
|
||||
Height = 28
|
||||
AnchorSideLeft.Control = cbPaper
|
||||
AnchorSideTop.Control = cbPaper
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = cbPaper
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 90
|
||||
Height = 35
|
||||
Top = 43
|
||||
Width = 347
|
||||
Width = 348
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Bottom = 8
|
||||
ItemHeight = 0
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object gpOrientation: TGroupBox
|
||||
Left = 6
|
||||
Height = 95
|
||||
Top = 110
|
||||
Width = 120
|
||||
Left = 0
|
||||
Height = 106
|
||||
Top = 112
|
||||
Width = 113
|
||||
Align = alLeft
|
||||
BorderSpacing.Around = 6
|
||||
AutoSize = True
|
||||
Caption = 'Orientation'
|
||||
ClientHeight = 79
|
||||
ClientWidth = 116
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ClientHeight = 86
|
||||
ClientWidth = 111
|
||||
TabOrder = 1
|
||||
object radPortrait: TRadioButton
|
||||
AnchorSideLeft.Control = gpOrientation
|
||||
AnchorSideTop.Control = gpOrientation
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 8
|
||||
Width = 70
|
||||
Height = 23
|
||||
Top = 2
|
||||
Width = 77
|
||||
Caption = 'Portrait'
|
||||
Checked = True
|
||||
OnClick = radPortraitClick
|
||||
@ -90,112 +117,115 @@ object framePageSetup: TframePageSetup
|
||||
TabStop = True
|
||||
end
|
||||
object radLandscape: TRadioButton
|
||||
AnchorSideLeft.Control = radPortrait
|
||||
AnchorSideTop.Control = radPortrait
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 40
|
||||
Width = 91
|
||||
Height = 23
|
||||
Top = 25
|
||||
Width = 95
|
||||
Caption = 'Landscape'
|
||||
OnClick = radPortraitClick
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object gpMargins: TGroupBox
|
||||
Left = 132
|
||||
Height = 95
|
||||
Top = 110
|
||||
Width = 310
|
||||
Left = 121
|
||||
Height = 106
|
||||
Top = 112
|
||||
Width = 327
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 6
|
||||
AutoSize = True
|
||||
Caption = 'Margins'
|
||||
ClientHeight = 79
|
||||
ClientWidth = 306
|
||||
ClientHeight = 86
|
||||
ClientWidth = 325
|
||||
TabOrder = 2
|
||||
object panMargins: TPanel
|
||||
Left = 0
|
||||
Height = 79
|
||||
Height = 80
|
||||
Top = 0
|
||||
Width = 306
|
||||
Width = 325
|
||||
Align = alClient
|
||||
AutoSize = True
|
||||
BorderSpacing.Bottom = 6
|
||||
BevelOuter = bvSpace
|
||||
ClientHeight = 79
|
||||
ClientWidth = 306
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 80
|
||||
ClientWidth = 325
|
||||
TabOrder = 0
|
||||
object lblBottom: TLabel
|
||||
AnchorSideLeft.Control = lblRight
|
||||
AnchorSideTop.Control = txtTop
|
||||
AnchorSideTop.Control = txtBottom
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 142
|
||||
Height = 14
|
||||
Top = 43
|
||||
Left = 166
|
||||
Height = 19
|
||||
Top = 50
|
||||
Width = 48
|
||||
Caption = 'Bottom:'
|
||||
Caption = 'Bottom'
|
||||
ParentColor = False
|
||||
end
|
||||
object lblTop: TLabel
|
||||
AnchorSideLeft.Control = lblLeft
|
||||
AnchorSideTop.Control = txtTop
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 7
|
||||
Height = 14
|
||||
Top = 43
|
||||
Left = 9
|
||||
Height = 19
|
||||
Top = 50
|
||||
Width = 24
|
||||
Caption = 'Top:'
|
||||
Caption = 'Top'
|
||||
ParentColor = False
|
||||
end
|
||||
object lblRight: TLabel
|
||||
AnchorSideLeft.Control = txtLeft
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = txtLeft
|
||||
AnchorSideLeft.Control = Label1
|
||||
AnchorSideTop.Control = txtRight
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 142
|
||||
Height = 14
|
||||
Top = 13
|
||||
Width = 36
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Right:'
|
||||
Left = 166
|
||||
Height = 19
|
||||
Top = 9
|
||||
Width = 34
|
||||
BorderSpacing.Left = 4
|
||||
Caption = 'Right'
|
||||
ParentColor = False
|
||||
end
|
||||
object lblLeft: TLabel
|
||||
AnchorSideLeft.Control = panMargins
|
||||
AnchorSideTop.Control = txtLeft
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 7
|
||||
Height = 14
|
||||
Top = 13
|
||||
Width = 27
|
||||
Left = 9
|
||||
Height = 19
|
||||
Top = 9
|
||||
Width = 25
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Left:'
|
||||
Caption = 'Left'
|
||||
ParentColor = False
|
||||
end
|
||||
object txtLeft: TFloatSpinEdit
|
||||
Left = 64
|
||||
Height = 24
|
||||
Top = 8
|
||||
Width = 72
|
||||
Increment = 1
|
||||
MaxValue = 100
|
||||
MinValue = 0
|
||||
OnChange = txtLeftChange
|
||||
TabOrder = 0
|
||||
Value = 0
|
||||
end
|
||||
object txtRight: TFloatSpinEdit
|
||||
AnchorSideTop.Control = txtLeft
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = panMargins
|
||||
AnchorSideLeft.Control = Label1
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = panMargins
|
||||
AnchorSideRight.Control = Label1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 227
|
||||
Height = 24
|
||||
Top = 8
|
||||
Left = 87
|
||||
Height = 35
|
||||
Top = 1
|
||||
Width = 72
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 4
|
||||
OnChange = txtLeftChange
|
||||
TabOrder = 0
|
||||
end
|
||||
object txtRight: TFloatSpinEdit
|
||||
AnchorSideTop.Control = panMargins
|
||||
AnchorSideRight.Control = panMargins
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 244
|
||||
Height = 35
|
||||
Top = 1
|
||||
Width = 72
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 6
|
||||
Increment = 1
|
||||
MaxValue = 100
|
||||
MinValue = 0
|
||||
OnChange = txtLeftChange
|
||||
TabOrder = 1
|
||||
Value = 0
|
||||
end
|
||||
object txtTop: TFloatSpinEdit
|
||||
AnchorSideLeft.Control = txtLeft
|
||||
@ -203,79 +233,58 @@ object framePageSetup: TframePageSetup
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = txtLeft
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 64
|
||||
Height = 24
|
||||
Top = 38
|
||||
Left = 87
|
||||
Height = 35
|
||||
Top = 42
|
||||
Width = 72
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
Increment = 1
|
||||
MaxValue = 100
|
||||
MinValue = 0
|
||||
OnChange = txtLeftChange
|
||||
TabOrder = 2
|
||||
Value = 0
|
||||
end
|
||||
object txtBottom: TFloatSpinEdit
|
||||
AnchorSideLeft.Control = txtRight
|
||||
AnchorSideTop.Control = txtTop
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideTop.Control = txtRight
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = txtRight
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 227
|
||||
Height = 24
|
||||
Top = 38
|
||||
Left = 244
|
||||
Height = 35
|
||||
Top = 42
|
||||
Width = 72
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Increment = 1
|
||||
MaxValue = 100
|
||||
MinValue = 0
|
||||
OnChange = txtLeftChange
|
||||
TabOrder = 3
|
||||
Value = 0
|
||||
end
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = panMargins
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = panMargins
|
||||
Left = 162
|
||||
Height = 1
|
||||
Top = 1
|
||||
Width = 1
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
object panPreview: TPanel
|
||||
AnchorSideTop.Control = panSetup
|
||||
Left = 0
|
||||
Height = 224
|
||||
Height = 230
|
||||
Top = 0
|
||||
Width = 448
|
||||
Align = alClient
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 224
|
||||
ClientHeight = 230
|
||||
ClientWidth = 448
|
||||
Constraints.MinHeight = 142
|
||||
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
|
||||
AnchorSideTop.Control = panPreview
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 174
|
||||
Height = 130
|
||||
Top = 47
|
||||
Width = 100
|
||||
OnMouseDown = pbPreviewMouseDown
|
||||
OnMouseWheelDown = pbPreviewMouseWheelDown
|
||||
OnMouseWheelUp = pbPreviewMouseWheelUp
|
||||
Left = 0
|
||||
Height = 230
|
||||
Top = 0
|
||||
Width = 448
|
||||
Align = alClient
|
||||
OnPaint = pbPreviewPaint
|
||||
end
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ uses
|
||||
LCLIntf, LCLProc, LResources, Controls, Graphics, Forms, ExtCtrls, StdCtrls,
|
||||
Spin, Printers,
|
||||
// Printers
|
||||
OsPrinters, CupsLCL;
|
||||
CupsLCL, Printer4LazStrConst;
|
||||
|
||||
type
|
||||
{ TframePageSetup }
|
||||
@ -26,8 +26,8 @@ type
|
||||
TframePageSetup = class(TFrame)
|
||||
cbPaper: TComboBox;
|
||||
cbSource: TComboBox;
|
||||
Label1: TLabel;
|
||||
panMargins: TPanel;
|
||||
boxShadow: TShape;
|
||||
txtLeft: TFloatSpinEdit;
|
||||
txtTop: TFloatSpinEdit;
|
||||
txtRight: TFloatSpinEdit;
|
||||
@ -47,19 +47,10 @@ type
|
||||
radLandscape: TRadioButton;
|
||||
radPortrait: TRadioButton;
|
||||
procedure cbPaperChange(Sender: TObject);
|
||||
procedure panPreviewResize(Sender: TObject);
|
||||
procedure pbPreviewMouseDown(Sender: TObject; Button: TMouseButton;
|
||||
{%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
|
||||
procedure pbPreviewMouseWheelDown(Sender: TObject; {%H-}Shift: TShiftState;
|
||||
{%H-}MousePos: TPoint; var Handled: Boolean);
|
||||
procedure pbPreviewMouseWheelUp(Sender: TObject; {%H-}Shift: TShiftState;
|
||||
{%H-}MousePos: TPoint; var Handled: Boolean);
|
||||
procedure pbPreviewPaint(Sender: TObject);
|
||||
procedure radPortraitClick(Sender: TObject);
|
||||
procedure txtLeftChange(Sender: TObject);
|
||||
private
|
||||
FHeightTallest: Integer;
|
||||
FFactorX, FFactorY, FZoom: Double;
|
||||
function NToInches: double;
|
||||
procedure RotateMargins(AOrder: boolean);
|
||||
public
|
||||
@ -138,36 +129,88 @@ begin
|
||||
end;
|
||||
|
||||
procedure TframePageSetup.pbPreviewPaint(Sender: TObject);
|
||||
const
|
||||
cTopBottomMargin = 8;
|
||||
cPadding = 6;
|
||||
cShadowSize = 4;
|
||||
cDimLineHeight = 12;
|
||||
cDimLineTail = 3;
|
||||
var
|
||||
R: TRect;
|
||||
NLeft, NTop, NRight, NBottom: integer;
|
||||
rc: TRect;
|
||||
txtHeight, fHeight, fWidth, fx, fy, vCenter: Integer;
|
||||
FUnitsStr, str: string;
|
||||
begin
|
||||
if not EnablePreview then
|
||||
exit;
|
||||
|
||||
with pbPreview do
|
||||
if UnitInches then
|
||||
FUnitsStr := p4lrsAbbrevUnitsInches
|
||||
else
|
||||
FUnitsStr := p4lrsAbbrevUnitsMm;
|
||||
|
||||
with pbPreview, Canvas do
|
||||
begin
|
||||
Canvas.Pen.Style := psSolid;
|
||||
Canvas.Pen.Color := clBlack;
|
||||
Canvas.Brush.Color := clWhite;
|
||||
Canvas.Rectangle(0, 0, Width, Height);
|
||||
|
||||
//if EnableMargins then // EnableMargins is for SpinEdits only
|
||||
Pen.Color := clBlack;
|
||||
txtHeight := TextHeight('A');
|
||||
// center
|
||||
vCenter := Height div 2;
|
||||
// adjust center
|
||||
if CurPageHeight > CurPageWidth then;
|
||||
vCenter := vCenter - (txtHeight + cDimLineHeight + cPadding) div 2;
|
||||
// compute height/width
|
||||
fHeight := Height - cTopBottomMargin * 2 - txtHeight - cDimLineHeight - cPadding;
|
||||
if CurPageHeight > CurPageWidth then
|
||||
fWidth := Round(CurPageWidth / CurPageHeight * fHeight)
|
||||
else
|
||||
begin
|
||||
NLeft := Round(txtLeft.Value * NToInches * Printer.XDPI * FFactorX * FZoom);
|
||||
NTop := Round(txtTop.Value * NToInches * Printer.YDPI * FFactorY * FZoom);
|
||||
NRight := Round(txtRight.Value * NToInches * Printer.XDPI * FFactorX * FZoom);
|
||||
NBottom := Round(txtBottom.Value * NToInches * Printer.YDPI * FFactorY * FZoom);
|
||||
|
||||
R.Left := NLeft;
|
||||
R.Top := NTop;
|
||||
R.Right := Width-1-NRight;
|
||||
R.Bottom := Height-1-NBottom;
|
||||
|
||||
Canvas.Pen.Color := clMedGray;
|
||||
//Canvas.Pen.Style := psDash; // AT: setting line style don't work, line is solid
|
||||
Canvas.Rectangle(R);
|
||||
fWidth := fHeight;
|
||||
fHeight := Round(CurPageHeight / CurPageWidth * fWidth);
|
||||
end;
|
||||
// draw paper and shadow
|
||||
fx := (Width - fWidth) div 2;
|
||||
fy := vCenter - (fHeight div 2);
|
||||
Brush.Color := clGrayText;
|
||||
Pen.Style := psClear;
|
||||
rc := Rect(fx, fy, fx + fWidth, fy + fHeight);
|
||||
rc.Offset(cShadowSize, cShadowSize);
|
||||
Rectangle(rc);
|
||||
Brush.Color := clWhite;
|
||||
Pen.Style := psSolid;
|
||||
rc.Offset(-cShadowSize, -cShadowSize);
|
||||
Rectangle(rc);
|
||||
// draw margins
|
||||
rc.Left := rc.Left + Round(txtLeft.Value * fWidth / CurPageWidth);
|
||||
rc.Top := rc.Top + Round(txtTop.Value * fHeight / CurPageHeight);
|
||||
rc.Right := rc.Right - Round(txtRight.Value * fWidth / CurPageWidth);
|
||||
rc.Bottom := rc.Bottom - Round(txtBottom.Value * fHeight / CurPageHeight);
|
||||
Pen.Color := clGray;
|
||||
Pen.Style := psDot;
|
||||
Rectangle(rc);
|
||||
// bottom dimension line
|
||||
Pen.Color := clBlack;
|
||||
Pen.Style := psSolid;
|
||||
fy := fy + fHeight + cPadding + cDimLineHeight div 2;
|
||||
Line(fx, fy, fx + fWidth, fy);
|
||||
Line(fx, fy - cDimLineTail, fx, fy + cDimLineTail + 1);
|
||||
fx := fx + fWidth - 1;
|
||||
Line(fx, fy - cDimLineTail, fx, fy + cDimLineTail + 1);
|
||||
// bottom dimension text
|
||||
Brush.Style := bsClear;
|
||||
str := FormatFloat(',0.00 ', CurPageWidth) + FUnitsStr;
|
||||
fy := fy + cDimLineHeight div 2;
|
||||
TextOut((Width - TextWidth(str)) div 2, fy, str);
|
||||
// left dimension line
|
||||
fy := vCenter - (fHeight div 2);
|
||||
fx := (Width - fWidth) div 2 - cPadding - cDimLineHeight div 2;
|
||||
Line(fx, fy, fx, fy + fHeight);
|
||||
Line(fx - cDimLineTail, fy, fx + cDimLineTail + 1, fy);
|
||||
fy := fy + fHeight - 1;
|
||||
Line(fx - cDimLineTail, fy, fx + cDimLineTail + 1, fy);
|
||||
// left dimension text
|
||||
Brush.Style := bsClear;
|
||||
str := FormatFloat(',0.00 ', CurPageHeight) + FUnitsStr;
|
||||
fy := fy - fHeight div 2 - txtHeight div 2;
|
||||
TextOut(fx - cDimLineHeight div 2 - TextWidth(str), fy, str);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -183,7 +226,7 @@ end;
|
||||
|
||||
procedure TframePageSetup.txtLeftChange(Sender: TObject);
|
||||
begin
|
||||
pbPreview.Update;
|
||||
pbPreview.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TframePageSetup.cbPaperChange(Sender: TObject);
|
||||
@ -197,69 +240,27 @@ begin
|
||||
UpdatePageSize;
|
||||
end;
|
||||
|
||||
procedure TframePageSetup.panPreviewResize(Sender: TObject);
|
||||
var
|
||||
TallH: Integer;
|
||||
begin
|
||||
if not EnablePreview then
|
||||
exit;
|
||||
|
||||
TallH := Round(FheightTallest * FFactorY);
|
||||
|
||||
with PanPreview do
|
||||
if (Height<>C_BOTHSPACES) and (TallH>(Height-C_BOTHSPACES)) then
|
||||
FZoom := (Height-C_BOTHSPACES)/TallH
|
||||
else
|
||||
FZoom := 1.0;
|
||||
end;
|
||||
|
||||
procedure TframePageSetup.pbPreviewMouseDown(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if Button=mbMiddle then
|
||||
begin
|
||||
FZoom := 1;
|
||||
UpdatePageSize;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TframePageSetup.pbPreviewMouseWheelDown(Sender: TObject;
|
||||
Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
|
||||
begin
|
||||
FZoom := FZoom - 0.2;
|
||||
if FZoom<0.5 then
|
||||
FZoom := 0.5;
|
||||
UpdatePageSize;
|
||||
Handled := true;
|
||||
end;
|
||||
|
||||
procedure TframePageSetup.pbPreviewMouseWheelUp(Sender: TObject;
|
||||
Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
|
||||
begin
|
||||
FZoom := FZoom + 0.2;
|
||||
UpdatePageSize;
|
||||
Handled := true;
|
||||
end;
|
||||
|
||||
procedure TframePageSetup.UpdatePageSize;
|
||||
var
|
||||
FLastPageWidth, FLastPageHeight: Double;
|
||||
begin
|
||||
if not EnablePreview then
|
||||
exit;
|
||||
|
||||
with Printer.PaperSize.PaperRect.PhysicalRect do
|
||||
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
|
||||
begin
|
||||
// save last size
|
||||
FLastPageWidth := CurPageWidth;
|
||||
FLastPageHeight := CurPageHeight;
|
||||
CurPageWidth := (PhysicalRect.Right-PhysicalRect.Left)/Printer.XDPI/NToInches;
|
||||
CurPageHeight := (PhysicalRect.Bottom-PhysicalRect.Top)/Printer.YDPI/NToInches;
|
||||
end;
|
||||
// revert to last size if invalid (custom?)
|
||||
if (CurPageWidth <= 0) or (CurPageHeight <= 0) then
|
||||
begin
|
||||
CurPageWidth := FLastPageWidth;
|
||||
CurPageHeight := FLastPageHeight;
|
||||
end;
|
||||
|
||||
UpdateMaxValues;
|
||||
end;
|
||||
@ -286,9 +287,6 @@ end;
|
||||
|
||||
procedure TframePageSetup.Initialize(AEnablePreview, AEnableMargins, AEnablePapers,
|
||||
AEnableOrientation: boolean);
|
||||
var
|
||||
i,j:Integer;
|
||||
R: TPaperRect;
|
||||
begin
|
||||
EnablePreview:= AEnablePreview;
|
||||
EnableMargins:= AEnableMargins;
|
||||
@ -300,20 +298,15 @@ begin
|
||||
cbPaper.ItemIndex := -1;
|
||||
cbSource.ItemIndex := -1;
|
||||
|
||||
if EnablePapers then
|
||||
SetupCupsCombo(cbSource, nil, 'InputSlot');
|
||||
SetupCupsCombo(cbPaper, nil, 'PageSize');
|
||||
if (cbPaper.Items.Count=0) then
|
||||
begin
|
||||
SetupCupsCombo(cbSource, nil, 'InputSlot');
|
||||
SetupCupsCombo(cbPaper, nil, 'PageSize');
|
||||
if (cbPaper.Items.Count=0) then
|
||||
begin
|
||||
// no cups printer papers, use default ones
|
||||
cbPaper.Items := Printer.PaperSize.SupportedPapers;
|
||||
cbPaper.ItemIndex:= cbPaper.Items.IndexOf(Printer.PaperSize.PaperName);
|
||||
end;
|
||||
// no cups printer papers, use default ones
|
||||
cbPaper.Items := Printer.PaperSize.SupportedPapers;
|
||||
cbPaper.ItemIndex:= cbPaper.Items.IndexOf(Printer.PaperSize.PaperName);
|
||||
end;
|
||||
|
||||
cbPaper.Enabled := cbPaper.Items.Count>0;
|
||||
cbSource.Enabled := cbSource.Items.Count>0;
|
||||
cbPaper.Enabled := EnablePapers;
|
||||
|
||||
//TODO: support reverse variants too?
|
||||
gpOrientation.Enabled := EnableOrientation;
|
||||
@ -328,44 +321,7 @@ begin
|
||||
panPreview.Visible:= EnablePreview;
|
||||
|
||||
if EnablePreview then
|
||||
begin
|
||||
// assume 100 pix = 8.5 inch (IOW, letter size width = 100 pixels)
|
||||
with ScreenInfo do
|
||||
begin
|
||||
FFactorX := (100/8.5)/Printer.XDPI;
|
||||
FFactorY := (100/8.5)*(PixelsPerInchY/PixelsPerInchX)/Printer.YDPI;
|
||||
end;
|
||||
|
||||
// find the tallest paper
|
||||
FHeightTallest := 0;
|
||||
j := -1;
|
||||
if cbPaper.Enabled then
|
||||
for i:=0 to cbPaper.Items.Count-1 do
|
||||
begin
|
||||
if Printer.PaperSize.DefaultPapers then
|
||||
R := Printer.PaperSize.PaperRectOf[cbPaper.Items[i]]
|
||||
else
|
||||
R := Printer.PaperSize.PaperRectOf[GetCupsComboKeyValue(cbPaper, i)];
|
||||
with R.PhysicalRect do
|
||||
if FHeightTallest<(Bottom-Top) then
|
||||
begin
|
||||
FHeightTallest := (Bottom-Top);
|
||||
j := i;
|
||||
end;
|
||||
end;
|
||||
|
||||
if j>=0 then
|
||||
begin
|
||||
{$IFDEF DebugCUPS}
|
||||
DebugLn(' Tallest Paper is: %s Height=%d %.2f Inch',
|
||||
[cbPaper.Items[j],FHeightTallest,FHeightTallest/Printer.YDPI]);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
// zoom factor
|
||||
FZoom := 1.0;
|
||||
UpdatePageSize;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TframePageSetup.SetDefaultMinMargins;
|
||||
|
@ -1,30 +1,82 @@
|
||||
/* XPM */
|
||||
static char *printer[]={
|
||||
"16 16 10 1",
|
||||
"# c #000000",
|
||||
"d c #ffffff",
|
||||
"c c #808080",
|
||||
"a c #c0c0c0",
|
||||
"g c #a0a0a4",
|
||||
"b c #585858",
|
||||
"e c #808000",
|
||||
"f c #ffff00",
|
||||
"h c #00ff00",
|
||||
". c None",
|
||||
"................",
|
||||
"......###.......",
|
||||
".....#aaa###....",
|
||||
"....#bbbaaaa###.",
|
||||
"...#cddcbbbaaaa#",
|
||||
"..#cdddd#bcceea#",
|
||||
".#cdddd#bccdfag#",
|
||||
"#daaad#bccdhadb#",
|
||||
"#adddaaacdaadbb#",
|
||||
"#aaaadddaaadbbb#",
|
||||
"#agggaaadddbbbb#",
|
||||
"#agddgggaabbbb#.",
|
||||
"##aaaddgaabbb#..",
|
||||
"..###aagaabb#...",
|
||||
".....###aab#....",
|
||||
"........###....."};
|
||||
|
||||
static char * printer_xpm[] = {
|
||||
"16 16 63 1",
|
||||
" c None",
|
||||
". c #8E8F8B",
|
||||
"+ c #888A85",
|
||||
"@ c #FFFFFF",
|
||||
"# c #E7E8E5",
|
||||
"$ c #ECEDEB",
|
||||
"% c #8E908B",
|
||||
"& c #F2F3F2",
|
||||
"* c #B7B9B5",
|
||||
"= c #F8F8F8",
|
||||
"- c #606462",
|
||||
"; c #454947",
|
||||
"> c #F3F3F1",
|
||||
", c #3C4140",
|
||||
"' c #939796",
|
||||
") c #8F9392",
|
||||
"! c #939695",
|
||||
"~ c #E5E6E2",
|
||||
"{ c #33383A",
|
||||
"] c #727676",
|
||||
"^ c #5A5F5F",
|
||||
"/ c #515656",
|
||||
"( c #505555",
|
||||
"_ c #535858",
|
||||
": c #575C5C",
|
||||
"< c #DDDFDA",
|
||||
"[ c #454B4C",
|
||||
"} c #2E3436",
|
||||
"| c #D5D9D1",
|
||||
"1 c #ACBF88",
|
||||
"2 c #F5F6F5",
|
||||
"3 c #B2B4B0",
|
||||
"4 c #747875",
|
||||
"5 c #6C706D",
|
||||
"6 c #747775",
|
||||
"7 c #4E514E",
|
||||
"8 c #4B4E4B",
|
||||
"9 c #5C615E",
|
||||
"0 c #EBECEB",
|
||||
"a c #F5F5F4",
|
||||
"b c #F4F4F2",
|
||||
"c c #F2F3F1",
|
||||
"d c #F1F2F0",
|
||||
"e c #F1F1EF",
|
||||
"f c #F0F0EE",
|
||||
"g c #EFF0ED",
|
||||
"h c #EEEFEC",
|
||||
"i c #E4E6E3",
|
||||
"j c #3D4242",
|
||||
"k c #3B4040",
|
||||
"l c #494D4D",
|
||||
"m c #EFEFED",
|
||||
"n c #EDEEEB",
|
||||
"o c #EBECE9",
|
||||
"p c #E9EAE8",
|
||||
"q c #E8E9E6",
|
||||
"r c #E7E8E4",
|
||||
"s c #E5E7E2",
|
||||
"t c #E3E5E1",
|
||||
"u c #E2E4DF",
|
||||
"v c #E0E3DE",
|
||||
"w c #3D4241",
|
||||
"x c #363C3D",
|
||||
" ",
|
||||
" .++++++. ",
|
||||
" +@@@@@@+ ",
|
||||
" +@####@+ ",
|
||||
" +@$$$$@+ ",
|
||||
" %++@&&&&@++% ",
|
||||
" *=-;;;;;;;;-=* ",
|
||||
".=>,'''))!'',>=.",
|
||||
"+@~{]^/(((_:{~@+",
|
||||
"+@<[}}}}}}}}[<@+",
|
||||
"+@|||||||||||1@+",
|
||||
"+23455555555632+",
|
||||
"7890abcdefghi987",
|
||||
"jklmnopqrstuvlkw",
|
||||
" xxxxxxxxxxxx ",
|
||||
" "};
|
||||
|
@ -1,36 +1,104 @@
|
||||
/* XPM */
|
||||
static char *printer_remote[]={
|
||||
"16 16 17 1",
|
||||
"b c #808080",
|
||||
"k c #e1e1e1",
|
||||
". c None",
|
||||
"l c #a0a0a0",
|
||||
"a c #c3c3c3",
|
||||
"j c #e6e6e6",
|
||||
"m c #00ff00",
|
||||
"f c #808000",
|
||||
"i c #e3e3e3",
|
||||
"# c #000000",
|
||||
"g c #c0ffc0",
|
||||
"h c #ffff00",
|
||||
"o c #eaeaea",
|
||||
"n c #f2f2f2",
|
||||
"d c #585858",
|
||||
"c c #dcdcdc",
|
||||
"e c #ffffff",
|
||||
".......##.......",
|
||||
"......#aa##.....",
|
||||
".....#bcdaa##...",
|
||||
"....#bec#dbfa#..",
|
||||
"...#bec#dbghc#..",
|
||||
"..#ijklllcmcd#..",
|
||||
"..#aaannlccdd#..",
|
||||
"..#cllaanoddd#..",
|
||||
"..##cclladdd#...",
|
||||
"....##cladd#....",
|
||||
".....###ad#.....",
|
||||
".....l#.##......",
|
||||
".....l#.........",
|
||||
"llllfff#llllllll",
|
||||
"####hef#########",
|
||||
"....####........"};
|
||||
static char * printer_remote_xpm[] = {
|
||||
"16 16 85 1",
|
||||
" c None",
|
||||
". c #8E8F8B",
|
||||
"+ c #888A85",
|
||||
"@ c #FFFFFF",
|
||||
"# c #E7E8E5",
|
||||
"$ c #8E908B",
|
||||
"% c #ECEDEB",
|
||||
"& c #B7B9B5",
|
||||
"* c #F8F8F8",
|
||||
"= c #606462",
|
||||
"- c #454947",
|
||||
"; c #F3F3F1",
|
||||
"> c #3C4140",
|
||||
", c #939796",
|
||||
"' c #8F9392",
|
||||
") c #939695",
|
||||
"! c #E5E6E2",
|
||||
"~ c #33383A",
|
||||
"{ c #727676",
|
||||
"] c #5A5F5F",
|
||||
"^ c #515656",
|
||||
"/ c #505555",
|
||||
"( c #535858",
|
||||
"_ c #575C5C",
|
||||
": c #DDDFDA",
|
||||
"< c #454B4C",
|
||||
"[ c #2E3436",
|
||||
"} c #D5D9D1",
|
||||
"| c #ACBF88",
|
||||
"1 c #F5F6F5",
|
||||
"2 c #B2B4B0",
|
||||
"3 c #747875",
|
||||
"4 c #6C706D",
|
||||
"5 c #747775",
|
||||
"6 c #4E514E",
|
||||
"7 c #4B4E4B",
|
||||
"8 c #5C615E",
|
||||
"9 c #EBECEB",
|
||||
"0 c #F5F5F4",
|
||||
"a c #F4F4F2",
|
||||
"b c #F2F3F1",
|
||||
"c c #F1F2F0",
|
||||
"d c #F1F1EF",
|
||||
"e c #F0F0EE",
|
||||
"f c #EFF0ED",
|
||||
"g c #EEEFEC",
|
||||
"h c #E4E6E3",
|
||||
"i c #3D4242",
|
||||
"j c #3B4040",
|
||||
"k c #494D4D",
|
||||
"l c #EFEFED",
|
||||
"m c #EDEEEB",
|
||||
"n c #EBECE9",
|
||||
"o c #DFE0DE",
|
||||
"p c #DEDFDC",
|
||||
"q c #DDDEDA",
|
||||
"r c #DBDDD8",
|
||||
"s c #E2E4E0",
|
||||
"t c #E2E4DF",
|
||||
"u c #E0E3DE",
|
||||
"v c #3D4241",
|
||||
"w c #363C3D",
|
||||
"x c #353B3C",
|
||||
"y c #4C4E4D",
|
||||
"z c #585A56",
|
||||
"A c #555753",
|
||||
"B c #4C504D",
|
||||
"C c #464646",
|
||||
"D c #474747",
|
||||
"E c #494949",
|
||||
"F c #5A5C58",
|
||||
"G c #D7D7D7",
|
||||
"H c #D6D6D6",
|
||||
"I c #D3D3D3",
|
||||
"J c #595B57",
|
||||
"K c #D9D9D9",
|
||||
"L c #D5D5D5",
|
||||
"M c #575955",
|
||||
"N c #9F9F9F",
|
||||
"O c #A1A1A0",
|
||||
"P c #9D9E9D",
|
||||
"Q c #D0D0D0",
|
||||
"R c #515350",
|
||||
"S c #565854",
|
||||
"T c #535451",
|
||||
" .++++++. ",
|
||||
" +@@@@@@+ ",
|
||||
" +@####@+ ",
|
||||
" $++@%%%%@++$ ",
|
||||
" &*=--------=*& ",
|
||||
".*;>,,,''),,>;*.",
|
||||
"+@!~{]^///(_~!@+",
|
||||
"+@:<[[[[[[[[<:@+",
|
||||
"+@}}}}}}}}}}}|@+",
|
||||
"+12344444444521+",
|
||||
"67890abcdefgh876",
|
||||
"ijklmnopqrstukjv",
|
||||
" wwxyzAAABwww ",
|
||||
" CDDEF9GHIJDDDD ",
|
||||
" KKKLMNOOPzQKKK ",
|
||||
" CDDDRSSSSTDDDD "};
|
||||
|
@ -1,38 +1,130 @@
|
||||
/* XPM */
|
||||
static char *printer_remote_stopped[]={
|
||||
"16 16 19 1",
|
||||
"b c #808080",
|
||||
"k c #e1e1e1",
|
||||
". c None",
|
||||
"l c #a0a0a0",
|
||||
"a c #c3c3c3",
|
||||
"j c #e6e6e6",
|
||||
"m c #00ff00",
|
||||
"f c #808000",
|
||||
"i c #e3e3e3",
|
||||
"# c #000000",
|
||||
"g c #c0ffc0",
|
||||
"h c #ffff00",
|
||||
"p c #eaeaea",
|
||||
"n c #f2f2f2",
|
||||
"q c #c00000",
|
||||
"d c #585858",
|
||||
"c c #dcdcdc",
|
||||
"e c #ffffff",
|
||||
"o c #ff0000",
|
||||
".......##.......",
|
||||
"......#aa##.....",
|
||||
".....#bcdaa##...",
|
||||
"....#bec#dbfa#..",
|
||||
"...#bec#dbghc#..",
|
||||
"..#ijklllcmcd#..",
|
||||
"..#ddddnlccdd#..",
|
||||
"..doooo#npddd#..",
|
||||
".doqecqq#ddd#...",
|
||||
"doqqecqqq#d#....",
|
||||
"doqqeeqqq##.....",
|
||||
"doqqecqqq#......",
|
||||
"doqqqqqqq#......",
|
||||
"ldqqeeqq#lllllll",
|
||||
"##dqqqq#########",
|
||||
"...ddd##........"};
|
||||
static char * printer_remote_stopped_xpm[] = {
|
||||
"16 16 111 2",
|
||||
" c None",
|
||||
". c #8E8F8B",
|
||||
"+ c #888A85",
|
||||
"@ c #FFFFFF",
|
||||
"# c #E7E8E5",
|
||||
"$ c #8E908B",
|
||||
"% c #ECEDEB",
|
||||
"& c #B7B9B5",
|
||||
"* c #F8F8F8",
|
||||
"= c #606462",
|
||||
"- c #454947",
|
||||
"; c #F3F3F1",
|
||||
"> c #3C4140",
|
||||
", c #939796",
|
||||
"' c #8F9392",
|
||||
") c #939695",
|
||||
"! c #E5E6E2",
|
||||
"~ c #33383A",
|
||||
"{ c #727676",
|
||||
"] c #5A5F5F",
|
||||
"^ c #515656",
|
||||
"/ c #505555",
|
||||
"( c #535858",
|
||||
"_ c #575C5C",
|
||||
": c #DDDFDA",
|
||||
"< c #454B4C",
|
||||
"[ c #2E3436",
|
||||
"} c #333436",
|
||||
"| c #7B2425",
|
||||
"1 c #9D0E0F",
|
||||
"2 c #A30202",
|
||||
"3 c #9E1718",
|
||||
"4 c #C4A4A1",
|
||||
"5 c #FEFDFD",
|
||||
"6 c #D5D9D1",
|
||||
"7 c #D4D7D0",
|
||||
"8 c #B16763",
|
||||
"9 c #B31F1F",
|
||||
"0 c #D55151",
|
||||
"a c #DE6A6A",
|
||||
"b c #B82525",
|
||||
"c c #BC7A7A",
|
||||
"d c #888984",
|
||||
"e c #F5F6F5",
|
||||
"f c #B2B4B0",
|
||||
"g c #747875",
|
||||
"h c #6C706D",
|
||||
"i c #793736",
|
||||
"j c #B21D1D",
|
||||
"k c #E06A6A",
|
||||
"l c #DB4E4E",
|
||||
"m c #FAE8E8",
|
||||
"n c #D22222",
|
||||
"o c #D94545",
|
||||
"p c #AE1212",
|
||||
"q c #7E4340",
|
||||
"r c #4E514E",
|
||||
"s c #4B4E4B",
|
||||
"t c #5C615E",
|
||||
"u c #EBECEB",
|
||||
"v c #F5F5F4",
|
||||
"w c #F4F4F2",
|
||||
"x c #F2F3F1",
|
||||
"y c #AB1B1A",
|
||||
"z c #D44E4E",
|
||||
"A c #D63333",
|
||||
"B c #FCF1F1",
|
||||
"C c #A21110",
|
||||
"D c #3D4242",
|
||||
"E c #3B4040",
|
||||
"F c #494D4D",
|
||||
"G c #EFEFED",
|
||||
"H c #EDEEEB",
|
||||
"I c #EBECE9",
|
||||
"J c #DFE0DE",
|
||||
"K c #A30101",
|
||||
"L c #DB5A5A",
|
||||
"M c #D73B3B",
|
||||
"N c #FCF2F2",
|
||||
"O c #D84F4F",
|
||||
"P c #363C3D",
|
||||
"Q c #353B3C",
|
||||
"R c #4C4E4D",
|
||||
"S c #585A56",
|
||||
"T c #AF1E1E",
|
||||
"U c #CD3030",
|
||||
"V c #9B0909",
|
||||
"W c #464646",
|
||||
"X c #474747",
|
||||
"Y c #494949",
|
||||
"Z c #5A5C58",
|
||||
"` c #936767",
|
||||
" . c #FAECEC",
|
||||
".. c #D22525",
|
||||
"+. c #7A1C1C",
|
||||
"@. c #D9D9D9",
|
||||
"#. c #D5D5D5",
|
||||
"$. c #575955",
|
||||
"%. c #9F9F9F",
|
||||
"&. c #A1A09F",
|
||||
"*. c #A54B4A",
|
||||
"=. c #D74747",
|
||||
"-. c #B16767",
|
||||
";. c #515350",
|
||||
">. c #565854",
|
||||
",. c #585753",
|
||||
"'. c #853F3C",
|
||||
"). c #A01817",
|
||||
"!. c #A10F0F",
|
||||
"~. c #8C2A2A",
|
||||
"{. c #4C4646",
|
||||
" . + + + + + + . ",
|
||||
" + @ @ @ @ @ @ + ",
|
||||
" + @ # # # # @ + ",
|
||||
" $ + + @ % % % % @ + + $ ",
|
||||
" & * = - - - - - - - - = * & ",
|
||||
". * ; > , , , ' ' ) , , > ; * . ",
|
||||
"+ @ ! ~ { ] ^ / / / ( _ ~ ! @ + ",
|
||||
"+ @ : < [ [ [ [ } | 1 2 3 4 5 + ",
|
||||
"+ @ 6 6 6 6 6 7 8 9 0 a 0 b c d ",
|
||||
"+ e f g h h h i j k l m n o p q ",
|
||||
"r s t u v w x y z l A B A n z C ",
|
||||
"D E F G H I J K L M A N A A O 2 ",
|
||||
" P P Q R S T U l A A A n U V ",
|
||||
" W X X Y Z u ` p k l ...o p +.",
|
||||
" @.@.@.#.$.%.&.*.p U =.U p -. ",
|
||||
" W X X X ;.>.>.,.'.).2 !.~.{. "};
|
||||
|
@ -1,32 +1,111 @@
|
||||
/* XPM */
|
||||
static char *printer_stopped[]={
|
||||
"16 16 13 1",
|
||||
"c c #808080",
|
||||
". c None",
|
||||
"i c #00ff00",
|
||||
"a c #c0c0c0",
|
||||
"e c #808000",
|
||||
"# c #000000",
|
||||
"f c #ffff00",
|
||||
"j c #c00000",
|
||||
"b c #585858",
|
||||
"g c #a0a0a4",
|
||||
"k c #dcdcdc",
|
||||
"d c #ffffff",
|
||||
"h c #ff0000",
|
||||
"................",
|
||||
"......###.......",
|
||||
".....#aaa###....",
|
||||
"....#bbbaaaa###.",
|
||||
"...#cddcbbbaaaa#",
|
||||
"..#cdddd#bcceea#",
|
||||
".#cbbbb#bccdfag#",
|
||||
"#dbhhhh#ccdiadb#",
|
||||
"#bhjdkjj#daadbb#",
|
||||
"bhjjdkjjj#adbbb#",
|
||||
"bhjjddjjj#dbbbb#",
|
||||
"bhjjdkjjj#bbbb#.",
|
||||
"bhjjjjjjj#bbb#..",
|
||||
".bjjddjj#abb#...",
|
||||
"..bjjjj#aab#....",
|
||||
"...bbb#.###....."};
|
||||
static char * printer_stopped_xpm[] = {
|
||||
"16 16 92 2",
|
||||
" c None",
|
||||
". c #8E8F8B",
|
||||
"+ c #888A85",
|
||||
"@ c #FFFFFF",
|
||||
"# c #E7E8E5",
|
||||
"$ c #ECEDEB",
|
||||
"% c #8E908B",
|
||||
"& c #F2F3F2",
|
||||
"* c #B7B9B5",
|
||||
"= c #F8F8F8",
|
||||
"- c #606462",
|
||||
"; c #454947",
|
||||
"> c #F3F3F1",
|
||||
", c #3C4140",
|
||||
"' c #939796",
|
||||
") c #8F9392",
|
||||
"! c #8F908F",
|
||||
"~ c #9B4B4B",
|
||||
"{ c #A31212",
|
||||
"] c #A30202",
|
||||
"^ c #980808",
|
||||
"/ c #CC7A79",
|
||||
"( c #F6F4F4",
|
||||
"_ c #E5E6E2",
|
||||
": c #33383A",
|
||||
"< c #727676",
|
||||
"[ c #5A5F5F",
|
||||
"} c #515656",
|
||||
"| c #515353",
|
||||
"1 c #951010",
|
||||
"2 c #B31F1F",
|
||||
"3 c #D55151",
|
||||
"4 c #DE6A6A",
|
||||
"5 c #B82525",
|
||||
"6 c #B73232",
|
||||
"7 c #888782",
|
||||
"8 c #DDDFDA",
|
||||
"9 c #454B4C",
|
||||
"0 c #2E3436",
|
||||
"a c #681A1B",
|
||||
"b c #B21D1D",
|
||||
"c c #E06A6A",
|
||||
"d c #DB4E4E",
|
||||
"e c #FAE8E8",
|
||||
"f c #D22222",
|
||||
"g c #D94545",
|
||||
"h c #B92424",
|
||||
"i c #964543",
|
||||
"j c #D5D9D1",
|
||||
"k c #AB1B1A",
|
||||
"l c #D44E4E",
|
||||
"m c #D63333",
|
||||
"n c #FCF1F1",
|
||||
"o c #A21110",
|
||||
"p c #F5F6F5",
|
||||
"q c #B2B4B0",
|
||||
"r c #747875",
|
||||
"s c #6C706D",
|
||||
"t c #A30101",
|
||||
"u c #DB5A5A",
|
||||
"v c #D73B3B",
|
||||
"w c #FCF2F2",
|
||||
"x c #D84F4F",
|
||||
"y c #4E514E",
|
||||
"z c #4B4E4B",
|
||||
"A c #5C615E",
|
||||
"B c #EBECEB",
|
||||
"C c #F5F5F4",
|
||||
"D c #F4F4F2",
|
||||
"E c #F2F3F1",
|
||||
"F c #AF1E1E",
|
||||
"G c #CD3030",
|
||||
"H c #9B0909",
|
||||
"I c #3D4242",
|
||||
"J c #3B4040",
|
||||
"K c #494D4D",
|
||||
"L c #EFEFED",
|
||||
"M c #EDEEEB",
|
||||
"N c #EBECE9",
|
||||
"O c #E9EAE8",
|
||||
"P c #C67574",
|
||||
"Q c #B41818",
|
||||
"R c #FAECEC",
|
||||
"S c #D22525",
|
||||
"T c #AE1212",
|
||||
"U c #7C1919",
|
||||
"V c #363C3D",
|
||||
"W c #373B3C",
|
||||
"X c #900B0B",
|
||||
"Y c #D74747",
|
||||
"Z c #A60000",
|
||||
"` c #A40000",
|
||||
" ",
|
||||
" . + + + + + + . ",
|
||||
" + @ @ @ @ @ @ + ",
|
||||
" + @ # # # # @ + ",
|
||||
" + @ $ $ $ $ @ + ",
|
||||
" % + + @ & & & & @ + + % ",
|
||||
" * = - ; ; ; ; ; ; ; ; - = * ",
|
||||
". = > , ' ' ' ) ! ~ { ] ^ / ( . ",
|
||||
"+ @ _ : < [ } | 1 2 3 4 3 5 6 7 ",
|
||||
"+ @ 8 9 0 0 0 a b c d e f g h i ",
|
||||
"+ @ j j j j j k l d m n m f l o ",
|
||||
"+ p q r s s s t u v m w m m x ] ",
|
||||
"y z A B C D E F G d m m m f G H ",
|
||||
"I J K L M N O P Q c d R S g T U ",
|
||||
" V V V V V W X T G Y G T Z ",
|
||||
" Z ` Z "};
|
||||
|
@ -1,133 +1,158 @@
|
||||
object dlgPageSetup: TdlgPageSetup
|
||||
Left = 411
|
||||
Height = 449
|
||||
Top = 113
|
||||
Width = 446
|
||||
ActiveControl = frmPageSetup.panPreview
|
||||
Left = 323
|
||||
Height = 514
|
||||
Top = 135
|
||||
Width = 447
|
||||
ActiveControl = frmPageSetup.cbPaper
|
||||
AutoSize = True
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'dlgPageSetup'
|
||||
ClientHeight = 449
|
||||
ClientWidth = 446
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 4
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 514
|
||||
ClientWidth = 447
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.9.0.0'
|
||||
LCLVersion = '2.1.0.0'
|
||||
inline frmPageSetup: TframePageSetup
|
||||
Height = 408
|
||||
Width = 446
|
||||
Align = alClient
|
||||
ClientHeight = 408
|
||||
ClientWidth = 446
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 8
|
||||
Height = 460
|
||||
Top = 4
|
||||
Width = 430
|
||||
ClientHeight = 460
|
||||
ClientWidth = 430
|
||||
DesignLeft = 388
|
||||
DesignTop = 96
|
||||
inherited panSetup: TPanel
|
||||
Top = 197
|
||||
Width = 446
|
||||
ClientWidth = 446
|
||||
Top = 242
|
||||
Width = 430
|
||||
ClientWidth = 430
|
||||
TabOrder = 1
|
||||
inherited gpPaper: TGroupBox
|
||||
Width = 434
|
||||
ClientWidth = 430
|
||||
Width = 430
|
||||
ClientWidth = 428
|
||||
inherited cbPaper: TComboBox
|
||||
Width = 345
|
||||
Width = 330
|
||||
end
|
||||
inherited cbSource: TComboBox
|
||||
Width = 345
|
||||
Width = 330
|
||||
end
|
||||
end
|
||||
inherited gpMargins: TGroupBox
|
||||
Width = 308
|
||||
ClientWidth = 304
|
||||
Width = 309
|
||||
ClientWidth = 307
|
||||
inherited panMargins: TPanel
|
||||
Width = 304
|
||||
ClientWidth = 304
|
||||
Width = 307
|
||||
ClientWidth = 307
|
||||
inherited lblBottom: TLabel
|
||||
Left = 157
|
||||
end
|
||||
inherited lblRight: TLabel
|
||||
Left = 157
|
||||
end
|
||||
inherited txtLeft: TFloatSpinEdit
|
||||
Left = 78
|
||||
end
|
||||
inherited txtRight: TFloatSpinEdit
|
||||
Left = 225
|
||||
Left = 226
|
||||
end
|
||||
inherited txtTop: TFloatSpinEdit
|
||||
Left = 78
|
||||
end
|
||||
inherited txtBottom: TFloatSpinEdit
|
||||
Left = 225
|
||||
Left = 226
|
||||
end
|
||||
inherited Label1: TLabel
|
||||
Left = 153
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
inherited panPreview: TPanel
|
||||
AnchorSideTop.Control = nil
|
||||
Height = 197
|
||||
Width = 446
|
||||
ClientHeight = 197
|
||||
ClientWidth = 446
|
||||
Height = 242
|
||||
Width = 430
|
||||
ClientHeight = 242
|
||||
ClientWidth = 430
|
||||
Constraints.MinHeight = 0
|
||||
TabOrder = 0
|
||||
inherited boxShadow: TShape
|
||||
Left = 179
|
||||
Top = 39
|
||||
end
|
||||
inherited pbPreview: TPaintBox
|
||||
Left = 173
|
||||
Top = 33
|
||||
Height = 242
|
||||
Width = 430
|
||||
end
|
||||
end
|
||||
end
|
||||
object PanelButtons: TPanel
|
||||
Left = 0
|
||||
Height = 41
|
||||
Top = 408
|
||||
Width = 446
|
||||
Align = alBottom
|
||||
Anchors = [akLeft, akBottom]
|
||||
AnchorSideLeft.Control = frmPageSetup
|
||||
AnchorSideTop.Control = frmPageSetup
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = frmPageSetup
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 36
|
||||
Top = 470
|
||||
Width = 430
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Bottom = 8
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 41
|
||||
ClientWidth = 446
|
||||
ChildSizing.HorizontalSpacing = 6
|
||||
ClientHeight = 36
|
||||
ClientWidth = 430
|
||||
FullRepaint = False
|
||||
TabOrder = 1
|
||||
TabStop = True
|
||||
object btnCancel: TButton
|
||||
AnchorSideTop.Control = btnPrinter
|
||||
AnchorSideTop.Control = btnOk
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = btnPrinter
|
||||
Left = 254
|
||||
Height = 26
|
||||
Top = 7
|
||||
Width = 90
|
||||
AnchorSideRight.Control = btnOk
|
||||
Left = 274
|
||||
Height = 35
|
||||
Top = 1
|
||||
Width = 75
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 6
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
Constraints.MinWidth = 90
|
||||
Constraints.MinWidth = 75
|
||||
ModalResult = 2
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnOk: TButton
|
||||
AnchorSideTop.Control = btnPrinter
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = btnCancel
|
||||
Left = 158
|
||||
Height = 26
|
||||
Top = 7
|
||||
Width = 90
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'OK'
|
||||
Constraints.MinWidth = 90
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 0
|
||||
end
|
||||
object btnPrinter: TButton
|
||||
AnchorSideTop.Control = PanelButtons
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = PanelButtons
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 350
|
||||
Height = 26
|
||||
Top = 7
|
||||
Width = 90
|
||||
Left = 355
|
||||
Height = 35
|
||||
Top = 1
|
||||
Width = 75
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 6
|
||||
Caption = 'Printer...'
|
||||
Constraints.MinWidth = 90
|
||||
OnClick = btnPrinterClick
|
||||
Caption = 'OK'
|
||||
Constraints.MinWidth = 75
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 2
|
||||
end
|
||||
object btnPrinter: TButton
|
||||
AnchorSideLeft.Control = PanelButtons
|
||||
AnchorSideTop.Control = PanelButtons
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 35
|
||||
Top = 1
|
||||
Width = 75
|
||||
AutoSize = True
|
||||
Caption = 'Printer...'
|
||||
Constraints.MinWidth = 75
|
||||
OnClick = btnPrinterClick
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -14,7 +14,7 @@ interface
|
||||
|
||||
uses
|
||||
// LCL
|
||||
Classes, Forms, ExtCtrls, StdCtrls, Menus,
|
||||
Classes, Forms, ExtCtrls, StdCtrls, Menus, Controls,
|
||||
// Printers
|
||||
Printers, framePageSetup;
|
||||
|
||||
@ -29,8 +29,14 @@ type
|
||||
frmPageSetup: TframePageSetup;
|
||||
PanelButtons: TPanel;
|
||||
procedure btnPrinterClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
FMenu: TPopupMenu;
|
||||
FSavedPaperName: string;
|
||||
FSavedOrientation: TPrinterOrientation;
|
||||
FSavedPrinterIndex: Integer;
|
||||
procedure MenuPrinterClick(Sender: TObject);
|
||||
public
|
||||
procedure SetControls(AEnablePreview, AEnableMargins, AEnablePapers,
|
||||
@ -71,6 +77,38 @@ begin
|
||||
FMenu.PopUp(pnt.X, pnt.Y);
|
||||
end;
|
||||
|
||||
procedure TDlgPageSetup.FormClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
begin
|
||||
if ModalResult = mrCancel then
|
||||
begin
|
||||
Printer.PaperSize.PaperName := FSavedPaperName;
|
||||
Printer.Orientation := FSavedOrientation;
|
||||
Printer.PrinterIndex := FSavedPrinterIndex;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TDlgPageSetup.FormCreate(Sender: TObject);
|
||||
begin
|
||||
// Save selected printer and paper, to be restore if dialog is cancelled
|
||||
FSavedPaperName := Printer.PaperSize.PaperName;
|
||||
FSavedOrientation := Printer.Orientation;
|
||||
FSavedPrinterIndex := Printer.PrinterIndex;
|
||||
AutoSize := False;
|
||||
AutoSize := True;
|
||||
end;
|
||||
|
||||
procedure TDlgPageSetup.FormShow(Sender: TObject);
|
||||
begin
|
||||
// adjust height for themes
|
||||
with frmPageSetup do
|
||||
if not EnablePreview then
|
||||
Height := panSetup.Height
|
||||
else
|
||||
Height := panSetup.Height + panPreview.Height;
|
||||
MoveToDefaultPosition;
|
||||
end;
|
||||
|
||||
procedure TDlgPageSetup.MenuPrinterClick(Sender: TObject);
|
||||
begin
|
||||
if Sender is TMenuItem then
|
||||
@ -90,6 +128,11 @@ procedure TDlgPageSetup.SetControls(AEnablePreview, AEnableMargins, AEnablePaper
|
||||
AEnableOrientation: boolean);
|
||||
begin
|
||||
frmPageSetup.Initialize(AEnablePreview, AEnableMargins, AEnablePapers, AEnableOrientation);
|
||||
{ with frmPageSetup do
|
||||
if not EnablePreview then
|
||||
Height := panSetup.Height
|
||||
else
|
||||
Height := panSetup.Height + panPreview.Height;}
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -1,40 +1,53 @@
|
||||
object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
Left = 363
|
||||
Height = 468
|
||||
Top = 180
|
||||
Width = 457
|
||||
ActiveControl = Notebook1
|
||||
Left = 334
|
||||
Height = 502
|
||||
Top = 134
|
||||
Width = 461
|
||||
AutoSize = True
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'dlgpropertiesprinter'
|
||||
ClientHeight = 468
|
||||
ClientWidth = 457
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.HorizontalSpacing = 4
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 502
|
||||
ClientWidth = 461
|
||||
OnActivate = FormActivate
|
||||
OnCreate = dlgpropertiesprinterCREATE
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = dlgpropertiesprinterSHOW
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.9.0.0'
|
||||
LCLVersion = '2.1.0.0'
|
||||
object Notebook1: TPageControl
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 427
|
||||
Top = 0
|
||||
Width = 457
|
||||
Left = 8
|
||||
Height = 446
|
||||
Top = 6
|
||||
Width = 444
|
||||
TabStop = False
|
||||
ActivePage = pgGeneral
|
||||
Align = alClient
|
||||
TabIndex = 0
|
||||
TabOrder = 0
|
||||
Options = [nboKeyboardTabSwitch]
|
||||
object pgGeneral: TTabSheet
|
||||
Caption = 'General'
|
||||
ClientHeight = 396
|
||||
ClientWidth = 453
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 8
|
||||
ChildSizing.HorizontalSpacing = 8
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 413
|
||||
ClientWidth = 434
|
||||
object labPaperSize: TLabel
|
||||
AnchorSideLeft.Control = pgGeneral
|
||||
AnchorSideTop.Control = cbPaperSize
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 13
|
||||
Width = 69
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 16
|
||||
Width = 68
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Paper size'
|
||||
ParentColor = False
|
||||
@ -43,10 +56,10 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
AnchorSideLeft.Control = labPaperSize
|
||||
AnchorSideTop.Control = cbPaperType
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 50
|
||||
Width = 73
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 57
|
||||
Width = 70
|
||||
Caption = 'Paper type'
|
||||
ParentColor = False
|
||||
end
|
||||
@ -54,10 +67,10 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
AnchorSideLeft.Control = labPaperSize
|
||||
AnchorSideTop.Control = cbPaperSrc
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 87
|
||||
Width = 88
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 98
|
||||
Width = 86
|
||||
Caption = 'Paper source'
|
||||
ParentColor = False
|
||||
end
|
||||
@ -65,23 +78,20 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
AnchorSideLeft.Control = labPaperSize
|
||||
AnchorSideTop.Control = cbResolution
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 124
|
||||
Width = 72
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 139
|
||||
Width = 69
|
||||
Caption = 'Resolution'
|
||||
ParentColor = False
|
||||
end
|
||||
object cbPaperSize: TComboBox
|
||||
AnchorSideTop.Control = pgGeneral
|
||||
AnchorSideRight.Control = pgGeneral
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 172
|
||||
Height = 31
|
||||
Top = 6
|
||||
Width = 275
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
Left = 142
|
||||
Height = 35
|
||||
Top = 8
|
||||
Width = 284
|
||||
DropDownCount = 10
|
||||
ItemHeight = 0
|
||||
OnKeyPress = cbPaperSizeKEYPRESS
|
||||
@ -94,12 +104,11 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = cbPaperSize
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 172
|
||||
Height = 31
|
||||
Top = 43
|
||||
Width = 275
|
||||
Left = 142
|
||||
Height = 35
|
||||
Top = 49
|
||||
Width = 284
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 0
|
||||
OnKeyPress = cbPaperSizeKEYPRESS
|
||||
Style = csDropDownList
|
||||
@ -111,37 +120,52 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = cbPaperSize
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 172
|
||||
Height = 31
|
||||
Top = 80
|
||||
Width = 275
|
||||
Left = 142
|
||||
Height = 35
|
||||
Top = 90
|
||||
Width = 284
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 0
|
||||
OnKeyPress = cbPaperSizeKEYPRESS
|
||||
Style = csDropDownList
|
||||
TabOrder = 2
|
||||
end
|
||||
object gbOrientation: TGroupBox
|
||||
Left = 13
|
||||
Height = 119
|
||||
Top = 162
|
||||
Width = 233
|
||||
AnchorSideLeft.Control = pgGeneral
|
||||
AnchorSideTop.Control = cbResolution
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Label1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 120
|
||||
Top = 172
|
||||
Width = 232
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
Caption = ' Orientation '
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ClientHeight = 100
|
||||
ClientWidth = 229
|
||||
ClientWidth = 230
|
||||
TabOrder = 4
|
||||
object imgOrientation: TImage
|
||||
Left = 167
|
||||
AnchorSideLeft.Control = rbrev_Landscape
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = gbOrientation
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 170
|
||||
Height = 48
|
||||
Top = 25
|
||||
Top = 26
|
||||
Width = 52
|
||||
BorderSpacing.Left = 14
|
||||
end
|
||||
object rbPortrait: TRadioButton
|
||||
Left = 7
|
||||
Height = 24
|
||||
Top = 5
|
||||
Width = 80
|
||||
AnchorSideLeft.Control = gbOrientation
|
||||
AnchorSideTop.Control = gbOrientation
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 2
|
||||
Width = 77
|
||||
Caption = 'Portrait'
|
||||
Checked = True
|
||||
DragCursor = crDefault
|
||||
@ -150,30 +174,40 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
TabStop = True
|
||||
end
|
||||
object rbLandscape: TRadioButton
|
||||
Left = 7
|
||||
Height = 24
|
||||
Top = 29
|
||||
Width = 98
|
||||
AnchorSideLeft.Control = gbOrientation
|
||||
AnchorSideTop.Control = rbPortrait
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 25
|
||||
Width = 95
|
||||
Caption = 'Landscape'
|
||||
DragCursor = crDefault
|
||||
OnClick = rbPortraitCLICK
|
||||
TabOrder = 1
|
||||
end
|
||||
object rbrev_Landscape: TRadioButton
|
||||
Left = 7
|
||||
Height = 24
|
||||
Top = 53
|
||||
Width = 150
|
||||
AnchorSideLeft.Control = gbOrientation
|
||||
AnchorSideTop.Control = rbLandscape
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 48
|
||||
Width = 148
|
||||
Caption = 'Reverse landscape'
|
||||
DragCursor = crDefault
|
||||
OnClick = rbPortraitCLICK
|
||||
TabOrder = 2
|
||||
end
|
||||
object rbrev_portrait: TRadioButton
|
||||
Left = 7
|
||||
Height = 24
|
||||
Top = 77
|
||||
Width = 136
|
||||
AnchorSideLeft.Control = gbOrientation
|
||||
AnchorSideTop.Control = rbrev_Landscape
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 71
|
||||
Width = 132
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'Reverse portrait'
|
||||
DragCursor = crDefault
|
||||
OnClick = rbPortraitCLICK
|
||||
@ -181,23 +215,32 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
end
|
||||
end
|
||||
object gbBanners: TGroupBox
|
||||
Left = 13
|
||||
Height = 96
|
||||
Top = 290
|
||||
Width = 427
|
||||
AnchorSideLeft.Control = pgGeneral
|
||||
AnchorSideTop.Control = gbOrientation
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = gbPagesSheet
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 106
|
||||
Top = 298
|
||||
Width = 418
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
Caption = ' Banners '
|
||||
ClientHeight = 77
|
||||
ClientWidth = 423
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 86
|
||||
ClientWidth = 416
|
||||
TabOrder = 6
|
||||
object labBanStart: TLabel
|
||||
AnchorSideLeft.Control = gbBanners
|
||||
AnchorSideTop.Control = cbBanStart
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 13
|
||||
Width = 34
|
||||
BorderSpacing.Left = 6
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 10
|
||||
Width = 32
|
||||
Caption = 'Start'
|
||||
ParentColor = False
|
||||
end
|
||||
@ -205,9 +248,9 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
AnchorSideLeft.Control = labBanStart
|
||||
AnchorSideTop.Control = cbBanEnd
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 50
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 51
|
||||
Width = 25
|
||||
Caption = 'End'
|
||||
ParentColor = False
|
||||
@ -216,12 +259,11 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
AnchorSideTop.Control = gbBanners
|
||||
AnchorSideRight.Control = gbBanners
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 112
|
||||
Height = 31
|
||||
Top = 6
|
||||
Width = 305
|
||||
Left = 88
|
||||
Height = 35
|
||||
Top = 2
|
||||
Width = 320
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
ItemHeight = 0
|
||||
OnKeyPress = cbPaperSizeKEYPRESS
|
||||
Style = csDropDownList
|
||||
@ -233,12 +275,12 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = cbBanStart
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 112
|
||||
Height = 31
|
||||
Left = 88
|
||||
Height = 35
|
||||
Top = 43
|
||||
Width = 305
|
||||
Width = 320
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Bottom = 8
|
||||
ItemHeight = 0
|
||||
OnKeyPress = cbPaperSizeKEYPRESS
|
||||
Style = csDropDownList
|
||||
@ -246,25 +288,44 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
end
|
||||
end
|
||||
object gbPagesSheet: TGroupBox
|
||||
Left = 256
|
||||
Height = 118
|
||||
Top = 163
|
||||
Width = 185
|
||||
AnchorSideLeft.Control = gbOrientation
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = cbResolution
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = cbResolution
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = gbOrientation
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 248
|
||||
Height = 120
|
||||
Top = 172
|
||||
Width = 178
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
Caption = ' Pages per sheet '
|
||||
ClientHeight = 99
|
||||
ClientWidth = 181
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ClientHeight = 100
|
||||
ClientWidth = 176
|
||||
TabOrder = 5
|
||||
object imgPageSheet: TImage
|
||||
Left = 78
|
||||
AnchorSideLeft.Control = rbSheet2
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = gbPagesSheet
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 72
|
||||
Height = 50
|
||||
Top = 17
|
||||
Top = 25
|
||||
Width = 80
|
||||
BorderSpacing.Left = 30
|
||||
end
|
||||
object rbSheet1: TRadioButton
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 5
|
||||
Width = 34
|
||||
AnchorSideLeft.Control = gbPagesSheet
|
||||
AnchorSideTop.Control = gbPagesSheet
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 2
|
||||
Width = 32
|
||||
Caption = '1'
|
||||
Checked = True
|
||||
DragCursor = crDefault
|
||||
@ -273,9 +334,12 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
TabStop = True
|
||||
end
|
||||
object rbSheet2: TRadioButton
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 29
|
||||
AnchorSideLeft.Control = gbPagesSheet
|
||||
AnchorSideTop.Control = rbSheet1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 25
|
||||
Width = 34
|
||||
Caption = '2'
|
||||
DragCursor = crDefault
|
||||
@ -283,10 +347,14 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
TabOrder = 1
|
||||
end
|
||||
object rbSheet4: TRadioButton
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 53
|
||||
Width = 34
|
||||
AnchorSideLeft.Control = gbPagesSheet
|
||||
AnchorSideTop.Control = rbSheet2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 48
|
||||
Width = 35
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = '4'
|
||||
DragCursor = crDefault
|
||||
OnClick = rbPortraitCLICK
|
||||
@ -299,40 +367,63 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = cbPaperSize
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 172
|
||||
Height = 31
|
||||
Top = 117
|
||||
Width = 275
|
||||
Left = 142
|
||||
Height = 35
|
||||
Top = 131
|
||||
Width = 284
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 0
|
||||
OnKeyPress = cbPaperSizeKEYPRESS
|
||||
Style = csDropDownList
|
||||
TabOrder = 3
|
||||
end
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = pgGeneral
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = pgGeneral
|
||||
Left = 195
|
||||
Height = 1
|
||||
Top = 8
|
||||
Width = 45
|
||||
Constraints.MinWidth = 45
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
object pgAdvanced: TTabSheet
|
||||
Caption = 'Advanced'
|
||||
ClientHeight = 396
|
||||
ClientWidth = 453
|
||||
ClientHeight = 413
|
||||
ClientWidth = 434
|
||||
object sb: TScrollBox
|
||||
Left = 0
|
||||
Height = 396
|
||||
Left = 6
|
||||
Height = 413
|
||||
Top = 0
|
||||
Width = 453
|
||||
Width = 428
|
||||
HorzScrollBar.Page = 1
|
||||
VertScrollBar.Page = 1
|
||||
Align = alClient
|
||||
BorderSpacing.Left = 6
|
||||
BorderStyle = bsNone
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.HorizontalSpacing = 8
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
object ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 29
|
||||
Top = 433
|
||||
Width = 445
|
||||
Anchors = [akLeft, akBottom]
|
||||
AnchorSideLeft.Control = Notebook1
|
||||
AnchorSideTop.Control = Notebook1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Notebook1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 35
|
||||
Top = 458
|
||||
Width = 444
|
||||
Align = alNone
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Bottom = 8
|
||||
BorderSpacing.Around = 0
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
HelpButton.Name = 'HelpButton'
|
||||
@ -343,6 +434,7 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
|
||||
CancelButton.DefaultCaption = True
|
||||
TabOrder = 1
|
||||
ShowButtons = [pbOK, pbCancel]
|
||||
ShowGlyphs = []
|
||||
ShowBevel = False
|
||||
end
|
||||
end
|
||||
|
@ -28,9 +28,12 @@ unit uDlgPropertiesPrinter;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
||||
ExtCtrls, StdCtrls, Buttons, Printers, CupsLCL, OsPrinters, LCLProc,
|
||||
ButtonPanel, CupsDyn, Printer4LazStrConst;
|
||||
Classes, SysUtils,
|
||||
// LCL
|
||||
LResources, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls, StdCtrls,
|
||||
LCLProc, LCLType, ButtonPanel, Printers,
|
||||
// Printers
|
||||
CupsLCL, CupsDyn, Printer4LazStrConst;
|
||||
|
||||
type
|
||||
|
||||
@ -50,6 +53,7 @@ type
|
||||
imgOrientation: TIMAGE;
|
||||
labBanStart: TLABEL;
|
||||
labBanEnd: TLABEL;
|
||||
Label1: TLabel;
|
||||
labPaperSrc: TLABEL;
|
||||
labResolution: TLabel;
|
||||
labPaperType: TLABEL;
|
||||
@ -66,6 +70,7 @@ type
|
||||
rbLandscape: TRADIOBUTTON;
|
||||
rbPortrait: TRADIOBUTTON;
|
||||
sb: TScrollBox;
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure rbPortraitClick(Sender: TObject);
|
||||
procedure cbPaperSizeKeypress(Sender: TObject; var Key: Char);
|
||||
@ -105,7 +110,7 @@ procedure Tdlgpropertiesprinter.cbPaperSizeKeypress(Sender: TObject;
|
||||
var Key: Char);
|
||||
begin
|
||||
if Sender=nil then ;
|
||||
Key:=#0;
|
||||
// Key:=#0;
|
||||
end;
|
||||
|
||||
function Tdlgpropertiesprinter.number_up_supported: string;
|
||||
@ -134,10 +139,6 @@ begin
|
||||
|
||||
SetupCupsCombo(cbPaperSize, nil, 'PageSize');
|
||||
SetupCupsCombo(cbPaperType, nil, 'MediaType');
|
||||
if not cbPaperType.Enabled then begin
|
||||
cbPaperType.Items.Add('Not Available');
|
||||
cbPaperType.ItemIndex:=0;
|
||||
end;
|
||||
SetupCupsCombo(cbPaperSrc, nil, 'InputSlot');
|
||||
SetupCupsCombo(cbResolution, nil, 'Resolution');
|
||||
st := THackCUPSPrinter(Printer).GetResolutionOption;
|
||||
@ -208,10 +209,11 @@ procedure Tdlgpropertiesprinter.SetupAdvancedOptions(Data: PtrInt);
|
||||
var
|
||||
Group: pppd_group_t;
|
||||
Option: pppd_option_t;
|
||||
c,g,k,y: Integer;
|
||||
c,g,k: Integer;
|
||||
lab: TLabel;
|
||||
Bevel: TBevel;
|
||||
Combo: TCombobox;
|
||||
prev: TControl;
|
||||
|
||||
function CheckOption: boolean;
|
||||
begin
|
||||
@ -232,7 +234,7 @@ begin
|
||||
then
|
||||
exit;
|
||||
|
||||
y := C_SPACE-C_GROUPSPACE;
|
||||
prev := sb;
|
||||
|
||||
g := 0;
|
||||
Group := THackCUPSPrinter(Printer).CupsPPD^.groups;
|
||||
@ -254,28 +256,33 @@ begin
|
||||
if k>0 then
|
||||
begin
|
||||
// add group's caption
|
||||
Inc(Y, C_GROUPSPACE);
|
||||
|
||||
// todo: use exclusively anchor options to do layout
|
||||
lab := TLabel.Create(Self);
|
||||
lab.Parent := sb;
|
||||
lab.Font.Style:=lab.font.style + [fsBold];
|
||||
lab.Top := Y;
|
||||
lab.Caption := group^.text;
|
||||
lab.BorderSpacing.Around:=C_SPACE;
|
||||
lab.ShowAccelChar := False;
|
||||
lab.AnchorSideTop.Control := prev;
|
||||
if prev = sb then
|
||||
lab.AnchorSideTop.Side := asrTop
|
||||
else
|
||||
lab.AnchorSideTop.Side := asrBottom;
|
||||
lab.AnchorSideLeft.Control := sb;
|
||||
lab.AnchorSideLeft.Side := asrTop;
|
||||
lab.BorderSpacing.Top := 8;
|
||||
|
||||
Bevel := TBevel.Create(Self);
|
||||
Bevel.Parent := sb;
|
||||
Bevel.Shape := bsTopLine;
|
||||
Bevel.Top:= y + lab.Height div 2;
|
||||
Bevel.Height:= C_SPACE div 2;
|
||||
Bevel.BorderSpacing.Around := C_SPACE;
|
||||
Bevel.Height:= 3;
|
||||
Bevel.AnchorSideTop.Control := lab;
|
||||
Bevel.AnchorSideTop.Side := asrCenter;
|
||||
Bevel.AnchorSideLeft.Control := lab;
|
||||
Bevel.AnchorSideLeft.Side := asrBottom;
|
||||
Bevel.width := sb.Width - C_SPACE;
|
||||
Bevel.AnchorSideRight.Control := sb;
|
||||
Bevel.AnchorSideRight.Side := asrBottom;
|
||||
Bevel.anchors := [akLeft, akTop, akRight];
|
||||
|
||||
inc(y, Lab.Height);
|
||||
prev := lab;
|
||||
|
||||
// add options
|
||||
c := 0;
|
||||
@ -285,34 +292,33 @@ begin
|
||||
|
||||
if CheckOption then
|
||||
begin
|
||||
y := y + C_SPACE;
|
||||
|
||||
lab := TLabel.Create(Self);
|
||||
lab.Parent := sb;
|
||||
lab.Layout:=tlCenter;
|
||||
lab.AutoSize := false;
|
||||
lab.Top := Y;
|
||||
lab.Width:=220;
|
||||
lab.BorderSpacing.Around:=C_SPACE;
|
||||
lab.AnchorSideLeft.Control := sb;
|
||||
lab.Width := 180; { ???? }
|
||||
lab.Caption := Option^.text;
|
||||
lab.ShowAccelChar := False;
|
||||
lab.AnchorSideLeft.Control := sb;
|
||||
lab.AnchorSideLeft.Side := asrLeft;
|
||||
|
||||
combo := TCombobox.Create(self);
|
||||
combo.Parent := sb;
|
||||
combo.Style:= csDropDownList;
|
||||
combo.Top:= y + lab.Height div 2;
|
||||
combo.BorderSpacing.Around := C_SPACE;
|
||||
combo.AnchorSideTop.Control := prev;
|
||||
combo.AnchorSideTop.Side := asrBottom;
|
||||
combo.AnchorSideLeft.Control := lab;
|
||||
combo.AnchorSideLeft.Side := asrBottom;
|
||||
combo.AnchorSideLeft.Side := asrRight;
|
||||
combo.AnchorSideRight.Control := sb;
|
||||
combo.AnchorSideRight.Side := asrBottom;
|
||||
combo.AnchorSideRight.Side := asrRight;
|
||||
combo.anchors := [akLeft, akTop, akRight];
|
||||
|
||||
lab.Height:= combo.height;
|
||||
lab.AnchorSideTop.Control := combo;
|
||||
lab.AnchorSideTop.Side := asrCenter;
|
||||
|
||||
SetupCupsCombo(Combo, Option);
|
||||
|
||||
inc(y, combo.height + C_SPACE );
|
||||
prev := combo;
|
||||
end;
|
||||
|
||||
Inc(Option);
|
||||
@ -324,14 +330,8 @@ begin
|
||||
inc(group);
|
||||
inc(g);
|
||||
end; // group
|
||||
|
||||
// final space
|
||||
with TPanel.Create(Self) do begin
|
||||
SetBounds(C_SPACE, y+C_SPACE, 1, C_SPACE);
|
||||
BevelOuter := bvNone;
|
||||
Parent := sb;
|
||||
end;
|
||||
|
||||
if Assigned(prev) then
|
||||
prev.BorderSpacing.Bottom := 12;
|
||||
end;
|
||||
|
||||
//Initialization
|
||||
@ -339,6 +339,7 @@ procedure Tdlgpropertiesprinter.dlgpropertiesprinterCreate(Sender: TObject);
|
||||
begin
|
||||
if Sender=nil then ;
|
||||
Notebook1.PageIndex:=0;
|
||||
Notebook1.AutoSize := True;
|
||||
|
||||
Caption := p4lrsPrinterProperties;
|
||||
ButtonPanel1.CancelButton.Caption := p4lrsCancel;
|
||||
@ -373,6 +374,11 @@ begin
|
||||
if Sender=nil then ;
|
||||
end;
|
||||
|
||||
procedure Tdlgpropertiesprinter.FormActivate(Sender: TObject);
|
||||
begin
|
||||
Notebook1.AutoSize := False;
|
||||
end;
|
||||
|
||||
procedure Tdlgpropertiesprinter.RefreshInfos;
|
||||
var St : string;
|
||||
begin
|
||||
@ -436,7 +442,7 @@ begin
|
||||
if rbSheet1.Checked then St:='1';
|
||||
if rbSheet2.Checked then St:='2';
|
||||
if rbSheet4.Checked then St:='4';
|
||||
if THackCUPSPrinter(Printer).GetAttributeInteger('number-up-default',0)<>StrToInt(St) then
|
||||
if THackCUPSPrinter(Printer).GetAttributeInteger('number-up',0)<>StrToInt(St) then
|
||||
THackCUPSPrinter(Printer).cupsAddOption('number-up',St);
|
||||
end;
|
||||
|
||||
|
@ -1,219 +1,268 @@
|
||||
object dlgSelectPrinter: TdlgSelectPrinter
|
||||
Left = 330
|
||||
Height = 441
|
||||
Top = 111
|
||||
Width = 563
|
||||
ActiveControl = btnProp
|
||||
Left = 321
|
||||
Height = 454
|
||||
Top = 135
|
||||
Width = 562
|
||||
ActiveControl = cbPrinters
|
||||
AutoSize = True
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Printing'
|
||||
ClientHeight = 441
|
||||
ClientWidth = 563
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 454
|
||||
ClientWidth = 562
|
||||
OnClose = FormClose
|
||||
OnCreate = dlgSelectPrinterCREATE
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = dlgSelectPrinterSHOW
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.9.0.0'
|
||||
LCLVersion = '2.1.0.0'
|
||||
object PrinterGroupbox: TGroupBox
|
||||
Left = 6
|
||||
Height = 137
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 8
|
||||
Height = 138
|
||||
Top = 6
|
||||
Width = 551
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
Width = 544
|
||||
AutoSize = True
|
||||
Caption = ' Printer '
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ChildSizing.HorizontalSpacing = 6
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 118
|
||||
ClientWidth = 547
|
||||
ClientWidth = 542
|
||||
TabOrder = 0
|
||||
object labState: TLabel
|
||||
Left = 96
|
||||
Height = 17
|
||||
Top = 49
|
||||
Width = 57
|
||||
AnchorSideLeft.Control = cbPrinters
|
||||
AnchorSideTop.Control = PrinterStateLabel
|
||||
Left = 116
|
||||
Height = 19
|
||||
Top = 43
|
||||
Width = 54
|
||||
Caption = 'labState'
|
||||
ParentColor = False
|
||||
ShowAccelChar = False
|
||||
end
|
||||
object labLocation: TLabel
|
||||
Left = 96
|
||||
Height = 17
|
||||
Top = 73
|
||||
Width = 80
|
||||
AnchorSideLeft.Control = labState
|
||||
AnchorSideTop.Control = PrinterLocationLabel
|
||||
Left = 116
|
||||
Height = 19
|
||||
Top = 68
|
||||
Width = 75
|
||||
Caption = 'labLocation'
|
||||
ParentColor = False
|
||||
ShowAccelChar = False
|
||||
end
|
||||
object labComment: TLabel
|
||||
Left = 96
|
||||
Height = 17
|
||||
Top = 97
|
||||
Width = 87
|
||||
AnchorSideLeft.Control = labLocation
|
||||
AnchorSideTop.Control = PrinterDescriptionLabel
|
||||
Left = 116
|
||||
Height = 19
|
||||
Top = 93
|
||||
Width = 84
|
||||
Caption = 'labComment'
|
||||
ParentColor = False
|
||||
ShowAccelChar = False
|
||||
end
|
||||
object ImgPrn: TImage
|
||||
Left = 96
|
||||
Height = 17
|
||||
Top = 12
|
||||
Width = 17
|
||||
end
|
||||
object PrinterNameLabel: TLabel
|
||||
Left = 250
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 40
|
||||
Anchors = []
|
||||
Caption = 'Name'
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = PrinterGroupbox
|
||||
AnchorSideTop.Control = PrinterGroupbox
|
||||
Left = 116
|
||||
Height = 1
|
||||
Top = 2
|
||||
Width = 1
|
||||
BorderSpacing.Left = 116
|
||||
ParentColor = False
|
||||
end
|
||||
object PrinterStateLabel: TLabel
|
||||
Left = 10
|
||||
Height = 17
|
||||
Top = 49
|
||||
Width = 36
|
||||
AnchorSideLeft.Control = PrinterGroupbox
|
||||
AnchorSideTop.Control = cbPrinters
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 43
|
||||
Width = 34
|
||||
Caption = 'State'
|
||||
ParentColor = False
|
||||
OnChangeBounds = PrinterStateLabelChangeBounds
|
||||
end
|
||||
object PrinterLocationLabel: TLabel
|
||||
Left = 10
|
||||
Height = 17
|
||||
Top = 73
|
||||
Width = 59
|
||||
AnchorSideLeft.Control = PrinterStateLabel
|
||||
AnchorSideTop.Control = PrinterStateLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 68
|
||||
Width = 55
|
||||
Caption = 'Location'
|
||||
ParentColor = False
|
||||
end
|
||||
object PrinterDescriptionLabel: TLabel
|
||||
Left = 10
|
||||
Height = 17
|
||||
Top = 97
|
||||
Width = 78
|
||||
AnchorSideLeft.Control = PrinterLocationLabel
|
||||
AnchorSideTop.Control = PrinterLocationLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 93
|
||||
Width = 75
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'Description'
|
||||
ParentColor = False
|
||||
end
|
||||
object labPrinterName: TLabel
|
||||
Left = 10
|
||||
Height = 17
|
||||
Top = 12
|
||||
object PrinterNameLabel: TLabel
|
||||
AnchorSideLeft.Control = PrinterGroupbox
|
||||
AnchorSideTop.Control = cbPrinters
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 10
|
||||
Width = 40
|
||||
Caption = 'Name'
|
||||
ParentColor = False
|
||||
OnChangeBounds = PrinterStateLabelChangeBounds
|
||||
end
|
||||
object btnProp: TButton
|
||||
AnchorSideLeft.Control = cbPrinters
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = cbPrinters
|
||||
AnchorSideTop.Control = PrinterGroupbox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 442
|
||||
Height = 29
|
||||
Top = 7
|
||||
Width = 99
|
||||
Anchors = [akTop, akRight]
|
||||
Left = 434
|
||||
Height = 35
|
||||
Top = 2
|
||||
Width = 100
|
||||
AutoSize = True
|
||||
Caption = 'Properties ...'
|
||||
OnClick = btnPropCLICK
|
||||
TabOrder = 1
|
||||
end
|
||||
object cbPrintToFile: TCheckBox
|
||||
AnchorSideTop.Control = btnProp
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = PrinterGroupbox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 438
|
||||
Height = 24
|
||||
Top = 39
|
||||
Width = 101
|
||||
Anchors = [akRight, akBottom]
|
||||
Left = 436
|
||||
Height = 23
|
||||
Top = 43
|
||||
Width = 98
|
||||
Anchors = [akTop, akRight]
|
||||
Caption = 'Print to file'
|
||||
TabOrder = 2
|
||||
end
|
||||
object cbPrinters: TComboBox
|
||||
AnchorSideRight.Control = btnProp
|
||||
Left = 120
|
||||
Height = 31
|
||||
Top = 7
|
||||
Width = 316
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Right = 6
|
||||
AnchorSideLeft.Control = Label1
|
||||
AnchorSideTop.Control = PrinterGroupbox
|
||||
Left = 116
|
||||
Height = 35
|
||||
Top = 2
|
||||
Width = 312
|
||||
ItemHeight = 0
|
||||
OnChange = cbPrintersCHANGE
|
||||
OnDrawItem = cbPrintersDrawItem
|
||||
OnKeyPress = cbPrintersKEYPRESS
|
||||
Style = csDropDownList
|
||||
Style = csOwnerDrawFixed
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object NbOpts: TPageControl
|
||||
Left = 6
|
||||
Height = 217
|
||||
Top = 177
|
||||
Width = 551
|
||||
AnchorSideLeft.Control = panLabels
|
||||
AnchorSideTop.Control = panLabels
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = panLabels
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 231
|
||||
Top = 175
|
||||
Width = 544
|
||||
TabStop = False
|
||||
ActivePage = pgCopies
|
||||
Align = alClient
|
||||
Anchors = [akLeft]
|
||||
BorderSpacing.Around = 6
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabIndex = 0
|
||||
TabOrder = 1
|
||||
TabOrder = 2
|
||||
Visible = False
|
||||
Options = [nboKeyboardTabSwitch]
|
||||
object pgCopies: TTabSheet
|
||||
Caption = 'Copies'
|
||||
ClientHeight = 186
|
||||
ClientWidth = 547
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ChildSizing.HorizontalSpacing = 8
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 198
|
||||
ClientWidth = 534
|
||||
object gbPages: TGroupBox
|
||||
AnchorSideBottom.Control = pgCopies
|
||||
AnchorSideLeft.Control = pgCopies
|
||||
AnchorSideTop.Control = pgCopies
|
||||
AnchorSideRight.Control = Label2
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 173
|
||||
Top = 7
|
||||
Left = 6
|
||||
Height = 187
|
||||
Top = 2
|
||||
Width = 262
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = ' Select pages '
|
||||
ClientHeight = 154
|
||||
ClientWidth = 258
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ChildSizing.HorizontalSpacing = 6
|
||||
ClientHeight = 167
|
||||
ClientWidth = 260
|
||||
TabOrder = 0
|
||||
object Bevel1: TBevel
|
||||
AnchorSideLeft.Control = gbPages
|
||||
AnchorSideTop.Control = edRange
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = gbPages
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 2
|
||||
Top = 110
|
||||
Width = 240
|
||||
Top = 112
|
||||
Width = 244
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
Shape = bsTopLine
|
||||
Style = bsRaised
|
||||
end
|
||||
object labPage: TLabel
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideLeft.Control = Bevel1
|
||||
AnchorSideTop.Control = edPageSet
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 124
|
||||
Height = 19
|
||||
Top = 128
|
||||
Width = 40
|
||||
BorderSpacing.Top = 12
|
||||
Caption = 'Pages'
|
||||
ParentColor = False
|
||||
end
|
||||
object edRange: TEdit
|
||||
AnchorSideLeft.Control = rbRange
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = rbRange
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideTop.Control = rbSelection
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = gbPages
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 90
|
||||
Height = 27
|
||||
Top = 77
|
||||
Width = 162
|
||||
Left = 81
|
||||
Height = 35
|
||||
Top = 71
|
||||
Width = 171
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 15
|
||||
BorderSpacing.Right = 6
|
||||
OnEnter = edRangeEnter
|
||||
TabOrder = 4
|
||||
end
|
||||
object edPageSet: TComboBox
|
||||
AnchorSideTop.Control = labPage
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = gbPages
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 104
|
||||
Height = 27
|
||||
Top = 119
|
||||
Height = 35
|
||||
Top = 120
|
||||
Width = 148
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 12
|
||||
ItemHeight = 0
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
@ -226,35 +275,37 @@ object dlgSelectPrinter: TdlgSelectPrinter
|
||||
Text = 'All pages'
|
||||
end
|
||||
object rbCurrentPage: TRadioButton
|
||||
AnchorSideLeft.Control = rbAllPage
|
||||
AnchorSideTop.Control = rbAllPage
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 26
|
||||
Width = 113
|
||||
BorderSpacing.Around = 2
|
||||
Height = 23
|
||||
Top = 25
|
||||
Width = 111
|
||||
Caption = 'Current page'
|
||||
DragCursor = crDefault
|
||||
Enabled = False
|
||||
TabOrder = 1
|
||||
end
|
||||
object rbRange: TRadioButton
|
||||
AnchorSideTop.Control = rbSelection
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideLeft.Control = rbSelection
|
||||
AnchorSideTop.Control = edRange
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 78
|
||||
Height = 23
|
||||
Top = 77
|
||||
Width = 67
|
||||
BorderSpacing.Around = 2
|
||||
Caption = 'Range'
|
||||
DragCursor = crDefault
|
||||
TabOrder = 3
|
||||
end
|
||||
object rbAllPage: TRadioButton
|
||||
AnchorSideLeft.Control = gbPages
|
||||
AnchorSideTop.Control = gbPages
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 0
|
||||
Width = 47
|
||||
Height = 23
|
||||
Top = 2
|
||||
Width = 46
|
||||
Caption = 'All '
|
||||
Checked = True
|
||||
DragCursor = crDefault
|
||||
@ -262,13 +313,13 @@ object dlgSelectPrinter: TdlgSelectPrinter
|
||||
TabStop = True
|
||||
end
|
||||
object rbSelection: TRadioButton
|
||||
AnchorSideLeft.Control = rbCurrentPage
|
||||
AnchorSideTop.Control = rbCurrentPage
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 24
|
||||
Top = 52
|
||||
Width = 88
|
||||
BorderSpacing.Around = 2
|
||||
Height = 23
|
||||
Top = 48
|
||||
Width = 86
|
||||
Caption = 'Selection'
|
||||
DragCursor = crDefault
|
||||
Enabled = False
|
||||
@ -278,109 +329,137 @@ object dlgSelectPrinter: TdlgSelectPrinter
|
||||
object gbCopies: TGroupBox
|
||||
AnchorSideLeft.Control = gbPages
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = pgCopies
|
||||
AnchorSideRight.Control = pgCopies
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = pgCopies
|
||||
AnchorSideBottom.Control = gbPages
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 276
|
||||
Height = 173
|
||||
Top = 7
|
||||
Width = 265
|
||||
Height = 187
|
||||
Top = 2
|
||||
Width = 252
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = ' Copies '
|
||||
ClientHeight = 154
|
||||
ClientWidth = 261
|
||||
ChildSizing.LeftRightSpacing = 8
|
||||
ChildSizing.TopBottomSpacing = 2
|
||||
ChildSizing.HorizontalSpacing = 6
|
||||
ClientHeight = 167
|
||||
ClientWidth = 250
|
||||
TabOrder = 1
|
||||
object imgCollate: TImage
|
||||
AnchorSideTop.Control = lanNumCopies
|
||||
AnchorSideLeft.Control = lanNumCopies
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = edCopies
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Left = 19
|
||||
Height = 37
|
||||
Top = 29
|
||||
Top = 45
|
||||
Width = 93
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Top = 8
|
||||
Proportional = True
|
||||
end
|
||||
object lanNumCopies: TLabel
|
||||
Left = 6
|
||||
Height = 17
|
||||
Top = 6
|
||||
Width = 120
|
||||
AnchorSideLeft.Control = gbCopies
|
||||
AnchorSideTop.Control = edCopies
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 10
|
||||
Width = 115
|
||||
Caption = 'Number of copies'
|
||||
ParentColor = False
|
||||
end
|
||||
object edCopies: TSpinEdit
|
||||
AnchorSideLeft.Control = lanNumCopies
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = lanNumCopies
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 132
|
||||
Height = 27
|
||||
Top = 1
|
||||
AnchorSideTop.Control = gbCopies
|
||||
Left = 129
|
||||
Height = 35
|
||||
Top = 2
|
||||
Width = 60
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Bottom = 2
|
||||
MaxValue = 999
|
||||
MinValue = 1
|
||||
OnChange = edCopiesChange
|
||||
TabOrder = 0
|
||||
Value = 1
|
||||
end
|
||||
object cbCollate: TCheckBox
|
||||
AnchorSideLeft.Control = edCopies
|
||||
AnchorSideTop.Control = edCopies
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 119
|
||||
Height = 24
|
||||
Top = 34
|
||||
Width = 74
|
||||
AllowGrayed = True
|
||||
BorderSpacing.Around = 6
|
||||
Left = 129
|
||||
Height = 23
|
||||
Top = 39
|
||||
Width = 72
|
||||
Caption = 'Collate'
|
||||
DragCursor = crDefault
|
||||
OnClick = cbReverseCLICK
|
||||
TabOrder = 1
|
||||
end
|
||||
object cbReverse: TCheckBox
|
||||
AnchorSideLeft.Control = cbCollate
|
||||
AnchorSideTop.Control = cbCollate
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 119
|
||||
Height = 24
|
||||
Top = 64
|
||||
Left = 129
|
||||
Height = 23
|
||||
Top = 62
|
||||
Width = 79
|
||||
AllowGrayed = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Reverse'
|
||||
DragCursor = crDefault
|
||||
OnClick = cbReverseCLICK
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
object Label2: TLabel
|
||||
AnchorSideLeft.Control = pgCopies
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = pgCopies
|
||||
Left = 267
|
||||
Height = 1
|
||||
Top = 2
|
||||
Width = 1
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
object pgAdvance: TTabSheet
|
||||
Caption = 'Advanced'
|
||||
ClientHeight = 186
|
||||
ClientWidth = 547
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 8
|
||||
ChildSizing.HorizontalSpacing = 8
|
||||
ChildSizing.VerticalSpacing = 6
|
||||
ClientHeight = 198
|
||||
ClientWidth = 534
|
||||
object labTask: TLabel
|
||||
Left = 7
|
||||
Height = 14
|
||||
Top = 10
|
||||
Width = 63
|
||||
AnchorSideLeft.Control = pgAdvance
|
||||
AnchorSideTop.Control = cbTasktime
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 16
|
||||
Width = 83
|
||||
Caption = 'Delayed task'
|
||||
ParentColor = False
|
||||
end
|
||||
object PrioLabel: TLabel
|
||||
AnchorSideTop.Control = labTask
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 7
|
||||
Height = 14
|
||||
Top = 50
|
||||
Width = 35
|
||||
BorderSpacing.Top = 20
|
||||
BorderSpacing.Around = 6
|
||||
AnchorSideLeft.Control = pgAdvance
|
||||
AnchorSideTop.Control = edPriority
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 57
|
||||
Width = 49
|
||||
Caption = 'Priority'
|
||||
ParentColor = False
|
||||
end
|
||||
object cbTasktime: TComboBox
|
||||
Left = 215
|
||||
Height = 21
|
||||
Top = 7
|
||||
AnchorSideLeft.Control = labTask
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = pgAdvance
|
||||
Left = 97
|
||||
Height = 35
|
||||
Top = 8
|
||||
Width = 200
|
||||
ItemHeight = 0
|
||||
ItemIndex = 0
|
||||
@ -398,149 +477,164 @@ object dlgSelectPrinter: TdlgSelectPrinter
|
||||
OnChange = cbTasktimeCHANGE
|
||||
OnKeyPress = cbPrintersKEYPRESS
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
TabOrder = 0
|
||||
Text = 'Immediate'
|
||||
end
|
||||
object edTimeTask: TEdit
|
||||
Left = 423
|
||||
Height = 21
|
||||
Top = 9
|
||||
AnchorSideLeft.Control = cbTasktime
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = cbTasktime
|
||||
Left = 305
|
||||
Height = 35
|
||||
Top = 8
|
||||
Width = 83
|
||||
DragCursor = crDefault
|
||||
MaxLength = 8
|
||||
TabOrder = 0
|
||||
TabOrder = 1
|
||||
Text = '23:00:00'
|
||||
end
|
||||
object edPriority: TSpinEdit
|
||||
AnchorSideTop.Control = PrioLabel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 127
|
||||
Height = 21
|
||||
Top = 47
|
||||
Width = 50
|
||||
TabOrder = 3
|
||||
AnchorSideLeft.Control = cbTasktime
|
||||
AnchorSideTop.Control = cbTasktime
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 97
|
||||
Height = 35
|
||||
Top = 49
|
||||
Width = 63
|
||||
TabOrder = 2
|
||||
end
|
||||
object tkbPriority: TTrackBar
|
||||
AnchorSideLeft.Control = edPriority
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = PrioLabel
|
||||
AnchorSideTop.Control = edPriority
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = pgAdvance
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 183
|
||||
Height = 38
|
||||
Top = 38
|
||||
Width = 320
|
||||
Left = 168
|
||||
Height = 30
|
||||
Top = 51
|
||||
Width = 360
|
||||
AutoSize = True
|
||||
Frequency = 10
|
||||
Max = 100
|
||||
OnChange = tkbPriorityCHANGE
|
||||
Position = 10
|
||||
TabStop = False
|
||||
TickMarks = tmBoth
|
||||
BorderSpacing.Around = 6
|
||||
TickStyle = tsNone
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
DragCursor = crDefault
|
||||
TabOrder = 2
|
||||
TabOrder = 3
|
||||
end
|
||||
end
|
||||
end
|
||||
object BtnPanel: TPanel
|
||||
Left = 0
|
||||
Height = 41
|
||||
Top = 400
|
||||
Width = 563
|
||||
Align = alBottom
|
||||
Anchors = [akLeft, akBottom]
|
||||
AnchorSideLeft.Control = NbOpts
|
||||
AnchorSideTop.Control = NbOpts
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = NbOpts
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 35
|
||||
Top = 412
|
||||
Width = 544
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Bottom = 8
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 41
|
||||
ClientWidth = 563
|
||||
ChildSizing.HorizontalSpacing = 6
|
||||
ClientHeight = 35
|
||||
ClientWidth = 544
|
||||
FullRepaint = False
|
||||
TabOrder = 2
|
||||
TabOrder = 3
|
||||
TabStop = True
|
||||
object btnCancel: TButton
|
||||
Left = 477
|
||||
Height = 29
|
||||
Top = 6
|
||||
Width = 80
|
||||
Left = 469
|
||||
Height = 35
|
||||
Top = 0
|
||||
Width = 75
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
Constraints.MinWidth = 80
|
||||
Constraints.MinWidth = 75
|
||||
ModalResult = 2
|
||||
TabOrder = 3
|
||||
end
|
||||
object btnPrint: TButton
|
||||
Left = 391
|
||||
Height = 29
|
||||
Top = 6
|
||||
Width = 80
|
||||
Left = 388
|
||||
Height = 35
|
||||
Top = 0
|
||||
Width = 75
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Print'
|
||||
Constraints.MinWidth = 80
|
||||
Constraints.MinWidth = 75
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
OnClick = btnPrintCLICK
|
||||
TabOrder = 2
|
||||
end
|
||||
object btnReduc: TButton
|
||||
Left = 6
|
||||
Height = 29
|
||||
Top = 6
|
||||
Width = 80
|
||||
Left = 0
|
||||
Height = 35
|
||||
Top = 0
|
||||
Width = 75
|
||||
Align = alLeft
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'More ...'
|
||||
Constraints.MinWidth = 80
|
||||
Constraints.MinWidth = 75
|
||||
OnClick = btnReducCLICK
|
||||
TabOrder = 0
|
||||
end
|
||||
object btnPreview: TButton
|
||||
Left = 305
|
||||
Height = 29
|
||||
Top = 6
|
||||
Width = 80
|
||||
Left = 307
|
||||
Height = 35
|
||||
Top = 0
|
||||
Width = 75
|
||||
Align = alRight
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Preview'
|
||||
Constraints.MinWidth = 80
|
||||
Constraints.MinWidth = 75
|
||||
ModalResult = 6
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object panLabels: TPanel
|
||||
Left = 6
|
||||
Height = 22
|
||||
Top = 149
|
||||
Width = 551
|
||||
Align = alTop
|
||||
BorderSpacing.Around = 6
|
||||
AnchorSideLeft.Control = PrinterGroupbox
|
||||
AnchorSideTop.Control = PrinterGroupbox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = PrinterGroupbox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 150
|
||||
Width = 544
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 22
|
||||
ClientWidth = 551
|
||||
TabOrder = 3
|
||||
ChildSizing.HorizontalSpacing = 8
|
||||
ClientHeight = 19
|
||||
ClientWidth = 544
|
||||
TabOrder = 1
|
||||
object labCUPS: TLabel
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 17
|
||||
Top = 3
|
||||
Width = 251
|
||||
AnchorSideLeft.Control = panLabels
|
||||
AnchorSideTop.Control = panLabels
|
||||
Left = 0
|
||||
Height = 19
|
||||
Top = 0
|
||||
Width = 244
|
||||
Caption = 'CUPS (Common Unix Printing System)'
|
||||
ParentColor = False
|
||||
end
|
||||
object labCUPSServer: TLabel
|
||||
AnchorSideLeft.Control = labCUPS
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 265
|
||||
Height = 17
|
||||
Top = 3
|
||||
Width = 100
|
||||
BorderSpacing.Around = 6
|
||||
AnchorSideTop.Control = panLabels
|
||||
Left = 252
|
||||
Height = 19
|
||||
Top = 0
|
||||
Width = 99
|
||||
Caption = 'labCUPSServer'
|
||||
ParentColor = False
|
||||
end
|
||||
|
@ -37,13 +37,12 @@ unit uDlgSelectPrinter;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Math,
|
||||
Classes, SysUtils, Types,
|
||||
// LCL
|
||||
LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons, ExtCtrls,
|
||||
Spin, ComCtrls, LCLType, LCLPlatformDef, InterfaceBase, Printers,
|
||||
Spin, ComCtrls, LCLType, LCLPlatformDef, InterfaceBase, Printers, LCLProc,
|
||||
// Printers
|
||||
Printer4LazStrConst,
|
||||
OsPrinters, CUPSDyn;
|
||||
Printer4LazStrConst, OsPrinters, CUPSDyn;
|
||||
|
||||
type
|
||||
|
||||
@ -63,19 +62,19 @@ type
|
||||
edPageSet: TCOMBOBOX;
|
||||
cbTasktime: TCOMBOBOX;
|
||||
edRange: TEDIT;
|
||||
Label2: TLabel;
|
||||
panLabels: TPanel;
|
||||
PrinterGroupbox: TGroupbox;
|
||||
gbPages: TGROUPBOX;
|
||||
gbCopies: TGROUPBOX;
|
||||
ImgPrn: TIMAGE;
|
||||
imgCollate: TIMAGE;
|
||||
PrinterNameLabel: TLabel;
|
||||
Label1: TLabel;
|
||||
PrinterStateLabel: TLabel;
|
||||
PrinterLocationLabel: TLabel;
|
||||
PrinterDescriptionLabel: TLabel;
|
||||
labComment: TLABEL;
|
||||
labCUPS: TLABEL;
|
||||
labPrinterName: TLabel;
|
||||
PrinterNameLabel: TLabel;
|
||||
PrioLabel: TLabel;
|
||||
labCUPSServer: TLABEL;
|
||||
labTask: TLABEL;
|
||||
@ -99,25 +98,31 @@ type
|
||||
procedure btnPropCLICK(Sender: TObject);
|
||||
procedure btnReducCLICK(Sender: TObject);
|
||||
procedure cbPrintersCHANGE(Sender: TObject);
|
||||
procedure cbPrintersDrawItem(Control: TWinControl; Index: Integer;
|
||||
ARect: TRect; State: TOwnerDrawState);
|
||||
procedure cbPrintersKEYPRESS(Sender: TObject; var Key: Char);
|
||||
procedure cbReverseCLICK(Sender: TObject);
|
||||
procedure cbTasktimeCHANGE(Sender: TObject);
|
||||
procedure dlgSelectPrinterCREATE(Sender: TObject);
|
||||
procedure dlgSelectPrinterSHOW(Sender: TObject);
|
||||
procedure PrinterStateLabelChangeBounds(Sender: TObject);
|
||||
procedure edCopiesChange(Sender: TObject);
|
||||
procedure edRangeEnter(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure tkbPriorityCHANGE(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
fPropertiesSetting : Boolean;
|
||||
FOptions: TPrintDialogOptions;
|
||||
FBig: boolean;
|
||||
FHeightInit: integer;
|
||||
FHeightDec: integer;
|
||||
fPrinterImgs: TImageList;
|
||||
FSavedPrinterIndex: Integer;
|
||||
function GetPrintRange: TPrintRange;
|
||||
procedure RefreshInfos;
|
||||
procedure InitPrinterOptions;
|
||||
procedure SetBigMode(AValue: boolean);
|
||||
procedure SetPrintRange(const AValue: TPrintRange);
|
||||
procedure InitPrinterList;
|
||||
property BigMode: boolean read FBig write SetBigMode;
|
||||
public
|
||||
{ public declaration}
|
||||
@ -159,10 +164,8 @@ end;
|
||||
|
||||
constructor TdlgSelectPrinter.Create(aOwner : TComponent);
|
||||
begin
|
||||
Inherited Create(aOwner);
|
||||
|
||||
FHeightInit:=Height;
|
||||
FHeightDec:=NbOpts.Height+6;
|
||||
inherited Create(aOwner);
|
||||
btnReduc.Caption := p4lrsButtonMoreArrow;
|
||||
|
||||
if WidgetSet.LCLPlatform = lpCarbon then
|
||||
begin //Can't hide tabs with button on Carbon, so just expand dialog.
|
||||
@ -232,12 +235,9 @@ begin
|
||||
BtnPrint.Enabled:=False;
|
||||
end;
|
||||
|
||||
labState.Caption:=St;
|
||||
btnPreview.Enabled := btnPrint.Enabled;
|
||||
|
||||
//DRw image printer
|
||||
imgPrn.Picture.PixMap.TransparentColor:=clNone;
|
||||
imgPrn.Picture.PixMap.LoadFromResourceName(HInstance, Stp);
|
||||
imgPrn.Picture.PixMap.Transparent:=True;
|
||||
labState.Caption:=St;
|
||||
|
||||
//cups server
|
||||
labCUPSServer.Caption:=cupsServer()+':'+IntToStr(ippPort());
|
||||
@ -245,9 +245,8 @@ begin
|
||||
labLocation.Caption:=THackCUPSPrinter(Printer).GetAttributeString('printer-location','');
|
||||
labComment.Caption :=THackCUPSPrinter(Printer).GetAttributeString('printer-info','');
|
||||
|
||||
//Copies
|
||||
edCopies.Value:=Printer.Copies;
|
||||
cbCollate.Checked:=True; //For update image
|
||||
cbReverseCLICK(cbCollate); // update collate image
|
||||
edCopiesChange(edCopies); // update collate/reverse states
|
||||
|
||||
//Range setting
|
||||
edRange.Enabled:=
|
||||
@ -296,7 +295,10 @@ begin
|
||||
Result:=prCurrentPage
|
||||
else
|
||||
if rbRange.checked then
|
||||
Result:=prPageNums;
|
||||
Result:=prPageNums
|
||||
else
|
||||
if rbSelection.checked then
|
||||
Result:=prSelection;
|
||||
end;
|
||||
|
||||
//Initialization of selected Printer options
|
||||
@ -373,25 +375,82 @@ begin
|
||||
case aValue of
|
||||
prAllPages : rbAllPage.checked:=True;
|
||||
prCurrentPage : rbCurrentPage.checked:=True;
|
||||
prSelection : rbSelection.checked:=True;
|
||||
prPageNums : rbRange.checked:=True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TdlgSelectPrinter.InitPrinterList;
|
||||
var
|
||||
i, FImgIndex, FSavedIndex: Integer;
|
||||
begin
|
||||
// load printer images from resource
|
||||
fPrinterImgs.AddResourceName(HInstance, 'printer');
|
||||
fPrinterImgs.AddResourceName(HInstance, 'printer_remote');
|
||||
fPrinterImgs.AddResourceName(HInstance, 'printer_remote_stopped');
|
||||
fPrinterImgs.AddResourceName(HInstance, 'printer_stopped');
|
||||
|
||||
// add printer names to cbPrinters, with image index
|
||||
FSavedIndex := Printer.PrinterIndex;
|
||||
try
|
||||
for i := 0 to Printer.Printers.Count - 1 do
|
||||
begin
|
||||
Printer.PrinterIndex := i;
|
||||
// determine printer type and state
|
||||
FImgIndex := 0;
|
||||
if Printer.PrinterType = ptNetWork then
|
||||
begin
|
||||
if Printer.PrinterState = psStopped then
|
||||
FImgIndex := 2
|
||||
else
|
||||
FImgIndex := 1;
|
||||
end
|
||||
else
|
||||
if Printer.PrinterState = psStopped then
|
||||
FImgIndex := 3;
|
||||
cbPrinters.Items.AddObject(Printer.PrinterName, TObject(IntPtr(FImgIndex)));
|
||||
end;
|
||||
finally
|
||||
Printer.PrinterIndex := FSavedIndex;
|
||||
end;
|
||||
if cbPrinters.Items.Count > 0 then
|
||||
cbPrinters.ItemIndex := Printer.PrinterIndex;
|
||||
end;
|
||||
|
||||
//Initialization of screen
|
||||
procedure TdlgSelectPrinter.dlgSelectPrinterSHOW(Sender: TObject);
|
||||
begin
|
||||
if Sender=nil then ;
|
||||
NbOpts.PageIndex:=0;
|
||||
cbPrinters.Items.Assign(Printer.Printers);
|
||||
if cbPrinters.Items.Count>0 then
|
||||
cbPrinters.ItemIndex:= Printer.PrinterIndex;
|
||||
InitPrinterList;
|
||||
RefreshInfos;
|
||||
{$IFDEF UNIX}
|
||||
btnCancel.Left := btnPreview.Left;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TdlgSelectPrinter.PrinterStateLabelChangeBounds(Sender: TObject);
|
||||
procedure TdlgSelectPrinter.edCopiesChange(Sender: TObject);
|
||||
begin
|
||||
labState.BorderSpacing.Top:=PrinterStateLabel.Top-labState.BorderSpacing.Around;
|
||||
if Sender=nil then ;
|
||||
cbCollate.Enabled := edCopies.Value > 1;
|
||||
cbReverse.Enabled := cbCollate.Enabled;
|
||||
end;
|
||||
|
||||
procedure TdlgSelectPrinter.edRangeEnter(Sender: TObject);
|
||||
begin
|
||||
rbRange.Checked := True;
|
||||
end;
|
||||
|
||||
procedure TdlgSelectPrinter.FormClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
begin
|
||||
if ModalResult = mrCancel then
|
||||
Printer.PrinterIndex := FSavedPrinterIndex;
|
||||
end;
|
||||
|
||||
procedure TdlgSelectPrinter.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
fPrinterImgs.Free;
|
||||
end;
|
||||
|
||||
procedure TdlgSelectPrinter.cbTasktimeCHANGE(Sender: TObject);
|
||||
@ -405,11 +464,15 @@ end;
|
||||
procedure TdlgSelectPrinter.dlgSelectPrinterCREATE(Sender: TObject);
|
||||
begin
|
||||
if Sender=nil then ;
|
||||
FBig := False;
|
||||
fPropertiesSetting:=False;
|
||||
NbOpts.AutoSize := True;
|
||||
NbOpts.PageIndex:=0;
|
||||
edPageSet.Items[0]:=p4lrsAllPages;
|
||||
edPageSet.Items[1]:=p4lrsPageOdd;
|
||||
edPageSet.Items[2]:=p4lrsPageEven;
|
||||
fPrinterImgs := TImageList.Create(Self);
|
||||
FSavedPrinterIndex := Printer.PrinterIndex;
|
||||
end;
|
||||
|
||||
//Show corresponding image
|
||||
@ -431,7 +494,7 @@ end;
|
||||
procedure TdlgSelectPrinter.cbPrintersKEYPRESS(Sender: TObject; var Key: Char);
|
||||
begin
|
||||
if Sender=nil then ;
|
||||
Key:=#0;
|
||||
// Key:=#0;
|
||||
end;
|
||||
|
||||
procedure TdlgSelectPrinter.btnReducCLICK(Sender: TObject);
|
||||
@ -442,19 +505,21 @@ end;
|
||||
|
||||
procedure TdlgSelectPrinter.SetBigMode(AValue: boolean);
|
||||
begin
|
||||
if FBig = AValue then
|
||||
Exit;
|
||||
FBig:= AValue;
|
||||
NbOpts.Visible:= FBig;
|
||||
|
||||
Constraints.MinHeight:=0;
|
||||
Constraints.MaxHeight:=0;
|
||||
Height:=FHeightInit-IfThen(not FBig, FHeightDec);
|
||||
Constraints.MinHeight:=Height;
|
||||
Constraints.MaxHeight:=Height;
|
||||
AutoSize := False;
|
||||
AutoSize := True;
|
||||
|
||||
if not FBig then
|
||||
btnReduc.Caption:=p4lrsButtonMoreArrow
|
||||
else
|
||||
btnReduc.Caption:=p4lrsButtonLessArrow;
|
||||
|
||||
Application.ProcessMessages;
|
||||
NbOpts.AutoSize := False;
|
||||
end;
|
||||
|
||||
procedure TdlgSelectPrinter.btnPrintCLICK(Sender: TObject);
|
||||
@ -500,4 +565,30 @@ begin
|
||||
RefreshInfos;
|
||||
end;
|
||||
|
||||
procedure TdlgSelectPrinter.cbPrintersDrawItem(Control: TWinControl;
|
||||
Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
||||
var
|
||||
ts: TTextStyle;
|
||||
begin
|
||||
// setup dropdown colors
|
||||
if cbPrinters.DroppedDown and not (odSelected in State) then
|
||||
begin
|
||||
cbPrinters.Canvas.Brush.Color := clMenu;
|
||||
cbPrinters.Canvas.Font.Color := clMenuText;
|
||||
cbPrinters.Canvas.FillRect(ARect);
|
||||
end;
|
||||
// draw image
|
||||
fPrinterImgs.Draw(cbPrinters.Canvas, ARect.Left + 4,
|
||||
(ARect.Top + ARect.Bottom - fPrinterImgs.Height) div 2,
|
||||
IntPtr(cbPrinters.Items.Objects[Index]));
|
||||
// draw text
|
||||
ts.Layout := tlCenter;
|
||||
ts.Alignment := taLeftJustify;
|
||||
ts.Opaque := False;
|
||||
ts.Clipping := True;
|
||||
ts.Wordbreak := False;
|
||||
ARect.Left := ARect.Left + (fPrinterImgs.Width + 8);
|
||||
cbPrinters.Canvas.TextRect(ARect, ARect.Left, 0, cbPrinters.Items[Index], ts);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user