]> git.saurik.com Git - apple/mdnsresponder.git/blob - Clients/PrinterSetupWizard/FourthPage.cpp
mDNSResponder-108.tar.gz
[apple/mdnsresponder.git] / Clients / PrinterSetupWizard / FourthPage.cpp
1 /*
2 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22
23 Change History (most recent first):
24
25 $Log: FourthPage.cpp,v $
26 Revision 1.7 2005/07/07 17:53:20 shersche
27 Fix problems associated with the CUPS printer workaround fix.
28
29 Revision 1.6 2005/02/08 21:45:06 shersche
30 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
31
32 Revision 1.5 2005/01/06 08:17:08 shersche
33 Display the selected protocol ("Raw", "LPR", "IPP") rather than the port name
34
35 Revision 1.4 2004/07/13 20:15:04 shersche
36 <rdar://problem/3726363> Load large font name from resource
37 Bug #: 3726363
38
39 Revision 1.3 2004/07/12 06:59:03 shersche
40 <rdar://problem/3723695> Use resource strings for Yes/No
41 Bug #: 3723695
42
43 Revision 1.2 2004/06/26 23:27:12 shersche
44 support for installing multiple printers of the same name
45
46 Revision 1.1 2004/06/18 04:36:57 rpantos
47 First checked in
48
49
50 */
51
52 #include "stdafx.h"
53 #include "PrinterSetupWizardApp.h"
54 #include "PrinterSetupWizardSheet.h"
55 #include "FourthPage.h"
56
57
58 // CFourthPage dialog
59
60 IMPLEMENT_DYNAMIC(CFourthPage, CPropertyPage)
61 CFourthPage::CFourthPage()
62 : CPropertyPage(CFourthPage::IDD),
63 m_initialized(false)
64 {
65 CString fontName;
66
67 m_psp.dwFlags &= ~(PSP_HASHELP);
68 m_psp.dwFlags |= PSP_DEFAULT|PSP_HIDEHEADER;
69
70 fontName.LoadString(IDS_LARGE_FONT);
71
72 // create the large font
73 m_largeFont.CreateFont(-16, 0, 0, 0,
74 FW_BOLD, FALSE, FALSE, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
75 CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, fontName);
76 }
77
78 CFourthPage::~CFourthPage()
79 {
80 }
81
82 void CFourthPage::DoDataExchange(CDataExchange* pDX)
83 {
84 CPropertyPage::DoDataExchange(pDX);
85 DDX_Control(pDX, IDC_GOODBYE, m_goodbye);
86 DDX_Control(pDX, IDC_PRINTER_NAME, m_printerNameCtrl);
87 DDX_Control(pDX, IDC_PRINTER_MANUFACTURER, m_printerManufacturerCtrl);
88 DDX_Control(pDX, IDC_PRINTER_MODEL, m_printerModelCtrl);
89 DDX_Control(pDX, IDC_PRINTER_PROTOCOL, m_printerProtocolCtrl);
90 DDX_Control(pDX, IDC_PRINTER_DEFAULT, m_printerDefault);
91 }
92
93
94 BEGIN_MESSAGE_MAP(CFourthPage, CPropertyPage)
95 END_MESSAGE_MAP()
96
97
98 // CFourthPage message handlers
99 OSStatus
100 CFourthPage::OnInitPage()
101 {
102 return kNoErr;
103 }
104
105
106 BOOL
107 CFourthPage::OnSetActive()
108 {
109 CPrinterSetupWizardSheet * psheet;
110 CString goodbyeText;
111 Printer * printer;
112 CString defaultText;
113
114 psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
115 require_quiet( psheet, exit );
116
117 printer = psheet->GetSelectedPrinter();
118 require_quiet( psheet, exit );
119
120 psheet->SetWizardButtons(PSWIZB_BACK|PSWIZB_FINISH);
121
122 if (m_initialized == false)
123 {
124 m_initialized = true;
125 OnInitPage();
126 }
127
128 m_goodbye.SetFont(&m_largeFont);
129
130 goodbyeText.LoadString(IDS_GOODBYE);
131 m_goodbye.SetWindowText(goodbyeText);
132
133 m_printerNameCtrl.SetWindowText( printer->actualName );
134 m_printerManufacturerCtrl.SetWindowText ( printer->manufacturer );
135 m_printerModelCtrl.SetWindowText ( printer->displayModelName );
136
137 Service * service = printer->services.front();
138 require_quiet( service, exit );
139 m_printerProtocolCtrl.SetWindowText ( service->protocol );
140
141 if (printer->deflt)
142 {
143 defaultText.LoadString(IDS_YES);
144 }
145 else
146 {
147 defaultText.LoadString(IDS_NO);
148 }
149
150 m_printerDefault.SetWindowText ( defaultText );
151
152 exit:
153
154 return CPropertyPage::OnSetActive();
155 }
156
157
158 BOOL
159 CFourthPage::OnKillActive()
160 {
161 CPrinterSetupWizardSheet * psheet;
162
163 psheet = reinterpret_cast<CPrinterSetupWizardSheet*>(GetParent());
164 require_quiet( psheet, exit );
165
166 psheet->SetLastPage(this);
167
168 exit:
169
170 return CPropertyPage::OnKillActive();
171 }