2 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
23 Change History (most recent first):
26 Revision 1.5 2005/07/07 17:53:20 shersche
27 Fix problems associated with the CUPS printer workaround fix.
29 Revision 1.4 2005/02/08 21:45:06 shersche
30 <rdar://problem/3947490> Default to Generic PostScript or PCL if unable to match driver
32 Revision 1.3 2005/01/25 08:57:28 shersche
33 <rdar://problem/3911084> Add m_printerControl member for dynamic loading of icons from resource DLLs
36 Revision 1.2 2004/12/29 18:53:38 shersche
37 <rdar://problem/3725106>
38 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
39 Bug #: 3725106, 3737413
41 Revision 1.1 2004/06/18 04:36:58 rpantos
49 #include "UtilTypes.h"
50 #include <CommonServices.h>
51 #include <DebugServices.h>
59 class CThirdPage
: public CPropertyPage
61 DECLARE_DYNAMIC(CThirdPage
)
65 virtual ~CThirdPage();
68 enum { IDD
= IDD_THIRD_PAGE
};
71 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
72 virtual BOOL
OnSetActive();
73 virtual BOOL
OnKillActive();
79 typedef std::map
<CString
, Manufacturer
*> Manufacturers
;
82 // LoadPrintDriverDefsFromFile
84 // Parses INF file and populates manufacturers
86 OSStatus
LoadPrintDriverDefsFromFile(Manufacturers
& manufacturers
, const CString
& filename
, bool checkForDuplicateModels
);
89 // LoadPrintDriverDefs
91 // Loads extant print driver definitions
93 OSStatus
LoadPrintDriverDefs(Manufacturers
& manufacturers
);
96 // LoadGenericPrintDriversDefs
98 // Loads generic postscript and pcl print driver defs
100 OSStatus
LoadGenericPrintDriverDefs( Manufacturers
& manufacturers
);
105 // Load print driver defs into UI for browsing/selection
107 OSStatus
PopulateUI(Manufacturers
& manufacturers
);
112 // Tries to match printer based on manufacturer and model
114 OSStatus
MatchPrinter(Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, bool useCUPSWorkaround
);
119 // Called first time page is activated.
120 OSStatus
OnInitPage();
123 // these functions will tweak the names so that everything is
126 CString
ConvertToManufacturerName( const CString
& name
);
127 CString
ConvertToModelName( const CString
& name
);
128 CString
NormalizeManufacturerName( const CString
& name
);
130 Manufacturer
* MatchManufacturer( Manufacturers
& manufacturer
, const CString
& name
);
131 Model
* MatchModel( Manufacturer
* manufacturer
, const CString
& name
);
132 BOOL
MatchGeneric( Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, Manufacturer
** manufacturer
, Model
** model
);
133 void SelectMatch(Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
134 void SelectMatch(Manufacturers
& manufacturers
, Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
135 void CopyPrinterSettings(Printer
* printer
, Service
* service
, Manufacturer
* manufacturer
, Model
* model
);
137 Manufacturers m_manufacturers
;
139 CListCtrl m_manufacturerListCtrl
;
140 Manufacturer
* m_manufacturerSelected
;
142 CListCtrl m_modelListCtrl
;
143 Model
* m_modelSelected
;
145 Model
* m_genericPostscript
;
146 Model
* m_genericPCL
;
152 afx_msg
void OnLvnItemchangedManufacturer(NMHDR
*pNMHDR
, LRESULT
*pResult
);
153 CStatic m_printerName
;
154 afx_msg
void OnLvnItemchangedPrinterModel(NMHDR
*pNMHDR
, LRESULT
*pResult
);
155 afx_msg
void OnBnClickedDefaultPrinter();
157 CButton m_defaultPrinterCtrl
;
159 CStatic m_printerSelectionText
;
160 CStatic
* m_printerImage
;
161 afx_msg
void OnBnClickedHaveDisk();