Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

895 lines
23 KiB

  1. /*++
  2. Copyright (c) 1990-1995 Microsoft Corporation
  3. Module Name:
  4. stdpage.c
  5. Abstract:
  6. This module contains standard page procs
  7. Author:
  8. 18-Aug-1995 Fri 18:57:12 created -by- Daniel Chou (danielc)
  9. [Environment:]
  10. NT Windows - Common Printer Driver UI DLL.
  11. [Notes:]
  12. Revision History:
  13. --*/
  14. #include "precomp.h"
  15. #pragma hdrstop
  16. #define DBG_CPSUIFILENAME DbgStdPage
  17. #define DBG_STDPAGE1ID 0x00000001
  18. #define DBGITEM_SDP 0x00000002
  19. #define DBGITEM_STDPAGEID 0x00000004
  20. DEFINE_DBGVAR(0);
  21. extern HINSTANCE hInstDLL;
  22. #define DOCPROP_PDLGPAGE_START 0
  23. #define DOCPROP_CDLGPAGE 3
  24. #define ADVDOCPROP_PDLGPAGE_START 3
  25. #define ADVDOCPROP_CDLGPAGE 1
  26. #define PRINTERPROP_PDLGPAGE_START 4
  27. #define PRINTERPROP_CDLGPAGE 1
  28. #define TVONLY_PDLGPAGE_START 5
  29. #define TVONLY_CDLGPAGE 1
  30. typedef struct _INTOIDATA {
  31. WORD HelpIdx;
  32. WORD wReserved;
  33. WORD StrID;
  34. WORD IconID;
  35. } INTOIDATA;
  36. typedef struct _STDDLGPAGE {
  37. WORD UseHdrIconID;
  38. WORD wReserved;
  39. WORD IDSTabName;
  40. WORD DlgTemplateID;
  41. } STDDLGPAGE;
  42. const INTOIDATA IntOIData[INTIDX_TOTAL] = {
  43. { IDH_STD_TVROOT, 0, 0, IDI_CPSUI_PRINTER3 },
  44. { IDH_PAPEROUTPUT, 0, IDS_CPSUI_PAPER_OUTPUT, IDI_CPSUI_PAPER_OUTPUT },
  45. { IDH_GRAPHIC, 0, IDS_CPSUI_GRAPHIC, IDI_CPSUI_GRAPHIC },
  46. { IDH_OPTIONS, 0, IDS_CPSUI_DOCUMENT, IDI_CPSUI_OPTION },
  47. { IDH_ICMHDR, 0, IDS_CPSUI_ICM, IDI_CPSUI_ICM_OPTION },
  48. { IDH_ADVANCED_PUSH, 0, IDS_CPSUI_ADVANCED, IDI_CPSUI_EMPTY }
  49. };
  50. //
  51. // We must use PUSHBUTTON_TYPE_CALLBACK because it will never overwrite the
  52. // pSel which we use for the icon id.
  53. //
  54. OPTPARAM OptParamHdrPush = {
  55. sizeof(OPTPARAM),
  56. 0,
  57. PUSHBUTTON_TYPE_CALLBACK,
  58. (LPTSTR)InternalRevertOptItem,
  59. (WORD)IDI_CPSUI_WARNING,
  60. 0
  61. };
  62. OPTTYPE OptTypeHdrPush = {
  63. sizeof(OPTTYPE),
  64. TVOT_PUSHBUTTON,
  65. 0,
  66. 1,
  67. 0,
  68. &OptParamHdrPush,
  69. OTS_PUSH_NO_DOT_DOT_DOT
  70. };
  71. EXTPUSH ExtPushAbout = {
  72. sizeof(EXTPUSH),
  73. 0,
  74. (LPTSTR)IDS_CPSUI_ABOUT,
  75. NULL,
  76. IDI_CPSUI_QUESTION,
  77. 0
  78. };
  79. STDDLGPAGE StdDlgPage[] = {
  80. { 0, 0, IDS_CPSUI_STDDOCPROPTAB1, DP_STD_DOCPROPPAGE1 },
  81. { 0, 0, IDS_CPSUI_STDDOCPROPTAB2, DP_STD_DOCPROPPAGE2 },
  82. { 0, 0, IDS_CPSUI_STDDOCPROPTVTAB, DP_STD_INT_TVPAGE },
  83. { 0, 0, IDS_CPSUI_STDDOCPROPTVTAB, DP_STD_TREEVIEWPAGE },
  84. { 0, 0, IDS_CPSUI_DEVICE_SETTINGS, DP_STD_TREEVIEWPAGE },
  85. { 0, 0, IDS_CPSUI_OPTIONS, DP_STD_TREEVIEWPAGE }
  86. };
  87. BYTE StdTVOT[] = { TVOT_2STATES, // 0
  88. TVOT_3STATES, // 1
  89. TVOT_COMBOBOX, // 2
  90. TVOT_LISTBOX, // 3
  91. TVOT_UDARROW, // 4
  92. TVOT_TRACKBAR, // 5
  93. TVOT_SCROLLBAR // 6
  94. };
  95. STDPAGEINFO StdPageInfo[] = {
  96. { IDD_ORIENT_GROUP ,0, 2, IDS_CPSUI_ORIENTATION ,IDH_ORIENTATION ,STDPAGEID_0 },
  97. { 0 ,4, 3, IDS_CPSUI_SCALING ,IDH_SCALING ,STDPAGEID_NONE},
  98. { 0 ,4, 1, IDS_CPSUI_NUM_OF_COPIES ,IDH_NUM_OF_COPIES ,STDPAGEID_NONE},
  99. { IDD_DEFSOURCE_GROUP,2, 2, IDS_CPSUI_SOURCE ,IDH_SOURCE ,STDPAGEID_1 },
  100. { 0 ,0, 4, IDS_CPSUI_PRINTQUALITY ,IDH_RESOLUTION ,STDPAGEID_NONE},
  101. { IDD_COLOR_GROUP ,0, 1, IDS_CPSUI_COLOR_APPERANCE,IDH_COLOR_APPERANCE ,STDPAGEID_1 },
  102. { IDD_DUPLEX_GROUP ,0, 2, IDS_CPSUI_DUPLEX ,IDH_DUPLEX ,STDPAGEID_0 },
  103. { 0 ,0, 4, IDS_CPSUI_TTOPTION ,IDH_TTOPTION ,STDPAGEID_NONE},
  104. { 0 ,2, 2, IDS_CPSUI_FORMNAME ,IDH_FORMNAME ,STDPAGEID_NONE},
  105. { 0 ,0, 4, IDS_CPSUI_ICMMETHOD ,IDH_ICMMETHOD ,STDPAGEID_NONE},
  106. { 0 ,0, 4, IDS_CPSUI_ICMINTENT ,IDH_ICMINTENT ,STDPAGEID_NONE},
  107. { IDD_MEDIATYPE_GROUP,2, 2, IDS_CPSUI_MEDIA ,IDH_MEDIA ,STDPAGEID_1 },
  108. { 0 ,0, 4, IDS_CPSUI_DITHERING ,IDH_DITHERING ,STDPAGEID_NONE},
  109. { IDD_OUTPUTBIN_GROUP,2, 2, IDS_CPSUI_OUTPUTBIN ,IDH_OUTPUTBIN ,STDPAGEID_1 },
  110. { IDD_QUALITY_GROUP ,0, 2, IDS_CPSUI_QUALITY_SETTINGS ,IDH_QUALITY ,STDPAGEID_1 },
  111. { IDD_NUP_GROUP ,2, 2, IDS_CPSUI_NUP ,IDH_NUP ,STDPAGEID_0 },
  112. { IDD_PAGEORDER_GROUP,0, 2, IDS_CPSUI_PAGEORDER ,IDH_PAGEORDER ,STDPAGEID_0 },
  113. };
  114. LONG
  115. SetStdPropPageID(
  116. PTVWND pTVWnd
  117. )
  118. /*++
  119. Routine Description:
  120. Do all the standard checking and set flags
  121. Arguments:
  122. Return Value:
  123. Author:
  124. 22-Aug-1995 Tue 14:34:01 created -by- Daniel Chou (danielc)
  125. Revision History:
  126. --*/
  127. {
  128. POPTITEM pItem;
  129. POPTITEM pFirstItem;
  130. POPTITEM pLastItem;
  131. POPTITEM pItemColor = NULL;
  132. POPTITEM pItemICMMethod = NULL;
  133. POPTITEM pItemICMIntent = NULL;
  134. HINSTANCE hInstCaller;
  135. UINT cDMPub = 0;
  136. FillMemory(pTVWnd->DMPubIdx, sizeof(pTVWnd->DMPubIdx), 0xFF);
  137. pFirstItem =
  138. pItem = pTVWnd->ComPropSheetUI.pOptItem;
  139. pLastItem = pTVWnd->pLastItem;
  140. hInstCaller = pTVWnd->ComPropSheetUI.hInstCaller;
  141. while (pItem <= pLastItem) {
  142. POPTTYPE pOptType;
  143. LPBYTE pTVOT;
  144. UINT cTVOT;
  145. BYTE LastTVOT;
  146. BYTE DMPubID = pItem->DMPubID;
  147. BYTE CurLevel = pItem->Level;
  148. do {
  149. if ((DMPubID != DMPUB_NONE) &&
  150. (DMPubID <= DMPUB_LAST) &&
  151. (pOptType = pItem->pOptType)) {
  152. POPTPARAM pOptParam;
  153. UINT Count;
  154. UINT Idx;
  155. WORD StdNameID;
  156. WORD BegCtrlID;
  157. Idx = (UINT)(DMPubID - DMPUB_FIRST);
  158. StdNameID = StdPageInfo[Idx].StdNameID;
  159. #if 1
  160. //
  161. // If there is help ID for standard item, use it; otherwise use the
  162. // system standard help ID
  163. //
  164. _OI_HELPIDX(pItem) = (DWORD)(((pItem->pOIExt) && (pItem->pOIExt->pHelpFile)) ?
  165. 0 : StdPageInfo[Idx].HelpIdx);
  166. #else
  167. if ((_OI_HINST(pItem) != hInstCaller) ||
  168. (!(pItem->HelpIndex))) {
  169. _OI_HELPIDX(pItem) = (DWORD)StdPageInfo[Idx].HelpIdx;
  170. } else {
  171. _OI_HELPIDX(pItem) = 0;
  172. }
  173. #endif
  174. if ((!(pItem->Flags & OPTIF_ITEM_HIDE)) &&
  175. (pTVWnd->DMPubIdx[Idx] == 0xFFFF)) {
  176. ++cDMPub;
  177. switch (DMPubID) {
  178. case DMPUB_PRINTQUALITY:
  179. switch (LODWORD(pItem->pName)) {
  180. case IDS_CPSUI_RESOLUTION:
  181. case IDS_CPSUI_PRINTQUALITY:
  182. StdNameID = LOWORD(LODWORD(pItem->pName));
  183. break;
  184. }
  185. break;
  186. case DMPUB_COPIES_COLLATE:
  187. if ((pItem->Flags & OPTIF_EXT_IS_EXTPUSH) &&
  188. (pItem->pExtChkBox)) {
  189. return(ERR_CPSUI_DMCOPIES_USE_EXTPUSH);
  190. }
  191. break;
  192. case DMPUB_COLOR:
  193. pItemColor = pItem;
  194. break;
  195. case DMPUB_ICMINTENT:
  196. pItemICMIntent = pItem;
  197. break;
  198. case DMPUB_ICMMETHOD:
  199. pItemICMMethod = pItem;
  200. break;
  201. case DMPUB_ORIENTATION:
  202. pOptParam = pOptType->pOptParam;
  203. Count = pOptType->Count;
  204. if (Count > 2 )
  205. {
  206. while (Count--) {
  207. switch (pOptParam->IconID) {
  208. case IDI_CPSUI_PORTRAIT:
  209. pOptParam->pData = (LPTSTR)IDS_CPSUI_PORTRAIT;
  210. break;
  211. case IDI_CPSUI_LANDSCAPE:
  212. pOptParam->pData = (LPTSTR)IDS_CPSUI_LANDSCAPE;
  213. break;
  214. case IDI_CPSUI_ROT_LAND:
  215. pOptParam->pData = (LPTSTR)IDS_CPSUI_ROT_LAND;
  216. break;
  217. }
  218. pOptParam++;
  219. }
  220. }
  221. else
  222. {
  223. while (Count--) {
  224. switch (pOptParam->IconID) {
  225. case IDI_CPSUI_PORTRAIT:
  226. pOptParam->pData = (LPTSTR)IDS_CPSUI_PORTRAIT;
  227. break;
  228. case IDI_CPSUI_LANDSCAPE:
  229. case IDI_CPSUI_ROT_LAND:
  230. pOptParam->pData = (LPTSTR)IDS_CPSUI_LANDSCAPE;
  231. break;
  232. }
  233. pOptParam++;
  234. }
  235. }
  236. break;
  237. case DMPUB_DUPLEX:
  238. pOptParam = pOptType->pOptParam;
  239. Count = pOptType->Count;
  240. while (Count--) {
  241. switch (pOptParam->IconID) {
  242. case IDI_CPSUI_DUPLEX_NONE:
  243. case IDI_CPSUI_DUPLEX_NONE_L:
  244. pOptParam->pData = (LPTSTR)IDS_CPSUI_SIMPLEX;
  245. break;
  246. case IDI_CPSUI_DUPLEX_HORZ:
  247. case IDI_CPSUI_DUPLEX_HORZ_L:
  248. pOptParam->pData = (LPTSTR)IDS_CPSUI_HORIZONTAL;
  249. break;
  250. case IDI_CPSUI_DUPLEX_VERT:
  251. case IDI_CPSUI_DUPLEX_VERT_L:
  252. pOptParam->pData = (LPTSTR)IDS_CPSUI_VERTICAL;
  253. break;
  254. }
  255. pOptParam++;
  256. }
  257. break;
  258. default:
  259. break;
  260. }
  261. pItem->pName = (LPTSTR)StdNameID;
  262. pTVWnd->DMPubIdx[Idx] = (WORD)(pItem - pFirstItem);
  263. }
  264. pTVOT = (LPBYTE)&StdTVOT[StdPageInfo[Idx].iStdTVOT];
  265. cTVOT = (UINT)StdPageInfo[Idx].cStdTVOT;
  266. LastTVOT = pTVOT[cTVOT - 1];
  267. while (cTVOT--) {
  268. if (pOptType->Type == *pTVOT++) {
  269. pTVOT = NULL;
  270. break;
  271. }
  272. }
  273. if (pTVOT) {
  274. CPSUIERR(("DMPubID=%u has wrong type=%u",
  275. (UINT)DMPubID, (UINT)pOptType->Type));
  276. return(ERR_CPSUI_INVALID_DMPUB_TVOT);
  277. }
  278. if (BegCtrlID = StdPageInfo[Idx].BegCtrlID) {
  279. BYTE HideMask;
  280. switch (pOptType->Type) {
  281. case TVOT_3STATES:
  282. pOptParam = pOptType->pOptParam;
  283. Count = pOptType->Count;
  284. HideMask = OTINTF_STATES_1;
  285. //
  286. // The OPTPF_HIDE cannot be dynamically changed for
  287. // standard page items (3 states one)
  288. //
  289. while (Count--) {
  290. if (pOptParam++->Flags & OPTPF_HIDE) {
  291. _OT_FLAGS(pOptType) |=
  292. (OTINTF_STDPAGE_3STATES | HideMask);
  293. }
  294. HideMask <<= 1;
  295. }
  296. break;
  297. case TVOT_2STATES:
  298. if (LastTVOT == TVOT_3STATES) {
  299. //
  300. // The 0x04 is to hide the last radio button/text
  301. // on the standard page and 0x80 is to tell the
  302. // InitStates() that ExtChkBoxID is located on
  303. // the end of 3 states
  304. //
  305. _OT_FLAGS(pOptType) |= (OTINTF_STDPAGE_3STATES |
  306. OTINTF_STATES_3);
  307. }
  308. break;
  309. case TVOT_LISTBOX:
  310. pOptType->Style |= OTS_LBCB_PROPPAGE_LBUSECB;
  311. }
  312. pOptType->BegCtrlID = BegCtrlID;
  313. CPSUIOPTITEM(DBGITEM_STDPAGEID, pTVWnd,
  314. "SetStdPageID", 1, pItem);
  315. }
  316. } else {
  317. _OI_HELPIDX(pItem) = 0;
  318. }
  319. } WHILE_SKIP_CHILDREN(pItem, pLastItem, CurLevel);
  320. }
  321. if (pItemColor) {
  322. DWORD dw;
  323. dw = (pItemColor->Sel < 1) ? OPTIF_DISABLED : 0;
  324. if (pItemICMMethod) {
  325. pItemICMMethod->Flags &= ~OPTIF_DISABLED;
  326. pItemICMMethod->Flags |= dw;
  327. }
  328. if (pItemICMIntent) {
  329. pItemICMIntent->Flags &= ~OPTIF_DISABLED;
  330. pItemICMIntent->Flags |= dw;
  331. }
  332. }
  333. pTVWnd->cDMPub = (BYTE)cDMPub;
  334. return(cDMPub);
  335. }
  336. LONG
  337. AddIntOptItem(
  338. PTVWND pTVWnd
  339. )
  340. /*++
  341. Routine Description:
  342. This function add standard internal OPTITEM to the TVWND
  343. Arguments:
  344. pTVWnd - Our instance data
  345. Return Value:
  346. LONG number of item added if >= 0, else error code
  347. Author:
  348. 13-Sep-1995 Wed 14:40:37 created -by- Daniel Chou (danielc)
  349. Revision History:
  350. --*/
  351. {
  352. POPTITEM pItem;
  353. POIDATA pOIData;
  354. UINT i;
  355. for (i = 0, pItem = PBEG_INTOPTITEM(pTVWnd), pOIData = pTVWnd->IntOIData;
  356. i < INTIDX_TOTAL;
  357. i++, pItem++, pOIData++) {
  358. //
  359. // Only set anything is none zero to it
  360. //
  361. pItem->cbSize = sizeof(OPTITEM);
  362. if (!(pItem->pName = (LPTSTR)IntOIData[i].StrID)) {
  363. if (!(pItem->pName = pTVWnd->ComPropSheetUI.pOptItemName)) {
  364. if (!(pItem->pName = pTVWnd->ComPropSheetUI.pCallerName)) {
  365. pItem->pName = (LPTSTR)IDS_CPSUI_OPTIONS;
  366. }
  367. }
  368. pItem->pSel = (LPTSTR)pTVWnd->ComPropSheetUI.IconID;
  369. pItem->Flags |= OPTIF_EXT_IS_EXTPUSH;
  370. pItem->pExtPush = &ExtPushAbout;
  371. if (pTVWnd->ComPropSheetUI.Flags & CPSUIF_ICONID_AS_HICON) {
  372. pItem->Flags |= OPTIF_SEL_AS_HICON;
  373. }
  374. } else if (pItem->pName == (LPTSTR)IDS_CPSUI_DOCUMENT) {
  375. pItem->Flags |= OPTIF_COLLAPSE;
  376. }
  377. if (!pItem->pName) {
  378. pItem->pName = (LPTSTR)IDS_CPSUI_PROPERTIES;
  379. }
  380. if (!pItem->Sel) {
  381. pItem->Sel = IntOIData[i].IconID;
  382. pItem->Flags &= ~OPTIF_SEL_AS_HICON;
  383. }
  384. pItem->pOptType = &OptTypeHdrPush;
  385. pItem->DMPubID = DMPUB_NONE;
  386. pOIData->HelpIdx = IntOIData[i].HelpIdx;
  387. pOIData->OIExtFlags = (pTVWnd->Flags & TWF_ANSI_CALL) ?
  388. OIEXTF_ANSI_STRING : 0;
  389. pOIData->hInstCaller = pTVWnd->hInstCaller;
  390. pOIData->pHelpFile = (LPTSTR)IDS_INT_CPSUI_HELPFILE;
  391. _OI_POIDATA(pItem) = pOIData;
  392. }
  393. pTVWnd->OptParamNone.cbSize = sizeof(OPTPARAM);
  394. pTVWnd->OptParamNone.pData = (LPTSTR)IDS_CPSUI_LBCB_NOSEL;
  395. pTVWnd->OptParamNone.IconID = IDI_CPSUI_SEL_NONE;
  396. pTVWnd->OptParamNone.lParam = 0;
  397. return(INTIDX_TOTAL);
  398. }
  399. LONG
  400. SetpMyDlgPage(
  401. PTVWND pTVWnd,
  402. UINT cCurPages
  403. )
  404. /*++
  405. Routine Description:
  406. Arguments:
  407. Return Value:
  408. Author:
  409. 06-Sep-1995 Wed 12:12:27 created -by- Daniel Chou (danielc)
  410. Revision History:
  411. --*/
  412. {
  413. PDLGPAGE pDP;
  414. PMYDLGPAGE pMyDP;
  415. POPTITEM pHdrItem;
  416. UINT cInitPage;
  417. UINT cPage;
  418. INT iPage;
  419. UINT cb;
  420. BOOL ChkDMPub = FALSE;
  421. pHdrItem = PIDX_INTOPTITEM(pTVWnd, INTIDX_TVROOT);
  422. switch ((ULONG_PTR)(pDP = pTVWnd->ComPropSheetUI.pDlgPage)) {
  423. case (ULONG_PTR)CPSUI_PDLGPAGE_DOCPROP:
  424. cInitPage = DOCPROP_CDLGPAGE - 1;
  425. cPage = DOCPROP_CDLGPAGE;
  426. iPage = DOCPROP_PDLGPAGE_START;
  427. pTVWnd->Flags |= (TWF_TVPAGE_CHK_DMPUB | TWF_HAS_ADVANCED_PUSH);
  428. pTVWnd->IntTVOptIdx = INTIDX_OPTIONS;
  429. pHdrItem->UserData = IDS_INT_CPSUI_ADVDOC_SET;
  430. ChkDMPub = TRUE;
  431. _OI_HELPIDX(pHdrItem) = IDH_DOCPROP_TVROOT;
  432. break;
  433. case (ULONG_PTR)CPSUI_PDLGPAGE_ADVDOCPROP:
  434. cInitPage =
  435. cPage = ADVDOCPROP_CDLGPAGE;
  436. iPage = ADVDOCPROP_PDLGPAGE_START;
  437. pTVWnd->Flags |= (TWF_TVPAGE_CHK_DMPUB | TWF_ADVDOCPROP);
  438. pTVWnd->IntTVOptIdx = INTIDX_OPTIONS;
  439. pHdrItem->UserData = IDS_INT_CPSUI_ADVDOC_SET;
  440. ChkDMPub = TRUE;
  441. _OI_HELPIDX(pHdrItem) = IDH_ADVDOCPROP_TVROOT;
  442. break;
  443. case (ULONG_PTR)CPSUI_PDLGPAGE_PRINTERPROP:
  444. cInitPage =
  445. cPage = PRINTERPROP_CDLGPAGE;
  446. iPage = PRINTERPROP_PDLGPAGE_START;
  447. pTVWnd->Flags |= (TWF_TVPAGE_CHK_DMPUB | TWF_TVPAGE_NODMPUB);
  448. pHdrItem->UserData = IDS_INT_CPSUI_DEVICE_SET;
  449. _OI_HELPIDX(pHdrItem) = IDH_DEVPROP_TVROOT;
  450. break;
  451. case (ULONG_PTR)CPSUI_PDLGPAGE_TREEVIEWONLY:
  452. cInitPage =
  453. cPage = TVONLY_CDLGPAGE;
  454. iPage = TVONLY_PDLGPAGE_START;
  455. pHdrItem->UserData = IDS_INT_CPSUI_SETTINGS;
  456. _OI_HELPIDX(pHdrItem) = IDH_STD_TVROOT;
  457. break;
  458. default:
  459. if (cPage = (UINT)pTVWnd->ComPropSheetUI.cDlgPage) {
  460. if (!VALID_PTR(pDP)) {
  461. return(ERR_CPSUI_INVALID_PDLGPAGE);
  462. }
  463. } else {
  464. return(0);
  465. }
  466. cInitPage = cPage;
  467. iPage = -1;
  468. break;
  469. }
  470. if ((cPage + cCurPages) > MAXPROPPAGES) {
  471. return(ERR_CPSUI_TOO_MANY_PROPSHEETPAGES);
  472. }
  473. cb = (UINT)(cPage * sizeof(MYDLGPAGE));
  474. pTVWnd->cInitMyDlgPage = (BYTE)cInitPage;
  475. pTVWnd->cMyDlgPage = (BYTE)cPage;
  476. if (!(pMyDP = pTVWnd->pMyDlgPage = (PMYDLGPAGE)LocalAlloc(LPTR, cb))) {
  477. return(ERR_CPSUI_ALLOCMEM_FAILED);
  478. }
  479. if (iPage < 0) {
  480. InitMYDLGPAGE(pMyDP, pDP, cPage);
  481. } else {
  482. POPTITEM pItem;
  483. POPTITEM pLastItem;
  484. POPTITEM pNextItem;
  485. WORD cChildren;
  486. BYTE DlgPageIdx;
  487. BYTE CurDMPubID;
  488. BYTE CurLevel;
  489. cb = cPage;
  490. while (cb--) {
  491. pMyDP->ID = MYDP_ID;
  492. pMyDP->DlgPage.cbSize = sizeof(DLGPAGE);
  493. pMyDP->DlgPage.Flags = 0;
  494. pMyDP->DlgPage.DlgProc = NULL;
  495. pMyDP->DlgPage.pTabName = (LPTSTR)StdDlgPage[iPage].IDSTabName;
  496. pMyDP->DlgPage.DlgTemplateID = StdDlgPage[iPage].DlgTemplateID;
  497. pMyDP->DlgPage.IconID = (StdDlgPage[iPage].UseHdrIconID) ?
  498. (DWORD)pHdrItem->Sel : 0;
  499. pMyDP++;
  500. iPage++;
  501. }
  502. pItem = pTVWnd->ComPropSheetUI.pOptItem;
  503. pLastItem = pTVWnd->pLastItem;
  504. while (pItem <= pLastItem) {
  505. DWORD FlagsClear;
  506. DWORD FlagsSet;
  507. FlagsClear =
  508. FlagsSet = 0;
  509. CurDMPubID = pItem->DMPubID;
  510. CurLevel = pItem->Level;
  511. if (ChkDMPub) {
  512. switch (CurDMPubID) {
  513. case DMPUB_NUP:
  514. FlagsSet |= OPTIF_NO_GROUPBOX_NAME;
  515. DlgPageIdx = 0;
  516. break;
  517. case DMPUB_ORIENTATION:
  518. case DMPUB_PAGEORDER:
  519. case DMPUB_DUPLEX:
  520. FlagsClear |= OPTIF_NO_GROUPBOX_NAME;
  521. DlgPageIdx = 0;
  522. break;
  523. case DMPUB_DEFSOURCE:
  524. FlagsSet |= OPTIF_NO_GROUPBOX_NAME;
  525. DlgPageIdx = (cPage > 1) ? 1 : 0;
  526. break;
  527. case DMPUB_COPIES_COLLATE:
  528. pItem->pOptType->pOptParam[0].pData =
  529. (LPTSTR)((ULONG_PTR)((pItem->Sel <= 1) ? IDS_CPSUI_COPY :
  530. IDS_CPSUI_COPIES));
  531. if ((!(pItem->Flags & OPTIF_EXT_HIDE)) &&
  532. (pItem->pExtChkBox)) {
  533. if (pItem->Sel <= 1) {
  534. FlagsSet |= OPTIF_EXT_DISABLED;
  535. } else {
  536. FlagsClear |= OPTIF_EXT_DISABLED;
  537. }
  538. }
  539. FlagsClear |= OPTIF_NO_GROUPBOX_NAME;
  540. DlgPageIdx = cPage - 1;
  541. break;
  542. case DMPUB_COLOR:
  543. case DMPUB_MEDIATYPE:
  544. case DMPUB_QUALITY:
  545. case DMPUB_OUTPUTBIN:
  546. FlagsClear |= OPTIF_NO_GROUPBOX_NAME;
  547. DlgPageIdx = (cPage > 1) ? 1 : 0;
  548. break;
  549. default:
  550. DlgPageIdx = cPage - 1;
  551. break;
  552. }
  553. } else {
  554. DlgPageIdx = 0;
  555. }
  556. //
  557. // Set the correct flags and DlgPageIdx for the item and all of
  558. // its children
  559. //
  560. do {
  561. BYTE DMPubID;
  562. pItem->Flags = (pItem->Flags & ~FlagsClear) | FlagsSet;
  563. pItem->DlgPageIdx = DlgPageIdx;
  564. if (((DMPubID = pItem->DMPubID) < DMPUB_USER) &&
  565. (DMPubID != DMPUB_NONE)) {
  566. pItem->DMPubID = CurDMPubID;
  567. }
  568. CPSUIOPTITEM(DBGITEM_SDP, pTVWnd, "SetDlgPage", 1, pItem);
  569. } WHILE_SKIP_CHILDREN(pItem, pLastItem, CurLevel);
  570. }
  571. }
  572. if (ChkDMPub) {
  573. SetStdPropPageID(pTVWnd);
  574. }
  575. return(cPage);
  576. }