Printers, added support to specify printing resolution, cups

git-svn-id: trunk@19095 -
This commit is contained in:
jesus 2009-03-25 05:35:55 +00:00
parent 2884421c60
commit 68eddde845
5 changed files with 339 additions and 182 deletions

View File

@ -10,12 +10,14 @@ uses udlgSelectPrinter,udlgpropertiesprinter, FileUtil;
//Return always 72 because, PostScript it's 72 only
function TCUPSPrinter.GetXDPI: Integer;
begin
//Result:=InternalGetResolution(True);
Result:=72;
end;
//Return always 72 because, PostScript it's 72 only
function TCUPSPrinter.GetYDPI: Integer;
begin
//Result:=InternalGetResolution(False);
Result:=72;
end;
@ -91,6 +93,33 @@ begin
end;
end;
function TCUPSPrinter.GetResolutionOption: string;
var
L1,L2: TStringlist;
i: Integer;
begin
Result := Self.cupsGetOption('Resolution');
if Result='' then
begin
// get resolution from ppd
Result := GetPPDAttribute('DefaultResolution');
if Result='' then
begin
// try grouped options
L1 := TStringList.Create;
L2 := TStringList.Create;
try
i := EnumPPDChoice(L1,'Resolution',L2);
if i>=0 then
Result := L2[i]
finally
L2.Free;
L1.Free;
end;
end;
end;
end;
procedure TCUPSPrinter.GetDebugOptions(Lst : TStrings);
Var Opts : Pcups_option_t;
Opt : Pcups_option_t;
@ -214,6 +243,54 @@ begin
result := fCupsPapersCount>0;
end;
function TCUPSPrinter.InternalGetResolution(ForX: boolean): Integer;
procedure ParseResolution(s:string);
var
a,b: Integer;
begin
if s<>'' then begin
s := uppercase(s);
a := pos('X', S);
b := pos('D', S);
if b=0 then
b := Length(S)
else
dec(b);
if a>0 then begin
// NNNXMMMDPI (or NNN X MMM DPI)
FCachedResolution.x := StrToIntDef(trim(copy(S,1,a-1)), 0);
FCAchedResolution.y := StrToIntDef(trim(copy(S,a+1,b)), 0);
end else begin
// NNNDPI (or NNN DPI);
FCachedResolution.x := StrToIntDef(trim(copy(S,1,b)), 0);
FCachedResolution.y := FCachedResolution.x;
end;
end;
end;
begin
if not (cpsResolutionValid in FStates) then begin
// check user defined resolution
FCachedResolution.x := 0;
FCachedResolution.y := 0;
ParseResolution(GetResolutionOption);
if (FCachedResolution.x=0) or (FCachedResolution.y=0) then
begin
FCachedResolution.x := 300;
FCachedResolution.y := 300;
end;
include(FStates, cpsResolutionValid);
end;
if ForX then
result := FCachedResolution.X
else
result := FCachedResolution.Y;
end;
//Print the file aFileName with a selected printer an options
function TCUPSPrinter.PrintFile(aFileName: String): longint;
var PrinterName : string;
@ -395,6 +472,48 @@ begin
end;
end;
function TCUPSPrinter.GetPPDAttribute(const aName: string): string;
var
i : integer;
AttrRoot : PPppd_attr_t;
Attr : Pppd_attr_t;
begin
Result:='';
if not CUPSLibInstalled then
Exit;
if (Printers.Count>0) and (fcupsPrinter<>nil) and (fcupsPPD<>nil) then
begin
{
WriteLn('PPD INFO: ');
WriteLn(' Model : ', fcupsPPD^.modelname);
WriteLn(' ModelNumber : ', fcupsPPD^.model_number);
WriteLn(' Manufacturer : ', fcupsPPD^.manufacturer);
WriteLn(' Nickname : ', fcupsPPD^.nickname);
WriteLn(' Product : ', fcupsPPD^.product);
WriteLn(' ShortNickName : ', fcupsPPD^.shortnickname);
WriteLn(' Attributes : ', fcupsPPD^.num_attrs,' Current=',fcupsPPD^.cur_attr);
}
i := 0;
AttrRoot := fCupsPPD^.attrs;
while (AttrRoot<>nil) and (i<fcupsPPD^.num_attrs) do
begin
Attr := AttrRoot^;
if attr<>nil then
begin
//WriteLn(' i=',i,' Name=',Attr^.Name,' Spec=',Attr^.Spec,' Value=',Attr^.Value);
if (StrComp(pchar(AName), Attr^.name)=0) then
begin
result := attr^.value;
break;
end;
end;
inc(i);
inc(AttrRoot);
end;
end;
end;
procedure TCUPSPrinter.GetEnumAttributeString(aName: PChar; Lst: TStrings);
var
Reponse : Pipp_t; //IPP Reponse

View File

@ -63,7 +63,8 @@ type
cpsOrientationValid,
cpsPaperNameValid,
cpsCopiesValid,
cpsPaperRectValid
cpsPaperRectValid,
cpsResolutionValid
);
TCUPSPrinterStates = set of TCUPSPrinterState;
@ -96,6 +97,7 @@ type
FBeginDocCount: Integer;
fRawModeStream: TMemoryStream;
FOutputFilename: string;
fCachedResolution: TPoint;
function GetCupsRequest : Pipp_t;
procedure DoCupsConnect;
@ -110,6 +112,7 @@ type
function InternalGetCurPaperName: string;
procedure InternalGetPaperRect(aPaperName:string; var PaperRect:TPaperRect);
function CupsPapersListValid: boolean;
function InternalGetResolution(ForX: boolean): Integer;
protected
function GetCanvasRef : TPrinterCanvasRef; override;
@ -152,9 +155,11 @@ type
function GetAttributeBoolean(aName : PChar; DefaultValue : Boolean) : Boolean;
function EnumPPDChoice(Lst : TStrings; const aKeyWord : string;
OptNames: TStrings = nil) : Integer;
function GetPPDAttribute(const aName: string): string;
procedure cupsAddOption(aName,aValue: string);
function cupsGetOption(aKeyWord: string): String;
function GetResolutionOption: string;
public
constructor Create; override;
destructor Destroy; override;

View File

@ -1,20 +1,20 @@
object dlgpropertiesprinter: Tdlgpropertiesprinter
Left = 333
Height = 417
Top = 111
Left = 228
Height = 464
Top = 63
Width = 457
HorzScrollBar.Page = 456
VertScrollBar.Page = 416
ActiveControl = PagesProperties
Caption = 'Printer properties'
ClientHeight = 417
ClientHeight = 464
ClientWidth = 457
OnCreate = dlgpropertiesprinterCREATE
OnDestroy = FormDestroy
OnShow = dlgpropertiesprinterSHOW
LCLVersion = '0.9.27'
object Panel1: TPanel
Left = 0
Height = 41
Top = 376
Top = 423
Width = 457
Align = alBottom
Anchors = [akLeft, akBottom]
@ -49,98 +49,106 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
end
end
object PagesProperties: TNotebook
Height = 376
Left = 0
Height = 423
Top = 0
Width = 457
Align = alClient
PageIndex = 1
PageIndex = 0
TabOrder = 1
object pgGeneral: TPage
Caption = 'General'
ClientWidth = 453
ClientHeight = 345
ClientHeight = 394
object labPaperSize: TLabel
Left = 15
Height = 20
Height = 16
Top = 19
Width = 66
Width = 63
Caption = 'Paper size'
ParentColor = False
end
object labPaperType: TLabel
Left = 15
Height = 20
Height = 16
Top = 55
Width = 69
Width = 64
Caption = 'Paper type'
ParentColor = False
end
object labPaperSrc: TLabel
Left = 15
Height = 20
Height = 16
Top = 92
Width = 84
Width = 78
Caption = 'Paper source'
ParentColor = False
end
object labResolution: TLabel
Left = 15
Height = 16
Top = 125
Width = 62
Caption = 'Resolution'
ParentColor = False
end
object cbPaperSize: TComboBox
Left = 131
Height = 25
Top = 11
Width = 309
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
Left = 130
Height = 27
Top = 9
Width = 310
AutoComplete = False
DropDownCount = 10
MaxLength = 0
ItemHeight = 0
ItemWidth = 0
OnKeyPress = cbPaperSizeKEYPRESS
ParentCtl3D = False
Style = csDropDownList
TabOrder = 0
end
object cbPaperType: TComboBox
Left = 131
Height = 25
Top = 47
Width = 309
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
MaxLength = 0
Left = 130
Height = 27
Top = 45
Width = 310
AutoComplete = False
ItemHeight = 0
ItemWidth = 0
OnKeyPress = cbPaperSizeKEYPRESS
ParentCtl3D = False
Style = csDropDownList
TabOrder = 1
end
object cbPaperSrc: TComboBox
Left = 131
Height = 25
Left = 130
Height = 27
Top = 81
Width = 309
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
MaxLength = 0
Width = 310
AutoComplete = False
ItemHeight = 0
ItemWidth = 0
OnKeyPress = cbPaperSizeKEYPRESS
ParentCtl3D = False
Style = csDropDownList
TabOrder = 4
end
object gbOrientation: TGroupBox
Left = 14
Left = 15
Height = 119
Top = 123
Top = 169
Width = 233
Caption = ' Orientation '
ClientHeight = 100
ClientHeight = 102
ClientWidth = 229
ParentCtl3D = False
TabOrder = 6
object imgOrientation: TImage
Left = 167
Height = 48
Top = 25
Width = 52
Transparent = False
end
object rbPortrait: TRadioButton
Left = 7
Height = 22
Height = 21
Top = 5
Width = 71
Width = 65
AllowGrayed = True
Caption = 'Portrait'
Checked = True
@ -151,60 +159,61 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
end
object rbLandscape: TRadioButton
Left = 7
Height = 22
Height = 21
Top = 29
Width = 93
Width = 86
AllowGrayed = True
Caption = 'Landscape'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 1
TabStop = False
end
object rbrev_Landscape: TRadioButton
Left = 7
Height = 22
Height = 21
Top = 53
Width = 143
Width = 132
AllowGrayed = True
Caption = 'Reverse landscape'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 2
TabStop = False
end
object rbrev_portrait: TRadioButton
Left = 7
Height = 22
Height = 21
Top = 77
Width = 125
Width = 113
AllowGrayed = True
Caption = 'Reverse portrait'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 3
TabStop = False
end
end
object gbDuplex: TGroupBox
Left = 255
Left = 256
Height = 119
Top = 123
Top = 169
Width = 185
Caption = ' Duplex printing '
ClientHeight = 100
ClientHeight = 102
ClientWidth = 181
ParentCtl3D = False
TabOrder = 2
object imgDuplex: TImage
Left = 126
Height = 52
Top = 21
Width = 44
Transparent = False
end
object rbDuplexNone: TRadioButton
Left = 14
Height = 22
Height = 21
Top = 5
Width = 58
Width = 53
AllowGrayed = True
Caption = 'None'
Checked = True
@ -215,100 +224,99 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
end
object rbDuplexLong: TRadioButton
Left = 14
Height = 22
Height = 21
Top = 29
Width = 91
Width = 83
AllowGrayed = True
Caption = 'Long edge'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 1
TabStop = False
end
object rbDuplexShort: TRadioButton
Left = 14
Height = 22
Height = 21
Top = 53
Width = 95
Width = 86
AllowGrayed = True
Caption = 'Short edge'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 2
TabStop = False
end
end
object gbBanners: TGroupBox
Left = 15
Left = 16
Height = 96
Top = 247
Top = 293
Width = 232
Caption = ' Banners '
ClientHeight = 77
ClientHeight = 79
ClientWidth = 228
ParentCtl3D = False
TabOrder = 3
object labBanStart: TLabel
Left = 6
Height = 13
Height = 16
Top = 9
Width = 26
Width = 29
Caption = 'Start'
ParentColor = False
end
object labBanEnd: TLabel
Left = 6
Height = 13
Height = 16
Top = 49
Width = 23
Width = 24
Caption = 'End'
ParentColor = False
end
object cbBanStart: TComboBox
Left = 94
Height = 25
Height = 27
Top = 1
Width = 128
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
MaxLength = 0
AutoComplete = False
ItemHeight = 0
ItemWidth = 0
OnKeyPress = cbPaperSizeKEYPRESS
ParentCtl3D = False
Style = csDropDownList
TabOrder = 0
end
object cbBanEnd: TComboBox
Left = 94
Height = 25
Height = 27
Top = 41
Width = 128
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
MaxLength = 0
AutoComplete = False
ItemHeight = 0
ItemWidth = 0
OnKeyPress = cbPaperSizeKEYPRESS
ParentCtl3D = False
Style = csDropDownList
TabOrder = 1
end
end
object gbPagesSheet: TGroupBox
Left = 255
Left = 256
Height = 96
Top = 247
Top = 293
Width = 185
Caption = ' Pages per sheet '
ClientHeight = 77
ClientHeight = 79
ClientWidth = 181
ParentCtl3D = False
TabOrder = 5
object imgPageSheet: TImage
Left = 78
Height = 50
Top = 17
Width = 80
Transparent = False
end
object rbSheet1: TRadioButton
Left = 6
Height = 22
Height = 21
Top = 5
Width = 32
Width = 30
AllowGrayed = True
Caption = '1'
Checked = True
@ -319,27 +327,41 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
end
object rbSheet2: TRadioButton
Left = 6
Height = 22
Height = 21
Top = 25
Width = 32
Width = 30
AllowGrayed = True
Caption = '2'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 1
TabStop = False
end
object rbSheet4: TRadioButton
Left = 6
Height = 22
Height = 21
Top = 46
Width = 32
Width = 30
AllowGrayed = True
Caption = '4'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 2
TabStop = False
end
end
object cbResolution: TComboBox
Left = 130
Height = 27
Top = 117
Width = 310
AutoComplete = False
ItemHeight = 0
ItemWidth = 0
OnKeyPress = cbPaperSizeKEYPRESS
Style = csDropDownList
TabOrder = 7
end
end
object pgMarge: TPage
Caption = 'Borders'

View File

@ -1,95 +1,95 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('Tdlgpropertiesprinter','FORMDATA',[
'TPF0'#21'Tdlgpropertiesprinter'#20'dlgpropertiesprinter'#4'Left'#3'M'#1#6'He'
+'ight'#3#161#1#3'Top'#2'o'#5'Width'#3#201#1#18'HorzScrollBar.Page'#3#200#1#18
+'VertScrollBar.Page'#3#160#1#13'ActiveControl'#7#15'PagesProperties'#7'Capti'
+'on'#6#18'Printer properties'#12'ClientHeight'#3#161#1#11'ClientWidth'#3#201
+#1#8'OnCreate'#7#26'dlgpropertiesprinterCREATE'#9'OnDestroy'#7#11'FormDestro'
+'y'#6'OnShow'#7#24'dlgpropertiesprinterSHOW'#0#6'TPanel'#6'Panel1'#6'Height'
+#2')'#3'Top'#3'x'#1#5'Width'#3#201#1#5'Align'#7#8'alBottom'#7'Anchors'#11#6
+'akLeft'#8'akBottom'#0#12'ClientHeight'#2')'#11'ClientWidth'#3#201#1#11'Full'
+'Repaint'#8#8'TabOrder'#2#0#7'TabStop'#9#0#7'TButton'#10'btnCancel1'#4'Left'
+#3'`'#1#6'Height'#2#25#3'Top'#2#8#5'Width'#2'['#7'Anchors'#11#5'akTop'#7'akR'
+'ight'#0#25'BorderSpacing.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6'Cancel'
+#11'ModalResult'#2#2#8'TabOrder'#2#0#0#0#7'TButton'#5'btnOk'#4'Left'#3#255#0
+#6'Height'#2#25#3'Top'#2#8#5'Width'#2'['#7'Anchors'#11#5'akTop'#7'akRight'#0
+#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#2'Ok'#7'Default'#9#11'ModalR'
+'esult'#2#1#8'TabOrder'#2#1#0#0#0#9'TNotebook'#15'PagesProperties'#6'Height'
+#3'x'#1#5'Width'#3#201#1#5'Align'#7#8'alClient'#9'PageIndex'#2#1#8'TabOrder'
+#2#1#0#5'TPage'#9'pgGeneral'#7'Caption'#6#7'General'#11'ClientWidth'#3#197#1
+#12'ClientHeight'#3'Y'#1#0#6'TLabel'#12'labPaperSize'#4'Left'#2#15#6'Height'
+#2#20#3'Top'#2#19#5'Width'#2'B'#7'Caption'#6#10'Paper size'#11'ParentColor'#8
+#0#0#6'TLabel'#12'labPaperType'#4'Left'#2#15#6'Height'#2#20#3'Top'#2'7'#5'Wi'
+'dth'#2'E'#7'Caption'#6#10'Paper type'#11'ParentColor'#8#0#0#6'TLabel'#11'la'
+'bPaperSrc'#4'Left'#2#15#6'Height'#2#20#3'Top'#2'\'#5'Width'#2'T'#7'Caption'
+#6#12'Paper source'#11'ParentColor'#8#0#0#9'TComboBox'#11'cbPaperSize'#4'Lef'
+'t'#3#131#0#6'Height'#2#25#3'Top'#2#11#5'Width'#3'5'#1#16'AutoCompleteText'
+#11#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0#13'DropDownCount'#2
+#10#9'MaxLength'#2#0#10'OnKeyPress'#7#19'cbPaperSizeKEYPRESS'#11'ParentCtl3D'
+#8#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#9'TComboBox'#11'cbPaper'
+'Type'#4'Left'#3#131#0#6'Height'#2#25#3'Top'#2'/'#5'Width'#3'5'#1#16'AutoCom'
+'pleteText'#11#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0#9'MaxLe'
+'ngth'#2#0#10'OnKeyPress'#7#19'cbPaperSizeKEYPRESS'#11'ParentCtl3D'#8#5'Styl'
+'e'#7#14'csDropDownList'#8'TabOrder'#2#1#0#0#9'TComboBox'#10'cbPaperSrc'#4'L'
+'eft'#3#131#0#6'Height'#2#25#3'Top'#2'Q'#5'Width'#3'5'#1#16'AutoCompleteText'
+#11#22'cbactEndOfLineComplete'#20'cbactSearchAscending'#0#9'MaxLength'#2#0#10
+'OnKeyPress'#7#19'cbPaperSizeKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDro'
+'pDownList'#8'TabOrder'#2#4#0#0#9'TGroupBox'#13'gbOrientation'#4'Left'#2#14#6
+'Height'#2'w'#3'Top'#2'{'#5'Width'#3#233#0#7'Caption'#6#13' Orientation '#12
+'ClientHeight'#2'd'#11'ClientWidth'#3#229#0#11'ParentCtl3D'#8#8'TabOrder'#2#6
+#0#6'TImage'#14'imgOrientation'#4'Left'#3#167#0#6'Height'#2'0'#3'Top'#2#25#5
+'Width'#2'4'#11'Transparent'#8#0#0#12'TRadioButton'#10'rbPortrait'#4'Left'#2
+#7#6'Height'#2#22#3'Top'#2#5#5'Width'#2'G'#11'AllowGrayed'#9#7'Caption'#6#8
+'Portrait'#7'Checked'#9#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPort'
+'raitCLICK'#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#12'TRadioButton'#11
+'rbLandscape'#4'Left'#2#7#6'Height'#2#22#3'Top'#2#29#5'Width'#2']'#11'AllowG'
+'rayed'#9#7'Caption'#6#9'Landscape'#10'DragCursor'#7#9'crDefault'#7'OnClick'
+#7#15'rbPortraitCLICK'#8'TabOrder'#2#1#0#0#12'TRadioButton'#15'rbrev_Landsca'
+'pe'#4'Left'#2#7#6'Height'#2#22#3'Top'#2'5'#5'Width'#3#143#0#11'AllowGrayed'
+#9#7'Caption'#6#17'Reverse landscape'#10'DragCursor'#7#9'crDefault'#7'OnClic'
+'k'#7#15'rbPortraitCLICK'#8'TabOrder'#2#2#0#0#12'TRadioButton'#14'rbrev_port'
+'rait'#4'Left'#2#7#6'Height'#2#22#3'Top'#2'M'#5'Width'#2'}'#11'AllowGrayed'#9
+#7'Caption'#6#16'Reverse portrait'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7
+#15'rbPortraitCLICK'#8'TabOrder'#2#3#0#0#0#9'TGroupBox'#8'gbDuplex'#4'Left'#3
+#255#0#6'Height'#2'w'#3'Top'#2'{'#5'Width'#3#185#0#7'Caption'#6#17' Duplex p'
+'rinting '#12'ClientHeight'#2'd'#11'ClientWidth'#3#181#0#11'ParentCtl3D'#8#8
+'TabOrder'#2#2#0#6'TImage'#9'imgDuplex'#4'Left'#2'~'#6'Height'#2'4'#3'Top'#2
+#21#5'Width'#2','#11'Transparent'#8#0#0#12'TRadioButton'#12'rbDuplexNone'#4
+'Left'#2#14#6'Height'#2#22#3'Top'#2#5#5'Width'#2':'#11'AllowGrayed'#9#7'Capt'
+'ion'#6#4'None'#7'Checked'#9#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'r'
+'bPortraitCLICK'#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#12'TRadioButton'
+#12'rbDuplexLong'#4'Left'#2#14#6'Height'#2#22#3'Top'#2#29#5'Width'#2'['#11'A'
+'llowGrayed'#9#7'Caption'#6#9'Long edge'#10'DragCursor'#7#9'crDefault'#7'OnC'
+'lick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#1#0#0#12'TRadioButton'#13'rbDuple'
+'xShort'#4'Left'#2#14#6'Height'#2#22#3'Top'#2'5'#5'Width'#2'_'#11'AllowGraye'
+'d'#9#7'Caption'#6#10'Short edge'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7
+#15'rbPortraitCLICK'#8'TabOrder'#2#2#0#0#0#9'TGroupBox'#9'gbBanners'#4'Left'
,#2#15#6'Height'#2'`'#3'Top'#3#247#0#5'Width'#3#232#0#7'Caption'#6#9' Banners'
+' '#12'ClientHeight'#2'M'#11'ClientWidth'#3#228#0#11'ParentCtl3D'#8#8'TabOrd'
+'er'#2#3#0#6'TLabel'#11'labBanStart'#4'Left'#2#6#6'Height'#2#13#3'Top'#2#9#5
+'Width'#2#26#7'Caption'#6#5'Start'#11'ParentColor'#8#0#0#6'TLabel'#9'labBanE'
+'nd'#4'Left'#2#6#6'Height'#2#13#3'Top'#2'1'#5'Width'#2#23#7'Caption'#6#3'End'
+#11'ParentColor'#8#0#0#9'TComboBox'#10'cbBanStart'#4'Left'#2'^'#6'Height'#2
+#25#3'Top'#2#1#5'Width'#3#128#0#16'AutoCompleteText'#11#22'cbactEndOfLineCom'
+'plete'#20'cbactSearchAscending'#0#9'MaxLength'#2#0#10'OnKeyPress'#7#19'cbPa'
+'perSizeKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'
+#2#0#0#0#9'TComboBox'#8'cbBanEnd'#4'Left'#2'^'#6'Height'#2#25#3'Top'#2')'#5
+'Width'#3#128#0#16'AutoCompleteText'#11#22'cbactEndOfLineComplete'#20'cbactS'
+'earchAscending'#0#9'MaxLength'#2#0#10'OnKeyPress'#7#19'cbPaperSizeKEYPRESS'
+#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#1#0#0#0#9'TGr'
+'oupBox'#12'gbPagesSheet'#4'Left'#3#255#0#6'Height'#2'`'#3'Top'#3#247#0#5'Wi'
+'dth'#3#185#0#7'Caption'#6#17' Pages per sheet '#12'ClientHeight'#2'M'#11'Cl'
+'ientWidth'#3#181#0#11'ParentCtl3D'#8#8'TabOrder'#2#5#0#6'TImage'#12'imgPage'
+'Sheet'#4'Left'#2'N'#6'Height'#2'2'#3'Top'#2#17#5'Width'#2'P'#11'Transparent'
+#8#0#0#12'TRadioButton'#8'rbSheet1'#4'Left'#2#6#6'Height'#2#22#3'Top'#2#5#5
+'Width'#2' '#11'AllowGrayed'#9#7'Caption'#6#1'1'#7'Checked'#9#10'DragCursor'
+#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#5'State'#7#9'cbChecked'#8'T'
+'abOrder'#2#0#0#0#12'TRadioButton'#8'rbSheet2'#4'Left'#2#6#6'Height'#2#22#3
+'Top'#2#25#5'Width'#2' '#11'AllowGrayed'#9#7'Caption'#6#1'2'#10'DragCursor'#7
+#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#1#0#0#12'TRadio'
+'Button'#8'rbSheet4'#4'Left'#2#6#6'Height'#2#22#3'Top'#2'.'#5'Width'#2' '#11
+'AllowGrayed'#9#7'Caption'#6#1'4'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7
+#15'rbPortraitCLICK'#8'TabOrder'#2#2#0#0#0#0#5'TPage'#7'pgMarge'#7'Caption'#6
+#7'Borders'#0#0#0#0
'TPF0'#21'Tdlgpropertiesprinter'#20'dlgpropertiesprinter'#4'Left'#3#228#0#6'H'
+'eight'#3#208#1#3'Top'#2'?'#5'Width'#3#201#1#13'ActiveControl'#7#15'PagesPro'
+'perties'#7'Caption'#6#18'Printer properties'#12'ClientHeight'#3#208#1#11'Cl'
+'ientWidth'#3#201#1#8'OnCreate'#7#26'dlgpropertiesprinterCREATE'#9'OnDestroy'
+#7#11'FormDestroy'#6'OnShow'#7#24'dlgpropertiesprinterSHOW'#10'LCLVersion'#6
+#6'0.9.27'#0#6'TPanel'#6'Panel1'#4'Left'#2#0#6'Height'#2')'#3'Top'#3#167#1#5
+'Width'#3#201#1#5'Align'#7#8'alBottom'#7'Anchors'#11#6'akLeft'#8'akBottom'#0
+#12'ClientHeight'#2')'#11'ClientWidth'#3#201#1#11'FullRepaint'#8#8'TabOrder'
+#2#0#7'TabStop'#9#0#7'TButton'#10'btnCancel1'#4'Left'#3'`'#1#6'Height'#2#25#3
+'Top'#2#8#5'Width'#2'['#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing'
+'.InnerBorder'#2#4#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8
+'TabOrder'#2#0#0#0#7'TButton'#5'btnOk'#4'Left'#3#255#0#6'Height'#2#25#3'Top'
+#2#8#5'Width'#2'['#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.Inne'
+'rBorder'#2#4#7'Caption'#6#2'Ok'#7'Default'#9#11'ModalResult'#2#1#8'TabOrder'
+#2#1#0#0#0#9'TNotebook'#15'PagesProperties'#4'Left'#2#0#6'Height'#3#167#1#3
+'Top'#2#0#5'Width'#3#201#1#5'Align'#7#8'alClient'#9'PageIndex'#2#0#8'TabOrde'
+'r'#2#1#0#5'TPage'#9'pgGeneral'#7'Caption'#6#7'General'#11'ClientWidth'#3#197
+#1#12'ClientHeight'#3#138#1#0#6'TLabel'#12'labPaperSize'#4'Left'#2#15#6'Heig'
+'ht'#2#16#3'Top'#2#19#5'Width'#2'?'#7'Caption'#6#10'Paper size'#11'ParentCol'
+'or'#8#0#0#6'TLabel'#12'labPaperType'#4'Left'#2#15#6'Height'#2#16#3'Top'#2'7'
+#5'Width'#2'@'#7'Caption'#6#10'Paper type'#11'ParentColor'#8#0#0#6'TLabel'#11
+'labPaperSrc'#4'Left'#2#15#6'Height'#2#16#3'Top'#2'\'#5'Width'#2'N'#7'Captio'
+'n'#6#12'Paper source'#11'ParentColor'#8#0#0#6'TLabel'#13'labResolution'#4'L'
+'eft'#2#15#6'Height'#2#16#3'Top'#2'}'#5'Width'#2'>'#7'Caption'#6#10'Resoluti'
+'on'#11'ParentColor'#8#0#0#9'TComboBox'#11'cbPaperSize'#4'Left'#3#130#0#6'He'
+'ight'#2#27#3'Top'#2#9#5'Width'#3'6'#1#12'AutoComplete'#8#13'DropDownCount'#2
+#10#10'ItemHeight'#2#0#9'ItemWidth'#2#0#10'OnKeyPress'#7#19'cbPaperSizeKEYPR'
+'ESS'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#9'TComboBox'#11'cbPa'
+'perType'#4'Left'#3#130#0#6'Height'#2#27#3'Top'#2'-'#5'Width'#3'6'#1#12'Auto'
+'Complete'#8#10'ItemHeight'#2#0#9'ItemWidth'#2#0#10'OnKeyPress'#7#19'cbPaper'
+'SizeKEYPRESS'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#1#0#0#9'TComboBox'
+#10'cbPaperSrc'#4'Left'#3#130#0#6'Height'#2#27#3'Top'#2'Q'#5'Width'#3'6'#1#12
+'AutoComplete'#8#10'ItemHeight'#2#0#9'ItemWidth'#2#0#10'OnKeyPress'#7#19'cbP'
+'aperSizeKEYPRESS'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#4#0#0#9'TGrou'
+'pBox'#13'gbOrientation'#4'Left'#2#15#6'Height'#2'w'#3'Top'#3#169#0#5'Width'
+#3#233#0#7'Caption'#6#13' Orientation '#12'ClientHeight'#2'f'#11'ClientWidth'
+#3#229#0#8'TabOrder'#2#6#0#6'TImage'#14'imgOrientation'#4'Left'#3#167#0#6'He'
+'ight'#2'0'#3'Top'#2#25#5'Width'#2'4'#0#0#12'TRadioButton'#10'rbPortrait'#4
+'Left'#2#7#6'Height'#2#21#3'Top'#2#5#5'Width'#2'A'#11'AllowGrayed'#9#7'Capti'
+'on'#6#8'Portrait'#7'Checked'#9#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15
+'rbPortraitCLICK'#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#12'TRadioButto'
+'n'#11'rbLandscape'#4'Left'#2#7#6'Height'#2#21#3'Top'#2#29#5'Width'#2'V'#11
+'AllowGrayed'#9#7'Caption'#6#9'Landscape'#10'DragCursor'#7#9'crDefault'#7'On'
+'Click'#7#15'rbPortraitCLICK'#8'TabOrder'#2#1#7'TabStop'#8#0#0#12'TRadioButt'
+'on'#15'rbrev_Landscape'#4'Left'#2#7#6'Height'#2#21#3'Top'#2'5'#5'Width'#3
+#132#0#11'AllowGrayed'#9#7'Caption'#6#17'Reverse landscape'#10'DragCursor'#7
+#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#2#7'TabStop'#8#0
+#0#12'TRadioButton'#14'rbrev_portrait'#4'Left'#2#7#6'Height'#2#21#3'Top'#2'M'
+#5'Width'#2'q'#11'AllowGrayed'#9#7'Caption'#6#16'Reverse portrait'#10'DragCu'
+'rsor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#3#7'Tab'
+'Stop'#8#0#0#0#9'TGroupBox'#8'gbDuplex'#4'Left'#3#0#1#6'Height'#2'w'#3'Top'#3
+#169#0#5'Width'#3#185#0#7'Caption'#6#17' Duplex printing '#12'ClientHeight'#2
+'f'#11'ClientWidth'#3#181#0#8'TabOrder'#2#2#0#6'TImage'#9'imgDuplex'#4'Left'
+#2'~'#6'Height'#2'4'#3'Top'#2#21#5'Width'#2','#0#0#12'TRadioButton'#12'rbDup'
+'lexNone'#4'Left'#2#14#6'Height'#2#21#3'Top'#2#5#5'Width'#2'5'#11'AllowGraye'
+'d'#9#7'Caption'#6#4'None'#7'Checked'#9#10'DragCursor'#7#9'crDefault'#7'OnCl'
+'ick'#7#15'rbPortraitCLICK'#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#0#0#12'T'
+'RadioButton'#12'rbDuplexLong'#4'Left'#2#14#6'Height'#2#21#3'Top'#2#29#5'Wid'
+'th'#2'S'#11'AllowGrayed'#9#7'Caption'#6#9'Long edge'#10'DragCursor'#7#9'crD'
+'efault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#1#7'TabStop'#8#0#0#12
+'TRadioButton'#13'rbDuplexShort'#4'Left'#2#14#6'Height'#2#21#3'Top'#2'5'#5'W'
+'idth'#2'V'#11'AllowGrayed'#9#7'Caption'#6#10'Short edge'#10'DragCursor'#7#9
+'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#2#7'TabStop'#8#0#0
+#0#9'TGroupBox'#9'gbBanners'#4'Left'#2#16#6'Height'#2'`'#3'Top'#3'%'#1#5'Wid'
,'th'#3#232#0#7'Caption'#6#9' Banners '#12'ClientHeight'#2'O'#11'ClientWidth'
+#3#228#0#8'TabOrder'#2#3#0#6'TLabel'#11'labBanStart'#4'Left'#2#6#6'Height'#2
+#16#3'Top'#2#9#5'Width'#2#29#7'Caption'#6#5'Start'#11'ParentColor'#8#0#0#6'T'
+'Label'#9'labBanEnd'#4'Left'#2#6#6'Height'#2#16#3'Top'#2'1'#5'Width'#2#24#7
+'Caption'#6#3'End'#11'ParentColor'#8#0#0#9'TComboBox'#10'cbBanStart'#4'Left'
+#2'^'#6'Height'#2#27#3'Top'#2#1#5'Width'#3#128#0#12'AutoComplete'#8#10'ItemH'
+'eight'#2#0#9'ItemWidth'#2#0#10'OnKeyPress'#7#19'cbPaperSizeKEYPRESS'#5'Styl'
+'e'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#9'TComboBox'#8'cbBanEnd'#4'Left'
+#2'^'#6'Height'#2#27#3'Top'#2')'#5'Width'#3#128#0#12'AutoComplete'#8#10'Item'
+'Height'#2#0#9'ItemWidth'#2#0#10'OnKeyPress'#7#19'cbPaperSizeKEYPRESS'#5'Sty'
+'le'#7#14'csDropDownList'#8'TabOrder'#2#1#0#0#0#9'TGroupBox'#12'gbPagesSheet'
+#4'Left'#3#0#1#6'Height'#2'`'#3'Top'#3'%'#1#5'Width'#3#185#0#7'Caption'#6#17
+' Pages per sheet '#12'ClientHeight'#2'O'#11'ClientWidth'#3#181#0#8'TabOrder'
+#2#5#0#6'TImage'#12'imgPageSheet'#4'Left'#2'N'#6'Height'#2'2'#3'Top'#2#17#5
+'Width'#2'P'#0#0#12'TRadioButton'#8'rbSheet1'#4'Left'#2#6#6'Height'#2#21#3'T'
+'op'#2#5#5'Width'#2#30#11'AllowGrayed'#9#7'Caption'#6#1'1'#7'Checked'#9#10'D'
+'ragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#5'State'#7#9'cbC'
+'hecked'#8'TabOrder'#2#0#0#0#12'TRadioButton'#8'rbSheet2'#4'Left'#2#6#6'Heig'
+'ht'#2#21#3'Top'#2#25#5'Width'#2#30#11'AllowGrayed'#9#7'Caption'#6#1'2'#10'D'
+'ragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#1#7
+'TabStop'#8#0#0#12'TRadioButton'#8'rbSheet4'#4'Left'#2#6#6'Height'#2#21#3'To'
+'p'#2'.'#5'Width'#2#30#11'AllowGrayed'#9#7'Caption'#6#1'4'#10'DragCursor'#7#9
+'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#2#7'TabStop'#8#0#0
+#0#9'TComboBox'#12'cbResolution'#4'Left'#3#130#0#6'Height'#2#27#3'Top'#2'u'#5
+'Width'#3'6'#1#12'AutoComplete'#8#10'ItemHeight'#2#0#9'ItemWidth'#2#0#10'OnK'
+'eyPress'#7#19'cbPaperSizeKEYPRESS'#5'Style'#7#14'csDropDownList'#8'TabOrder'
+#2#7#0#0#0#5'TPage'#7'pgMarge'#7'Caption'#6#7'Borders'#0#0#0#0
]);

View File

@ -45,6 +45,7 @@ type
btnCancel1: TBUTTON;
btnOk: TBUTTON;
cbPaperSize: TCOMBOBOX;
cbResolution: TComboBox;
cbPaperType: TCOMBOBOX;
cbPaperSrc: TCOMBOBOX;
cbBanStart: TCOMBOBOX;
@ -59,6 +60,7 @@ type
labBanStart: TLABEL;
labBanEnd: TLABEL;
labPaperSrc: TLABEL;
labResolution: TLabel;
labPaperType: TLABEL;
labPaperSize: TLABEL;
PagesProperties: TNOTEBOOK;
@ -82,7 +84,8 @@ type
procedure dlgpropertiesprinterSHOW(Sender: TObject);
private
{ private declarations }
fPaperSizeOptions,FMediaTypeOptions,FInputSlotOptions: TStringList;
fPaperSizeOptions,FMediaTypeOptions,FInputSlotOptions,
FResolutions: TStringList;
procedure RefreshInfos;
@ -131,7 +134,7 @@ end;
//Initialization
procedure Tdlgpropertiesprinter.dlgpropertiesprinterCREATE(Sender: TObject);
Var Lst : TStringList;
i : Integer;
i,j : Integer;
pOr : TPrinterOrientation;
St : String;
begin
@ -142,10 +145,13 @@ begin
FPaperSizeOptions := TStringList.Create;
FMediaTypeOptions := TStringlist.Create;
FInputSlotOptions := TStringList.Create;
FResolutions := TStringList.Create;
InitCombo(cbPaperSize,'PageSize',Printer.PaperSize.PaperName, FPaperSizeOptions);
InitCombo(cbPaperType,'MediaType','Plain Paper',FMediaTypeOptions);
InitCombo(cbPaperSrc ,'InputSlot','Auto Sheet Feeder',FInputSlotOptions);
st := THackCUPSPrinter(Printer).GetResolutionOption;
InitCombo(cbResolution,'Resolution', st, FResolutions);
Lst:=TStringList.Create;
try
@ -218,6 +224,7 @@ end;
procedure Tdlgpropertiesprinter.FormDestroy(Sender: TObject);
begin
if Sender=nil then ;
FResolutions.Free;
FPaperSizeOptions.Free;
FMediaTypeOptions.Free;
FInputSlotOptions.Free;
@ -277,6 +284,11 @@ begin
THackCUPSPrinter(Printer).FreeOptions;
THackCUPSPrinter(Printer).SetOptionsOfPrinter;
//Resolution
if (cbResolution.Items.Count>0) and (cbResolution.ItemIndex<>cbResolution.Tag) then
THackCUPSPrinter(Printer).cupsAddOption('Resolution',
fResolutions[cbResolution.ItemIndex]);
//PageSize
if (cbPaperSize.Items.Count>0) and (cbPaperSize.ItemIndex<>cbPaperSize.Tag) then
begin
@ -294,7 +306,6 @@ begin
if (cbPaperSrc.Items.Count>0) and (cbPaperSrc.ItemIndex<>cbPaperSrc.Tag) then
THackCUPSPrinter(Printer).cupsAddOption('InputSlot',
FInputSlotOptions[cbPaperSrc.ItemIndex]);
//Duplex
if gbDuplex.Enabled then