Changeset 924 for trunk/dll/select.c


Ignore:
Timestamp:
Jan 17, 2008, 1:40:52 AM (18 years ago)
Author:
Steven Levine
Message:

Avoid error reports for R/O FAT directories (ticket #116)
Change Config->Edit and Config->Palette menus to have no default
Move SpecialSelect to comp.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/select.c

    r907 r924  
    2828  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    2929  26 Aug 07 GKY DosSleep(1) in loops changed to (0)
     30  12 Jan 08 SHL Localize SpecialSelect in comp.c
    3031
    3132***********************************************************************/
     
    577578}
    578579
    579 /**
    580  * Do select actions for compare directories containers
    581  *
    582  */
    583 
    584 VOID SpecialSelect(HWND hwndCnrS, HWND hwndCnrD, INT action, BOOL reset)
    585 {
    586   PCNRITEM pciS, pciD, *pciSa = NULL, *pciDa = NULL;
    587   CNRINFO cnri;
    588   BOOL slow = FALSE;
    589   UINT x, numD, numS;
    590   INT ret = 0;
    591 
    592   if (!hwndCnrS || !hwndCnrD) {
    593     Runtime_Error(pszSrcFile, __LINE__, "hwndCnrS %p hwndCnrD %p", hwndCnrS, hwndCnrD);
    594     return;
    595   }
    596 
    597   memset(&cnri, 0, sizeof(CNRINFO));
    598   cnri.cb = sizeof(CNRINFO);
    599   WinSendMsg(hwndCnrD, CM_QUERYCNRINFO, MPFROMP(&cnri),
    600              MPFROMLONG(sizeof(CNRINFO)));
    601   numD = cnri.cRecords;
    602   memset(&cnri, 0, sizeof(CNRINFO));
    603   cnri.cb = sizeof(CNRINFO);
    604   WinSendMsg(hwndCnrS, CM_QUERYCNRINFO, MPFROMP(&cnri),
    605              MPFROMLONG(sizeof(CNRINFO)));
    606   numS = cnri.cRecords;
    607   if (!numD || numS != numD) {
    608     Runtime_Error(pszSrcFile, __LINE__, "numD %u != numS %u", numD, numS);
    609     return;
    610   }
    611   pciDa = xmalloc(sizeof(PCNRITEM) * numD, pszSrcFile, __LINE__);
    612   if (!pciDa)
    613     return;
    614 
    615   pciSa = xmalloc(sizeof(PCNRITEM) * numS, pszSrcFile, __LINE__);
    616   if (!pciSa) {
    617     free(pciDa);
    618     return;
    619   }
    620 
    621 Restart:
    622 
    623   memset(pciDa, 0, sizeof(PCNRITEM) * numD);
    624   memset(pciSa, 0, sizeof(PCNRITEM) * numS);
    625 
    626   pciD = (PCNRITEM)WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPVOID,
    627                                MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    628   x = 0;
    629   while (pciD && (INT)pciD != -1 && x < numD) {
    630     if (reset)
    631       pciD->flags = 0;
    632     pciDa[x] = pciD;
    633     x++;
    634     if (!slow)
    635       pciD = (PCNRITEM) pciD->rc.preccNextRecord;
    636     else
    637       pciD = (PCNRITEM) WinSendMsg(hwndCnrD, CM_QUERYRECORD, MPFROMP(pciD),
    638                                    MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    639     if (!(x % 500))
    640       DosSleep(0);  //26 Aug 07 GKY 1
    641     // else if (!(x % 50))
    642     //  DosSleep(0);
    643   } // while
    644 
    645   if (numD != x) {
    646     if (!slow) {
    647       slow = TRUE;
    648       goto Restart;
    649     }
    650     free(pciDa);
    651     free(pciSa);
    652     Runtime_Error(pszSrcFile, __LINE__, "numD %u != x %lu", numD, x);
    653     return;
    654   }
    655 
    656   pciS = (PCNRITEM) WinSendMsg(hwndCnrS, CM_QUERYRECORD, MPVOID,
    657                                MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    658   x = 0;
    659   while (pciS && (INT)pciS != -1 && x < numS) {
    660     if (reset)
    661       pciS->flags = 0;
    662     pciSa[x] = pciS;
    663     x++;
    664     if (!slow)
    665       pciS = (PCNRITEM) pciS->rc.preccNextRecord;
    666     else
    667       pciS = (PCNRITEM) WinSendMsg(hwndCnrS, CM_QUERYRECORD, MPFROMP(pciS),
    668                                    MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    669     if (!(x % 500))
    670       DosSleep(0);  //26 Aug 07 GKY 1
    671     // else if (!(x % 50))
    672     //  DosSleep(0);
    673   } // while
    674 
    675   if (numS != x) {
    676     if (!slow) {
    677       slow = TRUE;
    678       goto Restart;
    679     }
    680     free(pciSa);
    681     free(pciDa);
    682     Runtime_Error(pszSrcFile, __LINE__, "numS (%lu) != x (%lu)", numS, x);
    683     return;
    684   }
    685 
    686   // 05 Aug 07 SHL fixme to know what sets reset
    687   if (reset) {
    688     // Update flags for files that exist on both sides
    689     for (x = 0; x < numS; x++) {
    690 
    691       // 05 Aug 07 SHL fixme to know if should clear first
    692       if (!*pciSa[x]->pszFileName || !*pciDa[x]->pszFileName)
    693         continue;
    694 
    695       pciSa[x]->flags |= CNRITEM_EXISTS;        // File exists on both sides
    696       pciDa[x]->flags |= CNRITEM_EXISTS;
    697       if (pciSa[x]->cbFile + pciSa[x]->easize >
    698           pciDa[x]->cbFile + pciDa[x]->easize) {
    699         pciSa[x]->flags |= CNRITEM_LARGER;
    700         pciDa[x]->flags |= CNRITEM_SMALLER;
    701       }
    702       else if (pciSa[x]->cbFile + pciSa[x]->easize <
    703                pciDa[x]->cbFile + pciDa[x]->easize) {
    704         pciSa[x]->flags |= CNRITEM_SMALLER;
    705         pciDa[x]->flags |= CNRITEM_LARGER;
    706       }
    707       ret = TestCDates(&pciDa[x]->date, &pciDa[x]->time,
    708                        &pciSa[x]->date, &pciSa[x]->time);
    709       if (ret == 1)
    710         /*((pciSa[x]->date.year > pciDa[x]->date.year) ? TRUE :
    711           (pciSa[x]->date.year < pciDa[x]->date.year) ? FALSE :
    712           (pciSa[x]->date.month > pciDa[x]->date.month) ? TRUE :
    713           (pciSa[x]->date.month < pciDa[x]->date.month) ? FALSE :
    714           (pciSa[x]->date.day > pciDa[x]->date.day) ? TRUE :
    715           (pciSa[x]->date.day < pciDa[x]->date.day) ? FALSE :
    716           (pciSa[x]->time.hours > pciDa[x]->time.hours) ? TRUE :
    717           (pciSa[x]->time.hours < pciDa[x]->time.hours) ? FALSE :
    718           (pciSa[x]->time.minutes > pciDa[x]->time.minutes) ? TRUE :
    719           (pciSa[x]->time.minutes < pciDa[x]->time.minutes) ? FALSE :
    720           (pciSa[x]->time.seconds > pciDa[x]->time.seconds) ? TRUE :
    721           (pciSa[x]->time.seconds < pciDa[x]->time.seconds) ? FALSE : FALSE)*/ {
    722         pciSa[x]->flags |= CNRITEM_NEWER;
    723         pciDa[x]->flags |= CNRITEM_OLDER;
    724       }
    725       else if (ret == -1)
    726         /*((pciSa[x]->date.year < pciDa[x]->date.year) ? TRUE :
    727                (pciSa[x]->date.year > pciDa[x]->date.year) ? FALSE :
    728                (pciSa[x]->date.month < pciDa[x]->date.month) ? TRUE :
    729                (pciSa[x]->date.month > pciDa[x]->date.month) ? FALSE :
    730                (pciSa[x]->date.day < pciDa[x]->date.day) ? TRUE :
    731                (pciSa[x]->date.day > pciDa[x]->date.day) ? FALSE :
    732                (pciSa[x]->time.hours < pciDa[x]->time.hours) ? TRUE :
    733                (pciSa[x]->time.hours > pciDa[x]->time.hours) ? FALSE :
    734                (pciSa[x]->time.minutes < pciDa[x]->time.minutes) ? TRUE :
    735                (pciSa[x]->time.minutes > pciDa[x]->time.minutes) ? FALSE :
    736                (pciSa[x]->time.seconds < pciDa[x]->time.seconds) ? TRUE :
    737                (pciSa[x]->time.seconds > pciDa[x]->time.seconds) ? FALSE :
    738                FALSE)*/ {
    739         pciSa[x]->flags |= CNRITEM_OLDER;
    740         pciDa[x]->flags |= CNRITEM_NEWER;
    741       }
    742       if (!(x % 500))
    743         DosSleep(0); //26 Aug 07 GKY 1
    744       // else if (!(x % 50))
    745       //        DosSleep(0);
    746     } // for
    747   } // if reset
    748 
    749   switch (action) {
    750   case IDM_SELECTIDENTICAL:
    751     for (x = 0; x < numS; x++) {
    752       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
    753           pciSa[x]->flags & CNRITEM_EXISTS &&
    754           ~pciSa[x]->flags & CNRITEM_SMALLER &&
    755           ~pciSa[x]->flags & CNRITEM_LARGER &&
    756           ~pciSa[x]->flags & CNRITEM_NEWER &&
    757           ~pciSa[x]->flags & CNRITEM_OLDER) {
    758         if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    759           WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    760                      MPFROM2SHORT(TRUE, CRA_SELECTED));
    761         if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    762           WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    763                      MPFROM2SHORT(TRUE, CRA_SELECTED));
    764       }
    765       if (!(x % 500))
    766         DosSleep(0); //26 Aug 07 GKY 1
    767       // else if (!(x % 50))
    768       //        DosSleep(0);
    769     } // for
    770     break;
    771 
    772   case IDM_SELECTSAME:
    773     for (x = 0; x < numS; x++) {
    774       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
    775           pciSa[x]->flags & CNRITEM_EXISTS &&
    776           ~pciSa[x]->flags & CNRITEM_SMALLER &&
    777           ~pciSa[x]->flags & CNRITEM_LARGER) {
    778         if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    779           WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    780                      MPFROM2SHORT(TRUE, CRA_SELECTED));
    781         if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    782           WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    783                      MPFROM2SHORT(TRUE, CRA_SELECTED));
    784       }
    785       if (!(x % 500))
    786         DosSleep(0); //26 Aug 07 GKY 1
    787       // else if (!(x % 50))
    788       //        DosSleep(0);
    789     }
    790     break;
    791 
    792   case IDM_SELECTSAMECONTENT:
    793     for (x = 0; x < numS; x++) {
    794       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
    795           pciSa[x]->flags & CNRITEM_EXISTS)
    796       {
    797         FILE *fp1 = NULL;
    798         FILE *fp2 = NULL;
    799         BOOL gotMatch = FALSE;
    800         UINT errLineNo = 0;
    801         UINT compErrno = 0;
    802         CHAR buf1[1024];
    803         CHAR buf2[1024];
    804         HAB hab = WinQueryAnchorBlock(hwndCnrS);
    805 
    806         if (!*pciSa[x]->pszFileName ||
    807             !*pciDa[x]->pszFileName) {
    808           Runtime_Error(pszSrcFile, __LINE__,
    809                         "CNRITEM_EXISTS set with null file name for index %u", x);
    810           break;
    811         }
    812 
    813         fp1 = _fsopen(pciSa[x]->pszFileName, "rb", SH_DENYNO);
    814         if (!fp1) {
    815           errLineNo = __LINE__;
    816           compErrno = errno;
    817         }
    818         else {
    819           fp2 = _fsopen(pciDa[x]->pszFileName, "rb", SH_DENYNO);
    820           if (!fp2) {
    821             errLineNo = __LINE__;
    822             compErrno = errno;
    823           }
    824           else {
    825             size_t len1 = filelength(fileno(fp1));
    826             size_t len2 = filelength(fileno(fp2));
    827 
    828             if (len1 == len2) {
    829               setbuf(fp1, NULL);
    830               setbuf(fp2, NULL);
    831               while (WinIsWindow(hab, hwndCnrS)) {
    832                 size_t numread1 = fread(buf1, 1, 1024, fp1);
    833                 size_t numread2 = fread(buf2, 1, 1024, fp2);
    834 
    835                 if (!numread1 || !numread2 || numread1 != numread2) {
    836                   if (ferror(fp1) || ferror(fp2)) {
    837                     errLineNo = __LINE__;
    838                     compErrno = errno;
    839                   }
    840                   else if (feof(fp1) && feof(fp2))
    841                     gotMatch = TRUE;
    842                   break;
    843                 }
    844                 else if (memcmp(buf1, buf2, numread1))
    845                   break;
    846               } // while
    847             } // same len
    848           }
    849         }
    850 
    851         if (fp1)
    852           fclose(fp1);
    853 
    854         if (fp2)
    855           fclose(fp2);
    856 
    857         if (errLineNo) {
    858           Runtime_Error(pszSrcFile, errLineNo,
    859                         "error %d while comparing", compErrno);
    860         }
    861 
    862         if (gotMatch) {
    863           if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    864             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    865                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    866           if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    867             WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    868                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    869         }
    870       }
    871       if (!(x % 500))
    872         DosSleep(0); //26 Aug 07 GKY 1
    873       // else if (!(x % 50))
    874       //        DosSleep(0);
    875     } // for
    876     break;
    877 
    878   case IDM_SELECTBOTH:
    879     for (x = 0; x < numS; x++) {
    880       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
    881           pciSa[x]->flags & CNRITEM_EXISTS) {
    882         if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    883           WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    884                      MPFROM2SHORT(TRUE, CRA_SELECTED));
    885         if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    886           WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    887                      MPFROM2SHORT(TRUE, CRA_SELECTED));
    888       }
    889       if (!(x % 500))
    890         DosSleep(0); //26 Aug 07 GKY 1
    891       // else if (!(x % 50))
    892       //        DosSleep(0);
    893     }
    894     break;
    895 
    896   case IDM_SELECTONE:
    897     for (x = 0; x < numS; x++) {
    898       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
    899           ~pciSa[x]->flags & CNRITEM_EXISTS) {
    900         if (*pciSa[x]->pszFileName) {
    901           if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED) {
    902             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    903                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    904           }
    905         }
    906         else if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED) {
    907           WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    908                      MPFROM2SHORT(TRUE, CRA_SELECTED));
    909         }
    910       }
    911       if (!(x % 500))
    912         DosSleep(0);  //26 Aug 07 GKY 1
    913       // else if (!(x % 50))
    914       //        DosSleep(0);
    915     }
    916     break;
    917 
    918   case IDM_SELECTBIGGER:
    919     for (x = 0; x < numS; x++) {
    920       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
    921         if (pciSa[x]->flags & CNRITEM_LARGER) {
    922           if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    923             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    924                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    925         }
    926         else if (pciDa[x]->flags & CNRITEM_LARGER) {
    927           if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    928             WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    929                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    930         }
    931       }
    932       if (!(x % 500))
    933         DosSleep(0); //26 Aug 07 GKY 1
    934       // else if (!(x % 50))
    935       //        DosSleep(0);
    936     }
    937     break;
    938 
    939   case IDM_SELECTSMALLER:
    940     for (x = 0; x < numS; x++) {
    941       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
    942         if (pciSa[x]->flags & CNRITEM_SMALLER) {
    943           if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    944             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    945                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    946         }
    947         else if (pciDa[x]->flags & CNRITEM_SMALLER) {
    948           if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    949             WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    950                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    951         }
    952       }
    953       if (!(x % 500))
    954         DosSleep(0); //26 Aug 07 GKY 1
    955       // else if (!(x % 50))
    956       //        DosSleep(0);
    957     }
    958     break;
    959 
    960   case IDM_SELECTNEWER:
    961     for (x = 0; x < numS; x++) {
    962       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
    963         if (pciSa[x]->flags & CNRITEM_NEWER) {
    964           if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    965             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    966                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    967         }
    968         else if (pciDa[x]->flags & CNRITEM_NEWER) {
    969           if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    970             WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    971                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    972         }
    973       }
    974       if (!(x % 500))
    975         DosSleep(0); //26 Aug 07 GKY 1
    976       // else if (!(x % 50))
    977       //        DosSleep(0);
    978     }
    979     break;
    980 
    981   case IDM_SELECTOLDER:
    982     for (x = 0; x < numS; x++) {
    983       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
    984         if (pciSa[x]->flags & CNRITEM_OLDER) {
    985           if (~pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    986             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    987                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    988         }
    989         else if (pciDa[x]->flags & CNRITEM_OLDER) {
    990           if (~pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    991             WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    992                        MPFROM2SHORT(TRUE, CRA_SELECTED));
    993         }
    994       }
    995       if (!(x % 500))
    996         DosSleep(0); //26 Aug 07 GKY 1
    997       // else if (!(x % 50))
    998       //        DosSleep(0);
    999     }
    1000     break;
    1001 
    1002   case IDM_DESELECTBOTH:
    1003     for (x = 0; x < numS; x++) {
    1004       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED &&
    1005           pciSa[x]->flags & CNRITEM_EXISTS) {
    1006         if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    1007           WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    1008                      MPFROM2SHORT(FALSE, CRA_SELECTED));
    1009         if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    1010           WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    1011                      MPFROM2SHORT(FALSE, CRA_SELECTED));
    1012       }
    1013       if (!(x % 500))
    1014         DosSleep(0); //26 Aug 07 GKY 1
    1015       // else if (!(x % 50))
    1016       //        DosSleep(0);
    1017     }
    1018     break;
    1019 
    1020   case IDM_DESELECTONE:
    1021     for (x = 0; x < numS; x++) {
    1022       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
    1023         if (~pciSa[x]->flags & CNRITEM_EXISTS) {
    1024         if (*pciSa[x]->pszFileName) {
    1025           if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    1026             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    1027                        MPFROM2SHORT(FALSE, CRA_SELECTED));
    1028         }
    1029         else if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    1030             WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    1031                        MPFROM2SHORT(FALSE, CRA_SELECTED));
    1032         }
    1033       }
    1034       if (!(x % 500))
    1035         DosSleep(0); //26 Aug 07 GKY 1
    1036       // else if (!(x % 50))
    1037       //        DosSleep(0);
    1038     }
    1039     break;
    1040 
    1041   case IDM_DESELECTBIGGER:
    1042     for (x = 0; x < numS; x++) {
    1043       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
    1044         if (pciSa[x]->flags & CNRITEM_LARGER) {
    1045           if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    1046             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    1047                        MPFROM2SHORT(FALSE, CRA_SELECTED));
    1048         }
    1049         else if (pciDa[x]->flags & CNRITEM_LARGER) {
    1050           if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    1051             WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    1052                        MPFROM2SHORT(FALSE, CRA_SELECTED));
    1053         }
    1054       }
    1055       if (!(x % 500))
    1056         DosSleep(0); //26 Aug 07 GKY 1
    1057       // else if (!(x % 50))
    1058       //        DosSleep(0);
    1059     }
    1060     break;
    1061 
    1062   case IDM_DESELECTSMALLER:
    1063     for (x = 0; x < numS; x++) {
    1064       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
    1065         if (pciSa[x]->flags & CNRITEM_SMALLER) {
    1066           if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    1067             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    1068                        MPFROM2SHORT(FALSE, CRA_SELECTED));
    1069         }
    1070         else if (pciDa[x]->flags & CNRITEM_SMALLER) {
    1071           if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    1072             WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    1073                        MPFROM2SHORT(FALSE, CRA_SELECTED));
    1074         }
    1075       }
    1076       if (!(x % 500))
    1077         DosSleep(0); //26 Aug 07 GKY 1
    1078       // else if (!(x % 50))
    1079       //        DosSleep(0);
    1080     }
    1081     break;
    1082 
    1083   case IDM_DESELECTNEWER:
    1084     for (x = 0; x < numS; x++) {
    1085       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
    1086         if (pciSa[x]->flags & CNRITEM_NEWER) {
    1087           if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    1088             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    1089                        MPFROM2SHORT(FALSE, CRA_SELECTED));
    1090         }
    1091         else if (pciDa[x]->flags & CNRITEM_NEWER) {
    1092           if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    1093             WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    1094                        MPFROM2SHORT(FALSE, CRA_SELECTED));
    1095         }
    1096       }
    1097       if (!(x % 500))
    1098         DosSleep(0); //26 Aug 07 GKY 1
    1099       // else if (!(x % 50))
    1100       //        DosSleep(0);
    1101     }
    1102     break;
    1103 
    1104   case IDM_DESELECTOLDER:
    1105     for (x = 0; x < numS; x++) {
    1106       if (~pciSa[x]->rc.flRecordAttr & CRA_FILTERED) {
    1107         if (pciSa[x]->flags & CNRITEM_OLDER) {
    1108           if (pciSa[x]->rc.flRecordAttr & CRA_SELECTED)
    1109             WinSendMsg(hwndCnrS, CM_SETRECORDEMPHASIS, MPFROMP(pciSa[x]),
    1110                        MPFROM2SHORT(FALSE, CRA_SELECTED));
    1111         }
    1112         else if (pciDa[x]->flags & CNRITEM_OLDER) {
    1113           if (pciDa[x]->rc.flRecordAttr & CRA_SELECTED)
    1114             WinSendMsg(hwndCnrD, CM_SETRECORDEMPHASIS, MPFROMP(pciDa[x]),
    1115                        MPFROM2SHORT(FALSE, CRA_SELECTED));
    1116         }
    1117       }
    1118       if (!(x % 500))
    1119         DosSleep(0); //26 Aug 07 GKY 1
    1120       // else if (!(x % 50))
    1121       //        DosSleep(0);
    1122     }
    1123     break;
    1124 
    1125   default:
    1126     break;
    1127   }
    1128 
    1129   if (reset) {
    1130     while (numS) {
    1131       WinSendMsg(hwndCnrS, CM_INVALIDATERECORD,
    1132                  MPFROMP(pciSa), MPFROM2SHORT((min(numS, 65535)), 0));
    1133       DosSleep(0); //26 Aug 07 GKY 1
    1134       WinSendMsg(hwndCnrD, CM_INVALIDATERECORD,
    1135                  MPFROMP(pciDa), MPFROM2SHORT((min(numD, 65535)), 0));
    1136       numS -= min(numS, 65535);
    1137       if (numS)
    1138         DosSleep(0); //26 Aug 07 GKY 1
    1139     }
    1140   }
    1141 
    1142   free(pciSa);
    1143   free(pciDa);
    1144   DosPostEventSem(CompactSem);
    1145 }
    1146 
    1147580struct SS
    1148581{
     
    1286719              Cnrs[z].ss[x].largest = FALSE;
    1287720            cmp = TestCDates(&bsres->pci->date, &bsres->pci->time,
    1288                              &Cnrs[z].ss[x].pci->date, &Cnrs[z].ss[x].pci->time);
     721                             &Cnrs[z].ss[x].pci->date, &Cnrs[z].ss[x].pci->time);
    1289722              /*(Cnrs[z].ss[x].pci->date.year >
    1290723               bsres->pci->date.year) ? TRUE : (Cnrs[z].ss[x].pci->date.year <
     
    1539972#pragma alloc_text(SELECT,SelectList)
    1540973#pragma alloc_text(SELECT1,Deselect,HideAll,RemoveAll,ExpandAll,InvertAll)
    1541 #pragma alloc_text(SELECT3,SpecialSelect)
    1542974#pragma alloc_text(SELECT4,FreeCnrs,SpecialSelect2,CompSSNames,CompSSNamesB)
Note: See TracChangeset for help on using the changeset viewer.