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.6 2006/08/14 23:24:09 cheshire
21 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
23 Revision 1.5 2005/07/07 17:53:20 shersche
24 Fix problems associated with the CUPS printer workaround fix.
26 Revision 1.4 2005/02/08 21:45:06 shersche
27 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
29 Revision 1.3 2005/01/25 08:57:28 shersche
30 <rdar://problem/3911084> Add m_printerControl member for dynamic loading of icons from resource DLLs
33 Revision 1.2 2004/12/29 18:53:38 shersche
34 <rdar://problem/3725106>
35 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
36 Bug #: 3725106, 3737413
38 Revision 1.1 2004/06/18 04:36:58 rpantos
46 #include "UtilTypes.h"
47 #include <CommonServices.h>
48 #include <DebugServices.h>
56 class CThirdPage
: public CPropertyPage
58 DECLARE_DYNAMIC(CThirdPage
)
62 virtual ~CThirdPage();
65 enum { IDD
= IDD_THIRD_PAGE
};
68 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
69 virtual BOOL
OnSetActive();
70 virtual BOOL
OnKillActive();
76 typedef std::map
<CString
, Manufacturer
*> Manufacturers
;
79 // LoadPrintDriverDefsFromFile
81 // Parses INF file and populates manufacturers
83 OSStatus
LoadPrintDriverDefsFromFile(Manufacturers
& manufacturers
, const CString
& filename
, bool checkForDuplicateModels
);
86 // LoadPrintDriverDefs
88 // Loads extant print driver definitions
90 OSStatus
LoadPrintDriverDefs(Manufacturers
& manufacturers
);
93 // LoadGenericPrintDriversDefs
95 // Loads generic postscript and pcl print driver defs
97 OSStatus
LoadGenericPrintDriverDefs( Manufacturers
& manufacturers
);
102 // Load print driver defs into UI for browsing/selection
104 OSStatus
PopulateUI(Manufacturers
& manufacturers
);
109 // Tries to match printer based on manufacturer and model
111 OSStatus
MatchPrinter(Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, bool useCUPSWorkaround
);
116 // Called first time page is activated.
117 OSStatus
OnInitPage();
120 // these functions will tweak the names so that everything is
123 CString
ConvertToManufacturerName( const CString
& name
);
124 CString
ConvertToModelName( const CString
& name
);
125 CString
NormalizeManufacturerName( const CString
& name
);
127 Manufacturer
* MatchManufacturer( Manufacturers
& manufacturer
, const CString
& name
);
128 Model
* MatchModel( Manufacturer
* manufacturer
, const CString
& name
);
129 BOOL
MatchGeneric( Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, Manufacturer
** manufacturer
, Model
** model
);
130 void SelectMatch(Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
131 void SelectMatch(Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
132 void CopyPrinterSettings(Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
134 Manufacturers m_manufacturers
;
136 CListCtrl m_manufacturerListCtrl
;
137 Manufacturer
* m_manufacturerSelected
;
139 CListCtrl m_modelListCtrl
;
140 Model
* m_modelSelected
;
142 Model
* m_genericPostscript
;
143 Model
* m_genericPCL
;
149 afx_msg
void OnLvnItemchangedManufacturer(NMHDR
*pNMHDR
, LRESULT
*pResult
);
150 CStatic m_printerName
;
151 afx_msg
void OnLvnItemchangedPrinterModel(NMHDR
*pNMHDR
, LRESULT
*pResult
);
152 afx_msg
void OnBnClickedDefaultPrinter();
154 CButton m_defaultPrinterCtrl
;
156 CStatic m_printerSelectionText
;
157 CStatic
* m_printerImage
;
158 afx_msg
void OnBnClickedHaveDisk();