Fixes issues #1443,#1445 and TPageSetupDialog from Boguslaw Brandys

git-svn-id: trunk@8250 -
This commit is contained in:
jesus 2005-12-03 21:45:49 +00:00
parent 8e4c244804
commit 205d76944f
25 changed files with 1519 additions and 671 deletions

2
.gitattributes vendored
View File

@ -153,6 +153,7 @@ components/prettyformat/ptopu.pp svneol=native#text/plain
components/printers/linux/cupsdyn.pp svneol=native#text/pascal
components/printers/linux/cupsprinters.inc svneol=native#text/pascal
components/printers/linux/cupsprinters_h.inc svneol=native#text/pascal
components/printers/linux/cupsprndialogs.inc svneol=native#text/pascal
components/printers/linux/jobsimglist.lrs svneol=native#text/pascal
components/printers/linux/printerprop.lrs svneol=native#text/pascal
components/printers/linux/selectprinter.lrs svneol=native#text/pascal
@ -178,6 +179,7 @@ components/printers/sample/selectprinter.lpi svneol=native#text/plain
components/printers/sample/selectprinter.lpr svneol=native#text/pascal
components/printers/win32/winprinters.inc svneol=native#text/pascal
components/printers/win32/winprinters_h.inc svneol=native#text/pascal
components/printers/win32/winprndialogs.inc svneol=native#text/pascal
components/printers/win32/winutilprn.pas svneol=native#text/pascal
components/printers/win32/winutilprnconst.inc svneol=native#text/pascal
components/projecttemplates/README svneol=native#text/plain

View File

@ -1201,6 +1201,8 @@ begin
end;
end;
//WriteLn('CupsLibHandle=', CupsLibHandle);
//
//cups_language.pp
//

View File

@ -260,7 +260,7 @@ begin
begin
if Assigned(fcupsPrinter) then
begin
Opts:=fcupsPrinter^.options;
Opts := fcupsPrinter^.Options;
for i:=0 to fcupsPrinter^.num_options-1 do
begin
Opt:=@Opts[i];
@ -272,7 +272,7 @@ end;
//Enum all options associed with aKeyWord
function TCUPSPrinter.EnumPPDChoice(Lst : TStrings;
const aKeyWord : string) : Integer;
const aKeyWord : string; OptNames: TStrings = nil) : Integer;
var i : integer;
Option : Pppd_option_t;
Choice : Pppd_choice_t;
@ -300,11 +300,16 @@ begin
Result:=i;
Lst.Add(Choice^.text);
if Assigned(OptNames) then
OptNames.Add(Choice^.choice);
end;
//Not marked choise then the choice is default
if (Result<0) and (Lst.Count>0) then
if (Result<0) and (Lst.Count>0) then begin
Result:=Lst.IndexOf(OPtion^.defchoice);
if (Result<0)and Assigned(OptNames) then
Result := OptNames.IndexOf(Option^.DefChoice);
end;
end;
end;
end;
@ -444,7 +449,7 @@ begin
TPostscriptPrinterCanvas(Canvas).OutputFileName:=NewOutputFileName;
end;
//If not aborded, send PostScript file to printer.
//If not aborted, send PostScript file to printer.
//After, delete this file.
procedure TCUPSPrinter.DoEndDoc(aAborded: Boolean);
begin
@ -478,8 +483,10 @@ begin
end;
FreeOptions;
if Assigned(fcupsPrinters) and CUPSLibInstalled then
if Assigned(fcupsPrinters) and CUPSLibInstalled then begin
cupsFreeDests(Printers.Count,fcupsPrinters);
fCupsPrinter := nil;
end;
end;
procedure TCUPSPrinter.DoEnumPrinters(Lst: TStrings);
@ -511,6 +518,13 @@ begin
GetEnumAttributeString('media-supported',Lst);
end;
procedure TCUPSPrinter.DoInitialization;
begin
//printer list has been obtained
if Printers.Count > 0 then
SelectCurrentPrinterOrDefault;
end;
function TCUPSPrinter.DoSetPrinter(aName: string): Integer;
Var i : Integer;
P : Pcups_dest_t;

View File

@ -66,6 +66,8 @@ type
);
TCUPSPrinterStates = set of TCUPSPrinterState;
{ TCUPSPrinter }
TCUPSPrinter = Class(TPrinter)
private
fcupsPrinters: Pcups_dest_t; //Printers avaible
@ -99,6 +101,7 @@ type
procedure DoEnumPrinters(Lst : TStrings); override;
procedure DoEnumPapers(Lst : TStrings); override;
procedure DoInitialization; override;
function DoSetPrinter(aName : string): Integer; override;
function DoGetCopies : Integer; override;
procedure DoSetCopies(aValue : Integer); override;
@ -127,7 +130,8 @@ type
function GetAttributeInteger(aName : PChar;DefaultValue : Integer) : Integer;
function GetAttributeString(aName: PChar; const DefaultValue : string): string;
function GetAttributeBoolean(aName : PChar; DefaultValue : Boolean) : Boolean;
function EnumPPDChoice(Lst : TStrings; const aKeyWord : string) : Integer;
function EnumPPDChoice(Lst : TStrings; const aKeyWord : string;
OptNames: TStrings = nil) : Integer;
procedure cupsAddOption(aName,aValue: string);
function cupsGetOption(aKeyWord: string): String;

View File

@ -0,0 +1,55 @@
uses Controls, udlgSelectPrinter,udlgpropertiesprinter, FileUtil;
{ TPrinterSetupDialog }
function TPrinterSetupDialog.Execute: Boolean;
Var Dlg : Tdlgpropertiesprinter;
begin
Dlg:=TdlgPropertiesPrinter.Create(nil);
try
Result:=(Dlg.ShowModal=mrOk);
if Result then
Dlg.InitProperties;
finally
Dlg.Free;
end;
end;
{ TPrintDialog }
function TPrintDialog.Execute: Boolean;
Var Dlg : TdlgSelectPrinter;
begin
Dlg:=TdlgSelectPrinter.Create(nil);
Dlg.Options := Self.Options;
Dlg.PrintRange := Self.PrintRange;
Dlg.cbCollate.Checked := Self.Collate;
if FromPage<1 then FromPage:=1;
if ToPage<FromPage then ToPage:=FromPage;
Dlg.edRange.Text := IntToStr(Self.FromPage) +'-'+ IntToStr(Self.ToPage);
case Dlg.PrintRange of
prAllPages: Dlg.rbAllPage.Checked := True;
prSelection: Dlg.rbSelection.Checked := True;
prPageNums: Dlg.rbRange.Checked := True;
prCurrentPage: Dlg.rbCurrentPage.Checked := True;
end;
try
Dlg.btnPreview.Visible:=False;
Result:=(Dlg.ShowModal=mrOk);
finally
Dlg.Free;
end;
end;
{ TPrintDialog }
function TPageSetupDialog.Execute: Boolean;
begin
Result := true;
end;

View File

@ -1,8 +1,10 @@
object dlgpropertiesprinter: Tdlgpropertiesprinter
ActiveControl = btnCancel1
Caption = 'Printer properties'
ClientHeight = 417
ClientWidth = 457
OnCreate = dlgpropertiesprinterCREATE
OnDestroy = FormDestroy
OnShow = dlgpropertiesprinterSHOW
PixelsPerInch = 75
HorzScrollBar.Page = 456
@ -14,7 +16,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
object Panel1: TPanel
Align = alBottom
Anchors = [akLeft, akBottom]
BorderSpacing.OnChange = nil
ClientHeight = 41
ClientWidth = 457
FullRepaint = False
@ -25,7 +26,7 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
Width = 457
object btnCancel1: TButton
Anchors = [akTop, akRight]
BorderSpacing.OnChange = nil
BorderSpacing.InnerBorder = 2
Cancel = True
Caption = 'Cancel'
ModalResult = 2
@ -37,7 +38,7 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
end
object btnOk: TButton
Anchors = [akTop, akRight]
BorderSpacing.OnChange = nil
BorderSpacing.InnerBorder = 2
Caption = 'Ok'
Default = True
ModalResult = 1
@ -50,7 +51,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
end
object PagesProperties: TNotebook
Align = alClient
BorderSpacing.OnChange = nil
PageIndex = 0
Height = 376
Width = 457
@ -62,34 +62,33 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
Top = 22
Width = 457
object labPaperSize: TLabel
BorderSpacing.OnChange = nil
Caption = 'Paper size'
Color = clNone
ParentColor = False
Left = 15
Height = 17
Height = 13
Top = 19
Width = 65
Width = 60
end
object labPaperType: TLabel
BorderSpacing.OnChange = nil
Caption = 'Paper type'
Color = clNone
ParentColor = False
Left = 15
Height = 17
Height = 13
Top = 55
Width = 65
Width = 62
end
object labPaperSrc: TLabel
BorderSpacing.OnChange = nil
Caption = 'Paper source'
Color = clNone
ParentColor = False
Left = 15
Height = 17
Height = 13
Top = 92
Width = 112
Width = 76
end
object cbPaperSize: TComboBox
BorderSpacing.OnChange = nil
DropDownCount = 10
MaxLength = 0
OnKeyPress = cbPaperSizeKEYPRESS
@ -102,7 +101,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
Width = 309
end
object cbPaperType: TComboBox
BorderSpacing.OnChange = nil
MaxLength = 0
OnKeyPress = cbPaperSizeKEYPRESS
ParentCtl3D = False
@ -114,7 +112,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
Width = 309
end
object cbPaperSrc: TComboBox
BorderSpacing.OnChange = nil
MaxLength = 0
OnKeyPress = cbPaperSizeKEYPRESS
ParentCtl3D = False
@ -126,11 +123,9 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
Width = 309
end
object gbOrientation: TGroupBox
BorderSpacing.OnChange = nil
Caption = ' Orientation '
ClientHeight = 102
ClientWidth = 229
ParentColor = True
ParentCtl3D = False
TabOrder = 6
Left = 14
@ -138,7 +133,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
Top = 123
Width = 233
object imgOrientation: TImage
BorderSpacing.OnChange = nil
Transparent = True
Left = 167
Height = 48
@ -147,7 +141,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
end
object rbPortrait: TRadioButton
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = 'Portrait'
Checked = True
DragCursor = crDefault
@ -155,53 +148,48 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
State = cbChecked
TabOrder = 0
Left = 7
Height = 20
Height = 24
Top = 5
Width = 64
Width = 63
end
object rbLandscape: TRadioButton
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = 'Landscape'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 1
Left = 7
Height = 20
Height = 24
Top = 29
Width = 87
Width = 86
end
object rbrev_Landscape: TRadioButton
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = 'Reverse landscape'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 2
Left = 7
Height = 20
Height = 24
Top = 53
Width = 133
Width = 132
end
object rbrev_portrait: TRadioButton
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = 'Reverse portrait'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 3
Left = 7
Height = 20
Height = 24
Top = 77
Width = 113
Width = 112
end
end
object gbDuplex: TGroupBox
BorderSpacing.OnChange = nil
Caption = ' Duplex printing '
ClientHeight = 102
ClientWidth = 181
ParentColor = True
ParentCtl3D = False
TabOrder = 2
Left = 255
@ -209,7 +197,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
Top = 123
Width = 185
object imgDuplex: TImage
BorderSpacing.OnChange = nil
Transparent = True
Left = 126
Height = 52
@ -218,7 +205,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
end
object rbDuplexNone: TRadioButton
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = 'None'
Checked = True
DragCursor = crDefault
@ -226,41 +212,37 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
State = cbChecked
TabOrder = 0
Left = 14
Height = 20
Height = 24
Top = 5
Width = 55
Width = 54
end
object rbDuplexLong: TRadioButton
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = 'Long edge'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 1
Left = 14
Height = 20
Height = 24
Top = 29
Width = 85
Width = 84
end
object rbDuplexShort: TRadioButton
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = 'Short edge'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 2
Left = 14
Height = 20
Height = 24
Top = 53
Width = 86
Width = 85
end
end
object gbBanners: TGroupBox
BorderSpacing.OnChange = nil
Caption = ' Banners '
ClientHeight = 79
ClientWidth = 228
ParentColor = True
ParentCtl3D = False
TabOrder = 3
Left = 15
@ -268,25 +250,24 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
Top = 247
Width = 232
object labBanStart: TLabel
BorderSpacing.OnChange = nil
Caption = 'Start'
Color = clNone
ParentColor = False
Left = 6
Height = 17
Height = 13
Top = 9
Width = 65
Width = 26
end
object labBanEnd: TLabel
BorderSpacing.OnChange = nil
Caption = 'End'
Color = clNone
ParentColor = False
Left = 6
Height = 17
Height = 13
Top = 49
Width = 65
Width = 23
end
object cbBanStart: TComboBox
BorderSpacing.OnChange = nil
MaxLength = 0
OnKeyPress = cbPaperSizeKEYPRESS
ParentCtl3D = False
@ -298,7 +279,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
Width = 128
end
object cbBanEnd: TComboBox
BorderSpacing.OnChange = nil
MaxLength = 0
OnKeyPress = cbPaperSizeKEYPRESS
ParentCtl3D = False
@ -311,11 +291,9 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
end
end
object gbPagesSheet: TGroupBox
BorderSpacing.OnChange = nil
Caption = ' Pages per sheet '
ClientHeight = 79
ClientWidth = 181
ParentColor = True
ParentCtl3D = False
TabOrder = 5
Left = 255
@ -323,7 +301,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
Top = 247
Width = 185
object imgPageSheet: TImage
BorderSpacing.OnChange = nil
Transparent = True
Left = 78
Height = 50
@ -332,7 +309,6 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
end
object rbSheet1: TRadioButton
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = '1'
Checked = True
DragCursor = crDefault
@ -340,33 +316,31 @@ object dlgpropertiesprinter: Tdlgpropertiesprinter
State = cbChecked
TabOrder = 0
Left = 6
Height = 20
Height = 24
Top = 5
Width = 42
Width = 31
end
object rbSheet2: TRadioButton
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = '2'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 1
Left = 6
Height = 20
Height = 24
Top = 25
Width = 42
Width = 31
end
object rbSheet4: TRadioButton
AllowGrayed = True
BorderSpacing.OnChange = nil
Caption = '4'
DragCursor = crDefault
OnClick = rbPortraitCLICK
TabOrder = 2
Left = 6
Height = 20
Height = 24
Top = 46
Width = 42
Width = 31
end
end
end

View File

@ -1,103 +1,93 @@
{ Ceci est un fichier ressource généré automatiquement par Lazarus }
LazarusResources.Add('Tdlgpropertiesprinter','FORMDATA',[
'TPF0'#21'Tdlgpropertiesprinter'#20'dlgpropertiesprinter'#7'Caption'#6#18'Pri'
+'nter properties'#12'ClientHeight'#3#161#1#11'ClientWidth'#3#201#1#8'OnCreat'
+'e'#7#26'dlgpropertiesprinterCREATE'#6'OnShow'#7#24'dlgpropertiesprinterSHOW'
+#13'PixelsPerInch'#2'K'#18'HorzScrollBar.Page'#3#200#1#18'VertScrollBar.Page'
+#3#160#1#4'Left'#3'M'#1#6'Height'#3#161#1#3'Top'#2'o'#5'Width'#3#201#1#0#6'T'
+'Panel'#6'Panel1'#5'Align'#7#8'alBottom'#7'Anchors'#11#6'akLeft'#8'akBottom'
+#0#22'BorderSpacing.OnChange'#13#12'ClientHeight'#2')'#11'ClientWidth'#3#201
+#1#11'FullRepaint'#8#8'TabOrder'#2#0#7'TabStop'#9#6'Height'#2')'#3'Top'#3'x'
+#1#5'Width'#3#201#1#0#7'TButton'#10'btnCancel1'#7'Anchors'#11#5'akTop'#7'akR'
+'ight'#0#22'BorderSpacing.OnChange'#13#6'Cancel'#9#7'Caption'#6#6'Cancel'#11
+'ModalResult'#2#2#8'TabOrder'#2#0#4'Left'#3'`'#1#6'Height'#2#25#3'Top'#2#8#5
+'Width'#2'['#0#0#7'TButton'#5'btnOk'#7'Anchors'#11#5'akTop'#7'akRight'#0#22
+'BorderSpacing.OnChange'#13#7'Caption'#6#2'Ok'#7'Default'#9#11'ModalResult'#2
+#1#8'TabOrder'#2#1#4'Left'#3#255#0#6'Height'#2#25#3'Top'#2#8#5'Width'#2'['#0
+#0#0#9'TNotebook'#15'PagesProperties'#5'Align'#7#8'alClient'#22'BorderSpacin'
+'g.OnChange'#13#9'PageIndex'#2#0#6'Height'#3'x'#1#5'Width'#3#201#1#0#5'TPage'
+#9'pgGeneral'#7'Caption'#6#7'General'#11'ClientWidth'#3#201#1#12'ClientHeigh'
+'t'#3'b'#1#6'Height'#3'b'#1#3'Top'#2#22#5'Width'#3#201#1#0#6'TLabel'#12'labP'
+'aperSize'#22'BorderSpacing.OnChange'#13#7'Caption'#6#10'Paper size'#5'Color'
+#7#6'clNone'#4'Left'#2#15#6'Height'#2#17#3'Top'#2#19#5'Width'#2'A'#0#0#6'TLa'
+'bel'#12'labPaperType'#22'BorderSpacing.OnChange'#13#7'Caption'#6#10'Paper t'
+'ype'#5'Color'#7#6'clNone'#4'Left'#2#15#6'Height'#2#17#3'Top'#2'7'#5'Width'#2
+'A'#0#0#6'TLabel'#11'labPaperSrc'#22'BorderSpacing.OnChange'#13#7'Caption'#6
+#12'Paper source'#5'Color'#7#6'clNone'#4'Left'#2#15#6'Height'#2#17#3'Top'#2
+'\'#5'Width'#2'p'#0#0#9'TComboBox'#11'cbPaperSize'#22'BorderSpacing.OnChange'
+#13#13'DropDownCount'#2#10#9'MaxLength'#2#0#10'OnKeyPress'#7#19'cbPaperSizeK'
+'EYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#0#4
+'Left'#3#131#0#6'Height'#2#25#3'Top'#2#11#5'Width'#3'5'#1#0#0#9'TComboBox'#11
+'cbPaperType'#22'BorderSpacing.OnChange'#13#9'MaxLength'#2#0#10'OnKeyPress'#7
+#19'cbPaperSizeKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'T'
+'abOrder'#2#1#4'Left'#3#131#0#6'Height'#2#25#3'Top'#2'/'#5'Width'#3'5'#1#0#0
+#9'TComboBox'#10'cbPaperSrc'#22'BorderSpacing.OnChange'#13#9'MaxLength'#2#0
+#10'OnKeyPress'#7#19'cbPaperSizeKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'cs'
+'DropDownList'#8'TabOrder'#2#4#4'Left'#3#131#0#6'Height'#2#25#3'Top'#2'Q'#5
+'Width'#3'5'#1#0#0#9'TGroupBox'#13'gbOrientation'#22'BorderSpacing.OnChange'
+#13#7'Caption'#6#13' Orientation '#12'ClientHeight'#2'f'#11'ClientWidth'#3
+#229#0#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#6#4'Left'#2#14#6'He'
+'ight'#2'w'#3'Top'#2'{'#5'Width'#3#233#0#0#6'TImage'#14'imgOrientation'#22'B'
+'orderSpacing.OnChange'#13#11'Transparent'#9#4'Left'#3#167#0#6'Height'#2'0'#3
+'Top'#2#25#5'Width'#2'4'#0#0#12'TRadioButton'#10'rbPortrait'#11'AllowGrayed'
+#9#22'BorderSpacing.OnChange'#13#7'Caption'#6#8'Portrait'#7'Checked'#9#10'Dr'
+'agCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#5'State'#7#9'cbCh'
+'ecked'#8'TabOrder'#2#0#4'Left'#2#7#6'Height'#2#20#3'Top'#2#5#5'Width'#2'@'#0
+#0#12'TRadioButton'#11'rbLandscape'#11'AllowGrayed'#9#22'BorderSpacing.OnCha'
+'nge'#13#7'Caption'#6#9'Landscape'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7
+#15'rbPortraitCLICK'#8'TabOrder'#2#1#4'Left'#2#7#6'Height'#2#20#3'Top'#2#29#5
+'Width'#2'W'#0#0#12'TRadioButton'#15'rbrev_Landscape'#11'AllowGrayed'#9#22'B'
+'orderSpacing.OnChange'#13#7'Caption'#6#17'Reverse landscape'#10'DragCursor'
+#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#2#4'Left'#2#7
+#6'Height'#2#20#3'Top'#2'5'#5'Width'#3#133#0#0#0#12'TRadioButton'#14'rbrev_p'
+'ortrait'#11'AllowGrayed'#9#22'BorderSpacing.OnChange'#13#7'Caption'#6#16'Re'
+'verse portrait'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLI'
+'CK'#8'TabOrder'#2#3#4'Left'#2#7#6'Height'#2#20#3'Top'#2'M'#5'Width'#2'q'#0#0
+#0#9'TGroupBox'#8'gbDuplex'#22'BorderSpacing.OnChange'#13#7'Caption'#6#17' D'
+'uplex printing '#12'ClientHeight'#2'f'#11'ClientWidth'#3#181#0#11'ParentCol'
+'or'#9#11'ParentCtl3D'#8#8'TabOrder'#2#2#4'Left'#3#255#0#6'Height'#2'w'#3'To'
+'p'#2'{'#5'Width'#3#185#0#0#6'TImage'#9'imgDuplex'#22'BorderSpacing.OnChange'
+#13#11'Transparent'#9#4'Left'#2'~'#6'Height'#2'4'#3'Top'#2#21#5'Width'#2','#0
+#0#12'TRadioButton'#12'rbDuplexNone'#11'AllowGrayed'#9#22'BorderSpacing.OnCh'
+'ange'#13#7'Caption'#6#4'None'#7'Checked'#9#10'DragCursor'#7#9'crDefault'#7
+'OnClick'#7#15'rbPortraitCLICK'#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#4'Le'
+'ft'#2#14#6'Height'#2#20#3'Top'#2#5#5'Width'#2'7'#0#0#12'TRadioButton'#12'rb'
+'DuplexLong'#11'AllowGrayed'#9#22'BorderSpacing.OnChange'#13#7'Caption'#6#9
+'Long edge'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8
,'TabOrder'#2#1#4'Left'#2#14#6'Height'#2#20#3'Top'#2#29#5'Width'#2'U'#0#0#12
+'TRadioButton'#13'rbDuplexShort'#11'AllowGrayed'#9#22'BorderSpacing.OnChange'
+#13#7'Caption'#6#10'Short edge'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15
+'rbPortraitCLICK'#8'TabOrder'#2#2#4'Left'#2#14#6'Height'#2#20#3'Top'#2'5'#5
+'Width'#2'V'#0#0#0#9'TGroupBox'#9'gbBanners'#22'BorderSpacing.OnChange'#13#7
+'Caption'#6#9' Banners '#12'ClientHeight'#2'O'#11'ClientWidth'#3#228#0#11'Pa'
+'rentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#3#4'Left'#2#15#6'Height'#2'`'#3
+'Top'#3#247#0#5'Width'#3#232#0#0#6'TLabel'#11'labBanStart'#22'BorderSpacing.'
+'OnChange'#13#7'Caption'#6#5'Start'#5'Color'#7#6'clNone'#4'Left'#2#6#6'Heigh'
+'t'#2#17#3'Top'#2#9#5'Width'#2'A'#0#0#6'TLabel'#9'labBanEnd'#22'BorderSpacin'
+'g.OnChange'#13#7'Caption'#6#3'End'#5'Color'#7#6'clNone'#4'Left'#2#6#6'Heigh'
+'t'#2#17#3'Top'#2'1'#5'Width'#2'A'#0#0#9'TComboBox'#10'cbBanStart'#22'Border'
+'Spacing.OnChange'#13#9'MaxLength'#2#0#10'OnKeyPress'#7#19'cbPaperSizeKEYPRE'
+'SS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#0#4'Left'
+#2'^'#6'Height'#2#25#3'Top'#2#1#5'Width'#3#128#0#0#0#9'TComboBox'#8'cbBanEnd'
+#22'BorderSpacing.OnChange'#13#9'MaxLength'#2#0#10'OnKeyPress'#7#19'cbPaperS'
+'izeKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#1
'TPF0'#21'Tdlgpropertiesprinter'#20'dlgpropertiesprinter'#13'ActiveControl'#7
+#10'btnCancel1'#7'Caption'#6#18'Printer properties'#12'ClientHeight'#3#161#1
+#11'ClientWidth'#3#201#1#8'OnCreate'#7#26'dlgpropertiesprinterCREATE'#9'OnDe'
+'stroy'#7#11'FormDestroy'#6'OnShow'#7#24'dlgpropertiesprinterSHOW'#13'Pixels'
+'PerInch'#2'K'#18'HorzScrollBar.Page'#3#200#1#18'VertScrollBar.Page'#3#160#1
+#4'Left'#3'M'#1#6'Height'#3#161#1#3'Top'#2'o'#5'Width'#3#201#1#0#6'TPanel'#6
+'Panel1'#5'Align'#7#8'alBottom'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#12'Cli'
+'entHeight'#2')'#11'ClientWidth'#3#201#1#11'FullRepaint'#8#8'TabOrder'#2#0#7
+'TabStop'#9#6'Height'#2')'#3'Top'#3'x'#1#5'Width'#3#201#1#0#7'TButton'#10'bt'
+'nCancel1'#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'
+#2#2#6'Cancel'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#0#4
+'Left'#3'`'#1#6'Height'#2#25#3'Top'#2#8#5'Width'#2'['#0#0#7'TButton'#5'btnOk'
+#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#2#7'Cap'
+'tion'#6#2'Ok'#7'Default'#9#11'ModalResult'#2#1#8'TabOrder'#2#1#4'Left'#3#255
+#0#6'Height'#2#25#3'Top'#2#8#5'Width'#2'['#0#0#0#9'TNotebook'#15'PagesProper'
+'ties'#5'Align'#7#8'alClient'#9'PageIndex'#2#0#6'Height'#3'x'#1#5'Width'#3
+#201#1#0#5'TPage'#9'pgGeneral'#7'Caption'#6#7'General'#11'ClientWidth'#3#201
+#1#12'ClientHeight'#3'b'#1#6'Height'#3'b'#1#3'Top'#2#22#5'Width'#3#201#1#0#6
+'TLabel'#12'labPaperSize'#7'Caption'#6#10'Paper size'#5'Color'#7#6'clNone'#11
+'ParentColor'#8#4'Left'#2#15#6'Height'#2#13#3'Top'#2#19#5'Width'#2'<'#0#0#6
+'TLabel'#12'labPaperType'#7'Caption'#6#10'Paper type'#5'Color'#7#6'clNone'#11
+'ParentColor'#8#4'Left'#2#15#6'Height'#2#13#3'Top'#2'7'#5'Width'#2'>'#0#0#6
+'TLabel'#11'labPaperSrc'#7'Caption'#6#12'Paper source'#5'Color'#7#6'clNone'
+#11'ParentColor'#8#4'Left'#2#15#6'Height'#2#13#3'Top'#2'\'#5'Width'#2'L'#0#0
+#9'TComboBox'#11'cbPaperSize'#13'DropDownCount'#2#10#9'MaxLength'#2#0#10'OnK'
+'eyPress'#7#19'cbPaperSizeKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDo'
+'wnList'#8'TabOrder'#2#0#4'Left'#3#131#0#6'Height'#2#25#3'Top'#2#11#5'Width'
+#3'5'#1#0#0#9'TComboBox'#11'cbPaperType'#9'MaxLength'#2#0#10'OnKeyPress'#7#19
+'cbPaperSizeKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabO'
+'rder'#2#1#4'Left'#3#131#0#6'Height'#2#25#3'Top'#2'/'#5'Width'#3'5'#1#0#0#9
+'TComboBox'#10'cbPaperSrc'#9'MaxLength'#2#0#10'OnKeyPress'#7#19'cbPaperSizeK'
+'EYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#4#4
+'Left'#3#131#0#6'Height'#2#25#3'Top'#2'Q'#5'Width'#3'5'#1#0#0#9'TGroupBox'#13
+'gbOrientation'#7'Caption'#6#13' Orientation '#12'ClientHeight'#2'f'#11'Clie'
+'ntWidth'#3#229#0#11'ParentCtl3D'#8#8'TabOrder'#2#6#4'Left'#2#14#6'Height'#2
+'w'#3'Top'#2'{'#5'Width'#3#233#0#0#6'TImage'#14'imgOrientation'#11'Transpare'
+'nt'#9#4'Left'#3#167#0#6'Height'#2'0'#3'Top'#2#25#5'Width'#2'4'#0#0#12'TRadi'
+'oButton'#10'rbPortrait'#11'AllowGrayed'#9#7'Caption'#6#8'Portrait'#7'Checke'
+'d'#9#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#5'State'
+#7#9'cbChecked'#8'TabOrder'#2#0#4'Left'#2#7#6'Height'#2#24#3'Top'#2#5#5'Widt'
+'h'#2'?'#0#0#12'TRadioButton'#11'rbLandscape'#11'AllowGrayed'#9#7'Caption'#6
+#9'Landscape'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'
+#8'TabOrder'#2#1#4'Left'#2#7#6'Height'#2#24#3'Top'#2#29#5'Width'#2'V'#0#0#12
+'TRadioButton'#15'rbrev_Landscape'#11'AllowGrayed'#9#7'Caption'#6#17'Reverse'
+' landscape'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8
+'TabOrder'#2#2#4'Left'#2#7#6'Height'#2#24#3'Top'#2'5'#5'Width'#3#132#0#0#0#12
+'TRadioButton'#14'rbrev_portrait'#11'AllowGrayed'#9#7'Caption'#6#16'Reverse '
+'portrait'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8
+'TabOrder'#2#3#4'Left'#2#7#6'Height'#2#24#3'Top'#2'M'#5'Width'#2'p'#0#0#0#9
+'TGroupBox'#8'gbDuplex'#7'Caption'#6#17' Duplex printing '#12'ClientHeight'#2
+'f'#11'ClientWidth'#3#181#0#11'ParentCtl3D'#8#8'TabOrder'#2#2#4'Left'#3#255#0
+#6'Height'#2'w'#3'Top'#2'{'#5'Width'#3#185#0#0#6'TImage'#9'imgDuplex'#11'Tra'
+'nsparent'#9#4'Left'#2'~'#6'Height'#2'4'#3'Top'#2#21#5'Width'#2','#0#0#12'TR'
+'adioButton'#12'rbDuplexNone'#11'AllowGrayed'#9#7'Caption'#6#4'None'#7'Check'
+'ed'#9#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#5'Stat'
+'e'#7#9'cbChecked'#8'TabOrder'#2#0#4'Left'#2#14#6'Height'#2#24#3'Top'#2#5#5
+'Width'#2'6'#0#0#12'TRadioButton'#12'rbDuplexLong'#11'AllowGrayed'#9#7'Capti'
+'on'#6#9'Long edge'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortrait'
+'CLICK'#8'TabOrder'#2#1#4'Left'#2#14#6'Height'#2#24#3'Top'#2#29#5'Width'#2'T'
+#0#0#12'TRadioButton'#13'rbDuplexShort'#11'AllowGrayed'#9#7'Caption'#6#10'Sh'
+'ort edge'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8
+'TabOrder'#2#2#4'Left'#2#14#6'Height'#2#24#3'Top'#2'5'#5'Width'#2'U'#0#0#0#9
+'TGroupBox'#9'gbBanners'#7'Caption'#6#9' Banners '#12'ClientHeight'#2'O'#11
+'ClientWidth'#3#228#0#11'ParentCtl3D'#8#8'TabOrder'#2#3#4'Left'#2#15#6'Heigh'
,'t'#2'`'#3'Top'#3#247#0#5'Width'#3#232#0#0#6'TLabel'#11'labBanStart'#7'Capti'
+'on'#6#5'Start'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#6#6'Height'
+#2#13#3'Top'#2#9#5'Width'#2#26#0#0#6'TLabel'#9'labBanEnd'#7'Caption'#6#3'End'
+#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#6#6'Height'#2#13#3'Top'#2
+'1'#5'Width'#2#23#0#0#9'TComboBox'#10'cbBanStart'#9'MaxLength'#2#0#10'OnKeyP'
+'ress'#7#19'cbPaperSizeKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownL'
+'ist'#8'TabOrder'#2#0#4'Left'#2'^'#6'Height'#2#25#3'Top'#2#1#5'Width'#3#128#0
+#0#0#9'TComboBox'#8'cbBanEnd'#9'MaxLength'#2#0#10'OnKeyPress'#7#19'cbPaperSi'
+'zeKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#1
+#4'Left'#2'^'#6'Height'#2#25#3'Top'#2')'#5'Width'#3#128#0#0#0#0#9'TGroupBox'
+#12'gbPagesSheet'#22'BorderSpacing.OnChange'#13#7'Caption'#6#17' Pages per s'
+'heet '#12'ClientHeight'#2'O'#11'ClientWidth'#3#181#0#11'ParentColor'#9#11'P'
+'arentCtl3D'#8#8'TabOrder'#2#5#4'Left'#3#255#0#6'Height'#2'`'#3'Top'#3#247#0
+#5'Width'#3#185#0#0#6'TImage'#12'imgPageSheet'#22'BorderSpacing.OnChange'#13
+#11'Transparent'#9#4'Left'#2'N'#6'Height'#2'2'#3'Top'#2#17#5'Width'#2'P'#0#0
+#12'TRadioButton'#8'rbSheet1'#11'AllowGrayed'#9#22'BorderSpacing.OnChange'#13
+#7'Caption'#6#1'1'#7'Checked'#9#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#15
+'rbPortraitCLICK'#5'State'#7#9'cbChecked'#8'TabOrder'#2#0#4'Left'#2#6#6'Heig'
+'ht'#2#20#3'Top'#2#5#5'Width'#2'*'#0#0#12'TRadioButton'#8'rbSheet2'#11'Allow'
+'Grayed'#9#22'BorderSpacing.OnChange'#13#7'Caption'#6#1'2'#10'DragCursor'#7#9
+'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#1#4'Left'#2#6#6'H'
+'eight'#2#20#3'Top'#2#25#5'Width'#2'*'#0#0#12'TRadioButton'#8'rbSheet4'#11'A'
+'llowGrayed'#9#22'BorderSpacing.OnChange'#13#7'Caption'#6#1'4'#10'DragCursor'
+#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#2#4'Left'#2#6
+#6'Height'#2#20#3'Top'#2'.'#5'Width'#2'*'#0#0#0#0#5'TPage'#7'pgMarge'#7'Capt'
+'ion'#6#7'Borders'#11'ClientWidth'#3#201#1#12'ClientHeight'#3'b'#1#6'Height'
+#3'b'#1#3'Top'#2#22#5'Width'#3#201#1#0#0#0#0
+#12'gbPagesSheet'#7'Caption'#6#17' Pages per sheet '#12'ClientHeight'#2'O'#11
+'ClientWidth'#3#181#0#11'ParentCtl3D'#8#8'TabOrder'#2#5#4'Left'#3#255#0#6'He'
+'ight'#2'`'#3'Top'#3#247#0#5'Width'#3#185#0#0#6'TImage'#12'imgPageSheet'#11
+'Transparent'#9#4'Left'#2'N'#6'Height'#2'2'#3'Top'#2#17#5'Width'#2'P'#0#0#12
+'TRadioButton'#8'rbSheet1'#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'TabOrder'#2#0#4'Left'#2#6#6'Height'#2#24#3'Top'#2#5#5'Width'#2
+#31#0#0#12'TRadioButton'#8'rbSheet2'#11'AllowGrayed'#9#7'Caption'#6#1'2'#10
+'DragCursor'#7#9'crDefault'#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#1
+#4'Left'#2#6#6'Height'#2#24#3'Top'#2#25#5'Width'#2#31#0#0#12'TRadioButton'#8
+'rbSheet4'#11'AllowGrayed'#9#7'Caption'#6#1'4'#10'DragCursor'#7#9'crDefault'
+#7'OnClick'#7#15'rbPortraitCLICK'#8'TabOrder'#2#2#4'Left'#2#6#6'Height'#2#24
+#3'Top'#2'.'#5'Width'#2#31#0#0#0#0#5'TPage'#7'pgMarge'#7'Caption'#6#7'Border'
+'s'#11'ClientWidth'#3#201#1#12'ClientHeight'#3'b'#1#6'Height'#3'b'#1#3'Top'#2
+#22#5'Width'#3#201#1#0#0#0#0
]);

View File

@ -35,9 +35,12 @@ interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls,Buttons,Printers,osPrinters;
StdCtrls,Buttons,Printers, OsPrinters in '../osprinters.pas';
type
{ Tdlgpropertiesprinter }
Tdlgpropertiesprinter = class(TForm)
btnCancel1: TBUTTON;
btnOk: TBUTTON;
@ -72,26 +75,30 @@ type
rbrev_Landscape: TRADIOBUTTON;
rbLandscape: TRADIOBUTTON;
rbPortrait: TRADIOBUTTON;
procedure FormDestroy(Sender: TObject);
procedure rbPortraitCLICK(Sender: TObject);
procedure cbPaperSizeKEYPRESS(Sender: TObject; var Key: Char);
procedure dlgpropertiesprinterCREATE(Sender: TObject);
procedure dlgpropertiesprinterSHOW(Sender: TObject);
private
{ private declarations }
fPaperSizeOptions,FMediaTypeOptions,FInputSlotOptions: TStringList;
procedure RefreshInfos;
procedure InitCombo(aCombo : TCombobox; aKeyWord,aDefault : string);
procedure InitCombo(aCombo: TCombobox; aKeyWord,aDefault : string; OptList: TStrings);
function number_up_supported: string;
public
{ public declarations }
procedure InitProperties;
end;
end;
var
dlgpropertiesprinter: Tdlgpropertiesprinter;
implementation
Type
THackCUPSPrinter=Class(TCUPSPrinter);
@ -108,7 +115,6 @@ begin
Key:=#0;
end;
function Tdlgpropertiesprinter.number_up_supported: string;
Var Lst : TStringList;
begin
@ -129,10 +135,14 @@ Var Lst : TStringList;
St : String;
begin
if Sender=nil then ;
FPaperSizeOptions := TStringList.Create;
FMediaTypeOptions := TStringlist.Create;
FInputSlotOptions := TStringList.Create;
InitCombo(cbPaperSize,'PageSize',Printer.PaperSize.PaperName);
InitCombo(cbPaperType,'MediaType','Plain Paper');
InitCombo(cbPaperSrc ,'InputSlot','Auto Sheet Feeder');
InitCombo(cbPaperSize,'PageSize',Printer.PaperSize.PaperName, FPaperSizeOptions);
InitCombo(cbPaperType,'MediaType','Plain Paper',FMediaTypeOptions);
InitCombo(cbPaperSrc ,'InputSlot','Auto Sheet Feeder',FInputSlotOptions);
Lst:=TStringList.Create;
try
@ -202,6 +212,13 @@ begin
RefreshInfos;
end;
procedure Tdlgpropertiesprinter.FormDestroy(Sender: TObject);
begin
FPaperSizeOptions.Free;
FMediaTypeOptions.Free;
FInputSlotOptions.Free;
end;
procedure Tdlgpropertiesprinter.RefreshInfos;
var St : string;
begin
@ -232,15 +249,17 @@ begin
end;
//Initialization of an combobox with ppd options
procedure Tdlgpropertiesprinter.InitCombo(aCombo: TCombobox; aKeyWord,aDefault: string);
Var i : Integer;
procedure Tdlgpropertiesprinter.InitCombo(aCombo: TCombobox; aKeyWord,aDefault: string; OptList: TStrings);
Var
i : Integer;
begin
If Assigned(aCombo) then
begin
//Save the default choice or marked choice
aCombo.Tag:=THackCUPSPrinter(Printer).EnumPPDChoice(aCombo.Items,aKeyWord);
aCombo.Tag:=THackCUPSPrinter(Printer).EnumPPDChoice(aCombo.Items,aKeyWord,OptList);
aCombo.Enabled:=(aCombo.Items.Count>0);
i:=aCombo.Items.IndexOf(aDefault);
//i:=aCombo.Items.IndexOf(aDefault);
i := OptList.IndexOf(aDefault);
if i=-1 then i:=aCombo.Tag;
if i>-1 then
aCombo.ItemIndex:=i;
@ -256,15 +275,22 @@ begin
//PageSize
if (cbPaperSize.Items.Count>0) and (cbPaperSize.ItemIndex<>cbPaperSize.Tag) then
THackCUPSPrinter(Printer).cupsAddOption('PageSize',cbPaperSize.Text);
begin
//THackCUPSPrinter(Printer).cupsAddOption('PageSize',cbPaperSize.Text);
THackCUPSPrinter(Printer).cupsAddOption('PageSize',
fPaperSizeOptions[cbPaperSize.ItemIndex]);
end;
//MediaType
if (cbPaperType.Items.Count>0) and (cbPaperType.ItemIndex<>cbPaperType.Tag) then
THackCUPSPrinter(Printer).cupsAddOption('MediaType',cbPaperType.Text);
THackCUPSPrinter(Printer).cupsAddOption('MediaType',
fMediaTypeOptions[cbPaperType.ItemIndex]);
//InputSlot
if (cbPaperSrc.Items.Count>0) and (cbPaperSrc.ItemIndex<>cbPaperSrc.Tag) then
THackCUPSPrinter(Printer).cupsAddOption('InputSlot',cbPaperSrc.Text);
THackCUPSPrinter(Printer).cupsAddOption('InputSlot',
FInputSlotOptions[cbPaperSrc.ItemIndex]);
//Duplex
if gbDuplex.Enabled then

View File

@ -1,105 +1,114 @@
object dlgSelectPrinter: TdlgSelectPrinter
ActiveControl = cbPrinters
Caption = 'Printing'
ClientHeight = 385
ClientWidth = 537
ClientHeight = 401
ClientWidth = 552
OnCreate = dlgSelectPrinterCREATE
OnShow = dlgSelectPrinterSHOW
PixelsPerInch = 112
HorzScrollBar.Page = 536
VertScrollBar.Page = 384
Left = 430
Height = 385
Top = 208
Width = 537
PixelsPerInch = 75
HorzScrollBar.Page = 551
VertScrollBar.Page = 400
Left = 97
Height = 401
Top = 36
Width = 552
object labCUPS: TLabel
Caption = 'CUPS (Common Unix Printing System)'
Color = clNone
ParentColor = False
Left = 8
Height = 12
Height = 13
Top = 152
Width = 211
Width = 212
end
object labCUPSServer: TLabel
Caption = 'labCUPSServer'
Color = clNone
ParentColor = False
Left = 240
Height = 12
Height = 13
Top = 152
Width = 87
Width = 88
end
object Groupbox1: TGroupBox
Caption = ' Printer '
ClientHeight = 119
ClientWidth = 525
ParentColor = True
ClientWidth = 532
ParentCtl3D = False
TabOrder = 0
Left = 8
Height = 136
Top = 8
Width = 529
Width = 536
object ImgPrn: TImage
Transparent = True
Left = 124
Height = 19
Top = 9
Top = 7
Width = 17
end
object Label1: TLabel
Caption = 'Name'
Color = clNone
ParentColor = False
Left = 19
Height = 17
Height = 13
Top = 9
Width = 97
Width = 33
end
object Label2: TLabel
Caption = 'State'
Color = clNone
ParentColor = False
Left = 17
Height = 17
Height = 13
Top = 36
Width = 99
Width = 29
end
object Label3: TLabel
Caption = 'Location'
Color = clNone
ParentColor = False
Left = 18
Height = 17
Height = 13
Top = 64
Width = 98
Width = 49
end
object Label4: TLabel
Caption = 'Description'
Color = clNone
ParentColor = False
Left = 17
Height = 17
Height = 13
Top = 92
Width = 99
Width = 64
end
object labState: TLabel
Caption = 'labState'
Color = clNone
ParentColor = False
Left = 128
Height = 15
Height = 13
Top = 40
Width = 391
Width = 46
end
object labLocation: TLabel
Caption = 'labLocation'
Color = clNone
ParentColor = False
Left = 128
Height = 15
Height = 13
Top = 66
Width = 391
Width = 66
end
object labComment: TLabel
Caption = 'labComment'
Color = clNone
ParentColor = False
Left = 126
Height = 17
Height = 13
Top = 92
Width = 389
Width = 69
end
object cbPrinters: TComboBox
MaxLength = 0
@ -112,9 +121,10 @@ object dlgSelectPrinter: TdlgSelectPrinter
Left = 142
Height = 22
Top = 6
Width = 291
Width = 280
end
object btnProp: TButton
BorderSpacing.InnerBorder = 2
Caption = 'Properties ...'
OnClick = btnPropCLICK
TabOrder = 1
@ -123,74 +133,82 @@ object dlgSelectPrinter: TdlgSelectPrinter
Top = 4
Width = 92
end
object cbPrintToFile: TCheckBox
Caption = 'Print to file'
TabOrder = 2
Left = 422
Height = 23
Top = 89
Width = 90
end
end
object NbOpts: TNotebook
PageIndex = 0
Height = 168
Top = 176
Left = 8
Height = 192
Top = 168
Width = 537
object pgCopies: TPage
Caption = 'Copies'
ClientWidth = 533
ClientHeight = 138
Left = 2
Height = 138
Top = 28
Width = 533
ClientWidth = 537
ClientHeight = 170
Height = 170
Top = 22
Width = 537
object gbPages: TGroupBox
Caption = ' Select pages '
ClientHeight = 115
ClientHeight = 139
ClientWidth = 258
ParentColor = True
ParentCtl3D = False
TabOrder = 0
Left = 9
Height = 132
Top = 6
Left = 8
Height = 156
Top = 7
Width = 262
object Bevel1: TBevel
Height = 3
Left = 14
Left = 18
Name = 'Bevel1'
Shape = bsTopLine
Top = 73
Top = 100
Style = bsRaised
Width = 230
Left = 14
Left = 18
Height = 3
Top = 73
Top = 100
Width = 230
end
object labPage: TLabel
Caption = 'Pages'
Color = clNone
ParentColor = False
Left = 14
Height = 17
Top = 90
Width = 102
Height = 13
Top = 116
Width = 36
end
object edRange: TEdit
TabOrder = 0
Left = 92
Height = 23
Top = 47
Width = 112
Top = 70
Width = 154
end
object edPageSet: TComboBox
ItemIndex = 0
Items.Strings = (
'All pages'
'Odd pages'
'Even pages'
)
ItemIndex = 0
MaxLength = 0
ParentCtl3D = False
Style = csDropDownList
TabOrder = 1
Text = 'All pages'
Left = 132
Left = 130
Height = 25
Top = 82
Top = 108
Width = 118
end
object rbCurrentPage: TRadioButton
@ -199,20 +217,20 @@ object dlgSelectPrinter: TdlgSelectPrinter
DragCursor = crDefault
Enabled = False
TabOrder = 2
Left = 12
Height = 20
Top = 26
Width = 98
Left = 14
Height = 24
Top = 21
Width = 97
end
object rbRange: TRadioButton
AllowGrayed = True
Caption = 'Range'
DragCursor = crDefault
TabOrder = 4
Left = 12
Height = 20
Top = 50
Width = 61
Left = 14
Height = 24
Top = 68
Width = 60
end
object rbAllPage: TRadioButton
AllowGrayed = True
@ -221,21 +239,30 @@ object dlgSelectPrinter: TdlgSelectPrinter
DragCursor = crDefault
State = cbChecked
TabOrder = 3
Left = 12
Height = 20
Top = 2
Width = 48
Left = 14
Height = 24
Width = 43
end
object rbSelection: TRadioButton
AllowGrayed = True
Caption = 'Selection'
DragCursor = crDefault
Enabled = False
TabOrder = 5
Left = 14
Height = 24
Top = 45
Width = 76
end
end
object gbCopies: TGroupBox
Caption = ' Copies '
ClientHeight = 114
ClientHeight = 138
ClientWidth = 253
ParentColor = True
ParentCtl3D = False
TabOrder = 1
Left = 279
Height = 131
Height = 155
Top = 7
Width = 257
object imgCollate: TImage
@ -250,14 +277,13 @@ object dlgSelectPrinter: TdlgSelectPrinter
object lanNumCopies: TLabel
Caption = 'Number of copies'
Color = clNone
ParentColor = False
Left = 6
Height = 17
Height = 13
Top = 8
Width = 113
Width = 99
end
object edCopies: TSpinEdit
ClimbRate = 1
MaxValue = 100
TabOrder = 0
Left = 134
Height = 20
@ -271,9 +297,9 @@ object dlgSelectPrinter: TdlgSelectPrinter
OnClick = cbReverseCLICK
TabOrder = 2
Left = 119
Height = 20
Height = 24
Top = 32
Width = 104
Width = 63
end
object cbReverse: TCheckBox
AllowGrayed = True
@ -282,37 +308,39 @@ object dlgSelectPrinter: TdlgSelectPrinter
OnClick = cbReverseCLICK
TabOrder = 1
Left = 119
Height = 20
Height = 24
Top = 60
Width = 120
Width = 70
end
end
end
object pgAdvance: TPage
Caption = 'Advanced'
ClientWidth = 533
ClientHeight = 138
Left = 2
Height = 138
Top = 28
Width = 533
ClientWidth = 537
ClientHeight = 170
Height = 170
Top = 22
Width = 537
object labTask: TLabel
Caption = 'Delayed task'
Color = clNone
ParentColor = False
Left = 7
Height = 17
Height = 13
Top = 10
Width = 201
Width = 74
end
object Label5: TLabel
Caption = 'Priority'
Color = clNone
ParentColor = False
Left = 7
Height = 17
Height = 13
Top = 45
Width = 112
Width = 40
end
object cbTasktime: TComboBox
ItemIndex = 0
Items.Strings = (
'Immediate'
'Never (suspending)'
@ -324,7 +352,6 @@ object dlgSelectPrinter: TdlgSelectPrinter
'After midnight'
'At time'
)
ItemIndex = 0
MaxLength = 0
OnChange = cbTasktimeCHANGE
OnKeyPress = cbPrintersKEYPRESS
@ -341,8 +368,10 @@ object dlgSelectPrinter: TdlgSelectPrinter
DragCursor = crDefault
EditMask = '99:99:99'
MaxLength = 8
ParentColor = False
ParentCtl3D = False
TabOrder = 0
TabStop = True
Text = '23:00:00'
Left = 429
Height = 23
@ -350,8 +379,6 @@ object dlgSelectPrinter: TdlgSelectPrinter
Width = 58
end
object edPriority: TSpinEdit
ClimbRate = 1
MaxValue = 100
TabOrder = 3
Left = 127
Height = 20
@ -387,37 +414,40 @@ object dlgSelectPrinter: TdlgSelectPrinter
Align = alBottom
Anchors = [akLeft, akBottom]
ClientHeight = 41
ClientWidth = 537
ClientWidth = 552
FullRepaint = False
TabOrder = 2
TabStop = True
Height = 41
Top = 344
Width = 537
Top = 360
Width = 552
object btnCancel: TButton
Anchors = [akTop, akRight]
BorderSpacing.InnerBorder = 2
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 0
Left = 432
Left = 447
Height = 25
Top = 8
Width = 91
end
object btnPrint: TButton
Anchors = [akTop, akRight]
BorderSpacing.InnerBorder = 2
Caption = 'Print'
Default = True
ModalResult = 1
OnClick = btnPrintCLICK
TabOrder = 1
Left = 328
Left = 343
Height = 25
Top = 8
Width = 99
end
object btnReduc: TButton
BorderSpacing.InnerBorder = 2
Caption = 'More ...'
OnClick = btnReducCLICK
TabOrder = 2
@ -427,6 +457,7 @@ object dlgSelectPrinter: TdlgSelectPrinter
Width = 88
end
object btnPreview: TButton
BorderSpacing.InnerBorder = 2
Caption = 'Preview'
ModalResult = 6
TabOrder = 3

View File

@ -1,106 +1,114 @@
{ Ceci est un fichier ressource généré automatiquement par Lazarus }
LazarusResources.Add('TdlgSelectPrinter','FORMDATA',[
'TPF0'#17'TdlgSelectPrinter'#16'dlgSelectPrinter'#7'Caption'#6#8'Printing'#12
+'ClientHeight'#3#129#1#11'ClientWidth'#3#25#2#8'OnCreate'#7#22'dlgSelectPrin'
+'terCREATE'#6'OnShow'#7#20'dlgSelectPrinterSHOW'#13'PixelsPerInch'#2'p'#18'H'
+'orzScrollBar.Page'#3#24#2#18'VertScrollBar.Page'#3#128#1#4'Left'#3#174#1#6
+'Height'#3#129#1#3'Top'#3#208#0#5'Width'#3#25#2#0#6'TLabel'#7'labCUPS'#7'Cap'
+'tion'#6'"CUPS (Common Unix Printing System)'#5'Color'#7#6'clNone'#4'Left'#2
+#8#6'Height'#2#12#3'Top'#3#152#0#5'Width'#3#211#0#0#0#6'TLabel'#13'labCUPSSe'
+'rver'#7'Caption'#6#13'labCUPSServer'#5'Color'#7#6'clNone'#4'Left'#3#240#0#6
+'Height'#2#12#3'Top'#3#152#0#5'Width'#2'W'#0#0#9'TGroupBox'#9'Groupbox1'#7'C'
+'aption'#6#9' Printer '#12'ClientHeight'#2'w'#11'ClientWidth'#3#13#2#11'Pare'
+'ntColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#3#136#0#3
+'Top'#2#8#5'Width'#3#17#2#0#6'TImage'#6'ImgPrn'#11'Transparent'#9#4'Left'#2
+'|'#6'Height'#2#19#3'Top'#2#9#5'Width'#2#17#0#0#6'TLabel'#6'Label1'#7'Captio'
+'n'#6#4'Name'#5'Color'#7#6'clNone'#4'Left'#2#19#6'Height'#2#17#3'Top'#2#9#5
+'Width'#2'a'#0#0#6'TLabel'#6'Label2'#7'Caption'#6#5'State'#5'Color'#7#6'clNo'
+'ne'#4'Left'#2#17#6'Height'#2#17#3'Top'#2'$'#5'Width'#2'c'#0#0#6'TLabel'#6'L'
+'abel3'#7'Caption'#6#8'Location'#5'Color'#7#6'clNone'#4'Left'#2#18#6'Height'
+#2#17#3'Top'#2'@'#5'Width'#2'b'#0#0#6'TLabel'#6'Label4'#7'Caption'#6#11'Desc'
+'ription'#5'Color'#7#6'clNone'#4'Left'#2#17#6'Height'#2#17#3'Top'#2'\'#5'Wid'
+'th'#2'c'#0#0#6'TLabel'#8'labState'#7'Caption'#6#8'labState'#5'Color'#7#6'cl'
+'None'#4'Left'#3#128#0#6'Height'#2#15#3'Top'#2'('#5'Width'#3#135#1#0#0#6'TLa'
+'bel'#11'labLocation'#7'Caption'#6#11'labLocation'#5'Color'#7#6'clNone'#4'Le'
+'ft'#3#128#0#6'Height'#2#15#3'Top'#2'B'#5'Width'#3#135#1#0#0#6'TLabel'#10'la'
+'bComment'#7'Caption'#6#10'labComment'#5'Color'#7#6'clNone'#4'Left'#2'~'#6'H'
+'eight'#2#17#3'Top'#2'\'#5'Width'#3#133#1#0#0#9'TComboBox'#10'cbPrinters'#9
+'MaxLength'#2#0#8'OnChange'#7#16'cbPrintersCHANGE'#10'OnKeyPress'#7#18'cbPri'
+'ntersKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'#2
+#0#4'Text'#6#10'cbPrinters'#4'Left'#3#142#0#6'Height'#2#22#3'Top'#2#6#5'Widt'
+'h'#3'#'#1#0#0#7'TButton'#7'btnProp'#7'Caption'#6#14'Properties ...'#7'OnCli'
+'ck'#7#12'btnPropCLICK'#8'TabOrder'#2#1#4'Left'#3#174#1#6'Height'#2#25#3'Top'
+#2#4#5'Width'#2'\'#0#0#0#9'TNotebook'#6'NbOpts'#9'PageIndex'#2#0#6'Height'#3
+#168#0#3'Top'#3#176#0#5'Width'#3#25#2#0#5'TPage'#8'pgCopies'#7'Caption'#6#6
+'Copies'#11'ClientWidth'#3#21#2#12'ClientHeight'#3#138#0#4'Left'#2#2#6'Heigh'
+'t'#3#138#0#3'Top'#2#28#5'Width'#3#21#2#0#9'TGroupBox'#7'gbPages'#7'Caption'
+#6#14' Select pages '#12'ClientHeight'#2's'#11'ClientWidth'#3#2#1#11'ParentC'
+'olor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#0#4'Left'#2#9#6'Height'#3#132#0#3'T'
+'op'#2#6#5'Width'#3#6#1#0#6'TBevel'#6'Bevel1'#6'Height'#2#3#4'Left'#2#14#4'N'
+'ame'#6#6'Bevel1'#5'Shape'#7#9'bsTopLine'#3'Top'#2'I'#5'Style'#7#8'bsRaised'
+#5'Width'#3#230#0#4'Left'#2#14#6'Height'#2#3#3'Top'#2'I'#5'Width'#3#230#0#0#0
+#6'TLabel'#7'labPage'#7'Caption'#6#5'Pages'#5'Color'#7#6'clNone'#4'Left'#2#14
+#6'Height'#2#17#3'Top'#2'Z'#5'Width'#2'f'#0#0#5'TEdit'#7'edRange'#8'TabOrder'
+#2#0#4'Left'#2'\'#6'Height'#2#23#3'Top'#2'/'#5'Width'#2'p'#0#0#9'TComboBox'#9
+'edPageSet'#13'Items.Strings'#1#6#9'All pages'#6#9'Odd pages'#6#10'Even page'
+'s'#0#9'ItemIndex'#2#0#9'MaxLength'#2#0#11'ParentCtl3D'#8#5'Style'#7#14'csDr'
+'opDownList'#8'TabOrder'#2#1#4'Text'#6#9'All pages'#4'Left'#3#132#0#6'Height'
+#2#25#3'Top'#2'R'#5'Width'#2'v'#0#0#12'TRadioButton'#13'rbCurrentPage'#11'Al'
+'lowGrayed'#9#7'Caption'#6#12'Current page'#10'DragCursor'#7#9'crDefault'#7
+'Enabled'#8#8'TabOrder'#2#2#4'Left'#2#12#6'Height'#2#20#3'Top'#2#26#5'Width'
+#2'b'#0#0#12'TRadioButton'#7'rbRange'#11'AllowGrayed'#9#7'Caption'#6#5'Range'
+#10'DragCursor'#7#9'crDefault'#8'TabOrder'#2#4#4'Left'#2#12#6'Height'#2#20#3
+'Top'#2'2'#5'Width'#2'='#0#0#12'TRadioButton'#9'rbAllPage'#11'AllowGrayed'#9
+#7'Caption'#6#4'All '#7'Checked'#9#10'DragCursor'#7#9'crDefault'#5'State'#7#9
+'cbChecked'#8'TabOrder'#2#3#4'Left'#2#12#6'Height'#2#20#3'Top'#2#2#5'Width'#2
+'0'#0#0#0#9'TGroupBox'#8'gbCopies'#7'Caption'#6#8' Copies '#12'ClientHeight'
+#2'r'#11'ClientWidth'#3#253#0#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'
+#2#1#4'Left'#3#23#1#6'Height'#3#131#0#3'Top'#2#7#5'Width'#3#1#1#0#6'TImage'
+#10'imgCollate'#8'AutoSize'#9#12'Proportional'#9#11'Transparent'#9#4'Left'#2
+#6#6'Height'#2'%'#3'Top'#2' '#5'Width'#2']'#0#0#6'TLabel'#12'lanNumCopies'#7
+'Caption'#6#16'Number of copies'#5'Color'#7#6'clNone'#4'Left'#2#6#6'Height'#2
+#17#3'Top'#2#8#5'Width'#2'q'#0#0#9'TSpinEdit'#8'edCopies'#9'ClimbRate'#2#1#8
+'MaxValue'#2'd'#8'TabOrder'#2#0#4'Left'#3#134#0#6'Height'#2#20#3'Top'#2#3#5
+'Width'#2'2'#0#0#9'TCheckBox'#9'cbCollate'#11'AllowGrayed'#9#7'Caption'#6#7
+'Collate'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#14'cbReverseCLICK'#8'Ta'
+'bOrder'#2#2#4'Left'#2'w'#6'Height'#2#20#3'Top'#2' '#5'Width'#2'h'#0#0#9'TCh'
,'eckBox'#9'cbReverse'#11'AllowGrayed'#9#7'Caption'#6#7'Reverse'#10'DragCurso'
+'r'#7#9'crDefault'#7'OnClick'#7#14'cbReverseCLICK'#8'TabOrder'#2#1#4'Left'#2
+'w'#6'Height'#2#20#3'Top'#2'<'#5'Width'#2'x'#0#0#0#0#5'TPage'#9'pgAdvance'#7
+'Caption'#6#8'Advanced'#11'ClientWidth'#3#21#2#12'ClientHeight'#3#138#0#4'Le'
+'ft'#2#2#6'Height'#3#138#0#3'Top'#2#28#5'Width'#3#21#2#0#6'TLabel'#7'labTask'
+#7'Caption'#6#12'Delayed task'#5'Color'#7#6'clNone'#4'Left'#2#7#6'Height'#2
+#17#3'Top'#2#10#5'Width'#3#201#0#0#0#6'TLabel'#6'Label5'#7'Caption'#6#8'Prio'
+'rity'#5'Color'#7#6'clNone'#4'Left'#2#7#6'Height'#2#17#3'Top'#2'-'#5'Width'#2
+'p'#0#0#9'TComboBox'#10'cbTasktime'#13'Items.Strings'#1#6#9'Immediate'#6#18
+'Never (suspending)'#6#14'during the day'#6#7'evening'#6#5'night'#6#7'Weeken'
+'d'#6#23'After close of business'#6#14'After midnight'#6#7'At time'#0#9'Item'
+'Index'#2#0#9'MaxLength'#2#0#8'OnChange'#7#16'cbTasktimeCHANGE'#10'OnKeyPres'
+'s'#7#18'cbPrintersKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'
+#8'TabOrder'#2#1#4'Text'#6#9'Immediate'#4'Left'#3#215#0#6'Height'#2#25#3'Top'
+#2#7#5'Width'#3#200#0#0#0#9'TMaskEdit'#10'edTimeTask'#10'DragCursor'#7#9'crD'
+'efault'#8'EditMask'#6#8'99:99:99'#9'MaxLength'#2#8#11'ParentCtl3D'#8#8'TabO'
+'rder'#2#0#4'Text'#6#8'23:00:00'#4'Left'#3#173#1#6'Height'#2#23#3'Top'#2#9#5
+'Width'#2':'#0#0#9'TSpinEdit'#10'edPriority'#9'ClimbRate'#2#1#8'MaxValue'#2
+'d'#8'TabOrder'#2#3#4'Left'#2''#6'Height'#2#20#3'Top'#2'*'#5'Width'#2'2'#0#0
+#9'TTrackBar'#11'tkbPriority'#10'DragCursor'#7#9'crDefault'#9'Frequency'#2#10
+#3'Max'#2'd'#8'OnChange'#7#17'tkbPriorityCHANGE'#11'ParentCtl3D'#8#8'Positio'
+'n'#2#10#8'ScalePos'#7#5'trTop'#8'TabOrder'#2#2#7'TabStop'#8#9'TickMarks'#7#6
+'tmBoth'#9'Frequency'#2#10#3'Max'#2'd'#8'OnChange'#7#17'tkbPriorityCHANGE'#8
+'Position'#2#10#8'ScalePos'#7#5'trTop'#7'TabStop'#8#9'TickMarks'#7#6'tmBoth'
+#4'Left'#3#192#0#6'Height'#2#20#3'Top'#2'1'#5'Width'#3'O'#1#0#0#0#0#6'TPanel'
+#6'Panel1'#5'Align'#7#8'alBottom'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#12'C'
+'lientHeight'#2')'#11'ClientWidth'#3#25#2#11'FullRepaint'#8#8'TabOrder'#2#2#7
+'TabStop'#9#6'Height'#2')'#3'Top'#3'X'#1#5'Width'#3#25#2#0#7'TButton'#9'btnC'
+'ancel'#7'Anchors'#11#5'akTop'#7'akRight'#0#6'Cancel'#9#7'Caption'#6#6'Cance'
+'l'#11'ModalResult'#2#2#8'TabOrder'#2#0#4'Left'#3#176#1#6'Height'#2#25#3'Top'
+#2#8#5'Width'#2'['#0#0#7'TButton'#8'btnPrint'#7'Anchors'#11#5'akTop'#7'akRig'
+'ht'#0#7'Caption'#6#5'Print'#7'Default'#9#11'ModalResult'#2#1#7'OnClick'#7#13
+'btnPrintCLICK'#8'TabOrder'#2#1#4'Left'#3'H'#1#6'Height'#2#25#3'Top'#2#8#5'W'
+'idth'#2'c'#0#0#7'TButton'#8'btnReduc'#7'Caption'#6#8'More ...'#7'OnClick'#7
+#13'btnReducCLICK'#8'TabOrder'#2#2#4'Left'#2#8#6'Height'#2#25#3'Top'#2#8#5'W'
+'idth'#2'X'#0#0#7'TButton'#10'btnPreview'#7'Caption'#6#7'Preview'#11'ModalRe'
+'sult'#2#6#8'TabOrder'#2#3#4'Left'#3#208#0#6'Height'#2#25#3'Top'#2#8#5'Width'
+#2'{'#0#0#0#0
'TPF0'#17'TdlgSelectPrinter'#16'dlgSelectPrinter'#13'ActiveControl'#7#10'cbPr'
+'inters'#7'Caption'#6#8'Printing'#12'ClientHeight'#3#145#1#11'ClientWidth'#3
+'('#2#8'OnCreate'#7#22'dlgSelectPrinterCREATE'#6'OnShow'#7#20'dlgSelectPrint'
+'erSHOW'#13'PixelsPerInch'#2'K'#18'HorzScrollBar.Page'#3''''#2#18'VertScroll'
+'Bar.Page'#3#144#1#4'Left'#2'a'#6'Height'#3#145#1#3'Top'#2'$'#5'Width'#3'('#2
+#0#6'TLabel'#7'labCUPS'#7'Caption'#6'"CUPS (Common Unix Printing System)'#5
+'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#8#6'Height'#2#13#3'Top'#3#152
+#0#5'Width'#3#212#0#0#0#6'TLabel'#13'labCUPSServer'#7'Caption'#6#13'labCUPSS'
+'erver'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#3#240#0#6'Height'#2#13
+#3'Top'#3#152#0#5'Width'#2'X'#0#0#9'TGroupBox'#9'Groupbox1'#7'Caption'#6#9' '
+'Printer '#12'ClientHeight'#2'w'#11'ClientWidth'#3#20#2#11'ParentCtl3D'#8#8
+'TabOrder'#2#0#4'Left'#2#8#6'Height'#3#136#0#3'Top'#2#8#5'Width'#3#24#2#0#6
+'TImage'#6'ImgPrn'#11'Transparent'#9#4'Left'#2'|'#6'Height'#2#19#3'Top'#2#7#5
+'Width'#2#17#0#0#6'TLabel'#6'Label1'#7'Caption'#6#4'Name'#5'Color'#7#6'clNon'
+'e'#11'ParentColor'#8#4'Left'#2#19#6'Height'#2#13#3'Top'#2#9#5'Width'#2'!'#0
+#0#6'TLabel'#6'Label2'#7'Caption'#6#5'State'#5'Color'#7#6'clNone'#11'ParentC'
+'olor'#8#4'Left'#2#17#6'Height'#2#13#3'Top'#2'$'#5'Width'#2#29#0#0#6'TLabel'
+#6'Label3'#7'Caption'#6#8'Location'#5'Color'#7#6'clNone'#11'ParentColor'#8#4
+'Left'#2#18#6'Height'#2#13#3'Top'#2'@'#5'Width'#2'1'#0#0#6'TLabel'#6'Label4'
+#7'Caption'#6#11'Description'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'
+#2#17#6'Height'#2#13#3'Top'#2'\'#5'Width'#2'@'#0#0#6'TLabel'#8'labState'#7'C'
+'aption'#6#8'labState'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#3#128#0
+#6'Height'#2#13#3'Top'#2'('#5'Width'#2'.'#0#0#6'TLabel'#11'labLocation'#7'Ca'
+'ption'#6#11'labLocation'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#3
+#128#0#6'Height'#2#13#3'Top'#2'B'#5'Width'#2'B'#0#0#6'TLabel'#10'labComment'
+#7'Caption'#6#10'labComment'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2
+'~'#6'Height'#2#13#3'Top'#2'\'#5'Width'#2'E'#0#0#9'TComboBox'#10'cbPrinters'
+#9'MaxLength'#2#0#8'OnChange'#7#16'cbPrintersCHANGE'#10'OnKeyPress'#7#18'cbP'
+'rintersKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'
+#2#0#4'Text'#6#10'cbPrinters'#4'Left'#3#142#0#6'Height'#2#22#3'Top'#2#6#5'Wi'
+'dth'#3#24#1#0#0#7'TButton'#7'btnProp'#25'BorderSpacing.InnerBorder'#2#2#7'C'
+'aption'#6#14'Properties ...'#7'OnClick'#7#12'btnPropCLICK'#8'TabOrder'#2#1#4
+'Left'#3#174#1#6'Height'#2#25#3'Top'#2#4#5'Width'#2'\'#0#0#9'TCheckBox'#13'c'
+'bPrintToFile'#7'Caption'#6#13'Print to file'#8'TabOrder'#2#2#4'Left'#3#166#1
+#6'Height'#2#23#3'Top'#2'Y'#5'Width'#2'Z'#0#0#0#9'TNotebook'#6'NbOpts'#9'Pag'
+'eIndex'#2#0#4'Left'#2#8#6'Height'#3#192#0#3'Top'#3#168#0#5'Width'#3#25#2#0#5
+'TPage'#8'pgCopies'#7'Caption'#6#6'Copies'#11'ClientWidth'#3#25#2#12'ClientH'
+'eight'#3#170#0#6'Height'#3#170#0#3'Top'#2#22#5'Width'#3#25#2#0#9'TGroupBox'
+#7'gbPages'#7'Caption'#6#14' Select pages '#12'ClientHeight'#3#139#0#11'Clie'
+'ntWidth'#3#2#1#11'ParentCtl3D'#8#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#3#156
+#0#3'Top'#2#7#5'Width'#3#6#1#0#6'TBevel'#6'Bevel1'#6'Height'#2#3#4'Left'#2#18
+#4'Name'#6#6'Bevel1'#5'Shape'#7#9'bsTopLine'#3'Top'#2'd'#5'Style'#7#8'bsRais'
+'ed'#5'Width'#3#230#0#4'Left'#2#18#6'Height'#2#3#3'Top'#2'd'#5'Width'#3#230#0
+#0#0#6'TLabel'#7'labPage'#7'Caption'#6#5'Pages'#5'Color'#7#6'clNone'#11'Pare'
+'ntColor'#8#4'Left'#2#14#6'Height'#2#13#3'Top'#2't'#5'Width'#2'$'#0#0#5'TEdi'
+'t'#7'edRange'#8'TabOrder'#2#0#4'Left'#2'\'#6'Height'#2#23#3'Top'#2'F'#5'Wid'
+'th'#3#154#0#0#0#9'TComboBox'#9'edPageSet'#9'ItemIndex'#2#0#13'Items.Strings'
+#1#6#9'All pages'#6#9'Odd pages'#6#10'Even pages'#0#9'MaxLength'#2#0#11'Pare'
+'ntCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#1#4'Text'#6#9'All pa'
+'ges'#4'Left'#3#130#0#6'Height'#2#25#3'Top'#2'l'#5'Width'#2'v'#0#0#12'TRadio'
+'Button'#13'rbCurrentPage'#11'AllowGrayed'#9#7'Caption'#6#12'Current page'#10
+'DragCursor'#7#9'crDefault'#7'Enabled'#8#8'TabOrder'#2#2#4'Left'#2#14#6'Heig'
+'ht'#2#24#3'Top'#2#21#5'Width'#2'a'#0#0#12'TRadioButton'#7'rbRange'#11'Allow'
+'Grayed'#9#7'Caption'#6#5'Range'#10'DragCursor'#7#9'crDefault'#8'TabOrder'#2
+#4#4'Left'#2#14#6'Height'#2#24#3'Top'#2'D'#5'Width'#2'<'#0#0#12'TRadioButton'
+#9'rbAllPage'#11'AllowGrayed'#9#7'Caption'#6#4'All '#7'Checked'#9#10'DragCur'
+'sor'#7#9'crDefault'#5'State'#7#9'cbChecked'#8'TabOrder'#2#3#4'Left'#2#14#6
+'Height'#2#24#5'Width'#2'+'#0#0#12'TRadioButton'#11'rbSelection'#11'AllowGra'
+'yed'#9#7'Caption'#6#9'Selection'#10'DragCursor'#7#9'crDefault'#7'Enabled'#8
+#8'TabOrder'#2#5#4'Left'#2#14#6'Height'#2#24#3'Top'#2'-'#5'Width'#2'L'#0#0#0
+#9'TGroupBox'#8'gbCopies'#7'Caption'#6#8' Copies '#12'ClientHeight'#3#138#0
+#11'ClientWidth'#3#253#0#11'ParentCtl3D'#8#8'TabOrder'#2#1#4'Left'#3#23#1#6
+'Height'#3#155#0#3'Top'#2#7#5'Width'#3#1#1#0#6'TImage'#10'imgCollate'#8'Auto'
+'Size'#9#12'Proportional'#9#11'Transparent'#9#4'Left'#2#6#6'Height'#2'%'#3'T'
,'op'#2' '#5'Width'#2']'#0#0#6'TLabel'#12'lanNumCopies'#7'Caption'#6#16'Numbe'
+'r of copies'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#6#6'Height'#2
+#13#3'Top'#2#8#5'Width'#2'c'#0#0#9'TSpinEdit'#8'edCopies'#8'TabOrder'#2#0#4
+'Left'#3#134#0#6'Height'#2#20#3'Top'#2#3#5'Width'#2'2'#0#0#9'TCheckBox'#9'cb'
+'Collate'#11'AllowGrayed'#9#7'Caption'#6#7'Collate'#10'DragCursor'#7#9'crDef'
+'ault'#7'OnClick'#7#14'cbReverseCLICK'#8'TabOrder'#2#2#4'Left'#2'w'#6'Height'
+#2#24#3'Top'#2' '#5'Width'#2'?'#0#0#9'TCheckBox'#9'cbReverse'#11'AllowGrayed'
+#9#7'Caption'#6#7'Reverse'#10'DragCursor'#7#9'crDefault'#7'OnClick'#7#14'cbR'
+'everseCLICK'#8'TabOrder'#2#1#4'Left'#2'w'#6'Height'#2#24#3'Top'#2'<'#5'Widt'
+'h'#2'F'#0#0#0#0#5'TPage'#9'pgAdvance'#7'Caption'#6#8'Advanced'#11'ClientWid'
+'th'#3#25#2#12'ClientHeight'#3#170#0#6'Height'#3#170#0#3'Top'#2#22#5'Width'#3
+#25#2#0#6'TLabel'#7'labTask'#7'Caption'#6#12'Delayed task'#5'Color'#7#6'clNo'
+'ne'#11'ParentColor'#8#4'Left'#2#7#6'Height'#2#13#3'Top'#2#10#5'Width'#2'J'#0
+#0#6'TLabel'#6'Label5'#7'Caption'#6#8'Priority'#5'Color'#7#6'clNone'#11'Pare'
+'ntColor'#8#4'Left'#2#7#6'Height'#2#13#3'Top'#2'-'#5'Width'#2'('#0#0#9'TComb'
+'oBox'#10'cbTasktime'#9'ItemIndex'#2#0#13'Items.Strings'#1#6#9'Immediate'#6
+#18'Never (suspending)'#6#14'during the day'#6#7'evening'#6#5'night'#6#7'Wee'
+'kend'#6#23'After close of business'#6#14'After midnight'#6#7'At time'#0#9'M'
+'axLength'#2#0#8'OnChange'#7#16'cbTasktimeCHANGE'#10'OnKeyPress'#7#18'cbPrin'
+'tersKEYPRESS'#11'ParentCtl3D'#8#5'Style'#7#14'csDropDownList'#8'TabOrder'#2
+#1#4'Text'#6#9'Immediate'#4'Left'#3#215#0#6'Height'#2#25#3'Top'#2#7#5'Width'
+#3#200#0#0#0#9'TMaskEdit'#10'edTimeTask'#10'DragCursor'#7#9'crDefault'#8'Edi'
+'tMask'#6#8'99:99:99'#9'MaxLength'#2#8#11'ParentColor'#8#11'ParentCtl3D'#8#8
+'TabOrder'#2#0#7'TabStop'#9#4'Text'#6#8'23:00:00'#4'Left'#3#173#1#6'Height'#2
+#23#3'Top'#2#9#5'Width'#2':'#0#0#9'TSpinEdit'#10'edPriority'#8'TabOrder'#2#3
+#4'Left'#2''#6'Height'#2#20#3'Top'#2'*'#5'Width'#2'2'#0#0#9'TTrackBar'#11't'
+'kbPriority'#10'DragCursor'#7#9'crDefault'#9'Frequency'#2#10#3'Max'#2'd'#8'O'
+'nChange'#7#17'tkbPriorityCHANGE'#11'ParentCtl3D'#8#8'Position'#2#10#8'Scale'
+'Pos'#7#5'trTop'#8'TabOrder'#2#2#7'TabStop'#8#9'TickMarks'#7#6'tmBoth'#9'Fre'
+'quency'#2#10#3'Max'#2'd'#8'OnChange'#7#17'tkbPriorityCHANGE'#8'Position'#2
+#10#8'ScalePos'#7#5'trTop'#7'TabStop'#8#9'TickMarks'#7#6'tmBoth'#4'Left'#3
+#192#0#6'Height'#2#20#3'Top'#2'1'#5'Width'#3'O'#1#0#0#0#0#6'TPanel'#6'Panel1'
+#5'Align'#7#8'alBottom'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#12'ClientHeigh'
+'t'#2')'#11'ClientWidth'#3'('#2#11'FullRepaint'#8#8'TabOrder'#2#2#7'TabStop'
+#9#6'Height'#2')'#3'Top'#3'h'#1#5'Width'#3'('#2#0#7'TButton'#9'btnCancel'#7
+'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#2#6'Cance'
+'l'#9#7'Caption'#6#6'Cancel'#11'ModalResult'#2#2#8'TabOrder'#2#0#4'Left'#3
+#191#1#6'Height'#2#25#3'Top'#2#8#5'Width'#2'['#0#0#7'TButton'#8'btnPrint'#7
+'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#2#7'Capti'
+'on'#6#5'Print'#7'Default'#9#11'ModalResult'#2#1#7'OnClick'#7#13'btnPrintCLI'
+'CK'#8'TabOrder'#2#1#4'Left'#3'W'#1#6'Height'#2#25#3'Top'#2#8#5'Width'#2'c'#0
+#0#7'TButton'#8'btnReduc'#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#8'M'
+'ore ...'#7'OnClick'#7#13'btnReducCLICK'#8'TabOrder'#2#2#4'Left'#2#8#6'Heigh'
+'t'#2#25#3'Top'#2#8#5'Width'#2'X'#0#0#7'TButton'#10'btnPreview'#25'BorderSpa'
+'cing.InnerBorder'#2#2#7'Caption'#6#7'Preview'#11'ModalResult'#2#6#8'TabOrde'
+'r'#2#3#4'Left'#3#208#0#6'Height'#2#25#3'Top'#2#8#5'Width'#2'{'#0#0#0#0
]);

View File

@ -44,10 +44,12 @@ interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, ExtCtrls, Spin, MaskEdit, ComCtrls,LCLType,
Printers, osPrinters,
CUPSDyn,libc;
Printers, OsPrinters in '../osprinters.pas', CUPSDyn,libc;
type
{ TdlgSelectPrinter }
TdlgSelectPrinter = class(TForm)
Bevel1: TBEVEL;
btnProp: TBUTTON;
@ -58,6 +60,7 @@ type
cbPrinters: TCOMBOBOX;
cbCollate: TCHECKBOX;
cbReverse: TCHECKBOX;
cbPrintToFile: TCheckBox;
edPageSet: TCOMBOBOX;
cbTasktime: TCOMBOBOX;
edRange: TEDIT;
@ -84,6 +87,7 @@ type
pgAdvance: TPAGE;
pgCopies: TPAGE;
Panel1: TPANEL;
rbSelection: TRadioButton;
rbRange: TRADIOBUTTON;
rbCurrentPage: TRADIOBUTTON;
rbAllPage: TRADIOBUTTON;
@ -103,6 +107,7 @@ type
private
{ private declarations }
fPropertiesSetting : Boolean;
FOptions: TPrintDialogOptions;
function GetPrintRange: TPrintRange;
procedure RefreshInfos;
@ -113,6 +118,7 @@ type
constructor Create(aOwner : TComponent); override;
property PrintRange: TPrintRange read GetPrintRange write SetPrintRange;
property Options: TPrintDialogOptions read FOptions write FOptions;
end;
var
@ -196,6 +202,12 @@ var St : string;
begin
try
cbPrintToFile.Visible := (poPrintToFile in FOptions);
cbPrintToFile.Enabled := not (poDisablePrintToFile in FOptions);
rbSelection.Enabled := (poSelection in FOptions);
rbCurrentPage.Enabled := (poPageNums in FOptions);
//State
St:='';
StP:='printer';
@ -239,7 +251,9 @@ begin
cbCollate.Checked:=True; //For update image
//Range setting
edRange.Enabled:=THackCUPSPrinter(Printer).GetAttributeBoolean('page-ranges-supported',False);
edRange.Enabled:=
(poPageNums in FOptions) and
THackCUPSPrinter(Printer).GetAttributeBoolean('page-ranges-supported',False);
rbRange.Enabled:=edRange.Enabled;
//Job priority
@ -367,11 +381,12 @@ begin
if Sender=nil then ;
NbOpts.PageIndex:=0;
//Printers
Printer.Refresh;
cbPrinters.Items.Assign(Printer.Printers);
if cbPrinters.Items.Count>0 then
cbPrinters.ItemIndex:=0;
cbPrinters.ItemIndex:= Printer.PrinterIndex;
RefreshInfos;
end;

View File

@ -322,3 +322,19 @@ LazarusResources.Add('TPrintJobsDialog','XPM',[
+'aWaWaWaWaWaWaWcTQt",'#10'"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"'
+','#10'"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"};'#10
]);
LazarusResources.Add('TPageSetupDialog','XPM',[
'/* XPM */'#10'static char * Bitmap1_xpm[] = {'#10'"24 24 8 1",'#10'" '#9'c N'
+'one",'#10'".'#9'c #C0C0C0",'#10'"+'#9'c #000000",'#10'"@'#9'c #00FFFF",'#10
+'"#'#9'c #800000",'#10'"$'#9'c #FFFFFF",'#10'"%'#9'c #000080",'#10'"&'#9'c #'
+'0000FF",'#10'" ",'#10'" ...................... ",'#10
+'" . +++++++++++++++++ . ",'#10'" . +@@@@@#####@@@@@+ . ",'#10'" . +@@@@@'
+'#@@@#@@@@@+ . ",'#10'" . +@@@@@#@@@#@@@@@+ . ",'#10'" . +@@@@@#@@@#@@@@@+'
+' . ",'#10'" . +@@@@@#####@@@@@+ . ",'#10'" . +###@@@@@@@@@##@+ . ",'#10'"'
+' . +###@@++++++@##@+ . ",'#10'" . +@@@@+$$$$$$+@@@+ . ",'#10'" . +@@@+$+'
+'+++$+@@@@+ . ",'#10'" . +++++$$$$$$++++++ . ",'#10'" . +$++++$+ '
+'. ",'#10'" . +++$$$$$$++++ . ",'#10'" . +..++++++++...+ . ",'#10'" '
+'. +.............%+ . ",'#10'" .+..............&+ . ",'#10'" .+%..%%%%%%'
+'%%%.%.+ . ",'#10'" .+%............%+ . ",'#10'" .+.............+ .'
+' ",'#10'" . +++++++++++++ . ",'#10'" ...................... ",'#10'" '
+' "};'#10
]);

View File

@ -24,16 +24,33 @@ unit PrintersDlgs;
interface
uses
Classes, SysUtils, Dialogs, Printers, osPrinters, LResources;
Classes, SysUtils, Dialogs, LResources, Printers, OsPrinters;
type
{ Type for compatibility with delphi }
TMeasureUnits = (unMM,unInch);
{ Type for compatibility with delphi }
{ TPageSetupDialog }
TPageSetupDialog = class(TCustomPrinterSetupDialog)
private
fMargins : TRect;
fUnits : TMeasureUnits;
public
constructor Create(TheOwner: TComponent); override;
function Execute: Boolean; override;
property Margins : TRect read fMargins write fMargins;
property Units : TMeasureUnits read fUnits;
end;
{ TPrinterDialog }
TPrinterSetupDialog = class(TCustomPrinterSetupDialog)
public
function Execute: Boolean; override;
end;
{ TPrintDialog }
TPrintDialog = class(TCustomPrintDialog)
@ -56,25 +73,28 @@ procedure Register;
implementation
{$IFDEF LINUX}
{$I ./linux/cupsprndialogs.inc}
{$ENDIF}
{$IFDEF WIN32}
{$I win32/winprndialogs.inc}
{$ENDIF}
constructor TPageSetupDialog.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
fMargins.Bottom := 0;
fMargins.Left := 0;
fMargins.Right := 0;
fMargins.Top := 0;
end;
procedure Register;
begin
RegisterComponents('Dialogs',[TPrinterSetupDialog,TPrintDialog]);
RegisterComponents('Dialogs',[TPrinterSetupDialog,TPrintDialog,TPageSetupDialog]);
end;
{ TPrinterSetupDialog }
function TPrinterSetupDialog.Execute: Boolean;
begin
Result:=Printer.PrinterSetup;
end;
{ TPrinterDialog }
function TPrintDialog.Execute: Boolean;
begin
Result:=Printer.PrintDialog;
end;
initialization
{$I printersdlgs.lrs}

View File

@ -1,48 +1,137 @@
object Form1: TForm1
ActiveControl = Button2
Caption = 'Form1'
ClientHeight = 116
ClientHeight = 487
ClientWidth = 339
OnCreate = FormCreate
PixelsPerInch = 75
Position = poDesktopCenter
HorzScrollBar.Page = 338
VertScrollBar.Page = 115
Left = 245
Height = 116
Top = 167
VertScrollBar.Page = 486
Left = 212
Height = 487
Top = 47
Width = 339
object Label1: TLabel
Caption = 'This sample show how to use the printer dialogs'
Color = clNone
ParentColor = False
Left = 16
Height = 15
Top = 32
Width = 319
Height = 13
Top = 8
Width = 269
end
object Button2: TButton
BorderSpacing.InnerBorder = 2
Caption = 'Execute TPrinterSetupDialog'
OnClick = Button2Click
TabOrder = 0
Left = 16
Height = 25
Top = 48
Width = 312
Left = 8
Height = 27
Top = 51
Width = 320
end
object Button1: TButton
BorderSpacing.OnChange = nil
BorderSpacing.InnerBorder = 2
Caption = 'Execute TPrintDialog'
OnClick = Button1Click
TabOrder = 1
Left = 16
Left = 8
Height = 27
Top = 78
Width = 320
end
object SGrid: TStringGrid
AutoFillColumns = True
BorderStyle = bsNone
ColCount = 2
Columns = <
item
MinSize = 60
MaxSize = 350
ReadOnly = True
Title.Caption = 'Information'
Width = 250
end>
DefaultColWidth = 70
FixedColor = clBtnFace
Flat = True
GridLineWidth = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goSmoothScroll]
RowCount = 12
ScrollBars = ssAutoBoth
VisibleColCount = 1
VisibleRowCount = 11
Left = 8
Height = 288
Top = 192
Width = 320
end
object Button3: TButton
BorderSpacing.InnerBorder = 2
Caption = 'Get default printer info'
OnClick = Button3Click
TabOrder = 2
Left = 8
Height = 27
Top = 105
Width = 320
end
object Button4: TButton
BorderSpacing.InnerBorder = 2
Caption = 'Print test'
OnClick = Button4Click
TabOrder = 3
Left = 256
Height = 27
Top = 155
Width = 69
end
object Button5: TButton
BorderSpacing.InnerBorder = 2
Caption = 'Update printer state info'
OnClick = Button5Click
TabOrder = 4
Left = 8
Height = 25
Top = 80
Width = 312
Top = 132
Width = 224
end
object Button6: TButton
BorderSpacing.InnerBorder = 2
Caption = 'Show printer properties'
OnClick = Button6Click
TabOrder = 5
Left = 8
Height = 25
Top = 157
Width = 224
end
object Button7: TButton
BorderSpacing.InnerBorder = 2
Caption = 'Execute TPageSetupDialog'
OnClick = Button7Click
TabOrder = 6
Left = 8
Height = 27
Top = 24
Width = 320
end
object PSD: TPrinterSetupDialog
left = 8
top = 8
left = 176
top = 240
end
object PD: TPrintDialog
Copies = 1
left = 8
top = 248
left = 176
top = 272
end
object PopupMenu1: TPopupMenu
left = 216
top = 240
end
object PAGED: TPageSetupDialog
Title = 'Ustawienie strony raportu'
left = 176
top = 304
end
end

View File

@ -1,16 +1,42 @@
{ Ceci est un fichier ressource généré automatiquement par Lazarus }
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#7'Caption'#6#5'Form1'#12'ClientHeight'#2't'#11'Clie'
+'ntWidth'#3'S'#1#13'PixelsPerInch'#2'K'#18'HorzScrollBar.Page'#3'R'#1#18'Ver'
+'tScrollBar.Page'#2's'#4'Left'#3#245#0#6'Height'#2't'#3'Top'#3#167#0#5'Width'
+#3'S'#1#0#6'TLabel'#6'Label1'#7'Caption'#6'/This sample show how to use the '
+'printer dialogs'#5'Color'#7#6'clNone'#4'Left'#2#16#6'Height'#2#15#3'Top'#2
+' '#5'Width'#3'?'#1#0#0#7'TButton'#7'Button2'#7'Caption'#6#27'Execute TPrint'
+'erSetupDialog'#7'OnClick'#7#12'Button2Click'#8'TabOrder'#2#0#4'Left'#2#16#6
+'Height'#2#25#3'Top'#2'0'#5'Width'#3'8'#1#0#0#7'TButton'#7'Button1'#22'Borde'
+'rSpacing.OnChange'#13#7'Caption'#6#20'Execute TPrintDialog'#7'OnClick'#7#12
+'Button1Click'#8'TabOrder'#2#1#4'Left'#2#16#6'Height'#2#25#3'Top'#2'P'#5'Wid'
+'th'#3'8'#1#0#0#19'TPrinterSetupDialog'#3'PSD'#4'left'#2#8#3'top'#2#8#0#0#12
+'TPrintDialog'#2'PD'#6'Copies'#2#1#4'left'#2#8#3'top'#3#248#0#0#0#0
'TPF0'#6'TForm1'#5'Form1'#13'ActiveControl'#7#7'Button2'#7'Caption'#6#5'Form1'
+#12'ClientHeight'#3#231#1#11'ClientWidth'#3'S'#1#8'OnCreate'#7#10'FormCreate'
+#13'PixelsPerInch'#2'K'#8'Position'#7#15'poDesktopCenter'#18'HorzScrollBar.P'
+'age'#3'R'#1#18'VertScrollBar.Page'#3#230#1#4'Left'#3#212#0#6'Height'#3#231#1
+#3'Top'#2'/'#5'Width'#3'S'#1#0#6'TLabel'#6'Label1'#7'Caption'#6'/This sample'
+' show how to use the printer dialogs'#5'Color'#7#6'clNone'#11'ParentColor'#8
+#4'Left'#2#16#6'Height'#2#13#3'Top'#2#8#5'Width'#3#13#1#0#0#7'TButton'#7'But'
+'ton2'#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#27'Execute TPrinterSet'
+'upDialog'#7'OnClick'#7#12'Button2Click'#8'TabOrder'#2#0#4'Left'#2#8#6'Heigh'
+'t'#2#27#3'Top'#2'3'#5'Width'#3'@'#1#0#0#7'TButton'#7'Button1'#25'BorderSpac'
+'ing.InnerBorder'#2#2#7'Caption'#6#20'Execute TPrintDialog'#7'OnClick'#7#12
+'Button1Click'#8'TabOrder'#2#1#4'Left'#2#8#6'Height'#2#27#3'Top'#2'N'#5'Widt'
+'h'#3'@'#1#0#0#11'TStringGrid'#5'SGrid'#15'AutoFillColumns'#9#11'BorderStyle'
+#7#6'bsNone'#8'ColCount'#2#2#7'Columns'#14#1#7'MinSize'#2'<'#7'MaxSize'#3'^'
+#1#8'ReadOnly'#9#13'Title.Caption'#6#11'Information'#5'Width'#3#250#0#0#0#15
+'DefaultColWidth'#2'F'#10'FixedColor'#7#9'clBtnFace'#4'Flat'#9#13'GridLineWi'
+'dth'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLin'
+'e'#10'goHorzLine'#13'goRangeSelect'#14'goSmoothScroll'#0#8'RowCount'#2#12#10
+'ScrollBars'#7#10'ssAutoBoth'#15'VisibleColCount'#2#1#15'VisibleRowCount'#2
+#11#4'Left'#2#8#6'Height'#3' '#1#3'Top'#3#192#0#5'Width'#3'@'#1#0#0#7'TButto'
+'n'#7'Button3'#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#24'Get default'
+' printer info'#7'OnClick'#7#12'Button3Click'#8'TabOrder'#2#2#4'Left'#2#8#6
+'Height'#2#27#3'Top'#2'i'#5'Width'#3'@'#1#0#0#7'TButton'#7'Button4'#25'Borde'
+'rSpacing.InnerBorder'#2#2#7'Caption'#6#10'Print test'#7'OnClick'#7#12'Butto'
+'n4Click'#8'TabOrder'#2#3#4'Left'#3#0#1#6'Height'#2#27#3'Top'#3#155#0#5'Widt'
+'h'#2'E'#0#0#7'TButton'#7'Button5'#25'BorderSpacing.InnerBorder'#2#2#7'Capti'
+'on'#6#25'Update printer state info'#7'OnClick'#7#12'Button5Click'#8'TabOrde'
+'r'#2#4#4'Left'#2#8#6'Height'#2#25#3'Top'#3#132#0#5'Width'#3#224#0#0#0#7'TBu'
+'tton'#7'Button6'#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#23'Show pri'
+'nter properties'#7'OnClick'#7#12'Button6Click'#8'TabOrder'#2#5#4'Left'#2#8#6
+'Height'#2#25#3'Top'#3#157#0#5'Width'#3#224#0#0#0#7'TButton'#7'Button7'#25'B'
+'orderSpacing.InnerBorder'#2#2#7'Caption'#6#24'Execute TPageSetupDialog'#7'O'
+'nClick'#7#12'Button7Click'#8'TabOrder'#2#6#4'Left'#2#8#6'Height'#2#27#3'Top'
+#2#24#5'Width'#3'@'#1#0#0#19'TPrinterSetupDialog'#3'PSD'#4'left'#3#176#0#3't'
+'op'#3#240#0#0#0#12'TPrintDialog'#2'PD'#4'left'#3#176#0#3'top'#3#16#1#0#0#10
+'TPopupMenu'#10'PopupMenu1'#4'left'#3#216#0#3'top'#3#240#0#0#0#16'TPageSetup'
+'Dialog'#5'PAGED'#5'Title'#6#25'Ustawienie strony raportu'#4'left'#3#176#0#3
+'top'#3'0'#1#0#0#0
]);

View File

@ -25,7 +25,7 @@ interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons,
PrintersDlgs, StdCtrls;
PrintersDlgs, StdCtrls, Grids, Menus;
type
@ -34,13 +34,27 @@ type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Label1: TLABEL;
PAGED: TPageSetupDialog;
PD: TPrintDialog;
PopupMenu1: TPopupMenu;
PSD: TPrinterSetupDialog;
SGrid: TStringGrid;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
procedure UpdatePrinterInfo;
public
{ public declarations }
end;
@ -49,21 +63,155 @@ var
Form1: TForm1;
implementation
uses
Printers,OsPrinters,LCLType,LClProc;
{ TForm1 }
procedure TForm1.UpdatePrinterInfo;
var
ck : Integer;
s : String;
procedure AddInfo(const Desc : String; Const Info : String);
begin
SGrid.Cells[0,ck] := Desc;
SGrid.Cells[1,ck] := Info;
Inc(ck);
end;
begin
try
ck := 1;
SGrid.Clean;
with Printer do
begin
AddInfo('Printer',Printers[PrinterIndex]);
case Orientation of
poPortrait : AddInfo('Orientation','Portrait');
poLandscape : AddInfo('Orientation','Landscape');
poReverseLandscape : AddInfo('Orientation','ReverseLandscape');
poReversePortrait :AddInfo('Orientation','ReversePortrait');
end;
AddInfo('XDPI',IntToStr(XDPI));
AddInfo('YDPI',IntToStr(YDPI));
AddInfo('Copies',IntToStr(Copies));
AddInfo('PageHeight',IntToStr(PageHeight));
AddInfo('PageWidth',IntToStr(PageWidth));
case PrinterType of
ptLocal: AddInfo('PrinterType','Local');
ptNetWork: AddInfo('PrinterType','Network');
end;
case PrinterState of
psNoDefine: AddInfo('PrinterState','Undefined');
psReady:AddInfo('PrinterState','Ready');
psPrinting:AddInfo('PrinterState','Printing');
psStopped:AddInfo('PrinterState','Stopped');
end;
AddInfo('PaperSize',PaperSize.PaperName);
with PAGED do begin
if PAGED.Units = unMM then
begin
s :=' milimeters';
s := Format('[%d,%d,%d,%d] %s',[Margins.Top div 100,
Margins.Left div 100, Margins.Bottom div 100, Margins.Right div 100,
s]);
end
else
begin
s :=' inches';
s := Format('[%d,%d,%d,%d] %s',[Margins.Top div 1000,
Margins.Left div 1000,Margins.Bottom div 1000,Margins.Right div 1000,
s]);
end;
AddInfo('Margins',s);
end;
if not CanPrint then
Application.MessageBox('Selected printer cannot print currently!',
'Warning',mb_iconexclamation);
end;
except on E:Exception do
Application.MessageBox(PChar(e.message),'Error',mb_iconhand);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
PSD.Execute;
if PSD.Execute then
UpdatePrinterInfo;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Printer.PrinterIndex := 0;
UpdatePrinterInfo;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
try
Printer.Title := 'Printer test for printers4lazarus package';
Printer.BeginDoc;
Printer.Canvas.Font.Color:= clBlue;
Printer.Canvas.Font.Size := 12;
Printer.Canvas.TextOut(0,0,'This is test for lazarus printer4lazarus package');
Printer.EndDoc;
except on E:Exception do
begin
Printer.Abort;
Application.MessageBox(pChar(e.message),'Error',mb_iconhand);
end;
end;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
UpdatePrinterInfo;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
{$IFDEF WIN32}
TWinPrinter(Printer).Properties;
{$ELSE}
ShowMessage('Printer.Properties is not implemented for this platform');
{$ENDIF}
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
if PAGED.Execute then UpdatePrinterInfo;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
UpdatePrinterInfo;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s,x : String;
begin
PD.Execute;
PD.Copies := 4;
PD.FromPage := 1;
PD.ToPage := 5;
PD.MinPage := 1;
PD.MaxPage := 5;
PD.PrintRange := prAllPages;
//PD.Options := [poPageNums,poSelection,poPrintToFile];
if PD.Execute then
begin
UpdatePrinterInfo;
if PD.PrintRange=prPageNums then x :='Pages range,';
if PD.PrintRange=prSelection then x :='Selection,';
if PD.PrintToFile then x := x + ' ,PrintToFile,';
s := Format(x + ' From : %d to %d,Copies:%d',[PD.FromPage,PD.ToPage,PD.Copies]);
Application.MessageBox(pChar(s),'Info',mb_iconinformation);
end;
end;
initialization
{$I frmselprinter.lrs}

View File

@ -1,87 +1,59 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<PathDelim Value="/"/>
<Version Value="5"/>
<General>
<Flags>
<SaveClosedFiles Value="False"/>
</Flags>
<MainUnit Value="0"/>
<ActiveEditorIndexAtStart Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
<Title Value="selectprinter"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<JumpHistory Count="0" HistoryIndex="-1"/>
<Units Count="9">
<LazDoc Paths=""/>
<Units Count="4">
<Unit0>
<CursorPos X="41" Y="12"/>
<Filename Value="selectprinter.lpr"/>
<IsPartOfProject Value="True"/>
<TopLine Value="1"/>
<UnitName Value="selectprinter"/>
<UsageCount Value="20"/>
<UsageCount Value="114"/>
</Unit0>
<Unit1>
<CursorPos X="12" Y="28"/>
<CursorPos X="17" Y="24"/>
<EditorIndex Value="0"/>
<Filename Value="frmselprinter.pas"/>
<ComponentName Value="Form1"/>
<IsPartOfProject Value="True"/>
<Loaded Value="True"/>
<ResourceFilename Value="frmselprinter.lrs"/>
<TopLine Value="1"/>
<TopLine Value="20"/>
<UnitName Value="frmselprinter"/>
<UsageCount Value="20"/>
<UsageCount Value="114"/>
</Unit1>
<Unit2>
<CursorPos X="15" Y="29"/>
<Filename Value="G:\projects\winspl\PrintersDlgs.pp"/>
<TopLine Value="1"/>
<UnitName Value="PrintersDlgs"/>
<UsageCount Value="10"/>
<CursorPos X="15" Y="27"/>
<Filename Value="C:/lazarus/components/printers/win32/winprndialogs.inc"/>
<IsPartOfProject Value="True"/>
<TopLine Value="45"/>
<UnitName Value="text"/>
<UsageCount Value="60"/>
</Unit2>
<Unit3>
<CursorPos X="87" Y="19"/>
<Filename Value="xfrmselprinter.pas"/>
<ComponentName Value="Form1"/>
<CursorPos X="1" Y="1"/>
<Filename Value="C:/lazarus/components/printers/linux/cupsprndialogs.inc"/>
<IsPartOfProject Value="True"/>
<TopLine Value="1"/>
<UnitName Value="frmSelPrinter"/>
<UsageCount Value="10"/>
<UnitName Value="text"/>
<UsageCount Value="60"/>
</Unit3>
<Unit4>
<CursorPos X="46" Y="27"/>
<Filename Value="\home\olivier\lazarus\components\printers\printersdlgs.pp"/>
<TopLine Value="1"/>
<UnitName Value="PrintersDlgs"/>
<UsageCount Value="10"/>
</Unit4>
<Unit5>
<CursorPos X="23" Y="48"/>
<Filename Value="\home\olivier\lazarus\components\printers\osprinters.pas"/>
<TopLine Value="10"/>
<UnitName Value="OSPrinters"/>
<UsageCount Value="10"/>
</Unit5>
<Unit6>
<CursorPos X="47" Y="669"/>
<Filename Value="\home\olivier\lazarus\components\printers\linux\cupsprinters.inc"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit6>
<Unit7>
<CursorPos X="16" Y="57"/>
<Filename Value="\home\olivier\lazarus\components\printers\linux\cupsprinters_h.inc"/>
<TopLine Value="48"/>
<UsageCount Value="10"/>
</Unit7>
<Unit8>
<CursorPos X="1" Y="1389"/>
<Filename Value="\home\olivier\lazarus\components\printers\linux\cupsdyn.pp"/>
<TopLine Value="1344"/>
<UnitName Value="cupsdyn"/>
<UsageCount Value="10"/>
</Unit8>
</Units>
<PublishOptions>
<Version Value="2"/>
<DestinationDirectory Value="$(TestDir)\publishedproject\"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
@ -89,7 +61,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="2">
@ -101,13 +73,19 @@
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<JumpHistory Count="0" HistoryIndex="-1"/>
</ProjectOptions>
<CompilerOptions>
<Version Value="4"/>
<PathDelim Value="\"/>
<Version Value="5"/>
<SearchPaths>
<SrcPath Value="$(LazarusDir)\lcl\;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)\"/>
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<DelphiCompat Value="True"/>
<UseAnsiStrings Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
@ -121,21 +99,22 @@
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
<CompileReasons Run="False"/>
</CompilerOptions>
<Debugging>
<BreakPoints Count="3">
<BreakPoints Count="1">
<Item1>
<Source Value="G:\projects\udf_ib\udf_glob.pas"/>
<Line Value="117"/>
<Source Value="C:/lazarus/components/printers/win32/winprndialogs.inc"/>
<Line Value="20"/>
</Item1>
</BreakPoints>
<Watches Count="2">
<Item1>
<Expression Value="lpp.nCopies"/>
</Item1>
<Item2>
<Source Value="G:\projects\udf_ib\udf_glob.pas"/>
<Line Value="119"/>
<Expression Value="DevMode^.dmCopies"/>
</Item2>
<Item3>
<Source Value="G:\projects\udf_ib\TimeFncs.pas"/>
<Line Value="185"/>
</Item3>
</BreakPoints>
</Watches>
</Debugging>
</CONFIG>

View File

@ -1,23 +1,8 @@
{**************************************************************
Implementation for winprinter
***************************************************************}
Uses WinUtilPrn, InterfaceBase, Win32Int, LCLIntf;
Uses WinUtilPrn, InterfaceBase, Win32Int, LCLIntf,WinVer;
Const
Win32Orientations: array [TPrinterOrientation] of Integer = (
DMORIENT_PORTRAIT, DMORIENT_LANDSCAPE, DMORIENT_PORTRAIT, DMORIENT_LANDSCAPE);
Type
TPrinterDevice = class
Name : String;
Driver : String;
Device : String;
Port : String;
DefaultPaper : Short;
DevMode: TDeviceMode;
end;
{ TWinPrinter }
@ -46,96 +31,18 @@ begin
Result:=fDC;
end;
function TWinPrinter.BaseDialogs(aFlag : DWORD):boolean;
var lpp : tagPD;
PDev : TPrinterDevice;
DevMode : PDeviceMode;
DeviceMode : THandle;
DevNames : PDevNames;
St : PChar;
procedure TWinPrinter.SetHandlePrinter(aValue : HDC);
begin
Result:=False;
if Printers.Count>0 then
if aValue <> fDC then
begin
FillChar(lpp,SizeOf(lpp),0);
with lpp do
begin
lStructSize:=SizeOf(lpp);
hInstance:=LCLType.HInstance;
Flags:=aFlag or PD_RETURNDC;
hWndOwner:=TWin32WidgetSet(WidgetSet).AppHandle;
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
DeviceMode:=GlobalAlloc(GHND,SizeOf(PDev.DevMode)+1);
DevMode:=PDeviceMode(GlobalLock(DeviceMode));
try
DevMode^:=PDev.DevMode;
finally
GlobalUnLock(DeviceMode);
end;
hDevMode:=DeviceMode;
nCopies:=1;
try
if PrintDlg(lpp) then
begin
St:='';
//Change Selected printer
if lpp.hDevNames<>0 then
begin
DevNames:=PDevNames(GlobalLock(lpp.hDevNames));
try
St:=PChar(DevNames)+DevNames^.wDeviceOffset;
SetPrinter(St);
finally
GlobalUnlock(lpp.hDevNames);
GlobalFree(lpp.hDevNames);
end;
end;
Result:=True;
if lpp.hDevMode<>0 then
begin
DevMode:=PDeviceMode(GlobalLock(lpp.hDevMode));
try
//Set the properties for the selected printer
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
PDev.DevMode:=DevMode^;
ClearDC;
fDC := lpp.hDC;
if Assigned(Canvas) then Canvas.Handle:=fDC;
fLastHandleType:=2;
finally
GlobalUnlock(lpp.hDevMode);
GlobalFree(lpp.hDevMode);
end;
end;
end;
finally
if DeviceMode<>0 then
GlobalFree(DeviceMode);
if hDevNames<>0 then
GlobalFree(hDevNames);
end;
end;
ClearDC;
fDC := aValue;
if Assigned(Canvas) then Canvas.Handle:=fDC;
fLastHandleType:=2;
end;
end;
function TWinPrinter.PrinterSetup: Boolean;
begin
Result:=BaseDialogs(PD_PRINTSETUP);
end;
function TWinPrinter.PrintDialog: Boolean;
begin
Result:=BaseDialogs(PD_COLLATE or PD_USEDEVMODECOPIES);
end;
function TWinPrinter.GetXDPI: Integer;
begin
Result:=72;
@ -170,7 +77,7 @@ begin
PChar(PDev.Port),@PDev.DevMode);
if fDC=0 then
raise EPrinter.Create(Format('Invalide printer (DC=%d Driver=%s Device=%s Port=%s)',[fDC,Pdev.Driver,PDev.Device,PDev.Port]));
raise EPrinter.Create(Format('Invalid printer (DC=%d Driver=%s Device=%s Port=%s)',[fDC,Pdev.Driver,PDev.Device,PDev.Port]));
if Assigned(Canvas) then
Canvas.Handle:=fDC;
fLastHandleType:=1;
@ -178,38 +85,33 @@ begin
end;
procedure TWinPrinter.SetDC;
var
PDev : TPrinterDevice;
Driver : PChar;
function IsNT : Boolean;
var
OVI: TOsVersionInfo;
begin
OVI.dwOSVersionInfoSize := Sizeof( OVI );
GetVersionEx( OVI );
Result := (OVI.dwPlatformId = VER_PLATFORM_WIN32_NT);
end;
var PDev : TPrinterDevice;
begin
if (fLastHandleType<>2) and (Printers.Count>0) then
begin
ClearDC;
if IsNt then Driver := pChar('WINSPOOL')
else
Driver := nil;
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
fDC:=CreateDC(Driver,PChar(PDev.Device),nil,@PDev.DevMode);
if fDC=0 then fDC:=CreateDC(Driver,PChar(PDev.Driver),nil,@PDev.DevMode);
try
fDC:=CreateDC(nil,PChar(PDev.Device),nil,@PDev.DevMode);
if fDC=0 then fDC:=CreateDC(PChar('WISPOOL'),PChar(PDev.Device),nil,@PDev.DevMode);
{Workaround (hack) for Lexmark 1020 JetPrinter (Mono)}
if fDC=0 then fDC:=CreateDC(nil,PChar(PDev.Driver),nil,@PDev.DevMode);
if fDC=0 then fDC:=CreateDC(pChar('WINSPOOL'),PChar(PDev.Driver),nil,@PDev.DevMode);
except on E:Exception do
raise EPrinter.Create(Format('CreateDC exception: %s (LastError : %s,DC=%d Driver=%s Device=%s Port=%s)',[E.Message,SysErrorMessage(GetLastError),fDC,Pdev.Driver,PDev.Device,PDev.Port]));
end;
if fDC=0 then
raise EPrinter.Create(Format('Invalid printer (Error: %s DC=%d Driver=%s Device=%s Port=%s)',[SysErrorMessage(GetLastError),fDC,Pdev.Driver,PDev.Device,PDev.Port]));
raise EPrinter.Create(Format('Invalid printer (Error : %s,DC=%d Driver=%s Device=%s Port=%s)',[SysErrorMessage(GetLastError),fDC,Pdev.Driver,PDev.Device,PDev.Port]));
if Assigned(Canvas) then
Canvas.Handle:=fDC;
fLastHandleType:=2;
end;
end;
@ -218,10 +120,16 @@ begin
if Assigned(Canvas) then
Canvas.Handle:=0;
if fDC<>0 then
DeleteDC(fDC);
begin
DeleteDC(fDC);
fDc := 0;
end;
fLastHandleType:=0;
end;
procedure TWinPrinter.DoBeginDoc;
var Inf: TDocInfo;
begin
@ -230,7 +138,7 @@ begin
if fPrinterHandle=0 then
raise EPrinter.Create('Printer handle not defined');
ClearDC;
SetDC;
Canvas.Handle:=fDC;
Canvas.Refresh;
@ -267,6 +175,35 @@ begin
AbortDoc(fDC);
end;
(*
function TWinPrinter.GetDefaultPrinter : String;
var
PrtCount : DWORD;
Needed : DWORD;
Buffer : PChar;
DefaultPrinter : array[0..79] of Char;
begin
Result:='';
Needed:=0;
EnumPrinters(PRINTER_ENUM_DEFAULT,nil,5,nil,0,Needed,PrtCount);
if Needed>0 then
begin
GetMem(Buffer,Needed);
try
if EnumPrinters(PRINTER_ENUM_DEFAULT,nil,5,Buffer,Needed,Needed,PrtCount) then
Result := String(PPRINTER_INFO_5(Buffer)^.pPrinterName);
finally
FreeMem(Buffer);
end;
end
else
begin
GetProfileString(PChar('windows'),PChar('device'),PChar(''),DefaultPrinter,SizeOf(DefaultPrinter));
if pos(',',DefaultPrinter)<>0 then
Result:=Copy(DefaultPrinter,1,Pos(',',DefaultPrinter)-1);
end;
end;
*)
//Enum all defined printers. First printer it's default
procedure TWinPrinter.DoEnumPrinters(Lst: TStrings);
@ -307,6 +244,7 @@ begin
DefaultPrinter:=Copy(DefaultPrinter,1,Pos(',',DefaultPrinter)-1);
end;
Flags:=PRINTER_ENUM_CONNECTIONS or PRINTER_ENUM_LOCAL;
Level:=2;
@ -376,6 +314,7 @@ procedure TWinPrinter.DoEnumPapers(Lst: TStrings);
var Buffer : PChar;
PaperN : String;
PaperC,i : Integer;
Count : Integer;
PDev : TPrinterDevice;
ArPapers : Array[0..255] of Word;
begin
@ -391,12 +330,15 @@ begin
if fPrinterHandle=0 then
raise EPrinter.Create('Printer handle not defined');
//Reteive the supported papers
//Retreive the supported papers
PaperC:=0;
GetMem(Buffer,64*255);
Count := DeviceCapabilities(PChar(Pdev.Name),PCHar(PDev.Port),
DC_PAPERNAMES,nil,nil);
if Count<=0 then raise EPrinter.CreateFmt('DoEnumPapers<DC_PAPERNAMES> error : %d, (%s)',[GetLastError,SysErrorMessage(GetLastError)]);
GetMem(Buffer,64*Count);
try
PaperC:=DeviceCapabilities(PChar(Pdev.Name),PCHar(PDev.Port),
DC_PAPERNAMES,Buffer,@PDev.DevMode);
DC_PAPERNAMES,Buffer,nil);
for i:=0 to PaperC-1 do
begin
PaperN:=StrPas(Buffer+i*64);
@ -406,12 +348,16 @@ begin
FreeMem(Buffer);
end;
//Retreive the code of papers
FillChar(ArPapers,SizeOf(ArPapers),0);
PaperC:=DeviceCapabilities(PChar(Pdev.Name),PCHar(PDev.Port),
DC_PAPERS,@ArPapers,@PDev.DevMode);
for i:=0 to PaperC-1 do
Lst.Objects[i]:=TObject(Pointer(Integer(ArPapers[i])));
DC_PAPERS,@ArPapers,nil);
if PaperC<=0 then raise EPrinter.CreateFmt('DoEnumPapers<DC_PAPERS> error : %d, (%s)',[GetLastError,SysErrorMessage(GetLastError)]);
for i:=0 to PaperC-1 do
Lst.Objects[i]:=TObject(Pointer(Integer(ArPapers[i])));
end;
end;
@ -441,13 +387,13 @@ begin
if (Printers.Count>0) then
begin
ClearDC;
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
i:=PaperSize.SupportedPapers.IndexOf(aName);
if i<>-1 then
begin
ClearDC;
j:=SHORT(Pointer(PaperSize.SupportedPapers.Objects[i]));
PDev.DevMode.dmPaperSize:=j;
end;
@ -468,7 +414,7 @@ begin
//Retreive the Width and Height of aName paper
FillChar(ArSizes,SizeOf(ArSizes),0);
NSize:=DeviceCapabilities(PChar(Pdev.Name),PChar(PDev.Port),
DC_PAPERSIZE,@ArSizes,@PDev.DevMode);
DC_PAPERSIZE,@ArSizes,nil);
i:=PaperSize.SupportedPapers.IndexOf(aName);
if (i>=0) and (i<NSize) and (NSize<>0) then
begin
@ -490,13 +436,13 @@ begin
if i<>-1 then
begin
ClearDC;
PDev:=TPrinterDevice(Printers.Objects[PrinterIndex]);
PDev:=TPrinterDevice(Printers.Objects[i]);
if fPrinterHandle<>0 then
ClosePrinter(fPrinterHandle);
if OpenPrinter(PChar(PDev.Name),fPrinterHandle,nil) then
Result:=i;
if not OpenPrinter(PChar(PDev.Name),fPrinterHandle,nil) then
raise EPrinter.CreateFmt('OpenPrinter exception : %s',[SysErrorMessage(GetlastError)]);
Result:=i;
end;
end;
@ -558,6 +504,85 @@ begin
end;
end;
function TWinPrinter.GetPrinterType: TPrinterType;
var
Size : Dword;
InfoPrt : Pointer;
begin
Result := inherited GetPrinterType;
Result:=ptLocal;
//On Win9X all printers are local
if Win32Platform <> VER_PLATFORM_WIN32_NT then Exit;
GetPrinter(fPrinterHandle,4,nil,0,Size);
GetMem(InfoPrt,Size);
try
if not GetPrinter(fPRinterHandle,4,InfoPrt,Size,Size)
then
raise EPrinter.CreateFmt('GetPrinterType failed : %s',[SysErrorMessage(GetLastError)]);
if PPRINTER_INFO_4(InfoPrt)^.Attributes = PRINTER_ATTRIBUTE_NETWORK then
Result := ptNetwork;
finally
FreeMem(InfoPrt);
end;
end;
function TWinPrinter.DoGetPrinterState: TPrinterState;
var
Size,Status,Jobs : Dword;
InfoPrt : Pointer;
begin
Result := inherited DoGetPrinterState;
Result:=psNoDefine;
GetPrinter(fPrinterHandle,2,nil,0,Size);
GetMem(InfoPrt,Size);
try
if not GetPrinter(fPrinterHandle,2,InfoPrt,Size,Size)
then
raise EPrinter.CreateFmt('GetPrinterState failed : %s',[SysErrorMessage(GetLastError)]);
Jobs := PPRINTER_INFO_2(InfoPrt)^.cJobs;
Status := PPRINTER_INFO_2(InfoPrt)^.Status;
case Status of
0 : Result := psReady;
PRINTER_STATUS_PRINTING,
PRINTER_STATUS_PROCESSING,
PRINTER_STATUS_WARMING_UP,
PRINTER_STATUS_WAITING,
PRINTER_STATUS_IO_ACTIVE,
PRINTER_STATUS_PENDING_DELETION,
PRINTER_STATUS_INITIALIZING: Result := psPrinting;
PRINTER_STATUS_PAPER_JAM,
PRINTER_STATUS_PAPER_OUT,
PRINTER_STATUS_PAPER_PROBLEM,
PRINTER_STATUS_USER_INTERVENTION,
PRINTER_STATUS_NO_TONER,
PRINTER_STATUS_ERROR,
PRINTER_STATUS_DOOR_OPEN,
PRINTER_STATUS_PAGE_PUNT,
PRINTER_STATUS_OUT_OF_MEMORY,
PRINTER_STATUS_PAUSED : Result := psStopped;
end;
if (Result = psReady) and (Jobs > 0) then Result := psPrinting;
finally
FreeMem(InfoPrt);
end;
end;
function TWinPrinter.GetCanPrint: Boolean;
begin
Result := inherited GetCanPrint;
Result := (DoGetPrinterState <> psStopped);
end;
procedure TWinPrinter.Properties;
begin
PrinterProperties(TWin32WidgetSet(WidgetSet).AppHandle,fPrinterHandle);
end;
INITIALIZATION
Printer:=TWinPrinter.Create;

View File

@ -25,11 +25,12 @@
}
uses
Classes, SysUtils,Printers,LCLType,Forms,Windows,dialogs;
Classes, SysUtils,Printers,LCLType,{Forms,}Windows;//,dialogs;
Type
TWinPrinter = class(TPrinter)
private
fDefaultPrinter : String;
fLastHandleType : Byte; //0=None 1=IC 2=DC
fDC : HDC;
fPrinterHandle : THandle;
@ -38,9 +39,9 @@ Type
procedure SetDC;
procedure ClearDC;
function BaseDialogs(aFlag : DWORD):boolean;
protected
//function GetDefaultPrinter : String;
procedure DoBeginDoc; override;
procedure DoNewPage; override;
procedure DoEndDoc(aAborded : Boolean); override;
@ -63,17 +64,21 @@ Type
function GetXDPI: Integer; override;
function GetYDPI: Integer; override;
function GetPrinterType: TPrinterType;override;
function DoGetPrinterState: TPrinterState;override;
function GetCanPrint: Boolean;override;
function GetHandlePrinter : HDC;
procedure SetHandlePrinter(aValue : HDC);
public
constructor Create; override;
destructor Destroy; override;
function PrintDialog : Boolean; override;
function PrinterSetup : Boolean; override;
//Warning not portable functions here
procedure Properties;
//Warning it is a not potable property
property Handle : HDC read GetHandlePrinter;
property Handle : HDC read GetHandlePrinter write SetHandlePrinter;
end;

View File

@ -0,0 +1,322 @@
Uses
Windows,WinUtilPrn, InterfaceBase, Win32Int, LCLIntf,LCLType,WinVer,Printers,OSPrinters;
{ TPageSetupDialog }
function TPageSetupDialog.Execute: Boolean;
var
lpp : tagPSD;
PDev : TPrinterDevice;
DevMode : PDeviceMode;
DeviceMode : THandle;
DevNames : PDevNames;
St : PChar;
begin
Result:=False;
if not Assigned(Printer) then Exit;
if Printer.Printers.Count>0 then
begin
FillChar(lpp,SizeOf(lpp),0);
with lpp do
begin
lStructSize:=SizeOf(lpp);
hInstance:=LCLType.HInstance;
Flags := PSD_MARGINS;
hWndOwner:=TWin32WidgetSet(WidgetSet).AppHandle;
rtMargin := fMargins;
PDev:=TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
DeviceMode:=GlobalAlloc(GHND,SizeOf(PDev.DevMode));
try
DevMode:=PDeviceMode(GlobalLock(DeviceMode));
try
//some plotters crash when DEVMODE contains other options set
//so only minimal options passed to print dialog
StrCopy(DevMode^.dmDeviceName,Pdev.DevMode.dmDeviceName);
DevMode^.dmSize := Word(SizeOf(PDev.DevMode));
DevMode^.dmOrientation := Pdev.DevMode.dmOrientation;
DevMode^.dmFields := DM_ORIENTATION or DM_PAPERSIZE or DM_COPIES;
DevMode^.dmPaperSize := Pdev.DevMode.dmPaperSize;
DevMode^.dmCopies := Pdev.DevMode.dmCopies;
finally
GlobalUnLock(DeviceMode);
end;
hDevMode:= DeviceMode;
if PageSetupDlg(lpp) then
begin
St:='';
//Change Selected printer
if lpp.hDevNames<>0 then
begin
DevNames:=PDevNames(GlobalLock(lpp.hDevNames));
try
St:=PChar(DevNames)+DevNames^.wDeviceOffset;
Printer.SetPrinter(St);
finally
GlobalUnlock(lpp.hDevNames);
GlobalFree(lpp.hDevNames);
end;
end;
Result:=True;
if (Flags and PSD_INHUNDREDTHSOFMILLIMETERS)>0 then fUnits := unMM
else
fUnits := unInch;
fMargins := rtMargin;
if lpp.hDevMode<>0 then
begin
DevMode:=PDeviceMode(GlobalLock(lpp.hDevMode));
try
//Set the properties for the selected printer
PDev:=TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
PDev.DevMode.dmSize := SizeOf(PDev.DevMode);
StrCopy(@PDev.DevMode.dmDeviceName,DevMode^.dmDeviceName);
PDev.DevMode.dmOrientation := DevMode^.dmOrientation;
PDev.DevMode.dmFields := DevMode^.dmFields;
PDev.DevMode.dmPaperSize := DevMode^.dmPaperSize;
PDev.DevMode.dmPaperLength := DevMode^.dmPaperLength;
PDev.DevMode.dmPaperWidth := DevMode^.dmPaperWidth;
PDev.DevMode.dmScale := DevMode^.dmScale;
PDev.DevMode.dmCopies := DevMode^.dmCopies;
PDev.DevMode.dmPrintQuality := DevMode^.dmPrintQuality;
PDev.DevMode.dmColor := DevMode^.dmColor;
PDev.DevMode.dmDuplex := DevMode^.dmDuplex;
PDev.DevMode.dmYResolution := DevMode^.dmYResolution;
PDev.DevMode.dmTTOption := DevMode^.dmTTOption;
PDev.DefaultPaper := DevMode^.dmPaperSize;
finally
GlobalUnlock(lpp.hDevMode);
end;
end;
end;
finally
GlobalFree(DeviceMode);
end;
end;
end;
end;
{ TPrinterSetupDialog }
function TPrinterSetupDialog.Execute: Boolean;
var
lpp : tagPD;
PDev : TPrinterDevice;
DevMode : PDeviceMode;
DeviceMode : THandle;
DevNames : PDevNames;
St : PChar;
begin
Result:=False;
if not Assigned(Printer) then Exit;
if Printer.Printers.Count>0 then
begin
FillChar(lpp,SizeOf(lpp),0);
with lpp do
begin
lStructSize:=SizeOf(lpp);
hInstance:=LCLType.HInstance;
Flags:= PD_PRINTSETUP or PD_RETURNDC;
hWndOwner:=TWin32WidgetSet(WidgetSet).AppHandle;
PDev:=TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
DeviceMode:=GlobalAlloc(GHND,SizeOf(PDev.DevMode));
try
DevMode:=PDeviceMode(GlobalLock(DeviceMode));
try
//some plotters crash when DEVMODE contains other options set
//so only minimal options passed to print dialog
StrCopy(DevMode^.dmDeviceName,Pdev.DevMode.dmDeviceName);
DevMode^.dmSize := Word(SizeOf(PDev.DevMode));
DevMode^.dmOrientation := Pdev.DevMode.dmOrientation;
DevMode^.dmFields := DM_ORIENTATION or DM_PAPERSIZE or DM_COPIES;
DevMode^.dmPaperSize := Pdev.DevMode.dmPaperSize;
DevMode^.dmCopies := Pdev.DevMode.dmCopies;
finally
GlobalUnLock(DeviceMode);
end;
hDevMode:= DeviceMode;
if PrintDlg(lpp) then
begin
St:='';
//Change Selected printer
if lpp.hDevNames<>0 then
begin
DevNames:=PDevNames(GlobalLock(lpp.hDevNames));
try
St:=PChar(DevNames)+DevNames^.wDeviceOffset;
Printer.SetPrinter(St);
finally
GlobalUnlock(lpp.hDevNames);
GlobalFree(lpp.hDevNames);
end;
end;
Result:=True;
if lpp.hDevMode<>0 then
begin
DevMode:=PDeviceMode(GlobalLock(lpp.hDevMode));
try
//Set the properties for the selected printer
PDev:=TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
PDev.DevMode.dmSize := SizeOf(PDev.DevMode);
StrCopy(@PDev.DevMode.dmDeviceName,DevMode^.dmDeviceName);
PDev.DevMode.dmOrientation := DevMode^.dmOrientation;
PDev.DevMode.dmFields := DevMode^.dmFields;
PDev.DevMode.dmPaperSize := DevMode^.dmPaperSize;
PDev.DevMode.dmPaperLength := DevMode^.dmPaperLength;
PDev.DevMode.dmPaperWidth := DevMode^.dmPaperWidth;
PDev.DevMode.dmScale := DevMode^.dmScale;
PDev.DevMode.dmCopies := DevMode^.dmCopies;
PDev.DevMode.dmPrintQuality := DevMode^.dmPrintQuality;
PDev.DevMode.dmColor := DevMode^.dmColor;
PDev.DevMode.dmDuplex := DevMode^.dmDuplex;
PDev.DevMode.dmYResolution := DevMode^.dmYResolution;
PDev.DevMode.dmTTOption := DevMode^.dmTTOption;
PDev.DefaultPaper := DevMode^.dmPaperSize;
TWinPrinter(Printer).Handle := hDC;
finally
GlobalUnlock(lpp.hDevMode);
end;
end;
end;
finally
GlobalFree(DeviceMode);
end;
end;
end;
end;
{ TPrintDialog }
function TPrintDialog.Execute: Boolean;
var lpp : tagPD;
PDev : TPrinterDevice;
DevMode : PDeviceMode;
DeviceMode : THandle;
DevNames : PDevNames;
St : PChar;
Old : Integer;
begin
Result:=False;
if not Assigned(Printer) then Exit;
Old := Copies;
if Printer.Printers.Count>0 then
begin
FillChar(lpp,SizeOf(lpp),0);
with lpp do
begin
lStructSize:=SizeOf(lpp);
hInstance:=LCLType.HInstance;
Flags := PD_COLLATE or PD_USEDEVMODECOPIES or PD_RETURNDC;
case PrintRange of
prPageNums : Flags := Flags or PD_PAGENUMS;
prSelection : Flags := Flags or PD_SELECTION;
end;
if PrintToFile then Flags := Flags or PD_PRINTTOFILE;
if not (poPrintToFile in Options) then Flags := Flags or PD_HIDEPRINTTOFILE;
if not (poPageNums in Options) then Flags := Flags or PD_NOPAGENUMS;
if not (poSelection in Options) then Flags := Flags or PD_NOSELECTION;
if (poPrintToFile in Options ) and (poDisablePrintToFile in Options) then Flags := Flags or PD_DISABLEPRINTTOFILE;
hWndOwner:=TWin32WidgetSet(WidgetSet).AppHandle;
PDev:=TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
DeviceMode:=GlobalAlloc(GHND,SizeOf(PDev.DevMode));
try
DevMode:=PDeviceMode(GlobalLock(DeviceMode));
try
//some plotters crash when DEVMODE contains other options set
//so only minimal options passed to print dialog
DevMode^.dmSize := Word(SizeOf(PDev.DevMode));
StrCopy(DevMode^.dmDeviceName,Pdev.DevMode.dmDeviceName);
DevMode^.dmOrientation := Pdev.DevMode.dmOrientation;
DevMode^.dmFields := DM_ORIENTATION or DM_PAPERSIZE or DM_COPIES;
DevMode^.dmPaperSize := Pdev.DevMode.dmPaperSize;
DevMode^.dmCopies := Copies;
finally
GlobalUnLock(DeviceMode);
end;
hDevMode:= DeviceMode;
nCopies:= Word(Copies);
nFromPage := Word(FromPage);
nToPage := Word(ToPage);
nMinPage := Word(MinPage);
nMaxPage := Word(MaxPage);
if PrintDlg(lpp) then
begin
St:='';
//Change Selected printer
if lpp.hDevNames<>0 then
begin
DevNames:=PDevNames(GlobalLock(lpp.hDevNames));
try
St:=PChar(DevNames)+DevNames^.wDeviceOffset;
Printer.SetPrinter(St);
finally
GlobalUnlock(lpp.hDevNames);
GlobalFree(lpp.hDevNames);
end;
end;
Result:=True;
if lpp.hDevMode<>0 then
begin
DevMode:=PDeviceMode(GlobalLock(lpp.hDevMode));
try
//Set the properties for the selected printer
PDev:=TPrinterDevice(Printer.Printers.Objects[Printer.PrinterIndex]);
PDev.DevMode.dmSize := SizeOf(PDev.DevMode);
StrCopy(@PDev.DevMode.dmDeviceName,DevMode^.dmDeviceName);
PDev.DevMode.dmOrientation := DevMode^.dmOrientation;
PDev.DevMode.dmFields := DevMode^.dmFields;
PDev.DevMode.dmPaperSize := DevMode^.dmPaperSize;
PDev.DevMode.dmPaperLength := DevMode^.dmPaperLength;
PDev.DevMode.dmPaperWidth := DevMode^.dmPaperWidth;
PDev.DevMode.dmScale := DevMode^.dmScale;
PDev.DevMode.dmCopies := DevMode^.dmCopies;
PDev.DevMode.dmPrintQuality := DevMode^.dmPrintQuality;
PDev.DevMode.dmColor := DevMode^.dmColor;
PDev.DevMode.dmDuplex := DevMode^.dmDuplex;
PDev.DevMode.dmYResolution := DevMode^.dmYResolution;
PDev.DevMode.dmTTOption := DevMode^.dmTTOption;
PDev.DefaultPaper := DevMode^.dmPaperSize;
if DevMode^.dmCopies>1 then Copies := 1
else
Copies := Old;
TWinPrinter(Printer).Handle := hDC;
finally
GlobalUnlock(lpp.hDevMode);
end;
end;
PrintRange := prAllPages;
PrintToFile := false;
if (Flags and PD_SELECTION)>0 then PrintRange := prSelection;
if (Flags and PD_PAGENUMS)>0 then PrintRange := prPageNums;
if (Flags and PD_PRINTTOFILE)>0 then PrintToFile := true;
FromPage := Integer(nFromPage);
ToPage := Integer(nToPage);
MinPage := Integer(nMinPage);
MaxPage := Integer(nMaxPage);
end;
finally
GlobalFree(DeviceMode);
end;
end;
end;
end;

View File

@ -34,16 +34,29 @@ interface
{$ENDIF}
uses
Classes, SysUtils,LCLType;
Classes, SysUtils,LCLType,Printers;
const
{$i winutilprnconst.inc}
LibWinSpool = 'winspool.drv';
const
DMORIENT_LANDSCAPE = 2;
DMORIENT_PORTRAIT = 1;
DM_ORIENTATION = $1;
DM_PAPERSIZE = $2;
DM_COPIES = $100;
Const
Win32Orientations: array [TPrinterOrientation] of Integer = (
DMORIENT_PORTRAIT, DMORIENT_LANDSCAPE, DMORIENT_PORTRAIT, DMORIENT_LANDSCAPE);
type
PDevNames = ^tagDEVNAMES;
tagDEVNAMES = record
tagDEVNAMES = packed record
wDriverOffset: Word;
wDeviceOffset: Word;
wOutputOffset: Word;
@ -52,6 +65,27 @@ type
TFcntHook = function(Wnd: HWND; uiMsg: UINT; wParam: WPARAM; lParam: LPARAM): UINT stdcall;
tagPSD= packed record
lStructSize : DWORD;
hWndOwner : HWND;
hDevMode : HGLOBAL;
hDevNames : HGLOBAL;
Flags : DWORD;
ptPaperSize : TPOINT;
rtMinMargin : TRECT;
rtMargin : TRECT;
hInstance : HINST;
lCustData : LPARAM;
lpfnPageSetupHook : TFcntHook;
lpfnPagePaintHook : TFcntHook;
lpPageSetupTemplateName : pChar;
hPageSetupTemplate : HGLOBAL;
end;
tagPD=packed Record
lStructSize : DWORD;
hWndOwner : HWND;
@ -75,7 +109,7 @@ type
end;
PDeviceMode = ^TDeviceMode;
TDeviceMode = packed Record
TDeviceMode = packed Record
dmDeviceName : array[0..31] of AnsiChar;
dmSpecVersion : Word;
dmDriverVersion : Word;
@ -111,9 +145,23 @@ type
dmPanningWidth : DWORD;
dmPanningHeight : DWORD;
end;
Type
TPrinterDevice = class
Name : String;
Driver : String;
Device : String;
Port : String;
DefaultPaper : Short;
DevMode: TDeviceMode;
end;
PPrinterDefaults = ^_PRINTER_DEFAULTS;
_PRINTER_DEFAULTS = record
_PRINTER_DEFAULTS = packed record
pDatatype : PChar;
pDevMode : PDeviceMode;
DesiredAccess: DWord;
@ -122,14 +170,14 @@ type
//Size and ImageableArea Specifies the width and height,
//in thousandths of millimeters, of the form
PFORM_INFO_1 =^_FORM_INFO_1;
_FORM_INFO_1 = Record
_FORM_INFO_1 = packed Record
Flags : DWORD;
pName : PChar;
Size : TSize;
ImageableArea: TRect;
end;
TDocInfo = record
TDocInfo = packed record
cbSize : Integer;
lpszDocName : PChar;
lpszOutput : PChar;
@ -138,7 +186,7 @@ type
end;
PPRINTER_INFO_1 = ^_PRINTER_INFO_1;
_PRINTER_INFO_1 = Record
_PRINTER_INFO_1 = packed Record
Flags : DWORD;
pDescription : PChar;
pName : PChar;
@ -146,7 +194,7 @@ type
end;
PPRINTER_INFO_2 = ^_PRINTER_INFO_2;
_PRINTER_INFO_2 = Record
_PRINTER_INFO_2 = packed Record
pServerName : PChar;
pPrinterName : PChar;
pShareName : PChar;
@ -171,14 +219,14 @@ type
end;
PPRINTER_INFO_4 = ^_PRINTER_INFO_4;
_PRINTER_INFO_4 = Record
_PRINTER_INFO_4 = packed Record
pPrinterName : PChar;
pServerName : PChar;
Attributes : DWORD;
end;
PPRINTER_INFO_5 = ^_PRINTER_INFO_5;
_PRINTER_INFO_5 = Record
_PRINTER_INFO_5 = packed Record
pPrinterName : PChar;
pPortName : PChar;
Attributes : DWORD;
@ -191,10 +239,21 @@ function OpenPrinter(pPrinterName : PChar; // printer or server name
var phPrinter : THandle; // printer or server handle
pDefaults : PPrinterDefaults // printer defaults
) : BOOL; stdCall; external LibWinSpool name 'OpenPrinterA';
function GetPrinter(hPrinter : THandle;
Level : DWORD;
pPrinterEnum: Pointer;
cbBuf : DWORD;
var pcbNeeded
) : BOOL; stdcall; external LibWinSpool name 'GetPrinterA';
function ClosePrinter(hPrinter : THandle //handle to printer object
) : BOOL; stdCall; external LibWinSpool name 'ClosePrinter';
function PrinterProperties(hWnd : THandle;
hPrinter : THandle) : BOOL; stdcall; external LibWinSpool name 'PrinterProperties';
function EnumPrinters(Flags: DWORD; //Printer objet type
Name : PChar; //Name of printer object
Level: DWORD; //Information level
@ -235,6 +294,7 @@ function DeviceCapabilities(pDevice, pPort: PChar; fwCapability: Word; pOutput:
function GetProfileString(lpAppName:PChar; lpKeyName:PChar; lpDefault:PChar; lpReturnedString:PChar; nSize:DWORD):DWORD; stdcall; external 'kernel32' name 'GetProfileStringA';
function PrintDlg(var lppd : tagPD): BOOL; stdcall; external 'comdlg32.dll' name 'PrintDlgA';
function PageSetupDlg(var lppd : tagPSD): BOOL; stdcall; external 'comdlg32.dll' name 'PageSetupDlgA';
function CommDlgExtendedError: DWORD; stdcall; external 'comdlg32.dll' name 'CommDlgExtendedError';
function CreateIC(lpszDriver, lpszDevice, lpszOutput: PChar; lpdvmInit: PDeviceMode): HDC; stdcall; external 'gdi32.dll' name 'CreateICA';

View File

@ -8,6 +8,7 @@ Andrew Haines
Andrew Johnson
Bob Wingard
Boris Arko
Boguslaw Brandys
Christian Iversen
Christopher Kirkpatrick
Cliff Baeseman

View File

@ -319,7 +319,6 @@ type
TCustomPrintDialog = class(TCommonDialog)
private
FFromPage: Integer;
FNumCopies: Integer;
FToPage: Integer;
FCollate: Boolean;
FOptions: TPrintDialogOptions;
@ -332,7 +331,7 @@ type
constructor Create(TheOwner: TComponent); override;
public
property Collate: Boolean read FCollate write FCollate default False;
property Copies: Integer read FCopies write FNumCopies default 0;
property Copies: Integer read FCopies write FCopies default 0;
property FromPage: Integer read FFromPage write FFromPage default 0;
property MinPage: Integer read FMinPage write FMinPage default 0;
property MaxPage: Integer read FMaxPage write FMaxPage default 0;

View File

@ -2193,6 +2193,14 @@ function TGtkWidgetSet.DeleteObject(GDIObject: HGDIOBJ): Boolean;
procedure RaiseInvalidGDIObject;
begin
{$ifdef TraceGdiCalls}
DebugLn();
DebugLn('TraceCall for invalid object: ');
DumpBackTrace(PgdiObject(GdiObject)^.StackAddrs);
DebugLn();
DebugLn('Exception will follow:');
DebugLn();
{$endif}
RaiseGDBException('TGtkWidgetSet.DeleteObject invalid GdiObject='+DbgS(GdiObject));
end;
@ -7710,6 +7718,12 @@ begin
else begin
Result := ERROR;
DebugLn('WARNING: [TGtkWidgetSet.SelectClipRGN] Invalid RGN');
{$ifdef TraceGdiCalls}
DebugLn();
DebugLn('TraceCall for invalid object: ');
DumpBackTrace(PgdiObject(RGN)^.StackAddrs);
DebugLn();
{$endif}
end;
end;
end;

View File

@ -162,6 +162,7 @@ type
procedure DoEnumPrinters(Lst : TStrings); virtual;
procedure DoEnumFonts(Lst : TStrings); virtual;
procedure DoEnumPapers(Lst : TStrings); virtual;
procedure DoInitialization; virtual;
function DoSetPrinter(aName : string): Integer; virtual;
function DoGetCopies : Integer; virtual;
procedure DoSetCopies(aValue : Integer); virtual;
@ -187,9 +188,6 @@ type
procedure Refresh;
procedure SetPrinter(aName : String);
function PrintDialog : Boolean; virtual; abstract;
function PrinterSetup: Boolean; virtual; abstract;
property PrinterIndex : integer read GetPrinterIndex write SetPrinterIndex;
property PaperSize : TPaperSize read GetPaperSize;
property Orientation: TPrinterOrientation read GetOrientation write SetOrientation;
@ -305,10 +303,17 @@ end;
//Clear Printers & Fonts list
procedure TPrinter.Refresh;
var
OldPrinter: string;
begin
//Check if Printer not printing otherwise, exception
CheckPrinting(False);
if FPrinterIndex>=0 then
OldPrinter := fPrinters[FPrinterIndex]
else
OldPrinter := '';
if Assigned(fPrinters) then
begin
DoResetPrintersList;
@ -320,8 +325,18 @@ begin
DoResetFontsList;
FreeAndNil(fFonts);
end;
// need to refill printers here otherwise
// it wont be filled on getting printers
// due to only one initialization
GetPrinters;
DoEnumPrinters(fPrinters);
fPrinterIndex:=-1;
// try to locate old selected printer
if OldPrinter<>'' then
SetPrinter(OldPrinter);
end;
//Set the current printer
@ -439,6 +454,7 @@ begin
if not fPrintersValid then begin
fPrintersValid:=true;
DoEnumPrinters(fPrinters);
DoInitialization;
end;
end;
@ -557,6 +573,13 @@ begin
//Override this methode
end;
// This method is called once after the printer list
// is obtained for the first time.
procedure TPrinter.DoInitialization;
begin
//Override this method
end;
//Set the current printer
function TPrinter.DoSetPrinter(aName : string): Integer;