| [454] | 1 | Unit AEPrintDialogUnit; | 
|---|
|  | 2 |  | 
|---|
|  | 3 | Interface | 
|---|
|  | 4 |  | 
|---|
|  | 5 | Uses | 
|---|
|  | 6 | Classes, Forms, Graphics, Buttons, ExtCtrls, StdCtrls, | 
|---|
|  | 7 | ACLLanguageUnit; | 
|---|
|  | 8 |  | 
|---|
|  | 9 | Type | 
|---|
|  | 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 |  | 
|---|
|  | 43 | Var | 
|---|
|  | 44 | AEPrintDialog: TAEPrintDialog; | 
|---|
|  | 45 |  | 
|---|
|  | 46 | Implementation | 
|---|
|  | 47 |  | 
|---|
|  | 48 | uses | 
|---|
|  | 49 | SysUtils, | 
|---|
|  | 50 | Dialogs, Printers, | 
|---|
|  | 51 | ACLDialogs, ControlsUtility; | 
|---|
|  | 52 |  | 
|---|
|  | 53 | Procedure TAEPrintDialog.AEPrintDialogOnSetupShow (Sender: TObject); | 
|---|
|  | 54 | Begin | 
|---|
| [469] | 55 | ScaleForm( self, 9, 16 ); | 
|---|
| [454] | 56 | End; | 
|---|
|  | 57 |  | 
|---|
|  | 58 | Procedure TAEPrintDialog.AEPrintDialogOnCreate (Sender: TObject); | 
|---|
|  | 59 | Begin | 
|---|
|  | 60 | RegisterForLanguages( OnLanguageEvent ); | 
|---|
|  | 61 | End; | 
|---|
|  | 62 |  | 
|---|
|  | 63 | Procedure TAEPrintDialog.OnLanguageEvent( Language: TLanguageFile; | 
|---|
|  | 64 | const Apply: boolean ); | 
|---|
|  | 65 | begin | 
|---|
|  | 66 | Language.LoadComponentLanguage( self, Apply ); | 
|---|
|  | 67 | Language.LL( Apply, PrinterSetupTitle, 'PrinterSetupTitle', 'Setup Printer' ); | 
|---|
|  | 68 | Language.LL( Apply, PrinterSetupError, 'PrinterSetupError', 'Error displaying printer options: ' ); | 
|---|
|  | 69 | end; | 
|---|
|  | 70 |  | 
|---|
|  | 71 | Procedure TAEPrintDialog.SelectionRadioButtonOnClick (Sender: TObject); | 
|---|
|  | 72 | Begin | 
|---|
|  | 73 | AllRadioButton.Checked := false; | 
|---|
|  | 74 | End; | 
|---|
|  | 75 |  | 
|---|
|  | 76 | Procedure TAEPrintDialog.AllRadioButtonOnClick (Sender: TObject); | 
|---|
|  | 77 | Begin | 
|---|
|  | 78 | SelectionRadioButton.Checked := false; | 
|---|
|  | 79 | End; | 
|---|
|  | 80 |  | 
|---|
|  | 81 | Procedure TAEPrintDialog.PrinterComboBoxOnItemSelect (Sender: TObject; | 
|---|
|  | 82 | Index: LongInt); | 
|---|
|  | 83 | Begin | 
|---|
|  | 84 | Printer.PrinterIndex := PrinterComboBox.ItemIndex; | 
|---|
|  | 85 | End; | 
|---|
|  | 86 |  | 
|---|
|  | 87 | Procedure TAEPrintDialog.SetupPrinterButtonOnClick (Sender: TObject); | 
|---|
|  | 88 | Begin | 
|---|
|  | 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; | 
|---|
|  | 98 | End; | 
|---|
|  | 99 |  | 
|---|
|  | 100 | Procedure TAEPrintDialog.PrintDialogOnShow (Sender: TObject); | 
|---|
|  | 101 | Begin | 
|---|
|  | 102 | OKButton.Default := true; | 
|---|
|  | 103 | PrinterComboBox.Items.Assign( Printer.Printers ); | 
|---|
|  | 104 | PrinterComboBox.ItemIndex := Printer.PrinterIndex; | 
|---|
|  | 105 | End; | 
|---|
|  | 106 |  | 
|---|
|  | 107 | Initialization | 
|---|
|  | 108 | RegisterClasses ([TAEPrintDialog, TComboBox, TLabel, TButton, TCheckBox | 
|---|
|  | 109 | , TRadioButton]); | 
|---|
|  | 110 | End. | 
|---|