| 1 | #include <stdlib.h>
|
|---|
| 2 | #include <stdio.h>
|
|---|
| 3 | #include <string.h>
|
|---|
| 4 | #include <time.h>
|
|---|
| 5 | #include <sys/stat.h>
|
|---|
| 6 |
|
|---|
| 7 | #include "ecups.h"
|
|---|
| 8 | #include "ecdebug.h"
|
|---|
| 9 | #include "echelp.h"
|
|---|
| 10 |
|
|---|
| 11 | #include <os2.h>
|
|---|
| 12 | #include "helpers\standards.h"
|
|---|
| 13 | #include "helpers\linklist.h" // for mnemonic helpers
|
|---|
| 14 | #include "helpers\dialog.h"
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | NOTEBOOKBUTTON NoteBookButtons[1] = {{"Undo",ID_NBB_UNDO,NULL,0}};
|
|---|
| 19 |
|
|---|
| 20 | static const CONTROLDEF
|
|---|
| 21 | GroupDef = CONTROLDEF_GROUP("Group",
|
|---|
| 22 | 18000, // ID
|
|---|
| 23 | SZL_AUTOSIZE,
|
|---|
| 24 | SZL_AUTOSIZE),
|
|---|
| 25 | CnrDef = CONTROLDEF_CONTAINER(18001, // ID,
|
|---|
| 26 | 50,
|
|---|
| 27 | 50),
|
|---|
| 28 | GenGCUPSGroup = CONTROLDEF_GROUP("CUPS Information",
|
|---|
| 29 | -1, // ID
|
|---|
| 30 | SZL_AUTOSIZE,
|
|---|
| 31 | SZL_AUTOSIZE),
|
|---|
| 32 | GenECUPSEntry = CONTROLDEF_ENTRYFIELD(NULL,
|
|---|
| 33 | IDH_PSE_CUPSLOCATION, // ID
|
|---|
| 34 | 100,
|
|---|
| 35 | SZL_AUTOSIZE),
|
|---|
| 36 | GenGPrinter = CONTROLDEF_GROUP("CUPS Printer",
|
|---|
| 37 | -1, // ID
|
|---|
| 38 | SZL_AUTOSIZE,
|
|---|
| 39 | SZL_AUTOSIZE),
|
|---|
| 40 | GenTHost = CONTROLDEF_TEXT("Host",
|
|---|
| 41 | -1, // ID
|
|---|
| 42 | SZL_AUTOSIZE,
|
|---|
| 43 | SZL_AUTOSIZE),
|
|---|
| 44 | GenTPrinter = CONTROLDEF_TEXT("Printer",
|
|---|
| 45 | -1, // ID
|
|---|
| 46 | SZL_AUTOSIZE,
|
|---|
| 47 | SZL_AUTOSIZE),
|
|---|
| 48 | GenEHost = CONTROLDEF_ENTRYFIELD(NULL,
|
|---|
| 49 | IDH_PSE_HOST, // ID
|
|---|
| 50 | 100,
|
|---|
| 51 | SZL_AUTOSIZE),
|
|---|
| 52 | GenEPrinter = CONTROLDEF_ENTRYFIELD(NULL,
|
|---|
| 53 | IDH_PSE_PRINTER, // ID
|
|---|
| 54 | 100,
|
|---|
| 55 | SZL_AUTOSIZE),
|
|---|
| 56 | DLGMainNoteBook= {
|
|---|
| 57 | WC_NOTEBOOK,
|
|---|
| 58 | NULL,
|
|---|
| 59 | WS_VISIBLE|BKS_TABBEDDIALOG|BKS_BUTTONAREA,
|
|---|
| 60 | IDD_PORTPDF,
|
|---|
| 61 | "9.Warpsans",
|
|---|
| 62 | {100,100},
|
|---|
| 63 | COMMON_SPACING};
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | DLGHITEM firstPage[] =
|
|---|
| 69 | {
|
|---|
| 70 | START_TABLE, // root table, required
|
|---|
| 71 | START_ROW(0), // row 1 in the root table, required
|
|---|
| 72 | // create group on top
|
|---|
| 73 | START_GROUP_TABLE_EXT(&GenGPrinter, TABLE_INHERIT_SIZE),
|
|---|
| 74 | START_ROW(0),
|
|---|
| 75 | CONTROL_DEF(&GenTHost),
|
|---|
| 76 | START_ROW(0),
|
|---|
| 77 | CONTROL_DEF(&GenEHost),
|
|---|
| 78 | START_ROW(0),
|
|---|
| 79 | CONTROL_DEF(&GenTPrinter),
|
|---|
| 80 | START_ROW(0),
|
|---|
| 81 | CONTROL_DEF(&GenEPrinter),
|
|---|
| 82 | END_TABLE,
|
|---|
| 83 |
|
|---|
| 84 | END_TABLE
|
|---|
| 85 | };
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 | DLGHITEM NoteBook[] =
|
|---|
| 89 | {
|
|---|
| 90 | START_TABLE, // root table, required
|
|---|
| 91 | START_ROW(ROW_VALIGN_CENTER), // row 1 in the root table, required
|
|---|
| 92 | CONTROL_DEF(&DLGMainNoteBook),
|
|---|
| 93 | END_TABLE
|
|---|
| 94 | };
|
|---|
| 95 |
|
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 | extern ECUPSSESSIONDATA eCUPSSession;
|
|---|
| 99 |
|
|---|
| 100 | /****************************************************************************
|
|---|
| 101 | *
|
|---|
| 102 | * FUNCTION NAME = OpenSerialPortDlg
|
|---|
| 103 | *
|
|---|
| 104 | * DESCRIPTION = Display serial port settings dialog
|
|---|
| 105 | *
|
|---|
| 106 | * INPUT = hab - anchor block handle
|
|---|
| 107 | * hModule - this port driver's module handle
|
|---|
| 108 | * pszPortName - name of port to get description for
|
|---|
| 109 | * pszAppName - INI Appname for port( "PM_Portname").
|
|---|
| 110 | *
|
|---|
| 111 | * OUTPUT = TRUE - if port settings changed
|
|---|
| 112 | * FALSE - if port settings not changed
|
|---|
| 113 | *
|
|---|
| 114 | * RETURN-NORMAL =
|
|---|
| 115 | * RETURN-ERROR =
|
|---|
| 116 | *
|
|---|
| 117 | ****************************************************************************/
|
|---|
| 118 |
|
|---|
| 119 | ULONG OpenSerialPortDlg ( HAB hab,
|
|---|
| 120 | HMODULE hModule,
|
|---|
| 121 | PSZ pszPortName,
|
|---|
| 122 | PSZ pszAppName )
|
|---|
| 123 | {
|
|---|
| 124 |
|
|---|
| 125 | WinDlgBox (HWND_DESKTOP,
|
|---|
| 126 | HWND_DESKTOP,
|
|---|
| 127 | (PFNWP)CommDlg,
|
|---|
| 128 | (HMODULE)hModule,
|
|---|
| 129 | IDD_PDFNOTEBOOK,
|
|---|
| 130 | NULL);
|
|---|
| 131 |
|
|---|
| 132 | return NO_ERROR;
|
|---|
| 133 | }
|
|---|
| 134 |
|
|---|
| 135 | /****************************************************************************
|
|---|
| 136 | *
|
|---|
| 137 | * FUNCTION NAME = CommDlg
|
|---|
| 138 | *
|
|---|
| 139 | * DESCRIPTION = Port settings dialog procedure
|
|---|
| 140 | *
|
|---|
| 141 | * INPUT = hDlg: HWND
|
|---|
| 142 | * msg: message
|
|---|
| 143 | * mp1: message parameter
|
|---|
| 144 | * mp2: " "
|
|---|
| 145 | *
|
|---|
| 146 | * OUTPUT =
|
|---|
| 147 | *
|
|---|
| 148 | * RETURN-NORMAL =
|
|---|
| 149 | * RETURN-ERROR =
|
|---|
| 150 | *
|
|---|
| 151 | ****************************************************************************/
|
|---|
| 152 |
|
|---|
| 153 | MRESULT EXPENTRY CommDlg( HWND hDlg, USHORT msg, MPARAM mp1, MPARAM mp2 )
|
|---|
| 154 | {
|
|---|
| 155 | HWND hNotebook;
|
|---|
| 156 | ULONG ulPageId;
|
|---|
| 157 | CHAR Version[256];
|
|---|
| 158 | CHAR Font[32];
|
|---|
| 159 | SIZEL szFrameSize;
|
|---|
| 160 |
|
|---|
| 161 | /*
|
|---|
| 162 | ** Procedure for COM port setup dialog
|
|---|
| 163 | **
|
|---|
| 164 | ** This allows the user to set default values for COM port printing.
|
|---|
| 165 | ** It does not set defaults for non-printing Apps or Apps that
|
|---|
| 166 | ** do not go through the print spooler.
|
|---|
| 167 | ** It is up to each of these other Apps to set the COM port up
|
|---|
| 168 | ** for their environment.
|
|---|
| 169 | */
|
|---|
| 170 |
|
|---|
| 171 | switch (msg) {
|
|---|
| 172 |
|
|---|
| 173 | case WM_INITDLG:
|
|---|
| 174 |
|
|---|
| 175 | _PmpfF(("in wminitdlgcommdlg"));
|
|---|
| 176 | _PmpfF(("Module handle %d",eCUPSSession.hModule));
|
|---|
| 177 | sprintf(Version,"eCUPS %s, created on: %s, %s",ECUPSVERSION,__TIME__,__DATE__);
|
|---|
| 178 | WinRestoreWindowPos("ECUPS","WINSIZE",hDlg);
|
|---|
| 179 | PrfQueryProfileString (HINI_USERPROFILE,
|
|---|
| 180 | "PM_SystemFonts",
|
|---|
| 181 | "WindowText",
|
|---|
| 182 | "9.WarpSans",
|
|---|
| 183 | Font,
|
|---|
| 184 | 32);
|
|---|
| 185 |
|
|---|
| 186 | _PmpfF(("font: %s",Font));
|
|---|
| 187 |
|
|---|
| 188 | WinSetWindowText(hDlg,Version);
|
|---|
| 189 |
|
|---|
| 190 | ulPageId = (LONG)WinSendDlgItemMsg(hDlg, IDN_NOTEBOOK,
|
|---|
| 191 | BKM_INSERTPAGE, NULL,
|
|---|
| 192 | MPFROM2SHORT((BKA_STATUSTEXTON | BKA_AUTOPAGESIZE | BKA_MAJOR),
|
|---|
| 193 | BKA_LAST));
|
|---|
| 194 |
|
|---|
| 195 | WinSendDlgItemMsg(hDlg, IDN_NOTEBOOK,
|
|---|
| 196 | BKM_SETNOTEBOOKBUTTONS, MPFROMLONG(1),
|
|---|
| 197 | MPFROMP(&NoteBookButtons));
|
|---|
| 198 |
|
|---|
| 199 | WinSendDlgItemMsg(hDlg, IDN_NOTEBOOK,
|
|---|
| 200 | BKM_SETTABTEXT, MPFROMLONG(ulPageId),
|
|---|
| 201 | MPFROMP("General"));
|
|---|
| 202 |
|
|---|
| 203 | dlghCreateDlg(&hNotebook,hDlg,
|
|---|
| 204 | NULL,
|
|---|
| 205 | (PFNWP)NoteBookPageWndProc,
|
|---|
| 206 | "dummy",
|
|---|
| 207 | &firstPage, // DLGHITEM array
|
|---|
| 208 | ARRAYITEMCOUNT(firstPage),
|
|---|
| 209 | NULL, // mp2 for WM_INITDLG
|
|---|
| 210 | Font); // default font
|
|---|
| 211 |
|
|---|
| 212 |
|
|---|
| 213 |
|
|---|
| 214 |
|
|---|
| 215 | WinSetPresParam(hNotebook,
|
|---|
| 216 | PP_FONTNAMESIZE,
|
|---|
| 217 | strlen(Font),
|
|---|
| 218 | Font);
|
|---|
| 219 |
|
|---|
| 220 | if(hNotebook)
|
|---|
| 221 | WinSendDlgItemMsg(hDlg, IDN_NOTEBOOK,
|
|---|
| 222 | BKM_SETPAGEWINDOWHWND, MPFROMLONG(ulPageId),
|
|---|
| 223 | MPFROMHWND(hNotebook));
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 | return(FALSE);
|
|---|
| 229 | break;
|
|---|
| 230 |
|
|---|
| 231 | case WM_COMMAND:
|
|---|
| 232 |
|
|---|
| 233 |
|
|---|
| 234 | return(WinDefDlgProc(hDlg, msg, mp1, mp2) );
|
|---|
| 235 |
|
|---|
| 236 | //case WM_SIZE:
|
|---|
| 237 | case WM_ADJUSTWINDOWPOS:
|
|---|
| 238 | {
|
|---|
| 239 | /*PSWP swp;
|
|---|
| 240 | swp =*(SWP*)mp1;*/
|
|---|
| 241 | PSWP pswp = (PSWP)mp1;
|
|---|
| 242 | LONG cyTitleBar;
|
|---|
| 243 | POINTL ptlBorder;
|
|---|
| 244 | WinSendMsg(hDlg, WM_QUERYBORDERSIZE, &ptlBorder, NULL);
|
|---|
| 245 |
|
|---|
| 246 | cyTitleBar = (SHORT)WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
|
|---|
| 247 | //_PmpfF(("WM_ADJUSTWINDOWPOS: %d, %d ",swp.cx,swp.cy));
|
|---|
| 248 | if (pswp->fl & (SWP_SIZE | SWP_RESTORE | SWP_MAXIMIZE))
|
|---|
| 249 | {
|
|---|
| 250 | SWP swp;
|
|---|
| 251 |
|
|---|
| 252 | if (pswp->fl & SWP_SIZE)
|
|---|
| 253 | memcpy(&swp, pswp, sizeof(swp));
|
|---|
| 254 | else if (pswp->fl & SWP_MAXIMIZE)
|
|---|
| 255 | WinGetMaxPosition(hDlg, &swp);
|
|---|
| 256 | else
|
|---|
| 257 | {
|
|---|
| 258 | swp.cx = WinQueryWindowUShort(hDlg, QWS_CXRESTORE);
|
|---|
| 259 | swp.cy = WinQueryWindowUShort(hDlg, QWS_CYRESTORE);
|
|---|
| 260 | }
|
|---|
| 261 |
|
|---|
| 262 | WinSetWindowPos(WinWindowFromID(hDlg,IDN_NOTEBOOK), HWND_TOP,
|
|---|
| 263 | ptlBorder.x,
|
|---|
| 264 | ptlBorder.y,
|
|---|
| 265 | swp.cx - ptlBorder.x*2,
|
|---|
| 266 | swp.cy - ptlBorder.y*2 - cyTitleBar,
|
|---|
| 267 | SWP_MOVE | SWP_SIZE);
|
|---|
| 268 | }
|
|---|
| 269 | /* WinSetWindowPos(WinWindowFromID(hDlg,IDN_NOTEBOOK),
|
|---|
| 270 | NULL,
|
|---|
| 271 | swp.x,
|
|---|
| 272 | swp.y,
|
|---|
| 273 | swp.cx,
|
|---|
| 274 | swp.cy,
|
|---|
| 275 | SWP_SIZE);*/
|
|---|
| 276 | }
|
|---|
| 277 | break;
|
|---|
| 278 |
|
|---|
| 279 | case WM_DESTROY:
|
|---|
| 280 |
|
|---|
| 281 | /*
|
|---|
| 282 | ** if we have a help instance - destroy it.
|
|---|
| 283 | */
|
|---|
| 284 | GetDialogValues(hDlg);
|
|---|
| 285 | WinStoreWindowPos("ECUPS","WINSIZE",hDlg);
|
|---|
| 286 |
|
|---|
| 287 | break;
|
|---|
| 288 |
|
|---|
| 289 | default:
|
|---|
| 290 | return(WinDefDlgProc(hDlg, msg, mp1, mp2) );
|
|---|
| 291 | // break; /* WPOS */
|
|---|
| 292 | }
|
|---|
| 293 | //return(WinDefDlgProc(hDlg, msg, mp1, mp2) );
|
|---|
| 294 | return FALSE;
|
|---|
| 295 | }
|
|---|
| 296 |
|
|---|
| 297 |
|
|---|
| 298 | /****************************************************************************
|
|---|
| 299 | *
|
|---|
| 300 | * FUNCTION NAME = GetDialogValues
|
|---|
| 301 | *
|
|---|
| 302 | * DESCRIPTION = Get the user input fields from the port driver settings
|
|---|
| 303 | * dialog and return their values.
|
|---|
| 304 | *
|
|---|
| 305 | * INPUT = hDlg - handle of dialog window
|
|---|
| 306 | * pszSaveCommSettings - receives settings from dialog
|
|---|
| 307 | *
|
|---|
| 308 | * OUTPUT = *pszSaveCommSettings -> buffer is updated from dialog
|
|---|
| 309 | *
|
|---|
| 310 | * RETURN-NORMAL = VOID
|
|---|
| 311 | * RETURN-ERROR =
|
|---|
| 312 | *
|
|---|
| 313 | ****************************************************************************/
|
|---|
| 314 |
|
|---|
| 315 | VOID GetDialogValues(HWND hDlg)
|
|---|
| 316 | {
|
|---|
| 317 | CHAR szBuf[255];
|
|---|
| 318 | CHAR szSuffix[2] = ";"; /* additional string to add on end */
|
|---|
| 319 | ULONG ulBufSize;
|
|---|
| 320 | ULONG t,s;
|
|---|
| 321 | ULONG err;
|
|---|
| 322 | ULONG ulRadioValue,ulRadioPass;
|
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
|
|---|
| 326 | for(t=0; t < INICount;t++)
|
|---|
| 327 | {
|
|---|
| 328 | switch(INIKeys[t].inpIDs.ulType)
|
|---|
| 329 | {
|
|---|
| 330 | case BS_RADIOBUTTON:
|
|---|
| 331 |
|
|---|
| 332 |
|
|---|
| 333 | // check for multiple ID's
|
|---|
| 334 | if(INIKeys[t].inpIDs.ulIDCount>1)
|
|---|
| 335 | {
|
|---|
| 336 | ulRadioValue = INIKeys[t].inpIDs.ulIDCount;
|
|---|
| 337 | ulRadioPass=0;
|
|---|
| 338 | for(s=INIKeys[t].inpIDs.ulIDCount;s>0;s--)
|
|---|
| 339 | {
|
|---|
| 340 |
|
|---|
| 341 | if(WinWindowFromID(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs[s-1]))
|
|---|
| 342 | {
|
|---|
| 343 | ulRadioPass++;
|
|---|
| 344 | if(WinSendDlgItemMsg(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs[s-1],BM_QUERYCHECK,NULL,NULL))
|
|---|
| 345 | {
|
|---|
| 346 | _PmpfF(("radiobutton: %d,%d",s-1,ulRadioValue ));
|
|---|
| 347 | ulRadioValue=s;
|
|---|
| 348 | }
|
|---|
| 349 | }
|
|---|
| 350 | }
|
|---|
| 351 | if(ulRadioPass)
|
|---|
| 352 | {
|
|---|
| 353 | *(ULONG*)INIKeys[t].pData=ulRadioValue;
|
|---|
| 354 | _PmpfF(("Radio button %s Value: %d",INIKeys[t].pszKeyName,*(ULONG*)INIKeys[t].pData ));
|
|---|
| 355 | _PmpfF(("Radio button %s Value: %d",INIKeys[t].pszKeyName,ulRadioValue ));
|
|---|
| 356 | }
|
|---|
| 357 | }
|
|---|
| 358 | else
|
|---|
| 359 | {
|
|---|
| 360 | // check if ID is owned by current window
|
|---|
| 361 | if(WinWindowFromID(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs))
|
|---|
| 362 | {
|
|---|
| 363 | _PmpfF(("Radio button for %s",INIKeys[t].pszKeyName));
|
|---|
| 364 | }
|
|---|
| 365 | }
|
|---|
| 366 | break;
|
|---|
| 367 | case BS_CHECKBOX:
|
|---|
| 368 |
|
|---|
| 369 | // check for multiple ID's
|
|---|
| 370 | if(INIKeys[t].inpIDs.ulIDCount>1)
|
|---|
| 371 | {
|
|---|
| 372 | for(s=0;s<INIKeys[t].inpIDs.ulIDCount;s++)
|
|---|
| 373 | {
|
|---|
| 374 | // check if ID is owned by current window
|
|---|
| 375 | if(WinWindowFromID(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs[s]))
|
|---|
| 376 | {
|
|---|
| 377 | _PmpfF(("Check box for %s",INIKeys[t].pszKeyName));
|
|---|
| 378 | }
|
|---|
| 379 | }
|
|---|
| 380 | }
|
|---|
| 381 | else
|
|---|
| 382 | {
|
|---|
| 383 | if(WinWindowFromID(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs))
|
|---|
| 384 | {
|
|---|
| 385 |
|
|---|
| 386 | *(ULONG*)INIKeys[t].pData = WinSendDlgItemMsg(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs,BM_QUERYCHECK,NULL,NULL);
|
|---|
| 387 | _PmpfF(("Check box for %s -> %d",INIKeys[t].pszKeyName,*(ULONG*)INIKeys[t].pData));
|
|---|
| 388 | }
|
|---|
| 389 | }
|
|---|
| 390 | break;
|
|---|
| 391 | case (ULONG)WC_ENTRYFIELD:
|
|---|
| 392 |
|
|---|
| 393 |
|
|---|
| 394 | // check if ID is owned by current window
|
|---|
| 395 | if(WinWindowFromID(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs))
|
|---|
| 396 | {
|
|---|
| 397 | ulBufSize = WinQueryDlgItemText(hDlg, (ULONG*)INIKeys[t].inpIDs.ulIDs,sizeof(szBuf),szBuf);
|
|---|
| 398 | szBuf[ulBufSize] = '\0';
|
|---|
| 399 | _PmpfF(("Entryfield %s -> text %s,length %d",INIKeys[t].pszKeyName,szBuf,ulBufSize));
|
|---|
| 400 | *(PSZ*)INIKeys[t].pData = realloc(*(PSZ*)INIKeys[t].pData,ulBufSize+1);
|
|---|
| 401 | memcpy(*(PSZ*)INIKeys[t].pData,szBuf,ulBufSize+1);
|
|---|
| 402 |
|
|---|
| 403 | }
|
|---|
| 404 | break;
|
|---|
| 405 | default:
|
|---|
| 406 | break;
|
|---|
| 407 | }
|
|---|
| 408 | }
|
|---|
| 409 | }
|
|---|
| 410 |
|
|---|
| 411 | /****************************************************************************
|
|---|
| 412 | *
|
|---|
| 413 | * FUNCTION NAME = SetDialogValues
|
|---|
| 414 | *
|
|---|
| 415 | * DESCRIPTION = Set up the serial port dialog box options from the given
|
|---|
| 416 | * initialization settings
|
|---|
| 417 | *
|
|---|
| 418 | * INPUT = hDlg - handle of dialog window
|
|---|
| 419 | * pszCommSetting - values for setting dialog
|
|---|
| 420 | *
|
|---|
| 421 | * OUTPUT = Dialog entry fields set to pszCommSetting values
|
|---|
| 422 | *
|
|---|
| 423 | * RETURN-NORMAL = VOID
|
|---|
| 424 | * RETURN-ERROR =
|
|---|
| 425 | *
|
|---|
| 426 | ****************************************************************************/
|
|---|
| 427 |
|
|---|
| 428 | VOID SetDialogValues(HWND hDlg)
|
|---|
| 429 | {
|
|---|
| 430 | ULONG PathSize[QSV_MAX]= {0};
|
|---|
| 431 |
|
|---|
| 432 | ULONG rc,t,s,r;
|
|---|
| 433 |
|
|---|
| 434 | rc = DosQuerySysInfo(1,1,(PVOID)PathSize,sizeof(ULONG) *QSV_MAX); // query Path Size
|
|---|
| 435 | for(t=0; t < INICount;t++)
|
|---|
| 436 | {
|
|---|
| 437 | switch(INIKeys[t].inpIDs.ulType)
|
|---|
| 438 | {
|
|---|
| 439 | case BS_RADIOBUTTON:
|
|---|
| 440 |
|
|---|
| 441 | _PmpfF(("Radio button for %s",INIKeys[t].pszKeyName));
|
|---|
| 442 | // check for multiple ID's
|
|---|
| 443 | if(INIKeys[t].inpIDs.ulIDCount>1)
|
|---|
| 444 | {
|
|---|
| 445 | if(WinWindowFromID(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs[0]))
|
|---|
| 446 | {
|
|---|
| 447 | // check if stored data is in the range of the radio buttons
|
|---|
| 448 | if((*(ULONG*)INIKeys[t].pData)-1 < INIKeys[t].inpIDs.ulIDCount)
|
|---|
| 449 | {
|
|---|
| 450 | // check the radio button with the ID stored on the offset of data
|
|---|
| 451 | WinSendDlgItemMsg(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs[(*(ULONG*)INIKeys[t].pData)-1],BM_SETCHECK,(MPARAM)1,NULL);
|
|---|
| 452 | _PmpfF(("Radio button for %s , %d",INIKeys[t].pszKeyName,(*(ULONG*)INIKeys[t].pData)-1));
|
|---|
| 453 | }
|
|---|
| 454 | }
|
|---|
| 455 | }
|
|---|
| 456 | else
|
|---|
| 457 | {
|
|---|
| 458 | // check if ID is owned by current window
|
|---|
| 459 | if(WinWindowFromID(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs))
|
|---|
| 460 | {
|
|---|
| 461 | // one radio button makes no sense so we have no support for it
|
|---|
| 462 | _PmpfF(("Radio button for %s",INIKeys[t].pszKeyName));
|
|---|
| 463 | }
|
|---|
| 464 | }
|
|---|
| 465 | break;
|
|---|
| 466 | case BS_CHECKBOX:
|
|---|
| 467 |
|
|---|
| 468 | _PmpfF(("Check box for %s",INIKeys[t].pszKeyName));
|
|---|
| 469 | // check for multiple ID's
|
|---|
| 470 | if(INIKeys[t].inpIDs.ulIDCount>1)
|
|---|
| 471 | {
|
|---|
| 472 | for(s=0;s< INIKeys[t].inpIDs.ulIDCount;s++)
|
|---|
| 473 | {
|
|---|
| 474 | // check if ID is owned by current window
|
|---|
| 475 | if(WinWindowFromID(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs[s]))
|
|---|
| 476 | {
|
|---|
| 477 | // checkboxes are controls by them selves and do not come in ranges
|
|---|
| 478 | _PmpfF(("Check box for %s",INIKeys[t].pszKeyName));
|
|---|
| 479 | }
|
|---|
| 480 | }
|
|---|
| 481 | }
|
|---|
| 482 | else
|
|---|
| 483 | {
|
|---|
| 484 | if(WinWindowFromID(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs))
|
|---|
| 485 | {
|
|---|
| 486 | _PmpfF(("Check box for %s",INIKeys[t].pszKeyName));
|
|---|
| 487 | WinSendDlgItemMsg(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs,BM_SETCHECK,(MPARAM)*(ULONG*)INIKeys[t].pData,NULL);
|
|---|
| 488 | }
|
|---|
| 489 | }
|
|---|
| 490 | break;
|
|---|
| 491 | case (ULONG)WC_ENTRYFIELD:
|
|---|
| 492 |
|
|---|
| 493 | // check if ID is owned by current window
|
|---|
| 494 | if(WinWindowFromID(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs))
|
|---|
| 495 | {
|
|---|
| 496 | if(*(PSZ*)INIKeys[t].pData!=NULL)
|
|---|
| 497 | {
|
|---|
| 498 | _PmpfF(("Entryfield %s -> id: %d",INIKeys[t].pszKeyName,(ULONG*)INIKeys[t].inpIDs.ulIDs));
|
|---|
| 499 | WinSendDlgItemMsg(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs,EM_SETTEXTLIMIT,(MPARAM)PathSize[QSV_MAX_PATH_LENGTH-1],(MPARAM)0);
|
|---|
| 500 | WinSetDlgItemText(hDlg,(ULONG*)INIKeys[t].inpIDs.ulIDs,*(PSZ*)INIKeys[t].pData);
|
|---|
| 501 | _PmpfF(("Entryfield %s -> id: %d done",INIKeys[t].pszKeyName,(ULONG*)INIKeys[t].inpIDs.ulIDs));
|
|---|
| 502 | }
|
|---|
| 503 |
|
|---|
| 504 | }
|
|---|
| 505 | break;
|
|---|
| 506 | default:
|
|---|
| 507 | break;
|
|---|
| 508 | }
|
|---|
| 509 | }
|
|---|
| 510 | }
|
|---|
| 511 |
|
|---|
| 512 | /****************************************************************************
|
|---|
| 513 | *
|
|---|
| 514 | * FUNCTION NAME = NoteBookPageWndProc
|
|---|
| 515 | *
|
|---|
| 516 | * DESCRIPTION = Port settings dialog procedure
|
|---|
| 517 | *
|
|---|
| 518 | * INPUT = hDlg: HWND
|
|---|
| 519 | * msg: message
|
|---|
| 520 | * mp1: message parameter
|
|---|
| 521 | * mp2: " "
|
|---|
| 522 | *
|
|---|
| 523 | * OUTPUT =
|
|---|
| 524 | *
|
|---|
| 525 | * RETURN-NORMAL =
|
|---|
| 526 | * RETURN-ERROR =
|
|---|
| 527 | *
|
|---|
| 528 | ****************************************************************************/
|
|---|
| 529 |
|
|---|
| 530 | MRESULT EXPENTRY NoteBookPageWndProc( HWND hDlg, USHORT msg, MPARAM mp1, MPARAM mp2 )
|
|---|
| 531 | {
|
|---|
| 532 |
|
|---|
| 533 |
|
|---|
| 534 | switch (msg) {
|
|---|
| 535 |
|
|---|
| 536 | case WM_INITDLG:
|
|---|
| 537 | SetDialogValues(hDlg);
|
|---|
| 538 | SetHelpStubHook();
|
|---|
| 539 | return TRUE;
|
|---|
| 540 | break;
|
|---|
| 541 |
|
|---|
| 542 | case WM_COMMAND:
|
|---|
| 543 |
|
|---|
| 544 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 545 | case ID_NBB_UNDO:
|
|---|
| 546 |
|
|---|
| 547 | /*
|
|---|
| 548 | ** Reset port dialog to initial settings
|
|---|
| 549 | */
|
|---|
| 550 | SetDialogValues(hDlg);
|
|---|
| 551 | return TRUE;
|
|---|
| 552 | break;
|
|---|
| 553 | default:
|
|---|
| 554 |
|
|---|
| 555 | return (VOID*)TRUE;
|
|---|
| 556 | }
|
|---|
| 557 | break;
|
|---|
| 558 |
|
|---|
| 559 |
|
|---|
| 560 | case WM_CONTROL:
|
|---|
| 561 |
|
|---|
| 562 | switch (SHORT1FROMMP(mp1)) {
|
|---|
| 563 | default:
|
|---|
| 564 | return(WinDefDlgProc(hDlg, msg, mp1, mp2) );
|
|---|
| 565 | // break; /* WPOS */
|
|---|
| 566 | }
|
|---|
| 567 | break;
|
|---|
| 568 | case WM_HELP:
|
|---|
| 569 | InitializeHelp();
|
|---|
| 570 | if (hwndHelp)
|
|---|
| 571 | {
|
|---|
| 572 | WinSendMsg (hwndHelp, HM_DISPLAY_HELP,
|
|---|
| 573 | (MPARAM)IDH_DLG_EXTENDED, NULL);
|
|---|
| 574 | return (MRESULT)TRUE;
|
|---|
| 575 | }
|
|---|
| 576 | break;
|
|---|
| 577 |
|
|---|
| 578 | case WM_DESTROY:
|
|---|
| 579 | /*
|
|---|
| 580 | ** if we have a help instance - destroy it.
|
|---|
| 581 | */
|
|---|
| 582 | if (HelpAlreadyInitialized)
|
|---|
| 583 | {
|
|---|
| 584 | CALLDestroyHelpInstance(hwndHelp);
|
|---|
| 585 | hwndHelp = (HWND) NULL;
|
|---|
| 586 | HelpAlreadyInitialized = FALSE;
|
|---|
| 587 | HelpStubHookIsSet=FALSE;
|
|---|
| 588 | }
|
|---|
| 589 | ReleaseHelpStubHook();
|
|---|
| 590 | GetDialogValues(hDlg);
|
|---|
| 591 | SavePortSettings();
|
|---|
| 592 | break;
|
|---|
| 593 |
|
|---|
| 594 | default:
|
|---|
| 595 | return(WinDefDlgProc(hDlg, msg, mp1, mp2) );
|
|---|
| 596 | // break; /* WPOS */
|
|---|
| 597 | }
|
|---|
| 598 | //return(WinDefDlgProc(hDlg, msg, mp1, mp2) );
|
|---|
| 599 | return FALSE;
|
|---|
| 600 | }
|
|---|
| 601 |
|
|---|