Changeset 618 for trunk/dll/mainwnd.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/mainwnd.c

    r606 r618  
    3030  06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits
    3131  06 Apr 07 GKY Add some error checking in drag/drop
     32  15 Apr 07 SHL mainwnd MAIN_SETUPLIST restore state not found reporting
     33  19 Apr 07 SHL Sync with AcceptOneDrop GetOneDrop mods
     34  20 Apr 07 SHL Avoid spurious add_udir error reports
    3235
    3336***********************************************************************/
     
    3538#define INCL_DOS
    3639#define INCL_WIN
     40// #define INCL_WINERRORS
     41#define INCL_SHLERRORS
    3742#define INCL_WINHELP
    3843#define INCL_GPI
     
    628633        DrawTargetEmphasis(hwnd, emphasized);
    629634      }
    630       if (AcceptOneDrop(mp1, mp2))
     635      if (AcceptOneDrop(hwnd, mp1, mp2))
    631636        return MRFROM2SHORT(DOR_DROP, DO_MOVE);
    632637      return MRFROM2SHORT(DOR_NEVERDROP, 0);
     
    662667        DrawTargetEmphasis(hwnd, emphasized);
    663668      }
    664       if (GetOneDrop(mp1, mp2, szFrom, sizeof(szFrom))) {
     669      if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
    665670        MakeValidDir(szFrom);
    666671        WinSetWindowText(hwnd, szFrom);
     
    12331238      cdi.pDragInfo = mp1;
    12341239      li = DoFileDrop(hwnd, NULL, FALSE, mp1, MPFROMP(&cdi));
    1235       if (fExceedPMDrgLimit)
     1240      if (NumItemsToUnhilite)
    12361241        saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
    12371242                             hwnd,
     
    17521757        DrawTargetEmphasis(hwnd, emphasized);
    17531758      }
    1754       if (AcceptOneDrop(mp1, mp2))
     1759      if (AcceptOneDrop(hwnd, mp1, mp2))
    17551760        return MRFROM2SHORT(DOR_DROP, DO_MOVE);
    17561761      return MRFROM2SHORT(DOR_NEVERDROP, 0);
     
    18061811                      NULL,
    18071812                      TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd));
    1808       if (fExceedPMDrgLimit)
     1813      if (NumItemsToUnhilite)
    18091814        saymsg(MB_CANCEL | MB_ICONEXCLAMATION,
    18101815                             hwnd,
     
    34563461        DrawTargetEmphasis(hwnd, emphasized);
    34573462      }
    3458       if (AcceptOneDrop(mp1, mp2))
     3463      if (AcceptOneDrop(hwnd, mp1, mp2))
    34593464        return MRFROM2SHORT(DOR_DROP, DO_MOVE);
    34603465    }
     
    34803485        DrawTargetEmphasis(hwnd, emphasized);
    34813486      }
    3482       if (GetOneDrop(mp1, mp2, szFrom, sizeof(szFrom))) {
     3487      if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
    34833488        if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) {
    34843489          OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom);
     
    41514156          !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) {
    41524157        if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {
    4153           if (!add_udir(TRUE, path))
    4154             Runtime_Error(pszSrcFile, __LINE__, "add_udir");
    4155           else {
    4156             if (fUdirsChanged)
    4157               save_udirs();
    4158             WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
    4159           }
     4158          add_udir(TRUE, path);
     4159          if (fUdirsChanged)
     4160            save_udirs();
     4161          WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
    41604162        }
    41614163        else {
     
    41804182      WinQueryWindowText(hwndStatelist, 13, szStateName);
    41814183      bstrip(szStateName);
    4182       if (*szStateName) {
     4184      // Ignore request if blank or attempting to using illegal name
     4185      if (*szStateName && stricmp(szStateName, GetPString(IDS_STATETEXT))) {
    41834186        if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {
    41844187          // Save
     
    41894192              save_setups();
    41904193            }
     4194            else {
     4195              saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
     4196                     GetPString(IDS_WARNINGTEXT),
     4197                     GetPString(IDS_EXISTSASATEXT), szStateName, "state name");
     4198              WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
     4199            }
    41914200          }
    4192           WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
     4201          else {
     4202            saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
     4203                   GetPString(IDS_WARNINGTEXT),
     4204                   "\"%s\" state save failed", szStateName);    // 15 Apr 07 SHL failed
     4205            WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
     4206          }
    41934207        }
    41944208        else {
     
    53075321                         (CHAR *) mp1);
    53085322      if (add_udir(FALSE, (CHAR *) mp1)) {
    5309         if (fUserComboBox) {
    5310           if (fAutoAddDirs)
    5311             WinSendMsg(hwndUserlist, LM_INSERTITEM,
    5312                        MPFROM2SHORT(LIT_SORTASCENDING, 0),
    5313                        MPFROMP((CHAR *) mp1));
     5323        if (fUserComboBox && fAutoAddDirs) {
     5324          WinSendMsg(hwndUserlist, LM_INSERTITEM,
     5325                     MPFROM2SHORT(LIT_SORTASCENDING, 0),
     5326                     MPFROMP((CHAR *) mp1));
    53145327        }
    53155328      }
     
    54345447    WinSendMsg(hwndStatelist, LM_DELETEALL, MPVOID, MPVOID);
    54355448    if (fUserComboBox) {
    5436 
    54375449      INT x;
    54385450
     
    57045716              SetShiftState();
    57055717              size = sizeof(ULONG);
    5706               sprintf(s, "%s.NumDirsLastTime", path);
     5718              sprintf(s, "%s.NumDirsLastTime", path);   // path is state name
    57075719              if (!PrfQueryProfileData
    57085720                  (fmprof, FM3Str, s, (PVOID) & numsaves, &size))
    5709                 Win_Error2(hwnd, hwnd, __FILE__, __LINE__,
    5710                            IDS_PRFQUERYPROFILEDATA);
     5721              {
     5722                if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) {
     5723                  saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
     5724                         GetPString(IDS_WARNINGTEXT),
     5725                         GetPString(IDS_DOESNTEXISTTEXT), path);
     5726                }
     5727                else {
     5728                  Win_Error2(hwnd, hwnd, __FILE__, __LINE__,
     5729                             IDS_PRFQUERYPROFILEDATA);
     5730                }
     5731              }
    57115732              else if (!numsaves)
    57125733                Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     
    57305751                }
    57315752              }
    5732               WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
     5753              // fixme to hold restored state name for a while
     5754              // WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));    // 15 Apr 07 SHL
    57335755            }
    57345756            else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
Note: See TracChangeset for help on using the changeset viewer.