source: trunk/ae/AEPrintDialogUnit.pas@ 454

Last change on this file since 454 was 454, checked in by ataylor, 3 years ago

Add AE (text editor) sources.

File size: 2.9 KB
Line 
1Unit AEPrintDialogUnit;
2
3Interface
4
5Uses
6 Classes, Forms, Graphics, Buttons, ExtCtrls, StdCtrls,
7 ACLLanguageUnit;
8
9Type
10 TPrintSelection =
11 (
12 ptCurrentTopic,
13 ptVisibleTopics,
14 ptAllTopics
15 );
16
17 TAEPrintDialog = Class (TForm)
18 PrinterComboBox: TComboBox;
19 PrinterLabel: TLabel;
20 AllRadioButton: TRadioButton;
21 SelectionRadioButton: TRadioButton;
22 HelpButton: TButton;
23 HeaderCheckBox: TCheckBox;
24 OKButton: TButton;
25 SetupPrinterButton: TButton;
26 CancelButton: TButton;
27 Procedure AEPrintDialogOnSetupShow (Sender: TObject);
28 Procedure AEPrintDialogOnCreate (Sender: TObject);
29 Procedure SelectionRadioButtonOnClick (Sender: TObject);
30 Procedure AllRadioButtonOnClick (Sender: TObject);
31 Procedure PrinterComboBoxOnItemSelect (Sender: TObject; Index: LongInt);
32 Procedure SetupPrinterButtonOnClick (Sender: TObject);
33 Procedure PrintDialogOnShow (Sender: TObject);
34 Private
35 PrinterSetupTitle: string;
36 PrinterSetupError: string;
37 Public
38 Procedure OnLanguageEvent( Language: TLanguageFile;
39 const Apply: boolean );
40
41 End;
42
43Var
44 AEPrintDialog: TAEPrintDialog;
45
46Implementation
47
48uses
49 SysUtils,
50 Dialogs, Printers,
51 ACLDialogs, ControlsUtility;
52
53Procedure TAEPrintDialog.AEPrintDialogOnSetupShow (Sender: TObject);
54Begin
55 ScaleForm( self, 11, 16 );
56End;
57
58Procedure TAEPrintDialog.AEPrintDialogOnCreate (Sender: TObject);
59Begin
60 RegisterForLanguages( OnLanguageEvent );
61End;
62
63Procedure TAEPrintDialog.OnLanguageEvent( Language: TLanguageFile;
64 const Apply: boolean );
65begin
66 Language.LoadComponentLanguage( self, Apply );
67 Language.LL( Apply, PrinterSetupTitle, 'PrinterSetupTitle', 'Setup Printer' );
68 Language.LL( Apply, PrinterSetupError, 'PrinterSetupError', 'Error displaying printer options: ' );
69end;
70
71Procedure TAEPrintDialog.SelectionRadioButtonOnClick (Sender: TObject);
72Begin
73 AllRadioButton.Checked := false;
74End;
75
76Procedure TAEPrintDialog.AllRadioButtonOnClick (Sender: TObject);
77Begin
78 SelectionRadioButton.Checked := false;
79End;
80
81Procedure TAEPrintDialog.PrinterComboBoxOnItemSelect (Sender: TObject;
82 Index: LongInt);
83Begin
84 Printer.PrinterIndex := PrinterComboBox.ItemIndex;
85End;
86
87Procedure TAEPrintDialog.SetupPrinterButtonOnClick (Sender: TObject);
88Begin
89 try
90 Printer.OptionsDlg;
91 except
92 on E: Exception do
93 begin
94 DoErrorDlg( PrinterSetupTitle,
95 PrinterSetupError + E.Message );
96 end;
97 end;
98End;
99
100Procedure TAEPrintDialog.PrintDialogOnShow (Sender: TObject);
101Begin
102 OKButton.Default := true;
103 PrinterComboBox.Items.Assign( Printer.Printers );
104 PrinterComboBox.ItemIndex := Printer.PrinterIndex;
105End;
106
107Initialization
108 RegisterClasses ([TAEPrintDialog, TComboBox, TLabel, TButton, TCheckBox
109 , TRadioButton]);
110End.
Note: See TracBrowser for help on using the repository browser.