1 | Unit PrintDialogUnit;
|
---|
2 |
|
---|
3 | // NewView - a new OS/2 Help Viewer
|
---|
4 | // Copyright 2003 Aaron Lawrence (aaronl at consultant dot com)
|
---|
5 | // This software is released under the Gnu Public License - see readme.txt
|
---|
6 |
|
---|
7 | Interface
|
---|
8 |
|
---|
9 | Uses
|
---|
10 | Classes,
|
---|
11 | Forms,
|
---|
12 | Buttons,
|
---|
13 | ExtCtrls,
|
---|
14 | StdCtrls,
|
---|
15 | ACLLanguageUnit;
|
---|
16 |
|
---|
17 | Type
|
---|
18 | TPrintSelection =
|
---|
19 | (
|
---|
20 | ptCurrentTopic,
|
---|
21 | ptVisibleTopics,
|
---|
22 | ptAllTopics
|
---|
23 | );
|
---|
24 |
|
---|
25 | TNewViewPrintDialog = Class (TForm)
|
---|
26 | PrinterComboBox: TComboBox;
|
---|
27 | PrinterLabel: TLabel;
|
---|
28 | WhatToPrintRadioGroup: TRadioGroup;
|
---|
29 | OKButton: TButton;
|
---|
30 | SetupPrinterButton: TButton;
|
---|
31 | CancelButton: TButton;
|
---|
32 | Procedure OKButtonOnClick (Sender: TObject);
|
---|
33 | Procedure NewViewPrintDialogOnSetupShow (Sender: TObject);
|
---|
34 | Procedure NewViewPrintDialogOnCreate (Sender: TObject);
|
---|
35 | Procedure PrinterComboBoxOnItemSelect (Sender: TObject; Index: LongInt);
|
---|
36 | Procedure SetupPrinterButtonOnClick (Sender: TObject);
|
---|
37 | Procedure PrintDialogOnShow (Sender: TObject);
|
---|
38 | Public
|
---|
39 | Protected
|
---|
40 | Procedure OnLanguageEvent( Language: TLanguageFile;
|
---|
41 | const Apply: boolean );
|
---|
42 |
|
---|
43 | SetupPrinterErrorTitle: string;
|
---|
44 | SetupPrinterError: string;
|
---|
45 | End;
|
---|
46 |
|
---|
47 | Var
|
---|
48 | NewViewPrintDialog: TNewViewPrintDialog;
|
---|
49 |
|
---|
50 | Implementation
|
---|
51 |
|
---|
52 | uses
|
---|
53 | SysUtils,
|
---|
54 | Printers,
|
---|
55 | ACLDialogs,
|
---|
56 | ControlsUtility;
|
---|
57 |
|
---|
58 | Procedure TNewViewPrintDialog.OKButtonOnClick (Sender: TObject);
|
---|
59 | Begin
|
---|
60 |
|
---|
61 | End;
|
---|
62 |
|
---|
63 | Procedure TNewViewPrintDialog.NewViewPrintDialogOnSetupShow (Sender: TObject);
|
---|
64 | Begin
|
---|
65 | ScaleForm( self, 11, 16 );
|
---|
66 | End;
|
---|
67 |
|
---|
68 | Procedure TNewViewPrintDialog.NewViewPrintDialogOnCreate (Sender: TObject);
|
---|
69 | Begin
|
---|
70 | RegisterForLanguages( OnLanguageEvent );
|
---|
71 | End;
|
---|
72 |
|
---|
73 | Procedure TNewViewPrintDialog.OnLanguageEvent( Language: TLanguageFile;
|
---|
74 | const Apply: boolean );
|
---|
75 | begin
|
---|
76 | Language.LoadComponentLanguage( self, Apply );
|
---|
77 |
|
---|
78 | Language.LL( Apply, SetupPrinterErrorTitle, 'SetupPrinterErrorTitle', 'Setup Printer' );
|
---|
79 | Language.LL( Apply, SetupPrinterError, 'SetupPrinterError', 'Error displaying printer options: ' );
|
---|
80 | end;
|
---|
81 |
|
---|
82 | Procedure TNewViewPrintDialog.PrinterComboBoxOnItemSelect (Sender: TObject;
|
---|
83 | Index: LongInt);
|
---|
84 | Begin
|
---|
85 | Printer.PrinterIndex := PrinterComboBox.ItemIndex;
|
---|
86 | End;
|
---|
87 |
|
---|
88 | Procedure TNewViewPrintDialog.SetupPrinterButtonOnClick (Sender: TObject);
|
---|
89 | Begin
|
---|
90 | try
|
---|
91 | Printer.OptionsDlg;
|
---|
92 | except
|
---|
93 | on E: Exception do
|
---|
94 | begin
|
---|
95 | DoErrorDlg( SetupPrinterErrorTitle,
|
---|
96 | SetupPrinterError + E.Message );
|
---|
97 | end;
|
---|
98 | end;
|
---|
99 | End;
|
---|
100 |
|
---|
101 | Procedure TNewViewPrintDialog.PrintDialogOnShow (Sender: TObject);
|
---|
102 | Begin
|
---|
103 | PrinterComboBox.Items.Assign( Printer.Printers );
|
---|
104 | PrinterComboBox.ItemIndex := Printer.PrinterIndex;
|
---|
105 | OKButton.Default := true;
|
---|
106 | End;
|
---|
107 |
|
---|
108 | Initialization
|
---|
109 | RegisterClasses ([TNewViewPrintDialog, TComboBox, TLabel, TButton, TRadioGroup]);
|
---|
110 | End.
|
---|