1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 Change History (most recent first):
20 Revision 1.10 2009/05/29 20:43:37 herscher
21 <rdar://problem/6928136> Printer Wizard doesn't work correctly in Windows 7 64 bit
23 Revision 1.9 2007/04/13 23:42:20 herscher
24 <rdar://problem/4580061> mDNS: Printers added using Bonjour should be set as the default printer.
26 Revision 1.8 2007/04/13 21:38:46 herscher
27 <rdar://problem/4528853> mDNS: When auto-highlighting items in lists, scroll list so highlighted item is in the middle
29 Revision 1.7 2007/04/13 20:18:30 herscher
30 <rdar://problem/4189721> mDNS: Epson shows up twice in the list
32 Revision 1.6 2006/08/14 23:24:09 cheshire
33 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
35 Revision 1.5 2005/07/07 17:53:20 shersche
36 Fix problems associated with the CUPS printer workaround fix.
38 Revision 1.4 2005/02/08 21:45:06 shersche
39 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
41 Revision 1.3 2005/01/25 08:57:28 shersche
42 <rdar://problem/3911084> Add m_printerControl member for dynamic loading of icons from resource DLLs
45 Revision 1.2 2004/12/29 18:53:38 shersche
46 <rdar://problem/3725106>
47 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
48 Bug #: 3725106, 3737413
50 Revision 1.1 2004/06/18 04:36:58 rpantos
58 #include "UtilTypes.h"
59 #include <CommonServices.h>
60 #include <DebugServices.h>
68 class CThirdPage
: public CPropertyPage
70 DECLARE_DYNAMIC(CThirdPage
)
74 virtual ~CThirdPage();
77 enum { IDD
= IDD_THIRD_PAGE
};
80 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
81 virtual BOOL
OnSetActive();
82 virtual BOOL
OnKillActive();
89 //<rdar://problem/4189721> mDNS: Epson shows up twice in the list. Use case insensitive compare
93 bool operator()( const CString
& s1
, const CString
& s2
) const
95 return s1
.CompareNoCase( s2
) < 0;
99 typedef std::map
<CString
, Manufacturer
*, compare_func
> Manufacturers
;
102 // LoadPrintDriverDefsFromFile
104 // Parses INF file and populates manufacturers
106 OSStatus
LoadPrintDriverDefsFromFile(Manufacturers
& manufacturers
, const CString
& filename
, bool checkForDuplicateModels
);
109 // LoadPrintDriverDefs
111 // Loads extant print driver definitions
113 OSStatus
LoadPrintDriverDefs(Manufacturers
& manufacturers
);
116 // LoadGenericPrintDriversDefs
118 // Loads generic postscript and pcl print driver defs
120 OSStatus
LoadGenericPrintDriverDefs( Manufacturers
& manufacturers
);
125 // Load print driver defs into UI for browsing/selection
127 OSStatus
PopulateUI(Manufacturers
& manufacturers
);
132 // Tries to match printer based on manufacturer and model
134 OSStatus
MatchPrinter(Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, bool useCUPSWorkaround
);
139 // Called first time page is activated.
140 OSStatus
OnInitPage();
143 // these functions will tweak the names so that everything is
146 CString
ConvertToManufacturerName( const CString
& name
);
147 CString
ConvertToModelName( const CString
& name
);
148 CString
NormalizeManufacturerName( const CString
& name
);
150 Manufacturer
* MatchManufacturer( Manufacturers
& manufacturer
, const CString
& name
);
151 Model
* MatchModel( Manufacturer
* manufacturer
, const CString
& name
);
152 BOOL
MatchGeneric( Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, Manufacturer
** manufacturer
, Model
** model
);
153 void SelectMatch(Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
154 void SelectMatch(Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
155 void CopyPrinterSettings(Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
157 // <rdar://problem/4580061> mDNS: Printers added using Bonjour should be set as the default printer.
159 BOOL
DefaultPrinterExists();
161 //<rdar://problem/4528853> mDNS: When auto-highlighting items in lists, scroll list so highlighted item is in the middle
163 void AutoScroll(CListCtrl
& list
, int nIndex
);
165 Manufacturers m_manufacturers
;
167 CListCtrl m_manufacturerListCtrl
;
168 Manufacturer
* m_manufacturerSelected
;
170 CListCtrl m_modelListCtrl
;
171 Model
* m_modelSelected
;
173 Model
* m_genericPostscript
;
174 Model
* m_genericPCL
;
180 afx_msg
void OnLvnItemchangedManufacturer(NMHDR
*pNMHDR
, LRESULT
*pResult
);
181 CStatic m_printerName
;
182 afx_msg
void OnLvnItemchangedPrinterModel(NMHDR
*pNMHDR
, LRESULT
*pResult
);
183 afx_msg
void OnBnClickedDefaultPrinter();
187 Split( const CString
& string
, TCHAR ch
, CStringList
& components
);
189 CButton m_defaultPrinterCtrl
;
192 CStatic m_printerSelectionText
;
193 CStatic
* m_printerImage
;
194 afx_msg
void OnBnClickedHaveDisk();