Changeset 941 for trunk/dll/mainwnd.c
- Timestamp:
- Feb 9, 2008, 10:38:39 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/dll/mainwnd.c (modified) (191 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/mainwnd.c
r940 r941 49 49 17 Jan 08 GKY Add presparam save & restore for individual directory containers 50 50 19 Jan 08 GKY Rework Utilities menu 51 05 Feb 08 SHL Restore no-prescan drives if restoring named state 51 52 52 53 ***********************************************************************/ … … 76 77 #pragma data_seg(DATA1) 77 78 78 // #define FM2_STATE_AT_CLOSE GetPString(IDS_FM2TEMPTEXT)79 #define FM2_STATE_AT_CLOSE "LastClose"80 81 79 static PSZ pszSrcFile = __FILE__; 82 80 … … 87 85 88 86 static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 89 MPARAM mp2)87 MPARAM mp2) 90 88 { 91 89 switch (msg) { … … 113 111 *dv = 0; 114 112 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT), 115 id + 50), sizeof(dv), dv);113 id + 50), sizeof(dv), dv); 116 114 d = toupper(*dv); 117 115 if (isalpha(d) && d > 'B' && 118 !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID |119 DRIVE_SLOW)) &&120 (!hwndBubble ||121 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&122 !WinQueryCapture(HWND_DESKTOP)) {123 124 FSALLOCATE fsa;125 CHAR s[90], szQty[38];126 ULONG ulPctFree;127 ULONGLONG ullFreeQty;128 129 if (!DosQueryFSInfo((d - 'A') + 1,130 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {131 ullFreeQty = (ULONGLONG) fsa.cUnitAvail *132 (fsa.cSectorUnit * fsa.cbSector);133 ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?134 (fsa.cUnitAvail * 100) / fsa.cUnit : 0;135 CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');136 sprintf(s, "%s (%lu%%) free", szQty, ulPctFree);137 }138 if ((!hwndBubble ||139 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&140 !WinQueryCapture(HWND_DESKTOP))141 WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID);116 !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID | 117 DRIVE_SLOW)) && 118 (!hwndBubble || 119 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) && 120 !WinQueryCapture(HWND_DESKTOP)) { 121 122 FSALLOCATE fsa; 123 CHAR s[90], szQty[38]; 124 ULONG ulPctFree; 125 ULONGLONG ullFreeQty; 126 127 if (!DosQueryFSInfo((d - 'A') + 1, 128 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) { 129 ullFreeQty = (ULONGLONG) fsa.cUnitAvail * 130 (fsa.cSectorUnit * fsa.cbSector); 131 ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ? 132 (fsa.cUnitAvail * 100) / fsa.cUnit : 0; 133 CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' '); 134 sprintf(s, "%s (%lu%%) free", szQty, ulPctFree); 135 } 136 if ((!hwndBubble || 137 WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) && 138 !WinQueryCapture(HWND_DESKTOP)) 139 WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID); 142 140 } 143 141 } … … 150 148 151 149 if (DosQuerySysInfo(QSV_BOOT_DRIVE, 152 QSV_BOOT_DRIVE,153 (PVOID) & bd, (ULONG) sizeof(ULONG)))154 bd = 3L;150 QSV_BOOT_DRIVE, 151 (PVOID) & bd, (ULONG) sizeof(ULONG))) 152 bd = 3L; 155 153 *s = (CHAR) bd + '@'; 156 154 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1)); 157 155 if (!mp1) { 158 s[3] = 0;159 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID);156 s[3] = 0; 157 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID); 160 158 } 161 159 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1)); … … 164 162 165 163 case UM_RESTORE: 166 if (mp2) { 167 switch ((ULONG) mp2) { 168 case 1: 169 TileChildren(hwndMain, TRUE); 170 break; 171 case 2: 172 CloseDirCnrChildren(hwndMain); 173 break; 174 } 175 } 176 else { 164 switch ((ULONG)mp2) { 165 case 1: 166 TileChildren(hwndMain, TRUE); 167 break; 168 case 2: 169 CloseDirCnrChildren(hwndMain); 170 break; 171 case 0: 177 172 fNoTileUpdate = TRUE; 178 173 WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), FALSE); … … 181 176 fNoTileUpdate = FALSE; 182 177 if (mp1) 183 free((char *)mp1);178 free((char *)mp1); 184 179 if (fAutoTile) 185 TileChildren(hwndMain, TRUE); 180 TileChildren(hwndMain, TRUE); 181 break; 182 default: 183 Runtime_Error(pszSrcFile, __LINE__, "%u unexpected", mp2); 186 184 } 187 185 return 0; … … 216 214 DosError(FERR_DISABLEHARDERR); 217 215 WinRegisterClass(hab2, 218 (PSZ) WC_OBJECTWINDOW,219 MainObjectWndProc, 0, sizeof(PVOID));216 (PSZ) WC_OBJECTWINDOW, 217 MainObjectWndProc, 0, sizeof(PVOID)); 220 218 MainObjectHwnd = WinCreateWindow(HWND_OBJECT, 221 WC_OBJECTWINDOW,222 (PSZ) NULL,223 0,224 0L,225 0L,226 0L,227 0L,228 0L, HWND_TOP, OBJ_FRAME, NULL, NULL);219 WC_OBJECTWINDOW, 220 (PSZ) NULL, 221 0, 222 0L, 223 0L, 224 0L, 225 0L, 226 0L, HWND_TOP, OBJ_FRAME, NULL, NULL); 229 227 if (!MainObjectHwnd) 230 Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,231 IDS_WINCREATEWINDOW);228 Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__, 229 IDS_WINCREATEWINDOW); 232 230 else { 233 WinSetWindowPtr(MainObjectHwnd, QWL_USER, args);234 while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))235 WinDispatchMsg(hab2, &qmsg2);236 WinDestroyWindow(MainObjectHwnd);231 WinSetWindowPtr(MainObjectHwnd, QWL_USER, args); 232 while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0)) 233 WinDispatchMsg(hab2, &qmsg2); 234 WinDestroyWindow(MainObjectHwnd); 237 235 } 238 236 WinDestroyMsgQueue(hmq2); … … 243 241 244 242 static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1, 245 MPARAM mp2)243 MPARAM mp2) 246 244 { 247 245 switch (msg) { … … 263 261 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 264 262 if (hwndC != exclude) { 265 id = WinQueryWindowUShort(hwndC, QWS_ID);266 if (id)267 break;263 id = WinQueryWindowUShort(hwndC, QWS_ID); 264 if (id) 265 break; 268 266 } 269 267 } … … 285 283 henum = WinBeginEnumWindows(hwndMain); 286 284 while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) { 287 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);288 if (hwndC != exclude && hwndC != hwndTree) {289 id = WinQueryWindowUShort(hwndC, QWS_ID);290 if (id) {291 hwndClient = WinWindowFromID(hwndC, FID_CLIENT);292 if (hwndClient) {293 hwndDir = WinWindowFromID(hwndClient, DIR_CNR);294 if (hwndDir) {295 if (fLookInDir) {296 pci = (PCNRITEM) WinSendMsg(hwndDir,297 CM_QUERYRECORDEMPHASIS,298 MPFROMLONG(CMA_FIRST),299 MPFROMSHORT(CRA_CURSORED));300 if (pci && (INT) pci != -1)301 break;302 }303 if (WinSendMsg(hwndClient,304 UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {305 MakeValidDir(ret);306 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);307 WinEndEnumWindows(henum);308 return hwndC;309 }310 }311 }312 }313 }285 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC); 286 if (hwndC != exclude && hwndC != hwndTree) { 287 id = WinQueryWindowUShort(hwndC, QWS_ID); 288 if (id) { 289 hwndClient = WinWindowFromID(hwndC, FID_CLIENT); 290 if (hwndClient) { 291 hwndDir = WinWindowFromID(hwndClient, DIR_CNR); 292 if (hwndDir) { 293 if (fLookInDir) { 294 pci = (PCNRITEM) WinSendMsg(hwndDir, 295 CM_QUERYRECORDEMPHASIS, 296 MPFROMLONG(CMA_FIRST), 297 MPFROMSHORT(CRA_CURSORED)); 298 if (pci && (INT) pci != -1) 299 break; 300 } 301 if (WinSendMsg(hwndClient, 302 UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) { 303 MakeValidDir(ret); 304 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret); 305 WinEndEnumWindows(henum); 306 return hwndC; 307 } 308 } 309 } 310 } 311 } 314 312 } 315 313 WinEndEnumWindows(henum); 316 314 if (!pci || (INT) pci == -1) { 317 hwndC = hwndTree;318 pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree,319 FID_CLIENT),320 TREE_CNR),321 CM_QUERYRECORDEMPHASIS,322 MPFROMLONG(CMA_FIRST),323 MPFROMSHORT(CRA_CURSORED));315 hwndC = hwndTree; 316 pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree, 317 FID_CLIENT), 318 TREE_CNR), 319 CM_QUERYRECORDEMPHASIS, 320 MPFROMLONG(CMA_FIRST), 321 MPFROMSHORT(CRA_CURSORED)); 324 322 } 325 323 if (pci && (INT) pci != -1) { 326 strcpy(ret, pci->pszFileName);327 MakeValidDir(ret);324 strcpy(ret, pci->pszFileName); 325 MakeValidDir(ret); 328 326 } 329 327 else 330 save_dir2(ret);328 save_dir2(ret); 331 329 } 332 330 } … … 346 344 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 347 345 if (hwndDir) 348 ret++;346 ret++; 349 347 } 350 348 } … … 364 362 hwndC = WinWindowFromID(hwndF, FID_CLIENT); 365 363 if (hwndC) { 366 hwndDir = WinWindowFromID(hwndC, DIR_CNR);367 if (hwndDir) {368 *retstr = 0;369 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);370 if (*retstr && !stricmp(retstr, directory)) {371 if (restore)372 WinSetWindowPos(hwndF,373 HWND_TOP,374 0,375 0,376 0,377 0,378 SWP_RESTORE | SWP_SHOW |379 SWP_ACTIVATE | SWP_ZORDER);380 break;381 }382 }364 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 365 if (hwndDir) { 366 *retstr = 0; 367 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID); 368 if (*retstr && !stricmp(retstr, directory)) { 369 if (restore) 370 WinSetWindowPos(hwndF, 371 HWND_TOP, 372 0, 373 0, 374 0, 375 0, 376 SWP_RESTORE | SWP_SHOW | 377 SWP_ACTIVATE | SWP_ZORDER); 378 break; 379 } 380 } 383 381 } 384 382 } … … 447 445 while (tool) { 448 446 if (!(tool->flags & T_INVISIBLE)) { 449 swp[x].x = butx;450 if (fTextTools || (tool->flags & T_TEXT)) {451 butx += 55L;452 swp[x].cx = 54L;453 swp[x].cy = 24L;454 swp[x].y = 3L;455 }456 else457 butx += 33L;458 if (tool->flags & T_SEPARATOR)459 butx += 12;447 swp[x].x = butx; 448 if (fTextTools || (tool->flags & T_TEXT)) { 449 butx += 55L; 450 swp[x].cx = 54L; 451 swp[x].cy = 24L; 452 swp[x].y = 3L; 453 } 454 else 455 butx += 33L; 456 if (tool->flags & T_SEPARATOR) 457 butx += 12; 460 458 } 461 459 else 462 swp[x].fl = noattrib;460 swp[x].fl = noattrib; 463 461 swp[x].hwnd = WinWindowFromID(hwnd, tool->id); 464 462 x++; … … 469 467 swp[x].x = butx; 470 468 if (!(tool->flags & T_INVISIBLE)) { 471 if (fTextTools || (tool->flags & T_TEXT)) {472 butx += 55L;473 swp[x].cx = 54L;474 swp[x].cy = 24L;475 swp[x].y = 3L;476 }477 else478 butx += 33L;479 if (tool->flags & T_SEPARATOR)480 butx += 12;469 if (fTextTools || (tool->flags & T_TEXT)) { 470 butx += 55L; 471 swp[x].cx = 54L; 472 swp[x].cy = 24L; 473 swp[x].y = 3L; 474 } 475 else 476 butx += 33L; 477 if (tool->flags & T_SEPARATOR) 478 butx += 12; 481 479 } 482 480 else 483 swp[x].fl = noattrib;481 swp[x].fl = noattrib; 484 482 swp[x].hwnd = WinWindowFromID(hwnd, tool->id); 485 483 x++; … … 489 487 if (!fTextTools && fToolTitles) { 490 488 for (x = 2L; x < numtools + 2L; x++) { 491 if (fTextTools || !fToolTitles)492 swp[x].fl = noattrib;493 else {494 tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID));495 if (tool && (tool->flags & T_TEXT))496 swp[x].fl = noattrib;497 else {498 swp[x].hwndInsertBehind = HWND_TOP;499 swp[x].y = 1L;500 swp[x].cy = 10L;501 }502 }503 swp[x].hwnd = WinWindowFromID(hwnd,504 WinQueryWindowUShort(swp[x].hwnd,505 QWS_ID) + 25000);489 if (fTextTools || !fToolTitles) 490 swp[x].fl = noattrib; 491 else { 492 tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID)); 493 if (tool && (tool->flags & T_TEXT)) 494 swp[x].fl = noattrib; 495 else { 496 swp[x].hwndInsertBehind = HWND_TOP; 497 swp[x].y = 1L; 498 swp[x].cy = 10L; 499 } 500 } 501 swp[x].hwnd = WinWindowFromID(hwnd, 502 WinQueryWindowUShort(swp[x].hwnd, 503 QWS_ID) + 25000); 506 504 } 507 505 WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools); … … 513 511 514 512 static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1, 515 MPARAM mp2)513 MPARAM mp2) 516 514 { 517 515 PFNWP oldproc = (PFNWP) INSTDATA(hwnd); … … 551 549 id = WinQueryWindowUShort(hwndParent, QWS_ID); 552 550 if (SHORT1FROMMP(mp2)) { 553 // If getting focus 1st time - save original accelerator554 if (haccelSaved == NULLHANDLE) {555 haccelSaved = WinQueryAccelTable(hab, hwndFrame);556 if (haccelSaved == NULLHANDLE)557 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable");558 // else559 // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved);560 }561 if (haccelSaved != NULLHANDLE) {562 switch (id) {563 case MAIN_DRIVELIST:564 if (haccelDriveList == NULLHANDLE) {565 haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST);566 if (haccelDriveList == NULLHANDLE)567 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");568 }569 if (haccelDriveList != NULLHANDLE) {570 if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame))571 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");572 // else573 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);574 }575 break;576 case MAIN_SETUPLIST:577 if (haccelSetupList == NULLHANDLE) {578 haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST);579 if (haccelSetupList == NULLHANDLE)580 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");581 }582 if (haccelSetupList != NULLHANDLE) {583 if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame))584 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");585 // else586 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList);587 }588 break;589 case MAIN_CMDLIST:590 if (haccelCmdList == NULLHANDLE) {591 haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST);592 if (haccelCmdList == NULLHANDLE)593 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");594 }595 if (haccelCmdList != NULLHANDLE) {596 if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame))597 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");598 // else599 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList);600 }601 break;602 case MAIN_USERLIST:603 if (haccelUserList == NULLHANDLE) {604 haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST);605 if (haccelUserList == NULLHANDLE)606 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");607 }608 if (haccelUserList != NULLHANDLE) {609 if (!WinSetAccelTable(hab, haccelUserList, hwndFrame))610 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");611 // else612 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList);613 }614 break;615 case MAIN_BUTTONLIST:616 if (haccelButtonList == NULLHANDLE) {617 haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST);618 if (haccelButtonList == NULLHANDLE)619 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");620 }621 if (haccelButtonList != NULLHANDLE) {622 if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame))623 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");624 // else625 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList);626 }627 break;628 } // switch629 }551 // If getting focus 1st time - save original accelerator 552 if (haccelSaved == NULLHANDLE) { 553 haccelSaved = WinQueryAccelTable(hab, hwndFrame); 554 if (haccelSaved == NULLHANDLE) 555 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable"); 556 // else 557 // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved); 558 } 559 if (haccelSaved != NULLHANDLE) { 560 switch (id) { 561 case MAIN_DRIVELIST: 562 if (haccelDriveList == NULLHANDLE) { 563 haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST); 564 if (haccelDriveList == NULLHANDLE) 565 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 566 } 567 if (haccelDriveList != NULLHANDLE) { 568 if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame)) 569 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 570 // else 571 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList); 572 } 573 break; 574 case MAIN_SETUPLIST: 575 if (haccelSetupList == NULLHANDLE) { 576 haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST); 577 if (haccelSetupList == NULLHANDLE) 578 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 579 } 580 if (haccelSetupList != NULLHANDLE) { 581 if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame)) 582 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 583 // else 584 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList); 585 } 586 break; 587 case MAIN_CMDLIST: 588 if (haccelCmdList == NULLHANDLE) { 589 haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST); 590 if (haccelCmdList == NULLHANDLE) 591 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 592 } 593 if (haccelCmdList != NULLHANDLE) { 594 if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame)) 595 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 596 // else 597 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList); 598 } 599 break; 600 case MAIN_USERLIST: 601 if (haccelUserList == NULLHANDLE) { 602 haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST); 603 if (haccelUserList == NULLHANDLE) 604 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 605 } 606 if (haccelUserList != NULLHANDLE) { 607 if (!WinSetAccelTable(hab, haccelUserList, hwndFrame)) 608 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 609 // else 610 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList); 611 } 612 break; 613 case MAIN_BUTTONLIST: 614 if (haccelButtonList == NULLHANDLE) { 615 haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST); 616 if (haccelButtonList == NULLHANDLE) 617 Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable"); 618 } 619 if (haccelButtonList != NULLHANDLE) { 620 if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame)) 621 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 622 // else 623 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList); 624 } 625 break; 626 } // switch 627 } 630 628 } 631 629 else { 632 // Losing focus633 switch (id) {634 case MAIN_DRIVELIST:635 case MAIN_SETUPLIST:636 case MAIN_CMDLIST:637 case MAIN_USERLIST:638 case MAIN_BUTTONLIST:639 if (haccelSaved != NULLHANDLE) {640 if (!WinSetAccelTable(hab, haccelSaved, hwndFrame))641 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");642 // else643 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved);644 }645 break;646 } // switch630 // Losing focus 631 switch (id) { 632 case MAIN_DRIVELIST: 633 case MAIN_SETUPLIST: 634 case MAIN_CMDLIST: 635 case MAIN_USERLIST: 636 case MAIN_BUTTONLIST: 637 if (haccelSaved != NULLHANDLE) { 638 if (!WinSetAccelTable(hab, haccelSaved, hwndFrame)) 639 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable"); 640 // else 641 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved); 642 } 643 break; 644 } // switch 647 645 } 648 646 } … … 654 652 655 653 if (hwndMenu) 656 WinDestroyWindow(hwndMenu);654 WinDestroyWindow(hwndMenu); 657 655 hwndMenu = (HWND) 0; 658 656 id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID); 659 657 switch (id) { 660 658 case MAIN_CMDLIST: 661 WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,662 QW_PARENT),663 QW_PARENT),664 FID_CLIENT),665 WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID);666 break;659 WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 660 QW_PARENT), 661 QW_PARENT), 662 FID_CLIENT), 663 WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID); 664 break; 667 665 case MAIN_USERLIST: 668 666 case MAIN_SETUPLIST: 669 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);670 if (hwndMenu)671 PopupMenu(hwnd,672 WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,673 QW_PARENT),674 QW_PARENT),675 FID_CLIENT), hwndMenu);676 break;667 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id); 668 if (hwndMenu) 669 PopupMenu(hwnd, 670 WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 671 QW_PARENT), 672 QW_PARENT), 673 FID_CLIENT), hwndMenu); 674 break; 677 675 default: 678 ret = FALSE;679 break;676 ret = FALSE; 677 break; 680 678 } // switch 681 679 return ret; … … 686 684 switch (SHORT1FROMMP(mp1)) { 687 685 case CBID_EDIT: 688 id = WinQueryWindowUShort(hwnd, QWS_ID);689 switch (SHORT2FROMMP(mp1)) {690 case EN_SETFOCUS:691 switch (id) {692 case MAIN_CMDLIST:693 WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP));694 break;695 case MAIN_SETUPLIST:696 WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP));697 break;698 case MAIN_USERLIST:699 WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP));700 break;701 case MAIN_DRIVELIST:702 WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP));703 break;704 case MAIN_BUTTONLIST:705 WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP));706 break;707 default:708 break;709 }710 break;711 712 default:713 break;714 }686 id = WinQueryWindowUShort(hwnd, QWS_ID); 687 switch (SHORT2FROMMP(mp1)) { 688 case EN_SETFOCUS: 689 switch (id) { 690 case MAIN_CMDLIST: 691 WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP)); 692 break; 693 case MAIN_SETUPLIST: 694 WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP)); 695 break; 696 case MAIN_USERLIST: 697 WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP)); 698 break; 699 case MAIN_DRIVELIST: 700 WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP)); 701 break; 702 case MAIN_BUTTONLIST: 703 WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP)); 704 break; 705 default: 706 break; 707 } 708 break; 709 710 default: 711 break; 712 } 715 713 } 716 714 break; … … 725 723 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"%u %s %u",id,(id == CBID_EDIT) ? "TRUE" : "FALSE",WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID) == MAIN_USERLIST); 726 724 if (id == CBID_EDIT && 727 WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==728 MAIN_USERLIST) {725 WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) == 726 MAIN_USERLIST) { 729 727 730 728 CHAR path[CCHMAXPATH]; … … 735 733 // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path); 736 734 if (*path && !IsRoot(path)) 737 DragOne(hwnd, (HWND) 0, path, FALSE);735 DragOne(hwnd, (HWND) 0, path, FALSE); 738 736 return 0; 739 737 } … … 744 742 if (id == MAIN_USERLIST) { 745 743 if (!emphasized) { 746 emphasized = TRUE;747 DrawTargetEmphasis(hwnd, emphasized);744 emphasized = TRUE; 745 DrawTargetEmphasis(hwnd, emphasized); 748 746 } 749 747 if (AcceptOneDrop(hwnd, mp1, mp2)) 750 return MRFROM2SHORT(DOR_DROP, DO_MOVE);748 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 751 749 return MRFROM2SHORT(DOR_NEVERDROP, 0); 752 750 } … … 757 755 if (id == MAIN_USERLIST) { 758 756 if (emphasized) { 759 emphasized = FALSE;760 DrawTargetEmphasis(hwnd, emphasized);757 emphasized = FALSE; 758 DrawTargetEmphasis(hwnd, emphasized); 761 759 } 762 760 } … … 778 776 779 777 if (emphasized) { 780 emphasized = FALSE;781 DrawTargetEmphasis(hwnd, emphasized);778 emphasized = FALSE; 779 DrawTargetEmphasis(hwnd, emphasized); 782 780 } 783 781 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) { 784 MakeValidDir(szFrom);785 WinSetWindowText(hwnd, szFrom);786 PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,787 QW_PARENT),788 QW_PARENT),789 FID_CLIENT),790 UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID);791 return 0;782 MakeValidDir(szFrom); 783 WinSetWindowText(hwnd, szFrom); 784 PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 785 QW_PARENT), 786 QW_PARENT), 787 FID_CLIENT), 788 UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID); 789 return 0; 792 790 } 793 791 } … … 810 808 (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) { 811 809 if ((!hwndBubble || 812 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&813 !WinQueryCapture(HWND_DESKTOP))810 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 811 !WinQueryCapture(HWND_DESKTOP)) 814 812 MakeBubble(hwnd, above, help); 815 813 } … … 832 830 /* don't bring up help if window isn't active */ 833 831 if (!WinIsChild(hwnd, hwndActive)) 834 return;832 return; 835 833 } 836 834 hwndActive = WinQueryFocus(HWND_DESKTOP); … … 838 836 /* don't bring up help if a menu is active */ 839 837 if (!strcmp(ucClassname, "#4")) 840 return;838 return; 841 839 } 842 840 } 843 841 844 842 hwndBubble = WinCreateWindow(HWND_DESKTOP, 845 WC_BUBBLE,846 help,847 WS_CLIPSIBLINGS | SS_TEXT |848 DT_CENTER | DT_VCENTER,849 0,850 0,851 0,852 0,853 HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL);843 WC_BUBBLE, 844 help, 845 WS_CLIPSIBLINGS | SS_TEXT | 846 DT_CENTER | DT_VCENTER, 847 0, 848 0, 849 0, 850 0, 851 HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL); 854 852 if (!hwndBubble) 855 853 Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 856 IDS_WINCREATEWINDOW);854 IDS_WINCREATEWINDOW); 857 855 else { 858 856 HPS hps; … … 874 872 pp = strchr(p, '\r'); 875 873 if (pp) { 876 wp = pp;877 *pp = 0;878 pp++;874 wp = pp; 875 *pp = 0; 876 pp++; 879 877 } 880 878 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 881 879 tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x); 882 880 if (tptl.y) 883 tptl.y += extra;881 tptl.y += extra; 884 882 else 885 extra = aptl[TXTBOX_TOPLEFT].y / 4;883 extra = aptl[TXTBOX_TOPLEFT].y / 4; 886 884 tptl.y += aptl[TXTBOX_TOPLEFT].y; 887 885 if (wp) 888 *wp = '\r';886 *wp = '\r'; 889 887 p = pp; 890 888 } … … 896 894 sy = ptl.y + swp.cy + 4; 897 895 if (sy + tptl.y + 12 > lyScreen) { 898 above = FALSE;899 sy = ptl.y - (tptl.y + 14);896 above = FALSE; 897 sy = ptl.y - (tptl.y + 14); 900 898 } 901 899 } … … 913 911 sy = ptl.y + swp.cy + 4; 914 912 if (sy + tptl.y + 12 > lyScreen) 915 sy = 0;913 sy = 0; 916 914 } 917 915 WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy, 918 tptl.x + 14,919 tptl.y + 12,920 SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER |921 SWP_MOVE | SWP_SIZE);916 tptl.x + 14, 917 tptl.y + 12, 918 SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER | 919 SWP_MOVE | SWP_SIZE); 922 920 } 923 921 } … … 945 943 WinQueryPointerPos(HWND_DESKTOP, &ptl); 946 944 if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) != 947 WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd))948 WinDestroyWindow(hwnd);945 WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd)) 946 WinDestroyWindow(hwnd); 949 947 } 950 948 return 0; … … 960 958 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 961 959 if (hps) { 962 WinQueryWindowPos(hwnd, &swp);963 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0);964 GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198));965 GpiSetBackMix(hps, BM_LEAVEALONE);966 GpiSetMix(hps, FM_OVERPAINT);967 ptl.x = ptl.y = 0;968 GpiMove(hps, &ptl);969 ptl.x = swp.cx - 1;970 ptl.y = swp.cy - 1;971 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);972 tlen = WinQueryWindowTextLength(hwnd);973 if (tlen) {974 s = xmalloc(tlen + 2, pszSrcFile, __LINE__);975 if (s) {976 WinQueryWindowText(hwnd, tlen + 1, s);977 if (*s) {978 p = s;979 y = swp.cy - 3;980 extra = WinQueryWindowULong(hwnd, QWL_USER + 4);981 GpiSetColor(hps, 0);982 GpiSetMix(hps, FM_OVERPAINT);983 while (p && *p) {984 wp = NULL;985 pp = strchr(p, '\r');986 if (pp) {987 wp = pp;988 *pp = 0;989 pp++;990 }991 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);992 ptl.x = 7;993 y -= aptl[TXTBOX_TOPLEFT].y;994 if (p != s)995 y -= extra;996 ptl.y = y;997 GpiCharStringAt(hps, &ptl, strlen(p), p);998 if (wp)999 *wp = '\r';1000 p = pp;1001 }1002 }1003 free(s);1004 }1005 }1006 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) {1007 GpiSetColor(hps, CLR_WHITE);1008 ptl.x = 1;1009 ptl.y = 1;1010 GpiMove(hps, &ptl);1011 ptl.y = swp.cy - 2;1012 GpiLine(hps, &ptl);1013 ptl.x = swp.cx - 2;1014 GpiLine(hps, &ptl);1015 ptl.x = 2;1016 ptl.y = 2;1017 GpiMove(hps, &ptl);1018 ptl.y = swp.cy - 3;1019 GpiLine(hps, &ptl);1020 ptl.x = swp.cx - 3;1021 GpiLine(hps, &ptl);1022 GpiSetColor(hps, CLR_BROWN);1023 ptl.x = 1;1024 ptl.y = 1;1025 GpiMove(hps, &ptl);1026 ptl.x = swp.cx - 2;1027 GpiLine(hps, &ptl);1028 ptl.y = swp.cy - 2;1029 GpiLine(hps, &ptl);1030 ptl.x = 2;1031 ptl.y = 2;1032 GpiMove(hps, &ptl);1033 ptl.x = swp.cx - 3;1034 GpiLine(hps, &ptl);1035 ptl.y = swp.cy - 3;1036 GpiLine(hps, &ptl);1037 }1038 WinEndPaint(hps);960 WinQueryWindowPos(hwnd, &swp); 961 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0); 962 GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198)); 963 GpiSetBackMix(hps, BM_LEAVEALONE); 964 GpiSetMix(hps, FM_OVERPAINT); 965 ptl.x = ptl.y = 0; 966 GpiMove(hps, &ptl); 967 ptl.x = swp.cx - 1; 968 ptl.y = swp.cy - 1; 969 GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0); 970 tlen = WinQueryWindowTextLength(hwnd); 971 if (tlen) { 972 s = xmalloc(tlen + 2, pszSrcFile, __LINE__); 973 if (s) { 974 WinQueryWindowText(hwnd, tlen + 1, s); 975 if (*s) { 976 p = s; 977 y = swp.cy - 3; 978 extra = WinQueryWindowULong(hwnd, QWL_USER + 4); 979 GpiSetColor(hps, 0); 980 GpiSetMix(hps, FM_OVERPAINT); 981 while (p && *p) { 982 wp = NULL; 983 pp = strchr(p, '\r'); 984 if (pp) { 985 wp = pp; 986 *pp = 0; 987 pp++; 988 } 989 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 990 ptl.x = 7; 991 y -= aptl[TXTBOX_TOPLEFT].y; 992 if (p != s) 993 y -= extra; 994 ptl.y = y; 995 GpiCharStringAt(hps, &ptl, strlen(p), p); 996 if (wp) 997 *wp = '\r'; 998 p = pp; 999 } 1000 } 1001 free(s); 1002 } 1003 } 1004 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) { 1005 GpiSetColor(hps, CLR_WHITE); 1006 ptl.x = 1; 1007 ptl.y = 1; 1008 GpiMove(hps, &ptl); 1009 ptl.y = swp.cy - 2; 1010 GpiLine(hps, &ptl); 1011 ptl.x = swp.cx - 2; 1012 GpiLine(hps, &ptl); 1013 ptl.x = 2; 1014 ptl.y = 2; 1015 GpiMove(hps, &ptl); 1016 ptl.y = swp.cy - 3; 1017 GpiLine(hps, &ptl); 1018 ptl.x = swp.cx - 3; 1019 GpiLine(hps, &ptl); 1020 GpiSetColor(hps, CLR_BROWN); 1021 ptl.x = 1; 1022 ptl.y = 1; 1023 GpiMove(hps, &ptl); 1024 ptl.x = swp.cx - 2; 1025 GpiLine(hps, &ptl); 1026 ptl.y = swp.cy - 2; 1027 GpiLine(hps, &ptl); 1028 ptl.x = 2; 1029 ptl.y = 2; 1030 GpiMove(hps, &ptl); 1031 ptl.x = swp.cx - 3; 1032 GpiLine(hps, &ptl); 1033 ptl.y = swp.cy - 3; 1034 GpiLine(hps, &ptl); 1035 } 1036 WinEndPaint(hps); 1039 1037 } 1040 1038 } … … 1063 1061 switch (WinQueryWindowUShort(hwnd, QWS_ID)) { 1064 1062 case MAIN_LED: 1065 hps = WinGetPS(hwnd);1066 hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID);1067 if (!fBlueLED) {1068 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12);1069 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12);1070 }1071 else {1072 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12);1073 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12);1074 }1075 if (hbmLEDoff && hbmLEDon)1076 WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID);1077 else {1078 if (hbmLEDoff)1079 GpiDeleteBitmap(hbmLEDoff);1080 if (hbmLEDon)1081 GpiDeleteBitmap(hbmLEDon);1082 }1083 if (hbmold &&1084 hbmLEDon &&1085 hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff)1086 GpiDeleteBitmap(hbmold);1087 if (hps)1088 WinReleasePS(hps);1089 break;1063 hps = WinGetPS(hwnd); 1064 hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID); 1065 if (!fBlueLED) { 1066 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12); 1067 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12); 1068 } 1069 else { 1070 hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12); 1071 hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12); 1072 } 1073 if (hbmLEDoff && hbmLEDon) 1074 WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID); 1075 else { 1076 if (hbmLEDoff) 1077 GpiDeleteBitmap(hbmLEDoff); 1078 if (hbmLEDon) 1079 GpiDeleteBitmap(hbmLEDon); 1080 } 1081 if (hbmold && 1082 hbmLEDon && 1083 hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff) 1084 GpiDeleteBitmap(hbmold); 1085 if (hps) 1086 WinReleasePS(hps); 1087 break; 1090 1088 default: 1091 SetPresParams(hwnd,1092 &RGBGREY,1093 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));1094 break;1089 SetPresParams(hwnd, 1090 &RGBGREY, 1091 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT)); 1092 break; 1095 1093 } 1096 1094 return mr; … … 1116 1114 case WM_BUTTON1CLICK: 1117 1115 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1118 WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID);1116 WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID); 1119 1117 break; 1120 1118 1121 1119 case WM_BUTTON2CLICK: 1122 1120 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1123 WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID);1121 WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID); 1124 1122 break; 1125 1123 … … 1127 1125 case WM_BUTTON3CLICK: 1128 1126 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 1129 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);1127 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID); 1130 1128 break; 1131 1129 } … … 1150 1148 if (fToolbarHelp) { 1151 1149 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 1152 && !WinQueryCapture(HWND_DESKTOP)) {1153 id = WinQueryWindowUShort(hwnd, QWS_ID);1154 tool = find_tool(id);1155 if (tool && tool->help && *tool->help) {1156 1157 char s[128];1158 1159 strcpy(s, tool->help);1160 if (tool->flags & T_DROPABLE)1161 strcat(s, GetPString(IDS_DROPONMETEXT));1162 MakeBubble(hwnd, FALSE, s);1163 }1150 && !WinQueryCapture(HWND_DESKTOP)) { 1151 id = WinQueryWindowUShort(hwnd, QWS_ID); 1152 tool = find_tool(id); 1153 if (tool && tool->help && *tool->help) { 1154 1155 char s[128]; 1156 1157 strcpy(s, tool->help); 1158 if (tool->flags & T_DROPABLE) 1159 strcat(s, GetPString(IDS_DROPONMETEXT)); 1160 MakeBubble(hwnd, FALSE, s); 1161 } 1164 1162 } 1165 1163 } … … 1170 1168 case IDM_HELP: 1171 1169 if (hwndHelp) 1172 WinSendMsg(hwndHelp,1173 HM_DISPLAY_HELP,1174 MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID));1170 WinSendMsg(hwndHelp, 1171 HM_DISPLAY_HELP, 1172 MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID)); 1175 1173 break; 1176 1174 … … 1178 1176 case IDM_HIDETOOL: /* hide tool */ 1179 1177 if (SHORT1FROMMP(mp1) == IDM_HIDETOOL) 1180 id = WinQueryWindowUShort(hwnd, QWS_ID);1178 id = WinQueryWindowUShort(hwnd, QWS_ID); 1181 1179 else 1182 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd,1183 PickToolProc, FM3ModHandle,1184 PICKBTN_FRAME, GetPString(IDS_HIDETEXT));1180 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, 1181 PickToolProc, FM3ModHandle, 1182 PICKBTN_FRAME, GetPString(IDS_HIDETEXT)); 1185 1183 if (id) { 1186 tool = find_tool(id);1187 if (tool) {1188 tool->flags |= T_INVISIBLE;1189 fToolsChanged = TRUE;1190 }1184 tool = find_tool(id); 1185 if (tool) { 1186 tool->flags |= T_INVISIBLE; 1187 fToolsChanged = TRUE; 1188 } 1191 1189 } 1192 1190 break; … … 1195 1193 tool = toolhead; 1196 1194 while (tool) { 1197 tool->flags &= (~T_INVISIBLE);1198 tool = tool->next;1199 fToolsChanged = TRUE;1195 tool->flags &= (~T_INVISIBLE); 1196 tool = tool->next; 1197 fToolsChanged = TRUE; 1200 1198 } 1201 1199 break; … … 1204 1202 case IDM_DELETETOOL: /* delete button */ 1205 1203 if (SHORT1FROMMP(mp1) == IDM_DELETETOOL) 1206 id = WinQueryWindowUShort(hwnd, QWS_ID);1204 id = WinQueryWindowUShort(hwnd, QWS_ID); 1207 1205 else 1208 id =1209 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,1210 PICKBTN_FRAME, GetPString(IDS_DELETETEXT));1206 id = 1207 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle, 1208 PICKBTN_FRAME, GetPString(IDS_DELETETEXT)); 1211 1209 if (id) 1212 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP,1213 MPFROM2SHORT(id, 0), MPVOID);1210 PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP, 1211 MPFROM2SHORT(id, 0), MPVOID); 1214 1212 return 0; 1215 1213 … … 1217 1215 case IDM_EDITTOOL: /* edit button */ 1218 1216 if (SHORT1FROMMP(mp1) == IDM_EDITTOOL) 1219 id = WinQueryWindowUShort(hwnd, QWS_ID);1217 id = WinQueryWindowUShort(hwnd, QWS_ID); 1220 1218 else 1221 id =1222 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,1223 PICKBTN_FRAME, GetPString(IDS_EDITTEXT));1219 id = 1220 (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle, 1221 PICKBTN_FRAME, GetPString(IDS_EDITTEXT)); 1224 1222 if (id) { 1225 tool = find_tool(id);1226 if (tool) {1227 if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,1228 ADDBTN_FRAME, (PVOID) tool))1229 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,1230 QW_PARENT),1231 QW_PARENT), FID_CLIENT),1232 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),1233 MPFROM2SHORT(id, 0));1234 }1223 tool = find_tool(id); 1224 if (tool) { 1225 if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle, 1226 ADDBTN_FRAME, (PVOID) tool)) 1227 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 1228 QW_PARENT), 1229 QW_PARENT), FID_CLIENT), 1230 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0), 1231 MPFROM2SHORT(id, 0)); 1232 } 1235 1233 } 1236 1234 break; … … 1238 1236 case IDM_ADDTOOL: /* add tool */ 1239 1237 id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle, 1240 ADDBTN_FRAME, MPVOID);1238 ADDBTN_FRAME, MPVOID); 1241 1239 if (id && id != (USHORT) - 1) 1242 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,1243 QW_PARENT),1244 QW_PARENT), FID_CLIENT),1245 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),1246 MPFROM2SHORT(id, 0));1240 WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd, 1241 QW_PARENT), 1242 QW_PARENT), FID_CLIENT), 1243 WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0), 1244 MPFROM2SHORT(id, 0)); 1247 1245 break; 1248 1246 1249 1247 case IDM_REORDERTOOLS: /* reorder tools */ 1250 1248 WinDlgBox(HWND_DESKTOP, 1251 hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID);1249 hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID); 1252 1250 break; 1253 1251 … … 1255 1253 case IDM_LOADTOOLS: 1256 1254 if (WinDlgBox(HWND_DESKTOP, 1257 hwnd,1258 ToolIODlgProc,1259 FM3ModHandle,1260 SVBTN_FRAME,1261 (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?1262 "TRUE" : NULL))1263 BuildTools(hwndToolback, TRUE);1255 hwnd, 1256 ToolIODlgProc, 1257 FM3ModHandle, 1258 SVBTN_FRAME, 1259 (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ? 1260 "TRUE" : NULL)) 1261 BuildTools(hwndToolback, TRUE); 1264 1262 break; 1265 1263 } … … 1293 1291 tool = find_tool(id); 1294 1292 if (!tool) { 1295 DrgFreeDraginfo(pDInfo);1296 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */1293 DrgFreeDraginfo(pDInfo); 1294 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */ 1297 1295 } 1298 1296 if (!(tool->flags & T_DROPABLE)) { 1299 DrgFreeDraginfo(pDInfo);1300 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */1297 DrgFreeDraginfo(pDInfo); 1298 return (MRFROM2SHORT(DOR_NEVERDROP, 0)); /* Drop not valid */ 1301 1299 } 1302 1300 { 1303 PDRAGITEM pDItem; /* Pointer to DRAGITEM */1304 1305 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */1306 0); /* Index to DRAGITEM */1307 if (DrgVerifyRMF(pDItem, /* Check valid rendering */1308 DRM_OS2FILE, /* mechanisms and data */1309 NULL)) { /* formats */1310 if (!(tool->flags & T_EMPHASIZED)) {1311 tool->flags |= T_EMPHASIZED;1312 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));1313 DrgFreeDraginfo(pDInfo);1314 }1315 return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */1316 DO_MOVE)); /* Move operation valid */1317 }1318 DrgFreeDraginfo(pDInfo);1301 PDRAGITEM pDItem; /* Pointer to DRAGITEM */ 1302 1303 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */ 1304 0); /* Index to DRAGITEM */ 1305 if (DrgVerifyRMF(pDItem, /* Check valid rendering */ 1306 DRM_OS2FILE, /* mechanisms and data */ 1307 NULL)) { /* formats */ 1308 if (!(tool->flags & T_EMPHASIZED)) { 1309 tool->flags |= T_EMPHASIZED; 1310 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1311 DrgFreeDraginfo(pDInfo); 1312 } 1313 return (MRFROM2SHORT(DOR_DROP, /* Return okay to drop */ 1314 DO_MOVE)); /* Move operation valid */ 1315 } 1316 DrgFreeDraginfo(pDInfo); 1319 1317 } 1320 1318 } … … 1333 1331 if (tool && (tool->flags & T_DROPABLE)) { 1334 1332 if (tool->flags & T_EMPHASIZED) { 1335 tool->flags &= (~T_EMPHASIZED);1336 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));1333 tool->flags &= (~T_EMPHASIZED); 1334 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1337 1335 } 1338 1336 } … … 1347 1345 1348 1346 if (tool->flags & T_EMPHASIZED) { 1349 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));1350 tool->flags &= (~T_EMPHASIZED);1347 DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0)); 1348 tool->flags &= (~T_EMPHASIZED); 1351 1349 } 1352 1350 memset(&cdi, 0, sizeof(cdi)); … … 1355 1353 CheckPmDrgLimit(cdi.pDragInfo); 1356 1354 if (li) { 1357 li->type = id;1358 if (!li->list || !li->list[0])1359 FreeListInfo(li);1360 else {1361 HWND hwndActive;1362 1363 hwndActive = TopWindow(hwndMain, (HWND) 0);1364 if (hwndActive) {1365 if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID))1366 FreeListInfo(li);1367 }1368 else1369 FreeListInfo(li);1370 }1355 li->type = id; 1356 if (!li->list || !li->list[0]) 1357 FreeListInfo(li); 1358 else { 1359 HWND hwndActive; 1360 1361 hwndActive = TopWindow(hwndMain, (HWND) 0); 1362 if (hwndActive) { 1363 if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID)) 1364 FreeListInfo(li); 1365 } 1366 else 1367 FreeListInfo(li); 1368 } 1371 1369 } 1372 1370 } … … 1405 1403 if (!fTextTools) { 1406 1404 if (!(tool->flags & T_MYICON)) { 1407 hwndTool = WinCreateWindow(hwndT,1408 WC_TOOLBUTTONS,1409 s,1410 BS_NOPOINTERFOCUS |1411 BS_BITMAP | BS_PUSHBUTTON,1412 ctrlxpos,1413 14,1414 32,1415 32, hwndT, HWND_TOP, tool->id, NULL, NULL);1405 hwndTool = WinCreateWindow(hwndT, 1406 WC_TOOLBUTTONS, 1407 s, 1408 BS_NOPOINTERFOCUS | 1409 BS_BITMAP | BS_PUSHBUTTON, 1410 ctrlxpos, 1411 14, 1412 32, 1413 32, hwndT, HWND_TOP, tool->id, NULL, NULL); 1416 1414 } 1417 1415 if (!hwndTool) { 1418 HBITMAP hbm = LoadBitmapFromFileNum(tool->id);1419 1420 if (hbm) {1421 BTNCDATA btc;1422 1423 memset(&btc, 0, sizeof(btc));1424 btc.cb = sizeof(btc);1425 btc.hImage = hbm;1426 hwndTool = WinCreateWindow(hwndT,1427 WC_TOOLBUTTONS,1428 NullStr,1429 BS_NOPOINTERFOCUS |1430 BS_BITMAP | BS_PUSHBUTTON,1431 ctrlxpos,1432 14,1433 32,1434 32,1435 hwndT, HWND_TOP, tool->id, &btc, NULL);1436 if (!hwndTool)1437 GpiDeleteBitmap(hbm);1438 }1416 HBITMAP hbm = LoadBitmapFromFileNum(tool->id); 1417 1418 if (hbm) { 1419 BTNCDATA btc; 1420 1421 memset(&btc, 0, sizeof(btc)); 1422 btc.cb = sizeof(btc); 1423 btc.hImage = hbm; 1424 hwndTool = WinCreateWindow(hwndT, 1425 WC_TOOLBUTTONS, 1426 NullStr, 1427 BS_NOPOINTERFOCUS | 1428 BS_BITMAP | BS_PUSHBUTTON, 1429 ctrlxpos, 1430 14, 1431 32, 1432 32, 1433 hwndT, HWND_TOP, tool->id, &btc, NULL); 1434 if (!hwndTool) 1435 GpiDeleteBitmap(hbm); 1436 } 1439 1437 } 1440 1438 if (hwndTool) 1441 tool->flags &= (~T_TEXT);1439 tool->flags &= (~T_TEXT); 1442 1440 } 1443 1441 if (!hwndTool) { 1444 1442 hwndTool = WinCreateWindow(hwndT, 1445 WC_TOOLBUTTONS,1446 (!tool->text && tool->id >= IDM_COMMANDSTART1447 && tool->id <1448 IDM_QUICKTOOLSTART) ? command_title(tool->1449 id -1450 IDM_COMMANDSTART)1451 : tool->text,1452 BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos,1453 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL,1454 NULL);1443 WC_TOOLBUTTONS, 1444 (!tool->text && tool->id >= IDM_COMMANDSTART 1445 && tool->id < 1446 IDM_QUICKTOOLSTART) ? command_title(tool-> 1447 id - 1448 IDM_COMMANDSTART) 1449 : tool->text, 1450 BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos, 1451 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL, 1452 NULL); 1455 1453 if (!hwndTool) 1456 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,1457 IDS_WINCREATEWINDOW);1454 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1455 IDS_WINCREATEWINDOW); 1458 1456 tool->flags |= T_TEXT; 1459 1457 } 1460 1458 if (fToolTitles && !fTextTools) { 1461 1459 hwndTool = WinCreateWindow(hwndT, 1462 WC_STATIC,1463 tool->text,1464 SS_TEXT | DT_LEFT | DT_VCENTER,1465 ctrlxpos,1466 1,1467 32,1468 10,1469 hwndT,1470 HWND_TOP, tool->id + 25000, NULL, NULL);1460 WC_STATIC, 1461 tool->text, 1462 SS_TEXT | DT_LEFT | DT_VCENTER, 1463 ctrlxpos, 1464 1, 1465 32, 1466 10, 1467 hwndT, 1468 HWND_TOP, tool->id + 25000, NULL, NULL); 1471 1469 if (!hwndTool) 1472 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,1473 IDS_WINCREATEWINDOW);1470 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1471 IDS_WINCREATEWINDOW); 1474 1472 else { 1475 SetPresParams(hwndTool,1476 &RGBGREY,1477 &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT));1473 SetPresParams(hwndTool, 1474 &RGBGREY, 1475 &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT)); 1478 1476 } 1479 1477 } 1480 1478 ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L); 1481 1479 SetPresParams(WinWindowFromID(hwndT, tool->id), 1482 NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));1480 NULL, NULL, NULL, GetPString(IDS_8HELVTEXT)); 1483 1481 tool = tool->next; 1484 1482 } // while tool 1485 1483 1486 1484 hwndTool = WinCreateWindow(hwndT, 1487 WC_BUTTON,1488 "#6010",1489 BS_NOPOINTERFOCUS |1490 BS_BITMAP | BS_PUSHBUTTON,1491 1,1492 19,1493 14,1494 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL);1485 WC_BUTTON, 1486 "#6010", 1487 BS_NOPOINTERFOCUS | 1488 BS_BITMAP | BS_PUSHBUTTON, 1489 1, 1490 19, 1491 14, 1492 13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL); 1495 1493 if (!hwndTool) 1496 1494 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1497 IDS_WINCREATEWINDOW);1495 IDS_WINCREATEWINDOW); 1498 1496 hwndTool = 1499 1497 WinCreateWindow(hwndT, WC_BUTTON, "#6011", 1500 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14,1501 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL);1498 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14, 1499 13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL); 1502 1500 if (!hwndTool) 1503 1501 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 1504 IDS_WINCREATEWINDOW);1502 IDS_WINCREATEWINDOW); 1505 1503 if (resize) 1506 1504 ResizeTools(hwndT); … … 1508 1506 1509 1507 static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1, 1510 MPARAM mp2)1508 MPARAM mp2) 1511 1509 { 1512 1510 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); … … 1525 1523 1526 1524 if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON) 1527 break;1525 break; 1528 1526 if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid) 1529 WinDestroyWindow(hwnd);1527 WinDestroyWindow(hwnd); 1530 1528 } 1531 1529 break; … … 1538 1536 lbup = TRUE; 1539 1537 if (WinDlgBox(HWND_DESKTOP, 1540 hwnd,1541 CmdLine2DlgProc,1542 FM3ModHandle, EXEC2_FRAME, MPFROMP(cl))) {1543 lstrip(cl);1544 WinSetWindowText(hwnd, cl);1538 hwnd, 1539 CmdLine2DlgProc, 1540 FM3ModHandle, EXEC2_FRAME, MPFROMP(cl))) { 1541 lstrip(cl); 1542 WinSetWindowText(hwnd, cl); 1545 1543 } 1546 1544 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); … … 1561 1559 case COMMAND_BUTTON: 1562 1560 if (!lbup) 1563 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);1561 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1564 1562 break; 1565 1563 } … … 1580 1578 bstrip(cl + len); 1581 1579 if (strlen(cl) > len) { 1582 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),1583 UM_SETUP, MPFROMP(cl + len), MPVOID);1584 WinQueryWindowText(hwndStatus, CCHMAXPATH, directory);1585 bstrip(directory);1586 if (*directory && (IsRoot(directory) || !IsFile(directory))) {1587 if (!FM2Command(directory, cl + len)) {1588 hwndCnr = TopWindow(hwndMain, (HWND) 0);1589 if (hwndCnr) {1590 hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT);1591 if (hwndCnr) {1592 hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR);1593 if (hwndCnr)1594 list = BuildList(hwndCnr);1595 }1596 }1597 WinSetActiveWindow(HWND_DESKTOP, hwndCnr);1598 if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds)1599 save_cmdlines(FALSE);1600 ExecOnList(hwndCnr,1601 cl,1602 WINDOWED | ((fKeepCmdLine) ?1603 SEPARATEKEEP : SEPARATE),1604 directory, list, NULL, pszSrcFile, __LINE__);1605 if (list)1606 free(list);1607 WinDestroyWindow(hwnd);1608 break;1609 }1610 }1580 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 1581 UM_SETUP, MPFROMP(cl + len), MPVOID); 1582 WinQueryWindowText(hwndStatus, CCHMAXPATH, directory); 1583 bstrip(directory); 1584 if (*directory && (IsRoot(directory) || !IsFile(directory))) { 1585 if (!FM2Command(directory, cl + len)) { 1586 hwndCnr = TopWindow(hwndMain, (HWND) 0); 1587 if (hwndCnr) { 1588 hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT); 1589 if (hwndCnr) { 1590 hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR); 1591 if (hwndCnr) 1592 list = BuildList(hwndCnr); 1593 } 1594 } 1595 WinSetActiveWindow(HWND_DESKTOP, hwndCnr); 1596 if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds) 1597 save_cmdlines(FALSE); 1598 ExecOnList(hwndCnr, 1599 cl, 1600 WINDOWED | ((fKeepCmdLine) ? 1601 SEPARATEKEEP : SEPARATE), 1602 directory, list, NULL, pszSrcFile, __LINE__); 1603 if (list) 1604 free(list); 1605 WinDestroyWindow(hwnd); 1606 break; 1607 } 1608 } 1611 1609 } 1612 1610 WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID); … … 1617 1615 if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) { 1618 1616 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) { 1619 if ((SHORT1FROMMP(mp2) & 255) == '\r')1620 PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);1621 else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b)1622 WinDestroyWindow(hwnd);1623 else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN)1624 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);1617 if ((SHORT1FROMMP(mp2) & 255) == '\r') 1618 PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID); 1619 else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b) 1620 WinDestroyWindow(hwnd); 1621 else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN) 1622 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1625 1623 } 1626 1624 } 1627 1625 else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) && 1628 ((SHORT2FROMMP(mp2) == VK_UP ||1629 SHORT2FROMMP(mp2) == VK_DOWN) ||1630 (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r')))1626 ((SHORT2FROMMP(mp2) == VK_UP || 1627 SHORT2FROMMP(mp2) == VK_DOWN) || 1628 (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r'))) 1631 1629 return 0; 1632 1630 break; … … 1654 1652 rgb.bRed = (BYTE)128; 1655 1653 SetPresParams(hwnd, 1656 &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT));1654 &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT)); 1657 1655 SetTargetDir(hwnd, TRUE); 1658 1656 } … … 1684 1682 case WM_CONTROLPOINTER: 1685 1683 if (!fNoFinger && 1686 (SHORT1FROMMP(mp1) >= IDM_DRIVEA &&1687 SHORT1FROMMP(mp1) < IDM_DRIVEA + 26))1684 (SHORT1FROMMP(mp1) >= IDM_DRIVEA && 1685 SHORT1FROMMP(mp1) < IDM_DRIVEA + 26)) 1688 1686 return MRFROMLONG(hptrFinger); 1689 1687 break; … … 1695 1693 *dv = 0; 1696 1694 WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50), 1697 2, dv);1695 2, dv); 1698 1696 if (isalpha(*dv)) { 1699 1697 1700 HWND hwndActive;1701 1702 dv[1] = ':';1703 dv[2] = '\\';1704 dv[3] = 0;1705 hwndActive = TopWindow(hwnd, (HWND) 0);1706 if (hwndActive)1707 WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT),1708 UM_DRIVECMD, MPFROMP(dv), MPVOID);1698 HWND hwndActive; 1699 1700 dv[1] = ':'; 1701 dv[2] = '\\'; 1702 dv[3] = 0; 1703 hwndActive = TopWindow(hwnd, (HWND) 0); 1704 if (hwndActive) 1705 WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT), 1706 UM_DRIVECMD, MPFROMP(dv), MPVOID); 1709 1707 } 1710 1708 } … … 1734 1732 case WM_MOUSEMOVE: 1735 1733 if (fDrivebarHelp && 1736 (!hwndBubble ||1737 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&1738 !WinQueryCapture(HWND_DESKTOP)) {1734 (!hwndBubble || 1735 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 1736 !WinQueryCapture(HWND_DESKTOP)) { 1739 1737 id = WinQueryWindowUShort(hwnd, QWS_ID); 1740 1738 if (helpid != id) { 1741 helpid = id;1742 PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID);1739 helpid = id; 1740 PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID); 1743 1741 } 1744 1742 else 1745 helpid = 0;1743 helpid = 0; 1746 1744 } 1747 1745 break; … … 1750 1748 if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) { 1751 1749 if ((char *)mp1 && 1752 (!hwndBubble ||1753 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&1754 !WinQueryCapture(HWND_DESKTOP)) {1755 1756 RECTL rcl;1757 POINTL ptl;1758 1759 WinQueryPointerPos(HWND_DESKTOP, &ptl);1760 WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);1761 WinQueryWindowRect(hwnd, &rcl);1762 if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl))1763 BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);1750 (!hwndBubble || 1751 WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) && 1752 !WinQueryCapture(HWND_DESKTOP)) { 1753 1754 RECTL rcl; 1755 POINTL ptl; 1756 1757 WinQueryPointerPos(HWND_DESKTOP, &ptl); 1758 WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); 1759 WinQueryWindowRect(hwnd, &rcl); 1760 if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl)) 1761 BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1); 1764 1762 } 1765 1763 } … … 1780 1778 *szDrv = 0; 1781 1779 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1782 id + 50), sizeof(szDrv), szDrv);1780 id + 50), sizeof(szDrv), szDrv); 1783 1781 if (isalpha(*szDrv)) { 1784 1782 hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES); 1785 1783 if (hwndMenu) { 1786 BOOL rdy;1787 CHAR chDrv = *szDrv;1788 UINT iDrv;1789 1790 strcpy(szDrv + 2, "\\");1791 MakeValidDir(szDrv);1792 // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c1793 rdy = toupper(*szDrv) == toupper(chDrv);1794 iDrv = toupper(*szDrv) - 'A';1795 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE)1796 WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE);1797 1798 if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) {1799 WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE);1800 WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE);1801 WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE);1802 WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE);1803 }1804 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) {1805 WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE);1806 WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE);1807 WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE);1808 }1809 if (!rdy) {1810 WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE);1811 WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE);1812 WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE);1813 WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE);1814 WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE);1815 }1816 /* fixme to be gone?1817 if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) {1818 WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE);1819 }1820 */1821 PopupMenu(hwnd, hwnd, hwndMenu);1784 BOOL rdy; 1785 CHAR chDrv = *szDrv; 1786 UINT iDrv; 1787 1788 strcpy(szDrv + 2, "\\"); 1789 MakeValidDir(szDrv); 1790 // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c 1791 rdy = toupper(*szDrv) == toupper(chDrv); 1792 iDrv = toupper(*szDrv) - 'A'; 1793 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE) 1794 WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE); 1795 1796 if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) { 1797 WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE); 1798 WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE); 1799 WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE); 1800 WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE); 1801 } 1802 if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) { 1803 WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE); 1804 WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE); 1805 WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE); 1806 } 1807 if (!rdy) { 1808 WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE); 1809 WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE); 1810 WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE); 1811 WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE); 1812 WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE); 1813 } 1814 /* fixme to be gone? 1815 if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) { 1816 WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE); 1817 } 1818 */ 1819 PopupMenu(hwnd, hwnd, hwndMenu); 1822 1820 } 1823 1821 } … … 1834 1832 *szDrv = 0; 1835 1833 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1836 id + 50), sizeof(szDrv), szDrv);1834 id + 50), sizeof(szDrv), szDrv); 1837 1835 if (isalpha(*szDrv)) { 1838 1836 strcat(szDrv, "\\"); 1839 1837 if (!FindDirCnrByName(szDrv, TRUE)) 1840 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);1838 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv); 1841 1839 } 1842 1840 break; … … 1850 1848 *szDrv = 0; 1851 1849 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1852 id + 50), sizeof(szDrv), szDrv);1850 id + 50), sizeof(szDrv), szDrv); 1853 1851 if (isalpha(*szDrv)) { 1854 1852 strcat(szDrv, "\\"); … … 1861 1859 *szDrv = 0; 1862 1860 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1863 id + 50), sizeof(szDrv), szDrv);1861 id + 50), sizeof(szDrv), szDrv); 1864 1862 if (isalpha(*szDrv) && 1865 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {1863 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1866 1864 if (!emphasized) { 1867 emphasized = TRUE;1868 DrawTargetEmphasis(hwnd, emphasized);1865 emphasized = TRUE; 1866 DrawTargetEmphasis(hwnd, emphasized); 1869 1867 } 1870 1868 if (AcceptOneDrop(hwnd, mp1, mp2)) 1871 return MRFROM2SHORT(DOR_DROP, DO_MOVE);1869 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 1872 1870 return MRFROM2SHORT(DOR_NEVERDROP, 0); 1873 1871 } … … 1878 1876 *szDrv = 0; 1879 1877 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1880 id + 50), sizeof(szDrv), szDrv);1878 id + 50), sizeof(szDrv), szDrv); 1881 1879 if (isalpha(*szDrv) && 1882 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {1880 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1883 1881 if (emphasized) { 1884 emphasized = FALSE;1885 DrawTargetEmphasis(hwnd, emphasized);1882 emphasized = FALSE; 1883 DrawTargetEmphasis(hwnd, emphasized); 1886 1884 } 1887 1885 } … … 1892 1890 *szDrv = 0; 1893 1891 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1894 id + 50), sizeof(szDrv), szDrv);1892 id + 50), sizeof(szDrv), szDrv); 1895 1893 if (isalpha(*szDrv) && 1896 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {1894 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1897 1895 DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP)); 1898 1896 return 0; … … 1904 1902 *szDrv = 0; 1905 1903 WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 1906 id + 50), sizeof(szDrv), szDrv);1904 id + 50), sizeof(szDrv), szDrv); 1907 1905 if (isalpha(*szDrv) && 1908 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {1906 !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) { 1909 1907 1910 1908 CNRDRAGINFO cnd; … … 1913 1911 1914 1912 if (emphasized) { 1915 emphasized = FALSE;1916 DrawTargetEmphasis(hwnd, emphasized);1913 emphasized = FALSE; 1914 DrawTargetEmphasis(hwnd, emphasized); 1917 1915 } 1918 1916 memset(&cnd, 0, sizeof(cnd)); … … 1920 1918 cnd.pRecord = NULL; 1921 1919 li = DoFileDrop(hwnd, 1922 NULL,1923 TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd));1920 NULL, 1921 TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd)); 1924 1922 CheckPmDrgLimit(cnd.pDragInfo); 1925 1923 if (li) { 1926 strcpy(li->targetpath, szDrv);1927 strcat(li->targetpath, "\\");1928 if (li->list && li->list[0] && IsRoot(li->list[0]))1929 li->type = DO_LINK;1930 else if (fDragndropDlg && (!*li->arcname || !li->info)) {1931 1932 CHECKLIST cl;1933 1934 memset(&cl, 0, sizeof(cl));1935 cl.size = sizeof(cl);1936 cl.flags = li->type;1937 cl.list = li->list;1938 cl.cmd = li->type;1939 cl.prompt = li->targetpath;1940 li->type = WinDlgBox(HWND_DESKTOP,1941 hwndMain,1942 DropListProc,1943 FM3ModHandle, DND_FRAME, MPFROMP(&cl));1944 if (li->type == DID_ERROR)1945 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,1946 "Drag & Drop Dialog");1947 if (!li->type) {1948 FreeListInfo(li);1949 return 0;1950 }1951 li->list = cl.list;1952 if (!li->list || !li->list[0]) {1953 FreeListInfo(li);1954 return 0;1955 }1956 }1957 else {1958 if (!WinDlgBox(HWND_DESKTOP,1959 hwndMain,1960 WalkDlgProc,1961 FM3ModHandle,1962 WALK_FRAME,1963 MPFROMP(li->targetpath)) || !*li->targetpath) {1964 FreeListInfo(li);1965 return 0;1966 }1967 }1968 switch (li->type) {1969 case DND_LAUNCH:1970 strcat(li->targetpath, " %a");1971 ExecOnList(hwndMain,1972 li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL,1973 pszSrcFile, __LINE__);1974 FreeList(li->list);1975 li->list = NULL;1976 break;1977 case DO_LINK:1978 if (fLinkSetsIcon) {1979 li->type = IDM_SETICON;1980 action = UM_MASSACTION;1981 }1982 else1983 li->type = IDM_COMPARE;1984 break;1985 case DND_EXTRACT:1986 if (*li->targetpath && !IsFile(li->targetpath))1987 li->type = IDM_EXTRACT;1988 break;1989 case DND_MOVE:1990 li->type = IDM_MOVE;1991 if (*li->targetpath && IsFile(li->targetpath) == 1) {1992 action = UM_MASSACTION;1993 li->type = IDM_ARCHIVEM;1994 }1995 break;1996 case DND_WILDMOVE:1997 li->type = IDM_WILDMOVE;1998 if (*li->targetpath && IsFile(li->targetpath) == 1) {1999 action = UM_MASSACTION;2000 li->type = IDM_ARCHIVEM;2001 }2002 break;2003 case DND_OBJECT:2004 li->type = IDM_OBJECT;2005 action = UM_MASSACTION;2006 break;2007 case DND_SHADOW:2008 li->type = IDM_SHADOW;2009 action = UM_MASSACTION;2010 break;2011 case DND_COMPARE:2012 li->type = IDM_COMPARE;2013 break;2014 case DND_SETICON:2015 action = UM_MASSACTION;2016 li->type = IDM_SETICON;2017 break;2018 case DND_COPY:2019 li->type = IDM_COPY;2020 if (*li->targetpath && IsFile(li->targetpath) == 1) {2021 action = UM_MASSACTION;2022 li->type = IDM_ARCHIVE;2023 }2024 break;2025 case DND_WILDCOPY:2026 li->type = IDM_WILDCOPY;2027 if (*li->targetpath && IsFile(li->targetpath) == 1) {2028 action = UM_MASSACTION;2029 li->type = IDM_ARCHIVE;2030 }2031 break;2032 default:2033 if (*li->arcname && li->info) {2034 action = UM_MASSACTION;2035 li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM :2036 IDM_FAKEEXTRACT;2037 }2038 else if (*li->targetpath && IsFile(li->targetpath) == 1) {2039 action = UM_MASSACTION;2040 li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;2041 }2042 else2043 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;2044 break;2045 }2046 if (!li->list || !li->list[0])2047 FreeListInfo(li);2048 else2049 WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));1924 strcpy(li->targetpath, szDrv); 1925 strcat(li->targetpath, "\\"); 1926 if (li->list && li->list[0] && IsRoot(li->list[0])) 1927 li->type = DO_LINK; 1928 else if (fDragndropDlg && (!*li->arcname || !li->info)) { 1929 1930 CHECKLIST cl; 1931 1932 memset(&cl, 0, sizeof(cl)); 1933 cl.size = sizeof(cl); 1934 cl.flags = li->type; 1935 cl.list = li->list; 1936 cl.cmd = li->type; 1937 cl.prompt = li->targetpath; 1938 li->type = WinDlgBox(HWND_DESKTOP, 1939 hwndMain, 1940 DropListProc, 1941 FM3ModHandle, DND_FRAME, MPFROMP(&cl)); 1942 if (li->type == DID_ERROR) 1943 Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__, 1944 "Drag & Drop Dialog"); 1945 if (!li->type) { 1946 FreeListInfo(li); 1947 return 0; 1948 } 1949 li->list = cl.list; 1950 if (!li->list || !li->list[0]) { 1951 FreeListInfo(li); 1952 return 0; 1953 } 1954 } 1955 else { 1956 if (!WinDlgBox(HWND_DESKTOP, 1957 hwndMain, 1958 WalkDlgProc, 1959 FM3ModHandle, 1960 WALK_FRAME, 1961 MPFROMP(li->targetpath)) || !*li->targetpath) { 1962 FreeListInfo(li); 1963 return 0; 1964 } 1965 } 1966 switch (li->type) { 1967 case DND_LAUNCH: 1968 strcat(li->targetpath, " %a"); 1969 ExecOnList(hwndMain, 1970 li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL, 1971 pszSrcFile, __LINE__); 1972 FreeList(li->list); 1973 li->list = NULL; 1974 break; 1975 case DO_LINK: 1976 if (fLinkSetsIcon) { 1977 li->type = IDM_SETICON; 1978 action = UM_MASSACTION; 1979 } 1980 else 1981 li->type = IDM_COMPARE; 1982 break; 1983 case DND_EXTRACT: 1984 if (*li->targetpath && !IsFile(li->targetpath)) 1985 li->type = IDM_EXTRACT; 1986 break; 1987 case DND_MOVE: 1988 li->type = IDM_MOVE; 1989 if (*li->targetpath && IsFile(li->targetpath) == 1) { 1990 action = UM_MASSACTION; 1991 li->type = IDM_ARCHIVEM; 1992 } 1993 break; 1994 case DND_WILDMOVE: 1995 li->type = IDM_WILDMOVE; 1996 if (*li->targetpath && IsFile(li->targetpath) == 1) { 1997 action = UM_MASSACTION; 1998 li->type = IDM_ARCHIVEM; 1999 } 2000 break; 2001 case DND_OBJECT: 2002 li->type = IDM_OBJECT; 2003 action = UM_MASSACTION; 2004 break; 2005 case DND_SHADOW: 2006 li->type = IDM_SHADOW; 2007 action = UM_MASSACTION; 2008 break; 2009 case DND_COMPARE: 2010 li->type = IDM_COMPARE; 2011 break; 2012 case DND_SETICON: 2013 action = UM_MASSACTION; 2014 li->type = IDM_SETICON; 2015 break; 2016 case DND_COPY: 2017 li->type = IDM_COPY; 2018 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2019 action = UM_MASSACTION; 2020 li->type = IDM_ARCHIVE; 2021 } 2022 break; 2023 case DND_WILDCOPY: 2024 li->type = IDM_WILDCOPY; 2025 if (*li->targetpath && IsFile(li->targetpath) == 1) { 2026 action = UM_MASSACTION; 2027 li->type = IDM_ARCHIVE; 2028 } 2029 break; 2030 default: 2031 if (*li->arcname && li->info) { 2032 action = UM_MASSACTION; 2033 li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM : 2034 IDM_FAKEEXTRACT; 2035 } 2036 else if (*li->targetpath && IsFile(li->targetpath) == 1) { 2037 action = UM_MASSACTION; 2038 li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE; 2039 } 2040 else 2041 li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY; 2042 break; 2043 } 2044 if (!li->list || !li->list[0]) 2045 FreeListInfo(li); 2046 else 2047 WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action)); 2050 2048 } 2051 2049 return 0; … … 2081 2079 for (x = 0; x < 26; x++) { 2082 2080 if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) { 2083 if (x > 1) {2084 if (driveflags[x] & DRIVE_CDROM)2085 iconid = CDROM_ICON;2086 else2087 iconid = (driveflags[x] & DRIVE_REMOVABLE) ?2088 REMOVABLE_ICON :2089 (driveflags[x] & DRIVE_VIRTUAL) ?2090 VIRTUAL_ICON :2091 (driveflags[x] & DRIVE_REMOTE) ?2092 REMOTE_ICON :2093 (driveflags[x] & DRIVE_RAMDISK) ?2094 RAMDISK_ICON :2095 (driveflags[x] & DRIVE_ZIPSTREAM) ?2096 ZIPSTREAM_ICON :DRIVE_ICON;2097 }2098 else2099 iconid = FLOPPY_ICON;2100 sprintf(s, "#%lu", iconid);2101 hwndB = WinCreateWindow(hwndT,2102 WC_DRIVEBUTTONS,2103 s,2104 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,2105 0,2106 0,2107 28,2108 18,2109 hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL);2110 if (!hwndB)2111 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,2112 IDS_WINCREATEWINDOW);2113 else {2114 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);2115 sprintf(s, "%c:", (CHAR) x + 'A');2116 hwndB = WinCreateWindow(hwndT,2117 WC_STATIC,2118 s,2119 SS_TEXT | DT_LEFT | DT_VCENTER,2120 0,2121 0,2122 10,2123 18,2124 hwndT,2125 HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL);2126 if (!hwndB)2127 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,2128 IDS_WINCREATEWINDOW);2129 else {2130 SetPresParams(hwndB,2131 &RGBGREY,2132 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));2133 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);2134 }2135 y++;2136 }2081 if (x > 1) { 2082 if (driveflags[x] & DRIVE_CDROM) 2083 iconid = CDROM_ICON; 2084 else 2085 iconid = (driveflags[x] & DRIVE_REMOVABLE) ? 2086 REMOVABLE_ICON : 2087 (driveflags[x] & DRIVE_VIRTUAL) ? 2088 VIRTUAL_ICON : 2089 (driveflags[x] & DRIVE_REMOTE) ? 2090 REMOTE_ICON : 2091 (driveflags[x] & DRIVE_RAMDISK) ? 2092 RAMDISK_ICON : 2093 (driveflags[x] & DRIVE_ZIPSTREAM) ? 2094 ZIPSTREAM_ICON :DRIVE_ICON; 2095 } 2096 else 2097 iconid = FLOPPY_ICON; 2098 sprintf(s, "#%lu", iconid); 2099 hwndB = WinCreateWindow(hwndT, 2100 WC_DRIVEBUTTONS, 2101 s, 2102 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 2103 0, 2104 0, 2105 28, 2106 18, 2107 hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL); 2108 if (!hwndB) 2109 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 2110 IDS_WINCREATEWINDOW); 2111 else { 2112 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); 2113 sprintf(s, "%c:", (CHAR) x + 'A'); 2114 hwndB = WinCreateWindow(hwndT, 2115 WC_STATIC, 2116 s, 2117 SS_TEXT | DT_LEFT | DT_VCENTER, 2118 0, 2119 0, 2120 10, 2121 18, 2122 hwndT, 2123 HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL); 2124 if (!hwndB) 2125 Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__, 2126 IDS_WINCREATEWINDOW); 2127 else { 2128 SetPresParams(hwndB, 2129 &RGBGREY, 2130 &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT)); 2131 WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER); 2132 } 2133 y++; 2134 } 2137 2135 } 2138 2136 } // for 2139 2137 } // if drivebar 2140 2138 PostMsg(WinQueryWindow(hwndT, QW_PARENT), 2141 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);2139 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2142 2140 } 2143 2141 … … 2155 2153 WinQueryWindowRect(hwndT, &rcl); 2156 2154 xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP, 2157 SV_CYSIZEBORDER) * 2) + 2);2155 SV_CYSIZEBORDER) * 2) + 2); 2158 2156 } 2159 2157 henum = WinBeginEnumWindows(hwndT); … … 2164 2162 ctrlxsize = 28; 2165 2163 WinSetWindowPos(hwndB, 2166 HWND_TOP,2167 ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW);2164 HWND_TOP, 2165 ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW); 2168 2166 ctrlxpos += (ctrlxsize + 2); 2169 2167 if (ctrlxsize == 10) { 2170 2168 if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ? 2171 256 : 0)) > xwidth) {2172 ctrlxpos = 2;2173 ctrlypos += 18;2174 DriveLines++;2169 256 : 0)) > xwidth) { 2170 ctrlxpos = 2; 2171 ctrlypos += 18; 2172 DriveLines++; 2175 2173 } 2176 2174 } … … 2191 2189 2192 2190 SetPresParams(hwnd, 2193 &RGBGREY,2194 &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT));2191 &RGBGREY, 2192 &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT)); 2195 2193 return mr; 2196 2194 } … … 2202 2200 2203 2201 cbRetLen = WinQueryPresParam(hwnd, 2204 (ULONG) mp1,2205 0,2206 &AttrFound,2207 (ULONG) sizeof(AttrValue), &AttrValue, 0);2202 (ULONG) mp1, 2203 0, 2204 &AttrFound, 2205 (ULONG) sizeof(AttrValue), &AttrValue, 0); 2208 2206 if (cbRetLen) { 2209 //switch (AttrFound) { 2210 //case PP_FONTNAMESIZE: 2211 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2212 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2213 // JBS2 break; 2214 2207 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2208 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 2215 2209 } 2216 2210 } … … 2229 2223 WinQueryWindowPos(hwndTree, &swp); 2230 2224 if (!(swp.fl & SWP_MAXIMIZE)) 2231 fl |= SWP_RESTORE;2225 fl |= SWP_RESTORE; 2232 2226 WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl); 2233 2227 } … … 2262 2256 2263 2257 if (fOtherHelp) { 2264 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)2265 && !WinQueryCapture(HWND_DESKTOP)) {2266 switch (id) {2267 case IDM_ATTRS:2268 if (WinQueryWindowTextLength(hwnd))2269 s = GetPString(IDS_ATTRSBUTTONHELP);2270 break;2271 case IDM_INFO:2272 if (WinQueryWindowTextLength(hwnd))2273 s = GetPString(IDS_INFOBUTTONHELP);2274 break;2275 case IDM_RENAME:2276 if (WinQueryWindowTextLength(hwnd))2277 s = GetPString(IDS_NAMEBUTTONHELP);2278 break;2279 case MAIN_STATUS2:2280 if (!hwndE)2281 s = GetPString(IDS_STATUS2HELP);2282 break;2283 default:2284 break;2285 }2286 if (s)2287 MakeBubble(hwnd, FALSE, s);2288 else if (hwndBubble)2289 WinDestroyWindow(hwndBubble);2290 }2258 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 2259 && !WinQueryCapture(HWND_DESKTOP)) { 2260 switch (id) { 2261 case IDM_ATTRS: 2262 if (WinQueryWindowTextLength(hwnd)) 2263 s = GetPString(IDS_ATTRSBUTTONHELP); 2264 break; 2265 case IDM_INFO: 2266 if (WinQueryWindowTextLength(hwnd)) 2267 s = GetPString(IDS_INFOBUTTONHELP); 2268 break; 2269 case IDM_RENAME: 2270 if (WinQueryWindowTextLength(hwnd)) 2271 s = GetPString(IDS_NAMEBUTTONHELP); 2272 break; 2273 case MAIN_STATUS2: 2274 if (!hwndE) 2275 s = GetPString(IDS_STATUS2HELP); 2276 break; 2277 default: 2278 break; 2279 } 2280 if (s) 2281 MakeBubble(hwnd, FALSE, s); 2282 else if (hwndBubble) 2283 WinDestroyWindow(hwndBubble); 2284 } 2291 2285 } 2292 2286 switch (id) { … … 2295 2289 case IDM_RENAME: 2296 2290 case MAIN_STATUS2: 2297 return CommonTextProc(hwnd, msg, mp1, mp2);2291 return CommonTextProc(hwnd, msg, mp1, mp2); 2298 2292 default: 2299 break;2293 break; 2300 2294 } 2301 2295 } … … 2320 2314 case IDM_RENAME: 2321 2315 case MAIN_STATUS2: 2322 return CommonTextButton(hwnd, msg, mp1, mp2);2316 return CommonTextButton(hwnd, msg, mp1, mp2); 2323 2317 default: 2324 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);2325 break;2318 PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID); 2319 break; 2326 2320 } 2327 2321 } … … 2335 2329 id = WinQueryWindowUShort(hwnd, QWS_ID); 2336 2330 if (id == MAIN_STATUS2 && hwndE) 2337 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);2331 WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 2338 2332 else 2339 return CommonTextButton(hwnd, msg, mp1, mp2);2333 return CommonTextButton(hwnd, msg, mp1, mp2); 2340 2334 } 2341 2335 break; … … 2347 2341 id = WinQueryWindowUShort(hwnd, QWS_ID); 2348 2342 if (id == MAIN_STATUS) { 2349 if (SHORT2FROMMP(mp2) & KC_CTRL)2350 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),2351 FID_CLIENT),2352 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);2353 else if (hwndTree)2354 PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID);2343 if (SHORT2FROMMP(mp2) & KC_CTRL) 2344 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2345 FID_CLIENT), 2346 WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID); 2347 else if (hwndTree) 2348 PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID); 2355 2349 } 2356 2350 } … … 2365 2359 if (id == MAIN_STATUS2 && !hwndE) { 2366 2360 2367 SWP swp;2368 CHAR directory[CCHMAXPATH];2369 PFNWP oldproce;2370 2371 *directory = 0;2372 TopWindowName(hwndMain, (HWND) 0, directory);2373 WinQueryWindowPos(hwnd, &swp);2374 hwndB = WinCreateWindow(hwnd,2375 WC_BUTTON,2376 "+",2377 WS_VISIBLE | BS_PUSHBUTTON |2378 BS_NOPOINTERFOCUS,2379 swp.cx - swp.cy,2380 0,2381 swp.cy,2382 swp.cy,2383 hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL);2384 if (!hwndB)2385 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);2386 hwndE = WinCreateWindow(hwnd,2387 WC_ENTRYFIELD,2388 NULL,2389 WS_VISIBLE | ES_AUTOSCROLL,2390 0,2391 0,2392 swp.cx - swp.cy,2393 swp.cy,2394 hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL);2395 if (!hwndE)2396 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);2397 if (!hwndE || !hwndB) {2398 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);2399 return 0;2400 }2401 WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID);2402 WinSetWindowText(hwndStatus, directory);2403 if (*lastcmd)2404 WinSetWindowText(hwndE, lastcmd);2405 else2406 WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT));2407 oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc);2408 if (oldproce)2409 WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce);2410 PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID);2411 PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);2412 return 0;2361 SWP swp; 2362 CHAR directory[CCHMAXPATH]; 2363 PFNWP oldproce; 2364 2365 *directory = 0; 2366 TopWindowName(hwndMain, (HWND) 0, directory); 2367 WinQueryWindowPos(hwnd, &swp); 2368 hwndB = WinCreateWindow(hwnd, 2369 WC_BUTTON, 2370 "+", 2371 WS_VISIBLE | BS_PUSHBUTTON | 2372 BS_NOPOINTERFOCUS, 2373 swp.cx - swp.cy, 2374 0, 2375 swp.cy, 2376 swp.cy, 2377 hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL); 2378 if (!hwndB) 2379 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 2380 hwndE = WinCreateWindow(hwnd, 2381 WC_ENTRYFIELD, 2382 NULL, 2383 WS_VISIBLE | ES_AUTOSCROLL, 2384 0, 2385 0, 2386 swp.cx - swp.cy, 2387 swp.cy, 2388 hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL); 2389 if (!hwndE) 2390 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 2391 if (!hwndE || !hwndB) { 2392 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 2393 return 0; 2394 } 2395 WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID); 2396 WinSetWindowText(hwndStatus, directory); 2397 if (*lastcmd) 2398 WinSetWindowText(hwndE, lastcmd); 2399 else 2400 WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT)); 2401 oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc); 2402 if (oldproce) 2403 WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce); 2404 PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID); 2405 PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID); 2406 return 0; 2413 2407 } 2414 2408 if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) { 2415 switch (id) {2416 case IDM_ATTRS:2417 id = IDM_SORTSIZE;2418 break;2419 case IDM_INFO:2420 id = IDM_SORTLWDATE;2421 break;2422 case IDM_RENAME:2423 id = IDM_SORTFILENAME;2424 break;2425 }2409 switch (id) { 2410 case IDM_ATTRS: 2411 id = IDM_SORTSIZE; 2412 break; 2413 case IDM_INFO: 2414 id = IDM_SORTLWDATE; 2415 break; 2416 case IDM_RENAME: 2417 id = IDM_SORTFILENAME; 2418 break; 2419 } 2426 2420 } 2427 2421 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 2428 WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID);2422 WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID); 2429 2423 } 2430 2424 return 0; … … 2440 2434 case IDM_RENAME: 2441 2435 case MAIN_STATUS2: 2442 PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);2443 break;2436 PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE); 2437 break; 2444 2438 default: 2445 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE);2446 break;2439 PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE); 2440 break; 2447 2441 } 2448 2442 if (id == IDM_RENAME) { 2449 2443 2450 HPS hps;2451 2452 hps = WinBeginPaint(hwnd, (HPS) 0, NULL);2453 if (hps) {2454 PaintSTextWindow(hwnd, hps);2455 WinEndPaint(hps);2456 }2457 return 0;2444 HPS hps; 2445 2446 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 2447 if (hps) { 2448 PaintSTextWindow(hwnd, hps); 2449 WinEndPaint(hps); 2450 } 2451 return 0; 2458 2452 } 2459 2453 } … … 2488 2482 case UM_COMMAND: 2489 2483 return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2490 FID_CLIENT), msg, mp1, mp2);2484 FID_CLIENT), msg, mp1, mp2); 2491 2485 2492 2486 case WM_PAINT: … … 2501 2495 hps = WinBeginPaint(hwnd, (HPS)0, NULL); 2502 2496 if (hps) { 2503 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);2504 WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL,2505 sizeof(lColor), &lColor, 0);2506 WinQueryWindowRect(hwnd, &rcl);2507 WinFillRect(hps, &rcl, lColor);2508 WinEndPaint(hps);2497 GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL); 2498 WinQueryPresParam(hwnd, PP_BACKGROUNDCOLOR, 0, NULL, 2499 sizeof(lColor), &lColor, 0); 2500 WinQueryWindowRect(hwnd, &rcl); 2501 WinFillRect(hps, &rcl, lColor); 2502 WinEndPaint(hps); 2509 2503 } 2510 2504 … … 2524 2518 tool = find_tool(id); 2525 2519 if (tool) { 2526 del_tool(tool);2527 WinShowWindow(WinWindowFromID(hwnd, id), FALSE);2528 if (fToolTitles)2529 WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE);2530 ResizeTools(hwnd);2520 del_tool(tool); 2521 WinShowWindow(WinWindowFromID(hwnd, id), FALSE); 2522 if (fToolTitles) 2523 WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE); 2524 ResizeTools(hwnd); 2531 2525 } 2532 2526 } … … 2538 2532 2539 2533 id = (USHORT) WinDlgBox(HWND_DESKTOP, 2540 hwnd,2541 AddToolProc,2542 FM3ModHandle, ADDBTN_FRAME, MPVOID);2534 hwnd, 2535 AddToolProc, 2536 FM3ModHandle, ADDBTN_FRAME, MPVOID); 2543 2537 if (id && id != (USHORT) - 1) 2544 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),2545 FID_CLIENT),2546 WM_COMMAND,2547 MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0));2538 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 2539 FID_CLIENT), 2540 WM_COMMAND, 2541 MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0)); 2548 2542 } 2549 2543 break; … … 2551 2545 case WM_CONTEXTMENU: 2552 2546 if (WinDlgBox(HWND_DESKTOP, 2553 hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID))2547 hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID)) 2554 2548 BuildTools(hwnd, TRUE); 2555 2549 return MRFROMSHORT(TRUE); … … 2574 2568 if (pswp) { 2575 2569 if (WinQueryWindowPos(hwndTree, &swp) && 2576 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) {2570 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) { 2577 2571 pswp->x = swp.cx; 2578 2572 pswp->cx -= swp.cx; … … 2581 2575 if (prectl) { 2582 2576 if (WinQueryWindowPos(hwndTree, &swp) && 2583 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) &&2584 WinQueryWindowRect(hwndTree, &rectl)) {2577 !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) && 2578 WinQueryWindowRect(hwndTree, &rectl)) { 2585 2579 prectl->xLeft = rectl.xRight; 2586 2580 prectl->xRight -= rectl.xRight; … … 2634 2628 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 2635 2629 if (swp.x < swpT.cx) { 2636 swp.x = swpT.cx;2637 if (swp.x + swp.cx > swpC.cx)2638 swp.cx = swpC.cx - swp.x;2639 if (swp.cx > 24)2640 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,2641 SWP_SIZE | SWP_MOVE | SWP_SHOW);2630 swp.x = swpT.cx; 2631 if (swp.x + swp.cx > swpC.cx) 2632 swp.cx = swpC.cx - swp.x; 2633 if (swp.cx > 24) 2634 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 2635 SWP_SIZE | SWP_MOVE | SWP_SHOW); 2642 2636 } 2643 2637 } … … 2659 2653 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1); 2660 2654 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, 2661 SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE);2655 SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE); 2662 2656 } 2663 2657 } … … 2681 2675 if (hwndNext) { 2682 2676 if (!WinQueryWindowUShort(hwndNext, QWS_ID)) 2683 continue;2677 continue; 2684 2678 if (next) 2685 break;2679 break; 2686 2680 if (hwndNext == hwndActive) { 2687 if (!previous && hwndPrev) {2688 hwndNext = hwndPrev;2689 break;2690 }2691 else if (previous)2692 next = TRUE;2681 if (!previous && hwndPrev) { 2682 hwndNext = hwndPrev; 2683 break; 2684 } 2685 else if (previous) 2686 next = TRUE; 2693 2687 } 2694 2688 hwndPrev = hwndNext; … … 2696 2690 else { 2697 2691 if ((!next && previous) || once) 2698 break;2692 break; 2699 2693 else if (!previous) { 2700 hwndNext = hwndPrev;2701 break;2694 hwndNext = hwndPrev; 2695 break; 2702 2696 } 2703 2697 else 2704 once = next = TRUE;2698 once = next = TRUE; 2705 2699 } 2706 2700 } … … 2709 2703 if (hwndNext && hwndNext != hwndActive) { 2710 2704 WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0, 2711 SWP_ZORDER | SWP_ACTIVATE);2705 SWP_ZORDER | SWP_ACTIVATE); 2712 2706 WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0, 2713 0, 0, SWP_ZORDER);2707 0, 0, SWP_ZORDER); 2714 2708 } 2715 2709 } … … 2726 2720 if (hwndChild != hwndTree) { 2727 2721 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2728 WM_SAVEAPPLICATION, MPVOID, MPVOID);2722 WM_SAVEAPPLICATION, MPVOID, MPVOID); 2729 2723 if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2730 WM_CLOSE, MPVOID, MPVOID)) {2731 ret = TRUE;2732 break;2724 WM_CLOSE, MPVOID, MPVOID)) { 2725 ret = TRUE; 2726 break; 2733 2727 } 2734 2728 } … … 2753 2747 hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT); 2754 2748 if (hwndTemp) { 2755 hwndDir = WinWindowFromID(hwndTemp, DIR_CNR);2756 if (hwndDir) {2757 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),2758 WM_CLOSE, MPVOID, MPVOID);2759 ret = TRUE;2760 }2749 hwndDir = WinWindowFromID(hwndTemp, DIR_CNR); 2750 if (hwndDir) { 2751 WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT), 2752 WM_CLOSE, MPVOID, MPVOID); 2753 ret = TRUE; 2754 } 2761 2755 } 2762 2756 } … … 2775 2769 2776 2770 #define STATE_NAME_MAX_BYTES 256 2771 #define FM2_STATE_AT_CLOSE "LastClose" 2777 2772 2778 2773 INT SaveDirCnrState(HWND hwndClient, PSZ pszStateName) … … 2787 2782 INT nSaved = 0; 2788 2783 DIRCNRDATA *dcd; 2789 2790 if (!pszStateName) 2791 strcpy(szPrefix, NullStr); 2792 else { 2793 if (strlen(pszStateName) > sizeof(szPrefix) - 2) { 2794 Runtime_Error(pszSrcFile, __LINE__, "SaveDirCnrState"); 2784 BOOL fIsShutDownState; 2785 2786 if (!pszStateName || !*pszStateName) { 2787 Runtime_Error(pszSrcFile, __LINE__, "no data"); 2795 2788 return -1; 2796 }2797 sprintf(szPrefix, "%s.", pszStateName);2798 2789 } 2790 if (strlen(pszStateName) > sizeof(szPrefix) - 2) { 2791 Runtime_Error(pszSrcFile, __LINE__, "SaveDirCnrState"); 2792 return -1; 2793 } 2794 2795 fIsShutDownState = strcmp(pszStateName, FM2_STATE_AT_CLOSE) == 0; 2796 sprintf(szPrefix, "%s.", pszStateName); 2799 2797 2800 2798 henum = WinBeginEnumWindows(hwndClient); … … 2803 2801 hwndC = WinWindowFromID(hwndChild, FID_CLIENT); 2804 2802 if (hwndC) { 2805 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 2806 if (hwndDir) { 2807 WinQueryWindowPos(hwndChild, &swp); 2808 *szDir = 0; 2809 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID); 2810 if (*szDir) { 2811 if (driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) 2812 continue; 2813 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves); 2814 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, 2815 sizeof(SWP)); 2816 dcd = 2817 WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER); 2818 if (dcd) { 2819 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves); 2820 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags, 2821 sizeof(INT)); 2822 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves); 2823 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask, 2824 sizeof(MASK)); 2825 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves); 2826 flWindowAttr = dcd->flWindowAttr; 2827 if (!fLeaveTree && (flWindowAttr & CV_TREE)) { 2828 flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT)); 2829 if (dcd->lastattr) { 2830 if (dcd->lastattr & CV_TEXT) 2831 flWindowAttr |= CV_TEXT; 2832 else if (dcd->lastattr & CV_DETAIL) 2833 flWindowAttr |= CV_DETAIL; 2834 else if (dcd->lastattr & CV_ICON) 2835 flWindowAttr |= CV_ICON; 2836 else 2837 flWindowAttr |= CV_NAME; 2838 } 2839 else 2840 flWindowAttr |= CV_NAME; 2841 } 2842 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr, 2843 sizeof(ULONG)); 2844 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves); 2845 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslongname, 2846 sizeof(BOOL)); 2847 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves); 2848 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssubject, 2849 sizeof(BOOL)); 2850 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves); 2851 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssize, 2852 sizeof(BOOL)); 2853 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves); 2854 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsea, 2855 sizeof(BOOL)); 2856 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves); 2857 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsattr, 2858 sizeof(BOOL)); 2859 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves); 2860 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsicon, 2861 sizeof(BOOL)); 2862 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves); 2863 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwdate, 2864 sizeof(BOOL)); 2865 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves); 2866 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwtime, 2867 sizeof(BOOL)); 2868 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves); 2869 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsladate, 2870 sizeof(BOOL)); 2871 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves); 2872 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslatime, 2873 sizeof(BOOL)); 2874 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves); 2875 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrdate, 2876 sizeof(BOOL)); 2877 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves); 2878 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrtime, 2879 sizeof(BOOL)); 2880 sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves); 2881 SavePresParams(hwndDir, szKey); 2882 } 2883 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++); 2884 PrfWriteProfileString(fmprof, FM3Str, szKey, szDir); 2885 nSaved++; 2886 } 2887 } 2803 hwndDir = WinWindowFromID(hwndC, DIR_CNR); 2804 if (hwndDir) { 2805 WinQueryWindowPos(hwndChild, &swp); 2806 *szDir = 0; 2807 WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID); 2808 if (*szDir) { 2809 // If saving shutdown state skip no prescan drives 2810 if (fIsShutDownState && 2811 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 2812 continue; 2813 } 2814 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves); 2815 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, 2816 sizeof(SWP)); 2817 dcd = 2818 WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER); 2819 if (dcd) { 2820 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves); 2821 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags, 2822 sizeof(INT)); 2823 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves); 2824 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask, 2825 sizeof(MASK)); 2826 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves); 2827 flWindowAttr = dcd->flWindowAttr; 2828 if (!fLeaveTree && (flWindowAttr & CV_TREE)) { 2829 flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT)); 2830 if (dcd->lastattr) { 2831 if (dcd->lastattr & CV_TEXT) 2832 flWindowAttr |= CV_TEXT; 2833 else if (dcd->lastattr & CV_DETAIL) 2834 flWindowAttr |= CV_DETAIL; 2835 else if (dcd->lastattr & CV_ICON) 2836 flWindowAttr |= CV_ICON; 2837 else 2838 flWindowAttr |= CV_NAME; 2839 } 2840 else 2841 flWindowAttr |= CV_NAME; 2842 } 2843 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr, 2844 sizeof(ULONG)); 2845 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves); 2846 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslongname, 2847 sizeof(BOOL)); 2848 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, numsaves); 2849 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssubject, 2850 sizeof(BOOL)); 2851 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, numsaves); 2852 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailssize, 2853 sizeof(BOOL)); 2854 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, numsaves); 2855 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsea, 2856 sizeof(BOOL)); 2857 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, numsaves); 2858 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsattr, 2859 sizeof(BOOL)); 2860 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, numsaves); 2861 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsicon, 2862 sizeof(BOOL)); 2863 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, numsaves); 2864 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwdate, 2865 sizeof(BOOL)); 2866 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, numsaves); 2867 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslwtime, 2868 sizeof(BOOL)); 2869 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, numsaves); 2870 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailsladate, 2871 sizeof(BOOL)); 2872 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, numsaves); 2873 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslatime, 2874 sizeof(BOOL)); 2875 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, numsaves); 2876 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrdate, 2877 sizeof(BOOL)); 2878 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, numsaves); 2879 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailscrtime, 2880 sizeof(BOOL)); 2881 sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves); 2882 SavePresParams(hwndDir, szKey); 2883 } 2884 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++); 2885 PrfWriteProfileString(fmprof, FM3Str, szKey, szDir); 2886 nSaved++; 2887 } 2888 } 2888 2889 } 2889 2890 } … … 2927 2928 if (hwnd) { 2928 2929 if (WinQueryWindowPos(hwnd, &swp)) { 2929 if (pswp->x > swp.cx)2930 pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx;2931 if (pswp->y > swp.cy)2932 pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy;2933 if (pswp->x + pswp->cx > swp.cx)2934 pswp->cx = swp.cx - pswp->x;2935 if (pswp->y + pswp->cy > swp.cy)2936 pswp->cy = swp.cy - pswp->y;2930 if (pswp->x > swp.cx) 2931 pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx; 2932 if (pswp->y > swp.cy) 2933 pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy; 2934 if (pswp->x + pswp->cx > swp.cx) 2935 pswp->cx = swp.cx - pswp->x; 2936 if (pswp->y + pswp->cy > swp.cy) 2937 pswp->cy = swp.cy - pswp->y; 2937 2938 } 2938 2939 } … … 2943 2944 * @param hwndClient Client window handle 2944 2945 * @param pszStateName State name to restore, NULL to restore global state 2946 * @param noview request view state restore bypass 2945 2947 * @returns TRUE if one or more directory containers were opened 2946 2948 * @seealso SaveDirCnrState … … 2954 2956 HWND hwndDir, hwndC; 2955 2957 SWP swp, swpO, swpN; 2956 ULONG size, numsaves = 0 L, x;2958 ULONG size, numsaves = 0, x; 2957 2959 double xtrans, ytrans; 2958 2960 BOOL fRestored = FALSE; 2959 2961 DIRCNRDATA localdcd, *dcd; 2960 2961 if (!pszStateName) 2962 strcpy(szPrefix, NullStr); 2963 else { 2964 if (strlen(pszStateName) > sizeof(szPrefix) - 2) { 2965 Runtime_Error(pszSrcFile, __LINE__, "RestoreDirCnrState"); 2966 return fRestored; 2967 } 2968 sprintf(szPrefix, "%s.", pszStateName); 2962 BOOL fIsShutDownState; 2963 2964 if (!pszStateName || !*pszStateName) { 2965 Runtime_Error(pszSrcFile, __LINE__, "no name"); 2966 return fRestored; 2969 2967 } 2968 if (strlen(pszStateName) > sizeof(szPrefix) - 2) { 2969 Runtime_Error(pszSrcFile, __LINE__, "name too long"); 2970 return fRestored; 2971 } 2972 2973 sprintf(szPrefix, "%s.", pszStateName); 2974 fIsShutDownState = strcmp(pszStateName, FM2_STATE_AT_CLOSE) == 0; 2975 2970 2976 2971 2977 size = sizeof(SWP); 2972 2978 sprintf(szKey, "%sMySizeLastTime", szPrefix); 2973 2979 if (!PrfQueryProfileData(fmprof, 2974 FM3Str,2975 szKey,2976 (PVOID) & swpO,2977 &size) ||2980 FM3Str, 2981 szKey, 2982 (PVOID) & swpO, 2983 &size) || 2978 2984 size != sizeof(SWP) || !swp.cx || !swp.cy) 2979 2985 { 2980 2986 WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpO); 2981 2987 } 2982 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 2988 // If restoring saved shutdown state, forget info 2989 if (fIsShutDownState) 2983 2990 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2984 2991 WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpN); … … 2990 2997 sprintf(szKey, "%sLastTreePos", szPrefix); 2991 2998 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, &size)) { 2992 if ( !pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))2999 if (fIsShutDownState) 2993 3000 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2994 3001 swp.hwnd = hwndTree; … … 3002 3009 swp.fl &= (~SWP_ACTIVATE); 3003 3010 WinSetWindowPos(hwndTree, 3004 HWND_TOP,3005 swp.x,3006 swp.y,3007 swp.cx,3008 swp.cy,3009 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);3011 HWND_TOP, 3012 swp.x, 3013 swp.y, 3014 swp.cx, 3015 swp.cy, 3016 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 3010 3017 } 3011 3018 else { 3012 3019 WinSetWindowPos(hwndTree, 3013 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);3020 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3014 3021 WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x); 3015 3022 WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx); … … 3021 3028 sprintf(szKey, "%sNumDirsLastTime", szPrefix); 3022 3029 if (PrfQueryProfileData(fmprof, 3023 FM3Str, szKey, (PVOID) & numsaves, &size) && numsaves) {3024 if ( !pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))3030 FM3Str, szKey, (PVOID) & numsaves, &size) && numsaves) { 3031 if (fIsShutDownState) 3025 3032 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3026 3033 for (x = 0; x < numsaves; x++) { … … 3028 3035 size = sizeof(SWP); 3029 3036 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) &swp, &size)) { 3030 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 3031 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3032 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x); 3033 size = sizeof(szDir); 3034 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) { 3035 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 3036 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3037 if (driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 3038 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3039 continue; 3040 } 3041 localdcd.detailslongname = detailslongname; // Set default 3042 size = sizeof(BOOL); 3043 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x); 3044 if (PrfQueryProfileData(fmprof, 3045 FM3Str, 3046 szKey, 3047 (PVOID) & localdcd.detailslongname, 3048 &size) && size == sizeof(BOOL)) 3049 { 3050 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3051 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3052 } 3053 localdcd.detailssubject = detailssubject; // Set default 3054 size = sizeof(BOOL); 3055 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x); 3056 if (PrfQueryProfileData(fmprof, 3057 FM3Str, 3058 szKey, 3059 (PVOID) & localdcd.detailssubject, 3060 &size) && size == sizeof(BOOL)) 3061 { 3062 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3063 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3064 } 3065 localdcd.detailsea = detailsea; // Set default 3066 size = sizeof(BOOL); 3067 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x); 3068 if (PrfQueryProfileData(fmprof, 3069 FM3Str, 3070 szKey, 3071 (PVOID) & localdcd.detailsea, 3072 &size) && size == sizeof(BOOL)) 3073 { 3074 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3075 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3076 } 3077 localdcd.detailssize = detailssize; // Set default 3078 size = sizeof(BOOL); 3079 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x); 3080 if (PrfQueryProfileData(fmprof, 3081 FM3Str, 3082 szKey, 3083 (PVOID) & localdcd.detailssize, 3084 &size) && size == sizeof(BOOL)) 3085 { 3086 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3087 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3088 } 3089 localdcd.detailsicon = detailsicon; // Set default 3090 size = sizeof(BOOL); 3091 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x); 3092 if (PrfQueryProfileData(fmprof, 3093 FM3Str, 3094 szKey, 3095 (PVOID) & localdcd.detailsicon, 3096 &size) && size == sizeof(BOOL)) 3097 { 3098 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3099 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3100 } 3101 localdcd.detailsattr = detailsattr; // Set default 3102 size = sizeof(BOOL); 3103 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x); 3104 if (PrfQueryProfileData(fmprof, 3105 FM3Str, 3106 szKey, 3107 (PVOID) & localdcd.detailsattr, 3108 &size) && size == sizeof(BOOL)) 3109 { 3110 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3111 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3112 } 3113 localdcd.detailscrdate = detailscrdate; // Set default 3114 size = sizeof(BOOL); 3115 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x); 3116 if (PrfQueryProfileData(fmprof, 3117 FM3Str, 3118 szKey, 3119 (PVOID) & localdcd.detailscrdate, 3120 &size) && size == sizeof(BOOL)) 3121 { 3122 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3123 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3124 } 3125 localdcd.detailscrtime = detailscrtime; // Set default 3126 size = sizeof(BOOL); 3127 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x); 3128 if (PrfQueryProfileData(fmprof, 3129 FM3Str, 3130 szKey, 3131 (PVOID) & localdcd.detailscrtime, 3132 &size) && size == sizeof(BOOL)) 3133 { 3134 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3135 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3136 } 3137 localdcd.detailslwdate = detailslwdate; // Set default 3138 size = sizeof(BOOL); 3139 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x); 3140 if (PrfQueryProfileData(fmprof, 3141 FM3Str, 3142 szKey, 3143 (PVOID) & localdcd.detailslwdate, 3144 &size) && size == sizeof(BOOL)) 3145 { 3146 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3147 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3148 } 3149 localdcd.detailslwtime = detailslwtime; // Set default 3150 size = sizeof(BOOL); 3151 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x); 3152 if (PrfQueryProfileData(fmprof, 3153 FM3Str, 3154 szKey, 3155 (PVOID) & localdcd.detailslwtime, 3156 &size) && size == sizeof(BOOL)) 3157 { 3158 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3159 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3160 } 3161 localdcd.detailsladate = detailsladate; // Set default 3162 size = sizeof(BOOL); 3163 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x); 3164 if (PrfQueryProfileData(fmprof, 3165 FM3Str, 3166 szKey, 3167 (PVOID) & localdcd.detailsladate, 3168 &size) && size == sizeof(BOOL)) 3169 { 3170 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3171 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3172 } 3173 localdcd.detailslatime = detailslatime; // Set default 3174 size = sizeof(BOOL); 3175 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x); 3176 if (PrfQueryProfileData(fmprof, 3177 FM3Str, 3178 szKey, 3179 (PVOID) & localdcd.detailslatime, 3180 &size) && size == sizeof(BOOL)) 3181 { 3182 if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE)) 3183 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3184 } 3185 sprintf(szKey, "%sDirCnr.%lu", szPrefix, x); 3186 RestorePresParams(hwndClient, szKey); 3187 SavePresParams(hwndClient, "DirCnr"); 3188 hwndDir = (HWND) WinSendMsg(hwndClient, 3189 UM_SETDIR, 3190 MPFROMP(szDir), MPFROMLONG(1)); 3191 if (hwndDir) { 3192 hwndC = WinWindowFromID(hwndDir, FID_CLIENT); 3193 if (hwndC) { 3194 HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR); 3195 dcd = WinQueryWindowPtr(hwndCnr, QWL_USER); 3196 if (dcd) { 3197 dcd->detailslongname = localdcd.detailslongname; 3198 dcd->detailssubject = localdcd.detailssubject ; 3199 dcd->detailsattr = localdcd.detailsattr ; 3200 dcd->detailsea = localdcd.detailsea ; 3201 dcd->detailssize = localdcd.detailssize ; 3202 dcd->detailsicon = localdcd.detailsicon ; 3203 dcd->detailscrdate = localdcd.detailscrdate ; 3204 dcd->detailscrtime = localdcd.detailscrtime ; 3205 dcd->detailsladate = localdcd.detailsladate ; 3206 dcd->detailslatime = localdcd.detailslatime ; 3207 dcd->detailslwdate = localdcd.detailslwdate ; 3208 dcd->detailslwtime = localdcd.detailslwtime ; 3209 size = sizeof(INT); 3210 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x); 3211 if (PrfQueryProfileData(fmprof, 3212 FM3Str, 3213 szKey, 3214 (PVOID) & dcd->sortFlags, 3215 &size) && size == sizeof(INT)) { 3216 if (!dcd->sortFlags) 3217 dcd->sortFlags = SORT_PATHNAME; 3218 } 3219 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 3220 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3221 size = sizeof(MASK); 3222 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x); 3223 if (PrfQueryProfileData(fmprof, 3224 FM3Str, 3225 szKey, 3226 (PVOID) & dcd->mask, &size) && size) { 3227 if (*dcd->mask.szMask) 3228 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3229 UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID); 3230 } 3231 *(dcd->mask.prompt) = 0; 3232 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 3233 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3234 size = sizeof(ULONG); 3235 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x); 3236 if (!noview) { 3237 if (PrfQueryProfileData(fmprof, 3238 FM3Str, 3239 szKey, 3240 (PVOID) & dcd->flWindowAttr, 3241 &size) && size == sizeof(ULONG)) { 3242 3243 CNRINFO cnri; 3244 3245 memset(&cnri, 0, sizeof(CNRINFO)); 3246 cnri.cb = sizeof(CNRINFO); 3247 if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3248 CM_QUERYCNRINFO, 3249 MPFROMP(&cnri), 3250 MPFROMLONG(sizeof(CNRINFO)))) { 3251 cnri.flWindowAttr = dcd->flWindowAttr; 3252 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3253 CM_SETCNRINFO, 3254 MPFROMP(&cnri), 3255 MPFROMLONG(CMA_FLWINDOWATTR)); 3256 } 3257 } 3258 } 3259 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 3260 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3261 if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL)) 3262 WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL); 3263 } 3264 } 3265 fRestored = TRUE; 3266 swp.hwnd = hwndDir; 3267 TransformSwp(&swp, xtrans, ytrans); 3268 if (!fAutoTile && !(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) 3269 WinSetWindowPos(hwndDir, 3270 HWND_TOP, 3271 swp.x, 3272 swp.y, 3273 swp.cx, 3274 swp.cy, 3275 swp.fl | SWP_MOVE | 3276 SWP_SIZE | SWP_SHOW | SWP_ZORDER | 3277 SWP_ACTIVATE); 3278 else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3279 WinSetWindowPos(hwndDir, 3280 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3281 WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x); 3282 WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx); 3283 WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y); 3284 WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy); 3285 } 3286 else 3287 WinSetWindowPos(hwndDir, 3037 if (fIsShutDownState) 3038 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3039 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x); 3040 size = sizeof(szDir); 3041 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) { 3042 // If drive marked no prescan, and restoring shutdown state 3043 // bypass window restore 3044 if (fIsShutDownState && 3045 driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 3046 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3047 continue; 3048 } 3049 if (fIsShutDownState) 3050 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3051 localdcd.detailslongname = detailslongname; // Set default 3052 size = sizeof(BOOL); 3053 sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x); 3054 if (PrfQueryProfileData(fmprof, 3055 FM3Str, 3056 szKey, 3057 (PVOID)&localdcd.detailslongname, 3058 &size) && 3059 size == sizeof(BOOL)) 3060 { 3061 if (fIsShutDownState) 3062 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3063 } 3064 localdcd.detailssubject = detailssubject; // Set default 3065 size = sizeof(BOOL); 3066 sprintf(szKey, "%sDirCnr.%lu.DetailsSubject", szPrefix, x); 3067 if (PrfQueryProfileData(fmprof, 3068 FM3Str, 3069 szKey, 3070 (PVOID)&localdcd.detailssubject, 3071 &size) && 3072 size == sizeof(BOOL)) 3073 { 3074 if (fIsShutDownState) 3075 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3076 } 3077 localdcd.detailsea = detailsea; // Set default 3078 size = sizeof(BOOL); 3079 sprintf(szKey, "%sDirCnr.%lu.DetailsEA", szPrefix, x); 3080 if (PrfQueryProfileData(fmprof, 3081 FM3Str, 3082 szKey, 3083 (PVOID) & localdcd.detailsea, 3084 &size) && 3085 size == sizeof(BOOL)) 3086 { 3087 if (fIsShutDownState) 3088 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3089 } 3090 localdcd.detailssize = detailssize; // Set default 3091 size = sizeof(BOOL); 3092 sprintf(szKey, "%sDirCnr.%lu.DetailsSize", szPrefix, x); 3093 if (PrfQueryProfileData(fmprof, 3094 FM3Str, 3095 szKey, 3096 (PVOID) & localdcd.detailssize, 3097 &size) && 3098 size == sizeof(BOOL)) 3099 { 3100 if (fIsShutDownState) 3101 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3102 } 3103 localdcd.detailsicon = detailsicon; // Set default 3104 size = sizeof(BOOL); 3105 sprintf(szKey, "%sDirCnr.%lu.DetailsIcon", szPrefix, x); 3106 if (PrfQueryProfileData(fmprof, 3107 FM3Str, 3108 szKey, 3109 (PVOID) & localdcd.detailsicon, 3110 &size) && 3111 size == sizeof(BOOL)) 3112 { 3113 if (fIsShutDownState) 3114 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3115 } 3116 localdcd.detailsattr = detailsattr; // Set default 3117 size = sizeof(BOOL); 3118 sprintf(szKey, "%sDirCnr.%lu.DetailsAttr", szPrefix, x); 3119 if (PrfQueryProfileData(fmprof, 3120 FM3Str, 3121 szKey, 3122 (PVOID)&localdcd.detailsattr, 3123 &size) && 3124 size == sizeof(BOOL)) 3125 { 3126 if (fIsShutDownState) 3127 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3128 } 3129 localdcd.detailscrdate = detailscrdate; // Set default 3130 size = sizeof(BOOL); 3131 sprintf(szKey, "%sDirCnr.%lu.DetailsCRDate", szPrefix, x); 3132 if (PrfQueryProfileData(fmprof, 3133 FM3Str, 3134 szKey, 3135 (PVOID) & localdcd.detailscrdate, 3136 &size) && size == sizeof(BOOL)) 3137 { 3138 if (fIsShutDownState) 3139 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3140 } 3141 localdcd.detailscrtime = detailscrtime; // Set default 3142 size = sizeof(BOOL); 3143 sprintf(szKey, "%sDirCnr.%lu.DetailsCRTime", szPrefix, x); 3144 if (PrfQueryProfileData(fmprof, 3145 FM3Str, 3146 szKey, 3147 (PVOID)&localdcd.detailscrtime, 3148 &size) && 3149 size == sizeof(BOOL)) 3150 { 3151 if (fIsShutDownState) 3152 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3153 } 3154 localdcd.detailslwdate = detailslwdate; // Set default 3155 size = sizeof(BOOL); 3156 sprintf(szKey, "%sDirCnr.%lu.DetailsLWDate", szPrefix, x); 3157 if (PrfQueryProfileData(fmprof, 3158 FM3Str, 3159 szKey, 3160 (PVOID) & localdcd.detailslwdate, 3161 &size) && 3162 size == sizeof(BOOL)) 3163 { 3164 if (fIsShutDownState) 3165 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3166 } 3167 localdcd.detailslwtime = detailslwtime; // Set default 3168 size = sizeof(BOOL); 3169 sprintf(szKey, "%sDirCnr.%lu.DetailsLWTime", szPrefix, x); 3170 if (PrfQueryProfileData(fmprof, 3171 FM3Str, 3172 szKey, 3173 (PVOID) & localdcd.detailslwtime, 3174 &size) && 3175 size == sizeof(BOOL)) 3176 { 3177 if (fIsShutDownState) 3178 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3179 } 3180 localdcd.detailsladate = detailsladate; // Set default 3181 size = sizeof(BOOL); 3182 sprintf(szKey, "%sDirCnr.%lu.DetailsLADate", szPrefix, x); 3183 if (PrfQueryProfileData(fmprof, 3184 FM3Str, 3185 szKey, 3186 (PVOID) & localdcd.detailsladate, 3187 &size) && 3188 size == sizeof(BOOL)) 3189 { 3190 if (fIsShutDownState) 3191 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3192 } 3193 localdcd.detailslatime = detailslatime; // Set default 3194 size = sizeof(BOOL); 3195 sprintf(szKey, "%sDirCnr.%lu.DetailsLATime", szPrefix, x); 3196 if (PrfQueryProfileData(fmprof, 3197 FM3Str, 3198 szKey, 3199 (PVOID) & localdcd.detailslatime, 3200 &size) && 3201 size == sizeof(BOOL)) 3202 { 3203 if (fIsShutDownState) 3204 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3205 } 3206 sprintf(szKey, "%sDirCnr.%lu", szPrefix, x); 3207 RestorePresParams(hwndClient, szKey); 3208 SavePresParams(hwndClient, "DirCnr"); 3209 hwndDir = (HWND) WinSendMsg(hwndClient, 3210 UM_SETDIR, 3211 MPFROMP(szDir), MPFROMLONG(1)); 3212 if (hwndDir) { 3213 hwndC = WinWindowFromID(hwndDir, FID_CLIENT); 3214 if (hwndC) { 3215 HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR); 3216 dcd = WinQueryWindowPtr(hwndCnr, QWL_USER); 3217 if (dcd) { 3218 dcd->detailslongname = localdcd.detailslongname; 3219 dcd->detailssubject = localdcd.detailssubject ; 3220 dcd->detailsattr = localdcd.detailsattr ; 3221 dcd->detailsea = localdcd.detailsea ; 3222 dcd->detailssize = localdcd.detailssize ; 3223 dcd->detailsicon = localdcd.detailsicon ; 3224 dcd->detailscrdate = localdcd.detailscrdate ; 3225 dcd->detailscrtime = localdcd.detailscrtime ; 3226 dcd->detailsladate = localdcd.detailsladate ; 3227 dcd->detailslatime = localdcd.detailslatime ; 3228 dcd->detailslwdate = localdcd.detailslwdate ; 3229 dcd->detailslwtime = localdcd.detailslwtime ; 3230 size = sizeof(INT); 3231 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x); 3232 if (PrfQueryProfileData(fmprof, 3233 FM3Str, 3234 szKey, 3235 (PVOID) & dcd->sortFlags, 3236 &size) && size == sizeof(INT)) { 3237 if (!dcd->sortFlags) 3238 dcd->sortFlags = SORT_PATHNAME; 3239 } 3240 if (fIsShutDownState) 3241 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3242 size = sizeof(MASK); 3243 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x); 3244 if (PrfQueryProfileData(fmprof, 3245 FM3Str, 3246 szKey, 3247 (PVOID) & dcd->mask, &size) && size) { 3248 if (*dcd->mask.szMask) 3249 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3250 UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID); 3251 } 3252 *(dcd->mask.prompt) = 0; 3253 if (fIsShutDownState) 3254 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3255 size = sizeof(ULONG); 3256 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x); 3257 if (!noview) { 3258 if (PrfQueryProfileData(fmprof, 3259 FM3Str, 3260 szKey, 3261 (PVOID) & dcd->flWindowAttr, 3262 &size) && size == sizeof(ULONG)) { 3263 3264 CNRINFO cnri; 3265 3266 memset(&cnri, 0, sizeof(CNRINFO)); 3267 cnri.cb = sizeof(CNRINFO); 3268 if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3269 CM_QUERYCNRINFO, 3270 MPFROMP(&cnri), 3271 MPFROMLONG(sizeof(CNRINFO)))) { 3272 cnri.flWindowAttr = dcd->flWindowAttr; 3273 WinSendMsg(WinWindowFromID(hwndC, DIR_CNR), 3274 CM_SETCNRINFO, 3275 MPFROMP(&cnri), 3276 MPFROMLONG(CMA_FLWINDOWATTR)); 3277 } 3278 } 3279 } 3280 if (fIsShutDownState) 3281 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 3282 if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL)) 3283 WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL); 3284 } 3285 } 3286 fRestored = TRUE; 3287 swp.hwnd = hwndDir; 3288 TransformSwp(&swp, xtrans, ytrans); 3289 if (!fAutoTile && !(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) 3290 WinSetWindowPos(hwndDir, 3291 HWND_TOP, 3292 swp.x, 3293 swp.y, 3294 swp.cx, 3295 swp.cy, 3296 swp.fl | SWP_MOVE | 3297 SWP_SIZE | SWP_SHOW | SWP_ZORDER | 3298 SWP_ACTIVATE); 3299 else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3300 WinSetWindowPos(hwndDir, 3301 HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW); 3302 WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x); 3303 WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx); 3304 WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y); 3305 WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy); 3306 } 3307 else 3308 WinSetWindowPos(hwndDir, 3288 3309 HWND_BOTTOM, 3289 0, 0, 0, 0, SWP_ZORDER | SWP_ACTIVATE);3290 }3291 }3310 0, 0, 0, 0, SWP_ZORDER | SWP_ACTIVATE); 3311 } 3312 } 3292 3313 } 3293 3314 } // for … … 3314 3335 if (ulNumMinChildren) { 3315 3336 if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE)) 3316 (*ulNumMinChildren)++;3337 (*ulNumMinChildren)++; 3317 3338 } 3318 3339 } … … 3322 3343 3323 3344 VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR, 3324 ULONG * ulNumMinChildrenR)3345 ULONG * ulNumMinChildrenR) 3325 3346 { 3326 3347 register ULONG ulCnt; … … 3386 3407 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3387 3408 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3388 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;3409 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3389 3410 if (swp.x != 0) 3390 swp.x = 0;3411 swp.x = 0; 3391 3412 if (swp.y < 0) 3392 swp.y = 0;3413 swp.y = 0; 3393 3414 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3394 swp.cx = Rectl.xRight - Rectl.xLeft;3415 swp.cx = Rectl.xRight - Rectl.xLeft; 3395 3416 WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3396 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);3417 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3397 3418 } 3398 3419 } … … 3406 3427 GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren); 3407 3428 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3408 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE |3409 SWP_ZORDER | SWP_ACTIVATE);3429 SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE | 3430 SWP_ZORDER | SWP_ACTIVATE); 3410 3431 ulCnt++; 3411 3432 } … … 3460 3481 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3461 3482 if (swp.y < 0) 3462 swp.y = 0;3483 swp.y = 0; 3463 3484 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3464 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;3485 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3465 3486 if (swp.x != 0) 3466 swp.x = 0;3487 swp.x = 0; 3467 3488 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3468 swp.cx = Rectl.xRight - Rectl.xLeft;3489 swp.cx = Rectl.xRight - Rectl.xLeft; 3469 3490 WinSetWindowPos(hwndTree, 3470 HWND_TOP,3471 swp.x,3472 swp.y,3473 swp.cx,3474 swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);3491 HWND_TOP, 3492 swp.x, 3493 swp.y, 3494 swp.cx, 3495 swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3475 3496 WinQueryWindowPos(hwndTree, &swp); 3476 3497 } … … 3497 3518 3498 3519 for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) { 3499 if ((ulNumRows - ulCurRow) <= ulExtraCols)3500 ulNumCols++;3501 for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) {3502 ulWidth = Rectl.xRight / ulNumCols;3503 3504 while (hwndChild) {3505 id = WinQueryWindowUShort(hwndChild, QWS_ID);3506 if (id && (id != TREE_FRAME || fFreeTree)) {3507 WinQueryWindowPos(hwndChild, &swp);3508 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))3509 break;3510 }3511 hwndChild = WinGetNextWindow(henum);3512 }3513 3514 if (hwndChild) {3515 if (!absolute && (swp.fl & SWP_MAXIMIZE)) {3516 WinGetMaxPosition(hwndChild, &swp);3517 WinSetWindowPos(hwndChild,3518 HWND_TOP,3519 swp.x,3520 swp.y,3521 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW);3522 WinSetWindowUShort(hwndChild,3523 QWS_XRESTORE,3524 (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft);3525 WinSetWindowUShort(hwndChild,3526 QWS_YRESTORE,3527 (USHORT) (Rectl.yTop -3528 (ulHeight * (ulCurRow + 1))));3529 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth);3530 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight);3531 }3532 else3533 WinSetWindowPos(hwndChild,3534 HWND_TOP,3535 (ulWidth * ulCurCol) + Rectl.xLeft,3536 Rectl.yTop - (ulHeight * (ulCurRow + 1)),3537 ulWidth,3538 ulHeight,3539 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);3540 hwndChild = WinGetNextWindow(henum);3541 }3542 }3543 if ((ulNumRows - ulCurRow) <= ulExtraCols) {3544 ulNumCols--;3545 ulExtraCols--;3546 }3520 if ((ulNumRows - ulCurRow) <= ulExtraCols) 3521 ulNumCols++; 3522 for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) { 3523 ulWidth = Rectl.xRight / ulNumCols; 3524 3525 while (hwndChild) { 3526 id = WinQueryWindowUShort(hwndChild, QWS_ID); 3527 if (id && (id != TREE_FRAME || fFreeTree)) { 3528 WinQueryWindowPos(hwndChild, &swp); 3529 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) 3530 break; 3531 } 3532 hwndChild = WinGetNextWindow(henum); 3533 } 3534 3535 if (hwndChild) { 3536 if (!absolute && (swp.fl & SWP_MAXIMIZE)) { 3537 WinGetMaxPosition(hwndChild, &swp); 3538 WinSetWindowPos(hwndChild, 3539 HWND_TOP, 3540 swp.x, 3541 swp.y, 3542 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW); 3543 WinSetWindowUShort(hwndChild, 3544 QWS_XRESTORE, 3545 (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft); 3546 WinSetWindowUShort(hwndChild, 3547 QWS_YRESTORE, 3548 (USHORT) (Rectl.yTop - 3549 (ulHeight * (ulCurRow + 1)))); 3550 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth); 3551 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight); 3552 } 3553 else 3554 WinSetWindowPos(hwndChild, 3555 HWND_TOP, 3556 (ulWidth * ulCurCol) + Rectl.xLeft, 3557 Rectl.yTop - (ulHeight * (ulCurRow + 1)), 3558 ulWidth, 3559 ulHeight, 3560 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3561 hwndChild = WinGetNextWindow(henum); 3562 } 3563 } 3564 if ((ulNumRows - ulCurRow) <= ulExtraCols) { 3565 ulNumCols--; 3566 ulExtraCols--; 3567 } 3547 3568 } 3548 3569 } … … 3554 3575 3555 3576 static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy, 3556 SHORT newcx, SHORT newcy)3577 SHORT newcx, SHORT newcy) 3557 3578 { 3558 3579 /* … … 3572 3593 while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) { 3573 3594 if (!WinQueryWindowUShort(hwndChild, QWS_ID)) 3574 continue;3595 continue; 3575 3596 if (WinQueryWindowPos(hwndChild, &swp)) { 3576 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {3577 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);3578 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);3579 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);3580 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);3581 }3582 else if (swp.fl & SWP_MAXIMIZE) {3583 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);3584 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);3585 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);3586 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);3587 }3588 cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0;3589 cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0;3590 x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0;3591 y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0;3592 if (x < 0)3593 x = 0;3594 if (y < 0)3595 y = 0;3596 ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0;3597 uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0;3598 ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0;3599 ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0;3600 if (ux + ucx > newcx)3601 ucx = newcx - ux;3602 if (uy + ucy > newcy)3603 ucy = newcy - uy;3604 3605 if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)))3606 WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy,3607 SWP_MOVE | SWP_SIZE | SWP_SHOW);3608 else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {3609 WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);3610 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);3611 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,3612 SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE);3613 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);3614 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);3615 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);3616 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);3617 }3618 else {3619 WinGetMaxPosition(hwndChild, &swp);3620 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,3621 SWP_MOVE | SWP_SIZE | SWP_SHOW);3622 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);3623 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);3624 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);3625 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);3626 }3597 if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) { 3598 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE); 3599 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE); 3600 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE); 3601 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE); 3602 } 3603 else if (swp.fl & SWP_MAXIMIZE) { 3604 swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE); 3605 swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE); 3606 swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE); 3607 swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE); 3608 } 3609 cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0; 3610 cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0; 3611 x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0; 3612 y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0; 3613 if (x < 0) 3614 x = 0; 3615 if (y < 0) 3616 y = 0; 3617 ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0; 3618 uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0; 3619 ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0; 3620 ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0; 3621 if (ux + ucx > newcx) 3622 ucx = newcx - ux; 3623 if (uy + ucy > newcy) 3624 ucy = newcy - uy; 3625 3626 if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) 3627 WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy, 3628 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3629 else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) { 3630 WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1); 3631 WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1); 3632 WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0, 3633 SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE); 3634 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux); 3635 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy); 3636 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx); 3637 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy); 3638 } 3639 else { 3640 WinGetMaxPosition(hwndChild, &swp); 3641 WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3642 SWP_MOVE | SWP_SIZE | SWP_SHOW); 3643 WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux); 3644 WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy); 3645 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx); 3646 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy); 3647 } 3627 3648 } 3628 3649 } … … 3639 3660 if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) { 3640 3661 if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom) 3641 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;3662 swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y; 3642 3663 if (swp.x != 0) 3643 swp.x = 0;3664 swp.x = 0; 3644 3665 if (swp.y < 0) 3645 swp.y = 0;3666 swp.y = 0; 3646 3667 if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft) 3647 swp.cx = Rectl.xRight - Rectl.xLeft;3668 swp.cx = Rectl.xRight - Rectl.xLeft; 3648 3669 WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, 3649 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);3670 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE); 3650 3671 } 3651 3672 } … … 3675 3696 3676 3697 static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd, 3677 ULONG msg,3678 MPARAM mp1, MPARAM mp2)3698 ULONG msg, 3699 MPARAM mp1, MPARAM mp2) 3679 3700 { 3680 3701 USHORT id; … … 3690 3711 if (fOtherHelp) { 3691 3712 if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) 3692 && !WinQueryCapture(HWND_DESKTOP)) {3693 id = WinQueryWindowUShort(hwnd, QWS_ID);3694 switch (id) {3695 case IDM_OPENWALK:3696 MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP));3697 break;3698 case IDM_USERLIST:3699 MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP));3700 break;3701 }3713 && !WinQueryCapture(HWND_DESKTOP)) { 3714 id = WinQueryWindowUShort(hwnd, QWS_ID); 3715 switch (id) { 3716 case IDM_OPENWALK: 3717 MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP)); 3718 break; 3719 case IDM_USERLIST: 3720 MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP)); 3721 break; 3722 } 3702 3723 } 3703 3724 } … … 3713 3734 switch (id) { 3714 3735 case IDM_OPENWALK: 3715 switch (msg) {3716 case WM_BUTTON2CLICK:3717 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==3718 (KC_ALT | KC_SHIFT | KC_CTRL))3719 cmd = IDM_GREP;3720 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))3721 CascadeChildren(hwndMain);3736 switch (msg) { 3737 case WM_BUTTON2CLICK: 3738 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) == 3739 (KC_ALT | KC_SHIFT | KC_CTRL)) 3740 cmd = IDM_GREP; 3741 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL)) 3742 CascadeChildren(hwndMain); 3722 3743 3723 3744 #ifdef NEVER 3724 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))3725 cmd = IDM_SYSINFO;3745 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT)) 3746 cmd = IDM_SYSINFO; 3726 3747 #endif 3727 3748 3728 else if (shiftstate & KC_SHIFT)3729 cmd = IDM_WINDOWDLG;3730 else if (shiftstate & KC_CTRL)3731 cmd = IDM_SEEALL;3732 else if (shiftstate & KC_ALT)3733 TileChildren(hwndMain, TRUE);3734 else3735 cmd = IDM_WALKDIR;3736 break;3737 case WM_BUTTON3CLICK:3738 TileChildren(hwndMain, TRUE);3739 break;3740 }3741 break;3749 else if (shiftstate & KC_SHIFT) 3750 cmd = IDM_WINDOWDLG; 3751 else if (shiftstate & KC_CTRL) 3752 cmd = IDM_SEEALL; 3753 else if (shiftstate & KC_ALT) 3754 TileChildren(hwndMain, TRUE); 3755 else 3756 cmd = IDM_WALKDIR; 3757 break; 3758 case WM_BUTTON3CLICK: 3759 TileChildren(hwndMain, TRUE); 3760 break; 3761 } 3762 break; 3742 3763 case IDM_USERLIST: 3743 switch (msg) {3744 case WM_BUTTON2CLICK:3745 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==3746 (KC_ALT | KC_SHIFT | KC_CTRL))3747 cmd = IDM_COLORPALETTE;3748 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))3749 cmd = IDM_HIDEMENU;3750 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))3751 cmd = IDM_NOTEBOOK;3752 else if (shiftstate & KC_SHIFT)3753 cmd = IDM_TOOLTITLES;3754 else if (shiftstate & KC_CTRL)3755 cmd = IDM_TEXTTOOLS;3756 else if (shiftstate & KC_ALT)3757 cmd = IDM_FONTPALETTE;3758 else3759 cmd = IDM_TOOLBAR;3760 break;3761 case WM_BUTTON3CLICK:3762 cmd = IDM_DRIVEBAR;3763 break;3764 }3765 break;3764 switch (msg) { 3765 case WM_BUTTON2CLICK: 3766 if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) == 3767 (KC_ALT | KC_SHIFT | KC_CTRL)) 3768 cmd = IDM_COLORPALETTE; 3769 else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL)) 3770 cmd = IDM_HIDEMENU; 3771 else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT)) 3772 cmd = IDM_NOTEBOOK; 3773 else if (shiftstate & KC_SHIFT) 3774 cmd = IDM_TOOLTITLES; 3775 else if (shiftstate & KC_CTRL) 3776 cmd = IDM_TEXTTOOLS; 3777 else if (shiftstate & KC_ALT) 3778 cmd = IDM_FONTPALETTE; 3779 else 3780 cmd = IDM_TOOLBAR; 3781 break; 3782 case WM_BUTTON3CLICK: 3783 cmd = IDM_DRIVEBAR; 3784 break; 3785 } 3786 break; 3766 3787 } // switch id 3767 3788 3768 3789 if (cmd) { 3769 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT),3770 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);3790 PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT), 3791 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID); 3771 3792 } 3772 3793 } … … 3777 3798 if (id == IDM_OPENWALK) { 3778 3799 if (!emphasized) { 3779 emphasized = TRUE;3780 DrawTargetEmphasis(hwnd, emphasized);3800 emphasized = TRUE; 3801 DrawTargetEmphasis(hwnd, emphasized); 3781 3802 } 3782 3803 if (AcceptOneDrop(hwnd, mp1, mp2)) 3783 return MRFROM2SHORT(DOR_DROP, DO_MOVE);3804 return MRFROM2SHORT(DOR_DROP, DO_MOVE); 3784 3805 } 3785 3806 return MRFROM2SHORT(DOR_NEVERDROP, 0); … … 3801 3822 3802 3823 if (emphasized) { 3803 emphasized = FALSE;3804 DrawTargetEmphasis(hwnd, emphasized);3824 emphasized = FALSE; 3825 DrawTargetEmphasis(hwnd, emphasized); 3805 3826 } 3806 3827 if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) { 3807 if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) {3808 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom);3809 }3828 if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) { 3829 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom); 3830 } 3810 3831 } 3811 3832 } … … 3820 3841 3821 3842 static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1, 3822 MPARAM mp2)3843 MPARAM mp2) 3823 3844 { 3824 3845 PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER); … … 3832 3853 pswp = (SWP *) mp1; 3833 3854 if (fDataMin && !fAmClosing) { 3834 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {3835 3836 SWP swp;3837 3838 WinQueryWindowPos(hwnd, &swp);3839 PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);3840 HideNote();3841 }3842 else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {3843 if (DataHwnd)3844 PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);3845 }3855 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) { 3856 3857 SWP swp; 3858 3859 WinQueryWindowPos(hwnd, &swp); 3860 PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID); 3861 HideNote(); 3862 } 3863 else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) { 3864 if (DataHwnd) 3865 PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID); 3866 } 3846 3867 } 3847 3868 if (!fAmClosing) { 3848 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))3849 HideNote();3869 if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) 3870 HideNote(); 3850 3871 } 3851 3872 } … … 3870 3891 case WM_CONTROL: 3871 3892 return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1, 3872 mp2);3893 mp2); 3873 3894 3874 3895 case WM_COMMAND: … … 3890 3911 3891 3912 if (mr && mp2) { 3892 prectl = (PRECTL) mp1;3893 if (prectl->yBottom != prectl->yTop) {3894 {3895 HPS hps;3896 POINTL aptl[TXTBOX_COUNT];3897 3898 hps = WinGetPS(hwndStatus);3899 if (hps) {3900 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);3901 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;3902 WinReleasePS(hps);3903 }3904 }3905 prectl->yBottom += (sheight + 4);3906 prectl->yTop -= (sheight + 4);3907 if (fMoreButtons) {3908 3909 HPS hps;3910 POINTL aptl[TXTBOX_COUNT];3911 3912 hps = WinGetPS(hwndName);3913 if (hps) {3914 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);3915 bheight = aptl[TXTBOX_TOPLEFT].y + 6;3916 WinReleasePS(hps);3917 }3918 prectl->yBottom += (bheight + 4);3919 prectl->yTop -= (bheight + 4);3920 }3921 if (fToolbar) {3922 if (!fTextTools)3923 prectl->yTop -= ((fToolTitles) ? 50 : 40);3924 else3925 prectl->yTop -= 32;3926 }3927 if (fDrivebar) {3928 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),3929 ((prectl->xRight -3930 (WinQuerySysValue(HWND_DESKTOP,3931 SV_CYSIZEBORDER) * 2)) - 4));3932 prectl->yTop -= (16 * (DriveLines * 18));3933 }3934 if (fUserComboBox) {3935 if (!aheight) {3936 3937 SWP swpTemp;3938 3939 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),3940 &swpTemp);3941 aheight = swpTemp.cy;3942 }3943 prectl->yTop -= (aheight + 6L);3944 }3945 if (fAutoView) {3946 AutoviewHeight = min(AutoviewHeight,3947 (prectl->yTop - prectl->yBottom) - 116);3948 AutoviewHeight = max(AutoviewHeight, 36);3949 prectl->yBottom += (AutoviewHeight + 6);3950 }3951 }3913 prectl = (PRECTL) mp1; 3914 if (prectl->yBottom != prectl->yTop) { 3915 { 3916 HPS hps; 3917 POINTL aptl[TXTBOX_COUNT]; 3918 3919 hps = WinGetPS(hwndStatus); 3920 if (hps) { 3921 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 3922 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6; 3923 WinReleasePS(hps); 3924 } 3925 } 3926 prectl->yBottom += (sheight + 4); 3927 prectl->yTop -= (sheight + 4); 3928 if (fMoreButtons) { 3929 3930 HPS hps; 3931 POINTL aptl[TXTBOX_COUNT]; 3932 3933 hps = WinGetPS(hwndName); 3934 if (hps) { 3935 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 3936 bheight = aptl[TXTBOX_TOPLEFT].y + 6; 3937 WinReleasePS(hps); 3938 } 3939 prectl->yBottom += (bheight + 4); 3940 prectl->yTop -= (bheight + 4); 3941 } 3942 if (fToolbar) { 3943 if (!fTextTools) 3944 prectl->yTop -= ((fToolTitles) ? 50 : 40); 3945 else 3946 prectl->yTop -= 32; 3947 } 3948 if (fDrivebar) { 3949 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), 3950 ((prectl->xRight - 3951 (WinQuerySysValue(HWND_DESKTOP, 3952 SV_CYSIZEBORDER) * 2)) - 4)); 3953 prectl->yTop -= (16 * (DriveLines * 18)); 3954 } 3955 if (fUserComboBox) { 3956 if (!aheight) { 3957 3958 SWP swpTemp; 3959 3960 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 3961 &swpTemp); 3962 aheight = swpTemp.cy; 3963 } 3964 prectl->yTop -= (aheight + 6L); 3965 } 3966 if (fAutoView) { 3967 AutoviewHeight = min(AutoviewHeight, 3968 (prectl->yTop - prectl->yBottom) - 116); 3969 AutoviewHeight = max(AutoviewHeight, 36); 3970 prectl->yBottom += (AutoviewHeight + 6); 3971 } 3972 } 3952 3973 } 3953 3974 return mr; … … 3973 3994 pswp = (PSWP) mp1; 3974 3995 { 3975 SHORT x;3976 3977 for (x = 0; x < soldCount; x++) {3978 if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {3979 pswpClient = pswp;3980 break;3981 }3982 pswp++;3983 }3996 SHORT x; 3997 3998 for (x = 0; x < soldCount; x++) { 3999 if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) { 4000 pswpClient = pswp; 4001 break; 4002 } 4003 pswp++; 4004 } 3984 4005 } 3985 4006 3986 4007 { 3987 HPS hps;3988 POINTL aptl[TXTBOX_COUNT];3989 3990 hps = WinGetPS(hwndStatus);3991 if (hps) {3992 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);3993 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;3994 WinReleasePS(hps);3995 }3996 if (fMoreButtons) {3997 hps = WinGetPS(hwndName);3998 if (hps) {3999 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);4000 bheight = aptl[TXTBOX_TOPLEFT].y + 6;4001 WinReleasePS(hps);4002 }4003 }4008 HPS hps; 4009 POINTL aptl[TXTBOX_COUNT]; 4010 4011 hps = WinGetPS(hwndStatus); 4012 if (hps) { 4013 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4014 bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6; 4015 WinReleasePS(hps); 4016 } 4017 if (fMoreButtons) { 4018 hps = WinGetPS(hwndName); 4019 if (hps) { 4020 GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl); 4021 bheight = aptl[TXTBOX_TOPLEFT].y + 6; 4022 WinReleasePS(hps); 4023 } 4024 } 4004 4025 } 4005 4026 pswpNew = (PSWP) mp1 + soldCount; … … 4011 4032 pswpNew->y = swpClient.y + 2; 4012 4033 if (!fSplitStatus) 4013 width = swpClient.cx - (16 + (sheight * 2) + 4);4034 width = swpClient.cx - (16 + (sheight * 2) + 4); 4014 4035 else 4015 width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2;4036 width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2; 4016 4037 width = max(width, 10); 4017 4038 if (fSplitStatus) 4018 pswpNew->cx = width - 6;4039 pswpNew->cx = width - 6; 4019 4040 else 4020 pswpNew->cx = width - 8;4041 pswpNew->cx = width - 8; 4021 4042 pswpNew->cy = sheight; 4022 4043 pswpClient->y = pswpNew->y + pswpNew->cy + 3; … … 4025 4046 4026 4047 if (fSplitStatus) { 4027 pswpNew = (PSWP) mp1 + (soldCount + 1);4028 *pswpNew = *pswpClient;4029 pswpNew->hwnd = hwndStatus2;4030 pswpNew->hwndInsertBehind = HWND_BOTTOM;4031 pswpNew->x = width + 8;4032 pswpNew->y = swpClient.y + 2;4033 pswpNew->cx = width - 6;4034 pswpNew->cy = sheight;4035 sCount++;4048 pswpNew = (PSWP) mp1 + (soldCount + 1); 4049 *pswpNew = *pswpClient; 4050 pswpNew->hwnd = hwndStatus2; 4051 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4052 pswpNew->x = width + 8; 4053 pswpNew->y = swpClient.y + 2; 4054 pswpNew->cx = width - 6; 4055 pswpNew->cy = sheight; 4056 sCount++; 4036 4057 } 4037 4058 else { 4038 WinShowWindow(hwndStatus2, FALSE);4039 WinSetWindowText(hwndStatus2, NullStr);4059 WinShowWindow(hwndStatus2, FALSE); 4060 WinSetWindowText(hwndStatus2, NullStr); 4040 4061 } 4041 4062 4042 4063 if (fToolbar) { 4043 if (fTextTools)4044 theight = 32L;4045 else if (!fToolTitles)4046 theight = 40L;4047 pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE));4048 *pswpNew = *pswpClient;4049 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);4050 pswpNew->hwndInsertBehind = HWND_BOTTOM;4051 pswpNew->x = swpClient.x + 2;4052 pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);4053 pswpNew->cx = swpClient.cx - 4;4054 pswpNew->cy = theight - 4;4055 pswpClient->cy -= theight;4056 sCount++;4064 if (fTextTools) 4065 theight = 32L; 4066 else if (!fToolTitles) 4067 theight = 40L; 4068 pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE)); 4069 *pswpNew = *pswpClient; 4070 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS); 4071 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4072 pswpNew->x = swpClient.x + 2; 4073 pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2); 4074 pswpNew->cx = swpClient.cx - 4; 4075 pswpNew->cy = theight - 4; 4076 pswpClient->cy -= theight; 4077 sCount++; 4057 4078 } 4058 4079 else 4059 WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);4080 WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE); 4060 4081 4061 4082 if (fDrivebar) { 4062 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);4063 pswpNew = (PSWP) mp1 + (soldCount + 1 +4064 (fSplitStatus != FALSE) +4065 (fToolbar != FALSE));4066 *pswpNew = *pswpClient;4067 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);4068 pswpNew->hwndInsertBehind = HWND_BOTTOM;4069 pswpNew->x = swpClient.x + 2;4070 dheight += ((dheight - 2) * DriveLines);4071 pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);4072 if (fToolbar)4073 pswpNew->y -= theight;4074 pswpNew->cx = swpClient.cx - 4;4075 pswpNew->cy = dheight - 4;4076 pswpClient->cy -= dheight;4077 sCount++;4083 ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4); 4084 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4085 (fSplitStatus != FALSE) + 4086 (fToolbar != FALSE)); 4087 *pswpNew = *pswpClient; 4088 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES); 4089 pswpNew->hwndInsertBehind = HWND_BOTTOM; 4090 pswpNew->x = swpClient.x + 2; 4091 dheight += ((dheight - 2) * DriveLines); 4092 pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2); 4093 if (fToolbar) 4094 pswpNew->y -= theight; 4095 pswpNew->cx = swpClient.cx - 4; 4096 pswpNew->cy = dheight - 4; 4097 pswpClient->cy -= dheight; 4098 sCount++; 4078 4099 } 4079 4100 else 4080 WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE);4101 WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE); 4081 4102 4082 4103 if (fAutoView) { 4083 pswpNew = (PSWP) mp1 + (soldCount + 1 +4084 (fToolbar != FALSE) +4085 (fDrivebar != FALSE) +4086 (fSplitStatus != FALSE));4087 *pswpNew = *pswpClient;4088 pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;4089 pswpNew->x = pswpClient->x + 3;4090 pswpNew->y = pswpClient->y + 3;4091 if (fMoreButtons)4092 pswpNew->y += (bheight + 4);4093 pswpNew->cx = pswpClient->cx - 6;4094 AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);4095 AutoviewHeight = max(AutoviewHeight, 36);4096 pswpNew->cy = AutoviewHeight;4097 pswpClient->y += (AutoviewHeight + 6);4098 pswpClient->cy -= (AutoviewHeight + 6);4099 sCount++;4100 WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);4104 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4105 (fToolbar != FALSE) + 4106 (fDrivebar != FALSE) + 4107 (fSplitStatus != FALSE)); 4108 *pswpNew = *pswpClient; 4109 pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview; 4110 pswpNew->x = pswpClient->x + 3; 4111 pswpNew->y = pswpClient->y + 3; 4112 if (fMoreButtons) 4113 pswpNew->y += (bheight + 4); 4114 pswpNew->cx = pswpClient->cx - 6; 4115 AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116); 4116 AutoviewHeight = max(AutoviewHeight, 36); 4117 pswpNew->cy = AutoviewHeight; 4118 pswpClient->y += (AutoviewHeight + 6); 4119 pswpClient->cy -= (AutoviewHeight + 6); 4120 sCount++; 4121 WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE); 4101 4122 } 4102 4123 else { 4103 WinShowWindow(hwndAutoview, FALSE);4104 WinShowWindow(hwndAutoMLE, FALSE);4124 WinShowWindow(hwndAutoview, FALSE); 4125 WinShowWindow(hwndAutoMLE, FALSE); 4105 4126 } 4106 4127 4107 4128 pswpNew = (PSWP) mp1 + (soldCount + 1 + 4108 (fToolbar != FALSE) +4109 (fDrivebar != FALSE) +4110 (fSplitStatus != FALSE) + (fAutoView != FALSE));4129 (fToolbar != FALSE) + 4130 (fDrivebar != FALSE) + 4131 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4111 4132 *pswpNew = *pswpClient; 4112 4133 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK); … … 4117 4138 sCount++; 4118 4139 pswpNew = (PSWP) mp1 + (soldCount + 2 + 4119 (fToolbar != FALSE) +4120 (fDrivebar != FALSE) +4121 (fSplitStatus != FALSE) + (fAutoView != FALSE));4140 (fToolbar != FALSE) + 4141 (fDrivebar != FALSE) + 4142 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4122 4143 *pswpNew = *pswpClient; 4123 4144 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST); … … 4128 4149 sCount++; 4129 4150 pswpNew = (PSWP) mp1 + (soldCount + 3 + 4130 (fToolbar != FALSE) +4131 (fDrivebar != FALSE) +4132 (fSplitStatus != FALSE) + (fAutoView != FALSE));4151 (fToolbar != FALSE) + 4152 (fDrivebar != FALSE) + 4153 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4133 4154 *pswpNew = *pswpClient; 4134 4155 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED); … … 4139 4160 sCount++; 4140 4161 pswpNew = (PSWP) mp1 + (soldCount + 4 + 4141 (fToolbar != FALSE) +4142 (fDrivebar != FALSE) +4143 (fSplitStatus != FALSE) + (fAutoView != FALSE));4162 (fToolbar != FALSE) + 4163 (fDrivebar != FALSE) + 4164 (fSplitStatus != FALSE) + (fAutoView != FALSE)); 4144 4165 *pswpNew = *pswpClient; 4145 4166 pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR); … … 4150 4171 sCount++; 4151 4172 if (fUserComboBox) { 4152 if (!aheight) {4153 4154 SWP swpTemp;4155 4156 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),4157 &swpTemp);4158 aheight = swpTemp.cy;4159 }4160 pswpNew = (PSWP) mp1 + (soldCount + 5 +4161 (fToolbar != FALSE) +4162 (fSplitStatus != FALSE) +4163 (fDrivebar != FALSE) + (fAutoView != FALSE));4164 *pswpNew = *pswpClient;4165 pswpNew->hwnd = hwndDrivelist;4166 pswpNew->x = swpClient.x;4167 pswpNew->cx = 48;4168 pswpClient->cy -= (aheight + 6L);4169 pswpNew->y = pswpClient->y;4170 pswpNew->cy = pswpClient->cy + (aheight + 5L);4171 sCount++;4172 pswpNew = (PSWP) mp1 + (soldCount + 6 +4173 (fToolbar != FALSE) +4174 (fDrivebar != FALSE) +4175 (fSplitStatus != FALSE) +4176 (fAutoView != FALSE));4177 *pswpNew = *pswpClient;4178 pswpNew->hwnd = hwndStatelist;4179 pswpNew->x = swpClient.x + 48;4180 pswpNew->cx = (swpClient.cx - 48) / 7;4181 pswpNew->y = pswpClient->y;4182 pswpNew->cy = pswpClient->cy + (aheight + 5L);4183 sCount++;4184 pswpNew = (PSWP) mp1 + (soldCount + 7 +4185 (fToolbar != FALSE) +4186 (fDrivebar != FALSE) +4187 (fSplitStatus != FALSE) +4188 (fAutoView != FALSE));4189 *pswpNew = *pswpClient;4190 pswpNew->hwnd = hwndCmdlist;4191 pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7);4192 pswpNew->cx = (swpClient.cx - 48) / 5 +4193 ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7);4194 pswpNew->y = pswpClient->y;4195 pswpNew->cy = pswpClient->cy + (aheight + 5L);4196 sCount++;4197 pswpNew = (PSWP) mp1 + (soldCount + 8 +4198 (fToolbar != FALSE) +4199 (fDrivebar != FALSE) +4200 (fSplitStatus != FALSE) +4201 (fAutoView != FALSE));4202 *pswpNew = *pswpClient;4203 pswpNew->hwnd = hwndUserlist;4204 pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2);4205 pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) -4206 ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0);4207 pswpNew->y = pswpClient->y;4208 pswpNew->cy = pswpClient->cy + (aheight + 5L);4209 sCount++;4210 if (fToolbar) {4211 pswpNew = (PSWP) mp1 + (soldCount + 9 +4212 (fToolbar != FALSE) +4213 (fDrivebar != FALSE) +4214 (fSplitStatus != FALSE) +4215 (fAutoView != FALSE));4216 *pswpNew = *pswpClient;4217 pswpNew->hwnd = hwndButtonlist;4218 pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4;4219 pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x;4220 pswpNew->y = pswpClient->y;4221 pswpNew->cy = pswpClient->cy + (aheight + 5L);4222 sCount++;4223 }4224 else4225 WinShowWindow(hwndButtonlist, FALSE);4173 if (!aheight) { 4174 4175 SWP swpTemp; 4176 4177 WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT), 4178 &swpTemp); 4179 aheight = swpTemp.cy; 4180 } 4181 pswpNew = (PSWP) mp1 + (soldCount + 5 + 4182 (fToolbar != FALSE) + 4183 (fSplitStatus != FALSE) + 4184 (fDrivebar != FALSE) + (fAutoView != FALSE)); 4185 *pswpNew = *pswpClient; 4186 pswpNew->hwnd = hwndDrivelist; 4187 pswpNew->x = swpClient.x; 4188 pswpNew->cx = 48; 4189 pswpClient->cy -= (aheight + 6L); 4190 pswpNew->y = pswpClient->y; 4191 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4192 sCount++; 4193 pswpNew = (PSWP) mp1 + (soldCount + 6 + 4194 (fToolbar != FALSE) + 4195 (fDrivebar != FALSE) + 4196 (fSplitStatus != FALSE) + 4197 (fAutoView != FALSE)); 4198 *pswpNew = *pswpClient; 4199 pswpNew->hwnd = hwndStatelist; 4200 pswpNew->x = swpClient.x + 48; 4201 pswpNew->cx = (swpClient.cx - 48) / 7; 4202 pswpNew->y = pswpClient->y; 4203 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4204 sCount++; 4205 pswpNew = (PSWP) mp1 + (soldCount + 7 + 4206 (fToolbar != FALSE) + 4207 (fDrivebar != FALSE) + 4208 (fSplitStatus != FALSE) + 4209 (fAutoView != FALSE)); 4210 *pswpNew = *pswpClient; 4211 pswpNew->hwnd = hwndCmdlist; 4212 pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7); 4213 pswpNew->cx = (swpClient.cx - 48) / 5 + 4214 ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7); 4215 pswpNew->y = pswpClient->y; 4216 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4217 sCount++; 4218 pswpNew = (PSWP) mp1 + (soldCount + 8 + 4219 (fToolbar != FALSE) + 4220 (fDrivebar != FALSE) + 4221 (fSplitStatus != FALSE) + 4222 (fAutoView != FALSE)); 4223 *pswpNew = *pswpClient; 4224 pswpNew->hwnd = hwndUserlist; 4225 pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2); 4226 pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) - 4227 ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0); 4228 pswpNew->y = pswpClient->y; 4229 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4230 sCount++; 4231 if (fToolbar) { 4232 pswpNew = (PSWP) mp1 + (soldCount + 9 + 4233 (fToolbar != FALSE) + 4234 (fDrivebar != FALSE) + 4235 (fSplitStatus != FALSE) + 4236 (fAutoView != FALSE)); 4237 *pswpNew = *pswpClient; 4238 pswpNew->hwnd = hwndButtonlist; 4239 pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4; 4240 pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x; 4241 pswpNew->y = pswpClient->y; 4242 pswpNew->cy = pswpClient->cy + (aheight + 5L); 4243 sCount++; 4244 } 4245 else 4246 WinShowWindow(hwndButtonlist, FALSE); 4226 4247 } 4227 4248 else { 4228 WinShowWindow(hwndUserlist, FALSE);4229 WinShowWindow(hwndDrivelist, FALSE);4230 WinShowWindow(hwndStatelist, FALSE);4231 WinShowWindow(hwndButtonlist, FALSE);4232 WinShowWindow(hwndCmdlist, FALSE);4249 WinShowWindow(hwndUserlist, FALSE); 4250 WinShowWindow(hwndDrivelist, FALSE); 4251 WinShowWindow(hwndStatelist, FALSE); 4252 WinShowWindow(hwndButtonlist, FALSE); 4253 WinShowWindow(hwndCmdlist, FALSE); 4233 4254 } 4234 4255 { 4235 PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;4236 SHORT x;4237 4238 pswpNew = (PSWP) mp1 + (soldCount + 5 +4239 (fToolbar != FALSE) +4240 (fDrivebar != FALSE) +4241 (fSplitStatus != FALSE) +4242 (fAutoView != FALSE) +4243 ((fUserComboBox != FALSE) * 4) +4244 (fUserComboBox != FALSE &&4245 fToolbar != FALSE));4246 pswp = (PSWP) mp1;4247 for (x = 0; x < soldCount; x++) {4248 if (!pswpTitlebar &&4249 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)4250 pswpTitlebar = pswp;4251 else if (!pswpMinbutton &&4252 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)4253 pswpMinbutton = pswp;4254 if (pswpTitlebar && pswpMinbutton)4255 break;4256 pswp++;4257 }4258 if (pswpMinbutton && pswpTitlebar) {4259 *pswpNew = *pswpMinbutton;4260 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE);4261 pswpNew->cy = pswpMinbutton->cy + 3;4262 pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);4263 pswpTitlebar->cx -= (pswpNew->cx - 1);4264 pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx);4265 pswpNew->y = pswpMinbutton->y - 1;4266 sCount++;4267 }4268 else4269 WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE);4256 PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0; 4257 SHORT x; 4258 4259 pswpNew = (PSWP) mp1 + (soldCount + 5 + 4260 (fToolbar != FALSE) + 4261 (fDrivebar != FALSE) + 4262 (fSplitStatus != FALSE) + 4263 (fAutoView != FALSE) + 4264 ((fUserComboBox != FALSE) * 4) + 4265 (fUserComboBox != FALSE && 4266 fToolbar != FALSE)); 4267 pswp = (PSWP) mp1; 4268 for (x = 0; x < soldCount; x++) { 4269 if (!pswpTitlebar && 4270 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR) 4271 pswpTitlebar = pswp; 4272 else if (!pswpMinbutton && 4273 WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX) 4274 pswpMinbutton = pswp; 4275 if (pswpTitlebar && pswpMinbutton) 4276 break; 4277 pswp++; 4278 } 4279 if (pswpMinbutton && pswpTitlebar) { 4280 *pswpNew = *pswpMinbutton; 4281 pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE); 4282 pswpNew->cy = pswpMinbutton->cy + 3; 4283 pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3); 4284 pswpTitlebar->cx -= (pswpNew->cx - 1); 4285 pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx); 4286 pswpNew->y = pswpMinbutton->y - 1; 4287 sCount++; 4288 } 4289 else 4290 WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE); 4270 4291 } 4271 4292 4272 4293 if (fMoreButtons) { 4273 4294 4274 LONG lastx;4275 4276 pswpNew = (PSWP) mp1 + (soldCount + 6 +4277 (fToolbar != FALSE) +4278 (fDrivebar != FALSE) +4279 (fSplitStatus != FALSE) +4280 (fAutoView != FALSE) +4281 ((fUserComboBox != FALSE) * 4) +4282 (fUserComboBox != FALSE &&4283 fToolbar != FALSE));4284 *pswpNew = *pswpClient;4285 pswpNew->hwnd = hwndName;4286 pswpNew->x = swpClient.x + 3;4287 pswpNew->y = swpClient.y + (sheight + 6);4288 pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;4289 lastx = pswpNew->x + pswpNew->cx;4290 pswpNew->cy = bheight;4291 pswpClient->y += (bheight + 4);4292 pswpClient->cy -= (bheight + 4);4293 sCount++;4294 pswpNew = (PSWP) mp1 + (soldCount + 7 +4295 (fToolbar != FALSE) +4296 (fDrivebar != FALSE) +4297 (fSplitStatus != FALSE) +4298 (fAutoView != FALSE) +4299 ((fUserComboBox != FALSE) * 4) +4300 (fUserComboBox != FALSE &&4301 fToolbar != FALSE));4302 *pswpNew = *pswpClient;4303 pswpNew->hwnd = hwndDate;4304 pswpNew->x = lastx + 3;4305 pswpNew->y = swpClient.y + (sheight + 6);4306 pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;4307 lastx = pswpNew->x + pswpNew->cx;4308 pswpNew->cy = bheight;4309 sCount++;4310 pswpNew = (PSWP) mp1 + (soldCount + 8 +4311 (fToolbar != FALSE) +4312 (fDrivebar != FALSE) +4313 (fSplitStatus != FALSE) +4314 (fAutoView != FALSE) +4315 ((fUserComboBox != FALSE) * 4) +4316 (fUserComboBox != FALSE &&4317 fToolbar != FALSE));4318 *pswpNew = *pswpClient;4319 pswpNew->hwnd = hwndAttr;4320 pswpNew->x = lastx + 3;4321 pswpNew->y = swpClient.y + (sheight + 6);4322 pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;4323 pswpNew->cy = bheight;4324 sCount++;4295 LONG lastx; 4296 4297 pswpNew = (PSWP) mp1 + (soldCount + 6 + 4298 (fToolbar != FALSE) + 4299 (fDrivebar != FALSE) + 4300 (fSplitStatus != FALSE) + 4301 (fAutoView != FALSE) + 4302 ((fUserComboBox != FALSE) * 4) + 4303 (fUserComboBox != FALSE && 4304 fToolbar != FALSE)); 4305 *pswpNew = *pswpClient; 4306 pswpNew->hwnd = hwndName; 4307 pswpNew->x = swpClient.x + 3; 4308 pswpNew->y = swpClient.y + (sheight + 6); 4309 pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3; 4310 lastx = pswpNew->x + pswpNew->cx; 4311 pswpNew->cy = bheight; 4312 pswpClient->y += (bheight + 4); 4313 pswpClient->cy -= (bheight + 4); 4314 sCount++; 4315 pswpNew = (PSWP) mp1 + (soldCount + 7 + 4316 (fToolbar != FALSE) + 4317 (fDrivebar != FALSE) + 4318 (fSplitStatus != FALSE) + 4319 (fAutoView != FALSE) + 4320 ((fUserComboBox != FALSE) * 4) + 4321 (fUserComboBox != FALSE && 4322 fToolbar != FALSE)); 4323 *pswpNew = *pswpClient; 4324 pswpNew->hwnd = hwndDate; 4325 pswpNew->x = lastx + 3; 4326 pswpNew->y = swpClient.y + (sheight + 6); 4327 pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3; 4328 lastx = pswpNew->x + pswpNew->cx; 4329 pswpNew->cy = bheight; 4330 sCount++; 4331 pswpNew = (PSWP) mp1 + (soldCount + 8 + 4332 (fToolbar != FALSE) + 4333 (fDrivebar != FALSE) + 4334 (fSplitStatus != FALSE) + 4335 (fAutoView != FALSE) + 4336 ((fUserComboBox != FALSE) * 4) + 4337 (fUserComboBox != FALSE && 4338 fToolbar != FALSE)); 4339 *pswpNew = *pswpClient; 4340 pswpNew->hwnd = hwndAttr; 4341 pswpNew->x = lastx + 3; 4342 pswpNew->y = swpClient.y + (sheight + 6); 4343 pswpNew->cx = (swpClient.cx - pswpNew->x) - 1; 4344 pswpNew->cy = bheight; 4345 sCount++; 4325 4346 } 4326 4347 else { 4327 WinShowWindow(hwndAttr, FALSE);4328 WinShowWindow(hwndName, FALSE);4329 WinShowWindow(hwndDate, FALSE);4348 WinShowWindow(hwndAttr, FALSE); 4349 WinShowWindow(hwndName, FALSE); 4350 WinShowWindow(hwndDate, FALSE); 4330 4351 } 4331 4352 return MRFROMSHORT(sCount); … … 4340 4361 sCount += 6; 4341 4362 if (fSplitStatus) 4342 sCount++;4363 sCount++; 4343 4364 if (fToolbar) 4344 sCount++;4365 sCount++; 4345 4366 if (fUserComboBox) { 4346 sCount += 4;4347 if (fToolbar)4348 sCount++;4367 sCount += 4; 4368 if (fToolbar) 4369 sCount++; 4349 4370 } 4350 4371 if (fDrivebar) 4351 sCount++;4372 sCount++; 4352 4373 if (fAutoView) 4353 sCount++;4374 sCount++; 4354 4375 if (fMoreButtons) 4355 sCount += 3;4376 sCount += 3; 4356 4377 return MRFROMSHORT(sCount); 4357 4378 } … … 4374 4395 // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd); 4375 4396 if (hwnd != NULLHANDLE) { 4376 HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);4377 USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID);4378 switch (id) {4379 case MAIN_SETUPLIST:4380 case MAIN_USERLIST:4381 case MAIN_CMDLIST:4382 // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU");4383 WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0);4384 }4397 HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT); 4398 USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID); 4399 switch (id) { 4400 case MAIN_SETUPLIST: 4401 case MAIN_USERLIST: 4402 case MAIN_CMDLIST: 4403 // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU"); 4404 WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0); 4405 } 4385 4406 } 4386 4407 } … … 4411 4432 wa.size = sizeof(wa); 4412 4433 pci = 4413 (PCNRITEM)4414 WinSendMsg(WinWindowFromID4415 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),4416 CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),4417 MPFROMSHORT(CRA_CURSORED));4434 (PCNRITEM) 4435 WinSendMsg(WinWindowFromID 4436 (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), 4437 CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST), 4438 MPFROMSHORT(CRA_CURSORED)); 4418 4439 if (pci && (INT) pci != -1) { 4419 strcpy(wa.szCurrentPath1, pci->pszFileName);4420 MakeValidDir(wa.szCurrentPath1);4440 strcpy(wa.szCurrentPath1, pci->pszFileName); 4441 MakeValidDir(wa.szCurrentPath1); 4421 4442 } 4422 4443 else 4423 save_dir2(wa.szCurrentPath1);4444 save_dir2(wa.szCurrentPath1); 4424 4445 TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2); 4425 4446 if (!*wa.szCurrentPath2) 4426 strcpy(wa.szCurrentPath2, wa.szCurrentPath1);4447 strcpy(wa.szCurrentPath2, wa.szCurrentPath1); 4427 4448 MakeValidDir(wa.szCurrentPath2); 4428 4449 if (WinDlgBox(HWND_DESKTOP, 4429 hwnd,4430 WalkTwoCmpDlgProc,4431 FM3ModHandle,4432 WALK2_FRAME,4433 MPFROMP(&wa)) &&4434 !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) {4435 if (!*dircompare) {4436 4437 COMPARE *cmp;4438 4439 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);4440 if (cmp) {4441 cmp->size = sizeof(COMPARE);4442 strcpy(cmp->leftdir, wa.szCurrentPath1);4443 strcpy(cmp->rightdir, wa.szCurrentPath2);4444 cmp->hwndParent = hwnd;4445 cmp->dcd.hwndParent = hwnd;4446 WinDlgBox(HWND_DESKTOP,4447 HWND_DESKTOP,4448 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));4449 }4450 }4451 else {4452 4453 CHAR szPath1[CCHMAXPATH];4454 CHAR szPath2[CCHMAXPATH];4455 runemf2(SEPARATE,4456 HWND_DESKTOP, pszSrcFile, __LINE__,4457 NULL, NULL,4458 "%s %s %s",4459 dircompare,4460 BldQuotedFileName(szPath1, wa.szCurrentPath1),4461 BldQuotedFileName(szPath2, wa.szCurrentPath2));4462 }4450 hwnd, 4451 WalkTwoCmpDlgProc, 4452 FM3ModHandle, 4453 WALK2_FRAME, 4454 MPFROMP(&wa)) && 4455 !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) { 4456 if (!*dircompare) { 4457 4458 COMPARE *cmp; 4459 4460 cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__); 4461 if (cmp) { 4462 cmp->size = sizeof(COMPARE); 4463 strcpy(cmp->leftdir, wa.szCurrentPath1); 4464 strcpy(cmp->rightdir, wa.szCurrentPath2); 4465 cmp->hwndParent = hwnd; 4466 cmp->dcd.hwndParent = hwnd; 4467 WinDlgBox(HWND_DESKTOP, 4468 HWND_DESKTOP, 4469 CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp)); 4470 } 4471 } 4472 else { 4473 4474 CHAR szPath1[CCHMAXPATH]; 4475 CHAR szPath2[CCHMAXPATH]; 4476 runemf2(SEPARATE, 4477 HWND_DESKTOP, pszSrcFile, __LINE__, 4478 NULL, NULL, 4479 "%s %s %s", 4480 dircompare, 4481 BldQuotedFileName(szPath1, wa.szCurrentPath1), 4482 BldQuotedFileName(szPath2, wa.szCurrentPath2)); 4483 } 4463 4484 } 4464 4485 } … … 4472 4493 case IDM_CLI: 4473 4494 if (fSplitStatus && 4474 hwndStatus2 &&4475 !WinIsWindow(WinQueryAnchorBlock(hwnd),4476 WinWindowFromID(hwndStatus2, COMMAND_LINE)))4495 hwndStatus2 && 4496 !WinIsWindow(WinQueryAnchorBlock(hwnd), 4497 WinWindowFromID(hwndStatus2, COMMAND_LINE))) 4477 4498 PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID); 4478 4499 break; … … 4487 4508 bstrip(temp); 4488 4509 if (*temp && 4489 !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) {4490 if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {4491 add_udir(TRUE, path);4492 if (fUdirsChanged)4493 save_udirs();4494 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);4495 }4496 else {4497 if (!remove_udir(path))4498 Runtime_Error(pszSrcFile, __LINE__, "remove_udir");4499 else {4500 if (fUdirsChanged)4501 save_udirs();4502 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);4503 }4504 }4510 !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) { 4511 if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) { 4512 add_udir(TRUE, path); 4513 if (fUdirsChanged) 4514 save_udirs(); 4515 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 4516 } 4517 else { 4518 if (!remove_udir(path)) 4519 Runtime_Error(pszSrcFile, __LINE__, "remove_udir"); 4520 else { 4521 if (fUdirsChanged) 4522 save_udirs(); 4523 WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 4524 } 4525 } 4505 4526 } 4506 4527 } … … 4517 4538 // Ignore request if blank or attempting to using illegal name 4518 4539 if (*szStateName && stricmp(szStateName, GetPString(IDS_STATETEXT))) { 4519 if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {4520 // Save4521 INT nSaved = SaveDirCnrState(hwnd, szStateName);4522 if (nSaved > 0) {4523 INT ret = add_setup(szStateName);4524 if (ret == 0) {4525 WinSendMsg(hwndStatelist, LM_INSERTITEM,4526 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName));4527 save_setups();4528 }4529 else if (ret != 1) {4530 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,4531 GetPString(IDS_WARNINGTEXT),4532 "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed4533 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));4534 }4535 }4536 else {4537 saymsg(MB_ENTER | MB_ICONASTERISK,4538 hwnd,4539 GetPString(IDS_WARNINGTEXT),4540 nSaved == 0 ?4541 "Nothing to save" :4542 "State data save failed");4543 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));4544 }4545 }4546 else {4547 // Delete4548 ULONG numsaves = 0, size, x;4549 CHAR s[STATE_NAME_MAX_BYTES + 80];4550 4551 INT ret = remove_setup(szStateName);4552 if (ret == 1)4553 save_setups();4554 sprintf(s, "%s.NumDirsLastTime", szStateName);4555 size = sizeof(ULONG);4556 if (!PrfQueryProfileData(fmprof,4557 FM3Str,4558 s,4559 (PVOID)&numsaves,4560 &size)) {4561 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,4562 GetPString(IDS_WARNINGTEXT),4563 GetPString(IDS_DOESNTEXISTTEXT), szStateName);4564 }4565 else if (!size)4566 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);4567 else {4568 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L);4569 for (x = 0; x < numsaves; x++) {4570 sprintf(s, "%s.DirCnrPos.%lu", szStateName, x);4571 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4572 sprintf(s, "%s.DirCnrDir.%lu", szStateName, x);4573 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4574 sprintf(s, "%s.DirCnrSort.%lu", szStateName, x);4575 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4576 sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x);4577 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4578 sprintf(s, "%s.DirCnrView.%lu", szStateName, x);4579 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4580 sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x);4581 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4582 sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x);4583 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4584 sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x);4585 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4586 sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x);4587 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4588 sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x);4589 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4590 sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x);4591 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4592 sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x);4593 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4594 sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x);4595 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4596 sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x);4597 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4598 sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x);4599 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4600 sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x);4601 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4602 }4603 sprintf(s, "%s.LastTreePos", szStateName);4604 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4605 sprintf(s, "%s.MySizeLastTime", szStateName);4606 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);4607 }4608 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);4609 }4540 if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) { 4541 // Save 4542 INT nSaved = SaveDirCnrState(hwnd, szStateName); 4543 if (nSaved > 0) { 4544 INT ret = add_setup(szStateName); 4545 if (ret == 0) { 4546 WinSendMsg(hwndStatelist, LM_INSERTITEM, 4547 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName)); 4548 save_setups(); 4549 } 4550 else if (ret != 1) { 4551 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4552 GetPString(IDS_WARNINGTEXT), 4553 "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed 4554 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4555 } 4556 } 4557 else { 4558 saymsg(MB_ENTER | MB_ICONASTERISK, 4559 hwnd, 4560 GetPString(IDS_WARNINGTEXT), 4561 nSaved == 0 ? 4562 "Nothing to save" : 4563 "State data save failed"); 4564 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4565 } 4566 } 4567 else { 4568 // Delete 4569 ULONG numsaves = 0, size, x; 4570 CHAR s[STATE_NAME_MAX_BYTES + 80]; 4571 4572 INT ret = remove_setup(szStateName); 4573 if (ret == 1) 4574 save_setups(); 4575 sprintf(s, "%s.NumDirsLastTime", szStateName); 4576 size = sizeof(ULONG); 4577 if (!PrfQueryProfileData(fmprof, 4578 FM3Str, 4579 s, 4580 (PVOID)&numsaves, 4581 &size)) { 4582 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4583 GetPString(IDS_WARNINGTEXT), 4584 GetPString(IDS_DOESNTEXISTTEXT), szStateName); 4585 } 4586 else if (!size) 4587 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 4588 else { 4589 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L); 4590 for (x = 0; x < numsaves; x++) { 4591 sprintf(s, "%s.DirCnrPos.%lu", szStateName, x); 4592 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4593 sprintf(s, "%s.DirCnrDir.%lu", szStateName, x); 4594 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4595 sprintf(s, "%s.DirCnrSort.%lu", szStateName, x); 4596 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4597 sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x); 4598 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4599 sprintf(s, "%s.DirCnrView.%lu", szStateName, x); 4600 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4601 sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x); 4602 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4603 sprintf(s, "%s.DirCnr.%lu.DetailsSubject", szStateName, x); 4604 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4605 sprintf(s, "%s.DirCnr.%lu.DetailsSize", szStateName, x); 4606 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4607 sprintf(s, "%s.DirCnr.%lu.DetailsEA", szStateName, x); 4608 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4609 sprintf(s, "%s.DirCnr.%lu.DetailsAttr", szStateName, x); 4610 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4611 sprintf(s, "%s.DirCnr.%lu.DetailsLWDate", szStateName, x); 4612 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4613 sprintf(s, "%s.DirCnr.%lu.DetailsLWTime", szStateName, x); 4614 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4615 sprintf(s, "%s.DirCnr.%lu.DetailsLADate", szStateName, x); 4616 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4617 sprintf(s, "%s.DirCnr.%lu.DetailsLATime", szStateName, x); 4618 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4619 sprintf(s, "%s.DirCnr.%lu.DetailsCRDate", szStateName, x); 4620 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4621 sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x); 4622 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4623 } 4624 sprintf(s, "%s.LastTreePos", szStateName); 4625 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4626 sprintf(s, "%s.MySizeLastTime", szStateName); 4627 PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0); 4628 } 4629 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); 4630 } 4610 4631 } 4611 4632 } … … 4620 4641 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 4621 4642 if (swp.fl & SWP_MAXIMIZE) { 4622 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND,4623 MPFROM2SHORT(SC_RESTORE, 0), MPVOID);4624 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);4643 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND, 4644 MPFROM2SHORT(SC_RESTORE, 0), MPVOID); 4645 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 4625 4646 } 4626 4647 WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD); … … 4630 4651 swpD.cy -= (icz + bsz); 4631 4652 if (swp.x == swpD.x && swp.y == swpD.y && 4632 swp.cx == swpD.cx && swp.cy == swpD.cy &&4633 // fixme to be #defined someday4634 WinQueryWindowUShort(hwnd, QWL_USER + 10) &&4635 WinQueryWindowUShort(hwnd, QWL_USER + 14)) {4636 swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8);4637 swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10);4638 swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12);4639 swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14);4653 swp.cx == swpD.cx && swp.cy == swpD.cy && 4654 // fixme to be #defined someday 4655 WinQueryWindowUShort(hwnd, QWL_USER + 10) && 4656 WinQueryWindowUShort(hwnd, QWL_USER + 14)) { 4657 swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8); 4658 swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10); 4659 swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12); 4660 swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14); 4640 4661 } 4641 4662 else { 4642 WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x);4643 WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx);4644 WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y);4645 WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy);4663 WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x); 4664 WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx); 4665 WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y); 4666 WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy); 4646 4667 } 4647 4668 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 4648 swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE);4669 swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE); 4649 4670 } 4650 4671 break; … … 4652 4673 case IDM_BLINK: 4653 4674 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, 4654 SWP_MINIMIZE);4675 SWP_MINIMIZE); 4655 4676 WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0, 4656 SWP_RESTORE | SWP_ZORDER);4677 SWP_RESTORE | SWP_ZORDER); 4657 4678 break; 4658 4679 … … 4662 4683 4663 4684 if (hwndTop) 4664 WinSetFocus(HWND_DESKTOP, hwndTop);4685 WinSetFocus(HWND_DESKTOP, hwndTop); 4665 4686 } 4666 4687 break; … … 4675 4696 case IDM_QUICKSETTINGS: 4676 4697 WinDlgBox(HWND_DESKTOP, 4677 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1));4698 hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1)); 4678 4699 break; 4679 4700 … … 4681 4702 case IDM_VIEWINFS: 4682 4703 WinDlgBox(HWND_DESKTOP, 4683 HWND_DESKTOP,4684 ViewInfProc,4685 FM3ModHandle,4686 VINF_FRAME,4687 ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ?4688 MPFROMP(NullStr) : MPVOID));4704 HWND_DESKTOP, 4705 ViewInfProc, 4706 FM3ModHandle, 4707 VINF_FRAME, 4708 ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ? 4709 MPFROMP(NullStr) : MPVOID)); 4689 4710 break; 4690 4711 … … 4696 4717 TopWindowName(hwnd, (HWND) 0, newpath); 4697 4718 if (WinDlgBox(HWND_DESKTOP, 4698 hwnd,4699 WalkAllDlgProc,4700 FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath)4701 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath);4719 hwnd, 4720 WalkAllDlgProc, 4721 FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath) 4722 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath); 4702 4723 } 4703 4724 break; … … 4720 4741 if (SHORT1FROMMP(mp2) == CMDSRC_MENU) { 4721 4742 4722 RECTL rcl;4723 ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;4724 4725 WinQueryWindowRect(HWND_DESKTOP, &rcl);4726 rcl.yBottom += icz;4727 rcl.yTop -= icz;4728 rcl.xLeft += icz;4729 rcl.xRight -= icz;4730 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);4743 RECTL rcl; 4744 ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L; 4745 4746 WinQueryWindowRect(HWND_DESKTOP, &rcl); 4747 rcl.yBottom += icz; 4748 rcl.yTop -= icz; 4749 rcl.xLeft += icz; 4750 rcl.xRight -= icz; 4751 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID); 4731 4752 } 4732 4753 else { 4733 4754 4734 RECTL rcl;4735 4736 WinQueryWindowRect(HWND_DESKTOP, &rcl);4737 rcl.yBottom += 8;4738 rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7);4739 rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7);4740 rcl.xRight -= 8;4741 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);4755 RECTL rcl; 4756 4757 WinQueryWindowRect(HWND_DESKTOP, &rcl); 4758 rcl.yBottom += 8; 4759 rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7); 4760 rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7); 4761 rcl.xRight -= 8; 4762 WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID); 4742 4763 } 4743 4764 switch (SHORT1FROMMP(mp1)) { 4744 4765 case IDM_HELPCONTEXT: 4745 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4746 MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID));4747 break;4766 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4767 MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID)); 4768 break; 4748 4769 4749 4770 case IDM_HELPMOUSE: 4750 if (hwndHelp)4751 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4752 MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID));4753 break;4771 if (hwndHelp) 4772 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4773 MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID)); 4774 break; 4754 4775 4755 4776 case IDM_HELPPIX: 4756 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4757 MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID));4758 break;4777 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4778 MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID)); 4779 break; 4759 4780 4760 4781 case IDM_HELPTUTOR: 4761 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4762 MPFROM2SHORT(HELP_TUTORIAL, 0),4763 MPFROMSHORT(HM_RESOURCEID));4764 break;4782 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4783 MPFROM2SHORT(HELP_TUTORIAL, 0), 4784 MPFROMSHORT(HM_RESOURCEID)); 4785 break; 4765 4786 4766 4787 case IDM_HELPHINTS: 4767 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4768 MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID));4769 break;4788 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4789 MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID)); 4790 break; 4770 4791 4771 4792 case IDM_HELPGENERAL: 4772 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4773 MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID));4774 break;4793 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4794 MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID)); 4795 break; 4775 4796 case IDM_HELPKEYS: 4776 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4777 MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID));4778 break;4797 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4798 MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID)); 4799 break; 4779 4800 4780 4801 case IDM_HELP: 4781 4802 case IDM_HELPCONTENTS: 4782 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);4783 break;4803 WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID); 4804 break; 4784 4805 4785 4806 case IDM_HELPUSERLIST: 4786 WinSendMsg(hwndHelp, HM_DISPLAY_HELP,4787 MPFROM2SHORT(HELP_USERLISTS, 0),4788 MPFROMSHORT(HM_RESOURCEID));4789 break;4807 WinSendMsg(hwndHelp, HM_DISPLAY_HELP, 4808 MPFROM2SHORT(HELP_USERLISTS, 0), 4809 MPFROMSHORT(HM_RESOURCEID)); 4810 break; 4790 4811 } 4791 4812 } … … 4798 4819 case IDM_ABOUT: 4799 4820 WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle, 4800 ABT_FRAME, MPVOID);4821 ABT_FRAME, MPVOID); 4801 4822 break; 4802 4823 … … 4812 4833 4813 4834 if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, 4814 (PVOID) & version, (ULONG) sizeof(version))) {4815 if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) {4816 if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE)4817 palette = "<WP_HIRESCLRPAL>";4818 else4819 palette = "<WP_LORESCLRPAL>";4820 }4835 (PVOID) & version, (ULONG) sizeof(version))) { 4836 if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) { 4837 if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE) 4838 palette = "<WP_HIRESCLRPAL>"; 4839 else 4840 palette = "<WP_LORESCLRPAL>"; 4841 } 4821 4842 } 4822 4843 OpenObject(palette, Default, hwnd); … … 4834 4855 hWPSObject = WinQueryObject("<WP_SCHPAL>"); 4835 4856 if (hWPSObject != NULLHANDLE) 4836 WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter,"4837 "Spring:PM_Spring,Summer:PM_Summer,"4838 "System:PM_System,Windows:PM_Windows;"4839 "OPEN=DEFAULT");4857 WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter," 4858 "Spring:PM_Spring,Summer:PM_Summer," 4859 "System:PM_System,Windows:PM_Windows;" 4860 "OPEN=DEFAULT"); 4840 4861 } 4841 4862 break; … … 4848 4869 case IDM_SYSINFO: 4849 4870 WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle, 4850 SYS_FRAME, NULL);4871 SYS_FRAME, NULL); 4851 4872 break; 4852 4873 #endif … … 4858 4879 4859 4880 if (hwndTree) 4860 pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS,4861 MPFROMLONG(CMA_FIRST),4862 MPFROMSHORT(CRA_CURSORED));4881 pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS, 4882 MPFROMLONG(CMA_FIRST), 4883 MPFROMSHORT(CRA_CURSORED)); 4863 4884 if (pci && (INT) pci != -1) { 4864 strcpy(path, pci->pszFileName);4865 MakeValidDir(path);4885 strcpy(path, pci->pszFileName); 4886 MakeValidDir(path); 4866 4887 } 4867 4888 else 4868 save_dir2(path);4889 save_dir2(path); 4869 4890 WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle, 4870 BAT_FRAME, MPFROMP(path));4891 BAT_FRAME, MPFROMP(path)); 4871 4892 } 4872 4893 break; … … 4882 4903 TopWindowName(hwnd, (HWND) 0, path); 4883 4904 if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE) 4884 env = GetCmdSpec(TRUE);4905 env = GetCmdSpec(TRUE); 4885 4906 else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) { 4886 env = "WINOS2.COM";4887 type = SEPARATE | FULLSCREEN;4907 env = "WINOS2.COM"; 4908 type = SEPARATE | FULLSCREEN; 4888 4909 } 4889 4910 runemf2(type, hwnd, pszSrcFile, __LINE__, 4890 path, NULL, "%s", env);4911 path, NULL, "%s", env); 4891 4912 } 4892 4913 break; … … 4894 4915 case IDM_KILLPROC: 4895 4916 WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle, 4896 KILL_FRAME, NULL);4917 KILL_FRAME, NULL); 4897 4918 break; 4898 4919 … … 4909 4930 case IDM_AUTOVIEW: 4910 4931 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 4911 &fAutoView, TRUE, "AutoView");4932 &fAutoView, TRUE, "AutoView"); 4912 4933 AutoChange: 4913 4934 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 4914 MPFROMLONG(FCF_SIZEBORDER), MPVOID);4935 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 4915 4936 if (fAutoView) { 4916 4937 … … 4921 4942 hwndDir = TopWindowName(hwnd, (HWND) 0, s); 4922 4943 if (hwndDir) { 4923 hwndDir = WinWindowFromID(hwndDir, FID_CLIENT);4924 if (hwndDir) {4925 hwndDir = WinWindowFromID(hwndDir, DIR_CNR);4926 if (hwndDir) {4927 pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS,4928 MPFROMLONG(CMA_FIRST),4929 MPFROMSHORT(CRA_CURSORED));4930 if (pci && (INT) pci != -1 &&4931 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))4932 WinSendMsg(hwnd,4933 UM_LOADFILE,4934 MPFROMP(pci->pszFileName),4935 (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ?4936 MPVOID : MPFROMLONG(1));4937 }4938 }4944 hwndDir = WinWindowFromID(hwndDir, FID_CLIENT); 4945 if (hwndDir) { 4946 hwndDir = WinWindowFromID(hwndDir, DIR_CNR); 4947 if (hwndDir) { 4948 pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS, 4949 MPFROMLONG(CMA_FIRST), 4950 MPFROMSHORT(CRA_CURSORED)); 4951 if (pci && (INT) pci != -1 && 4952 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW))) 4953 WinSendMsg(hwnd, 4954 UM_LOADFILE, 4955 MPFROMP(pci->pszFileName), 4956 (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ? 4957 MPVOID : MPFROMLONG(1)); 4958 } 4959 } 4939 4960 } 4940 4961 } … … 4943 4964 case IDM_TEXTTOOLS: 4944 4965 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 4945 &fTextTools, TRUE, "TextTools");4966 &fTextTools, TRUE, "TextTools"); 4946 4967 BuildTools(hwndToolback, TRUE); 4947 4968 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 4948 MPFROMLONG(FCF_SIZEBORDER), MPVOID);4969 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 4949 4970 break; 4950 4971 4951 4972 case IDM_TOOLTITLES: 4952 4973 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 4953 &fToolTitles, TRUE, "ToolTitles");4974 &fToolTitles, TRUE, "ToolTitles"); 4954 4975 BuildTools(hwndToolback, TRUE); 4955 4976 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 4956 MPFROMLONG(FCF_SIZEBORDER), MPVOID);4977 MPFROMLONG(FCF_SIZEBORDER), MPVOID); 4957 4978 break; 4958 4979 … … 4964 4985 MenuInvisible = (MenuInvisible) ? FALSE : TRUE; 4965 4986 if (MenuInvisible) { 4966 WinSetParent(hwndMenu, HWND_OBJECT, FALSE);4967 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),4968 FID_SYSMENU), IDM_HIDEMENU,4969 GetPString(IDS_UNHIDEMENUTEXT));4987 WinSetParent(hwndMenu, HWND_OBJECT, FALSE); 4988 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 4989 FID_SYSMENU), IDM_HIDEMENU, 4990 GetPString(IDS_UNHIDEMENUTEXT)); 4970 4991 } 4971 4992 else { 4972 WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE);4973 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),4974 FID_SYSMENU), IDM_HIDEMENU,4975 GetPString(IDS_HIDEMENUTEXT));4993 WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE); 4994 WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 4995 FID_SYSMENU), IDM_HIDEMENU, 4996 GetPString(IDS_HIDEMENUTEXT)); 4976 4997 } 4977 4998 PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME, 4978 MPFROMLONG(FCF_MENU), MPVOID);4999 MPFROMLONG(FCF_MENU), MPVOID); 4979 5000 PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible", 4980 &MenuInvisible, sizeof(BOOL));5001 &MenuInvisible, sizeof(BOOL)); 4981 5002 } 4982 5003 break; … … 4991 5012 4992 5013 if (Collector) 4993 already = TRUE;5014 already = TRUE; 4994 5015 if (!already && !fAutoTile && !fExternalCollector) 4995 GetNextWindowPos(hwnd, &swp, NULL, NULL);5016 GetNextWindowPos(hwnd, &swp, NULL, NULL); 4996 5017 hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4); 4997 5018 if (hwndC) { 4998 if (!already && !fAutoTile && !fExternalCollector)4999 WinSetWindowPos(hwndC, HWND_TOP,5000 swp.x, swp.y, swp.cx, swp.cy,5001 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);5002 else if (fAutoTile && !already)5003 TileChildren(hwnd, TRUE);5004 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE |5005 SWP_ACTIVATE);5006 if (SHORT1FROMMP(mp1) == IDM_GREP)5007 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,5008 MPFROM2SHORT(IDM_GREP, 0), MPVOID);5009 if (SHORT1FROMMP(mp1) == IDM_SEEALL)5010 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,5011 MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);5019 if (!already && !fAutoTile && !fExternalCollector) 5020 WinSetWindowPos(hwndC, HWND_TOP, 5021 swp.x, swp.y, swp.cx, swp.cy, 5022 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 5023 else if (fAutoTile && !already) 5024 TileChildren(hwnd, TRUE); 5025 WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE | 5026 SWP_ACTIVATE); 5027 if (SHORT1FROMMP(mp1) == IDM_GREP) 5028 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND, 5029 MPFROM2SHORT(IDM_GREP, 0), MPVOID); 5030 if (SHORT1FROMMP(mp1) == IDM_SEEALL) 5031 PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND, 5032 MPFROM2SHORT(IDM_SEEALL, 0), MPVOID); 5012 5033 } 5013 5034 } … … 5020 5041 5021 5042 if (!toolhead || !toolhead->next) { 5022 firsttool = (toolhead) ? toolhead->id : 0;5023 break;5043 firsttool = (toolhead) ? toolhead->id : 0; 5044 break; 5024 5045 } 5025 5046 tool = find_tool(firsttool); 5026 5047 if (!tool) 5027 tool = toolhead;5048 tool = toolhead; 5028 5049 if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) { 5029 tool = prev_tool(tool, TRUE);5030 firsttool = tool->id;5050 tool = prev_tool(tool, TRUE); 5051 firsttool = tool->id; 5031 5052 } 5032 5053 else { 5033 tool = next_tool(tool, TRUE);5034 firsttool = tool->id;5054 tool = next_tool(tool, TRUE); 5055 firsttool = tool->id; 5035 5056 } 5036 5057 ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5037 MAIN_TOOLS));5058 MAIN_TOOLS)); 5038 5059 } 5039 5060 break; … … 5045 5066 case IDM_TOOLBAR: 5046 5067 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5047 IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar");5068 IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar"); 5048 5069 BuildTools(hwndToolback, TRUE); 5049 5070 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5050 MAIN_TOOLS), fToolbar);5071 MAIN_TOOLS), fToolbar); 5051 5072 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 5052 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);5073 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5053 5074 if (fDrivebar) 5054 5075 WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5055 MAIN_DRIVES), NULL, TRUE);5076 MAIN_DRIVES), NULL, TRUE); 5056 5077 break; 5057 5078 5058 5079 case IDM_DRIVEBAR: 5059 5080 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5060 IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar");5081 IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar"); 5061 5082 WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5062 MAIN_DRIVES), fDrivebar);5083 MAIN_DRIVES), fDrivebar); 5063 5084 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5064 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);5085 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5065 5086 PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID); 5066 5087 break; … … 5068 5089 case IDM_USERLIST: 5069 5090 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5070 SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox");5091 SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox"); 5071 5092 WinShowWindow(hwndUserlist, fUserComboBox); 5072 5093 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5073 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);5094 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5074 5095 PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID); 5075 5096 PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID); … … 5083 5104 WinSetWindowText(hwndAttr, NullStr); 5084 5105 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5085 SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons");5106 SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons"); 5086 5107 if (fMoreButtons) { 5087 5108 … … 5091 5112 5092 5113 if (hwndTemp) { 5093 WinSetFocus(HWND_DESKTOP, hwnd);5094 WinSetFocus(HWND_DESKTOP, hwndTemp);5114 WinSetFocus(HWND_DESKTOP, hwnd); 5115 WinSetFocus(HWND_DESKTOP, hwndTemp); 5095 5116 } 5096 5117 } 5097 5118 PostMsg(WinQueryWindow(hwnd, QW_PARENT), 5098 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);5119 WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID); 5099 5120 break; 5100 5121 5101 5122 case IDM_TOGGLEDRAGDIALOG: 5102 5123 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5103 IDM_TOGGLEDRAGDIALOG,5104 &fDragndropDlg,5105 TRUE,5106 "Drag&DropDlg");5124 IDM_TOGGLEDRAGDIALOG, 5125 &fDragndropDlg, 5126 TRUE, 5127 "Drag&DropDlg"); 5107 5128 break; 5108 5129 5109 5130 case IDM_SYNCUPDATES: 5110 5131 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5111 IDM_SYNCUPDATES,5112 &fSyncUpdates,5113 TRUE,5114 "SyncUpdates");5132 IDM_SYNCUPDATES, 5133 &fSyncUpdates, 5134 TRUE, 5135 "SyncUpdates"); 5115 5136 break; 5116 5137 … … 5122 5143 WinQueryWindowPos(hwnd, &swp); 5123 5144 WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0, 5124 SWP_MOVE);5145 SWP_MOVE); 5125 5146 } 5126 5147 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1), 5127 &fFreeTree, TRUE, "FreeTree");5148 &fFreeTree, TRUE, "FreeTree"); 5128 5149 if (fAutoTile) 5129 5150 TileChildren(hwnd, TRUE); … … 5132 5153 case IDM_AUTOTILE: 5133 5154 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5134 SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile");5155 SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile"); 5135 5156 if (fAutoTile) 5136 5157 TileChildren(hwnd, TRUE); … … 5139 5160 case IDM_TILEBACKWARDS: 5140 5161 SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), 5141 SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards");5162 SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards"); 5142 5163 if (fAutoTile) 5143 5164 TileChildren(hwnd, TRUE); … … 5184 5205 default: 5185 5206 if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER), 5186 SHORT1FROMMP(mp1))) {5207 SHORT1FROMMP(mp1))) { 5187 5208 if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART && 5188 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {5189 5190 INT x;5191 HWND hwndCnr;5192 5193 if (!cmdloaded)5194 load_commands();5195 hwndCnr = TopWindow(hwnd, (HWND) 0);5196 hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),5197 UM_CONTAINERHWND, MPVOID, MPVOID);5198 if (!hwndCnr) {5199 Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT);5200 break;5201 }5202 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;5203 if (x >= 0) {5204 x++;5205 RunCommand(hwndCnr, x);5206 if (fUnHilite) {5207 5208 PCNRITEM pci;5209 DIRCNRDATA *dcd = NULL;5210 5211 // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR?5212 if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)5213 dcd = INSTDATA(hwndCnr);5214 pci = (PCNRITEM) WinSendMsg(hwndCnr,5215 CM_QUERYRECORDEMPHASIS,5216 MPFROMLONG(CMA_FIRST),5217 MPFROMSHORT(CRA_CURSORED));5218 if (pci && (INT) pci != -1 &&5219 (pci->rc.flRecordAttr & CRA_SELECTED))5220 {5221 UnHilite(hwnd,5222 TRUE,5223 dcd ? &dcd->lastselection : NULL,5224 dcd ? dcd ->ulItemsToUnHilite : 0);5225 }5226 }5227 }5209 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) { 5210 5211 INT x; 5212 HWND hwndCnr; 5213 5214 if (!cmdloaded) 5215 load_commands(); 5216 hwndCnr = TopWindow(hwnd, (HWND) 0); 5217 hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT), 5218 UM_CONTAINERHWND, MPVOID, MPVOID); 5219 if (!hwndCnr) { 5220 Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT); 5221 break; 5222 } 5223 x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART; 5224 if (x >= 0) { 5225 x++; 5226 RunCommand(hwndCnr, x); 5227 if (fUnHilite) { 5228 5229 PCNRITEM pci; 5230 DIRCNRDATA *dcd = NULL; 5231 5232 // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR? 5233 if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR) 5234 dcd = INSTDATA(hwndCnr); 5235 pci = (PCNRITEM) WinSendMsg(hwndCnr, 5236 CM_QUERYRECORDEMPHASIS, 5237 MPFROMLONG(CMA_FIRST), 5238 MPFROMSHORT(CRA_CURSORED)); 5239 if (pci && (INT) pci != -1 && 5240 (pci->rc.flRecordAttr & CRA_SELECTED)) 5241 { 5242 UnHilite(hwnd, 5243 TRUE, 5244 dcd ? &dcd->lastselection : NULL, 5245 dcd ? dcd ->ulItemsToUnHilite : 0); 5246 } 5247 } 5248 } 5228 5249 } 5229 5250 else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART && 5230 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) {5231 if (!qtloaded)5232 load_quicktools();5233 if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) {5234 if (fToolsChanged)5235 save_tools(NULL);5236 if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]))5237 load_tools(NULL);5238 else {5239 strcpy(lasttoolbox,5240 quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]);5241 PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox);5242 }5243 BuildTools(hwndToolback, TRUE);5244 }5251 SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) { 5252 if (!qtloaded) 5253 load_quicktools(); 5254 if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) { 5255 if (fToolsChanged) 5256 save_tools(NULL); 5257 if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART])) 5258 load_tools(NULL); 5259 else { 5260 strcpy(lasttoolbox, 5261 quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]); 5262 PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox); 5263 } 5264 BuildTools(hwndToolback, TRUE); 5265 } 5245 5266 } 5246 5267 else { 5247 5268 5248 HWND hwndActive;5249 5250 hwndActive = TopWindow(hwnd, (HWND) 0);5251 if (hwndActive)5252 PostMsg(WinWindowFromID(hwndActive, FID_CLIENT),5253 WM_COMMAND, mp1, mp2);5269 HWND hwndActive; 5270 5271 hwndActive = TopWindow(hwnd, (HWND) 0); 5272 if (hwndActive) 5273 PostMsg(WinWindowFromID(hwndActive, FID_CLIENT), 5274 WM_COMMAND, mp1, mp2); 5254 5275 } 5255 5276 } … … 5260 5281 5261 5282 static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1, 5262 MPARAM mp2)5283 MPARAM mp2) 5263 5284 { 5264 5285 TID tid; … … 5283 5304 if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) { 5284 5305 Runtime_Error(pszSrcFile, __LINE__, 5285 GetPString(IDS_COULDNTSTARTTHREADTEXT));5306 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 5286 5307 PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID); 5287 5308 return 0; … … 5302 5323 5303 5324 if (!WinCreateWindow(hwndFrame, 5304 WC_BUTTON,5305 "I",5306 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS,5307 ((swp.cx -5308 WinQuerySysValue(HWND_DESKTOP,5309 SV_CXMINMAXBUTTON)) -5310 WinQuerySysValue(HWND_DESKTOP,5311 SV_CXMINMAXBUTTON) / 2) -5312 WinQuerySysValue(HWND_DESKTOP,5313 SV_CXSIZEBORDER),5314 (swp.cy - WinQuerySysValue(HWND_DESKTOP,5315 SV_CYMINMAXBUTTON)) -5316 WinQuerySysValue(HWND_DESKTOP,5317 SV_CYSIZEBORDER),5318 WinQuerySysValue(HWND_DESKTOP,5319 SV_CXMINMAXBUTTON) / 2,5320 WinQuerySysValue(HWND_DESKTOP,5321 SV_CYMINMAXBUTTON),5322 hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) {5325 WC_BUTTON, 5326 "I", 5327 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, 5328 ((swp.cx - 5329 WinQuerySysValue(HWND_DESKTOP, 5330 SV_CXMINMAXBUTTON)) - 5331 WinQuerySysValue(HWND_DESKTOP, 5332 SV_CXMINMAXBUTTON) / 2) - 5333 WinQuerySysValue(HWND_DESKTOP, 5334 SV_CXSIZEBORDER), 5335 (swp.cy - WinQuerySysValue(HWND_DESKTOP, 5336 SV_CYMINMAXBUTTON)) - 5337 WinQuerySysValue(HWND_DESKTOP, 5338 SV_CYSIZEBORDER), 5339 WinQuerySysValue(HWND_DESKTOP, 5340 SV_CXMINMAXBUTTON) / 2, 5341 WinQuerySysValue(HWND_DESKTOP, 5342 SV_CYMINMAXBUTTON), 5343 hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) { 5323 5344 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5324 5345 } 5325 5346 else { 5326 5347 WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE), 5327 IdealButtonProc);5348 IdealButtonProc); 5328 5349 SetPresParams(WinWindowFromID(hwndFrame, 5329 IDM_IDEALSIZE),5330 NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT));5350 IDM_IDEALSIZE), 5351 NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT)); 5331 5352 } 5332 5353 5333 5354 hwndTmp = WinCreateWindow(hwndFrame, 5334 WC_BUTTON,5335 "#1019",5336 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |5337 BS_BITMAP,5338 swp.cx - 46,5339 swp.y + 2,5340 24,5341 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL);5355 WC_BUTTON, 5356 "#1019", 5357 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | 5358 BS_BITMAP, 5359 swp.cx - 46, 5360 swp.y + 2, 5361 24, 5362 22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL); 5342 5363 if (!hwndTmp) 5343 5364 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5344 5365 5345 5366 hwndTmp = WinCreateWindow(hwndFrame, 5346 WC_BUTTON,5347 "#3062",5348 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |5349 BS_BITMAP,5350 swp.cx - 22,5351 swp.y + 2,5352 24,5353 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL);5367 WC_BUTTON, 5368 "#3062", 5369 WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS | 5370 BS_BITMAP, 5371 swp.cx - 22, 5372 swp.y + 2, 5373 24, 5374 22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL); 5354 5375 if (!hwndTmp) 5355 5376 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5356 5377 5357 5378 hwndUserlist = WinCreateWindow(hwndFrame, 5358 WC_COMBOBOX,5359 (PSZ) NULL,5360 WS_VISIBLE | CBS_DROPDOWN |5361 LS_HORZSCROLL,5362 (swp.x +5363 WinQuerySysValue(HWND_DESKTOP,5364 SV_CXSIZEBORDER) + 48L),5365 (swp.cy -5366 WinQuerySysValue(HWND_DESKTOP,5367 SV_CYSIZEBORDER)) - 60,5368 ((swp.cx -5369 (WinQuerySysValue(HWND_DESKTOP,5370 SV_CXSIZEBORDER) *5371 2)) - 64L), 60L, hwndFrame, HWND_TOP,5372 MAIN_USERLIST, NULL, NULL);5379 WC_COMBOBOX, 5380 (PSZ) NULL, 5381 WS_VISIBLE | CBS_DROPDOWN | 5382 LS_HORZSCROLL, 5383 (swp.x + 5384 WinQuerySysValue(HWND_DESKTOP, 5385 SV_CXSIZEBORDER) + 48L), 5386 (swp.cy - 5387 WinQuerySysValue(HWND_DESKTOP, 5388 SV_CYSIZEBORDER)) - 60, 5389 ((swp.cx - 5390 (WinQuerySysValue(HWND_DESKTOP, 5391 SV_CXSIZEBORDER) * 5392 2)) - 64L), 60L, hwndFrame, HWND_TOP, 5393 MAIN_USERLIST, NULL, NULL); 5373 5394 if (!hwndUserlist) 5374 5395 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5375 5396 hwndCmdlist = WinCreateWindow(hwndFrame, 5376 WC_COMBOBOX,5377 (PSZ) NULL,5378 WS_VISIBLE | CBS_DROPDOWN |5379 LS_HORZSCROLL,5380 (swp.x +5381 WinQuerySysValue(HWND_DESKTOP,5382 SV_CXSIZEBORDER) + 48L),5383 (swp.cy -5384 WinQuerySysValue(HWND_DESKTOP,5385 SV_CYSIZEBORDER)) - 60,5386 ((swp.cx -5387 (WinQuerySysValue(HWND_DESKTOP,5388 SV_CXSIZEBORDER) * 2)) -5389 64L), 60L, hwndFrame, HWND_TOP,5390 MAIN_CMDLIST, NULL, NULL);5397 WC_COMBOBOX, 5398 (PSZ) NULL, 5399 WS_VISIBLE | CBS_DROPDOWN | 5400 LS_HORZSCROLL, 5401 (swp.x + 5402 WinQuerySysValue(HWND_DESKTOP, 5403 SV_CXSIZEBORDER) + 48L), 5404 (swp.cy - 5405 WinQuerySysValue(HWND_DESKTOP, 5406 SV_CYSIZEBORDER)) - 60, 5407 ((swp.cx - 5408 (WinQuerySysValue(HWND_DESKTOP, 5409 SV_CXSIZEBORDER) * 2)) - 5410 64L), 60L, hwndFrame, HWND_TOP, 5411 MAIN_CMDLIST, NULL, NULL); 5391 5412 if (!hwndCmdlist) 5392 5413 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5393 5414 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 5394 5415 hwndStatelist = WinCreateWindow(hwndFrame, 5395 WC_COMBOBOX,5396 (PSZ) NULL,5397 WS_VISIBLE | CBS_DROPDOWN |5398 LS_HORZSCROLL,5399 (swp.x +5400 WinQuerySysValue(HWND_DESKTOP,5401 SV_CXSIZEBORDER) + 48L),5402 (swp.cy -5403 WinQuerySysValue(HWND_DESKTOP,5404 SV_CYSIZEBORDER)) - 60,5405 ((swp.cx -5406 (WinQuerySysValue(HWND_DESKTOP,5407 SV_CXSIZEBORDER) *5408 2)) - 64L), 60L, hwndFrame, HWND_TOP,5409 MAIN_SETUPLIST, NULL, NULL);5416 WC_COMBOBOX, 5417 (PSZ) NULL, 5418 WS_VISIBLE | CBS_DROPDOWN | 5419 LS_HORZSCROLL, 5420 (swp.x + 5421 WinQuerySysValue(HWND_DESKTOP, 5422 SV_CXSIZEBORDER) + 48L), 5423 (swp.cy - 5424 WinQuerySysValue(HWND_DESKTOP, 5425 SV_CYSIZEBORDER)) - 60, 5426 ((swp.cx - 5427 (WinQuerySysValue(HWND_DESKTOP, 5428 SV_CXSIZEBORDER) * 5429 2)) - 64L), 60L, hwndFrame, HWND_TOP, 5430 MAIN_SETUPLIST, NULL, NULL); 5410 5431 if (!hwndStatelist) 5411 5432 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5412 5433 5413 5434 hwndDrivelist = WinCreateWindow(hwndFrame, 5414 WC_COMBOBOX,5415 (PSZ) NULL,5416 WS_VISIBLE | CBS_DROPDOWN,5417 (swp.x +5418 WinQuerySysValue(HWND_DESKTOP,5419 SV_CXSIZEBORDER)),5420 (swp.cy -5421 WinQuerySysValue(HWND_DESKTOP,5422 SV_CYSIZEBORDER)) - 60,5423 48L,5424 60L,5425 hwndFrame,5426 HWND_TOP, MAIN_DRIVELIST, NULL, NULL);5435 WC_COMBOBOX, 5436 (PSZ) NULL, 5437 WS_VISIBLE | CBS_DROPDOWN, 5438 (swp.x + 5439 WinQuerySysValue(HWND_DESKTOP, 5440 SV_CXSIZEBORDER)), 5441 (swp.cy - 5442 WinQuerySysValue(HWND_DESKTOP, 5443 SV_CYSIZEBORDER)) - 60, 5444 48L, 5445 60L, 5446 hwndFrame, 5447 HWND_TOP, MAIN_DRIVELIST, NULL, NULL); 5427 5448 if (!hwndDrivelist) 5428 5449 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5429 5450 SetPresParams(hwndDrivelist, 5430 NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT));5451 NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT)); 5431 5452 hwndButtonlist = WinCreateWindow(hwndFrame, 5432 WC_COMBOBOX,5433 (PSZ) NULL,5434 WS_VISIBLE | CBS_DROPDOWN |5435 LS_HORZSCROLL,5436 (swp.cx -5437 WinQuerySysValue(HWND_DESKTOP,5438 SV_CXSIZEBORDER)) -5439 164L,5440 (swp.cy -5441 WinQuerySysValue(HWND_DESKTOP,5442 SV_CYSIZEBORDER)) - 60,5443 164L, 60L, hwndFrame, HWND_TOP,5444 MAIN_BUTTONLIST, NULL, NULL);5453 WC_COMBOBOX, 5454 (PSZ) NULL, 5455 WS_VISIBLE | CBS_DROPDOWN | 5456 LS_HORZSCROLL, 5457 (swp.cx - 5458 WinQuerySysValue(HWND_DESKTOP, 5459 SV_CXSIZEBORDER)) - 5460 164L, 5461 (swp.cy - 5462 WinQuerySysValue(HWND_DESKTOP, 5463 SV_CYSIZEBORDER)) - 60, 5464 164L, 60L, hwndFrame, HWND_TOP, 5465 MAIN_BUTTONLIST, NULL, NULL); 5445 5466 if (!hwndButtonlist) 5446 5467 Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW); 5447 5468 WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT), 5448 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);5469 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 5449 5470 WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT), 5450 EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID);5471 EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID); 5451 5472 WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5452 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);5473 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5453 5474 WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5454 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);5475 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5455 5476 WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5456 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);5477 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); 5457 5478 5458 5479 oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT), 5459 DropDownListProc);5480 DropDownListProc); 5460 5481 WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT), 5461 QWL_USER, (PVOID) oldproc);5482 QWL_USER, (PVOID) oldproc); 5462 5483 oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5463 DropDownListProc);5484 DropDownListProc); 5464 5485 WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT), 5465 QWL_USER, (PVOID) oldproc);5486 QWL_USER, (PVOID) oldproc); 5466 5487 oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5467 DropDownListProc);5488 DropDownListProc); 5468 5489 WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT), 5469 QWL_USER, (PVOID) oldproc);5490 QWL_USER, (PVOID) oldproc); 5470 5491 oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT), 5471 DropDownListProc);5492 DropDownListProc); 5472 5493 WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT), 5473 QWL_USER, (PVOID) oldproc);5494 QWL_USER, (PVOID) oldproc); 5474 5495 oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5475 DropDownListProc);5496 DropDownListProc); 5476 5497 WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5477 QWL_USER, (PVOID) oldproc);5498 QWL_USER, (PVOID) oldproc); 5478 5499 oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc); 5479 5500 WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc); … … 5487 5508 WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc); 5488 5509 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST), 5489 ChildFrameButtonProc);5510 ChildFrameButtonProc); 5490 5511 WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST), 5491 QWL_USER, (PVOID) oldproc);5512 QWL_USER, (PVOID) oldproc); 5492 5513 oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK), 5493 ChildFrameButtonProc);5514 ChildFrameButtonProc); 5494 5515 WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK), 5495 QWL_USER, (PVOID) oldproc);5516 QWL_USER, (PVOID) oldproc); 5496 5517 hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); 5497 5518 WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID); … … 5506 5527 hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU); 5507 5528 idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu, 5508 MM_ITEMIDFROMPOSITION,5509 MPVOID, MPVOID));5529 MM_ITEMIDFROMPOSITION, 5530 MPVOID, MPVOID)); 5510 5531 WinSendMsg(hwndSysMenu, 5511 MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit));5532 MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit)); 5512 5533 hwndSysSubMenu = mit.hwndSubMenu; 5513 5534 mi.iPosition = MIT_END; … … 5518 5539 mi.id = IDM_IDEALSIZE; 5519 5540 WinSendMsg(hwndSysSubMenu, 5520 MM_INSERTITEM,5521 MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT)));5541 MM_INSERTITEM, 5542 MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT))); 5522 5543 mi.afStyle = MIS_TEXT; 5523 5544 mi.id = IDM_HIDEMENU; 5524 5545 WinSendMsg(hwndSysSubMenu, 5525 MM_INSERTITEM,5526 MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT)));5546 MM_INSERTITEM, 5547 MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT))); 5527 5548 SetSysMenu(hwndSysMenu); 5528 5549 5529 5550 size = sizeof(BOOL); 5530 5551 if (PrfQueryProfileData(fmprof, 5531 FM3Str,5532 "MenuInvisible", &temp, &size) && size && temp)5552 FM3Str, 5553 "MenuInvisible", &temp, &size) && size && temp) 5533 5554 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID); 5534 5555 size = sizeof(BOOL); 5535 5556 if (PrfQueryProfileData(fmprof, 5536 FM3Str, "FreeTree", &temp, &size) && size && temp)5557 FM3Str, "FreeTree", &temp, &size) && size && temp) 5537 5558 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID); 5538 5559 size = sizeof(BOOL); 5539 5560 if (PrfQueryProfileData(fmprof, 5540 FM3Str,5541 "AutoTile", &temp, &size) && size && !temp)5561 FM3Str, 5562 "AutoTile", &temp, &size) && size && !temp) 5542 5563 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID); 5543 5564 size = sizeof(BOOL); 5544 5565 if (PrfQueryProfileData(fmprof, 5545 FM3Str, "Toolbar", &temp, &size) && size && !temp)5566 FM3Str, "Toolbar", &temp, &size) && size && !temp) 5546 5567 WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID); 5547 5568 … … 5568 5589 hwndTree = StartTreeCnr(hwnd, 0); 5569 5590 if (!hwndTree) 5570 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));5591 WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT)); 5571 5592 else { 5572 if (!fSaveState ||5573 !PrfQueryProfileData(fmprof,5574 FM3Str,5575 "LastTreePos",5576 &swp, &size) || size != sizeof(SWP)) {5577 5578 INT ratio, height = 0;5579 5580 if (!fNoTreeGap)5581 height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;5582 size = sizeof(ratio);5583 if (!PrfQueryProfileData(fmprof,5584 FM3Str,5585 "TreeWindowRatio",5586 (PVOID) & ratio,5587 &size) || size < sizeof(ratio))5588 ratio = 400;5589 WinSetWindowPos(hwndTree,5590 HWND_TOP,5591 0,5592 height,5593 (swp.cx * 100) / ratio,5594 swp.cy - height,5595 SWP_SHOW | SWP_SIZE | SWP_MOVE |5596 SWP_ACTIVATE | SWP_ZORDER);5597 }5598 else5599 WinSetWindowPos(hwndTree,5600 HWND_TOP,5601 swp.x,5602 swp.y,5603 swp.cx,5604 swp.cy,5605 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW |5606 SWP_ZORDER | SWP_ACTIVATE);5593 if (!fSaveState || 5594 !PrfQueryProfileData(fmprof, 5595 FM3Str, 5596 "LastTreePos", 5597 &swp, &size) || size != sizeof(SWP)) { 5598 5599 INT ratio, height = 0; 5600 5601 if (!fNoTreeGap) 5602 height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2; 5603 size = sizeof(ratio); 5604 if (!PrfQueryProfileData(fmprof, 5605 FM3Str, 5606 "TreeWindowRatio", 5607 (PVOID) & ratio, 5608 &size) || size < sizeof(ratio)) 5609 ratio = 400; 5610 WinSetWindowPos(hwndTree, 5611 HWND_TOP, 5612 0, 5613 height, 5614 (swp.cx * 100) / ratio, 5615 swp.cy - height, 5616 SWP_SHOW | SWP_SIZE | SWP_MOVE | 5617 SWP_ACTIVATE | SWP_ZORDER); 5618 } 5619 else 5620 WinSetWindowPos(hwndTree, 5621 HWND_TOP, 5622 swp.x, 5623 swp.y, 5624 swp.cx, 5625 swp.cy, 5626 swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | 5627 SWP_ZORDER | SWP_ACTIVATE); 5607 5628 } 5608 5629 ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5609 MAIN_TOOLS));5630 MAIN_TOOLS)); 5610 5631 } 5611 5632 PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2); … … 5625 5646 5626 5647 for (x = 1; x < argc; x++) { 5627 if (*argv[x] == '/' || *argv[x] == ';')5628 continue;5629 if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE))5630 OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);5648 if (*argv[x] == '/' || *argv[x] == ';') 5649 continue; 5650 if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE)) 5651 OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]); 5631 5652 } 5632 5653 } … … 5646 5667 hwndActive = TopWindow(hwnd, hwndTree); 5647 5668 if (hwndActive) 5648 WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);5669 WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE); 5649 5670 } 5650 5671 if (fStartMinimized || fReminimize) … … 5676 5697 case WM_CONTROLPOINTER: 5677 5698 if (!fNoFinger && 5678 (SHORT1FROMMP(mp1) == IDM_OPENWALK ||5679 SHORT1FROMMP(mp1) == IDM_USERLIST))5699 (SHORT1FROMMP(mp1) == IDM_OPENWALK || 5700 SHORT1FROMMP(mp1) == IDM_USERLIST)) 5680 5701 return MRFROMLONG(hptrFinger); 5681 5702 break; … … 5717 5738 if (mp1) { 5718 5739 if (fUserComboBox) 5719 WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT),5720 (CHAR *) mp1);5740 WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT), 5741 (CHAR *) mp1); 5721 5742 if (add_udir(FALSE, (CHAR *) mp1)) { 5722 if (fUserComboBox && fAutoAddDirs) {5723 WinSendMsg(hwndUserlist, LM_INSERTITEM,5724 MPFROM2SHORT(LIT_SORTASCENDING, 0),5725 MPFROMP((CHAR *) mp1));5726 }5743 if (fUserComboBox && fAutoAddDirs) { 5744 WinSendMsg(hwndUserlist, LM_INSERTITEM, 5745 MPFROM2SHORT(LIT_SORTASCENDING, 0), 5746 MPFROMP((CHAR *) mp1)); 5747 } 5727 5748 } 5728 5749 } … … 5756 5777 WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp); 5757 5778 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) { 5758 WinStoreWindowPos(FM2Str,5759 "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));5760 if (!fNoSaveState && fSaveState)5761 SaveDirCnrState(hwnd, FM2_STATE_AT_CLOSE);5779 WinStoreWindowPos(FM2Str, 5780 "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT)); 5781 if (!fNoSaveState && fSaveState) 5782 SaveDirCnrState(hwnd, FM2_STATE_AT_CLOSE); 5762 5783 } 5763 5784 } … … 5769 5790 case 1: 5770 5791 { 5771 HWND hwndCurrent;5772 ULONG wmsg;5773 5774 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;5775 hwndCurrent = TopWindow(hwnd, (HWND) 0);5776 PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent,5777 FID_CLIENT), wmsg,5778 MPVOID, MPVOID), mp1, mp2);5792 HWND hwndCurrent; 5793 ULONG wmsg; 5794 5795 wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU; 5796 hwndCurrent = TopWindow(hwnd, (HWND) 0); 5797 PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent, 5798 FID_CLIENT), wmsg, 5799 MPVOID, MPVOID), mp1, mp2); 5779 5800 } 5780 5801 break; … … 5794 5815 */ 5795 5816 { 5796 HWND hwndMenu, hwndSubMenu;5797 MENUITEM mi;5798 5799 hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);5800 memset(&mi, 0, sizeof(mi));5801 mi.iPosition = MIT_END;5802 mi.afStyle = MIS_TEXT;5803 if (!WinSendMsg(hwndMenu, MM_QUERYITEM,5804 MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))5805 break;5806 hwndSubMenu = mi.hwndSubMenu;5807 SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT));5817 HWND hwndMenu, hwndSubMenu; 5818 MENUITEM mi; 5819 5820 hwndMenu = WinQueryWindowULong(hwnd, QWL_USER); 5821 memset(&mi, 0, sizeof(mi)); 5822 mi.iPosition = MIT_END; 5823 mi.afStyle = MIS_TEXT; 5824 if (!WinSendMsg(hwndMenu, MM_QUERYITEM, 5825 MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi))) 5826 break; 5827 hwndSubMenu = mi.hwndSubMenu; 5828 SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT)); 5808 5829 } 5809 5830 break; … … 5811 5832 default: 5812 5833 { 5813 HWND hwndCurrent;5814 5815 hwndCurrent = TopWindow(hwnd, (HWND) 0);5816 if (hwndCurrent)5817 WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2);5834 HWND hwndCurrent; 5835 5836 hwndCurrent = TopWindow(hwnd, (HWND) 0); 5837 if (hwndCurrent) 5838 WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2); 5818 5839 } 5819 5840 break; … … 5823 5844 case UM_ADDTOMENU: 5824 5845 AddToMenu((CHAR *) mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 5825 FID_MENU));5846 FID_MENU)); 5826 5847 return 0; 5827 5848 … … 5836 5857 info = cmdhead; 5837 5858 while (info) { 5838 WinSendMsg(hwndCmdlist, LM_INSERTITEM,5839 MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title));5840 info = info->next;5859 WinSendMsg(hwndCmdlist, LM_INSERTITEM, 5860 MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title)); 5861 info = info->next; 5841 5862 } 5842 5863 } … … 5862 5883 ulSearchCount = 1; 5863 5884 if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED, 5864 &findbuf, sizeof(FILEFINDBUF3),5865 &ulSearchCount, FIL_STANDARD)) {5866 do {5867 priority_bumped();5868 if (!foundit) {5869 thisone = FALSE;5870 p = strrchr(lasttoolbox, '\\');5871 if (!p)5872 p = lasttoolbox;5873 else5874 p++;5875 if (!stricmp(findbuf.achName, p))5876 thisone = TRUE;5877 }5878 p = strrchr(findbuf.achName, '.');5879 if (p)5880 *p = 0;5881 sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM,5882 MPFROM2SHORT(LIT_SORTASCENDING, 0),5883 MPFROMP(findbuf.achName));5884 if (!foundit && thisone && sSelect >= 0) {5885 WinSendMsg(hwndButtonlist, LM_SELECTITEM,5886 MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE));5887 foundit = TRUE;5888 }5889 }5890 while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3),5891 &ulSearchCount));5892 DosFindClose(hDir);5893 priority_bumped();5885 &findbuf, sizeof(FILEFINDBUF3), 5886 &ulSearchCount, FIL_STANDARD)) { 5887 do { 5888 priority_bumped(); 5889 if (!foundit) { 5890 thisone = FALSE; 5891 p = strrchr(lasttoolbox, '\\'); 5892 if (!p) 5893 p = lasttoolbox; 5894 else 5895 p++; 5896 if (!stricmp(findbuf.achName, p)) 5897 thisone = TRUE; 5898 } 5899 p = strrchr(findbuf.achName, '.'); 5900 if (p) 5901 *p = 0; 5902 sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM, 5903 MPFROM2SHORT(LIT_SORTASCENDING, 0), 5904 MPFROMP(findbuf.achName)); 5905 if (!foundit && thisone && sSelect >= 0) { 5906 WinSendMsg(hwndButtonlist, LM_SELECTITEM, 5907 MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE)); 5908 foundit = TRUE; 5909 } 5910 } 5911 while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3), 5912 &ulSearchCount)); 5913 DosFindClose(hDir); 5914 priority_bumped(); 5894 5915 } 5895 5916 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT)); … … 5910 5931 5911 5932 if (!loadedudirs) 5912 load_udirs();5933 load_udirs(); 5913 5934 DosError(FERR_DISABLEHARDERR); 5914 5935 DosQCurDisk(&ulDriveNum, &ulDriveMap); 5915 5936 info = udirhead; 5916 5937 while (info) { 5917 if (IsFullName(info->path) &&5918 !(driveflags[toupper(*info->path) - 'A'] &5919 (DRIVE_IGNORE | DRIVE_INVALID))) {5920 DosError(FERR_DISABLEHARDERR);5921 hDir = HDIR_CREATE;5922 ulSearchCount = 1;5923 if (!IsRoot(info->path))5924 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |5925 MUST_HAVE_DIRECTORY | FILE_READONLY |5926 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,5927 &findbuf, sizeof(FILEFINDBUF3),5928 &ulSearchCount, FIL_STANDARD);5929 else {5930 rc = 0;5931 findbuf.attrFile = FILE_DIRECTORY;5932 }5933 priority_bumped();5934 if (!rc) {5935 if (!IsRoot(info->path))5936 DosFindClose(hDir);5937 if (findbuf.attrFile & FILE_DIRECTORY)5938 WinSendMsg(hwndUserlist, LM_INSERTITEM,5939 MPFROM2SHORT(LIT_SORTASCENDING, 0),5940 MPFROMP(info->path));5941 else {5942 temp = info->next;5943 remove_udir(info->path);5944 info = temp;5945 continue;5946 }5947 }5948 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {5949 temp = info->next;5950 remove_udir(info->path);5951 info = temp;5952 continue;5953 }5954 }5955 info = info->next;5938 if (IsFullName(info->path) && 5939 !(driveflags[toupper(*info->path) - 'A'] & 5940 (DRIVE_IGNORE | DRIVE_INVALID))) { 5941 DosError(FERR_DISABLEHARDERR); 5942 hDir = HDIR_CREATE; 5943 ulSearchCount = 1; 5944 if (!IsRoot(info->path)) 5945 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | 5946 MUST_HAVE_DIRECTORY | FILE_READONLY | 5947 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 5948 &findbuf, sizeof(FILEFINDBUF3), 5949 &ulSearchCount, FIL_STANDARD); 5950 else { 5951 rc = 0; 5952 findbuf.attrFile = FILE_DIRECTORY; 5953 } 5954 priority_bumped(); 5955 if (!rc) { 5956 if (!IsRoot(info->path)) 5957 DosFindClose(hDir); 5958 if (findbuf.attrFile & FILE_DIRECTORY) 5959 WinSendMsg(hwndUserlist, LM_INSERTITEM, 5960 MPFROM2SHORT(LIT_SORTASCENDING, 0), 5961 MPFROMP(info->path)); 5962 else { 5963 temp = info->next; 5964 remove_udir(info->path); 5965 info = temp; 5966 continue; 5967 } 5968 } 5969 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) { 5970 temp = info->next; 5971 remove_udir(info->path); 5972 info = temp; 5973 continue; 5974 } 5975 } 5976 info = info->next; 5956 5977 } 5957 5978 info = ldirhead; 5958 5979 while (info) { 5959 if (IsFullName(info->path) &&5960 !(driveflags[toupper(*info->path) - 'A'] &5961 (DRIVE_IGNORE | DRIVE_INVALID))) {5962 DosError(FERR_DISABLEHARDERR);5963 hDir = HDIR_CREATE;5964 ulSearchCount = 1;5965 if (!IsRoot(info->path))5966 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |5967 MUST_HAVE_DIRECTORY | FILE_READONLY |5968 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,5969 &findbuf, sizeof(FILEFINDBUF3),5970 &ulSearchCount, FIL_STANDARD);5971 else {5972 rc = 0;5973 findbuf.attrFile = FILE_DIRECTORY;5974 }5975 priority_bumped();5976 if (!rc) {5977 if (!IsRoot(info->path))5978 DosFindClose(hDir);5979 if (findbuf.attrFile & FILE_DIRECTORY)5980 WinSendMsg(hwndUserlist, LM_INSERTITEM,5981 MPFROM2SHORT(LIT_SORTASCENDING, 0),5982 MPFROMP(info->path));5983 else {5984 temp = info->next;5985 remove_udir(info->path);5986 info = temp;5987 continue;5988 }5989 }5990 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {5991 temp = info->next;5992 remove_udir(info->path);5993 info = temp;5994 continue;5995 }5996 }5997 info = info->next;5980 if (IsFullName(info->path) && 5981 !(driveflags[toupper(*info->path) - 'A'] & 5982 (DRIVE_IGNORE | DRIVE_INVALID))) { 5983 DosError(FERR_DISABLEHARDERR); 5984 hDir = HDIR_CREATE; 5985 ulSearchCount = 1; 5986 if (!IsRoot(info->path)) 5987 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | 5988 MUST_HAVE_DIRECTORY | FILE_READONLY | 5989 FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN, 5990 &findbuf, sizeof(FILEFINDBUF3), 5991 &ulSearchCount, FIL_STANDARD); 5992 else { 5993 rc = 0; 5994 findbuf.attrFile = FILE_DIRECTORY; 5995 } 5996 priority_bumped(); 5997 if (!rc) { 5998 if (!IsRoot(info->path)) 5999 DosFindClose(hDir); 6000 if (findbuf.attrFile & FILE_DIRECTORY) 6001 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6002 MPFROM2SHORT(LIT_SORTASCENDING, 0), 6003 MPFROMP(info->path)); 6004 else { 6005 temp = info->next; 6006 remove_udir(info->path); 6007 info = temp; 6008 continue; 6009 } 6010 } 6011 else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) { 6012 temp = info->next; 6013 remove_udir(info->path); 6014 info = temp; 6015 continue; 6016 } 6017 } 6018 info = info->next; 5998 6019 } 5999 6020 WinSendMsg(hwndUserlist, LM_INSERTITEM, 6000 MPFROM2SHORT(0, 0),6001 MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT)));6021 MPFROM2SHORT(0, 0), 6022 MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT))); 6002 6023 WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT)); 6003 6024 } … … 6013 6034 case WM_SIZE: 6014 6035 ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1), 6015 SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));6036 SHORT1FROMMP(mp2), SHORT2FROMMP(mp2)); 6016 6037 break; 6017 6038 … … 6027 6048 hps = WinBeginPaint(hwnd, (HPS) 0, NULL); 6028 6049 if (hps) { 6029 WinQueryWindowRect(hwnd, &rcl);6030 WinFillRect(hps, &rcl, CLR_PALEGRAY);6031 WinEndPaint(hps);6050 WinQueryWindowRect(hwnd, &rcl); 6051 WinFillRect(hps, &rcl, CLR_PALEGRAY); 6052 WinEndPaint(hps); 6032 6053 } 6033 6054 } … … 6043 6064 switch (SHORT2FROMMP(mp1)) { 6044 6065 case CBN_ENTER: 6045 {6046 HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),6047 SHORT1FROMMP(mp1));6048 CHAR path[CCHMAXPATH];6049 ULONG ul;6050 6051 switch (SHORT1FROMMP(mp1)) {6052 case MAIN_USERLIST:6053 ul = CCHMAXPATH;6054 break;6055 case MAIN_SETUPLIST:6056 ul = STATE_NAME_MAX_BYTES;6057 break;6058 default:6059 ul = 13; // fixme to not be hardcoded6060 }6061 6062 SetShiftState();6063 WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path);6064 bstrip(path);6065 if (*path) {6066 if (SHORT1FROMMP(mp1) == MAIN_USERLIST) {6067 if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) {6068 if (!LastDir ||6069 !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT),6070 UM_CONTAINERDIR, MPFROMP(path), MPVOID))6071 save_dir2(path);6072 if (!PMMkDir(hwnd, path, TRUE)) {6073 WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT));6074 break;6075 }6076 }6077 if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) {6078 6079 HWND hwndDir;6080 6081 if ((fUserListSwitches &&6082 !(shiftstate & KC_SHIFT)) ||6083 (!fUserListSwitches && (shiftstate & KC_SHIFT))) {6084 hwndDir = FindDirCnr(hwnd);6085 if (hwndDir) {6086 WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID);6087 break;6088 }6089 }6090 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path);6091 }6092 }6093 else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) {6094 ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree,6095 FID_CLIENT),6096 TREE_CNR), path, FALSE, TRUE);6097 WinSetFocus(HWND_DESKTOP, hwndTree);6098 }6099 else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) {6100 strcat(path, ".TLS");6101 load_tools(path);6102 PrfWriteProfileString(fmprof,6103 FM3Str, "LastToolBox", lasttoolbox);6104 BuildTools(hwndToolback, TRUE);6105 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));6106 }6107 else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {6108 6109 CHAR szKey[80];6110 ULONG size, numsaves = 0; 6111 6112 SetShiftState();6113 size = sizeof(ULONG); 6114 sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name 6115 if (!PrfQueryProfileData(fmprof,6116 FM3Str,6117 szKey,6118 (PVOID)&numsaves, 6119 &size)) 6120 {6121 if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) { 6122 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,6123 GetPString(IDS_WARNINGTEXT), 6124 GetPString(IDS_DOESNTEXISTTEXT), path); 6125 } 6126 else { 6127 Win_Error2(hwnd, hwnd, __FILE__, __LINE__, 6128 IDS_PRFQUERYPROFILEDATA); 6129 }6130 } 6131 else if (!numsaves) 6132 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 6133 else { 6134 if ((shiftstate & KC_SHIFT) == 0)6135 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));6136 { 6137 char *temp; 6138 6139 temp = xstrdup(path, pszSrcFile, __LINE__); 6140 if (!temp) { 6141 if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) 6142 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID,6143 MPFROMLONG(1)); 6144 } 6145 else { 6146 if (!PostMsg 6147 (MainObjectHwnd, UM_RESTORE, MPFROMP(temp), MPVOID)) 6148 free(temp); 6149 } 6150 } 6151 } 6152 // fixme to hold restored state name for a while 6153 // WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); // 15 Apr 07 SHL 6154 }6155 else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {6156 6157 SHORT sSelect;6158 6159 sSelect = (SHORT) WinSendMsg(hwndCmdlist,6160 LM_QUERYSELECTION,6161 MPFROMSHORT(LIT_FIRST), MPVOID);6162 if (sSelect >= 0)6163 WinPostMsg(hwnd,6164 WM_COMMAND,6165 MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0),6166 MPVOID);6167 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));6168 }6169 }6170 }6171 break;6066 { 6067 HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), 6068 SHORT1FROMMP(mp1)); 6069 CHAR path[CCHMAXPATH]; 6070 ULONG ul; 6071 6072 switch (SHORT1FROMMP(mp1)) { 6073 case MAIN_USERLIST: 6074 ul = CCHMAXPATH; 6075 break; 6076 case MAIN_SETUPLIST: 6077 ul = STATE_NAME_MAX_BYTES; 6078 break; 6079 default: 6080 ul = 13; // fixme to not be hardcoded 6081 } 6082 6083 SetShiftState(); 6084 WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path); 6085 bstrip(path); 6086 if (*path) { 6087 if (SHORT1FROMMP(mp1) == MAIN_USERLIST) { 6088 if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) { 6089 if (!LastDir || 6090 !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT), 6091 UM_CONTAINERDIR, MPFROMP(path), MPVOID)) 6092 save_dir2(path); 6093 if (!PMMkDir(hwnd, path, TRUE)) { 6094 WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT)); 6095 break; 6096 } 6097 } 6098 if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) { 6099 6100 HWND hwndDir; 6101 6102 if ((fUserListSwitches && 6103 !(shiftstate & KC_SHIFT)) || 6104 (!fUserListSwitches && (shiftstate & KC_SHIFT))) { 6105 hwndDir = FindDirCnr(hwnd); 6106 if (hwndDir) { 6107 WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID); 6108 break; 6109 } 6110 } 6111 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path); 6112 } 6113 } 6114 else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) { 6115 ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree, 6116 FID_CLIENT), 6117 TREE_CNR), path, FALSE, TRUE); 6118 WinSetFocus(HWND_DESKTOP, hwndTree); 6119 } 6120 else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) { 6121 strcat(path, ".TLS"); 6122 load_tools(path); 6123 PrfWriteProfileString(fmprof, 6124 FM3Str, "LastToolBox", lasttoolbox); 6125 BuildTools(hwndToolback, TRUE); 6126 WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT)); 6127 } 6128 else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) { 6129 CHAR szKey[80]; 6130 ULONG size, numsaves = 0; 6131 6132 SetShiftState(); 6133 size = sizeof(ULONG); 6134 sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name 6135 if (!PrfQueryProfileData(fmprof, 6136 FM3Str, 6137 szKey, 6138 (PVOID)&numsaves, 6139 &size)) 6140 { 6141 if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) { 6142 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 6143 GetPString(IDS_WARNINGTEXT), 6144 GetPString(IDS_DOESNTEXISTTEXT), path); 6145 } 6146 else { 6147 Win_Error2(hwnd, hwnd, __FILE__, __LINE__, 6148 IDS_PRFQUERYPROFILEDATA); 6149 } 6150 } 6151 else if (!numsaves) 6152 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 6153 else { 6154 char *pszStateName; 6155 if ((shiftstate & KC_SHIFT) == 0) 6156 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2)); 6157 pszStateName = xstrdup(path, pszSrcFile, __LINE__); 6158 if (!pszStateName) { 6159 // Fall back if out of memory - already complained 6160 if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) { 6161 // Autotile requested or forced 6162 PostMsg(MainObjectHwnd, 6163 UM_RESTORE, 6164 MPVOID, 6165 MPFROMLONG(1)); // Autotile 6166 } 6167 } 6168 else if (!PostMsg(MainObjectHwnd, 6169 UM_RESTORE, 6170 MPFROMP(pszStateName), 6171 MPVOID)) { 6172 free(pszStateName); 6173 } 6174 } 6175 } 6176 else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) { 6177 6178 SHORT sSelect; 6179 6180 sSelect = (SHORT) WinSendMsg(hwndCmdlist, 6181 LM_QUERYSELECTION, 6182 MPFROMSHORT(LIT_FIRST), MPVOID); 6183 if (sSelect >= 0) 6184 WinPostMsg(hwnd, 6185 WM_COMMAND, 6186 MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0), 6187 MPVOID); 6188 WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT)); 6189 } 6190 } 6191 } 6192 break; 6172 6193 6173 6194 default: 6174 break;6195 break; 6175 6196 } 6176 6197 break; … … 6192 6213 case WM_CLOSE: 6193 6214 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 6194 WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID);6215 WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID); 6195 6216 WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID); 6196 6217 fAmClosing = TRUE; 6197 6218 WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), 6198 WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID);6219 WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID); 6199 6220 if (CloseChildren(hwnd)) { 6200 6221 fAmClosing = FALSE; 6201 6222 if (fAutoTile) 6202 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID);6223 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID); 6203 6224 return 0; 6204 6225 } 6205 6226 if (hwndTree) { 6206 6227 if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID)) 6207 WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);6228 WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID); 6208 6229 } 6209 6230 DosSleep(1); … … 6217 6238 case UM_RESTORE: 6218 6239 { 6219 char *temp;6220 6221 temp = xstrdup(GetPString(IDS_FM2TEMPTEXT), pszSrcFile, __LINE__);6222 if (temp) { 6223 if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(temp), MPVOID)) 6224 free(temp);6240 // Try to restore saved shutdown state 6241 char *pszDefaultStateName = xstrdup(FM2_STATE_AT_CLOSE, pszSrcFile, __LINE__); 6242 if (pszDefaultStateName) { 6243 if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID)) 6244 // 05 Feb 08 SHL fixme to complain? 6245 free(pszDefaultStateName); 6225 6246 } 6226 6247 } … … 6231 6252 if (mp1) 6232 6253 return MRFROMLONG(OpenDirCnr((HWND) 0, 6233 hwndMain,6234 hwndTree, (BOOL) mp2, (char *)mp1));6254 hwndMain, 6255 hwndTree, (BOOL) mp2, (char *)mp1)); 6235 6256 return 0; 6236 6257
Note:
See TracChangeset
for help on using the changeset viewer.
