Changeset 423 for trunk/dll/arccnrs.c
- Timestamp:
- Jul 31, 2006, 9:21:52 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/arccnrs.c
r406 r423 27 27 26 Jul 06 SHL Correct SelectAll usage 28 28 29 Jul 06 SHL Use xfgets_bstripcr 29 31 Jul 06 SHL Lower priority for archives with more than 1000 entries 29 30 30 31 ***********************************************************************/ … … 69 70 { 70 71 case WM_INITDLG: 71 if (!mp2)72 if (!mp2) 72 73 WinDismissDlg(hwnd,0); 73 74 else { 74 75 ad = (ARCDUMP *)mp2; 75 76 WinSetWindowPtr(hwnd,QWL_USER,ad); 76 if(ad->errmsg) 77 WinSetDlgItemText(hwnd, 78 ARCERR_TEXT, 79 ad->errmsg); 80 if(!ad->info->test) 77 if (ad->errmsg) 78 WinSetDlgItemText(hwnd,ARCERR_TEXT,ad->errmsg); 79 if (!ad->info->test) 81 80 WinEnableWindow(WinWindowFromID(hwnd,ARCERR_TEST),FALSE); 82 if (ad->listname) {81 if (ad->listname) { 83 82 MLEsetlimit(WinWindowFromID(hwnd,ARCERR_MLE),-1L); 84 83 MLEsetformat(WinWindowFromID(hwnd,ARCERR_MLE),MLFIE_NOTRANS); … … 99 98 100 99 case IDM_HELP: 101 if (hwndHelp)100 if (hwndHelp) { 102 101 WinSendMsg(hwndHelp,HM_DISPLAY_HELP, 103 102 MPFROM2SHORT(HELP_ARCERR,0), 104 103 MPFROMSHORT(HM_RESOURCEID)); 104 } 105 105 break; 106 106 … … 119 119 list[0] = ad->arcname; 120 120 list[1] = NULL; 121 if (TestBinary(ad->arcname)) {122 if (*binview)121 if (TestBinary(ad->arcname)) { 122 if (*binview) 123 123 ExecOnList((HWND)0,binview,WINDOWED | SEPARATE,NULL,list,NULL); 124 124 else … … 126 126 } 127 127 else { 128 if (*viewer)128 if (*viewer) { 129 129 ExecOnList((HWND)0,viewer,WINDOWED | SEPARATE | 130 130 ((fViewChild) ? CHILD : 0), 131 131 NULL,list,NULL); 132 } 132 133 else 133 134 StartMLEEditor(HWND_DESKTOP,8 + 4 + 1,ad->arcname,hwnd); … … 160 161 INT sortFlags; 161 162 162 if (!pdcd) 163 { 163 if (!pdcd) { 164 164 HWND hwndCnr = pai1->hwndCnr; 165 pdcd = (DIRCNRDATA *)WinQueryWindowPtr(hwndCnr,QWL_USER);165 pdcd = WinQueryWindowPtr(hwndCnr,QWL_USER); 166 166 if (!pdcd) { 167 167 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); … … 172 172 sortFlags = pdcd->sortFlags; // Optimize 173 173 174 if (sortFlags) {174 if (sortFlags) { 175 175 switch(sortFlags & (~SORT_REVERSE)) { 176 176 case SORT_FIRSTEXTENSION: 177 177 pext = strchr(pai1->szFileName,'.'); 178 178 ppext = strchr(pai2->szFileName,'.'); 179 if (!pext)179 if (!pext) 180 180 pext = NullStr; 181 if (!ppext)181 if (!ppext) 182 182 ppext = NullStr; 183 183 ret = stricmp(pext,ppext); … … 187 187 pext = strrchr(pai1->szFileName,'.'); 188 188 ppext = strrchr(pai2->szFileName,'.'); 189 if (!pext)189 if (!pext) 190 190 pext = NullStr; 191 if (!ppext)191 if (!ppext) 192 192 ppext = NullStr; 193 193 ret = stricmp(pext,ppext); … … 212 212 ret = (pai1->cbFile < pai2->cbFile) ? 1 : (pai1->cbFile == pai2->cbFile) ? 213 213 0 : -1; 214 if (!ret)214 if (!ret) 215 215 ret = (pai1->cbComp < pai2->cbComp) ? 1 : (pai1->cbComp == pai2->cbComp) ? 216 216 0 : -1; … … 220 220 ret = (pai1->cbComp < pai2->cbComp) ? 1 : (pai1->cbComp == pai2->cbComp) ? 221 221 0 : -1; 222 if (!ret)222 if (!ret) 223 223 ret = (pai1->cbFile < pai2->cbFile) ? 1 : (pai1->cbFile == pai2->cbFile) ? 224 224 0 : -1; 225 225 break; 226 226 } 227 if (!ret)227 if (!ret) 228 228 ret = (SHORT)stricmp(pai1->szFileName,pai2->szFileName); 229 if (ret && (sortFlags & SORT_REVERSE))229 if (ret && (sortFlags & SORT_REVERSE)) 230 230 ret = (ret > 0) ? -1 : 1; 231 231 return ret; … … 242 242 INT ret = FALSE; 243 243 244 if (dcd && *dcd->mask.szMask) {244 if (dcd && *dcd->mask.szMask) { 245 245 r = (PARCITEM)rmini; 246 if (dcd->mask.pszMasks[1]) {246 if (dcd->mask.pszMasks[1]) { 247 247 for(x = 0;dcd->mask.pszMasks[x];x++) { 248 if (*dcd->mask.pszMasks[x]) {249 if (*dcd->mask.pszMasks[x] != '/') {250 if (wildcard(r->szFileName,dcd->mask.pszMasks[x],FALSE))248 if (*dcd->mask.pszMasks[x]) { 249 if (*dcd->mask.pszMasks[x] != '/') { 250 if (wildcard(r->szFileName,dcd->mask.pszMasks[x],FALSE)) 251 251 ret = TRUE; 252 252 } 253 253 else { 254 if (wildcard(r->szFileName,dcd->mask.pszMasks[x] + 1,FALSE)) {254 if (wildcard(r->szFileName,dcd->mask.pszMasks[x] + 1,FALSE)) { 255 255 ret = FALSE; 256 256 break; … … 261 261 } 262 262 else { 263 if (wildcard(r->szFileName,dcd->mask.szMask,FALSE))263 if (wildcard(r->szFileName,dcd->mask.szMask,FALSE)) 264 264 ret = TRUE; 265 265 } … … 279 279 static BOOL IsArcThere (HWND hwnd, CHAR *arcname) 280 280 { 281 if (arcname) {282 if (IsFile(arcname) != 1) {281 if (arcname) { 282 if (IsFile(arcname) != 1) { 283 283 saymsg(MB_CANCEL,hwnd, 284 284 GetPString(IDS_SAYWHATTEXT), … … 293 293 294 294 295 static INT FillArcCnr (HWND hwndCnr,CHAR *arcname,ARC_TYPE **arcinfo, 296 ULONGLONG *pullTotalBytes) 295 //== FillArcCnr() generate archive content list and fill container window == 296 297 static INT FillArcCnr(HWND hwndCnr,CHAR *arcname,ARC_TYPE **arcinfo, 298 ULONGLONG *pullTotalBytes) 297 299 { 298 300 FILE *fp; … … 312 314 APIRET rc; 313 315 314 if (!arcname || !arcinfo)316 if (!arcname || !arcinfo) 315 317 return 0; 316 318 317 319 info = *arcinfo; 318 if (!info)320 if (!info) 319 321 info = find_type(arcname,NULL); 320 321 322 if(IsFile(arctemp) == 1)323 324 325 326 322 for(x = 0;x < 99;x++) { 323 sprintf(arctemp,"%s.%03x",ArcTempRoot,(clock() & 4095L)); 324 if (IsFile(arctemp) == 1) 325 DosSleep(rand() % 100); 326 else 327 break; 328 } 327 329 328 330 ReTry: … … 344 346 CM_REMOVERECORD, 345 347 MPVOID, 346 MPFROM2SHORT(0, 347 CMA_FREE | CMA_INVALIDATE | CMA_ERASE)); 348 MPFROM2SHORT(0,CMA_FREE | CMA_INVALIDATE | CMA_ERASE)); 348 349 *arcinfo = info; 349 350 highest = info->osizepos; 350 if (info->nsizepos > highest)351 if (info->nsizepos > highest) 351 352 highest = info->nsizepos; 352 if (info->fdpos > highest)353 if (info->fdpos > highest) 353 354 highest = info->fdpos; 354 if (info->fnpos > highest)355 if (info->fnpos > highest) 355 356 highest = info->fnpos; 356 if (highest > 50)357 if (highest > 50) { 357 358 saymsg(MB_ENTER | MB_ICONEXCLAMATION,HWND_DESKTOP, 358 359 GetPString(IDS_SHAMETEXT), 359 360 "%s", 360 361 GetPString(IDS_BUNGEDUPTEXT)); 361 if(info->fnpos == -1) 362 } 363 if (info->fnpos == -1) 362 364 highest = 32767; 363 365 … … 368 370 strcpy(s,info->list); 369 371 p = strchr(s,' '); 370 if (p)372 if (p) 371 373 *p = 0; 372 374 DosError(FERR_DISABLEHARDERR); 373 if (!DosQAppType(s,&apptype) &&374 ((apptype & FAPPTYP_DOS) ||375 (apptype & FAPPTYP_WINDOWSREAL) ||376 (apptype & FAPPTYP_WINDOWSPROT) ||377 (apptype & 0x1000))) {375 if (!DosQAppType(s,&apptype) && 376 ((apptype & FAPPTYP_DOS) || 377 (apptype & FAPPTYP_WINDOWSREAL) || 378 (apptype & FAPPTYP_WINDOWSPROT) || 379 (apptype & 0x1000))) { 378 380 p = GetCmdSpec(TRUE); 379 381 runemf2(SEPARATE | INVISIBLE | MINIMIZED | BACKGROUND | WAIT, … … 391 393 else { 392 394 fp = xfopen(arctemp,"w",pszSrcFile,__LINE__); 393 if (!fp)395 if (!fp) 394 396 return 0; 395 397 else { … … 432 434 433 435 while(!feof(fp) && !gotend) { 434 if (!xfgets_bstripcr(s,sizeof(s),fp,pszSrcFile,__LINE__))436 if (!xfgets_bstripcr(s,sizeof(s),fp,pszSrcFile,__LINE__)) 435 437 break; 436 if (!gotstart) {438 if (!gotstart) { 437 439 if (!strcmp(s,info->startlist)) 438 440 gotstart = TRUE; 439 441 } 440 else if (info->endlist &&441 !strcmp(s,info->endlist))442 else if (info->endlist && 443 !strcmp(s,info->endlist)) 442 444 gotend = TRUE; 443 445 else { … … 445 447 fname = NULL; 446 448 bstrip(s); 447 if (info->nameisfirst) {449 if (info->nameisfirst) { 448 450 strncpy(lonename,s,CCHMAXPATH + 2); 449 451 lonename[CCHMAXPATH + 1] = 0; 450 452 fname = lonename; 451 if (!xfgets_bstripcr(s,sizeof(s),fp,pszSrcFile,__LINE__))453 if (!xfgets_bstripcr(s,sizeof(s),fp,pszSrcFile,__LINE__)) 452 454 break; 453 if (*fname == '\"') {455 if (*fname == '\"') { 454 456 memmove(fname,fname + 1,strlen(fname) + 1); 455 457 p = strchr(fname,'\"'); 456 if (p)458 if (p) 457 459 *p = 0; 458 460 } … … 465 467 while(*pp && (*pp == ' ' || *pp == '\t')) /* skip leading */ 466 468 pp++; 467 if (!*pp)469 if (!*pp) 468 470 break; 469 471 wasquote = FALSE; … … 472 474 ((x != info->fnpos || !info->nameislast) ? 473 475 (*p != ' ' && *p != '\t') : TRUE))) { 474 if (*p == '\"') {475 if (!wasquote) {476 if (*p == '\"') { 477 if (!wasquote) { 476 478 wasquote = TRUE; 477 479 memmove(p,p + 1,strlen(p)); … … 484 486 } 485 487 } 486 else if (*p)488 else if (*p) 487 489 p++; 488 490 } 489 if (*p) {491 if (*p) { 490 492 *p = 0; 491 493 p++; 492 494 } 493 if (x == info->nsizepos)495 if (x == info->nsizepos) 494 496 nsize = pp; 495 else if (x == info->osizepos)497 else if (x == info->osizepos) 496 498 osize = pp; 497 else if (x == info->fdpos) {499 else if (x == info->fdpos) { 498 500 fdate = pp; 499 if(info->fdflds > 1 && 500 info->fdflds < 24) { 501 501 if (info->fdflds > 1 && 502 info->fdflds < 24) { 502 503 INT y; 503 504 504 if (*p) {505 if (*p) { 505 506 p--; 506 507 *p = ' '; … … 512 513 x++; 513 514 } 514 if (*p) {515 if (*p) { 515 516 *p = 0; 516 517 p++; … … 519 520 } 520 521 } 521 else if (x == info->fnpos) {522 else if (x == info->fnpos) { 522 523 fname = pp; 523 if (pp && *pp == '*' && !*(pp + 1)) /* workaround for LH.EXE */524 if (pp && *pp == '*' && !*(pp + 1)) /* workaround for LH.EXE */ 524 525 fname = NULL; 525 if (info->nameislast)526 if (info->nameislast) 526 527 break; 527 528 } 528 else if ((!p || !*p) && info->fnpos == -1) {529 else if ((!p || !*p) && info->fnpos == -1) { 529 530 fname = pp; 530 531 break; … … 536 537 fname = lonename; 537 538 } 539 // fixme to complain? 538 540 if (fname && *fname) { 539 541 … … 568 570 pai->flags = ARCFLAGS_REALDIR; 569 571 } 570 if (fname[strlen(fname) - 1] == '\\' ||572 if (fname[strlen(fname) - 1] == '\\' || 571 573 fname[strlen(fname) - 1] == '/') 572 574 pai->flags = ARCFLAGS_REALDIR; 573 575 strcpy(pai->szFileName,fname); 574 if (fdate)576 if (fdate) 575 577 strcpy(pai->szDate,fdate); 576 578 pai->pszFileName = pai->szFileName; … … 603 605 *pullTotalBytes += pai->cbFile; 604 606 } 605 if(!lastpai)606 lastpai = pai;607 607 numarcfiles++; 608 608 if (!(++counter % 50)) { 609 if (!lastpai) 610 lastpai = pai; 609 611 WinSendMsg(hwndCnr, 610 612 CM_INVALIDATERECORD, 611 613 lastpai, 612 MPFROM2SHORT(10, 613 CMA_ERASE | CMA_REPOSITION)); 614 MPFROM2SHORT(10,CMA_ERASE | CMA_REPOSITION)); 614 615 lastpai = pai; 615 616 } 617 // Avoid hogging system if large archive 618 if (numarcfiles == 1000) 619 priority_idle(); 616 620 } 617 621 } … … 623 627 if (!numarcfiles || !gotstart || (!gotend && info->endlist && *info->endlist)) 624 628 { 629 // Oops 625 630 ARCDUMP ad; 626 631 CHAR errstr[CCHMAXPATH + 256]; 632 633 // Try for alternate archiver 627 634 tinfo = info; 628 635 do { 629 636 tinfo = tinfo->next; 630 if (tinfo)637 if (tinfo) 631 638 tinfo = find_type(arcname,tinfo); 632 if (tinfo) {639 if (tinfo) { 633 640 DosError(FERR_DISABLEHARDERR); 634 641 DosForceDelete(arctemp); … … 637 644 } 638 645 } while(tinfo); 639 DosBeep(750,50); // fixme to know why? 640 { 641 CHAR errstr[CCHMAXPATH + 256]; 642 643 sprintf(errstr,GetPString(IDS_ARCERRORINFOTEXT), 644 arcname, 645 (!gotstart) ? GetPString(IDS_NOGOTSTARTTEXT) : NullStr, 646 (!numarcfiles) ? GetPString(IDS_NOARCFILESFOUNDTEXT) : NullStr, 647 (!gotend) ? GetPString(IDS_NOENDOFLISTTEXT) : NullStr); 648 memset(&ad,0,sizeof(ARCDUMP)); 649 ad.info = info; 650 strcpy(ad.listname,arctemp); 651 strcpy(ad.arcname,arcname); 652 ad.errmsg = errstr; 653 WinDlgBox(HWND_DESKTOP, 654 hwndCnr, 655 ArcErrProc, 656 FM3ModHandle, 657 ARCERR_FRAME, 658 MPFROMP(&ad)); 659 } 646 DosBeep(750,50); // wake up user 647 sprintf(errstr,GetPString(IDS_ARCERRORINFOTEXT), 648 arcname, 649 (!gotstart) ? GetPString(IDS_NOGOTSTARTTEXT) : NullStr, 650 (!numarcfiles) ? GetPString(IDS_NOARCFILESFOUNDTEXT) : NullStr, 651 (!gotend) ? GetPString(IDS_NOENDOFLISTTEXT) : NullStr); 652 memset(&ad,0,sizeof(ARCDUMP)); 653 ad.info = info; 654 strcpy(ad.listname,arctemp); 655 strcpy(ad.arcname,arcname); 656 ad.errmsg = errstr; 657 WinDlgBox(HWND_DESKTOP, 658 hwndCnr, 659 ArcErrProc, 660 FM3ModHandle, 661 ARCERR_FRAME, 662 MPFROMP(&ad)); 660 663 } 661 664 else if (!nomove && tinfo) { … … 664 667 info->next = arcsighead; 665 668 arcsighead->prev = info; 666 if (tinfo)669 if (tinfo) 667 670 tinfo->next->prev = info->prev; 668 671 info->prev->next = tinfo; … … 675 678 DosForceDelete(arctemp); 676 679 } 680 681 if (numarcfiles >= 500) 682 priority_normal(); 677 683 678 684 return numarcfiles; … … 713 719 DIRCNRDATA *dcd; 714 720 715 if (hwndButtonPopup)721 if (hwndButtonPopup) 716 722 WinDestroyWindow(hwndButtonPopup); 717 if (id == DIR_SELECTED)723 if (id == DIR_SELECTED) 718 724 id = DIR_RESTORE; 719 if (id == lastid) {725 if (id == lastid) { 720 726 721 727 ULONG check; 722 728 723 729 DosQuerySysInfo(QSV_MS_COUNT,QSV_MS_COUNT,&check,sizeof(check)); 724 if (check < timestamp + 500) {730 if (check < timestamp + 500) { 725 731 lastid = 0; 726 732 goto MenuAbort; … … 730 736 FM3ModHandle, 731 737 id); 732 if (hwndButtonPopup) {738 if (hwndButtonPopup) { 733 739 WinSetWindowUShort(hwndButtonPopup, 734 740 QWS_ID, … … 738 744 ARC_CNR), 739 745 QWL_USER); 740 if (id == DIR_SORT) {741 if (dcd)746 if (id == DIR_SORT) { 747 if (dcd) 742 748 SetSortChecks(hwndButtonPopup, 743 749 dcd->sortFlags); 744 750 WinSendMsg(hwndButtonPopup, 745 751 MM_DELETEITEM, 746 MPFROM2SHORT(IDM_SORTNONE, 747 FALSE), 752 MPFROM2SHORT(IDM_SORTNONE,FALSE), 748 753 MPVOID); 749 754 WinSendMsg(hwndButtonPopup, 750 755 MM_DELETEITEM, 751 MPFROM2SHORT(IDM_SORTNAME, 752 FALSE), 756 MPFROM2SHORT(IDM_SORTNAME,FALSE), 753 757 MPVOID); 754 758 WinSendMsg(hwndButtonPopup, 755 759 MM_DELETEITEM, 756 MPFROM2SHORT(IDM_SORTLADATE, 757 FALSE), 760 MPFROM2SHORT(IDM_SORTLADATE,FALSE), 758 761 MPVOID); 759 762 WinSendMsg(hwndButtonPopup, 760 763 MM_DELETEITEM, 761 MPFROM2SHORT(IDM_SORTCRDATE, 762 FALSE), 764 MPFROM2SHORT(IDM_SORTCRDATE,FALSE), 763 765 MPVOID); 764 766 WinSendMsg(hwndButtonPopup, 765 767 MM_DELETEITEM, 766 MPFROM2SHORT(IDM_SORTDIRSFIRST, 767 FALSE), 768 MPFROM2SHORT(IDM_SORTDIRSFIRST,FALSE), 768 769 MPVOID); 769 770 WinSendMsg(hwndButtonPopup, 770 771 MM_DELETEITEM, 771 MPFROM2SHORT(IDM_SORTDIRSLAST, 772 FALSE), 772 MPFROM2SHORT(IDM_SORTDIRSLAST,FALSE), 773 773 MPVOID); 774 774 WinSendMsg(hwndButtonPopup, 775 775 MM_DELETEITEM, 776 MPFROM2SHORT(IDM_SORTSUBJECT, 777 FALSE), 776 MPFROM2SHORT(IDM_SORTSUBJECT,FALSE), 778 777 MPVOID); 779 778 WinSendMsg(hwndButtonPopup, … … 787 786 } 788 787 ptl.x = 0; 789 if (WinPopupMenu(HWND_OBJECT,788 if (WinPopupMenu(HWND_OBJECT, 790 789 HWND_OBJECT, 791 790 hwndButtonPopup, … … 803 802 ptl.y = swp.cy + 2; 804 803 } 805 if (WinPopupMenu(hwnd,804 if (WinPopupMenu(hwnd, 806 805 hwnd, 807 806 hwndButtonPopup, … … 824 823 ARC_CNR), 825 824 WM_CONTROL, 826 MPFROM2SHORT(ARC_CNR, 827 CN_CONTEXTMENU), 825 MPFROM2SHORT(ARC_CNR,CN_CONTEXTMENU), 828 826 MPVOID); 829 827 break; … … 831 829 } 832 830 MenuAbort: 833 if (msg == UM_CONTEXTMENU)831 if (msg == UM_CONTEXTMENU) 834 832 return 0; 835 833 break; 836 834 837 835 case WM_MENUEND: 838 if (hwndButtonPopup == (HWND)mp2) {836 if (hwndButtonPopup == (HWND)mp2) { 839 837 lastid = WinQueryWindowUShort((HWND)mp2,QWS_ID); 840 838 WinDestroyWindow(hwndButtonPopup); … … 857 855 char *s = NULL; 858 856 859 if (fOtherHelp) {860 if ((!hwndBubble ||857 if (fOtherHelp) { 858 if ((!hwndBubble || 861 859 WinQueryWindowULong(hwndBubble,QWL_USER) != hwnd) && 862 860 !WinQueryCapture(HWND_DESKTOP)) { … … 883 881 break; 884 882 } 885 if (s)883 if (s) 886 884 MakeBubble(hwnd,TRUE,s); 887 else if (hwndBubble)885 else if (hwndBubble) 888 886 WinDestroyWindow(hwndBubble); 889 887 } … … 933 931 break; 934 932 default: 935 if ((SHORT2FROMMP(mp2) & KC_ALT) != 0)933 if ((SHORT2FROMMP(mp2) & KC_ALT) != 0) 936 934 cmd = IDM_WINDOWDLG; 937 935 else … … 943 941 case DIR_SORT: 944 942 case DIR_SELECTED: 945 PostMsg(hwnd, 946 UM_CONTEXTMENU, 947 MPVOID, 948 MPVOID); 943 PostMsg(hwnd,UM_CONTEXTMENU,MPVOID,MPVOID); 949 944 break; 950 945 case DIR_FILTER: … … 954 949 break; 955 950 } 956 if (cmd)951 if (cmd) 957 952 PostMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT), 958 953 ARC_CNR), … … 968 963 case DM_DRAGLEAVE: 969 964 case DM_DROPHELP: 970 if (msg == DM_DRAGOVER) {971 if (!emphasized) {965 if (msg == DM_DRAGOVER) { 966 if (!emphasized) { 972 967 emphasized = TRUE; 973 968 DrawTargetEmphasis(hwnd,emphasized); 974 969 } 975 970 } 976 else if (msg != WM_BEGINDRAG) {977 if (emphasized) {971 else if (msg != WM_BEGINDRAG) { 972 if (emphasized) { 978 973 emphasized = FALSE; 979 974 DrawTargetEmphasis(hwnd,emphasized); … … 984 979 switch(msg) { 985 980 case DM_DRAGOVER: 986 if (AcceptOneDrop(mp1,mp2))981 if (AcceptOneDrop(mp1,mp2)) 987 982 return MRFROM2SHORT(DOR_DROP, 988 983 DO_MOVE); … … 998 993 char szFrom[CCHMAXPATH + 2]; 999 994 1000 if (emphasized) {995 if (emphasized) { 1001 996 emphasized = FALSE; 1002 997 DrawTargetEmphasis(hwnd,emphasized); 1003 998 } 1004 if (GetOneDrop(mp1,mp2,szFrom,sizeof(szFrom)))999 if (GetOneDrop(mp1,mp2,szFrom,sizeof(szFrom))) 1005 1000 WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT), 1006 1001 ARC_CNR), … … 1077 1072 case WM_PSETFOCUS: 1078 1073 case WM_SETFOCUS: 1079 if (mp2)1074 if (mp2) 1080 1075 PostMsg(hwnd,UM_FOCUSME,MPVOID,MPVOID); 1081 1076 break; … … 1091 1086 1092 1087 hps = WinBeginPaint(hwnd,(HPS)0,NULL); 1093 if (hps) {1088 if (hps) { 1094 1089 WinQueryWindowRect(hwnd,&rcl); 1095 1090 WinFillRect(hps,&rcl,CLR_PALEGRAY); … … 1102 1097 case UM_SIZE: 1103 1098 case WM_SIZE: 1104 if (msg == UM_SIZE) {1099 if (msg == UM_SIZE) { 1105 1100 1106 1101 SWP swp; … … 1166 1161 } 1167 1162 CommonTextPaint(hwnd,(HPS)0); 1168 if (msg == UM_SIZE) {1163 if (msg == UM_SIZE) { 1169 1164 WinSetWindowPos(WinQueryWindow(hwnd,QW_PARENT),HWND_TOP,0,0,0,0, 1170 1165 SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE); … … 1186 1181 case DM_DISCARDOBJECT: 1187 1182 dcd = INSTDATA(hwnd); 1188 if (dcd) {1183 if (dcd) { 1189 1184 1190 1185 LISTINFO *li; … … 1198 1193 MPVOID, 1199 1194 MPFROMP(&cni)); 1200 if (li) {1195 if (li) { 1201 1196 li->type = (msg == DM_DISCARDOBJECT) ? 1202 1197 IDM_DELETE : 1203 1198 IDM_PRINT; 1204 if (!li->list ||1199 if (!li->list || 1205 1200 !li->list[0] || 1206 !PostMsg(hwnd, 1207 UM_ACTION, 1208 MPFROMP(li), 1209 MPVOID)) 1201 !PostMsg(hwnd,UM_ACTION,MPFROMP(li),MPVOID)) 1210 1202 FreeListInfo(li); 1211 1203 else … … 1220 1212 case DM_RENDER: 1221 1213 dcd = WinQueryWindowPtr(hwnd,QWL_USER); 1222 if (dcd && dcd->info && dcd->info->extract && dcd->arcname) {1214 if (dcd && dcd->info && dcd->info->extract && dcd->arcname) { 1223 1215 1224 1216 PDRAGTRANSFER pdt = (PDRAGTRANSFER)mp1; … … 1226 1218 ULONG len; 1227 1219 1228 if (pdt->hwndClient && pdt->pditem && pdt->hstrSelectedRMF &&1220 if (pdt->hwndClient && pdt->pditem && pdt->hstrSelectedRMF && 1229 1221 pdt->hstrRenderToName) 1230 1222 { … … 1240 1232 len = DrgQueryStrName(pdt->hstrRenderToName,CCHMAXPATH,filename); 1241 1233 filename[len] = 0; 1242 if (len && *filename) {1234 if (len && *filename) { 1243 1235 psz = xstrdup(filename,pszSrcFile,__LINE__); 1244 1236 if (psz) { … … 1263 1255 1264 1256 dcd = WinQueryWindowPtr(hwnd,QWL_USER); 1265 if (dcd && dcd->info && dcd->info->extract && dcd->arcname) {1257 if (dcd && dcd->info && dcd->info->extract && dcd->arcname) { 1266 1258 1267 1259 CHAR *filename = (CHAR *)mp2,*p; … … 1273 1265 CCHMAXPATH,membername); 1274 1266 membername[len] = 0; 1275 if (*membername && len && filename) {1267 if (*membername && len && filename) { 1276 1268 unlinkf("%s",filename); 1277 1269 strcpy(construct,filename); 1278 1270 p = strrchr(filename,'\\'); 1279 if (!p)1271 if (!p) 1280 1272 *construct = 0; 1281 1273 else { 1282 if (p == filename || *(p - 1) == ':')1274 if (p == filename || *(p - 1) == ':') 1283 1275 p++; 1284 1276 *p = 0; … … 1295 1287 membername, 1296 1288 (needs_quoting(membername)) ? "\"" : NullStr); 1297 if (*construct && construct[strlen(construct) - 1] != '\\')1289 if (*construct && construct[strlen(construct) - 1] != '\\') 1298 1290 strcat(construct,"\\"); 1299 1291 strcat(construct,membername); 1300 if (IsFile(construct) != -1) {1292 if (IsFile(construct) != -1) { 1301 1293 rename(construct,filename); 1302 1294 unlinkf("%s",construct); 1303 if (IsFile(filename) != -1)1295 if (IsFile(filename) != -1) 1304 1296 usRes = DMFL_RENDEROK; 1305 1297 } 1306 1298 } 1307 1299 } 1308 if (mp2)1300 if (mp2) 1309 1301 free((CHAR *)mp2); 1310 1302 PostMsg(pdt->hwndClient,DM_RENDERCOMPLETE,MPFROMP(pdt), 1311 1303 MPFROM2SHORT(usRes,0)); 1312 1304 } 1313 1305 return 0; … … 1315 1307 case UM_SETUP: 1316 1308 dcd = WinQueryWindowPtr(hwnd,QWL_USER); 1317 if(dcd) { 1309 if (!dcd) { 1310 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 1311 PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID); 1312 } 1313 else { 1318 1314 /* set unique id */ 1319 1315 WinSetWindowUShort(hwnd,QWS_ID,ARCOBJ_FRAME + (ARC_FRAME - dcd->id)); 1320 1316 dcd->hwndObject = hwnd; // pass back hwnd 1321 if (ParentIsDesktop(hwnd,dcd->hwndParent))1317 if (ParentIsDesktop(hwnd,dcd->hwndParent)) 1322 1318 DosSleep(250); // Avoid race? 1323 1319 } 1324 else1325 PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID);1326 1320 return 0; 1327 1321 … … 1331 1325 */ 1332 1326 dcd = WinQueryWindowPtr(hwnd,QWL_USER); 1333 if (dcd) {1334 if (mp1)1327 if (dcd) { 1328 if (mp1) 1335 1329 strcpy(dcd->arcname,(CHAR *)mp1); // Update name on request 1336 1330 WinSetWindowText(dcd->hwndFrame,"AV/2"); … … 1344 1338 &dcd->info, 1345 1339 &dcd->ullTotalBytes); 1346 if(!dcd->totalfiles) 1347 PostMsg(dcd->hwndCnr, 1348 WM_CLOSE, 1349 MPVOID, 1350 MPVOID); 1340 if (!dcd->totalfiles) 1341 PostMsg(dcd->hwndCnr,WM_CLOSE,MPVOID,MPVOID); 1351 1342 else { 1352 1343 dcd->arcfilled = TRUE; 1353 if(!PostMsg(dcd->hwndCnr, 1354 UM_RESCAN, 1355 MPVOID, 1356 MPVOID)) 1357 WinSendMsg(dcd->hwndCnr, 1358 UM_RESCAN, 1359 MPVOID, 1360 MPVOID); 1361 PostMsg(dcd->hwndCnr, 1362 UM_SETUP2, 1363 MPVOID, 1364 MPVOID); 1344 if (!PostMsg(dcd->hwndCnr,UM_RESCAN,MPVOID,MPVOID)) 1345 WinSendMsg(dcd->hwndCnr,UM_RESCAN,MPVOID,MPVOID); 1346 PostMsg(dcd->hwndCnr,UM_SETUP2,MPVOID,MPVOID); 1365 1347 WinSendMsg(dcd->hwndCnr, 1366 1348 CM_INVALIDATERECORD, … … 1373 1355 case UM_SELECT: 1374 1356 dcd = WinQueryWindowPtr(hwnd,QWL_USER); 1375 if (dcd) {1357 if (dcd) { 1376 1358 switch(SHORT1FROMMP(mp1)) { 1377 1359 case IDM_SELECTALL: … … 1396 1378 IDS_SELECTFILTERTEXT : 1397 1379 IDS_DESELECTFILTERTEXT)); 1398 if (pci && (INT)pci != -1)1380 if (pci && (INT)pci != -1) 1399 1381 strcpy(mask.szMask,pci->szFileName); 1400 if (WinDlgBox(HWND_DESKTOP,dcd->hwndCnr,PickMaskDlgProc,1382 if (WinDlgBox(HWND_DESKTOP,dcd->hwndCnr,PickMaskDlgProc, 1401 1383 FM3ModHandle,MSK_FRAME,MPFROMP(&mask))) { 1402 if (SHORT1FROMMP(mp1) == IDM_SELECTMASK)1384 if (SHORT1FROMMP(mp1) == IDM_SELECTMASK) 1403 1385 SelectAll(dcd->hwndCnr,TRUE,TRUE,mask.szMask,NULL,FALSE); 1404 1386 else … … 1416 1398 case UM_ENTER: 1417 1399 dcd = WinQueryWindowPtr(hwnd,QWL_USER); 1418 if (dcd) {1400 if (dcd) { 1419 1401 1420 1402 CHAR *s = (CHAR *)mp1,*p,*pp,filename[CCHMAXPATH]; 1421 1403 1422 if (s) {1404 if (s) { 1423 1405 if (!dcd->info->extract) { 1424 1406 Runtime_Error(pszSrcFile, __LINE__, "no extract"); … … 1438 1420 (needs_quoting(s)) ? "\"" : NullStr); 1439 1421 1440 if (!dcd->info->exwdirs) {1422 if (!dcd->info->exwdirs) { 1441 1423 p = s; 1442 1424 p = strrchr(s,'\\'); 1443 1425 pp = strrchr(s,'/'); 1444 if (p && pp)1426 if (p && pp) 1445 1427 p = max(p,pp); 1446 else if (!p)1428 else if (!p) 1447 1429 p = pp; 1448 if (p)1430 if (p) 1449 1431 memmove(s,p + 1,strlen(p + 1)); 1450 1432 } … … 1452 1434 p = filename; 1453 1435 while(*p) { 1454 if (*p == '/')1436 if (*p == '/') 1455 1437 *p = '\\'; 1456 1438 p++; 1457 1439 } 1458 1440 free(s); 1459 if (IsFile(filename) == 1)1441 if (IsFile(filename) == 1) 1460 1442 WinSendMsg(dcd->hwndCnr,UM_ENTER,MPFROMP(filename),MPVOID); 1461 1443 } … … 1464 1446 1465 1447 case UM_COMMAND: 1466 if (mp1) {1467 if (PostMsg(hwnd,UM_ACTION,mp1,mp2))1448 if (mp1) { 1449 if (PostMsg(hwnd,UM_ACTION,mp1,mp2)) 1468 1450 return (MRESULT)TRUE; 1469 1451 } … … 1473 1455 DosError(FERR_DISABLEHARDERR); 1474 1456 dcd = WinQueryWindowPtr(hwnd,QWL_USER); 1475 if (dcd) {1457 if (dcd) { 1476 1458 1477 1459 LISTINFO *li = (LISTINFO *)mp1; 1478 1460 register INT x; 1479 1461 1480 if (li && li->list && li->list[0]) {1462 if (li && li->list && li->list[0]) { 1481 1463 switch(li->type) { 1482 1464 case IDM_ARCHIVE: … … 1493 1475 ad.namecanchange = 0; 1494 1476 ad.fmoving = (li->type == IDM_ARCHIVEM); 1495 if (!WinDlgBox(HWND_DESKTOP,dcd->hwndClient,1477 if (!WinDlgBox(HWND_DESKTOP,dcd->hwndClient, 1496 1478 ArchiveDlgProc,FM3ModHandle, 1497 1479 ARCH_FRAME,(PVOID)&ad) || … … 1502 1484 strcpy(szBuffer,ad.command); 1503 1485 strcat(szBuffer," "); 1504 if (needs_quoting(ad.arcname))1486 if (needs_quoting(ad.arcname)) 1505 1487 strcat(szBuffer,"\""); 1506 1488 strcat(szBuffer,ad.arcname); 1507 if (needs_quoting(ad.arcname))1489 if (needs_quoting(ad.arcname)) 1508 1490 strcat(szBuffer,"\""); 1509 1491 p = &szBuffer[strlen(szBuffer)]; 1510 if (ad.mask.szMask) {1492 if (ad.mask.szMask) { 1511 1493 strcat(szBuffer," "); 1512 if (needs_quoting(ad.mask.szMask))1494 if (needs_quoting(ad.mask.szMask)) 1513 1495 strcat(szBuffer,"\""); 1514 1496 strcat(szBuffer,ad.mask.szMask); 1515 if (needs_quoting(ad.mask.szMask))1497 if (needs_quoting(ad.mask.szMask)) 1516 1498 strcat(szBuffer,"\""); 1517 1499 } … … 1519 1501 x = 0; 1520 1502 while(li->list[x]) { 1521 if (needs_quoting(li->list[x]))1503 if (needs_quoting(li->list[x])) 1522 1504 strcat(szBuffer,"\""); 1523 1505 strcat(szBuffer,li->list[x]); 1524 if (!IsFile(li->list[x])) {1525 if (szBuffer[strlen(szBuffer) - 1] != '\\')1506 if (!IsFile(li->list[x])) { 1507 if (szBuffer[strlen(szBuffer) - 1] != '\\') 1526 1508 strcat(szBuffer,"\\"); 1527 1509 strcat(szBuffer,"*"); 1528 1510 } 1529 if (needs_quoting(li->list[x]))1511 if (needs_quoting(li->list[x])) 1530 1512 strcat(szBuffer,"\""); 1531 1513 x++; 1532 if (!li->list[x] || strlen(szBuffer) +1514 if (!li->list[x] || strlen(szBuffer) + 1533 1515 strlen(li->list[x]) + 5 > 1024) { 1534 1516 runemf2(SEPARATE | WINDOWED | … … 1540 1522 strcat(szBuffer," "); 1541 1523 } 1542 PostMsg(dcd->hwndCnr, 1543 UM_RESCAN, 1544 MPFROMSHORT(1), 1545 MPVOID); 1524 PostMsg(dcd->hwndCnr,UM_RESCAN,MPFROMSHORT(1),MPVOID); 1546 1525 Broadcast(WinQueryAnchorBlock(hwnd), 1547 1526 hwndMain, … … 1565 1544 CHAR prompt[CCHMAXPATH + 257]; 1566 1545 1567 if (!dcd->info->delete)1546 if (!dcd->info->delete) 1568 1547 break; 1569 1548 memset(&ck,0,sizeof(ck)); … … 1581 1560 GetPString(IDS_DELETELOWERTEXT) : 1582 1561 GetPString(IDS_REFRESHLOWERTEXT)); 1583 if (!WinDlgBox(HWND_DESKTOP,hwnd,CheckListProc,1562 if (!WinDlgBox(HWND_DESKTOP,hwnd,CheckListProc, 1584 1563 FM3ModHandle, 1585 1564 CHECK_FRAME,MPFROMP(&ck))) 1586 1565 break; 1587 1566 li->list = ck.list; 1588 if (!li->list || !li->list[0])1567 if (!li->list || !li->list[0]) 1589 1568 break; 1590 if (li->type == IDM_DELETE)1569 if (li->type == IDM_DELETE) 1591 1570 sprintf(cl,"%s %s%s%s",dcd->info->delete, 1592 1571 (needs_quoting(dcd->arcname)) ? "\"" : NullStr, … … 1604 1583 strlen(cl) + strlen(li->list[x]) < 999;x++) { 1605 1584 strcat(cl," "); 1606 if (needs_quoting(li->list[x]))1585 if (needs_quoting(li->list[x])) 1607 1586 strcat(cl,"\""); 1608 1587 strcat(cl,li->list[x]); 1609 if (needs_quoting(li->list[x]))1588 if (needs_quoting(li->list[x])) 1610 1589 strcat(cl,"\""); 1611 1590 } … … 1616 1595 *endofit = 0; 1617 1596 } while(li->list[x]); 1618 PostMsg(dcd->hwndCnr, 1619 UM_RESCAN, 1620 MPFROMSHORT(1), 1621 MPVOID); 1597 PostMsg(dcd->hwndCnr,UM_RESCAN,MPFROMSHORT(1),MPVOID); 1622 1598 Broadcast(WinQueryAnchorBlock(hwnd), 1623 1599 hwndMain, … … 1645 1621 INT z; 1646 1622 1647 if ((li->type == IDM_EXTRACT && !li->info->extract) ||1623 if ((li->type == IDM_EXTRACT && !li->info->extract) || 1648 1624 ((li->type == IDM_VIEW || li->type == IDM_VIEWTEXT || 1649 1625 li->type == IDM_VIEWBINARY || li->type == IDM_EDIT || … … 1662 1638 break; 1663 1639 } 1664 if (li->type == IDM_EXTRACT || li->type == IDM_EXTRACTWDIRS) {1640 if (li->type == IDM_EXTRACT || li->type == IDM_EXTRACTWDIRS) { 1665 1641 1666 1642 CHAR fullname[CCHMAXPATH * 2]; … … 1674 1650 NullStr : "\\", 1675 1651 li->list[x]); 1676 if (IsFile(fullname) != -1) {1652 if (IsFile(fullname) != -1) { 1677 1653 AddToList(li->list[x],&exfiles,&numfiles, 1678 1654 &numalloc); 1679 1655 li->list = RemoveFromList(li->list,li->list[x]); 1680 if (!li->list)1656 if (!li->list) 1681 1657 break; 1682 1658 x--; 1683 1659 } 1684 1660 } 1685 if (exfiles && numfiles) {1661 if (exfiles && numfiles) { 1686 1662 1687 1663 CHECKLIST ckl; … … 1699 1675 &"s"[numfiles != 1], 1700 1676 li->targetpath); 1701 if (!WinDlgBox(HWND_DESKTOP,hwnd,CheckListProc,1677 if (!WinDlgBox(HWND_DESKTOP,hwnd,CheckListProc, 1702 1678 FM3ModHandle, 1703 1679 CHECK_FRAME,MPFROMP(&ckl))) { 1704 if (ckl.list)1680 if (ckl.list) 1705 1681 FreeList(ckl.list); 1706 1682 break; 1707 1683 } 1708 else if (ckl.list)1684 else if (ckl.list) 1709 1685 li->list = CombineLists(li->list,ckl.list); 1710 1686 } 1711 1687 } 1712 if (!li->list || !li->list[0])1688 if (!li->list || !li->list[0]) 1713 1689 break; 1714 1690 sprintf(cl,"%s %s%s%s",(li->type == IDM_EXTRACT || … … 1731 1707 strlen(cl) + strlen(li->list[x]) < 999;x++) { 1732 1708 strcat(cl," "); 1733 if (needs_quoting(li->list[x]))1709 if (needs_quoting(li->list[x])) 1734 1710 strcat(cl,"\""); 1735 1711 strcat(cl,li->list[x]); 1736 if (needs_quoting(li->list[x]))1712 if (needs_quoting(li->list[x])) 1737 1713 strcat(cl,"\""); 1738 1714 ptr = li->list[x]; 1739 1715 while(*ptr) { 1740 if (*ptr == '/')1716 if (*ptr == '/') 1741 1717 *ptr = '\\'; 1742 1718 ptr++; … … 1749 1725 *endofit = 0; 1750 1726 } while(li->list[x]); 1751 if (li->type == IDM_EXTRACT || li->type == IDM_EXTRACTWDIRS) {1727 if (li->type == IDM_EXTRACT || li->type == IDM_EXTRACTWDIRS) { 1752 1728 /* update windows */ 1753 1729 for(x = 0;li->list[x];x++) { … … 1758 1734 p = temp; 1759 1735 while(*p) { 1760 if (*p == '/')1736 if (*p == '/') 1761 1737 *p = '\\'; 1762 1738 p++; … … 1765 1741 if (p) { 1766 1742 strcpy(p,li->targetpath); 1767 if (p[strlen(p) - 1] != '\\')1743 if (p[strlen(p) - 1] != '\\') 1768 1744 strcat(p,"\\"); 1769 1745 strcat(p,temp); … … 1781 1757 FM3ModHandle,OBJCNR_FRAME, 1782 1758 MPFROMP(objectpath)); 1783 if (rc) {1784 if (rc > 1)1759 if (rc) { 1760 if (rc > 1) 1785 1761 strcpy(objectpath,"<WP_DESKTOP>"); 1786 1762 p = NULL; 1787 if (li->arcname) {1763 if (li->arcname) { 1788 1764 p = strrchr(li->arcname,'\\'); 1789 if (p)1765 if (p) 1790 1766 p++; 1791 1767 } … … 1799 1775 MPVOID); 1800 1776 } 1801 else if (li->type == IDM_EXEC)1777 else if (li->type == IDM_EXEC) 1802 1778 ExecOnList(hwnd, 1803 1779 li->runfile, … … 1806 1782 NULL, 1807 1783 GetPString(IDS_EXECARCFILETITLETEXT)); 1808 else if (li->type == IDM_VIRUSSCAN)1784 else if (li->type == IDM_VIRUSSCAN) 1809 1785 ExecOnList(hwnd,virus,PROMPT | WINDOWED | SEPARATEKEEP, 1810 1786 li->targetpath,NULL, 1811 1787 GetPString(IDS_VIRUSSCANARCHIVETITLETEXT)); 1812 else if (li->type == IDM_VIEW || li->type == IDM_VIEWTEXT ||1788 else if (li->type == IDM_VIEW || li->type == IDM_VIEWTEXT || 1813 1789 li->type == IDM_VIEWBINARY || li->type == IDM_EDIT || 1814 1790 li->type == IDM_EDITTEXT || … … 1844 1820 free(temp); 1845 1821 } 1846 if (li->type == IDM_VIEW || li->type == IDM_EDIT) {1822 if (li->type == IDM_VIEW || li->type == IDM_EDIT) { 1847 1823 1848 1824 BOOL isit = TestBinary(li->list[0]); 1849 1825 1850 if (isit) {1851 if (li->type == IDM_VIEW)1826 if (isit) { 1827 if (li->type == IDM_VIEW) 1852 1828 li->type = IDM_VIEWBINARY; 1853 1829 else … … 1855 1831 } 1856 1832 else { 1857 if (li->type == IDM_VIEW)1833 if (li->type == IDM_VIEW) 1858 1834 li->type = IDM_VIEWTEXT; 1859 1835 else … … 1861 1837 } 1862 1838 } 1863 if (li->type == IDM_MCIPLAY) {1839 if (li->type == IDM_MCIPLAY) { 1864 1840 1865 1841 FILE *fp; … … 1877 1853 } 1878 1854 } 1879 else if (li->type == IDM_PRINT) {1855 else if (li->type == IDM_PRINT) { 1880 1856 strcpy(li->targetpath,printer); 1881 1857 if (_beginthread(PrintList,NULL,65536,(PVOID)li) != -1) { … … 1884 1860 } 1885 1861 } 1886 else if (li->type == IDM_VIEWARCHIVE) {1862 else if (li->type == IDM_VIEWARCHIVE) { 1887 1863 1888 1864 ARC_TYPE *info; 1889 1865 1890 1866 for(x = 0;li->list[x];x++) { 1891 if (IsFile(li->list[x]) == 1) {1867 if (IsFile(li->list[x]) == 1) { 1892 1868 info = NULL; // Do not hide dups - fixme to know why? 1893 1869 if (WinDlgBox(HWND_DESKTOP,HWND_DESKTOP, … … 1905 1881 } 1906 1882 } 1907 else if ((li->type == IDM_VIEWTEXT && *viewer) ||1883 else if ((li->type == IDM_VIEWTEXT && *viewer) || 1908 1884 (li->type == IDM_VIEWBINARY && *binview) || 1909 1885 (li->type == IDM_EDITTEXT && *editor) || … … 1918 1894 } 1919 1895 else { 1920 if (li->hwnd) {1896 if (li->hwnd) { 1921 1897 1922 1898 ULONG viewtype; 1923 1899 1924 1900 for(x = 0;li->list[x];x++) { 1925 if (x == 0) {1926 if (li->type == IDM_VIEWBINARY ||1901 if (x == 0) { 1902 if (li->type == IDM_VIEWBINARY || 1927 1903 li->type == IDM_EDITBINARY) 1928 1904 viewtype = 16; … … 1958 1934 p = li->list[x]; 1959 1935 while(*p) { 1960 if (*p == '/')1936 if (*p == '/') 1961 1937 *p = '\\'; 1962 1938 p++; … … 1965 1941 (dcd->directory[strlen(dcd->directory) - 1] == '\\') ? 1966 1942 NullStr : "\\",li->list[x]); 1967 if (IsFile(fullname) != -1)1968 if (AddToList(fullname,&list2,&numfiles,&numalloced))1943 if (IsFile(fullname) != -1) 1944 if (AddToList(fullname,&list2,&numfiles,&numalloced)) 1969 1945 break; 1970 if (strchr(li->list[x],'\\')) {1946 if (strchr(li->list[x],'\\')) { 1971 1947 p = strrchr(li->list[x],'\\'); 1972 if (p) {1948 if (p) { 1973 1949 p++; 1974 if (*p) {1950 if (*p) { 1975 1951 sprintf(fullname,"%s%s%s",dcd->directory, 1976 1952 (dcd->directory[strlen(dcd->directory) - 1] == '\\') ? 1977 1953 NullStr : "\\",p); 1978 if (IsFile(fullname) != -1)1979 if (AddToList(fullname,&list2,&numfiles,&numalloced))1954 if (IsFile(fullname) != -1) 1955 if (AddToList(fullname,&list2,&numfiles,&numalloced)) 1980 1956 break; 1981 1957 } … … 1989 1965 MPFROM2SHORT(IDM_COLLECTOR,0),MPVOID); 1990 1966 DosSleep(128L); 1991 if (Collector) {1992 if (!PostMsg(Collector,WM_COMMAND,1967 if (Collector) { 1968 if (!PostMsg(Collector,WM_COMMAND, 1993 1969 MPFROM2SHORT(IDM_COLLECTOR,0), 1994 1970 MPFROMP(list2))) … … 2012 1988 case WM_DESTROY: 2013 1989 dcd = WinQueryWindowPtr(hwnd,QWL_USER); 2014 if (dcd) {2015 if (*dcd->workdir) {1990 if (dcd) { 1991 if (*dcd->workdir) { 2016 1992 DosSleep(33L); 2017 1993 wipeallf("%s\\*",dcd->workdir); 2018 if (rmdir(dcd->workdir)) {1994 if (rmdir(dcd->workdir)) { 2019 1995 DosSleep(256L); 2020 1996 wipeallf("%s\\*",dcd->workdir); … … 2027 2003 WinSetWindowPtr(dcd->hwndCnr,QWL_USER,NULL); 2028 2004 } 2029 if (!PostMsg((HWND)0,WM_QUIT,MPVOID,MPVOID))2005 if (!PostMsg((HWND)0,WM_QUIT,MPVOID,MPVOID)) 2030 2006 WinSendMsg((HWND)0,WM_QUIT,MPVOID,MPVOID); 2031 2007 break; … … 2042 2018 case DM_PRINTOBJECT: 2043 2019 case DM_DISCARDOBJECT: 2044 if(dcd) 2045 return WinSendMsg(dcd->hwndObject, 2046 msg, 2047 mp1, 2048 mp2); 2020 if (dcd) 2021 return WinSendMsg(dcd->hwndObject,msg,mp1,mp2); 2049 2022 else 2050 2023 return MRFROMLONG(DRR_TARGET); … … 2052 2025 case WM_CHAR: 2053 2026 shiftstate = (SHORT1FROMMP(mp1) & (KC_SHIFT | KC_ALT | KC_CTRL)); 2054 if (SHORT1FROMMP(mp1) & KC_KEYUP)2027 if (SHORT1FROMMP(mp1) & KC_KEYUP) 2055 2028 return (MRESULT)TRUE; 2056 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {2029 if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) { 2057 2030 switch(SHORT2FROMMP(mp2)) { 2058 2031 case VK_DELETE: 2059 PostMsg(hwnd, 2060 WM_COMMAND, 2061 MPFROM2SHORT(IDM_DELETE,0), 2062 MPVOID); 2063 break; 2064 } 2065 } 2066 if(shiftstate || fNoSearch) 2032 PostMsg(hwnd,WM_COMMAND,MPFROM2SHORT(IDM_DELETE,0),MPVOID); 2033 break; 2034 } 2035 } 2036 if (shiftstate || fNoSearch) 2067 2037 break; 2068 if (SHORT1FROMMP(mp1) & KC_CHAR) {2038 if (SHORT1FROMMP(mp1) & KC_CHAR) { 2069 2039 2070 2040 ULONG thistime,len; … … 2072 2042 PCNRITEM pci; 2073 2043 2074 if (!dcd)2044 if (!dcd) 2075 2045 break; 2076 2046 switch(SHORT1FROMMP(mp2)) { … … 2083 2053 default: 2084 2054 thistime = WinQueryMsgTime(WinQueryAnchorBlock(hwnd)); 2085 if (thistime > dcd->lasttime + 1250)2055 if (thistime > dcd->lasttime + 1250) 2086 2056 *dcd->szCommonName = 0; 2087 2057 dcd->lasttime = thistime; 2088 if (SHORT1FROMMP(mp2) == ' ' && !*dcd->szCommonName)2058 if (SHORT1FROMMP(mp2) == ' ' && !*dcd->szCommonName) 2089 2059 break; 2090 2060 KbdRetry: 2091 2061 len = strlen(dcd->szCommonName); 2092 if (len >= CCHMAXPATH - 1) {2062 if (len >= CCHMAXPATH - 1) { 2093 2063 *dcd->szCommonName = 0; 2094 2064 len = 0; … … 2106 2076 MPFROMP(&srch), 2107 2077 MPFROMLONG(CMA_FIRST)); 2108 if (pci && (INT)pci != -1) {2078 if (pci && (INT)pci != -1) { 2109 2079 2110 2080 USHORT attrib = CRA_CURSORED; 2111 2081 2112 2082 /* make found item current item */ 2113 if (!stricmp(pci->pszFileName,dcd->szCommonName))2083 if (!stricmp(pci->pszFileName,dcd->szCommonName)) 2114 2084 attrib |= CRA_SELECTED; 2115 2085 WinSendMsg(hwnd, … … 2122 2092 } 2123 2093 else { 2124 if (SHORT1FROMMP(mp2) == ' ') {2094 if (SHORT1FROMMP(mp2) == ' ') { 2125 2095 dcd->szCommonName[len] = 0; 2126 2096 break; … … 2128 2098 *dcd->szCommonName = 0; 2129 2099 dcd->lasttime = 0; 2130 if (len) // retry as first letter if no match2100 if (len) // retry as first letter if no match 2131 2101 goto KbdRetry; 2132 2102 } … … 2150 2120 memset(&cnri,0,sizeof(CNRINFO)); 2151 2121 cnri.cb = sizeof(CNRINFO); 2152 if (WinSendMsg(hwnd,2122 if (WinSendMsg(hwnd, 2153 2123 CM_QUERYCNRINFO, 2154 2124 MPFROMP(&cnri), 2155 2125 MPFROMLONG(sizeof(CNRINFO)))) { 2156 if (cnri.flWindowAttr & CV_DETAIL)2126 if (cnri.flWindowAttr & CV_DETAIL) 2157 2127 PrfWriteProfileData(fmprof, 2158 2128 appname, … … 2170 2140 case UM_UPDATERECORD: 2171 2141 case UM_UPDATERECORDLIST: 2172 if(dcd && 2173 !IsArcThere(hwnd,dcd->arcname)) 2174 PostMsg(hwnd, 2175 WM_CLOSE, 2176 MPVOID, 2177 MPVOID); 2142 if (dcd && !IsArcThere(hwnd,dcd->arcname)) 2143 PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID); 2178 2144 return 0; 2179 2145 … … 2182 2148 * put name of our window (archive name) on status line 2183 2149 */ 2184 if(dcd && 2185 hwndStatus && 2186 mp2) 2187 WinSendMsg(hwnd, 2188 UM_RESCAN, 2189 MPVOID, 2190 MPVOID); 2150 if (dcd && hwndStatus && mp2) 2151 WinSendMsg(hwnd,UM_RESCAN,MPVOID,MPVOID); 2191 2152 break; 2192 2153 2193 2154 case UM_SETUP2: 2194 if (dcd &&2155 if (dcd && 2195 2156 dcd->info) { 2196 if (dcd->info->fdpos == -1 || !dcd->info->datetype)2157 if (dcd->info->fdpos == -1 || !dcd->info->datetype) 2197 2158 dcd->sortFlags &= (~SORT_LWDATE); 2198 if (dcd->info->nsizepos == -1)2159 if (dcd->info->nsizepos == -1) 2199 2160 dcd->sortFlags &= (~SORT_EASIZE); 2200 if (dcd->info->osizepos == -1)2161 if (dcd->info->osizepos == -1) 2201 2162 dcd->sortFlags &= (~SORT_SIZE); 2202 2163 AdjustCnrColVis(hwnd, … … 2222 2183 dcd->info->fdpos != -1 && dcd->info->datetype, 2223 2184 FALSE); 2224 WinSendMsg(hwnd, 2225 CM_INVALIDATEDETAILFIELDINFO, 2226 MPVOID, 2227 MPVOID); 2185 WinSendMsg(hwnd,CM_INVALIDATEDETAILFIELDINFO,MPVOID,MPVOID); 2228 2186 } 2229 2187 return 0; 2230 2188 2231 2189 case UM_RESCAN: 2232 if(dcd) { 2233 2190 if (dcd) { 2234 2191 CNRINFO cnri; 2235 2192 CHAR s[CCHMAXPATH * 2],tb[81],tf[81]; 2236 2193 PARCITEM pci; 2237 2194 2238 if(mp1) { 2239 PostMsg(dcd->hwndObject, 2240 UM_RESCAN, 2241 MPVOID, 2242 MPVOID); 2195 if (mp1) { 2196 PostMsg(dcd->hwndObject,UM_RESCAN,MPVOID,MPVOID); 2243 2197 return 0; 2244 2198 } … … 2259 2213 *tb ? " / " : NullStr, 2260 2214 tb); 2261 WinSetDlgItemText(dcd->hwndClient, 2262 DIR_SELECTED, 2263 s); 2215 WinSetDlgItemText(dcd->hwndClient,DIR_SELECTED,s); 2264 2216 commafmt(tf,sizeof(tf),dcd->totalfiles); 2265 2217 if (dcd->ullTotalBytes) … … 2271 2223 *tb ? " / " : NullStr, 2272 2224 tb); 2273 WinSetDlgItemText(dcd->hwndClient, 2274 DIR_TOTALS, 2275 s); 2276 if(hwndStatus && 2225 WinSetDlgItemText(dcd->hwndClient,DIR_TOTALS,s); 2226 if (hwndStatus && 2277 2227 dcd->hwndFrame == WinQueryActiveWindow(dcd->hwndParent)) 2278 2228 { … … 2285 2235 (*dcd->mask.szMask) ? ")" : NullStr,dcd->arcname); 2286 2236 WinSetWindowText(hwndStatus,s); 2287 if (!ParentIsDesktop(hwnd,dcd->hwndParent)) {2237 if (!ParentIsDesktop(hwnd,dcd->hwndParent)) { 2288 2238 pci = WinSendMsg(hwnd, 2289 2239 CM_QUERYRECORDEMPHASIS, 2290 2240 MPFROMLONG(CMA_FIRST), 2291 2241 MPFROMSHORT(CRA_CURSORED)); 2292 if (pci && (INT)pci != -1) {2293 if (fSplitStatus && hwndStatus2) {2242 if (pci && (INT)pci != -1) { 2243 if (fSplitStatus && hwndStatus2) { 2294 2244 if (dcd->ullTotalBytes) 2295 2245 CommaFmtULL(tb,sizeof(tb),pci->cbFile,' '); … … 2303 2253 WinSetWindowText(hwndStatus2,s); 2304 2254 } 2305 if (fMoreButtons)2255 if (fMoreButtons) 2306 2256 WinSetWindowText(hwndName, 2307 2257 pci->szFileName); … … 2315 2265 } 2316 2266 } 2317 if ((dcd->arcfilled &&2267 if ((dcd->arcfilled && 2318 2268 !dcd->totalfiles) || 2319 2269 !IsArcThere(hwnd,dcd->arcname)) 2320 PostMsg(hwnd, 2321 WM_CLOSE, 2322 MPVOID, 2323 MPVOID); 2270 PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID); 2324 2271 } 2325 2272 return 0; 2326 2273 2327 2274 case UM_SETUP: 2328 if(dcd) { 2329 if(!dcd->hwndObject) { 2275 if (!dcd) { 2276 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2277 PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID); 2278 return 0; 2279 } 2280 else { 2281 if (!dcd->hwndObject) { 2330 2282 /* 2331 2283 * first time through -- set things up … … 2337 2289 2338 2290 rc = DosCreateDir(dcd->workdir,0); 2339 if (rc) {2340 if (rc == ERROR_ACCESS_DENIED) {2291 if (rc) { 2292 if (rc == ERROR_ACCESS_DENIED) { 2341 2293 p = strrchr(dcd->workdir,'.'); 2342 if (p) {2294 if (p) { 2343 2295 p++; 2344 2296 pp = p; … … 2348 2300 sprintf(p,"%03x"); 2349 2301 rc = DosCreateDir(dcd->workdir,0); 2350 if (!rc || rc != ERROR_ACCESS_DENIED)2302 if (!rc || rc != ERROR_ACCESS_DENIED) 2351 2303 break; 2352 2304 } 2353 2305 } 2354 2306 } 2355 if (rc)2307 if (rc) 2356 2308 PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID); 2357 2309 return 0; … … 2365 2317 PFIELDINFO pfi, pfiLastLeftCol; 2366 2318 ULONG numcols = CON_COLS; 2319 CNRINFO cnri; 2320 ULONG size; 2367 2321 2368 2322 pfi = WinSendMsg(hwnd, … … 2370 2324 MPFROMLONG(numcols), 2371 2325 NULL); 2372 if (pfi) {2326 if (pfi) { 2373 2327 2374 2328 PFIELDINFO pfiFirst; … … 2415 2369 MPFROMP(pfiFirst), 2416 2370 MPFROMP(&fii)); 2417 PostMsg(hwnd, 2418 UM_SETUP2, 2419 MPVOID, 2420 MPVOID); 2421 { 2422 CNRINFO cnri; 2423 2424 memset(&cnri,0,sizeof(cnri)); 2425 cnri.cb = sizeof( CNRINFO ); 2426 cnri.pFieldInfoLast = pfiLastLeftCol; 2427 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET + 32; 2428 { 2429 ULONG size; 2430 2431 size = sizeof(LONG); 2432 PrfQueryProfileData(fmprof,appname,"ArcCnrSplitBar", 2433 &cnri.xVertSplitbar,&size); 2434 if(cnri.xVertSplitbar <= 0) 2435 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET + 32; 2436 } 2437 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT | 2438 CV_NAME)); 2439 cnri.flWindowAttr |= (CV_DETAIL | CA_DETAILSVIEWTITLES | 2440 CV_FLOW); 2441 cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH | 2442 CA_MIXEDTARGETEMPH)); 2443 cnri.pSortRecord = (PVOID)ArcSort; 2444 WinSendMsg(hwnd, 2445 CM_SETCNRINFO, 2446 MPFROMP(&cnri), 2447 MPFROMLONG(CMA_PFIELDINFOLAST | 2448 CMA_XVERTSPLITBAR | 2449 CMA_PSORTRECORD | 2450 CMA_FLWINDOWATTR)); 2451 } 2371 PostMsg(hwnd,UM_SETUP2,MPVOID,MPVOID); 2372 2373 memset(&cnri,0,sizeof(cnri)); 2374 cnri.cb = sizeof( CNRINFO ); 2375 cnri.pFieldInfoLast = pfiLastLeftCol; 2376 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET + 32; 2377 2378 size = sizeof(LONG); 2379 PrfQueryProfileData(fmprof,appname,"ArcCnrSplitBar", 2380 &cnri.xVertSplitbar,&size); 2381 if (cnri.xVertSplitbar <= 0) 2382 cnri.xVertSplitbar = DIR_SPLITBAR_OFFSET + 32; 2383 2384 cnri.flWindowAttr &= (~(CV_ICON | CV_TREE | CV_TEXT | 2385 CV_NAME)); 2386 cnri.flWindowAttr |= (CV_DETAIL | CA_DETAILSVIEWTITLES | 2387 CV_FLOW); 2388 cnri.flWindowAttr &= (~(CA_ORDEREDTARGETEMPH | 2389 CA_MIXEDTARGETEMPH)); 2390 cnri.pSortRecord = (PVOID)ArcSort; 2391 WinSendMsg(hwnd, 2392 CM_SETCNRINFO, 2393 MPFROMP(&cnri), 2394 MPFROMLONG(CMA_PFIELDINFOLAST | 2395 CMA_XVERTSPLITBAR | 2396 CMA_PSORTRECORD | 2397 CMA_FLWINDOWATTR)); 2452 2398 } 2453 2399 } 2454 WinSendMsg(hwnd, 2455 CM_SORTRECORD, 2456 MPFROMP(ArcSort), 2457 MPFROMP(dcd)); 2458 if(_beginthread(MakeObjWin,NULL,245760,(PVOID)dcd) == -1) { 2400 WinSendMsg(hwnd,CM_SORTRECORD,MPFROMP(ArcSort),MPFROMP(dcd)); 2401 if (_beginthread(MakeObjWin,NULL,245760,(PVOID)dcd) == -1) { 2459 2402 Runtime_Error(pszSrcFile, __LINE__, GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2460 2403 PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID); … … 2474 2417 } 2475 2418 } 2476 else {2477 PostMsg(hwnd,2478 WM_CLOSE,2479 MPVOID,2480 MPVOID);2481 return 0;2482 }2483 2419 return 0; 2484 2420 2485 2421 case UM_SETDIR: 2486 if (dcd) {2422 if (dcd) { 2487 2423 2488 2424 CHAR s[CCHMAXPATH],*p; … … 2495 2431 bstrip(s); 2496 2432 MakeFullName(s); 2497 if (*s) {2433 if (*s) { 2498 2434 while ((p = strchr(s,'/')) != NULL) 2499 2435 *p = '\\'; … … 2511 2447 } 2512 2448 } 2513 if (!SetDir(dcd->hwndParent,hwnd,s,0)) {2514 if (stricmp(dcd->directory,s)) {2449 if (!SetDir(dcd->hwndParent,hwnd,s,0)) { 2450 if (stricmp(dcd->directory,s)) { 2515 2451 DosEnterCritSec(); 2516 2452 strcpy(lastextractpath,s); … … 2518 2454 } 2519 2455 strcpy(dcd->directory,s); 2520 if ((!isalpha(*s) || s[1] != ':') && *s != '.')2456 if ((!isalpha(*s) || s[1] != ':') && *s != '.') 2521 2457 saymsg(MB_ENTER | MB_ICONASTERISK, 2522 2458 hwnd, … … 2536 2472 2537 2473 case UM_ENTER: 2538 if(WinSendMsg(hwnd, 2539 UM_SETDIR, 2540 MPVOID, 2541 MPVOID)) 2474 if (WinSendMsg(hwnd,UM_SETDIR,MPVOID,MPVOID)) 2542 2475 return 0; 2543 2476 SetShiftState(); 2544 if (dcd && (CHAR *)mp1) {2477 if (dcd && (CHAR *)mp1) { 2545 2478 2546 2479 SWP swp; 2547 2480 CHAR *filename = mp1; 2548 2481 2549 if (IsFile(filename) != 1)2482 if (IsFile(filename) != 1) 2550 2483 return 0; 2551 2484 WinQueryWindowPos(dcd->hwndFrame,&swp); … … 2555 2488 &swp, 2556 2489 filename); 2557 if (fUnHilite)2490 if (fUnHilite) 2558 2491 UnHilite(hwnd, 2559 2492 FALSE, … … 2563 2496 2564 2497 case WM_MENUEND: 2565 if (dcd) {2498 if (dcd) { 2566 2499 2567 2500 HWND hwndMenu = (HWND)mp2; 2568 2501 2569 if(hwndMenu == ArcCnrMenu || 2570 hwndMenu == ArcMenu) { 2571 MarkAll(hwnd, 2572 TRUE, 2573 FALSE, 2574 TRUE); 2575 if(dcd->cnremphasized) { 2502 if (hwndMenu == ArcCnrMenu || hwndMenu == ArcMenu) { 2503 MarkAll(hwnd,TRUE,FALSE,TRUE); 2504 if (dcd->cnremphasized) { 2576 2505 WinSendMsg(hwnd, 2577 2506 CM_SETRECORDEMPHASIS, … … 2585 2514 2586 2515 case MM_PORTHOLEINIT: 2587 if (dcd) {2516 if (dcd) { 2588 2517 switch(SHORT1FROMMP(mp1)) { 2589 2518 case 0: … … 2607 2536 case UM_INITMENU: 2608 2537 case WM_INITMENU: 2609 if (dcd) {2538 if (dcd) { 2610 2539 switch(SHORT1FROMMP(mp1)) { 2611 2540 case IDM_FILESMENU: 2612 if (dcd->info) {2541 if (dcd->info) { 2613 2542 WinEnableMenuItem((HWND)mp2, 2614 2543 IDM_DELETE, … … 2642 2571 2643 2572 case IDM_COMMANDSMENU: 2644 SetupCommandMenu((HWND)mp2, 2645 hwnd); 2573 SetupCommandMenu((HWND)mp2,hwnd); 2646 2574 break; 2647 2575 2648 2576 case IDM_SORTSUBMENU: 2649 SetSortChecks((HWND)mp2, 2650 dcd->sortFlags); 2577 SetSortChecks((HWND)mp2,dcd->sortFlags); 2651 2578 break; 2652 2579 … … 2662 2589 dcd->hwndLastMenu = (HWND)mp2; 2663 2590 } 2664 if (msg == WM_INITMENU)2591 if (msg == WM_INITMENU) 2665 2592 break; 2666 2593 return 0; 2667 2594 2668 2595 case UM_LOADFILE: 2669 if (dcd && mp2) {2596 if (dcd && mp2) { 2670 2597 2671 2598 HWND ret; … … 2681 2608 2682 2609 case UM_COMMAND: 2683 if(mp1) { 2684 if(dcd) { 2685 if(!PostMsg(dcd->hwndObject, 2686 UM_COMMAND, 2687 mp1, 2688 mp2)) { 2610 if (mp1) { 2611 if (dcd) { 2612 if (!PostMsg(dcd->hwndObject,UM_COMMAND,mp1,mp2)) { 2689 2613 Runtime_Error(pszSrcFile, __LINE__, "post"); 2690 2614 FreeListInfo((LISTINFO *)mp1); … … 2699 2623 2700 2624 case UM_OPENWINDOWFORME: 2701 if(dcd) { 2702 if(mp1 && 2703 !IsFile((CHAR *)mp1)) 2625 if (dcd) { 2626 if (mp1 && !IsFile((CHAR *)mp1)) { 2704 2627 OpenDirCnr((HWND)0, 2705 2628 hwndMain, … … 2707 2630 FALSE, 2708 2631 (char *)mp1); 2709 else if(mp1 && 2710 IsFile(mp1) == 1)2632 } 2633 else if (mp1 && IsFile(mp1) == 1) { 2711 2634 StartArcCnr(HWND_DESKTOP, 2712 2635 dcd->hwndFrame, … … 2714 2637 4, 2715 2638 (ARC_TYPE *)mp2); 2639 } 2716 2640 } 2717 2641 return 0; … … 2719 2643 case WM_COMMAND: 2720 2644 DosError(FERR_DISABLEHARDERR); 2721 if (dcd) {2722 if (SwitchCommand(dcd->hwndLastMenu,2645 if (dcd) { 2646 if (SwitchCommand(dcd->hwndLastMenu, 2723 2647 SHORT1FROMMP(mp1))) 2724 2648 return 0; 2725 if(WinSendMsg(hwnd, 2726 UM_SETDIR, 2727 MPVOID, 2728 MPVOID)) 2649 if (WinSendMsg(hwnd,UM_SETDIR,MPVOID,MPVOID)) 2729 2650 return 0; 2730 if(!IsArcThere(hwnd, 2731 dcd->arcname)) { 2732 PostMsg(hwnd, 2733 WM_CLOSE, 2734 MPVOID, 2735 MPVOID); 2651 if (!IsArcThere(hwnd,dcd->arcname)) { 2652 PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID); 2736 2653 return 0; 2737 2654 } … … 2748 2665 PostMsg(hwnd, 2749 2666 WM_CONTROL, 2750 MPFROM2SHORT(ARC_CNR, 2751 CN_CONTEXTMENU), 2667 MPFROM2SHORT(ARC_CNR,CN_CONTEXTMENU), 2752 2668 MPFROMP(pci)); 2753 2669 } … … 2784 2700 2785 2701 case IDM_NOTEBOOK: 2786 if(!ParentIsDesktop(dcd->hwndParent,dcd->hwndParent)) 2787 PostMsg(dcd->hwndParent, 2788 msg, 2789 mp1, 2790 mp2); 2702 if (!ParentIsDesktop(dcd->hwndParent,dcd->hwndParent)) 2703 PostMsg(dcd->hwndParent,msg,mp1,mp2); 2791 2704 else 2792 2705 WinDlgBox(HWND_DESKTOP, … … 2807 2720 &dcd->info, 2808 2721 &dcd->ullTotalBytes); 2809 PostMsg(dcd->hwndCnr, 2810 UM_RESCAN, 2811 MPVOID, 2812 MPVOID); 2813 PostMsg(dcd->hwndCnr, 2814 UM_SETUP2, 2815 MPVOID, 2816 MPVOID); 2722 PostMsg(dcd->hwndCnr,UM_RESCAN,MPVOID,MPVOID); 2723 PostMsg(dcd->hwndCnr,UM_SETUP2,MPVOID,MPVOID); 2817 2724 WinSendMsg(dcd->hwndCnr, 2818 2725 CM_INVALIDATERECORD, 2819 2726 MPVOID, 2820 MPFROM2SHORT(0, 2821 CMA_ERASE | CMA_REPOSITION)); 2727 MPFROM2SHORT(0,CMA_ERASE | CMA_REPOSITION)); 2822 2728 break; 2823 2729 … … 2833 2739 2834 2740 case IDM_HELP: 2835 if (hwndHelp)2741 if (hwndHelp) 2836 2742 WinSendMsg(hwndHelp, 2837 2743 HM_DISPLAY_HELP, … … 2841 2747 2842 2748 case IDM_WINDOWDLG: 2843 if (!ParentIsDesktop(dcd->hwndParent,dcd->hwndFrame))2749 if (!ParentIsDesktop(dcd->hwndParent,dcd->hwndFrame)) 2844 2750 PostMsg(dcd->hwndParent, 2845 2751 UM_COMMAND, … … 2862 2768 MPFROMLONG(CMA_FIRST), 2863 2769 MPFROMSHORT(CRA_CURSORED)); 2864 if ((INT)pci == -1)2770 if ((INT)pci == -1) 2865 2771 pci = NULL; 2866 if (SHORT1FROMMP(mp1) == IDM_HIDEALL) {2867 if (pci) {2868 if (!(pci->rc.flRecordAttr & CRA_SELECTED))2772 if (SHORT1FROMMP(mp1) == IDM_HIDEALL) { 2773 if (pci) { 2774 if (!(pci->rc.flRecordAttr & CRA_SELECTED)) 2869 2775 pci->rc.flRecordAttr |= CRA_FILTERED; 2870 2776 WinSendMsg(hwnd, 2871 2777 CM_INVALIDATERECORD, 2872 2778 MPFROMP(&pci), 2873 MPFROM2SHORT(1, 2874 CMA_ERASE | CMA_REPOSITION)); 2779 MPFROM2SHORT(1,CMA_ERASE | CMA_REPOSITION)); 2875 2780 break; 2876 2781 } 2877 2782 } 2878 PostMsg(dcd->hwndObject, 2879 UM_SELECT, 2880 mp1, 2881 MPFROMP(pci)); 2783 PostMsg(dcd->hwndObject,UM_SELECT,mp1,MPFROMP(pci)); 2882 2784 } 2883 2785 break; … … 2915 2817 break; 2916 2818 case IDM_SORTREVERSE: 2917 if (dcd->sortFlags & SORT_REVERSE)2819 if (dcd->sortFlags & SORT_REVERSE) 2918 2820 dcd->sortFlags &= (~SORT_REVERSE); 2919 2821 else … … 2921 2823 break; 2922 2824 } 2923 WinSendMsg(hwnd, 2924 CM_SORTRECORD, 2925 MPFROMP(ArcSort), 2926 MPFROMP(dcd)); 2825 WinSendMsg(hwnd,CM_SORTRECORD,MPFROMP(ArcSort),MPFROMP(dcd)); 2927 2826 SaySort(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT), 2928 2827 DIR_SORT), … … 2933 2832 2934 2833 case IDM_COLLECTOR: 2935 if(!Collector) { 2936 2834 if (!Collector) { 2937 2835 HWND hwndC; 2938 2836 SWP swp; 2939 2837 2940 if (ParentIsDesktop(hwnd,dcd->hwndParent) && !fAutoTile &&2941 (!fExternalCollector && !strcmp(realappname,FM3Str)))2838 if (ParentIsDesktop(hwnd,dcd->hwndParent) && !fAutoTile && 2839 (!fExternalCollector && !strcmp(realappname,FM3Str))) 2942 2840 GetNextWindowPos(dcd->hwndParent,&swp,NULL,NULL); 2943 2841 hwndC = StartCollector((fExternalCollector || 2944 2842 strcmp(realappname,FM3Str)) ? 2945 2843 HWND_DESKTOP : dcd->hwndParent,4); 2946 if (hwndC) {2947 if (!ParentIsDesktop(hwnd,dcd->hwndParent) && !fAutoTile &&2948 (!fExternalCollector && !strcmp(realappname,FM3Str)))2844 if (hwndC) { 2845 if (!ParentIsDesktop(hwnd,dcd->hwndParent) && !fAutoTile && 2846 (!fExternalCollector && !strcmp(realappname,FM3Str))) 2949 2847 WinSetWindowPos(hwndC, 2950 2848 HWND_TOP, … … 2955 2853 SWP_MOVE | SWP_SIZE | 2956 2854 SWP_SHOW | SWP_ZORDER); 2957 else if (!ParentIsDesktop(hwnd,dcd->hwndParent) &&2958 fAutoTile &&2959 !strcmp(realappname,FM3Str))2855 else if (!ParentIsDesktop(hwnd,dcd->hwndParent) && 2856 fAutoTile && 2857 !strcmp(realappname,FM3Str)) { 2960 2858 TileChildren(dcd->hwndParent,TRUE); 2859 } 2961 2860 WinSetWindowPos(hwndC, 2962 2861 HWND_TOP, … … 2975 2874 case IDM_ARCEXTRACTEXIT: 2976 2875 case IDM_ARCEXTRACT: 2977 if (dcd->info->extract)2876 if (dcd->info->extract) 2978 2877 runemf2(SEPARATE | WINDOWED | 2979 2878 ((fArcStuffVisible) ? 0 : (BACKGROUND | MINIMIZED)), … … 2983 2882 dcd->arcname, 2984 2883 (needs_quoting(dcd->arcname)) ? "\"" : NullStr); 2985 if(SHORT1FROMMP(mp1) == IDM_ARCEXTRACTEXIT) 2986 PostMsg(hwnd, 2987 WM_CLOSE, 2988 MPVOID, 2989 MPVOID); 2884 if (SHORT1FROMMP(mp1) == IDM_ARCEXTRACTEXIT) 2885 PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID); 2990 2886 break; 2991 2887 2992 2888 case IDM_ARCEXTRACTWDIRSEXIT: 2993 2889 case IDM_ARCEXTRACTWDIRS: 2994 if (dcd->info->exwdirs)2890 if (dcd->info->exwdirs) 2995 2891 runemf2(SEPARATE | WINDOWED | 2996 2892 ((fArcStuffVisible) ? 0 : (BACKGROUND | MINIMIZED)) , … … 3000 2896 dcd->arcname, 3001 2897 (needs_quoting(dcd->arcname)) ? "\"" : NullStr); 3002 if(SHORT1FROMMP(mp1) == IDM_ARCEXTRACTWDIRSEXIT) 3003 PostMsg(hwnd, 3004 WM_CLOSE, 3005 MPVOID, 3006 MPVOID); 2898 if (SHORT1FROMMP(mp1) == IDM_ARCEXTRACTWDIRSEXIT) 2899 PostMsg(hwnd,WM_CLOSE,MPVOID,MPVOID); 3007 2900 break; 3008 2901 3009 2902 case IDM_RESORT: 3010 WinSendMsg(hwnd, 3011 CM_SORTRECORD, 3012 MPFROMP(ArcSort), 3013 MPFROMP(dcd)); 2903 WinSendMsg(hwnd,CM_SORTRECORD,MPFROMP(ArcSort),MPFROMP(dcd)); 3014 2904 break; 3015 2905 … … 3019 2909 PARCITEM pci; 3020 2910 3021 if (!*dcd->mask.szMask) {2911 if (!*dcd->mask.szMask) { 3022 2912 empty = TRUE; 3023 2913 pci = (PARCITEM)CurrentRecord(hwnd); 3024 if (pci && strchr(pci->szFileName,'.'))2914 if (pci && strchr(pci->szFileName,'.')) 3025 2915 strcpy(dcd->mask.szMask,pci->szFileName); 3026 2916 } 3027 2917 3028 if(WinDlgBox(HWND_DESKTOP,hwnd,PickMaskDlgProc, 3029 FM3ModHandle,MSK_FRAME,MPFROMP(&dcd->mask))) { 3030 WinSendMsg(hwnd,CM_FILTER,MPFROMP(ArcFilter), 3031 MPFROMP(dcd)); 2918 if (WinDlgBox(HWND_DESKTOP,hwnd,PickMaskDlgProc, 2919 FM3ModHandle,MSK_FRAME,MPFROMP(&dcd->mask))) { 2920 WinSendMsg(hwnd,CM_FILTER,MPFROMP(ArcFilter),MPFROMP(dcd)); 3032 2921 PostMsg(hwnd,UM_RESCAN,MPVOID,MPVOID); 3033 2922 } 3034 else if (empty)2923 else if (empty) 3035 2924 *dcd->mask.szMask = 0; 3036 2925 SayFilter(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT), … … 3040 2929 3041 2930 case IDM_SWITCH: 3042 if (mp2) {3043 if (stricmp(dcd->directory,(CHAR *)mp2)) {2931 if (mp2) { 2932 if (stricmp(dcd->directory,(CHAR *)mp2)) { 3044 2933 DosEnterCritSec(); 3045 2934 strcpy(lastextractpath,(CHAR *)mp2); … … 3058 2947 3059 2948 strcpy(newdir,dcd->directory); 3060 if (!WinDlgBox(HWND_DESKTOP,dcd->hwndParent,WalkExtractDlgProc,3061 FM3ModHandle,WALK_FRAME,3062 MPFROMP(newdir)) || !*newdir)2949 if (!WinDlgBox(HWND_DESKTOP,dcd->hwndParent,WalkExtractDlgProc, 2950 FM3ModHandle,WALK_FRAME, 2951 MPFROMP(newdir)) || !*newdir) 3063 2952 break; 3064 if (stricmp(newdir,dcd->directory)) {2953 if (stricmp(newdir,dcd->directory)) { 3065 2954 strcpy(dcd->directory,newdir); 3066 if (stricmp(lastextractpath,newdir))2955 if (stricmp(lastextractpath,newdir)) 3067 2956 strcpy(lastextractpath,newdir); 3068 2957 WinSetWindowText(dcd->hwndExtract,dcd->directory); … … 3072 2961 3073 2962 case IDM_TEST: 3074 if (dcd->info->test)2963 if (dcd->info->test) 3075 2964 runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED, 3076 2965 hwnd,NULL,NULL,"%s %s%s%s",dcd->info->test, … … 3134 3023 PARCITEM pai; 3135 3024 3136 if (SHORT1FROMMP(mp1) != IDM_EXEC)3025 if (SHORT1FROMMP(mp1) != IDM_EXEC) 3137 3026 pai = (PARCITEM)CurrentRecord(hwnd); 3138 3027 else … … 3140 3029 MPFROMLONG(CMA_FIRST), 3141 3030 MPFROMSHORT(CRA_CURSORED)); 3142 if (pai && (INT)pai != -1)3031 if (pai && (INT)pai != -1) 3143 3032 strcpy(li->runfile,pai->szFileName); 3144 3033 else … … 3162 3051 break; 3163 3052 } 3164 if(li->list) { 3165 if(!PostMsg(dcd->hwndObject,UM_ACTION,MPFROMP(li), 3166 MPVOID)) { 3053 if (li->list) { 3054 if (!PostMsg(dcd->hwndObject,UM_ACTION,MPFROMP(li),MPVOID)) { 3167 3055 Runtime_Error(pszSrcFile, __LINE__, "post"); 3168 3056 FreeListInfo(li); 3169 3057 } 3170 else if (fUnHilite && SHORT1FROMMP(mp1) != IDM_EDIT)3058 else if (fUnHilite && SHORT1FROMMP(mp1) != IDM_EDIT) 3171 3059 UnHilite(hwnd,TRUE,&dcd->lastselection); 3172 3060 } … … 3182 3070 case WM_CONTROL: 3183 3071 DosError(FERR_DISABLEHARDERR); 3184 if (dcd) {3072 if (dcd) { 3185 3073 switch(SHORT2FROMMP(mp1)) { 3186 3074 case CN_BEGINEDIT: 3187 PostMsg(hwnd, 3188 CM_CLOSEEDIT, 3189 MPVOID, 3190 MPVOID); 3075 PostMsg(hwnd,CM_CLOSEEDIT,MPVOID,MPVOID); 3191 3076 break; 3192 3077 3193 3078 case CN_ENDEDIT: 3194 if (!((PCNREDITDATA)mp2)->pRecord) {3079 if (!((PCNREDITDATA)mp2)->pRecord) { 3195 3080 3196 3081 PFIELDINFO pfi = ((PCNREDITDATA)mp2)->pFieldInfo; 3197 3082 USHORT cmd = 0; 3198 3083 3199 if (!pfi || pfi->offStruct == FIELDOFFSET(ARCITEM,pszFileName))3084 if (!pfi || pfi->offStruct == FIELDOFFSET(ARCITEM,pszFileName)) 3200 3085 cmd = IDM_SORTSMARTNAME; 3201 else if (pfi->offStruct == FIELDOFFSET(ARCITEM,cbFile))3086 else if (pfi->offStruct == FIELDOFFSET(ARCITEM,cbFile)) 3202 3087 cmd = IDM_SORTSIZE; 3203 else if (pfi->offStruct == FIELDOFFSET(ARCITEM,cbComp))3088 else if (pfi->offStruct == FIELDOFFSET(ARCITEM,cbComp)) 3204 3089 cmd = IDM_SORTEASIZE; 3205 else if (pfi->offStruct == FIELDOFFSET(ARCITEM,date))3090 else if (pfi->offStruct == FIELDOFFSET(ARCITEM,date)) 3206 3091 cmd = IDM_SORTLWDATE; 3207 else if (pfi->offStruct == FIELDOFFSET(ARCITEM,time))3092 else if (pfi->offStruct == FIELDOFFSET(ARCITEM,time)) 3208 3093 cmd = IDM_SORTLWDATE; 3209 if(cmd) 3210 PostMsg(hwnd, 3211 WM_COMMAND, 3212 MPFROM2SHORT(cmd,0), 3213 MPVOID); 3094 if (cmd) 3095 PostMsg(hwnd,WM_COMMAND,MPFROM2SHORT(cmd,0),MPVOID); 3214 3096 } 3215 3097 break; … … 3223 3105 3224 3106 case CN_DRAGLEAVE: 3225 if (mp2) {3107 if (mp2) { 3226 3108 3227 3109 PDRAGINFO pDInfo; … … 3235 3117 case CN_DRAGAFTER: 3236 3118 case CN_DRAGOVER: 3237 if (mp2) {3119 if (mp2) { 3238 3120 3239 3121 PDRAGITEM pDItem; /* Pointer to DRAGITEM */ … … 3242 3124 3243 3125 pci = (PARCITEM)((PCNRDRAGINFO)mp2)->pRecord; 3244 if (SHORT1FROMMP(mp1) == CN_DRAGAFTER)3126 if (SHORT1FROMMP(mp1) == CN_DRAGAFTER) 3245 3127 pci = NULL; 3246 3128 pDInfo = ((PCNRDRAGINFO)mp2)->pDragInfo; 3247 3129 DrgAccessDraginfo(pDInfo); /* Access DRAGINFO */ 3248 if (*dcd->arcname) {3249 if ((driveflags[toupper(*dcd->arcname) - 'A'] & DRIVE_NOTWRITEABLE) ||3250 !dcd->info ||3251 !dcd->info->create) {3130 if (*dcd->arcname) { 3131 if ((driveflags[toupper(*dcd->arcname) - 'A'] & DRIVE_NOTWRITEABLE) || 3132 !dcd->info || 3133 !dcd->info->create) { 3252 3134 DrgFreeDraginfo(pDInfo); 3253 3135 return MRFROM2SHORT(DOR_NEVERDROP,0); 3254 3136 } 3255 3137 } 3256 if (pci) {3138 if (pci) { 3257 3139 DrgFreeDraginfo(pDInfo); 3258 3140 return MRFROM2SHORT(DOR_NODROP,0); 3259 3141 } 3260 pDItem = DrgQueryDragitemPtr(pDInfo, 3261 0); 3262 if (DrgVerifyRMF(pDItem,/* Check valid rendering */3263 DRM_OS2FILE,/* mechanisms and data */3264 NULL) &&3265 !(pDItem->fsControl & DC_PREPARE)) {3142 pDItem = DrgQueryDragitemPtr(pDInfo, /* Access DRAGITEM */ 3143 0); /* Index to DRAGITEM */ 3144 if (DrgVerifyRMF(pDItem, /* Check valid rendering */ 3145 DRM_OS2FILE, /* mechanisms and data */ 3146 NULL) && 3147 !(pDItem->fsControl & DC_PREPARE)) { 3266 3148 DrgFreeDraginfo(pDInfo); /* Free DRAGINFO */ 3267 3149 return(MRFROM2SHORT(DOR_DROP, /* Return okay to drop */ … … 3274 3156 3275 3157 case CN_INITDRAG: 3276 if (mp2) {3158 if (mp2) { 3277 3159 3278 3160 BOOL wasemphasized = FALSE; … … 3280 3162 PARCITEM pci; 3281 3163 3282 if (pcd) {3164 if (pcd) { 3283 3165 pci = (PARCITEM)pcd->pRecord; 3284 if (pci) {3285 if (pci->rc.flRecordAttr & CRA_SELECTED)3166 if (pci) { 3167 if (pci->rc.flRecordAttr & CRA_SELECTED) 3286 3168 wasemphasized = TRUE; 3287 if (!ParentIsDesktop(hwnd,dcd->hwndParent) &&3288 fSplitStatus && hwndStatus2)3169 if (!ParentIsDesktop(hwnd,dcd->hwndParent) && 3170 fSplitStatus && hwndStatus2) 3289 3171 WinSetWindowText(hwndStatus2, 3290 3172 GetPString(IDS_DRAGARCMEMTEXT)); 3291 if (DoFileDrag(hwnd,3292 dcd->hwndObject,3293 mp2,3294 dcd->arcname,3295 NULL,3296 TRUE)) {3297 if (fUnHilite && wasemphasized)3173 if (DoFileDrag(hwnd, 3174 dcd->hwndObject, 3175 mp2, 3176 dcd->arcname, 3177 NULL, 3178 TRUE)) { 3179 if (fUnHilite && wasemphasized) 3298 3180 UnHilite(hwnd,TRUE,&dcd->lastselection); 3299 3181 } 3300 if (!ParentIsDesktop(hwnd,dcd->hwndParent) &&3301 fSplitStatus && hwndStatus2)3182 if (!ParentIsDesktop(hwnd,dcd->hwndParent) && 3183 fSplitStatus && hwndStatus2) { 3302 3184 PostMsg(hwnd,UM_RESCAN,MPVOID,MPVOID); 3185 } 3303 3186 } 3304 3187 else { 3305 if (!ParentIsDesktop(hwnd,dcd->hwndParent) &&3306 fSplitStatus && hwndStatus2)3188 if (!ParentIsDesktop(hwnd,dcd->hwndParent) && 3189 fSplitStatus && hwndStatus2) 3307 3190 WinSetWindowText(hwndStatus2, 3308 3191 GetPString(IDS_DRAGARCFILETEXT)); … … 3311 3194 dcd->arcname, 3312 3195 FALSE); 3313 if (!ParentIsDesktop(hwnd,dcd->hwndParent) &&3314 fSplitStatus && hwndStatus2)3196 if (!ParentIsDesktop(hwnd,dcd->hwndParent) && 3197 fSplitStatus && hwndStatus2) 3315 3198 PostMsg(hwnd,UM_RESCAN,MPVOID,MPVOID); 3316 3199 } … … 3320 3203 3321 3204 case CN_DROP: 3322 if (mp2) {3205 if (mp2) { 3323 3206 3324 3207 LISTINFO *li; … … 3331 3214 mp2); 3332 3215 DosBeep(50,100); // fixme to know why beep? 3333 if (li) {3216 if (li) { 3334 3217 li->type = (li->type == DO_MOVE) ? 3335 3218 IDM_ARCHIVEM : 3336 3219 IDM_ARCHIVE; 3337 3220 strcpy(li->targetpath,dcd->arcname); 3338 if(!li->list || 3339 !li->list[0] || 3340 !PostMsg(dcd->hwndObject, 3341 UM_ACTION, 3342 MPFROMP(li), 3343 MPVOID)) 3221 if (!li->list || 3222 !li->list[0] || 3223 !PostMsg(dcd->hwndObject,UM_ACTION,MPFROMP(li),MPVOID)) 3344 3224 FreeListInfo(li); 3345 3225 } … … 3351 3231 PARCITEM pci = (PARCITEM)mp2; 3352 3232 3353 if (pci) {3233 if (pci) { 3354 3234 WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPFROMP(pci), 3355 3235 MPFROM2SHORT(TRUE,CRA_CURSORED)); … … 3359 3239 else { 3360 3240 dcd->hwndLastMenu = CheckMenu(&ArcCnrMenu,ARCCNR_POPUP); 3361 if (dcd->hwndLastMenu && !dcd->cnremphasized) {3241 if (dcd->hwndLastMenu && !dcd->cnremphasized) { 3362 3242 WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPVOID, 3363 3243 MPFROM2SHORT(TRUE,CRA_SOURCE)); … … 3365 3245 } 3366 3246 } 3367 if (dcd->hwndLastMenu) {3368 if (dcd->hwndLastMenu == ArcCnrMenu) {3369 if (dcd->flWindowAttr & CV_MINI)3247 if (dcd->hwndLastMenu) { 3248 if (dcd->hwndLastMenu == ArcCnrMenu) { 3249 if (dcd->flWindowAttr & CV_MINI) 3370 3250 WinCheckMenuItem(dcd->hwndLastMenu,IDM_MINIICONS,TRUE); 3371 3251 } 3372 3252 WinCheckMenuItem(dcd->hwndLastMenu,IDM_FOLDERAFTEREXTRACT, 3373 3253 fFolderAfterExtract); 3374 if (!PopupMenu(hwnd,hwnd,dcd->hwndLastMenu)) {3375 if (dcd->cnremphasized) {3254 if (!PopupMenu(hwnd,hwnd,dcd->hwndLastMenu)) { 3255 if (dcd->cnremphasized) { 3376 3256 WinSendMsg(hwnd,CM_SETRECORDEMPHASIS,MPVOID, 3377 3257 MPFROM2SHORT(FALSE,CRA_SOURCE)); … … 3385 3265 3386 3266 case CN_EMPHASIS: 3387 if (mp2) {3267 if (mp2) { 3388 3268 3389 3269 PNOTIFYRECORDEMPHASIS pre = mp2; … … 3392 3272 3393 3273 pci = (PARCITEM)((pre) ? pre->pRecord : NULL); 3394 if (!pci) {3395 if (!ParentIsDesktop(hwnd,dcd->hwndParent)) {3396 if (hwndStatus2)3274 if (!pci) { 3275 if (!ParentIsDesktop(hwnd,dcd->hwndParent)) { 3276 if (hwndStatus2) 3397 3277 WinSetWindowText(hwndStatus2,NullStr); 3398 if (fMoreButtons)3278 if (fMoreButtons) 3399 3279 WinSetWindowText(hwndName,NullStr); 3400 3280 } 3401 3281 break; 3402 3282 } 3403 if (pre->fEmphasisMask & CRA_SELECTED) {3404 if (pci->rc.flRecordAttr & CRA_SELECTED) {3283 if (pre->fEmphasisMask & CRA_SELECTED) { 3284 if (pci->rc.flRecordAttr & CRA_SELECTED) { 3405 3285 dcd->selectedbytes += pci->cbFile; 3406 3286 dcd->selectedfiles++; 3407 3287 } 3408 else if (dcd->selectedfiles) {3288 else if (dcd->selectedfiles) { 3409 3289 dcd->selectedbytes -= pci->cbFile; 3410 3290 dcd->selectedfiles--; … … 3421 3301 WinSetDlgItemText(dcd->hwndClient,DIR_SELECTED,s); 3422 3302 } 3423 else if (WinQueryActiveWindow(dcd->hwndParent) ==3424 dcd->hwndFrame &&3425 !ParentIsDesktop(hwnd,dcd->hwndParent)) {3426 if (pre->fEmphasisMask & CRA_CURSORED) {3427 if (pci->rc.flRecordAttr & CRA_CURSORED) {3428 if (fSplitStatus && hwndStatus2) {3303 else if (WinQueryActiveWindow(dcd->hwndParent) == 3304 dcd->hwndFrame && 3305 !ParentIsDesktop(hwnd,dcd->hwndParent)) { 3306 if (pre->fEmphasisMask & CRA_CURSORED) { 3307 if (pci->rc.flRecordAttr & CRA_CURSORED) { 3308 if (fSplitStatus && hwndStatus2) { 3429 3309 if (dcd->ullTotalBytes) 3430 3310 CommaFmtULL(tb,sizeof(tb),pci->cbFile,' '); … … 3438 3318 WinSetWindowText(hwndStatus2,s); 3439 3319 } 3440 if (fMoreButtons)3320 if (fMoreButtons) 3441 3321 WinSetWindowText(hwndName,pci->szFileName); 3442 3322 } … … 3447 3327 3448 3328 case CN_ENTER: 3449 if (mp2) {3329 if (mp2) { 3450 3330 3451 3331 PARCITEM pci = (PARCITEM)((PNOTIFYRECORDENTER)mp2)->pRecord; 3452 3332 3453 if (pci) {3333 if (pci) { 3454 3334 3455 3335 CHAR *s; 3456 3336 3457 if ((pci->rc.flRecordAttr & CRA_INUSE) ||3458 (pci->flags & (ARCFLAGS_REALDIR | ARCFLAGS_PSEUDODIR)))3337 if ((pci->rc.flRecordAttr & CRA_INUSE) || 3338 (pci->flags & (ARCFLAGS_REALDIR | ARCFLAGS_PSEUDODIR))) 3459 3339 break; 3460 3340 s = xstrdup(pci->szFileName,pszSrcFile,__LINE__); 3461 3341 if (s) { 3462 if(!PostMsg(dcd->hwndObject,UM_ENTER, 3463 MPFROMP(s),MPVOID)) { 3342 if (!PostMsg(dcd->hwndObject,UM_ENTER,MPFROMP(s),MPVOID)) { 3464 3343 Runtime_Error(pszSrcFile, __LINE__, "post"); 3465 3344 free(s); … … 3474 3353 3475 3354 case UM_FOLDUP: 3476 if(!PostMsg((HWND)0, 3477 WM_QUIT, 3478 MPVOID, 3479 MPVOID)) 3355 if (!PostMsg((HWND)0,WM_QUIT,MPVOID,MPVOID)) 3480 3356 DosExit(EXIT_PROCESS,1); 3481 3357 return 0; … … 3487 3363 3488 3364 case WM_SAVEAPPLICATION: 3489 if(dcd && 3490 ParentIsDesktop(hwnd,dcd->hwndParent)) { 3491 3365 if (dcd && 3366 ParentIsDesktop(hwnd,dcd->hwndParent)) { 3492 3367 SWP swp; 3493 3494 3368 WinQueryWindowPos(dcd->hwndFrame,&swp); 3495 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE | SWP_MAXIMIZE)))3369 if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE | SWP_MAXIMIZE))) 3496 3370 PrfWriteProfileData(fmprof, 3497 3371 appname, … … 3503 3377 3504 3378 case WM_CLOSE: 3505 WinSendMsg(hwnd, 3506 WM_SAVEAPPLICATION, 3507 MPVOID, 3508 MPVOID); 3509 if(dcd) 3379 WinSendMsg(hwnd,WM_SAVEAPPLICATION,MPVOID,MPVOID); 3380 if (dcd) 3510 3381 dcd->stopflag++; 3511 if(dcd && dcd->hwndObject) { 3512 if(!PostMsg(dcd->hwndObject, 3513 WM_CLOSE, 3514 MPVOID, 3515 MPVOID)) 3516 WinSendMsg(dcd->hwndObject, 3517 WM_CLOSE, 3518 MPVOID, 3519 MPVOID); 3382 if (dcd && dcd->hwndObject) { 3383 if (!PostMsg(dcd->hwndObject,WM_CLOSE,MPVOID,MPVOID)) 3384 WinSendMsg(dcd->hwndObject,WM_CLOSE,MPVOID,MPVOID); 3520 3385 } 3521 3386 dcd = WinQueryWindowPtr(hwnd,QWL_USER); 3522 if(!dcd || 3523 (!dcd->dontclose && 3524 !dcd->amextracted && 3525 ParentIsDesktop(hwnd,dcd->hwndParent))) { 3526 if(!PostMsg(hwnd, 3527 UM_FOLDUP, 3528 MPVOID, 3529 MPVOID)) 3530 WinSendMsg(hwnd, 3531 UM_FOLDUP, 3532 MPVOID, 3533 MPVOID); 3387 if (!dcd || 3388 (!dcd->dontclose && 3389 !dcd->amextracted && 3390 ParentIsDesktop(hwnd,dcd->hwndParent))) { 3391 if (!PostMsg(hwnd,UM_FOLDUP,MPVOID,MPVOID)) 3392 WinSendMsg(hwnd,UM_FOLDUP,MPVOID,MPVOID); 3534 3393 } 3535 3394 return 0; 3536 3395 3537 3396 case WM_DESTROY: 3538 if (ArcMenu)3397 if (ArcMenu) 3539 3398 WinDestroyWindow(ArcMenu); 3540 if (ArcCnrMenu)3399 if (ArcCnrMenu) 3541 3400 WinDestroyWindow(ArcCnrMenu); 3542 3401 ArcMenu = ArcCnrMenu = (HWND)0; … … 3569 3428 static USHORT idinc = 0; 3570 3429 3571 if (!idinc)3430 if (!idinc) 3572 3431 idinc = (rand() % 256); 3573 if (ParentIsDesktop(hwndParent,hwndParent))3432 if (ParentIsDesktop(hwndParent,hwndParent)) 3574 3433 FrameFlags |= (FCF_TASKLIST | FCF_MENU); 3575 if (arcname) {3434 if (arcname) { 3576 3435 DosError(FERR_DISABLEHARDERR); 3577 if (DosQueryPathInfo(arcname,3578 FIL_QUERYFULLNAME,3579 fullname,3580 sizeof(fullname)))3436 if (DosQueryPathInfo(arcname, 3437 FIL_QUERYFULLNAME, 3438 fullname, 3439 sizeof(fullname))) 3581 3440 strcpy(fullname,arcname); 3582 3441 p = fullname; 3583 3442 while(*p) { 3584 if (*p == '/')3443 if (*p == '/') 3585 3444 *p = '\\'; 3586 3445 p++; 3587 3446 } 3588 if (!info)3447 if (!info) 3589 3448 info = find_type(fullname, 3590 3449 arcsighead); 3591 if (!info)3450 if (!info) 3592 3451 return hwndFrame; 3593 3452 hwndFrame = WinCreateStdWindow(hwndParent, … … 3600 3459 ARC_FRAME, 3601 3460 &hwndClient); 3602 if (hwndFrame && hwndClient) {3461 if (hwndFrame && hwndClient) { 3603 3462 id = ARC_FRAME + idinc++; 3604 if (idinc > 512)3463 if (idinc > 512) 3605 3464 idinc = 0; 3606 3465 WinSetWindowUShort(hwndFrame,QWS_ID,id); … … 3615 3474 dcd->type = ARC_FRAME; 3616 3475 save_dir2(dcd->workdir); 3617 if (dcd->workdir[strlen(dcd->workdir) - 1] != '\\')3476 if (dcd->workdir[strlen(dcd->workdir) - 1] != '\\') 3618 3477 strcat(dcd->workdir,"\\"); 3619 3478 sprintf(dcd->workdir + strlen(dcd->workdir),"%s.%03x", 3620 3479 ArcTempRoot,(clock() & 4095)); 3621 3480 strcpy(dcd->arcname,fullname); 3622 if (*extractpath) {3623 if (!strcmp(extractpath,"*")) {3481 if (*extractpath) { 3482 if (!strcmp(extractpath,"*")) { 3624 3483 p = strrchr(fullname,'\\'); 3625 if (p) {3626 if (p < fullname + 3)3484 if (p) { 3485 if (p < fullname + 3) 3627 3486 p++; 3628 3487 temp = *p; … … 3635 3494 strcpy(dcd->directory,extractpath); 3636 3495 } 3637 if(!*dcd->directory && 3638 *lastextractpath) { 3496 if (!*dcd->directory && *lastextractpath) { 3639 3497 DosEnterCritSec(); 3640 3498 strcpy(dcd->directory,lastextractpath); 3641 3499 DosExitCritSec(); 3642 3500 } 3643 if (!*dcd->directory) {3644 if (!ParentIsDesktop(hwndParent,hwndParent))3501 if (!*dcd->directory) { 3502 if (!ParentIsDesktop(hwndParent,hwndParent)) 3645 3503 TopWindowName(hwndParent, 3646 3504 hwndCaller, 3647 3505 dcd->directory); 3648 if (!*dcd->directory) {3506 if (!*dcd->directory) { 3649 3507 p = strrchr(fullname,'\\'); 3650 if (p) {3651 if (p < fullname + 3)3508 if (p) { 3509 if (p < fullname + 3) 3652 3510 p++; 3653 3511 *p = 0; … … 3656 3514 } 3657 3515 } 3658 if (!*dcd->directory ||3659 IsFile(dcd->directory) ||3660 (isalpha(*dcd->directory) &&3661 (driveflags[toupper(*dcd->directory) - 'A'] & DRIVE_NOTWRITEABLE)))3516 if (!*dcd->directory || 3517 IsFile(dcd->directory) || 3518 (isalpha(*dcd->directory) && 3519 (driveflags[toupper(*dcd->directory) - 'A'] & DRIVE_NOTWRITEABLE))) 3662 3520 save_dir2(dcd->directory); 3663 3521 dcd->hwndParent = (hwndParent) ? hwndParent : … … 3740 3598 MPVOID); 3741 3599 WinSetWindowText(dcd->hwndExtract,dcd->directory); 3742 if (!PostMsg(dcd->hwndCnr,UM_SETUP,MPVOID,MPVOID))3600 if (!PostMsg(dcd->hwndCnr,UM_SETUP,MPVOID,MPVOID)) 3743 3601 WinSendMsg(dcd->hwndCnr,UM_SETUP,MPVOID,MPVOID); 3744 3602 if (FrameFlags & FCF_MENU) { … … 3746 3604 HWND hwndMenu = WinWindowFromID(hwndFrame,FID_MENU); 3747 3605 3748 if (hwndMenu) {3606 if (hwndMenu) { 3749 3607 WinSendMsg(hwndMenu,MM_DELETEITEM, 3750 3608 MPFROM2SHORT(IDM_VIEW,FALSE), … … 3784 3642 3785 3643 WinQueryTaskSizePos(WinQueryAnchorBlock(hwndFrame),0,&swp); 3786 if (PrfQueryProfileData(fmprof,3644 if (PrfQueryProfileData(fmprof, 3787 3645 appname, 3788 3646 "AV2SizePos", … … 3791 3649 cxScreen = WinQuerySysValue(HWND_DESKTOP,SV_CXSCREEN); 3792 3650 cyScreen = WinQuerySysValue(HWND_DESKTOP,SV_CYSCREEN); 3793 if (swp.x + swpD.cx > cxScreen)3651 if (swp.x + swpD.cx > cxScreen) 3794 3652 swp.x = cxScreen - swpD.cx; 3795 if (swp.y + swpD.cy > cyScreen)3653 if (swp.y + swpD.cy > cyScreen) 3796 3654 swp.y = cyScreen - swpD.cy; 3797 3655 swp.cx = swpD.cx;
Note:
See TracChangeset
for help on using the changeset viewer.