Changeset 1844 for trunk/dll/mainwnd.c


Ignore:
Timestamp:
Aug 12, 2015, 7:37:37 AM (10 years ago)
Author:
Steven Levine
Message:

Add RESTORE_STATE_... definitions and use

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/mainwnd.c

    r1838 r1844  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2013 Steven H. Levine
     9  Copyright (c) 2001, 2015 Steven H. Levine
    1010
    1111  11 Jun 02 SHL Drop obsolete xor code
     
    100100  14 Sep 09 SHL Blink thread LEDs when workers busy
    101101  13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
    102                 profile calls for user settings that work and are setable in more than one
    103                 miniapp; FM3Str should be used for setting only relavent to FM/2 or that
    104                 aren't user settable; realappname should be used for setting applicable to
    105                 one or more miniapp but not to FM/2
     102                profile calls for user settings that work and are setable in more than one
     103                miniapp; FM3Str should be used for setting only relavent to FM/2 or that
     104                aren't user settable; realappname should be used for setting applicable to
     105                one or more miniapp but not to FM/2
    106106  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast
    107                 CHAR CONSTANT * as CHAR *.
     107                CHAR CONSTANT * as CHAR *.
    108108  11 Apr 10 GKY Fix drive tree rescan failure and program hang caused by event sem
    109                 never being posted
     109                never being posted
    110110  23 Oct 10 GKY Changes to populate and utilize a HELPTABLE for context specific help
    111111  03 Oct 11 SHL Add needTile to ensure containers opened on command line render correctly
     
    114114  12 Aug 12 GKY Allow for selection of include subdirectories or a list file on initial startup of compare dirs
    115115  30 Dec 12 GKY Enhance traget directory drop to give the option of changing the directory or carrying out an
    116                 operation to the current target; Added an error message for target = None;
     116                operation to the current target; Added an error message for target = None;
    117117  02 Aug 15 GKY Remove unneed SubbyScan code and improve suppression of blank lines and
    118                 duplicate subdirectory name caused by running Stubby in worker threads.
     118                duplicate subdirectory name caused by running Stubby in worker threads.
     119  09 Aug 15 SHL Use RESTORE_STATE_...
    119120
    120121***********************************************************************/
     
    340341        WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID);
    341342      }
    342       PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1));
     343      PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(RESTORE_STATE_TILE_CHILDREN));
    343344    }
    344345    return 0;
     
    346347  case UM_RESTORE:
    347348    switch ((ULONG)mp2) {
    348     case 1:
     349    case RESTORE_STATE_TILE_CHILDREN:
    349350      TileChildren(hwndMain, TRUE);
    350351      break;
    351     case 2:
     352    case RESTORE_STATE_CLOSE_CHILDREN:
    352353      CloseDirCnrChildren(hwndMain);
    353354      break;
    354     case 0:
     355    case RESTORE_STATE_RESTORE:
    355356      fNoTileUpdate = TRUE;
    356357      WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), FALSE);
    357       RestoreDirCnrState(hwndMain, (char *)mp1, FALSE);
     358      RestoreDirCnrState(hwndMain, (CHAR *)mp1, FALSE);
    358359      WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), TRUE);
    359360      fNoTileUpdate = FALSE; ;
     
    18191820MRESULT EXPENTRY DriveBackProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
    18201821{
    1821     static BOOL emphasized = FALSE;
     1822  APIRET rc;
     1823
     1824  static BOOL emphasized;
    18221825
    18231826  switch (msg) {
     
    18831886      cnd.pDragInfo = (PDRAGINFO) mp1;
    18841887      if (!DrgAccessDraginfo((PDRAGINFO) cnd.pDragInfo)) {
    1885         Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
    1886                   PCSZ_DRGACCESSDRAGINFO);
    1887         return 0;
     1888        Win_Error(hwnd, hwnd, pszSrcFile, __LINE__,
     1889                  PCSZ_DRGACCESSDRAGINFO);
     1890        return 0;
    18881891      }
    18891892      numitems = DrgQueryDragitemCount((PDRAGINFO) cnd.pDragInfo);
    18901893      usOperation = cnd.pDragInfo->usOperation;
    18911894      if (usOperation == DO_DEFAULT)
    1892         usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
     1895        usOperation = fCopyDefault ? DO_COPY : DO_MOVE;
    18931896      saymsg(MB_ENTER | MB_ICONASTERISK,
    1894              hwnd,
    1895              GetPString(IDS_DROPHELPHDRTEXT),
    1896              GetPString(IDS_DROPHELPTEXT),
    1897              numitems,
    1898              &"s"[numitems == 1L],
    1899              NullStr,
    1900              NullStr,
    1901              targetdir,
    1902              " ",
    1903              GetPString((usOperation == DO_MOVE) ?
    1904                         IDS_MOVETEXT :
    1905                         (usOperation == DO_LINK) ?
    1906                         IDS_LINKTEXT : IDS_COPYTEXT));
     1897             hwnd,
     1898             GetPString(IDS_DROPHELPHDRTEXT),
     1899             GetPString(IDS_DROPHELPTEXT),
     1900             numitems,
     1901             &"s"[numitems == 1L],
     1902             NullStr,
     1903             NullStr,
     1904             targetdir,
     1905             " ",
     1906             GetPString((usOperation == DO_MOVE) ?
     1907                        IDS_MOVETEXT :
     1908                        (usOperation == DO_LINK) ?
     1909                        IDS_LINKTEXT : IDS_COPYTEXT));
    19071910    }
    19081911    return 0;
     
    19271930      CheckPmDrgLimit(cnd.pDragInfo);
    19281931      if (li) {
    1929         if (!li->list[1] && !IsFile(li->list[0])) {
    1930           ret = saymsg(MB_YESNO,
     1932        if (!li->list[1] && !IsFile(li->list[0])) {
     1933          ret = saymsg(MB_YESNO,
    19311934                   HWND_DESKTOP,
    1932                        NullStr,
    1933                        GetPString(IDS_DROPSETSTARGET));
    1934           if (ret == MBID_YES) {
    1935             SetTargetDir(hwnd, TRUE, li->list[0]);
    1936             break;
    1937           }
    1938         }
     1935                       NullStr,
     1936                       GetPString(IDS_DROPSETSTARGET));
     1937          if (ret == MBID_YES) {
     1938            SetTargetDir(hwnd, TRUE, li->list[0]);
     1939            break;
     1940          }
     1941        }
    19391942        strcpy(li->targetpath, targetdir);
    19401943        strcat(li->targetpath, PCSZ_BACKSLASH);
     
    20542057          FreeListInfo(li);
    20552058        else
    2056           WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));
     2059          WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));
    20572060    }
    20582061    else {
     
    20722075      CheckPmDrgLimit(cnd.pDragInfo);
    20732076      if (li && !li->list[1] && !IsFile(li->list[0]))
    2074         SetTargetDir(hwnd, TRUE, li->list[0]);
     2077        SetTargetDir(hwnd, TRUE, li->list[0]);
    20752078      else
    2076         saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
     2079        saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
    20772080               GetPString(IDS_WARNINGTEXT),
    20782081               GetPString(IDS_NOTARGETSET));
     
    20922095
    20932096  case WM_COMMAND:
    2094     DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
     2097    rc = DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
     2098    if (rc)
     2099      Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, "DosWaitEventSem");
     2100
    20952101    switch(SHORT1FROMMP(mp1)) {
    20962102    case IDM_RESCAN:
     
    21232129      {
    21242130        CHAR dv[4];
    2125 
    21262131        *dv = SHORT1FROMMP(mp1) - IDM_DRIVEA + 'A';
    2127         strcpy(dv + 1, ":\\");
     2132        dv[1] = ':';
     2133        dv[2] = '\\';
     2134        dv[3] = 0;
    21282135        if (isalpha(*dv)) {
    2129 
    2130           HWND hwndActive;
    2131 
    2132           dv[1] = ':';
    2133           dv[2] = '\\';
    2134           dv[3] = 0;
    2135           hwndActive = TopWindow(hwnd, (HWND) 0);
     2136          HWND hwndActive = TopWindow(hwnd, (HWND) 0);
    21362137          if (hwndActive)
    21372138            WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT),
     
    38903891              WinSetWindowUShort(hwndChild,
    38913892                                 QWS_XRESTORE,
    3892                                 (USHORT) ((USHORT) ulWidth * (USHORT) ulCurCol)
    3893                                 + (USHORT) Rectl.xLeft);
     3893                                (USHORT) ((USHORT) ulWidth * (USHORT) ulCurCol)
     3894                                + (USHORT) Rectl.xLeft);
    38943895              WinSetWindowUShort(hwndChild,
    38953896                                 QWS_YRESTORE,
     
    48194820            cmp->size = sizeof(COMPARE);
    48204821            strcpy(cmp->leftdir, wa.szCurrentPath1);
    4821             strcpy(cmp->rightdir, wa.szCurrentPath2);
    4822             cmp->listfile = wa.listfile;
    4823             cmp->includesubdirs = wa.includesubdirs;
     4822            strcpy(cmp->rightdir, wa.szCurrentPath2);
     4823            cmp->listfile = wa.listfile;
     4824            cmp->includesubdirs = wa.includesubdirs;
    48244825            cmp->hwndParent = hwnd;
    48254826            cmp->dcd.hwndParent = hwnd;
     
    60306031    if (!fNoSaveState && fSaveState) {
    60316032      PCSZ pszStatename = PCSZ_SHUTDOWNSTATE;
    6032       PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID);
     6033      PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPFROMLONG(RESTORE_STATE_RESTORE));
    60336034      if (!add_setup(pszStatename))
    60346035        save_setups();
     
    62726273      info = cmdhead;
    62736274      while (info) {
    6274         sprintf(s, "%s    {%i}", info->title, info->ID);
     6275        sprintf(s, "%s    {%i}", info->title, info->ID);
    62756276        WinSendMsg(hwndCmdlist, LM_INSERTITEM,
    62766277                   MPFROM2SHORT(LIT_END, 0), MPFROMP(s));
     
    65466547            }
    65476548            else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
     6549              // State name list
    65486550              CHAR szKey[80];
    65496551              ULONG numsaves = 0;
    65506552              ULONG size = sizeof(ULONG);
    6551               // 06 Oct 09 SHL Ctrl-select selects, but suppresses open
     6553              // Ctrl-select selects, but suppresses open
    65526554                if ((shiftstate & (KC_CTRL | KC_SHIFT | KC_ALT)) == KC_CTRL)
    65536555                  break;
     
    65596561                                       &size))
    65606562              {
     6563                // Name not found
    65616564                if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) {
    65626565                  saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
     
    65706573              }
    65716574              else {
     6575                // Name exists
    65726576                char *pszStateName;
     6577                // If shift key, add state to existing state - FIXME to doc better
    65736578                if ((shiftstate & KC_SHIFT) == 0)
    6574                   PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2));
     6579                  PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(RESTORE_STATE_CLOSE_CHILDREN));
    65756580                pszStateName = xstrdup(path, pszSrcFile, __LINE__);
    65766581                if (!pszStateName) {
     
    65846589                  }
    65856590                }
     6591                // Request restore
    65866592                else if (!PostMsg(MainObjectHwnd,
    65876593                                  UM_RESTORE,
     
    65916597                }
    65926598              }
    6593             }
     6599            } // if MAIN_SETUPLIST
    65946600            else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
    65956601
     
    66026608
    66036609                WinSendMsg(hwndCmdlist, LM_QUERYITEMTEXT,
    6604                            MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));
     6610                           MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));
    66056611                p = strrchr(s, '}');
    66066612                p = 0;
     
    66096615                WinPostMsg(hwnd,
    66106616                           WM_COMMAND,
    6611                            MPFROM2SHORT(atol(p), 0), //fixme GKY this traps in atol the {} probably don't exist
    6612                            //IDM_COMMANDSTART + sSelect, 0),
     6617                           MPFROM2SHORT(atol(p), 0), //fixme GKY this traps in atol the {} probably don't exist
     6618                           //IDM_COMMANDSTART + sSelect, 0),
    66136619                           MPVOID);
    66146620              }
     
    66576663    }
    66586664    DosSleep(1);
    6659     return 0;           // Suppress WinDefWindowProc WM_QUIT message generation
     6665    DbgMsg(pszSrcFile, __LINE__, "MainWndProc WM_CLOSE returning");
     6666
     6667    return 0;           // Suppress WinDefWindowProc WM_QUIT message generation
    66606668
    66616669  case UM_CLOSE:
     
    66696677      char *pszDefaultStateName = xstrdup(PCSZ_SHUTDOWNSTATE, pszSrcFile, __LINE__);
    66706678      if (pszDefaultStateName) {
    6671         if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID))
     6679        if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPFROMLONG(RESTORE_STATE_RESTORE)))
    66726680          // 05 Feb 08 SHL fixme to complain?
    66736681          free(pszDefaultStateName);
     
    66856693
    66866694  case WM_DESTROY:
    6687 #   ifdef FORTIFY
    6688     DbgMsg(pszSrcFile, __LINE__, "WM_DESTROY hwnd %p TID %u", hwnd, GetTidForThread()); // 22 Jul 08 SHL fixme
    6689 #   endif
    6690     hwndMain = (HWND) 0;
    6691     if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID))
    6692       WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID);
     6695    hwndMain = (HWND)0;
     6696    if (!PostMsg((HWND)0, WM_QUIT, MPVOID, MPVOID))
     6697      WinSendMsg((HWND)0, WM_QUIT, MPVOID, MPVOID);
    66936698#   ifdef FORTIFY
    66946699    free_commands();
Note: See TracChangeset for help on using the changeset viewer.