source: branches/2.20_branch/NewView/PrintDialogUnit.pas@ 482

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

refactoring for language handling

  • Property svn:eol-style set to native
File size: 2.9 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,
11 Forms,
12 Buttons,
13 ExtCtrls,
14 StdCtrls,
15 ACLLanguageUnit;
16
17Type
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
47Var
48 NewViewPrintDialog: TNewViewPrintDialog;
49
50Implementation
51
52uses
53 SysUtils,
54 Printers,
55 ACLDialogs,
56 ControlsUtility,
57 DebugUnit,
58 StringUtilsUnit;
59
60Procedure TNewViewPrintDialog.OKButtonOnClick (Sender: TObject);
61Begin
62
63End;
64
65Procedure TNewViewPrintDialog.NewViewPrintDialogOnSetupShow (Sender: TObject);
66Begin
67 ScaleForm( self, 11, 16 );
68End;
69
70Procedure TNewViewPrintDialog.NewViewPrintDialogOnCreate (Sender: TObject);
71Begin
72 RegisterEventForLanguages( OnLanguageEvent );
73End;
74
75Procedure TNewViewPrintDialog.OnLanguageEvent( Language: TLanguageFile;
76 const Apply: boolean );
77var
78 tmpPrefix : String;
79begin
80 // LogEvent(LogI18n, 'TNewViewPrintDialog.OnLanguageEvent apply: "' + BoolToStr(Apply) + '"');
81 Language.LoadComponentLanguage( self, Apply );
82
83 tmpPrefix := 'NewViewPrintDialog' + LANGUAGE_LABEL_DELIMITER;
84
85 Language.LL( Apply, SetupPrinterErrorTitle, tmpPrefix + 'SetupPrinterErrorTitle', 'Setup Printer' );
86 Language.LL( Apply, SetupPrinterError, tmpPrefix + 'SetupPrinterError', 'Error displaying printer options: ' );
87end;
88
89Procedure TNewViewPrintDialog.PrinterComboBoxOnItemSelect (Sender: TObject;
90 Index: LongInt);
91Begin
92 Printer.PrinterIndex := PrinterComboBox.ItemIndex;
93End;
94
95Procedure TNewViewPrintDialog.SetupPrinterButtonOnClick (Sender: TObject);
96Begin
97 try
98 Printer.OptionsDlg;
99 except
100 on E: Exception do
101 begin
102 DoErrorDlg( SetupPrinterErrorTitle,
103 SetupPrinterError + E.Message );
104 end;
105 end;
106End;
107
108Procedure TNewViewPrintDialog.PrintDialogOnShow (Sender: TObject);
109Begin
110 PrinterComboBox.Items.Assign( Printer.Printers );
111 PrinterComboBox.ItemIndex := Printer.PrinterIndex;
112 OKButton.Default := true;
113End;
114
115Initialization
116 RegisterClasses ([TNewViewPrintDialog, TComboBox, TLabel, TButton, TRadioGroup]);
117End.
Note: See TracBrowser for help on using the repository browser.