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.

1477 lines
46 KiB

  1. /*===========================================================================*/
  2. /* Copyright (c) 1987 - 1988, Future Soft Engineering, Inc. */
  3. /* Houston, Texas */
  4. /*===========================================================================*/
  5. #define NOGDICAPMASKS TRUE
  6. #define NOVIRTUALKEYCODES TRUE
  7. #define NOICONS TRUE
  8. #define NOKEYSTATES TRUE
  9. #define NOSYSCOMMANDS TRUE
  10. #define NOATOM TRUE
  11. #define NOCLIPBOARD TRUE
  12. #define NODRAWTEXT TRUE
  13. #define NOMINMAX TRUE
  14. #define NOOPENFILE TRUE
  15. #define NOSCROLL TRUE
  16. #define NOHELP TRUE
  17. #define NOPROFILER TRUE
  18. #define NODEFERWINDOWPOS TRUE
  19. #define NOPEN TRUE
  20. #define NO_TASK_DEFINES TRUE
  21. #define NOLSTRING TRUE
  22. #define WIN31
  23. #include <windows.h>
  24. #include <port1632.h>
  25. #include "dcrc.h"
  26. #include "dynacomm.h"
  27. #include "task.h" /* mbbx 1.04: using taskState.string */
  28. #include "connect.h"
  29. #include <ctype.h> /* adding for prototype of isalpha() -sdj*/
  30. #define SAVEPARAMS struct saveParams /* mbbx 1.04 ... */
  31. #define PSAVEPARAMS SAVEPARAMS *
  32. struct saveParams
  33. {
  34. HANDLE hData;
  35. recTrmParams FAR *lpData;
  36. INT saveLevel;
  37. };
  38. /*---------------------------------------------------------------------------*/
  39. /* doSettings() - [mbb] */
  40. /*---------------------------------------------------------------------------*/
  41. BOOL doSettings(INT dbResID, DLGPROC dbProc)
  42. {
  43. BOOL doSettings = FALSE;
  44. CHAR work[STR255];
  45. doSettings = DialogBox(hInst, MAKEINTRESOURCE(dbResID), hItWnd, dbProc);
  46. if(doSettings == -1)
  47. {
  48. LoadString(hInst, STR_OUTOFMEMORY, work, STR255-1);
  49. testMsg(work,NULL,NULL);
  50. }
  51. return(doSettings);
  52. }
  53. /*---------------------------------------------------------------------------*/
  54. /* initDlgPos() - [mbb] */
  55. /*---------------------------------------------------------------------------*/
  56. VOID initDlgPos(HWND hDlg)
  57. {
  58. RECT dialogRect, windowRect;
  59. GetWindowRect(hDlg, &dialogRect);
  60. dialogRect.right -= dialogRect.left;
  61. dialogRect.bottom -= dialogRect.top;
  62. GetWindowRect(hItWnd, &windowRect);
  63. windowRect.left += (((windowRect.right - windowRect.left) - dialogRect.right) / 2);
  64. windowRect.top += (((windowRect.bottom - windowRect.top) - dialogRect.bottom) / 2);
  65. if(windowRect.left < 10)
  66. windowRect.left = 10;
  67. else if((windowRect.left + dialogRect.right) > (GetSystemMetrics(SM_CXSCREEN) - 10))
  68. windowRect.left = (GetSystemMetrics(SM_CXSCREEN) - 10) - dialogRect.right;
  69. if(windowRect.top < 10)
  70. windowRect.top = 10;
  71. else if((windowRect.top + dialogRect.bottom) > (GetSystemMetrics(SM_CYSCREEN) - 10))
  72. windowRect.top = (GetSystemMetrics(SM_CYSCREEN) - 10) - dialogRect.bottom;
  73. MoveWindow(hDlg, windowRect.left, windowRect.top, dialogRect.right, dialogRect.bottom, FALSE);
  74. }
  75. /*---------------------------------------------------------------------------*/
  76. /* loadListData() - [mbb] */
  77. /*---------------------------------------------------------------------------*/
  78. VOID NEAR loadListData(HWND hDlg, INT nItem, INT nList)
  79. {
  80. INT ndx;
  81. CHAR work[STR255];
  82. for(ndx = 0; LoadString(hInst, nList + ndx, work, STR255-1); ndx += 1)
  83. SendDlgItemMessage(hDlg, nItem, LB_INSERTSTRING, -1, (LPARAM) work);
  84. }
  85. /*---------------------------------------------------------------------------*/
  86. /* dbPhon() - */
  87. /*---------------------------------------------------------------------------*/
  88. INT_PTR APIENTRY dbPhon(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  89. {
  90. BYTE szPhone[((DCS_MODEMCMDSZ-1)*2)+1];
  91. BYTE work[255]; /* jtf 3.20 */
  92. updateTimer();
  93. switch(message)
  94. {
  95. case WM_INITDIALOG:
  96. initDlgPos(hDlg);
  97. SendDlgItemMessage(hDlg, ITMPHONENUMBER, EM_LIMITTEXT, sizeof(szPhone)-1, 0L); /* mbbx 2.00 */
  98. strcpy(szPhone,trmParams.phone);
  99. strcpy(szPhone+strlen(szPhone),trmParams.phone2);
  100. SetDlgItemText(hDlg, ITMPHONENUMBER, szPhone);
  101. SetDlgItemInt(hDlg, ITMRETRYTIME, trmParams.dlyRetry, FALSE);
  102. CheckDlgButton(hDlg, ITMRETRY, trmParams.flgRetry);
  103. CheckDlgButton(hDlg, ITMSIGNAL, trmParams.flgSignal);
  104. return(TRUE);
  105. case WM_COMMAND:
  106. switch(GET_WM_COMMAND_ID(wParam, lParam))
  107. {
  108. case IDOK:
  109. GetDlgItemText(hDlg, ITMPHONENUMBER, szPhone, sizeof(szPhone));
  110. strncpy(trmParams.phone, szPhone, DCS_MODEMCMDSZ);
  111. trmParams.phone[DCS_MODEMCMDSZ-1] = 0;
  112. strcpy(trmParams.phone2, szPhone+strlen(trmParams.phone));
  113. if((trmParams.dlyRetry = GetDlgItemInt(hDlg, ITMRETRYTIME, NULL, FALSE)) < 30)
  114. { /* jtf 3.20 */
  115. LoadString(hInst, STR_MINTIME, work, STR255-1);
  116. testMsg(work,NULL,NULL);
  117. trmParams.dlyRetry = 30;
  118. }
  119. trmParams.flgRetry = (BYTE)IsDlgButtonChecked(hDlg, ITMRETRY);
  120. trmParams.flgSignal = (BYTE)IsDlgButtonChecked(hDlg, ITMSIGNAL);
  121. termData.flags |= TF_CHANGED;
  122. break;
  123. case IDCANCEL:
  124. break;
  125. case ITMRETRY:
  126. case ITMSIGNAL:
  127. CheckDlgButton(hDlg, GET_WM_COMMAND_ID(wParam, lParam), !IsDlgButtonChecked(hDlg, GET_WM_COMMAND_ID(wParam, lParam)));
  128. return(TRUE);
  129. default:
  130. return(TRUE);
  131. }
  132. break;
  133. default:
  134. return(FALSE);
  135. }
  136. EndDialog(hDlg, TRUE);
  137. return(TRUE);
  138. }
  139. /*---------------------------------------------------------------------------*/
  140. /* dbEmul() - */
  141. /*---------------------------------------------------------------------------*/
  142. INT_PTR APIENTRY dbEmul(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  143. {
  144. updateTimer();
  145. switch(message)
  146. {
  147. case WM_INITDIALOG:
  148. chkGrpButton(hDlg, ITMTERMFIRST, ITMTERMLAST, (trmParams.emulate != ITMDELTA) ? trmParams.emulate : ITMTTY);
  149. initDlgPos(hDlg);
  150. return(TRUE);
  151. case WM_COMMAND:
  152. switch(GET_WM_COMMAND_ID(wParam, lParam))
  153. {
  154. case IDOK:
  155. if((wParam = whichGrpButton(hDlg, ITMTERMFIRST, ITMTERMLAST)) != trmParams.emulate)
  156. {
  157. trmParams.emulate = (BYTE)wParam;
  158. resetEmul();
  159. }
  160. termData.flags |= TF_CHANGED;
  161. break;
  162. case IDCANCEL:
  163. break;
  164. default:
  165. chkGrpButton(hDlg, ITMTERMFIRST, ITMTERMLAST, GET_WM_COMMAND_ID(wParam, lParam));
  166. return(TRUE);
  167. }
  168. break;
  169. default:
  170. return(FALSE);
  171. }
  172. EndDialog(hDlg, TRUE);
  173. return(TRUE);
  174. }
  175. /*---------------------------------------------------------------------------*/
  176. /* dbTerm() - Terminal Settings dialog control. [mbb] */
  177. /*---------------------------------------------------------------------------*/
  178. /* mbbx 2.00: all new font enumeration code... */
  179. int APIENTRY nextFontName(const LOGFONT *lpLogFont, const TEXTMETRIC *lpTextMetrics,
  180. DWORD FontType, LPARAM lParam)
  181. {
  182. HWND hDlg = (HWND)lParam;
  183. BYTE testStr[40];
  184. BYTE testStr1[40];
  185. if (lpLogFont->lfPitchAndFamily & FIXED_PITCH) /* jtf 3.21 */
  186. #ifdef ORGCODE
  187. SendDlgItemMessage((HWND) LOWORD((LONG) lpData), ITMFONTFACE, LB_ADDSTRING, 0, (LONG) lpLogFont->lfFaceName);
  188. #else
  189. SendDlgItemMessage(hDlg, ITMFONTFACE, LB_ADDSTRING, 0, (LPARAM) lpLogFont->lfFaceName);
  190. #endif
  191. lstrcpy( testStr, (LPSTR) lpLogFont->lfFaceName); /* jtf 3.21 */
  192. LoadString(hInst, STR_INI_FONTFACE, testStr1, LF_FACESIZE);
  193. /* changed from strcmpi -sdj */
  194. if (lstrcmpi(testStr,testStr1) == 0)
  195. #ifdef ORGCODE
  196. SendDlgItemMessage((HWND) LOWORD((LONG) lpData), ITMFONTFACE, LB_ADDSTRING, 0, (LONG) lpLogFont->lfFaceName);
  197. #else
  198. SendDlgItemMessage(hDlg, ITMFONTFACE, LB_ADDSTRING, 0, (LPARAM) lpLogFont->lfFaceName);
  199. #endif
  200. return(TRUE);
  201. }
  202. VOID NEAR loadFontNames(HWND hDlg)
  203. {
  204. getPort();
  205. #ifdef ORGCODE
  206. EnumFonts(thePort, NULL, nextFontName, ((LONG) hDlg));
  207. #else
  208. EnumFonts(thePort, NULL, nextFontName, (LPARAM) hDlg);
  209. #endif
  210. releasePort();
  211. SendDlgItemMessage(hDlg, ITMFONTFACE, LB_SELECTSTRING, -1, (LPARAM) (trmParams.fontFace));
  212. }
  213. VOID NEAR loadFontSizes(HWND hDlg, BYTE *faceName, INT fontSize)
  214. {
  215. CHAR sizeList[64], work[16];
  216. INT ndx, ndx1;
  217. listFontSizes(faceName, sizeList, 64-1);
  218. ndx = -1;
  219. for(ndx1 = 7; ndx1 < 64; ndx1 += 1)
  220. if(sizeList[ndx1] != 0)
  221. {
  222. sprintf(work, "%d", ndx1);
  223. SendDlgItemMessage(hDlg, ITMFONTSIZE, LB_INSERTSTRING, -1, (LPARAM) (work));
  224. if((ndx1 <= fontSize) || (ndx == -1))
  225. ndx += 1;
  226. }
  227. SendDlgItemMessage(hDlg, ITMFONTSIZE, LB_SETCURSEL, ndx, 0L);
  228. }
  229. INT NEAR getFontSize(HWND hDlg) /* mbbx 2.00: font selection... */
  230. {
  231. INT ndx;
  232. CHAR work[16];
  233. ndx = (INT)SendDlgItemMessage(hDlg, ITMFONTSIZE, LB_GETCURSEL, 0, 0L);
  234. SendDlgItemMessage(hDlg, ITMFONTSIZE, LB_GETTEXT, ndx, (LPARAM) (work));
  235. sscanf(work, "%d", &ndx);
  236. return(ndx);
  237. }
  238. INT_PTR APIENTRY dbTerm(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  239. {
  240. WORD tempWord;
  241. BOOL tempBool;
  242. updateTimer();
  243. switch(message)
  244. {
  245. case WM_INITDIALOG:
  246. initDlgPos(hDlg);
  247. if((((PSAVEPARAMS) taskState.string)->hData = GlobalAlloc(GMEM_MOVEABLE, (DWORD) sizeof(recTrmParams))) == NULL)
  248. break;
  249. ((PSAVEPARAMS) taskState.string)->lpData = (recTrmParams FAR *) GlobalLock(((PSAVEPARAMS) taskState.string)->hData);
  250. *(((PSAVEPARAMS) taskState.string)->lpData) = trmParams;
  251. CheckDlgButton(hDlg, ITMLINEWRAP, trmParams.lineWrap);
  252. CheckDlgButton(hDlg, ITMLOCALECHO, trmParams.localEcho);
  253. CheckDlgButton(hDlg, ITMSOUND, trmParams.sound);
  254. CheckDlgButton(hDlg, ITMINCRLF, trmParams.inpCRLF);
  255. CheckDlgButton(hDlg, ITMOUTCRLF, trmParams.outCRLF);
  256. CheckRadioButton(hDlg, ITM80COL, ITM132COL, trmParams.columns);
  257. CheckRadioButton(hDlg, ITMBLKCURSOR, ITMUNDCURSOR, trmParams.termCursor);
  258. CheckDlgButton(hDlg, ITMBLINKCURSOR, trmParams.cursorBlink);
  259. loadFontNames(hDlg); /* mbbx 2.00: font selection... */
  260. loadFontSizes(hDlg, trmParams.fontFace, trmParams.fontSize);
  261. ((PSAVEPARAMS) taskState.string)->saveLevel = -1;
  262. loadListData(hDlg, ITMTRANSLATE, STR_ICS_NAME);
  263. SendDlgItemMessage(hDlg, ITMTRANSLATE, LB_SETCURSEL, trmParams.language, 0L);
  264. SetDlgItemInt(hDlg, ITMBUFFERLINES, trmParams.bufferLines = maxLines, FALSE); /* mbbx 2.00.03 ... */
  265. CheckDlgButton(hDlg, ITMSCROLLBARS, !trmParams.fHideTermVSB);
  266. CheckDlgButton(hDlg, ITMIBMXANSI, trmParams.setIBMXANSI); /* rjs swat */
  267. CheckDlgButton(hDlg, ITMWINCTRL, trmParams.useWinCtrl); /* rjs swat */
  268. return(TRUE);
  269. case WM_COMMAND:
  270. switch(GET_WM_COMMAND_ID(wParam, lParam))
  271. {
  272. case IDOK:
  273. /* mbbx 2.00.03 ... */
  274. /* rjs bug2 002 */
  275. tempWord = GetDlgItemInt(hDlg, ITMBUFFERLINES, (BOOL FAR *)&tempBool, FALSE);
  276. if(tempBool)
  277. {
  278. if(tempWord > 399)
  279. {
  280. MessageBeep(0);
  281. lParam = 0xFFFF0000;
  282. SendDlgItemMessage(hDlg, ITMBUFFERLINES, EM_SETSEL, GET_EM_SETSEL_MPS( 0, lParam));
  283. return(TRUE);
  284. }
  285. }
  286. else
  287. {
  288. MessageBeep(0);
  289. lParam = 0xFFFF0000;
  290. SendDlgItemMessage(hDlg, ITMBUFFERLINES, EM_SETSEL, GET_EM_SETSEL_MPS(0, lParam));
  291. return(TRUE);
  292. }
  293. /* end rjs bug2 002 */
  294. if(tempWord != trmParams.bufferLines)
  295. trmParams.bufferLines = tempWord;
  296. resetTermBuffer();
  297. icsResetTable((WORD) SendDlgItemMessage(hDlg, ITMTRANSLATE, LB_GETCURSEL, 0, 0L));
  298. if(((PSAVEPARAMS) taskState.string)->saveLevel != -1) /* mbbx 2.00: font selection... */
  299. buildTermFont();
  300. updateTermScrollBars(FALSE);
  301. if(!IsIconic(hItWnd))/* rjs bugs 015 */
  302. sizeTerm(0L);
  303. termData.flags |= TF_CHANGED;
  304. // clears the hTermWnd make sure there's no garbage left
  305. // when font is changed.
  306. InvalidateRect (hTermWnd, NULL, TRUE);
  307. UpdateWindow (hTermWnd);
  308. break;
  309. case IDCANCEL:
  310. trmParams = *(((PSAVEPARAMS) taskState.string)->lpData);
  311. break;
  312. case ITMIBMXANSI:
  313. CheckDlgButton(hDlg, ITMIBMXANSI, trmParams.setIBMXANSI = !trmParams.setIBMXANSI);
  314. return(TRUE);
  315. case ITMLINEWRAP:
  316. CheckDlgButton(hDlg, ITMLINEWRAP, trmParams.lineWrap = !trmParams.lineWrap);
  317. return(TRUE);
  318. case ITMLOCALECHO:
  319. CheckDlgButton(hDlg, ITMLOCALECHO, trmParams.localEcho = !trmParams.localEcho);
  320. return(TRUE);
  321. case ITMSOUND:
  322. CheckDlgButton(hDlg, ITMSOUND, trmParams.sound = !trmParams.sound);
  323. return(TRUE);
  324. case ITMINCRLF:
  325. CheckDlgButton(hDlg, ITMINCRLF, trmParams.inpCRLF = !trmParams.inpCRLF);
  326. return(TRUE);
  327. case ITMOUTCRLF:
  328. CheckDlgButton(hDlg, ITMOUTCRLF, trmParams.outCRLF = !trmParams.outCRLF);
  329. return(TRUE);
  330. case ITM80COL:
  331. case ITM132COL:
  332. CheckRadioButton(hDlg, ITM80COL, ITM132COL, trmParams.columns = wParam);
  333. return(TRUE);
  334. case ITMBLKCURSOR:
  335. case ITMUNDCURSOR:
  336. CheckRadioButton(hDlg, ITMBLKCURSOR, ITMUNDCURSOR, trmParams.termCursor = wParam);
  337. return(TRUE);
  338. case ITMBLINKCURSOR:
  339. CheckDlgButton(hDlg, ITMBLINKCURSOR, trmParams.cursorBlink = !trmParams.cursorBlink);
  340. return(TRUE);
  341. case ITMFONTFACE:
  342. // -sdj 10/09 LBN_ HAS CHANGED IN WIN32, have to take care of this in spec.
  343. #ifdef ORGCODE
  344. if(HIWORD(lParam) == LBN_SELCHANGE) /* mbbx 2.00: font selection... */
  345. #else
  346. if(HIWORD(wParam) == LBN_SELCHANGE) /* mbbx 2.00: font selection... */
  347. #endif
  348. {
  349. SendDlgItemMessage(hDlg, ITMFONTFACE, LB_GETTEXT, SendDlgItemMessage(hDlg, ITMFONTFACE, LB_GETCURSEL, 0, 0L),
  350. (LPARAM) (trmParams.fontFace));
  351. SendDlgItemMessage(hDlg, ITMFONTSIZE, LB_RESETCONTENT, 0, 0L);
  352. loadFontSizes(hDlg, trmParams.fontFace, trmParams.fontSize);
  353. }
  354. case ITMFONTSIZE:
  355. // -sdj 10/09 LBN_ HAS CHANGED IN WIN32, have to take care of this in spec.
  356. #ifdef ORGCODE
  357. if(HIWORD(lParam) == LBN_SELCHANGE) /* mbbx 2.00: font selection... */
  358. #else
  359. if(HIWORD(wParam) == LBN_SELCHANGE) /* mbbx 2.00: font selection... */
  360. #endif
  361. {
  362. trmParams.fontSize = getFontSize(hDlg);
  363. ((PSAVEPARAMS) taskState.string)->saveLevel = 0;
  364. }
  365. return(TRUE);
  366. case ITMTRANSLATE:
  367. case ITMBUFFERLINES:
  368. return(TRUE);
  369. case ITMSCROLLBARS:
  370. CheckDlgButton(hDlg, ITMSCROLLBARS, !(trmParams.fHideTermVSB = !trmParams.fHideTermVSB));
  371. trmParams.fHideTermHSB = trmParams.fHideTermVSB;
  372. return(TRUE);
  373. case ITMWINCTRL:
  374. CheckDlgButton(hDlg, ITMWINCTRL, trmParams.useWinCtrl = !trmParams.useWinCtrl);
  375. return(TRUE);
  376. }
  377. break;
  378. default:
  379. return(FALSE);
  380. }
  381. if(((PSAVEPARAMS) taskState.string)->hData != NULL)
  382. {
  383. GlobalUnlock(((PSAVEPARAMS) taskState.string)->hData);
  384. GlobalFree(((PSAVEPARAMS) taskState.string)->hData);
  385. }
  386. EndDialog(hDlg, TRUE);
  387. return(TRUE);
  388. }
  389. /*---------------------------------------------------------------------------*/
  390. /* dbFkey() - Dialog box control for function keys. */
  391. /*---------------------------------------------------------------------------*/
  392. VOID NEAR setDlgFkeys(HWND hDlg, INT level)
  393. {
  394. INT key;
  395. for(key = 0; key < DCS_NUMFKEYS; key += 1)
  396. {
  397. SetDlgItemText(hDlg, ITMFKEYTITLE+(key+1), trmParams.fKeyTitle[level-1][key]); /* rkhx 2.00 */
  398. SetDlgItemText(hDlg, ITMFKEYTEXT+(key+1), trmParams.fKeyText[level-1][key]);
  399. }
  400. }
  401. VOID NEAR getDlgFkeys(HWND hDlg, INT level)
  402. {
  403. INT key;
  404. for(key = 0; key < DCS_NUMFKEYS; key += 1)
  405. {
  406. GetDlgItemText(hDlg, ITMFKEYTITLE+(key+1), trmParams.fKeyTitle[level-1][key], DCS_FKEYTITLESZ-2); /* rkhx 2.00 */
  407. GetDlgItemText(hDlg, ITMFKEYTEXT+(key+1), trmParams.fKeyText[level-1][key], DCS_FKEYTEXTSZ-2); /* jtf 3.12 */
  408. }
  409. }
  410. INT_PTR APIENTRY dbFkey(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  411. {
  412. updateTimer();
  413. switch(message)
  414. {
  415. case WM_INITDIALOG:
  416. initDlgPos(hDlg);
  417. if((((PSAVEPARAMS) taskState.string)->hData = GlobalAlloc(GMEM_MOVEABLE, (DWORD) sizeof(recTrmParams))) == NULL)
  418. break;
  419. ((PSAVEPARAMS) taskState.string)->lpData = (recTrmParams FAR *) GlobalLock(((PSAVEPARAMS) taskState.string)->hData);
  420. *(((PSAVEPARAMS) taskState.string)->lpData) = trmParams;
  421. ((PSAVEPARAMS) taskState.string)->saveLevel = curLevel;
  422. for(wParam = 1; wParam <= DCS_NUMFKEYS; wParam += 1)
  423. {
  424. SendDlgItemMessage(hDlg, ITMFKEYTITLE + wParam, EM_LIMITTEXT, DCS_FKEYTITLESZ-2, 0L);
  425. SendDlgItemMessage(hDlg, ITMFKEYTEXT + wParam, EM_LIMITTEXT, DCS_FKEYTEXTSZ-3, 0L); /* jtf 3.12 */
  426. }
  427. setDlgFkeys(hDlg, curLevel);
  428. CheckRadioButton(hDlg, ITMLEVEL1, ITMLEVEL4, ITMLEVEL1+(curLevel-1));
  429. CheckDlgButton(hDlg, ITMSHOWFKEYS, trmParams.environmentFlags & DCS_EVF_FKEYSSHOW); /* mbbx 2.00: show fkeys... */
  430. return(TRUE);
  431. case WM_COMMAND:
  432. switch(GET_WM_COMMAND_ID(wParam, lParam))
  433. {
  434. case IDOK:
  435. getDlgFkeys(hDlg, curLevel);
  436. setFKeyLevel(curLevel, TRUE); /* mbbx 2.00 */
  437. if(IsDlgButtonChecked(hDlg, ITMSHOWFKEYS)) /* mbbx 2.00: show fkeys... */
  438. {
  439. if(!(trmParams.environmentFlags & DCS_EVF_FKEYSSHOW))
  440. {
  441. showHidedbmyControls(TRUE, TRUE);
  442. trmParams.environmentFlags |= DCS_EVF_FKEYSSHOW;
  443. }
  444. }
  445. else
  446. trmParams.environmentFlags &= ~DCS_EVF_FKEYSSHOW;
  447. // -sdj: 02jun92 when keys visible is ticked and ok pressed
  448. // IsDlgButtonChecked(hDlg, AUTOARRANGE ) is called, but
  449. // AUTOARRANGE is not present in the rc file, NT doesnt like
  450. // this any more! If this flag is important then we need to
  451. // define this some place to avoid Unknown control Id error
  452. // from USER.
  453. #ifdef BUGBYPASS
  454. #else
  455. if(IsDlgButtonChecked(hDlg, ITMAUTOARRANGE))
  456. trmParams.environmentFlags |= DCS_EVF_FKEYSARRANGE;
  457. else
  458. trmParams.environmentFlags &= ~DCS_EVF_FKEYSARRANGE;
  459. #endif
  460. termData.flags |= TF_CHANGED;
  461. break;
  462. case IDCANCEL:
  463. trmParams = *(((PSAVEPARAMS) taskState.string)->lpData);
  464. curLevel = ((PSAVEPARAMS) taskState.string)->saveLevel;
  465. break;
  466. case ITMLEVEL1:
  467. case ITMLEVEL2:
  468. case ITMLEVEL3:
  469. case ITMLEVEL4:
  470. CheckRadioButton(hDlg, ITMLEVEL1, ITMLEVEL4, GET_WM_COMMAND_ID(wParam, lParam));
  471. getDlgFkeys(hDlg, curLevel);
  472. setDlgFkeys(hDlg, curLevel = wParam-(ITMLEVEL1-1));
  473. return(TRUE);
  474. case ITMSHOWFKEYS: /* mbbx 2.00 ... */
  475. CheckDlgButton(hDlg, GET_WM_COMMAND_ID(wParam, lParam), !IsDlgButtonChecked(hDlg, GET_WM_COMMAND_ID(wParam, lParam)));
  476. return(TRUE);
  477. default:
  478. return(TRUE);
  479. }
  480. break;
  481. default:
  482. return(FALSE);
  483. }
  484. if(((PSAVEPARAMS) taskState.string)->hData != NULL)
  485. {
  486. GlobalUnlock(((PSAVEPARAMS) taskState.string)->hData);
  487. GlobalFree(((PSAVEPARAMS) taskState.string)->hData);
  488. }
  489. EndDialog(hDlg, TRUE);
  490. return(TRUE);
  491. }
  492. /*---------------------------------------------------------------------------*/
  493. /* dbTxtX() - Control for Text transfer dialogue box. */
  494. /*---------------------------------------------------------------------------*/
  495. VOID NEAR enableStdItems(HWND hDlg, BOOL bEnable)
  496. {
  497. ShowWindow(GetDlgItem(hDlg, ITMSTDGRP), bEnable ? SW_SHOWNOACTIVATE : SW_HIDE);
  498. ShowWindow(GetDlgItem(hDlg, ITMSTDXON), bEnable && (trmParams.flowControl == ITMXONFLOW) ? SW_SHOWNOACTIVATE : SW_HIDE);
  499. ShowWindow(GetDlgItem(hDlg, ITMSTDHARD), bEnable && (trmParams.flowControl == ITMHARDFLOW) ? SW_SHOWNOACTIVATE : SW_HIDE);
  500. ShowWindow(GetDlgItem(hDlg, ITMSTDNONE), bEnable && (trmParams.flowControl == ITMNOFLOW) ? SW_SHOWNOACTIVATE : SW_HIDE);
  501. UpdateWindow(hDlg); /* rjs bugs 001 */
  502. }
  503. VOID NEAR enableChrItems(HWND hDlg, BOOL bEnable)
  504. {
  505. INT nCmdShow, nResID;
  506. nCmdShow = bEnable ? SW_SHOWNOACTIVATE : SW_HIDE;
  507. for(nResID = ITMCHRGRP; nResID <= ITMCHRUNITS; nResID += 1)
  508. ShowWindow(GetDlgItem(hDlg, nResID), nCmdShow);
  509. if(bEnable)
  510. EnableWindow(GetDlgItem(hDlg, ITMCHRTIME), trmParams.xChrType == ITMCHRDELAY);
  511. UpdateWindow(hDlg); /* rjs bugs 001 */
  512. }
  513. VOID NEAR enableLinItems(HWND hDlg, BOOL bEnable)
  514. {
  515. INT nCmdShow, nResID;
  516. nCmdShow = bEnable ? SW_SHOWNOACTIVATE : SW_HIDE;
  517. for(nResID = ITMLINGRP; nResID <= ITMLINSTR; nResID += 1)
  518. ShowWindow(GetDlgItem(hDlg, nResID), nCmdShow);
  519. if(bEnable)
  520. {
  521. EnableWindow(GetDlgItem(hDlg, ITMLINTIME), trmParams.xLinType == ITMLINDELAY);
  522. EnableWindow(GetDlgItem(hDlg, ITMLINSTR), trmParams.xLinType == ITMLINWAIT);
  523. }
  524. UpdateWindow(hDlg); /* rjs bugs 001 */
  525. }
  526. INT_PTR APIENTRY dbTxtX(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  527. {
  528. DWORD temp;
  529. BYTE tempStr[16];
  530. updateTimer();
  531. switch(message)
  532. {
  533. case WM_INITDIALOG:
  534. if((((PSAVEPARAMS) taskState.string)->hData = GlobalAlloc(GMEM_MOVEABLE, (DWORD) sizeof(recTrmParams))) == NULL)
  535. break;
  536. ((PSAVEPARAMS) taskState.string)->lpData = (recTrmParams FAR *) GlobalLock(((PSAVEPARAMS) taskState.string)->hData);
  537. *(((PSAVEPARAMS) taskState.string)->lpData) = trmParams;
  538. CheckRadioButton(hDlg, ITMSTD, ITMLIN, trmParams.xTxtType);
  539. enableStdItems(hDlg, trmParams.xTxtType == ITMSTD);
  540. enableChrItems(hDlg, trmParams.xTxtType == ITMCHR);
  541. enableLinItems(hDlg, trmParams.xTxtType == ITMLIN);
  542. CheckRadioButton(hDlg, ITMCHRDELAY, ITMCHRWAIT, trmParams.xChrType);
  543. SetDlgItemInt(hDlg, ITMCHRTIME, trmParams.xChrDelay, FALSE);
  544. CheckRadioButton(hDlg, ITMLINDELAY, ITMLINWAIT, trmParams.xLinType);
  545. SetDlgItemInt(hDlg, ITMLINTIME, trmParams.xLinDelay, FALSE);
  546. SendDlgItemMessage(hDlg, ITMLINSTR, EM_LIMITTEXT, DCS_XLINSTRSZ-1, 0L); /* rkhx 2.00 */
  547. SetDlgItemText(hDlg, ITMLINSTR, trmParams.xLinStr);
  548. CheckDlgButton(hDlg, ITMWORDWRAP, trmParams.xWordWrap);
  549. EnableWindow(GetDlgItem(hDlg, ITMWRAPCOL), trmParams.xWordWrap);
  550. SetDlgItemInt(hDlg, ITMWRAPCOL, trmParams.xWrapCol, FALSE);
  551. initDlgPos(hDlg);
  552. return(TRUE);
  553. case WM_COMMAND:
  554. switch(GET_WM_COMMAND_ID(wParam, lParam))
  555. {
  556. case IDOK:
  557. trmParams.xTxtType = whichGrpButton(hDlg, ITMSTD, ITMLIN);
  558. #ifdef OLDCODE /* rjs bugs 007 */
  559. trmParams.xChrDelay = GetDlgItemInt(hDlg, ITMCHRTIME, NULL, FALSE);
  560. trmParams.xLinDelay = GetDlgItemInt(hDlg, ITMLINTIME, NULL, FALSE);
  561. trmParams.xWrapCol = GetDlgItemInt(hDlg, ITMWRAPCOL, NULL, FALSE);
  562. #endif
  563. GetDlgItemText(hDlg, ITMLINSTR, trmParams.xLinStr, DCS_XLINSTRSZ-1); /* rkhx 2.00 */
  564. /* rjs bugs 007 */
  565. GetDlgItemText(hDlg, ITMCHRTIME, tempStr, DCS_XLINSTRSZ-1); /* rjs bugs 007 */
  566. temp = 0;
  567. while(tempStr[temp])
  568. if(isalpha(tempStr[temp++]))
  569. {
  570. MessageBeep(0);
  571. return(TRUE);
  572. }
  573. sscanf(tempStr, "%u", &temp);
  574. if(temp > 255)
  575. {
  576. MessageBeep(0);
  577. return(TRUE);
  578. }
  579. trmParams.xChrDelay = temp;
  580. GetDlgItemText(hDlg, ITMLINTIME, tempStr, DCS_XLINSTRSZ-1); /* rjs bugs 007 */
  581. temp = 0;
  582. while(tempStr[temp])
  583. if(isalpha(tempStr[temp++]))
  584. {
  585. MessageBeep(0);
  586. return(TRUE);
  587. }
  588. sscanf(tempStr, "%u", &temp);
  589. if(temp > 255)
  590. {
  591. MessageBeep(0);
  592. return(TRUE);
  593. }
  594. trmParams.xLinDelay = temp;
  595. GetDlgItemText(hDlg, ITMWRAPCOL, tempStr, DCS_XLINSTRSZ-1); /* rjs bugs 007 */
  596. temp = 0;
  597. while(tempStr[temp])
  598. if(isalpha(tempStr[temp++]))
  599. {
  600. MessageBeep(0);
  601. return(TRUE);
  602. }
  603. sscanf(tempStr, "%u", &temp);
  604. if(temp > 255)
  605. {
  606. MessageBeep(0);
  607. return(TRUE);
  608. }
  609. trmParams.xWrapCol = temp;
  610. termData.flags |= TF_CHANGED;
  611. break;
  612. case IDCANCEL:
  613. trmParams = *(((PSAVEPARAMS) taskState.string)->lpData);
  614. break;
  615. case ITMSTD:
  616. case ITMCHR:
  617. case ITMLIN:
  618. CheckRadioButton(hDlg, ITMSTD, ITMLIN, trmParams.xTxtType = GET_WM_COMMAND_ID(wParam, lParaqm));
  619. enableLinItems(hDlg, GET_WM_COMMAND_ID(wParam, lParam) == ITMLIN);
  620. enableChrItems(hDlg, GET_WM_COMMAND_ID(wParam, lParam) == ITMCHR);
  621. enableStdItems(hDlg, GET_WM_COMMAND_ID(wParam, lParam) == ITMSTD);
  622. return(TRUE);
  623. case ITMCHRDELAY:
  624. case ITMCHRWAIT:
  625. if(trmParams.xTxtType == ITMCHR)
  626. {
  627. CheckRadioButton(hDlg, ITMCHRDELAY, ITMCHRWAIT, trmParams.xChrType = GET_WM_COMMAND_ID(wParam, lParam));
  628. enableChrItems(hDlg, TRUE);
  629. }
  630. return(TRUE);
  631. case ITMLINDELAY:
  632. case ITMLINWAIT:
  633. if(trmParams.xTxtType == ITMLIN)
  634. {
  635. CheckRadioButton(hDlg, ITMLINDELAY, ITMLINWAIT, trmParams.xLinType = GET_WM_COMMAND_ID(wParam, lParam));
  636. enableLinItems(hDlg, TRUE);
  637. }
  638. return(TRUE);
  639. case ITMWORDWRAP:
  640. CheckDlgButton(hDlg, ITMWORDWRAP, trmParams.xWordWrap = !trmParams.xWordWrap);
  641. EnableWindow(GetDlgItem(hDlg, ITMWRAPCOL), trmParams.xWordWrap);
  642. if(trmParams.xWordWrap)
  643. {
  644. SetFocus(GetDlgItem(hDlg, ITMWRAPCOL));
  645. SendDlgItemMessage(hDlg, ITMWRAPCOL, EM_SETSEL, GET_EM_SETSEL_MPS(0, MAKELONG(0, 0x7FFF)));
  646. }
  647. return(TRUE);
  648. default:
  649. return(TRUE);
  650. }
  651. break;
  652. default:
  653. return(FALSE);
  654. }
  655. if(((PSAVEPARAMS) taskState.string)->hData != NULL)
  656. {
  657. GlobalUnlock(((PSAVEPARAMS) taskState.string)->hData);
  658. GlobalFree(((PSAVEPARAMS) taskState.string)->hData);
  659. }
  660. EndDialog(hDlg, TRUE);
  661. return(TRUE);
  662. }
  663. /*---------------------------------------------------------------------------*/
  664. /* dbBinX() - Dialogue box control for Binary File Transfers. */
  665. /*---------------------------------------------------------------------------*/
  666. INT_PTR APIENTRY dbBinX(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  667. {
  668. updateTimer();
  669. switch(message)
  670. {
  671. case WM_INITDIALOG:
  672. chkGrpButton(hDlg, ITMKERMIT, ITMXMODEM, trmParams.xBinType);
  673. initDlgPos(hDlg);
  674. return(TRUE);
  675. case WM_COMMAND:
  676. switch(GET_WM_COMMAND_ID(wParam, lParam))
  677. {
  678. case IDOK:
  679. // trmParams.xBinType = whichGrpButton(hDlg, ITMDYNACOMM, ITMYTERM);
  680. // change this to kermit,xmodem, to avoid controlid unknown error from user
  681. // -sdj 02jun92
  682. trmParams.xBinType = whichGrpButton(hDlg, ITMKERMIT, ITMXMODEM);
  683. termData.flags |= TF_CHANGED;
  684. break;
  685. case IDCANCEL:
  686. break;
  687. default:
  688. // change this to kermit,xmodem, to avoid control id unknown error from user
  689. // -sdj 02jun92
  690. // chkGrpButton(hDlg, ITMDYNACOMM, ITMYTERM, GET_WM_COMMAND_ID(wParam, lParam));
  691. chkGrpButton(hDlg, ITMKERMIT, ITMXMODEM, GET_WM_COMMAND_ID(wParam, lParam));
  692. return(TRUE);
  693. }
  694. break;
  695. default:
  696. return(FALSE);
  697. }
  698. EndDialog(hDlg, TRUE);
  699. return(TRUE);
  700. }
  701. /*---------------------------------------------------------------------------*/
  702. /* dbComm() - [mbb] */
  703. /*---------------------------------------------------------------------------*/
  704. #ifdef ORGCODE
  705. BYTE comDevList[5];
  706. #else
  707. BYTE comDevList[20];
  708. #endif
  709. VOID initComDevSelect(HWND hDlg,WORD wListID,BOOL bInit) /* mbbx 2.01.09 ... */
  710. {
  711. BYTE str1[8], str2[8], str3[16];
  712. INT ndx;
  713. loadListData(hDlg, wListID, STR_COM_CONNECT);
  714. LoadString(hInst, STR_COM_CONNECT+2, str1, sizeof(str1));
  715. comDevList[0] = 0;
  716. for(ndx = 1; ndx <= MaxComPortNumberInMenu; ndx += 1)
  717. {
  718. //sprintf(str2, str1, ndx);
  719. //if(GetProfileString("ports", (LPSTR) str2, (LPSTR) NULL_STR, (LPSTR) str3, sizeof(str3)))
  720. if (TRUE)
  721. {
  722. SendDlgItemMessage(hDlg, wListID, LB_INSERTSTRING, -1, (LPARAM) (arComNumAndName[ndx].PortName));
  723. comDevList[++comDevList[0]] = ndx;
  724. }
  725. }
  726. #ifdef ORGCODE
  727. #else
  728. comDevList[(comDevList[0])+1] = ndx;
  729. //MaxComPortNumberInMenu = ndx-1;
  730. SendDlgItemMessage(hDlg, wListID, LB_INSERTSTRING, -1, (LPARAM)"TELNET");
  731. #endif
  732. if(bInit)
  733. {
  734. ndx = 0;
  735. }
  736. else
  737. {
  738. loadListData(hDlg, wListID, STR_COM_CONNECT+4);
  739. if(trmParams.comDevRef < ITMNETCOM)
  740. {
  741. for(ndx = comDevList[0]; ndx > 0; ndx -= 1)
  742. if(comDevList[ndx] == trmParams.comPortRef)
  743. break;
  744. }
  745. else
  746. ndx = trmParams.comDevRef + (comDevList[0] - 1);
  747. }
  748. SendDlgItemMessage(hDlg, wListID, LB_SETCURSEL, ndx, 0L);
  749. }
  750. BYTE getComDevSelect(HWND hDlg, WORD wListID, BYTE *newDevRef) /* mbbx 2.01.09 ... */
  751. {
  752. BYTE comPortRef = 0;
  753. if((*newDevRef = SendDlgItemMessage(hDlg, wListID, LB_GETCURSEL, 0, 0L)) != (BYTE) -1)
  754. {
  755. #ifdef ORGCODE
  756. if(*newDevRef <= comDevList[0])
  757. #else
  758. if(*newDevRef <= (comDevList[0])+1)
  759. #endif
  760. {
  761. if(*newDevRef > ITMNOCOM)
  762. {
  763. comPortRef = comDevList[*newDevRef];
  764. *newDevRef = ITMWINCOM;
  765. }
  766. }
  767. else
  768. *newDevRef -= (comDevList[0] - 1);
  769. }
  770. else
  771. *newDevRef = ITMNOCOM;
  772. return(comPortRef);
  773. }
  774. /*---------------------------------------------------------------------------*/
  775. VOID NEAR enableGrpItems(HWND hDlg, INT itemFirst, INT itemLast, INT itemSelect)
  776. {
  777. INT itemNext;
  778. CheckRadioButton(hDlg, itemFirst, itemLast, itemSelect);
  779. for(itemNext = itemFirst; itemNext <= itemLast; itemNext += 1)
  780. EnableWindow(GetDlgItem(hDlg, itemNext), itemSelect);
  781. }
  782. VOID NEAR enableCommItems(HWND hDlg, BYTE comDevRef)
  783. {
  784. WORD wBaudID;
  785. switch(trmParams.speed)
  786. {
  787. case 110:
  788. wBaudID = ITMBD110;
  789. break;
  790. case 300:
  791. wBaudID = ITMBD300;
  792. break;
  793. case 600:
  794. wBaudID = ITMBD600;
  795. break;
  796. case 2400:
  797. wBaudID = ITMBD240;
  798. break;
  799. case 4800:
  800. wBaudID = ITMBD480;
  801. break;
  802. case 9600:
  803. wBaudID = ITMBD960;
  804. break;
  805. case 14400:
  806. wBaudID = ITMBD144;
  807. break;
  808. case 19200:
  809. wBaudID = ITMBD192;
  810. break;
  811. case 38400:
  812. wBaudID = ITMBD384;
  813. break;
  814. case 57600:
  815. wBaudID = ITMBD576;
  816. break;
  817. case 57601:
  818. wBaudID = ITMBD1152;
  819. break;
  820. //case 57602:
  821. // wBaudID = ITMBD1280;
  822. // break;
  823. default:
  824. wBaudID = ITMBD120;
  825. trmParams.speed = 1200;
  826. break;
  827. }
  828. switch(comDevRef)
  829. {
  830. case ITMWINCOM:
  831. enableGrpItems(hDlg, ITMBD110, ITMBD1152, wBaudID);
  832. enableGrpItems(hDlg, ITMDATA5, ITMDATA8, trmParams.dataBits); /* jtf 3.24 */
  833. enableGrpItems(hDlg, ITMSTOP1, ITMSTOP2, trmParams.stopBits);
  834. enableGrpItems(hDlg, ITMNOPARITY, ITMSPACEPARITY, trmParams.parity);
  835. enableGrpItems(hDlg, ITMXONFLOW, ITMNOFLOW, trmParams.flowControl);
  836. if(trmParams.dataBits == ITMDATA5) /* jtf 3.24 */
  837. {
  838. EnableWindow(GetDlgItem(hDlg, ITMDATA6), FALSE);
  839. EnableWindow(GetDlgItem(hDlg, ITMDATA7), FALSE);
  840. EnableWindow(GetDlgItem(hDlg, ITMDATA8), FALSE);
  841. }
  842. else
  843. EnableWindow(GetDlgItem(hDlg, ITMDATA5), FALSE);
  844. break;
  845. default:
  846. enableGrpItems(hDlg, ITMBD110, ITMBD1152, 0);
  847. enableGrpItems(hDlg, ITMDATA5, ITMDATA8, 0); /* jtf 3.24 */
  848. enableGrpItems(hDlg, ITMSTOP1, ITMSTOP2, 0);
  849. enableGrpItems(hDlg, ITMNOPARITY, ITMSPACEPARITY, 0);
  850. enableGrpItems(hDlg, ITMXONFLOW, ITMNOFLOW, 0);
  851. break;
  852. }
  853. CheckDlgButton(hDlg, ITMPARITY, (comDevRef == ITMWINCOM) ? trmParams.fParity : FALSE);
  854. EnableWindow(GetDlgItem(hDlg, ITMPARITY), (comDevRef == ITMWINCOM) ? TRUE : FALSE);
  855. CheckDlgButton(hDlg, ITMCARRIER, (comDevRef == ITMWINCOM) ? trmParams.fCarrier : FALSE);
  856. EnableWindow(GetDlgItem(hDlg, ITMCARRIER), (comDevRef == ITMWINCOM) ? TRUE : FALSE);
  857. }
  858. INT_PTR APIENTRY dbComm(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  859. {
  860. WORD wCurSel; /* seh nova 005 */
  861. LPCONNECTOR_CONTROL_BLOCK lpWorkCCB; /* slc nova 047 */
  862. WORD lastItem; /* slc nova 117 */
  863. WORD lastPort; /* slc nova 117 */
  864. BOOL prevcarrier;
  865. updateTimer();
  866. switch(message)
  867. {
  868. case WM_INITDIALOG:
  869. initDlgPos(hDlg);
  870. if((((PSAVEPARAMS) taskState.string)->hData = GlobalAlloc(GMEM_MOVEABLE, (DWORD) sizeof(recTrmParams))) == NULL)
  871. break;
  872. ((PSAVEPARAMS) taskState.string)->lpData = (recTrmParams FAR *) GlobalLock(((PSAVEPARAMS) taskState.string)->hData);
  873. *(((PSAVEPARAMS) taskState.string)->lpData) = trmParams;
  874. trmParams.newDevRef = -1; /* mbbx 2.00: network... */
  875. enableCommItems(hDlg, trmParams.comDevRef);
  876. initComDevSelect(hDlg, ITMCONNECTOR, FALSE); /* mbbx 2.01.09 ... */
  877. /* rjs bug2 - add tcp/ip connector for microsoft */
  878. EnableWindow(GetDlgItem(hDlg, ITMSETUP), FALSE); /* slc nova 031, seh nova 005 */
  879. ShowWindow(GetDlgItem(hDlg, ITMSETUP), SW_HIDE); /* seh nova 005 */
  880. addConnectorList(hDlg, ITMCONNECTOR); /* slc nova 012 bjw gold 027 */
  881. ghWorkConnector = NULL; /* slc nova 031 */
  882. if(trmParams.comDevRef == ITMDLLCONNECT)
  883. {
  884. SendDlgItemMessage(hDlg, ITMCONNECTOR, LB_SETCURSEL, trmParams.comExtRef - 1, 0L);
  885. ghWorkConnector = ghCCB; /* slc nova 031 */
  886. }
  887. /* end of rjs bug2 */
  888. return(TRUE);
  889. case WM_COMMAND:
  890. switch(GET_WM_COMMAND_ID(wParam, lParam))
  891. {
  892. case IDOK:
  893. if(!trmParams.fResetDevice)
  894. {
  895. if(trmParams.newDevRef != (BYTE) -1) /* mbbx 2.00.04: force reload... */
  896. trmParams.fResetDevice = TRUE;
  897. }
  898. if(trmParams.newDevRef == ITMDLLCONNECT) /* slc nova 031 */
  899. {
  900. if((ghWorkConnector != NULL) &&
  901. (ghWorkConnector != ghCCB))
  902. {
  903. GlobalFree(ghCCB);
  904. ghCCB = ghWorkConnector;
  905. ghWorkConnector = NULL;
  906. }
  907. }
  908. resetSerial(&trmParams, (trmParams.newDevRef != (BYTE) -1), FALSE, 0); /* slc swat */
  909. if(sPort == (HANDLE)-1)
  910. break; //return(TRUE);
  911. if((trmParams.newDevRef != (BYTE) -1) && (trmParams.comDevRef != trmParams.newDevRef))
  912. return(TRUE);
  913. termData.flags |= TF_CHANGED;
  914. break;
  915. case IDCANCEL:
  916. trmParams = *(((PSAVEPARAMS) taskState.string)->lpData);
  917. break;
  918. /* rjs bug2 - begin */
  919. case ITMSETUP:
  920. if(ghWorkConnector != NULL)
  921. DLL_SetupConnector(ghWorkConnector, TRUE);
  922. SetFocus(GetDlgItem(hDlg, IDOK));
  923. return(TRUE);
  924. /* rjs bug2 - end */
  925. case ITMBD110:
  926. case ITMBD300:
  927. case ITMBD600: /* mbbx 2.00: support 600 baud... */
  928. case ITMBD120:
  929. case ITMBD240:
  930. case ITMBD480:
  931. case ITMBD960:
  932. case ITMBD144:
  933. case ITMBD192:
  934. case ITMBD384:
  935. case ITMBD576:
  936. case ITMBD1152:
  937. switch(GET_WM_COMMAND_ID(wParam, lParam))
  938. {
  939. case ITMBD110:
  940. trmParams.speed = 110;
  941. break;
  942. case ITMBD300:
  943. trmParams.speed = 300;
  944. break;
  945. case ITMBD600:
  946. trmParams.speed = 600;
  947. break;
  948. case ITMBD120:
  949. trmParams.speed = 1200;
  950. break;
  951. case ITMBD240:
  952. trmParams.speed = 2400;
  953. break;
  954. case ITMBD480:
  955. trmParams.speed = 4800;
  956. break;
  957. case ITMBD960:
  958. trmParams.speed = 9600;
  959. break;
  960. case ITMBD144:
  961. trmParams.speed = 14400;
  962. break;
  963. case ITMBD192:
  964. trmParams.speed = 19200;
  965. break;
  966. case ITMBD384:
  967. trmParams.speed = 38400;
  968. break;
  969. case ITMBD576:
  970. trmParams.speed = 57600;
  971. break;
  972. case ITMBD1152:
  973. trmParams.speed = 57601;
  974. break;
  975. //case ITMBD1280:
  976. // trmParams.speed = 57602;
  977. // break;
  978. }
  979. CheckRadioButton(hDlg, ITMBD110, ITMBD1152, GET_WM_COMMAND_ID(wParam, lParam));
  980. return(TRUE);
  981. case ITMDATA8: /* mbbx 2.00 ... */
  982. if(trmParams.parity != ITMNOPARITY)
  983. CheckRadioButton(hDlg, ITMNOPARITY, ITMSPACEPARITY, trmParams.parity = ITMNOPARITY);
  984. /* then fall thru... */
  985. case ITMDATA5:
  986. case ITMDATA6:
  987. case ITMDATA7:
  988. CheckRadioButton(hDlg, ITMDATA5, ITMDATA8, trmParams.dataBits = GET_WM_COMMAND_ID(wParam, lParam)); /* jtf 3.24 */
  989. return(TRUE);
  990. case ITMSTOP5: /* jtf 3.24 */
  991. CheckRadioButton(hDlg, ITMSTOP1, ITMSTOP2, trmParams.stopBits = GET_WM_COMMAND_ID(wParam, lParam));
  992. CheckRadioButton(hDlg, ITMDATA5, ITMDATA8, trmParams.dataBits = ITMDATA5); /* jtf 3.24 */
  993. EnableWindow(GetDlgItem(hDlg, ITMDATA5), TRUE);
  994. EnableWindow(GetDlgItem(hDlg, ITMDATA6), FALSE);
  995. EnableWindow(GetDlgItem(hDlg, ITMDATA7), FALSE);
  996. EnableWindow(GetDlgItem(hDlg, ITMDATA8), FALSE);
  997. return(TRUE);
  998. case ITMSTOP1:
  999. case ITMSTOP2:
  1000. EnableWindow(GetDlgItem(hDlg, ITMDATA5), FALSE);
  1001. EnableWindow(GetDlgItem(hDlg, ITMDATA6), TRUE);
  1002. EnableWindow(GetDlgItem(hDlg, ITMDATA7), TRUE);
  1003. EnableWindow(GetDlgItem(hDlg, ITMDATA8), TRUE);
  1004. if (trmParams.dataBits = ITMDATA5)
  1005. CheckRadioButton(hDlg, ITMDATA5, ITMDATA8, trmParams.dataBits = ITMDATA8); /* jtf 3.24 */
  1006. CheckRadioButton(hDlg, ITMSTOP1, ITMSTOP2, trmParams.stopBits = GET_WM_COMMAND_ID(wParam, lParam));
  1007. return(TRUE);
  1008. case ITMODDPARITY: /* mbbx 2.00 ... */
  1009. case ITMEVENPARITY:
  1010. case ITMMARKPARITY:
  1011. case ITMSPACEPARITY:
  1012. if(trmParams.dataBits == ITMDATA8)
  1013. CheckRadioButton(hDlg, ITMDATA5, ITMDATA8, trmParams.dataBits = ITMDATA7); /* jtf 3.24 */
  1014. /* then fall thru... */
  1015. case ITMNOPARITY:
  1016. CheckRadioButton(hDlg, ITMNOPARITY, ITMSPACEPARITY, trmParams.parity = GET_WM_COMMAND_ID(wParam, lParam));
  1017. return(TRUE);
  1018. case ITMXONFLOW:
  1019. case ITMHARDFLOW:
  1020. case ITMNOFLOW:
  1021. CheckRadioButton(hDlg, ITMXONFLOW, ITMNOFLOW, trmParams.flowControl = GET_WM_COMMAND_ID(wParam, lParam));
  1022. return(TRUE);
  1023. case ITMCONNECTOR:
  1024. switch(GET_WM_COMMAND_CMD(wParam, lParam)) /* mbbx 2.00: network... */
  1025. {
  1026. case LBN_SELCHANGE: /* mbbx 2.01.09 ... */
  1027. lastItem = trmParams.newDevRef; /* slc nova 117 */
  1028. lastPort = trmParams.comPortRef; /* slc nova 117 */
  1029. trmParams.comPortRef = getComDevSelect(hDlg, ITMCONNECTOR, &trmParams.newDevRef);
  1030. if(trmParams.comPortRef > ITMCOM4)
  1031. {
  1032. wCurSel = (WORD) SendDlgItemMessage(hDlg, ITMCONNECTOR, LB_GETCURSEL, 0, 0L); /* seh nova 005 */
  1033. SendDlgItemMessage(hDlg, ITMCONNECTOR, LB_GETTEXT, wCurSel,
  1034. (LPARAM) gszWork); /* bjw gold 027, seh nova 005 */
  1035. if((ghWorkConnector == NULL) || /* slc nova 031 */
  1036. (ghWorkConnector == ghCCB))
  1037. {
  1038. ghWorkConnector = GlobalAlloc(GHND | GMEM_ZEROINIT, (DWORD)sizeof(CONNECTOR_CONTROL_BLOCK));
  1039. }
  1040. EnableWindow(GetDlgItem(hDlg, ITMSETUP), FALSE); /* slc nova 031 */
  1041. ShowWindow(GetDlgItem(hDlg, ITMSETUP), SW_HIDE);
  1042. if(loadConnector(hDlg, ghWorkConnector, gszWork, FALSE)) /* slc nova 031 */
  1043. {
  1044. trmParams.comExtRef = (BYTE)(wCurSel + 1);
  1045. trmParams.newDevRef = ITMDLLCONNECT;
  1046. lstrcpy(trmParams.szConnectorName, gszWork);
  1047. if(DLL_HasSetupBox(ghWorkConnector)) /* slc nova 031 */
  1048. {
  1049. EnableWindow(GetDlgItem(hDlg, ITMSETUP), TRUE);
  1050. ShowWindow(GetDlgItem(hDlg, ITMSETUP), SW_SHOW);
  1051. }
  1052. }
  1053. }
  1054. enableCommItems(hDlg, trmParams.newDevRef);
  1055. trmParams.fResetDevice = FALSE;
  1056. break;
  1057. }
  1058. return(TRUE);
  1059. case ITMPARITY:
  1060. CheckDlgButton(hDlg, ITMPARITY, trmParams.fParity = !trmParams.fParity);
  1061. return(TRUE);
  1062. case ITMCARRIER:
  1063. prevcarrier = trmParams.fCarrier;
  1064. CheckDlgButton(hDlg, ITMCARRIER, trmParams.fCarrier = !trmParams.fCarrier);
  1065. //-sdj if fcarrier is disabled by the user, reset the mdmOnLine flag
  1066. //-sdj so that, the Dial menu item gets enabled. bug# 735
  1067. if (prevcarrier && !(trmParams.fCarrier) ) mdmOnLine = FALSE;
  1068. return(TRUE);
  1069. }
  1070. break;
  1071. default:
  1072. return(FALSE);
  1073. }
  1074. if(((PSAVEPARAMS) taskState.string)->hData != NULL)
  1075. {
  1076. GlobalUnlock(((PSAVEPARAMS) taskState.string)->hData);
  1077. GlobalFree(((PSAVEPARAMS) taskState.string)->hData);
  1078. }
  1079. EndDialog(hDlg, TRUE);
  1080. return(TRUE);
  1081. }
  1082. /*---------------------------------------------------------------------------*/
  1083. /* dbModem() - [mbb] */
  1084. /*---------------------------------------------------------------------------*/
  1085. VOID NEAR loadModemData(HWND hDlg, WORD wMdmType)
  1086. {
  1087. WORD nResID;
  1088. INT ndx;
  1089. BYTE work[STR255];
  1090. switch(wMdmType)
  1091. {
  1092. case ITMHAYES:
  1093. nResID = STR_MDM_HAYES;
  1094. break;
  1095. case ITMMULTITECH:
  1096. nResID = STR_MDM_MNP;
  1097. break;
  1098. case ITMTRAILBLAZER:
  1099. nResID = STR_MDM_TELEBIT;
  1100. break;
  1101. default: /* ITMNOMODEM */
  1102. nResID = STR_MDM_NONE;
  1103. break;
  1104. }
  1105. for(ndx = 0; ndx < 10; ndx ++) /* rjs swat - changed to 10 from 11 */
  1106. {
  1107. LoadString(hInst, nResID + ndx, work, STR255-1);
  1108. SetDlgItemText(hDlg, ITMDIAL + ndx, work);
  1109. }
  1110. ndx++;
  1111. LoadString(hInst, nResID + ndx, work, STR255-1);
  1112. SetDlgItemText(hDlg, ITMDIAL + ndx, work);
  1113. }
  1114. INT_PTR APIENTRY dbModem(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
  1115. {
  1116. updateTimer();
  1117. switch(message)
  1118. {
  1119. case WM_INITDIALOG:
  1120. initDlgPos(hDlg);
  1121. if((((PSAVEPARAMS) taskState.string)->hData = GlobalAlloc(GMEM_MOVEABLE, (DWORD) sizeof(recTrmParams))) == NULL)
  1122. break;
  1123. ((PSAVEPARAMS) taskState.string)->lpData = (recTrmParams FAR *) GlobalLock(((PSAVEPARAMS) taskState.string)->hData);
  1124. *(((PSAVEPARAMS) taskState.string)->lpData) = trmParams;
  1125. SetDlgItemText(hDlg, ITMDIAL, trmParams.dialPrefix);
  1126. SetDlgItemText(hDlg, ITMDIAL+1, trmParams.dialSuffix);
  1127. SetDlgItemText(hDlg, ITMHANGUP, trmParams.hangPrefix);
  1128. SetDlgItemText(hDlg, ITMHANGUP+1, trmParams.hangSuffix);
  1129. SetDlgItemText(hDlg, ITMBINTX, trmParams.binTXPrefix);
  1130. SetDlgItemText(hDlg, ITMBINTX+1, trmParams.binTXSuffix);
  1131. SetDlgItemText(hDlg, ITMBINRX, trmParams.binRXPrefix);
  1132. SetDlgItemText(hDlg, ITMBINRX+1, trmParams.binRXSuffix);
  1133. SetDlgItemText(hDlg, ITMFASTQRY, trmParams.fastInq);
  1134. SetDlgItemText(hDlg, ITMFASTQRY+1, trmParams.fastRsp);
  1135. SetDlgItemText(hDlg, ITMANSWER, trmParams.answer);
  1136. SetDlgItemText(hDlg, ITMORIGIN, trmParams.originate);
  1137. CheckRadioButton(hDlg, ITMMODEMFIRST, ITMMODEMLAST, trmParams.xMdmType);
  1138. ((PSAVEPARAMS) taskState.string)->saveLevel = -1;
  1139. return(TRUE);
  1140. case WM_COMMAND:
  1141. switch(GET_WM_COMMAND_ID(wParam, lParam))
  1142. {
  1143. case IDOK:
  1144. GetDlgItemText(hDlg, ITMDIAL, trmParams.dialPrefix, DCS_MODEMCMDSZ-1);
  1145. GetDlgItemText(hDlg, ITMDIAL+1, trmParams.dialSuffix, DCS_MODEMCMDSZ-1);
  1146. GetDlgItemText(hDlg, ITMHANGUP, trmParams.hangPrefix, DCS_MODEMCMDSZ-1);
  1147. GetDlgItemText(hDlg, ITMHANGUP+1, trmParams.hangSuffix, DCS_MODEMCMDSZ-1);
  1148. GetDlgItemText(hDlg, ITMBINTX, trmParams.binTXPrefix, DCS_MODEMCMDSZ-1);
  1149. GetDlgItemText(hDlg, ITMBINTX+1, trmParams.binTXSuffix, DCS_MODEMCMDSZ-1);
  1150. GetDlgItemText(hDlg, ITMBINRX, trmParams.binRXPrefix, DCS_MODEMCMDSZ-1);
  1151. GetDlgItemText(hDlg, ITMBINRX+1, trmParams.binRXSuffix, DCS_MODEMCMDSZ-1);
  1152. GetDlgItemText(hDlg, ITMFASTQRY, trmParams.fastInq, DCS_MODEMCMDSZ-1);
  1153. GetDlgItemText(hDlg, ITMFASTQRY+1, trmParams.fastRsp, DCS_MODEMCMDSZ-1);
  1154. GetDlgItemText(hDlg, ITMANSWER, trmParams.answer, DCS_MODEMCMDSZ-1);
  1155. GetDlgItemText(hDlg, ITMORIGIN, trmParams.originate, DCS_MODEMCMDSZ-1);
  1156. trmParams.xMdmType = whichGrpButton(hDlg, ITMMODEMFIRST, ITMMODEMLAST);
  1157. termData.flags |= TF_CHANGED;
  1158. break;
  1159. case IDCANCEL:
  1160. trmParams = *(((PSAVEPARAMS) taskState.string)->lpData);
  1161. break;
  1162. case ITMHAYES:
  1163. case ITMMULTITECH:
  1164. case ITMTRAILBLAZER:
  1165. case ITMNOMODEM:
  1166. CheckRadioButton(hDlg, ITMMODEMFIRST, ITMMODEMLAST, GET_WM_COMMAND_ID(wParam, lParam));
  1167. loadModemData(hDlg, GET_WM_COMMAND_ID(wParam, lParam));
  1168. return(TRUE);
  1169. default:
  1170. return(TRUE);
  1171. }
  1172. break;
  1173. default:
  1174. return(FALSE);
  1175. }
  1176. EndDialog(hDlg, TRUE);
  1177. return(TRUE);
  1178. }
  1179. /*---------------------------------------------------------------------------*/
  1180. /* chkGrpButton() - Toggle on radio buttons. */
  1181. /*---------------------------------------------------------------------------*/
  1182. VOID chkGrpButton(HWND hDlg, INT iFirst, INT iLast, INT item)
  1183. {
  1184. if((item >= iFirst) && (item <= iLast)) /* mbbx 1.04 ... */
  1185. CheckRadioButton(hDlg, iFirst, iLast, item);
  1186. }
  1187. /*---------------------------------------------------------------------------*/
  1188. /* whichGrpButton() - Return which button in a group was pressed. */
  1189. /*---------------------------------------------------------------------------*/
  1190. BYTE whichGrpButton(HWND hDlg, INT iFirst, INT iLast)
  1191. {
  1192. INT which;
  1193. for(which = iFirst; which <= iLast; which += 1)
  1194. if(IsDlgButtonChecked(hDlg, which))
  1195. return((BYTE) which);
  1196. return((BYTE) iFirst);
  1197. }