Changeset 1777 for trunk/dll/mainwnd2.c


Ignore:
Timestamp:
Jun 13, 2014, 3:51:31 AM (11 years ago)
Author:
Steven Levine
Message:

Rework FM/2 Config menu. Add confirm delete toggle. (Steven)
Rework FM/2 Lite Config menu. Add drag&drop dialog toggle and confirm delete toggles. (Steven)
Correct View, Sort and Filter button initialization. (Steven)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/mainwnd2.c

    r1700 r1777  
    2828  10 Dec 08 SHL Integrate exception handler support
    2929  03 Jan 09 GKY Check for system that is protectonly to gray out Dos/Win command lines and prevent
    30                 Dos/Win programs from being inserted into the execute dialog with message why.
     30                Dos/Win programs from being inserted into the execute dialog with message why.
    3131  21 Jun 09 GKY Added drive letter to bitmap buttons in drive bar; Eliminate static drive
    32                 letter windows; Use button ID to identify drive letter for processing.
     32                letter windows; Use button ID to identify drive letter for processing.
    3333  22 Jul 09 GKY Code changes to use semaphores to serialize drive scanning
    3434  12 Sep 09 GKY Add FM3.INI User ini and system ini to submenu for view ini
    3535  13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
    36                 profile calls for user settings that work and are setable in more than one
    37                 miniapp; FM3Str should be used for setting only relavent to FM/2 or that
    38                 aren't user settable; realappname should be used for setting applicable to
    39                 one or more miniapp but not to FM/2
     36                profile calls for user settings that work and are setable in more than one
     37                miniapp; FM3Str should be used for setting only relavent to FM/2 or that
     38                aren't user settable; realappname should be used for setting applicable to
     39                one or more miniapp but not to FM/2
    4040  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
    4141  11 Apr 10 GKY Fix drive tree rescan failure and program hang caused by event sem
    42                 never being posted
     42                never being posted
    4343  12 Aug 12 GKY Allow for selection of include subdirectories or a list file on initial startup of compare dirs
    4444
     
    7676                                        // SetSysMenu
    7777#include "mainwnd.h"                    // CloseChildren, MainWMCommand, MakeMainObjWin, ResizeDrives
    78                                 // TopWindow
     78                                        // TopWindow
    7979#include "common.h"                     // CommonCreateMainChildren, CommonMainWndProc
    8080#include "notify.h"                     // HideNote
     
    459459  case IDM_AUTOVIEWFILE:
    460460  case IDM_AUTOVIEW:
     461  case IDM_CONFIRMDELETE:               // 2014-05-17 SHL
     462  case IDM_TOGGLEDRAGDIALOG:            // 2014-05-15 SHL
    461463//    case IDM_SYSINFO:
    462464  case IDM_HIDENOTEWND:
     
    555557            strcpy(cmp->leftdir, wa.szCurrentPath1);
    556558            strcpy(cmp->rightdir, wa.szCurrentPath2);
    557             cmp->listfile = wa.listfile;
    558             cmp->includesubdirs = wa.includesubdirs;
     559            cmp->listfile = wa.listfile;
     560            cmp->includesubdirs = wa.includesubdirs;
    559561            cmp->hwndParent = hwnd;
    560562            cmp->dcd.hwndParent = hwnd;
     
    783785{
    784786  PERSON1DATA *pd;
     787  TID tid;
     788  SWP swp;
     789  PFNWP oldproc;
     790  HWND hwndMenu;
     791  DIRCNRDATA *dcd;
     792  HWND hwndC;
     793  ULONG which;
     794  ULONG size;
    785795
    786796  switch (msg) {
    787797  case WM_CREATE:
    788     {
    789       TID tid;
    790 
    791       WinQueryWindowProcess(hwnd, &mypid, &tid);
    792     }
     798    WinQueryWindowProcess(hwnd, &mypid, &tid);
    793799    hwndMain = hwnd;
     800
    794801    WinSetWindowUShort(hwnd, QWL_USER + 8, 0);
    795802    WinSetWindowUShort(hwnd, QWL_USER + 10, 0);
     
    815822      WinSetWindowPtr(hwnd, QWL_USER + 4, (PVOID) pd);
    816823    }
    817     {
    818       SWP swp;
    819       PFNWP oldproc;
    820 
    821       // create frame children (not client children, frame children)
    822       DosSleep(1);
    823       WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
    824       oldproc = WinSubclassWindow(WinQueryWindow(hwnd, QW_PARENT),
    825                                   (PFNWP) MainFrameWndProc2);
    826       if (oldproc)
    827         WinSetWindowPtr(WinQueryWindow(hwnd, QW_PARENT), QWL_USER, (PVOID) oldproc);
    828       CommonCreateMainChildren(hwnd, &swp);
    829 
    830       {
    831         HWND hwndMenu;
    832 
    833         hwndMenu = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_MENU);
    834         WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
    835         CfgMenuInit(hwndMenu, FALSE);   // 14 Feb 08 SHL
    836         SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
    837         if (fProtectOnly) {
    838           WinEnableMenuItem(hwndMenu, IDM_DOSCOMMANDLINE, FALSE);
    839           WinEnableMenuItem(hwndMenu, IDM_WINFULLSCREEN, FALSE);
    840         }
    841         SetConditionalCascade(hwndMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
    842         SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
    843       }
    844     }
     824
     825    // create frame children (not client children, frame children)
     826    DosSleep(1);
     827    WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
     828    oldproc = WinSubclassWindow(WinQueryWindow(hwnd, QW_PARENT),
     829                                (PFNWP) MainFrameWndProc2);
     830    if (oldproc)
     831      WinSetWindowPtr(WinQueryWindow(hwnd, QW_PARENT), QWL_USER, (PVOID) oldproc);
     832
     833    CommonCreateMainChildren(hwnd, &swp);
     834
     835    hwndMenu = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_MENU);
     836    WinSetWindowULong(hwnd, QWL_USER, hwndMenu);
     837
     838    // 2014-05-15 SHL FIXME to be sure needed
     839    // WinCheckMenuItem(hwndMenu, IDM_TOGGLEDRAGDIALOG, fDragndropDlg); // 2014-05-15 SHL
     840
     841    CfgMenuInit(hwndMenu, FALSE);       // 14 Feb 08 SHL
     842    SetConditionalCascade(hwndMenu, IDM_COMMANDLINESUBMENU, IDM_COMMANDLINE);
     843
     844    if (fProtectOnly) {
     845      WinEnableMenuItem(hwndMenu, IDM_DOSCOMMANDLINE, FALSE);
     846      WinEnableMenuItem(hwndMenu, IDM_WINFULLSCREEN, FALSE);
     847    }
     848
     849    SetConditionalCascade(hwndMenu, IDM_COMMANDSMENU, IDM_DOITYOURSELF);
     850    SetConditionalCascade(hwndMenu, IDM_TOOLSUBMENU, IDM_TOOLBAR);
     851
    845852    WinSetWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    846853                                     FID_TITLEBAR), "FM/2 Lite");
     854
    847855    FixSwitchList(WinQueryWindow(hwnd, QW_PARENT), NULL);
    848856    SetSysMenu(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_SYSMENU));
     
    852860    pd = WinQueryWindowPtr(hwnd, QWL_USER + 4);
    853861    if (pd) {
    854 
    855862      CHAR s[CCHMAXPATH];
    856       ULONG size;
    857       DIRCNRDATA *dcd;
    858       HWND hwndC;
    859863      BOOL dummy = TRUE;
    860864
    861865      size = sizeof(BOOL);
    862866      PrfQueryProfileData(fmprof, realappname, "FM/4 TreeUp",
    863                           (PVOID) &dummy, &size);
     867                          (PVOID) &dummy, &size);
    864868      if (dummy) {
    865869        size = sizeof(ULONG);
    866870        hwndTree = StartTreeCnr(hwnd, 3);
    867         PrfQueryProfileData(fmprof, realappname, "FM/4 TreeWidth",
    868                             (PVOID) &TreeWidth, &size);
     871        PrfQueryProfileData(fmprof, realappname, "FM/4 TreeWidth",
     872                            (PVOID) &TreeWidth, &size);
    869873        TreeWidth = max(TreeWidth, 80);
    870874      }
    871875      size = sizeof(BOOL);
    872876      if (PrfQueryProfileData(fmprof, appname, "Toolbar", &dummy, &size) &&
    873           size && !dummy)
     877          size && !dummy)
    874878        WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
    875879
     
    971975      }
    972976    }
     977    // 2014-06-11 SHL Initialize view, sort and filter button text
     978    if (pd->hwndDir1) {
     979      hwndC = WinWindowFromID(pd->hwndDir1, FID_CLIENT);
     980      if (hwndC) {
     981        dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
     982        if (dcd && dcd->hwndCnr)
     983          PostMsg(dcd->hwndCnr, UM_SETUP2, MPVOID, MPVOID);
     984      }
     985    }
     986    if (pd->hwndDir2) {
     987      hwndC = WinWindowFromID(pd->hwndDir2, FID_CLIENT);
     988      if (hwndC) {
     989        dcd = WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
     990        if (dcd && dcd->hwndCnr)
     991          PostMsg(dcd->hwndCnr, UM_SETUP2, MPVOID, MPVOID);
     992      }
     993    }
     994
     995    which = 0;
     996    size = sizeof(ULONG);
     997    if (PrfQueryProfileData(fmprof,
     998                            realappname,
     999                            "FM/4 Max",
     1000                            (PVOID)&which,
     1001                            &size) &&
     1002        size == sizeof(ULONG) &&
     1003        which)
    9731004    {
    974       ULONG which = 0, size = sizeof(ULONG);
    975 
    976       if (PrfQueryProfileData(fmprof, realappname, "FM/4 Max",
    977                               (PVOID) & which,
    978                               &size) && size == sizeof(ULONG) && which) {
    979         PostMsg(hwnd,
    980                 UM_MAXIMIZE,
    981                 MPFROMLONG(((which == 1) ?
    982                             pd->hwndDir1 : pd->hwndDir2)), MPVOID);
    983       }
     1005      PostMsg(hwnd,
     1006              UM_MAXIMIZE,
     1007              MPFROMLONG(((which == 1) ?
     1008                          pd->hwndDir1 : pd->hwndDir2)), MPVOID);
    9841009    }
    9851010    PostMsg(hwnd, UM_SIZE, MPVOID, MPVOID);
     
    12391264      break;
    12401265    case IDM_CONFIGMENU:
     1266      // 2014-05-17 SHL FIXME to use SetToggleChecks maybe
    12411267      WinCheckMenuItem((HWND) mp2, IDM_TOOLSUBMENU, fToolbar);
    12421268      WinCheckMenuItem((HWND) mp2, IDM_AUTOVIEW, fAutoView);
     1269      WinCheckMenuItem((HWND) mp2, IDM_CONFIRMDELETE, fConfirmDelete);  // 2014-05-17 SHL
     1270      WinCheckMenuItem((HWND) mp2, IDM_TOGGLEDRAGDIALOG, fDragndropDlg);        // 2014-05-15 SHL
    12431271      break;
    12441272    case IDM_TOOLSUBMENU:
     1273      // 2014-05-17 SHL FIXME to use SetToggleChecks maybe
    12451274      WinCheckMenuItem((HWND) mp2, IDM_TOOLBAR, fToolbar);
    12461275      WinCheckMenuItem((HWND) mp2, IDM_TEXTTOOLS, fTextTools);
     
    12481277      break;
    12491278    case IDM_WINDOWSMENU:
     1279      // 2014-05-17 SHL FIXME to use SetToggleChecks maybe
    12501280      WinCheckMenuItem((HWND) mp2, IDM_VTREE, (hwndTree != (HWND) 0));
    12511281      WinCheckMenuItem((HWND) mp2, IDM_TILEBACKWARDS, fTileBackwards);
Note: See TracChangeset for help on using the changeset viewer.