Changeset 618 for trunk/dll/treecnr.c


Ignore:
Timestamp:
Apr 20, 2007, 9:19:03 PM (18 years ago)
Author:
Steven Levine
Message:

Add more drag/drop error checking
Use FreeDragInfoData
Sync with NumItemsToUnhilite AcceptOneDrop GetOneDrop mods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/treecnr.c

    r606 r618  
    2828  06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
    2929  06 Apr 07 GKY Add some error checking in drag/drop
     30  19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods
     31  19 Apr 07 SHL Add more drag/drop error checking
    3032
    3133***********************************************************************/
     
    99101      EmphasizeButton(hwnd, emphasized);
    100102    }
    101     if (AcceptOneDrop(mp1, mp2))
     103    if (AcceptOneDrop(hwnd, mp1, mp2))
    102104      return MRFROM2SHORT(DOR_DROP, DO_MOVE);
    103105    return MRFROM2SHORT(DOR_NEVERDROP, 0);
     
    122124        EmphasizeButton(hwnd, emphasized);
    123125      }
    124       if (GetOneDrop(mp1, mp2, szFrom, sizeof(szFrom))) {
     126      if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
    125127        MakeValidDir(szFrom);
    126128        WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
     
    544546      cni.pDragInfo = (PDRAGINFO) mp1;
    545547      li = DoFileDrop(dcd->hwndCnr,
    546                       dcd->directory, FALSE, MPVOID, MPFROMP(&cni));
    547       if (fExceedPMDrgLimit)
    548         saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
    549                              hwnd,
    550                              GetPString(IDS_ERRORTEXT),
    551                    GetPString(IDS_EXCEEDPMDRGLMT));
     548                      dcd->directory, FALSE, MPVOID, MPFROMP(&cni));
     549      if (NumItemsToUnhilite)
     550        saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
     551                             hwnd,
     552                             GetPString(IDS_ERRORTEXT),
     553                   GetPString(IDS_EXCEEDPMDRGLMT));
    552554      if (li) {
    553555        li->type = ((fDefaultDeletePerm) ? IDM_PERMDELETE : IDM_DELETE);
     
    12541256          PDRAGINFO pDInfo;
    12551257
     1258          // fixme to know why - seems superfluous
    12561259          pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
    12571260          DrgAccessDraginfo(pDInfo);
     
    12701273
    12711274          pDInfo = ((PCNRDRAGINFO) mp2)->pDragInfo;
    1272           DrgAccessDraginfo(pDInfo);
     1275          if (!DrgAccessDraginfo(pDInfo)) {
     1276            Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
     1277                      "DrgAccessDraginfo");
     1278            return (MRFROM2SHORT(DOR_NODROP, 0));       /* Drop not valid */
     1279          }
    12731280          pci = (PCNRITEM) ((PCNRDRAGINFO) mp2)->pRecord;
    12741281          if ((INT) pci == -1)
    12751282            pci = NULL;
    12761283          if (pci && (pci->flags & (RECFLAGS_ENV | RECFLAGS_NODROP))) {
    1277             DrgFreeDraginfo(pDInfo);
    1278             return MRFROM2SHORT(DOR_NODROP, 0);
    1279           }
    1280           if (!pDInfo) {
    12811284            DrgFreeDraginfo(pDInfo);
    12821285            return MRFROM2SHORT(DOR_NODROP, 0);
     
    13151318            }
    13161319          }
    1317           pDItem = DrgQueryDragitemPtr(pDInfo,  /* Access DRAGITEM       */
    1318                                        0);      /* Index to DRAGITEM     */
     1320          pDItem = DrgQueryDragitemPtr(pDInfo,  /* Access DRAGITEM */
     1321                                       0);      /* Index to DRAGITEM */
    13191322          if (DrgVerifyRMF(pDItem,      /* Check valid rendering */
    1320                            DRM_OS2FILE, /* mechanisms and data   */
    1321                            NULL) || DrgVerifyRMF(pDItem, DRM_FM2ARCMEMBER, DRF_FM2ARCHIVE)) {   /* formats               */
    1322             DrgFreeDraginfo(pDInfo);    /* Free DRAGINFO         */
     1323                           DRM_OS2FILE, /* mechanisms and data */
     1324                           NULL) || DrgVerifyRMF(pDItem, DRM_FM2ARCMEMBER, DRF_FM2ARCHIVE)) {   /* formats */
     1325            DrgFreeDraginfo(pDInfo);    /* Free DRAGINFO */
    13231326            if (!pci || (INT) pci == -1)
    13241327              return MRFROM2SHORT(DOR_DROP, DO_MOVE);
     
    13281331            if (toupper(*pci->szFileName) < 'C')
    13291332              return MRFROM2SHORT(DOR_DROP, DO_COPY);
    1330             return MRFROM2SHORT(DOR_DROP,       /* Return okay to drop   */
     1333            return MRFROM2SHORT(DOR_DROP,       /* Return okay to drop */
    13311334                                ((fCopyDefault) ? DO_COPY : DO_MOVE));
    13321335          }
    1333           DrgFreeDraginfo(pDInfo);      /* Free DRAGINFO         */
    1334         }
    1335         return MRFROM2SHORT(DOR_NODROP, 0);     /* Drop not valid        */
     1336          DrgFreeDraginfo(pDInfo);      /* Free DRAGINFO */
     1337        }
     1338        return MRFROM2SHORT(DOR_NODROP, 0);     /* Drop not valid */
    13361339
    13371340      case CN_INITDRAG:
     
    13741377          ULONG action = UM_ACTION;
    13751378
    1376           li = DoFileDrop(hwnd, NULL, TRUE, mp1, mp2);
    1377           if (fExceedPMDrgLimit)
    1378             saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
    1379                                 hwnd,
    1380                                 GetPString(IDS_ERRORTEXT),
    1381                        GetPString(IDS_EXCEEDPMDRGLMT));
     1379          li = DoFileDrop(hwnd, NULL, TRUE, mp1, mp2);
     1380          if (NumItemsToUnhilite)
     1381            saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
     1382                                hwnd,
     1383                                GetPString(IDS_ERRORTEXT),
     1384                       GetPString(IDS_EXCEEDPMDRGLMT));
    13821385          if (li) {
    13831386            if (!*li->targetpath) {
     
    14021405                                   dcd->hwndParent,
    14031406                                   DropListProc,
    1404                                    FM3ModHandle, DND_FRAME, MPFROMP(&cl));
    1405               if (li->type == DID_ERROR)
    1406                   Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,
    1407                             "Drag & Drop Dialog");
    1408               if (!li->type) {
     1407                                   FM3ModHandle, DND_FRAME, MPFROMP(&cl));
     1408              if (li->type == DID_ERROR)
     1409                  Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__,
     1410                            "Drag & Drop Dialog");
     1411              if (!li->type) {
    14091412                FreeListInfo(li);
    14101413                return 0;
    14111414              }
    14121415              li->list = cl.list;
    1413               if (!li->list || !li->list[0]) {
     1416              if (!li->list || !li->list[0]) {
    14141417                FreeListInfo(li);
    14151418                return 0;
     
    17981801              if (drvtype & DRIVE_REMOTE)
    17991802                driveflags[x] |= DRIVE_REMOTE;
    1800               if (!strcmp(FileSystem, CBSIFS)) {
     1803              if (!strcmp(FileSystem, CBSIFS)) {
    18011804                driveflags[x] |= DRIVE_ZIPSTREAM;
    1802                 driveflags[x] &= (~DRIVE_REMOTE);
    1803               }
    1804               if(!strcmp(FileSystem,NDFS32)) {
    1805                 driveflags[x] |= DRIVE_VIRTUAL;
    1806                 driveflags[x] &= (~DRIVE_REMOTE);
    1807               }
    1808               if(!strcmp(FileSystem,RAMFS)) {
    1809                 driveflags[x] |= DRIVE_RAMDISK;
    1810                 driveflags[x] &= (~DRIVE_REMOTE);
    1811               }
     1805                driveflags[x] &= (~DRIVE_REMOTE);
     1806              }
     1807              if(!strcmp(FileSystem,NDFS32)) {
     1808                driveflags[x] |= DRIVE_VIRTUAL;
     1809                driveflags[x] &= (~DRIVE_REMOTE);
     1810              }
     1811              if(!strcmp(FileSystem,RAMFS)) {
     1812                driveflags[x] |= DRIVE_RAMDISK;
     1813                driveflags[x] &= (~DRIVE_REMOTE);
     1814              }
    18121815              if (!strcmp(FileSystem, CDFS) || !strcmp(FileSystem, ISOFS))
    18131816                driveflags[x] |= (DRIVE_REMOVABLE |
    1814                                   DRIVE_NOTWRITEABLE | DRIVE_CDROM);
    1815               if(!strcmp(FileSystem,NTFS))
    1816                 driveflags[x] |= DRIVE_NOTWRITEABLE;
     1817                                  DRIVE_NOTWRITEABLE | DRIVE_CDROM);
     1818              if(!strcmp(FileSystem,NTFS))
     1819                driveflags[x] |= DRIVE_NOTWRITEABLE;
    18171820              if (strcmp(FileSystem, HPFS) &&
    18181821                  strcmp(FileSystem, JFS) &&
    18191822                  strcmp(FileSystem, CDFS) &&
    1820                   strcmp(FileSystem, ISOFS) &&
    1821                   strcmp(FileSystem, RAMFS) &&
     1823                  strcmp(FileSystem, ISOFS) &&
     1824                  strcmp(FileSystem, RAMFS) &&
    18221825                  strcmp(FileSystem, FAT32) &&
    1823                   strcmp(FileSystem, NDFS32) &&
    1824                   strcmp(FileSystem, NTFS) &&
    1825                   strcmp(FileSystem, HPFS386)) {
     1826                  strcmp(FileSystem, NDFS32) &&
     1827                  strcmp(FileSystem, NTFS) &&
     1828                  strcmp(FileSystem, HPFS386)) {
    18261829                driveflags[x] |= DRIVE_NOLONGNAMES;
    1827               }
    1828               SelectDriveIcon(pciP);
     1830              }
     1831              SelectDriveIcon(pciP);
    18291832              WinSendMsg(hwnd,
    18301833                         CM_INVALIDATERECORD,
     
    25632566              // Check if drive type might need update
    25642567              if ((driveflag & (DRIVE_INVALID | DRIVE_NOPRESCAN)) ||
    2565                   (~driveflag & DRIVE_NOPRESCAN && pci->rc.hptrIcon == hptrDunno))
     2568                  (~driveflag & DRIVE_NOPRESCAN && pci->rc.hptrIcon == hptrDunno))
    25662569              {
    25672570                driveflags[toupper(*pci->szFileName) - 'A'] &=
     
    25692572                   DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | DRIVE_NOSTATS);
    25702573                DriveFlagsOne(toupper(*pci->szFileName) - 'A');
    2571                 driveflag = driveflags[toupper(*pci->szFileName) - 'A'];
     2574                driveflag = driveflags[toupper(*pci->szFileName) - 'A'];
    25722575                if (driveflag & DRIVE_INVALID)
    25732576                  pci->rc.hptrIcon = hptrDunno;
    25742577                else {
    2575                   SelectDriveIcon(pci);
     2578                  SelectDriveIcon(pci);
    25762579                }
    25772580                WinSendMsg(hwnd,
Note: See TracChangeset for help on using the changeset viewer.