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