source: trunk/NewView/PrintDialogUnit.pas@ 18

Last change on this file since 18 was 18, checked in by RBRi, 19 years ago

+ newview source

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1Unit 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
7Interface
8
9Uses
10 Classes, Forms, Graphics, Buttons, ExtCtrls, StdCtrls,
11 ACLLanguageUnit;
12
13Type
14 TPrintSelection =
15 (
16 ptCurrentTopic,
17 ptVisibleTopics,
18 ptAllTopics
19 );
20
21 TNewViewPrintDialog = Class (TForm)
22 PrinterComboBox: TComboBox;
23 PrinterLabel: TLabel;
24 WhatToPrintRadioGroup: TRadioGroup;
25 OKButton: TButton;
26 SetupPrinterButton: TButton;
27 CancelButton: TButton;
28 Procedure OKButtonOnClick (Sender: TObject);
29 Procedure NewViewPrintDialogOnSetupShow (Sender: TObject);
30 Procedure NewViewPrintDialogOnCreate (Sender: TObject);
31 Procedure PrinterComboBoxOnItemSelect (Sender: TObject; Index: LongInt);
32 Procedure SetupPrinterButtonOnClick (Sender: TObject);
33 Procedure PrintDialogOnShow (Sender: TObject);
34 Public
35 Protected
36 Procedure OnLanguageEvent( Language: TLanguageFile;
37 const Apply: boolean );
38
39 SetupPrinterErrorTitle: string;
40 SetupPrinterError: string;
41 End;
42
43Var
44 NewViewPrintDialog: TNewViewPrintDialog;
45
46Implementation
47
48uses
49 SysUtils,
50 Dialogs, Printers,
51 ACLDialogs,
52 ControlsUtility;
53
54Procedure TNewViewPrintDialog.OKButtonOnClick (Sender: TObject);
55Begin
56
57End;
58
59Procedure TNewViewPrintDialog.NewViewPrintDialogOnSetupShow (Sender: TObject);
60Begin
61 ScaleForm( self, 11, 16 );
62End;
63
64Procedure TNewViewPrintDialog.NewViewPrintDialogOnCreate (Sender: TObject);
65Begin
66 RegisterForLanguages( OnLanguageEvent );
67End;
68
69Procedure TNewViewPrintDialog.OnLanguageEvent( Language: TLanguageFile;
70 const Apply: boolean );
71begin
72 Language.LoadComponentLanguage( self, Apply );
73
74 Language.LL( Apply, SetupPrinterErrorTitle, 'SetupPrinterErrorTitle', 'Setup Printer' );
75 Language.LL( Apply, SetupPrinterError, 'SetupPrinterError', 'Error displaying printer options: ' );
76end;
77
78Procedure TNewViewPrintDialog.PrinterComboBoxOnItemSelect (Sender: TObject;
79 Index: LongInt);
80Begin
81 Printer.PrinterIndex := PrinterComboBox.ItemIndex;
82End;
83
84Procedure TNewViewPrintDialog.SetupPrinterButtonOnClick (Sender: TObject);
85Begin
86 try
87 Printer.OptionsDlg;
88 except
89 on E: Exception do
90 begin
91 DoErrorDlg( SetupPrinterErrorTitle,
92 SetupPrinterError + E.Message );
93 end;
94 end;
95End;
96
97Procedure TNewViewPrintDialog.PrintDialogOnShow (Sender: TObject);
98Begin
99 PrinterComboBox.Items.Assign( Printer.Printers );
100 PrinterComboBox.ItemIndex := Printer.PrinterIndex;
101 OKButton.Default := true;
102End;
103
104Initialization
105 RegisterClasses ([TNewViewPrintDialog, TComboBox, TLabel, TButton, TRadioGroup]);
106End.
Note: See TracBrowser for help on using the repository browser.