Leaked source code of windows server 2003
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.

217 lines
6.7 KiB

  1. // Created 04-Jan-1993 1:10pm by Jeff Parsons
  2. #include "shellprv.h"
  3. #pragma hdrstop
  4. #ifdef _X86_
  5. BINF abinfVid[] = {
  6. {IDC_WINDOWED, BITNUM(VID_FULLSCREEN) | 0x80},
  7. {IDC_FULLSCREEN, BITNUM(VID_FULLSCREEN)},
  8. {IDC_TEXTEMULATE, BITNUM(VID_TEXTEMULATE)},
  9. {IDC_DYNAMICVIDMEM, BITNUM(VID_RETAINMEMORY) | 0x80},
  10. };
  11. BINF abinfWinInit[] = {
  12. {IDC_WINRESTORE, BITNUM(WININIT_NORESTORE) | 0x80},
  13. };
  14. // Private function prototypes
  15. void EnableVidDlg(HWND hDlg, PPROPLINK ppl);
  16. void InitVidDlg(HWND hDlg, PPROPLINK ppl);
  17. void ApplyVidDlg(HWND hDlg, PPROPLINK ppl);
  18. // Context-sensitive help ids
  19. const static DWORD rgdwHelp[] = {
  20. IDC_SCREENUSAGEGRP, IDH_COMM_GROUPBOX,
  21. IDC_FULLSCREEN, IDH_DOS_SCREEN_USAGE_FULL,
  22. IDC_WINDOWED, IDH_DOS_SCREEN_USAGE_WINDOW,
  23. IDC_SCREENLINESLBL, IDH_DOS_DISPLAY_SCREEN_SETTINGS,
  24. IDC_SCREENLINES, IDH_DOS_DISPLAY_SCREEN_SETTINGS,
  25. IDC_WINDOWUSAGEGRP, IDH_COMM_GROUPBOX,
  26. IDC_TOOLBAR, IDH_DOS_WINDOWS_TOOLBAR,
  27. IDC_SCREENPERFGRP, IDH_COMM_GROUPBOX,
  28. IDC_TEXTEMULATE, IDH_DOS_DISPLAY_ROM,
  29. IDC_WINRESTORE, IDH_DOS_SCREEN_RESTORE,
  30. IDC_DYNAMICVIDMEM, IDH_DOS_SCREEN_DMA,
  31. IDC_REALMODEDISABLE,IDH_DOS_REALMODEPROPS,
  32. 0, 0
  33. };
  34. /*
  35. * This is a little table that converts listbox indices into
  36. * screen lines.
  37. *
  38. * The correspondences are...
  39. *
  40. * IDS_WHATEVER = List box index + IDS_DEFAULTLINES
  41. * nLines = awVideoLines[List box index]
  42. */
  43. #if IDS_25LINES - IDS_DEFAULTLINES != 1 || \
  44. IDS_43LINES - IDS_DEFAULTLINES != 2 || \
  45. IDS_50LINES - IDS_DEFAULTLINES != 3
  46. #error Manifest constants damaged.
  47. #endif
  48. WORD awVideoLines[] = { 0, 25, 43, 50 };
  49. BOOL_PTR CALLBACK DlgVidProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  50. {
  51. PPROPLINK ppl;
  52. FunctionName(DlgVidProc);
  53. ppl = (PPROPLINK)GetWindowLongPtr(hDlg, DWLP_USER);
  54. switch (uMsg) {
  55. case WM_INITDIALOG:
  56. lParam = ((LPPROPSHEETPAGE)lParam)->lParam;
  57. SetWindowLongPtr(hDlg, DWLP_USER, lParam);
  58. ppl = (PPROPLINK)(INT_PTR)lParam;
  59. InitVidDlg(hDlg, ppl);
  60. break;
  61. HELP_CASES(rgdwHelp) // Handle help messages
  62. case WM_COMMAND:
  63. if (LOWORD(lParam) == 0)
  64. break; // message not from a control
  65. switch (LOWORD(wParam)) {
  66. case IDC_SCREENLINES:
  67. if (HIWORD(wParam) == CBN_SELCHANGE)
  68. SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0L);
  69. break;
  70. case IDC_WINDOWED:
  71. case IDC_FULLSCREEN:
  72. case IDC_WINRESTORE:
  73. case IDC_TEXTEMULATE:
  74. case IDC_DYNAMICVIDMEM:
  75. if (HIWORD(wParam) == BN_CLICKED)
  76. SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0L);
  77. break;
  78. }
  79. break;
  80. case WM_NOTIFY:
  81. switch (((NMHDR *)lParam)->code) {
  82. case PSN_SETACTIVE:
  83. AdjustRealModeControls(ppl, hDlg);
  84. break;
  85. case PSN_KILLACTIVE:
  86. // This gives the current page a chance to validate itself
  87. // SetWindowLong(hDlg, DWL_MSGRESULT, 0);
  88. break;
  89. case PSN_APPLY:
  90. // This happens on OK....
  91. ApplyVidDlg(hDlg, ppl);
  92. break;
  93. case PSN_RESET:
  94. // This happens on Cancel....
  95. break;
  96. }
  97. break;
  98. default:
  99. return FALSE; // return 0 when not processing
  100. }
  101. return TRUE;
  102. }
  103. void InitVidDlg(HWND hDlg, PPROPLINK ppl)
  104. {
  105. WORD w;
  106. HWND hwnd;
  107. PROPVID vid;
  108. PROPWIN win;
  109. TCHAR szBuf[MAX_STRING_SIZE];
  110. FunctionName(InitVidDlg);
  111. if (!PifMgr_GetProperties(ppl, MAKELP(0,GROUP_VID),
  112. &vid, SIZEOF(vid), GETPROPS_NONE) ||
  113. !PifMgr_GetProperties(ppl, MAKELP(0,GROUP_WIN),
  114. &win, SIZEOF(win), GETPROPS_NONE)) {
  115. Warning(hDlg, IDS_QUERY_ERROR, MB_ICONEXCLAMATION | MB_OK);
  116. return;
  117. }
  118. SetDlgBits(hDlg, &abinfVid[0], ARRAYSIZE(abinfVid), vid.flVid);
  119. SetDlgBits(hDlg, &abinfWinInit[0], ARRAYSIZE(abinfWinInit), win.flWinInit);
  120. /*
  121. * Fill in the "Initial screen size" combo box. Note that
  122. * we bail on low-memory errors. Note also that if we have
  123. * a nonstandard size, we just leave the combo box with no
  124. * default selection.
  125. */
  126. VERIFYTRUE(hwnd = GetDlgItem(hDlg, IDC_SCREENLINES));
  127. for (w = 0; w < ARRAYSIZE(awVideoLines); w++) {
  128. VERIFYTRUE(LoadString(HINST_THISDLL, IDS_DEFAULTLINES + w, szBuf, ARRAYSIZE(szBuf)));
  129. VERIFYTRUE(SendMessage(hwnd, CB_ADDSTRING, 0, (LPARAM)(LPTSTR)szBuf) == w);
  130. if (vid.cScreenLines == awVideoLines[w]) {
  131. SendMessage(hwnd, CB_SETCURSEL, w, 0);
  132. }
  133. }
  134. if (!IsBilingualCP(g_uCodePage))
  135. {
  136. EnableWindow(GetDlgItem(hDlg, IDC_SCREENLINESLBL), FALSE);
  137. EnableWindow(hwnd, FALSE);
  138. }
  139. }
  140. void ApplyVidDlg(HWND hDlg, PPROPLINK ppl)
  141. {
  142. DWORD dw;
  143. HWND hwnd;
  144. PROPVID vid;
  145. PROPWIN win;
  146. FunctionName(ApplyVidDlg);
  147. // Get the current set of properties, then overlay the new settings
  148. if (!PifMgr_GetProperties(ppl, MAKELP(0,GROUP_VID),
  149. &vid, SIZEOF(vid), GETPROPS_NONE) ||
  150. !PifMgr_GetProperties(ppl, MAKELP(0,GROUP_WIN),
  151. &win, SIZEOF(win), GETPROPS_NONE)) {
  152. Warning(hDlg, IDS_UPDATE_ERROR, MB_ICONEXCLAMATION | MB_OK);
  153. return;
  154. }
  155. GetDlgBits(hDlg, &abinfVid[0], ARRAYSIZE(abinfVid), &vid.flVid);
  156. GetDlgBits(hDlg, &abinfWinInit[0], ARRAYSIZE(abinfWinInit), &win.flWinInit);
  157. /*
  158. * If there is no current selection, don't change the cScreenLines
  159. * property. This allows the user to retain an unusual number of
  160. * screen lines by simply not touching the field.
  161. */
  162. VERIFYTRUE(hwnd = GetDlgItem(hDlg, IDC_SCREENLINES));
  163. dw = (DWORD) SendMessage(hwnd, CB_GETCURSEL, 0, 0L);
  164. if (dw < ARRAYSIZE(awVideoLines)) {
  165. vid.cScreenLines = awVideoLines[dw];
  166. }
  167. if (!PifMgr_SetProperties(ppl, MAKELP(0,GROUP_VID),
  168. &vid, SIZEOF(vid), SETPROPS_NONE) ||
  169. !PifMgr_SetProperties(ppl, MAKELP(0,GROUP_WIN),
  170. &win, SIZEOF(win), SETPROPS_NONE))
  171. Warning(hDlg, IDS_UPDATE_ERROR, MB_ICONEXCLAMATION | MB_OK);
  172. else
  173. if (ppl->hwndNotify) {
  174. ppl->flProp |= PROP_NOTIFY;
  175. PostMessage(ppl->hwndNotify, ppl->uMsgNotify, SIZEOF(vid), (LPARAM)MAKELP(0,GROUP_VID));
  176. PostMessage(ppl->hwndNotify, ppl->uMsgNotify, SIZEOF(win), (LPARAM)MAKELP(0,GROUP_WIN));
  177. }
  178. }
  179. #endif