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.9 2007/04/13 23:42:20 herscher
21 <rdar://problem/4580061> mDNS: Printers added using Bonjour should be set as the default printer.
23 Revision 1.8 2007/04/13 21:38:46 herscher
24 <rdar://problem/4528853> mDNS: When auto-highlighting items in lists, scroll list so highlighted item is in the middle
26 Revision 1.7 2007/04/13 20:18:30 herscher
27 <rdar://problem/4189721> mDNS: Epson shows up twice in the list
29 Revision 1.6 2006/08/14 23:24:09 cheshire
30 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
32 Revision 1.5 2005/07/07 17:53:20 shersche
33 Fix problems associated with the CUPS printer workaround fix.
35 Revision 1.4 2005/02/08 21:45:06 shersche
36 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
38 Revision 1.3 2005/01/25 08:57:28 shersche
39 <rdar://problem/3911084> Add m_printerControl member for dynamic loading of icons from resource DLLs
42 Revision 1.2 2004/12/29 18:53:38 shersche
43 <rdar://problem/3725106>
44 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
45 Bug #: 3725106, 3737413
47 Revision 1.1 2004/06/18 04:36:58 rpantos
55 #include "UtilTypes.h"
56 #include <CommonServices.h>
57 #include <DebugServices.h>
65 class CThirdPage
: public CPropertyPage
67 DECLARE_DYNAMIC(CThirdPage
)
71 virtual ~CThirdPage();
74 enum { IDD
= IDD_THIRD_PAGE
};
77 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
78 virtual BOOL
OnSetActive();
79 virtual BOOL
OnKillActive();
86 //<rdar://problem/4189721> mDNS: Epson shows up twice in the list. Use case insensitive compare
90 bool operator()( const CString
& s1
, const CString
& s2
) const
92 return s1
.CompareNoCase( s2
) < 0;
96 typedef std::map
<CString
, Manufacturer
*, compare_func
> Manufacturers
;
99 // LoadPrintDriverDefsFromFile
101 // Parses INF file and populates manufacturers
103 OSStatus
LoadPrintDriverDefsFromFile(Manufacturers
& manufacturers
, const CString
& filename
, bool checkForDuplicateModels
);
106 // LoadPrintDriverDefs
108 // Loads extant print driver definitions
110 OSStatus
LoadPrintDriverDefs(Manufacturers
& manufacturers
);
113 // LoadGenericPrintDriversDefs
115 // Loads generic postscript and pcl print driver defs
117 OSStatus
LoadGenericPrintDriverDefs( Manufacturers
& manufacturers
);
122 // Load print driver defs into UI for browsing/selection
124 OSStatus
PopulateUI(Manufacturers
& manufacturers
);
129 // Tries to match printer based on manufacturer and model
131 OSStatus
MatchPrinter(Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, bool useCUPSWorkaround
);
136 // Called first time page is activated.
137 OSStatus
OnInitPage();
140 // these functions will tweak the names so that everything is
143 CString
ConvertToManufacturerName( const CString
& name
);
144 CString
ConvertToModelName( const CString
& name
);
145 CString
NormalizeManufacturerName( const CString
& name
);
147 Manufacturer
* MatchManufacturer( Manufacturers
& manufacturer
, const CString
& name
);
148 Model
* MatchModel( Manufacturer
* manufacturer
, const CString
& name
);
149 BOOL
MatchGeneric( Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, Manufacturer
** manufacturer
, Model
** model
);
150 void SelectMatch(Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
151 void SelectMatch(Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
152 void CopyPrinterSettings(Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
154 // <rdar://problem/4580061> mDNS: Printers added using Bonjour should be set as the default printer.
156 BOOL
DefaultPrinterExists();
158 //<rdar://problem/4528853> mDNS: When auto-highlighting items in lists, scroll list so highlighted item is in the middle
160 void AutoScroll(CListCtrl
& list
, int nIndex
);
162 Manufacturers m_manufacturers
;
164 CListCtrl m_manufacturerListCtrl
;
165 Manufacturer
* m_manufacturerSelected
;
167 CListCtrl m_modelListCtrl
;
168 Model
* m_modelSelected
;
170 Model
* m_genericPostscript
;
171 Model
* m_genericPCL
;
177 afx_msg
void OnLvnItemchangedManufacturer(NMHDR
*pNMHDR
, LRESULT
*pResult
);
178 CStatic m_printerName
;
179 afx_msg
void OnLvnItemchangedPrinterModel(NMHDR
*pNMHDR
, LRESULT
*pResult
);
180 afx_msg
void OnBnClickedDefaultPrinter();
182 CButton m_defaultPrinterCtrl
;
184 CStatic m_printerSelectionText
;
185 CStatic
* m_printerImage
;
186 afx_msg
void OnBnClickedHaveDisk();