Changeset 930


Ignore:
Timestamp:
Jan 19, 2008, 2:54:06 PM (18 years ago)
Author:
John Small
Message:

Some code "cleanup" for ticket 150.

Location:
trunk/dll
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dircnrs.c

    r923 r930  
    3333  22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
    3434  10 Jan 08 SHL Sync with CfgDlgProc mods
     35  xx Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
    3536
    3637***********************************************************************/
     
    14231424
    14241425        CNRINFO cnri;
    1425 // JBS     static int i = 0;
    1426 //             FILE * f = fopen("e:\\dev\\netlabs\\fm2\\trunk\\jbsdebug.log", "a");
    1427 //             fprintf(f, "UM_SETUP Dir: %s; Count: %d Details: %d %d %d %d\n", dcd->directory, ++i, (int)dcd->detailscrdate, (int)dcd->detailscrtime, (int)dcd->detailsladate, (int)dcd->detailsladate);
    1428 //             fclose(f);
    14291426
    14301427        RestorePresParams(hwnd, "DirCnr");
    1431 // JBS  LoadDetailsSwitches("DirCnr", dcd);
    14321428        memset(&cnri, 0, sizeof(CNRINFO));
    14331429        cnri.cb = sizeof(CNRINFO);
     
    14861482                              CMA_CXTREEINDENT | CMA_PSORTRECORD));
    14871483        SetCnrCols(hwnd, FALSE);
    1488 // JBS  AdjustCnrColsForPref(hwnd, NULL, dcd, FALSE);
    14891484        if (_beginthread(MakeObjWin, NULL, 245760, (PVOID) dcd) == -1) {
    14901485          Runtime_Error(pszSrcFile, __LINE__,
     
    20402035
    20412036      case IDM_RESORT:
    2042 //            WinSendMsg(hwnd,
    2043 //                       CM_SORTRECORD,
    2044 //                       MPFROMP(SortDirCnr),
    2045 //                       MPFROMLONG((fSyncUpdates) ? sortFlags : dcd->sortFlags));
     2037//          WinSendMsg(hwnd,
     2038//                     CM_SORTRECORD,
     2039//                     MPFROMP(SortDirCnr),
     2040//                     MPFROMLONG((fSyncUpdates) ? sortFlags : dcd->sortFlags));
    20462041        WinSendMsg(hwnd,
    20472042                   CM_SORTRECORD,
     
    21622157                              dcd->hwndLastMenu,
    21632158                              SHORT1FROMMP(mp1),
    2164 // JBS                        dcd->directory, "DirCnr", dcd, FALSE);
    21652159                              dcd->directory, NULL, dcd, FALSE);
    21662160        break;
     
    25942588        if (pci->attrFile & FILE_DIRECTORY) {
    25952589          menuHwnd = CheckMenu(hwndMainMenu, &DirMenu, DIR_POPUP);
    2596 //            WinEnableMenuItem(DirMenu,IDM_TREE,TRUE);
     2590//          WinEnableMenuItem(DirMenu,IDM_TREE,TRUE);
    25972591        }
    25982592        else
     
    34293423        dcd->hwndRestore = hwndRestore;
    34303424        dcd->dontclose = ((flags & 1) != 0);
    3431         dcd->detailslongname = detailslongname;
    3432         dcd->detailssubject = detailssubject;
    3433         dcd->detailsea = detailsea;
    3434         dcd->detailssize = detailssize;
    3435         dcd->detailsicon = detailsicon;
    3436         dcd->detailsattr = detailsattr;
    3437         dcd->detailscrdate = detailscrdate;
    3438         dcd->detailscrtime = detailscrtime;
    3439         dcd->detailslwdate = detailslwdate;
    3440         dcd->detailslwtime = detailslwtime;
    3441         dcd->detailsladate = detailsladate;
    3442         dcd->detailslatime = detailslatime;
     3425        dcd->detailslongname = detailslongname;
     3426        dcd->detailssubject = detailssubject;
     3427        dcd->detailsea = detailsea;
     3428        dcd->detailssize = detailssize;
     3429        dcd->detailsicon = detailsicon;
     3430        dcd->detailsattr = detailsattr;
     3431        dcd->detailscrdate = detailscrdate;
     3432        dcd->detailscrtime = detailscrtime;
     3433        dcd->detailslwdate = detailslwdate;
     3434        dcd->detailslwtime = detailslwtime;
     3435        dcd->detailsladate = detailsladate;
     3436        dcd->detailslatime = detailslatime;
    34433437        strcpy(dcd->directory, directory);
    34443438        add_udir(FALSE, directory);
  • trunk/dll/mainwnd.c

    r928 r930  
    4646  16 Jan 08 SHL Add sync updates toggle
    4747  16 Jan 08 GKY Fix changing background color on toolbar
     48  xx Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
    4849
    4950***********************************************************************/
     
    5253#include <string.h>
    5354#include <ctype.h>
    54 #include <process.h>                    // _beginthread
     55#include <process.h>                    // _beginthread
    5556
    5657#define INCL_DOS
    5758#define INCL_WIN
    58 #define INCL_SHLERRORS                  // PMERR_NOT_IN_IDX
     59#define INCL_SHLERRORS                  // PMERR_NOT_IN_IDX
    5960#define INCL_WINHELP
    6061#define INCL_GPI
     
    6667#include "comp.h"
    6768#include "datamin.h"
    68 #include "arccnrs.h"                    // BldQuotedFileName
    69 #include "errutil.h"                    // Dos_Error...
    70 #include "strutil.h"                    // GetPString
     69#include "arccnrs.h"                    // BldQuotedFileName
     70#include "errutil.h"                    // Dos_Error...
     71#include "strutil.h"                    // GetPString
    7172#include "fm3dll.h"
    7273
     
    7576// #define FM2_STATE_AT_CLOSE GetPString(IDS_FM2TEMPTEXT)
    7677#define FM2_STATE_AT_CLOSE "LastClose"
    77 //#define JBSDBG size = 1; //
    78 #define JBSDBG
    7978
    8079static PSZ pszSrcFile = __FILE__;
     
    8685
    8786static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
    88                                           MPARAM mp2)
     87                                          MPARAM mp2)
    8988{
    9089  switch (msg) {
     
    112111      *dv = 0;
    113112      WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwndB, QW_PARENT),
    114                                         id + 50), sizeof(dv), dv);
     113                                        id + 50), sizeof(dv), dv);
    115114      d = toupper(*dv);
    116115      if (isalpha(d) && d > 'B' &&
    117           !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID |
    118                                    DRIVE_SLOW)) &&
    119           (!hwndBubble ||
    120            WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
    121           !WinQueryCapture(HWND_DESKTOP)) {
    122 
    123         FSALLOCATE fsa;
    124         CHAR s[90], szQty[38];
    125         ULONG ulPctFree;
    126         ULONGLONG ullFreeQty;
    127 
    128         if (!DosQueryFSInfo((d - 'A') + 1,
    129                             FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
    130           ullFreeQty = (ULONGLONG) fsa.cUnitAvail *
    131             (fsa.cSectorUnit * fsa.cbSector);
    132           ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?
    133             (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
    134           CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');
    135           sprintf(s, "%s (%lu%%) free", szQty, ulPctFree);
    136         }
    137         if ((!hwndBubble ||
    138              WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
    139             !WinQueryCapture(HWND_DESKTOP))
    140           WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID);
     116          !(driveflags[d - 'A'] & (DRIVE_CDROM | DRIVE_INVALID |
     117                                   DRIVE_SLOW)) &&
     118          (!hwndBubble ||
     119           WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
     120          !WinQueryCapture(HWND_DESKTOP)) {
     121
     122        FSALLOCATE fsa;
     123        CHAR s[90], szQty[38];
     124        ULONG ulPctFree;
     125        ULONGLONG ullFreeQty;
     126
     127        if (!DosQueryFSInfo((d - 'A') + 1,
     128                            FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) {
     129          ullFreeQty = (ULONGLONG) fsa.cUnitAvail *
     130            (fsa.cSectorUnit * fsa.cbSector);
     131          ulPctFree = (fsa.cUnit && fsa.cUnitAvail) ?
     132            (fsa.cUnitAvail * 100) / fsa.cUnit : 0;
     133          CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');
     134          sprintf(s, "%s (%lu%%) free", szQty, ulPctFree);
     135        }
     136        if ((!hwndBubble ||
     137             WinQueryWindowULong(hwndBubble, QWL_USER) != hwndB) &&
     138            !WinQueryCapture(HWND_DESKTOP))
     139          WinSendMsg(hwndB, UM_SETUP6, MPFROMP(s), MPVOID);
    141140      }
    142141    }
     
    149148
    150149      if (DosQuerySysInfo(QSV_BOOT_DRIVE,
    151                           QSV_BOOT_DRIVE,
    152                           (PVOID) & bd, (ULONG) sizeof(ULONG)))
    153         bd = 3L;
     150                          QSV_BOOT_DRIVE,
     151                          (PVOID) & bd, (ULONG) sizeof(ULONG)))
     152        bd = 3L;
    154153      *s = (CHAR) bd + '@';
    155154      WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1));
    156155      if (!mp1) {
    157         s[3] = 0;
    158         WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID);
     156        s[3] = 0;
     157        WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID);
    159158      }
    160159      PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1));
     
    166165      switch ((ULONG) mp2) {
    167166      case 1:
    168         TileChildren(hwndMain, TRUE);
    169         break;
     167        TileChildren(hwndMain, TRUE);
     168        break;
    170169      case 2:
    171         CloseDirCnrChildren(hwndMain);
    172         break;
     170        CloseDirCnrChildren(hwndMain);
     171        break;
    173172      }
    174173    }
     
    180179      fNoTileUpdate = FALSE;
    181180      if (mp1)
    182         free((char *)mp1);
     181        free((char *)mp1);
    183182      if (fAutoTile)
    184         TileChildren(hwndMain, TRUE);
     183        TileChildren(hwndMain, TRUE);
    185184    }
    186185    return 0;
     
    215214      DosError(FERR_DISABLEHARDERR);
    216215      WinRegisterClass(hab2,
    217                        (PSZ) WC_OBJECTWINDOW,
    218                        MainObjectWndProc, 0, sizeof(PVOID));
     216                       (PSZ) WC_OBJECTWINDOW,
     217                       MainObjectWndProc, 0, sizeof(PVOID));
    219218      MainObjectHwnd = WinCreateWindow(HWND_OBJECT,
    220                                        WC_OBJECTWINDOW,
    221                                        (PSZ) NULL,
    222                                        0,
    223                                        0L,
    224                                        0L,
    225                                        0L,
    226                                        0L,
    227                                        0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
     219                                       WC_OBJECTWINDOW,
     220                                       (PSZ) NULL,
     221                                       0,
     222                                       0L,
     223                                       0L,
     224                                       0L,
     225                                       0L,
     226                                       0L, HWND_TOP, OBJ_FRAME, NULL, NULL);
    228227      if (!MainObjectHwnd)
    229         Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
    230                    IDS_WINCREATEWINDOW);
     228        Win_Error2(HWND_OBJECT, HWND_DESKTOP, pszSrcFile, __LINE__,
     229                   IDS_WINCREATEWINDOW);
    231230      else {
    232         WinSetWindowPtr(MainObjectHwnd, QWL_USER, args);
    233         while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
    234           WinDispatchMsg(hab2, &qmsg2);
    235         WinDestroyWindow(MainObjectHwnd);
     231        WinSetWindowPtr(MainObjectHwnd, QWL_USER, args);
     232        while (WinGetMsg(hab2, &qmsg2, (HWND) 0, 0, 0))
     233          WinDispatchMsg(hab2, &qmsg2);
     234        WinDestroyWindow(MainObjectHwnd);
    236235      }
    237236      WinDestroyMsgQueue(hmq2);
     
    242241
    243242static MRESULT EXPENTRY IdealButtonProc(HWND hwnd, ULONG msg, MPARAM mp1,
    244                                         MPARAM mp2)
     243                                        MPARAM mp2)
    245244{
    246245  switch (msg) {
     
    262261    while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
    263262      if (hwndC != exclude) {
    264         id = WinQueryWindowUShort(hwndC, QWS_ID);
    265         if (id)
    266           break;
     263        id = WinQueryWindowUShort(hwndC, QWS_ID);
     264        if (id)
     265          break;
    267266      }
    268267    }
     
    284283      henum = WinBeginEnumWindows(hwndMain);
    285284      while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
    286         // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
    287         if (hwndC != exclude && hwndC != hwndTree) {
    288           id = WinQueryWindowUShort(hwndC, QWS_ID);
    289           if (id) {
    290             hwndClient = WinWindowFromID(hwndC, FID_CLIENT);
    291             if (hwndClient) {
    292               hwndDir = WinWindowFromID(hwndClient, DIR_CNR);
    293               if (hwndDir) {
    294                 if (fLookInDir) {
    295                   pci = (PCNRITEM) WinSendMsg(hwndDir,
    296                                               CM_QUERYRECORDEMPHASIS,
    297                                               MPFROMLONG(CMA_FIRST),
    298                                               MPFROMSHORT(CRA_CURSORED));
    299                   if (pci && (INT) pci != -1)
    300                     break;
    301                 }
    302                 if (WinSendMsg(hwndClient,
    303                                UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {
    304                   MakeValidDir(ret);
    305                   // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
    306                   WinEndEnumWindows(henum);
    307                   return hwndC;
    308                 }
    309               }
    310             }
    311           }
    312         }
     285        // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
     286        if (hwndC != exclude && hwndC != hwndTree) {
     287          id = WinQueryWindowUShort(hwndC, QWS_ID);
     288          if (id) {
     289            hwndClient = WinWindowFromID(hwndC, FID_CLIENT);
     290            if (hwndClient) {
     291              hwndDir = WinWindowFromID(hwndClient, DIR_CNR);
     292              if (hwndDir) {
     293                if (fLookInDir) {
     294                  pci = (PCNRITEM) WinSendMsg(hwndDir,
     295                                              CM_QUERYRECORDEMPHASIS,
     296                                              MPFROMLONG(CMA_FIRST),
     297                                              MPFROMSHORT(CRA_CURSORED));
     298                  if (pci && (INT) pci != -1)
     299                    break;
     300                }
     301                if (WinSendMsg(hwndClient,
     302                               UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {
     303                  MakeValidDir(ret);
     304                  // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
     305                  WinEndEnumWindows(henum);
     306                  return hwndC;
     307                }
     308              }
     309            }
     310          }
     311        }
    313312      }
    314313      WinEndEnumWindows(henum);
    315314      if (!pci || (INT) pci == -1) {
    316         hwndC = hwndTree;
    317         pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree,
    318                                                                     FID_CLIENT),
    319                                                     TREE_CNR),
    320                                     CM_QUERYRECORDEMPHASIS,
    321                                     MPFROMLONG(CMA_FIRST),
    322                                     MPFROMSHORT(CRA_CURSORED));
     315        hwndC = hwndTree;
     316        pci = (PCNRITEM) WinSendMsg(WinWindowFromID(WinWindowFromID(hwndTree,
     317                                                                    FID_CLIENT),
     318                                                    TREE_CNR),
     319                                    CM_QUERYRECORDEMPHASIS,
     320                                    MPFROMLONG(CMA_FIRST),
     321                                    MPFROMSHORT(CRA_CURSORED));
    323322      }
    324323      if (pci && (INT) pci != -1) {
    325         strcpy(ret, pci->pszFileName);
    326         MakeValidDir(ret);
     324        strcpy(ret, pci->pszFileName);
     325        MakeValidDir(ret);
    327326      }
    328327      else
    329         save_dir2(ret);
     328        save_dir2(ret);
    330329    }
    331330  }
     
    345344      hwndDir = WinWindowFromID(hwndC, DIR_CNR);
    346345      if (hwndDir)
    347         ret++;
     346        ret++;
    348347    }
    349348  }
     
    363362      hwndC = WinWindowFromID(hwndF, FID_CLIENT);
    364363      if (hwndC) {
    365         hwndDir = WinWindowFromID(hwndC, DIR_CNR);
    366         if (hwndDir) {
    367           *retstr = 0;
    368           WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
    369           if (*retstr && !stricmp(retstr, directory)) {
    370             if (restore)
    371               WinSetWindowPos(hwndF,
    372                               HWND_TOP,
    373                               0,
    374                               0,
    375                               0,
    376                               0,
    377                               SWP_RESTORE | SWP_SHOW |
    378                               SWP_ACTIVATE | SWP_ZORDER);
    379             break;
    380           }
    381         }
     364        hwndDir = WinWindowFromID(hwndC, DIR_CNR);
     365        if (hwndDir) {
     366          *retstr = 0;
     367          WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(retstr), MPVOID);
     368          if (*retstr && !stricmp(retstr, directory)) {
     369            if (restore)
     370              WinSetWindowPos(hwndF,
     371                              HWND_TOP,
     372                              0,
     373                              0,
     374                              0,
     375                              0,
     376                              SWP_RESTORE | SWP_SHOW |
     377                              SWP_ACTIVATE | SWP_ZORDER);
     378            break;
     379          }
     380        }
    382381      }
    383382    }
     
    446445    while (tool) {
    447446      if (!(tool->flags & T_INVISIBLE)) {
    448         swp[x].x = butx;
    449         if (fTextTools || (tool->flags & T_TEXT)) {
    450           butx += 55L;
    451           swp[x].cx = 54L;
    452           swp[x].cy = 24L;
    453           swp[x].y = 3L;
    454         }
    455         else
    456           butx += 33L;
    457         if (tool->flags & T_SEPARATOR)
    458           butx += 12;
     447        swp[x].x = butx;
     448        if (fTextTools || (tool->flags & T_TEXT)) {
     449          butx += 55L;
     450          swp[x].cx = 54L;
     451          swp[x].cy = 24L;
     452          swp[x].y = 3L;
     453        }
     454        else
     455          butx += 33L;
     456        if (tool->flags & T_SEPARATOR)
     457          butx += 12;
    459458      }
    460459      else
    461         swp[x].fl = noattrib;
     460        swp[x].fl = noattrib;
    462461      swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
    463462      x++;
     
    468467      swp[x].x = butx;
    469468      if (!(tool->flags & T_INVISIBLE)) {
    470         if (fTextTools || (tool->flags & T_TEXT)) {
    471           butx += 55L;
    472           swp[x].cx = 54L;
    473           swp[x].cy = 24L;
    474           swp[x].y = 3L;
    475         }
    476         else
    477           butx += 33L;
    478         if (tool->flags & T_SEPARATOR)
    479           butx += 12;
     469        if (fTextTools || (tool->flags & T_TEXT)) {
     470          butx += 55L;
     471          swp[x].cx = 54L;
     472          swp[x].cy = 24L;
     473          swp[x].y = 3L;
     474        }
     475        else
     476          butx += 33L;
     477        if (tool->flags & T_SEPARATOR)
     478          butx += 12;
    480479      }
    481480      else
    482         swp[x].fl = noattrib;
     481        swp[x].fl = noattrib;
    483482      swp[x].hwnd = WinWindowFromID(hwnd, tool->id);
    484483      x++;
     
    488487    if (!fTextTools && fToolTitles) {
    489488      for (x = 2L; x < numtools + 2L; x++) {
    490         if (fTextTools || !fToolTitles)
    491           swp[x].fl = noattrib;
    492         else {
    493           tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID));
    494           if (tool && (tool->flags & T_TEXT))
    495             swp[x].fl = noattrib;
    496           else {
    497             swp[x].hwndInsertBehind = HWND_TOP;
    498             swp[x].y = 1L;
    499             swp[x].cy = 10L;
    500           }
    501         }
    502         swp[x].hwnd = WinWindowFromID(hwnd,
    503                                       WinQueryWindowUShort(swp[x].hwnd,
    504                                                            QWS_ID) + 25000);
     489        if (fTextTools || !fToolTitles)
     490          swp[x].fl = noattrib;
     491        else {
     492          tool = find_tool(WinQueryWindowUShort(swp[x].hwnd, QWS_ID));
     493          if (tool && (tool->flags & T_TEXT))
     494            swp[x].fl = noattrib;
     495          else {
     496            swp[x].hwndInsertBehind = HWND_TOP;
     497            swp[x].y = 1L;
     498            swp[x].cy = 10L;
     499          }
     500        }
     501        swp[x].hwnd = WinWindowFromID(hwnd,
     502                                      WinQueryWindowUShort(swp[x].hwnd,
     503                                                           QWS_ID) + 25000);
    505504      }
    506505      WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools);
     
    512511
    513512static MRESULT EXPENTRY DropDownListProc(HWND hwnd, ULONG msg, MPARAM mp1,
    514                                         MPARAM mp2)
     513                                        MPARAM mp2)
    515514{
    516515  PFNWP oldproc = (PFNWP) INSTDATA(hwnd);
     
    550549      id = WinQueryWindowUShort(hwndParent, QWS_ID);
    551550      if (SHORT1FROMMP(mp2)) {
    552         // If getting focus 1st time - save original accelerator
    553         if (haccelSaved == NULLHANDLE) {
    554           haccelSaved = WinQueryAccelTable(hab, hwndFrame);
    555           if (haccelSaved == NULLHANDLE)
    556             Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable");
    557           // else
    558             // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved);
    559         }
    560         if (haccelSaved != NULLHANDLE) {
    561           switch (id) {
    562           case MAIN_DRIVELIST:
    563             if (haccelDriveList == NULLHANDLE) {
    564                 haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST);
    565                 if (haccelDriveList == NULLHANDLE)
    566                   Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
    567             }
    568             if (haccelDriveList != NULLHANDLE) {
    569               if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame))
    570                 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
    571               // else
    572                 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);
    573             }
    574             break;
    575           case MAIN_SETUPLIST:
    576             if (haccelSetupList == NULLHANDLE) {
    577                 haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST);
    578                 if (haccelSetupList == NULLHANDLE)
    579                   Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
    580             }
    581             if (haccelSetupList != NULLHANDLE) {
    582               if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame))
    583                 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
    584               // else
    585                 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList);
    586             }
    587             break;
    588           case MAIN_CMDLIST:
    589             if (haccelCmdList == NULLHANDLE) {
    590                 haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST);
    591                 if (haccelCmdList == NULLHANDLE)
    592                   Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
    593             }
    594             if (haccelCmdList != NULLHANDLE) {
    595               if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame))
    596                 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
    597               // else
    598                 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList);
    599             }
    600             break;
    601           case MAIN_USERLIST:
    602             if (haccelUserList == NULLHANDLE) {
    603                 haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST);
    604                 if (haccelUserList == NULLHANDLE)
    605                   Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
    606             }
    607             if (haccelUserList != NULLHANDLE) {
    608               if (!WinSetAccelTable(hab, haccelUserList, hwndFrame))
    609                 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
    610               // else
    611                 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList);
    612             }
    613             break;
    614           case MAIN_BUTTONLIST:
    615             if (haccelButtonList == NULLHANDLE) {
    616                 haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST);
    617                 if (haccelButtonList == NULLHANDLE)
    618                   Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
    619             }
    620             if (haccelButtonList != NULLHANDLE) {
    621               if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame))
    622                 Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
    623               // else
    624                 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList);
    625             }
    626             break;
    627           } // switch
    628         }
     551        // If getting focus 1st time - save original accelerator
     552        if (haccelSaved == NULLHANDLE) {
     553          haccelSaved = WinQueryAccelTable(hab, hwndFrame);
     554          if (haccelSaved == NULLHANDLE)
     555            Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable");
     556          // else
     557            // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved);
     558        }
     559        if (haccelSaved != NULLHANDLE) {
     560          switch (id) {
     561          case MAIN_DRIVELIST:
     562            if (haccelDriveList == NULLHANDLE) {
     563                haccelDriveList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_DRIVELIST);
     564                if (haccelDriveList == NULLHANDLE)
     565                  Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
     566            }
     567            if (haccelDriveList != NULLHANDLE) {
     568              if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame))
     569                Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
     570              // else
     571                // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);
     572            }
     573            break;
     574          case MAIN_SETUPLIST:
     575            if (haccelSetupList == NULLHANDLE) {
     576                haccelSetupList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_SETUPLIST);
     577                if (haccelSetupList == NULLHANDLE)
     578                  Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
     579            }
     580            if (haccelSetupList != NULLHANDLE) {
     581              if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame))
     582                Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
     583              // else
     584                // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList);
     585            }
     586            break;
     587          case MAIN_CMDLIST:
     588            if (haccelCmdList == NULLHANDLE) {
     589                haccelCmdList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_CMDLIST);
     590                if (haccelCmdList == NULLHANDLE)
     591                  Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
     592            }
     593            if (haccelCmdList != NULLHANDLE) {
     594              if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame))
     595                Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
     596              // else
     597                // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList);
     598            }
     599            break;
     600          case MAIN_USERLIST:
     601            if (haccelUserList == NULLHANDLE) {
     602                haccelUserList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_USERLIST);
     603                if (haccelUserList == NULLHANDLE)
     604                  Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
     605            }
     606            if (haccelUserList != NULLHANDLE) {
     607              if (!WinSetAccelTable(hab, haccelUserList, hwndFrame))
     608                Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
     609              // else
     610                // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList);
     611            }
     612            break;
     613          case MAIN_BUTTONLIST:
     614            if (haccelButtonList == NULLHANDLE) {
     615                haccelButtonList = WinLoadAccelTable(hab, FM3ModHandle, MAIN_BUTTONLIST);
     616                if (haccelButtonList == NULLHANDLE)
     617                  Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinLoadAccelTable");
     618            }
     619            if (haccelButtonList != NULLHANDLE) {
     620              if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame))
     621                Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
     622              // else
     623                // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList);
     624            }
     625            break;
     626          } // switch
     627        }
    629628      }
    630629      else {
    631         // Losing focus
    632         switch (id) {
    633         case MAIN_DRIVELIST:
    634         case MAIN_SETUPLIST:
    635         case MAIN_CMDLIST:
    636         case MAIN_USERLIST:
    637         case MAIN_BUTTONLIST:
    638           if (haccelSaved != NULLHANDLE) {
    639             if (!WinSetAccelTable(hab, haccelSaved, hwndFrame))
    640               Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
    641             // else
    642               // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved);
    643           }
    644           break;
    645         } // switch
     630        // Losing focus
     631        switch (id) {
     632        case MAIN_DRIVELIST:
     633        case MAIN_SETUPLIST:
     634        case MAIN_CMDLIST:
     635        case MAIN_USERLIST:
     636        case MAIN_BUTTONLIST:
     637          if (haccelSaved != NULLHANDLE) {
     638            if (!WinSetAccelTable(hab, haccelSaved, hwndFrame))
     639              Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, "WinSetAccelTable");
     640            // else
     641              // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved);
     642          }
     643          break;
     644        } // switch
    646645      }
    647646    }
     
    653652
    654653      if (hwndMenu)
    655         WinDestroyWindow(hwndMenu);
     654        WinDestroyWindow(hwndMenu);
    656655      hwndMenu = (HWND) 0;
    657656      id = WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID);
    658657      switch (id) {
    659658      case MAIN_CMDLIST:
    660         WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
    661                                                                 QW_PARENT),
    662                                                   QW_PARENT),
    663                                    FID_CLIENT),
    664                    WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID);
    665         break;
     659        WinPostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
     660                                                                QW_PARENT),
     661                                                  QW_PARENT),
     662                                   FID_CLIENT),
     663                   WM_COMMAND, MPFROM2SHORT(IDM_EDITCOMMANDS, 0), MPVOID);
     664        break;
    666665      case MAIN_USERLIST:
    667666      case MAIN_SETUPLIST:
    668         hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
    669         if (hwndMenu)
    670           PopupMenu(hwnd,
    671                     WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
    672                                                                   QW_PARENT),
    673                                                    QW_PARENT),
    674                                     FID_CLIENT), hwndMenu);
    675         break;
     667        hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, id);
     668        if (hwndMenu)
     669          PopupMenu(hwnd,
     670                    WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
     671                                                                  QW_PARENT),
     672                                                   QW_PARENT),
     673                                    FID_CLIENT), hwndMenu);
     674        break;
    676675      default:
    677         ret = FALSE;
    678         break;
     676        ret = FALSE;
     677        break;
    679678      } // switch
    680679      return ret;
     
    685684      switch (SHORT1FROMMP(mp1)) {
    686685      case CBID_EDIT:
    687         id = WinQueryWindowUShort(hwnd, QWS_ID);
    688         switch (SHORT2FROMMP(mp1)) {
    689         case EN_SETFOCUS:
    690           switch (id) {
    691           case MAIN_CMDLIST:
    692             WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP));
    693             break;
    694           case MAIN_SETUPLIST:
    695             WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP));
    696             break;
    697           case MAIN_USERLIST:
    698             WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP));
    699             break;
    700           case MAIN_DRIVELIST:
    701             WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP));
    702             break;
    703           case MAIN_BUTTONLIST:
    704             WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP));
    705             break;
    706           default:
    707             break;
    708           }
    709           break;
    710 
    711         default:
    712           break;
    713         }
     686        id = WinQueryWindowUShort(hwnd, QWS_ID);
     687        switch (SHORT2FROMMP(mp1)) {
     688        case EN_SETFOCUS:
     689          switch (id) {
     690          case MAIN_CMDLIST:
     691            WinSetWindowText(hwndStatus2, GetPString(IDS_CMDLISTHELP));
     692            break;
     693          case MAIN_SETUPLIST:
     694            WinSetWindowText(hwndStatus2, GetPString(IDS_SETUPLISTHELP));
     695            break;
     696          case MAIN_USERLIST:
     697            WinSetWindowText(hwndStatus2, GetPString(IDS_USERLISTHELP));
     698            break;
     699          case MAIN_DRIVELIST:
     700            WinSetWindowText(hwndStatus2, GetPString(IDS_DRIVELISTHELP));
     701            break;
     702          case MAIN_BUTTONLIST:
     703            WinSetWindowText(hwndStatus2, GetPString(IDS_BUTTONLISTHELP));
     704            break;
     705          default:
     706            break;
     707          }
     708          break;
     709
     710        default:
     711          break;
     712        }
    714713      }
    715714      break;
     
    724723    // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"%u %s %u",id,(id == CBID_EDIT) ? "TRUE" : "FALSE",WinQueryWindowUShort(WinQueryWindow(hwnd,QW_PARENT),QWS_ID) == MAIN_USERLIST);
    725724    if (id == CBID_EDIT &&
    726         WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==
    727         MAIN_USERLIST) {
     725        WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==
     726        MAIN_USERLIST) {
    728727
    729728      CHAR path[CCHMAXPATH];
     
    734733      // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path);
    735734      if (*path && !IsRoot(path))
    736         DragOne(hwnd, (HWND) 0, path, FALSE);
     735        DragOne(hwnd, (HWND) 0, path, FALSE);
    737736      return 0;
    738737    }
     
    743742    if (id == MAIN_USERLIST) {
    744743      if (!emphasized) {
    745         emphasized = TRUE;
    746         DrawTargetEmphasis(hwnd, emphasized);
     744        emphasized = TRUE;
     745        DrawTargetEmphasis(hwnd, emphasized);
    747746      }
    748747      if (AcceptOneDrop(hwnd, mp1, mp2))
    749         return MRFROM2SHORT(DOR_DROP, DO_MOVE);
     748        return MRFROM2SHORT(DOR_DROP, DO_MOVE);
    750749      return MRFROM2SHORT(DOR_NEVERDROP, 0);
    751750    }
     
    756755    if (id == MAIN_USERLIST) {
    757756      if (emphasized) {
    758         emphasized = FALSE;
    759         DrawTargetEmphasis(hwnd, emphasized);
     757        emphasized = FALSE;
     758        DrawTargetEmphasis(hwnd, emphasized);
    760759      }
    761760    }
     
    777776
    778777      if (emphasized) {
    779         emphasized = FALSE;
    780         DrawTargetEmphasis(hwnd, emphasized);
     778        emphasized = FALSE;
     779        DrawTargetEmphasis(hwnd, emphasized);
    781780      }
    782781      if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
    783         MakeValidDir(szFrom);
    784         WinSetWindowText(hwnd, szFrom);
    785         PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
    786                                                               QW_PARENT),
    787                                                QW_PARENT),
    788                                 FID_CLIENT),
    789                 UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID);
    790         return 0;
     782        MakeValidDir(szFrom);
     783        WinSetWindowText(hwnd, szFrom);
     784        PostMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
     785                                                              QW_PARENT),
     786                                               QW_PARENT),
     787                                FID_CLIENT),
     788                UM_COMMAND, MPFROM2SHORT(IDM_ADDTOUSERLIST, 0), MPVOID);
     789        return 0;
    791790      }
    792791    }
     
    809808       (other && fOtherHelp) || (!other && !drive && fToolbarHelp))) {
    810809    if ((!hwndBubble ||
    811         WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
    812         !WinQueryCapture(HWND_DESKTOP))
     810        WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
     811        !WinQueryCapture(HWND_DESKTOP))
    813812      MakeBubble(hwnd, above, help);
    814813  }
     
    831830      /* don't bring up help if window isn't active */
    832831      if (!WinIsChild(hwnd, hwndActive))
    833         return;
     832        return;
    834833    }
    835834    hwndActive = WinQueryFocus(HWND_DESKTOP);
     
    837836      /* don't bring up help if a menu is active */
    838837      if (!strcmp(ucClassname, "#4"))
    839         return;
     838        return;
    840839    }
    841840  }
    842841
    843842  hwndBubble = WinCreateWindow(HWND_DESKTOP,
    844                                WC_BUBBLE,
    845                                help,
    846                                WS_CLIPSIBLINGS | SS_TEXT |
    847                                DT_CENTER | DT_VCENTER,
    848                                0,
    849                                0,
    850                                0,
    851                                0,
    852                                HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL);
     843                               WC_BUBBLE,
     844                               help,
     845                               WS_CLIPSIBLINGS | SS_TEXT |
     846                               DT_CENTER | DT_VCENTER,
     847                               0,
     848                               0,
     849                               0,
     850                               0,
     851                               HWND_DESKTOP, HWND_TOP, MAIN_HELP, NULL, NULL);
    853852  if (!hwndBubble)
    854853    Win_Error2(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__,
    855                IDS_WINCREATEWINDOW);
     854               IDS_WINCREATEWINDOW);
    856855  else {
    857856    HPS hps;
     
    873872      pp = strchr(p, '\r');
    874873      if (pp) {
    875         wp = pp;
    876         *pp = 0;
    877         pp++;
     874        wp = pp;
     875        *pp = 0;
     876        pp++;
    878877      }
    879878      GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
    880879      tptl.x = max(aptl[TXTBOX_TOPRIGHT].x, tptl.x);
    881880      if (tptl.y)
    882         tptl.y += extra;
     881        tptl.y += extra;
    883882      else
    884         extra = aptl[TXTBOX_TOPLEFT].y / 4;
     883        extra = aptl[TXTBOX_TOPLEFT].y / 4;
    885884      tptl.y += aptl[TXTBOX_TOPLEFT].y;
    886885      if (wp)
    887         *wp = '\r';
     886        *wp = '\r';
    888887      p = pp;
    889888    }
     
    895894      sy = ptl.y + swp.cy + 4;
    896895      if (sy + tptl.y + 12 > lyScreen) {
    897         above = FALSE;
    898         sy = ptl.y - (tptl.y + 14);
     896        above = FALSE;
     897        sy = ptl.y - (tptl.y + 14);
    899898      }
    900899    }
     
    912911      sy = ptl.y + swp.cy + 4;
    913912      if (sy + tptl.y + 12 > lyScreen)
    914         sy = 0;
     913        sy = 0;
    915914    }
    916915    WinSetWindowPos(hwndBubble, HWND_TOP, sx, sy,
    917                     tptl.x + 14,
    918                     tptl.y + 12,
    919                     SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER |
    920                     SWP_MOVE | SWP_SIZE);
     916                    tptl.x + 14,
     917                    tptl.y + 12,
     918                    SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER |
     919                    SWP_MOVE | SWP_SIZE);
    921920  }
    922921}
     
    944943      WinQueryPointerPos(HWND_DESKTOP, &ptl);
    945944      if (WinWindowFromPoint(HWND_DESKTOP, &ptl, TRUE) !=
    946           WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd))
    947         WinDestroyWindow(hwnd);
     945          WinQueryWindowULong(hwnd, QWL_USER) || !WinIsWindowVisible(hwnd))
     946        WinDestroyWindow(hwnd);
    948947    }
    949948    return 0;
     
    959958      hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
    960959      if (hps) {
    961         WinQueryWindowPos(hwnd, &swp);
    962         GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0);
    963         GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198));
    964         GpiSetBackMix(hps, BM_LEAVEALONE);
    965         GpiSetMix(hps, FM_OVERPAINT);
    966         ptl.x = ptl.y = 0;
    967         GpiMove(hps, &ptl);
    968         ptl.x = swp.cx - 1;
    969         ptl.y = swp.cy - 1;
    970         GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
    971         tlen = WinQueryWindowTextLength(hwnd);
    972         if (tlen) {
    973           s = xmalloc(tlen + 2, pszSrcFile, __LINE__);
    974           if (s) {
    975             WinQueryWindowText(hwnd, tlen + 1, s);
    976             if (*s) {
    977               p = s;
    978               y = swp.cy - 3;
    979               extra = WinQueryWindowULong(hwnd, QWL_USER + 4);
    980               GpiSetColor(hps, 0);
    981               GpiSetMix(hps, FM_OVERPAINT);
    982               while (p && *p) {
    983                 wp = NULL;
    984                 pp = strchr(p, '\r');
    985                 if (pp) {
    986                   wp = pp;
    987                   *pp = 0;
    988                   pp++;
    989                 }
    990                 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
    991                 ptl.x = 7;
    992                 y -= aptl[TXTBOX_TOPLEFT].y;
    993                 if (p != s)
    994                   y -= extra;
    995                 ptl.y = y;
    996                 GpiCharStringAt(hps, &ptl, strlen(p), p);
    997                 if (wp)
    998                   *wp = '\r';
    999                 p = pp;
    1000               }
    1001             }
    1002             free(s);
    1003           }
    1004         }
    1005         if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) {
    1006           GpiSetColor(hps, CLR_WHITE);
    1007           ptl.x = 1;
    1008           ptl.y = 1;
    1009           GpiMove(hps, &ptl);
    1010           ptl.y = swp.cy - 2;
    1011           GpiLine(hps, &ptl);
    1012           ptl.x = swp.cx - 2;
    1013           GpiLine(hps, &ptl);
    1014           ptl.x = 2;
    1015           ptl.y = 2;
    1016           GpiMove(hps, &ptl);
    1017           ptl.y = swp.cy - 3;
    1018           GpiLine(hps, &ptl);
    1019           ptl.x = swp.cx - 3;
    1020           GpiLine(hps, &ptl);
    1021           GpiSetColor(hps, CLR_BROWN);
    1022           ptl.x = 1;
    1023           ptl.y = 1;
    1024           GpiMove(hps, &ptl);
    1025           ptl.x = swp.cx - 2;
    1026           GpiLine(hps, &ptl);
    1027           ptl.y = swp.cy - 2;
    1028           GpiLine(hps, &ptl);
    1029           ptl.x = 2;
    1030           ptl.y = 2;
    1031           GpiMove(hps, &ptl);
    1032           ptl.x = swp.cx - 3;
    1033           GpiLine(hps, &ptl);
    1034           ptl.y = swp.cy - 3;
    1035           GpiLine(hps, &ptl);
    1036         }
    1037         WinEndPaint(hps);
     960        WinQueryWindowPos(hwnd, &swp);
     961        GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, 0);
     962        GpiSetColor(hps, ((255 << 16) | (255 << 8) | 198));
     963        GpiSetBackMix(hps, BM_LEAVEALONE);
     964        GpiSetMix(hps, FM_OVERPAINT);
     965        ptl.x = ptl.y = 0;
     966        GpiMove(hps, &ptl);
     967        ptl.x = swp.cx - 1;
     968        ptl.y = swp.cy - 1;
     969        GpiBox(hps, DRO_OUTLINEFILL, &ptl, 0, 0);
     970        tlen = WinQueryWindowTextLength(hwnd);
     971        if (tlen) {
     972          s = xmalloc(tlen + 2, pszSrcFile, __LINE__);
     973          if (s) {
     974            WinQueryWindowText(hwnd, tlen + 1, s);
     975            if (*s) {
     976              p = s;
     977              y = swp.cy - 3;
     978              extra = WinQueryWindowULong(hwnd, QWL_USER + 4);
     979              GpiSetColor(hps, 0);
     980              GpiSetMix(hps, FM_OVERPAINT);
     981              while (p && *p) {
     982                wp = NULL;
     983                pp = strchr(p, '\r');
     984                if (pp) {
     985                  wp = pp;
     986                  *pp = 0;
     987                  pp++;
     988                }
     989                GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl);
     990                ptl.x = 7;
     991                y -= aptl[TXTBOX_TOPLEFT].y;
     992                if (p != s)
     993                  y -= extra;
     994                ptl.y = y;
     995                GpiCharStringAt(hps, &ptl, strlen(p), p);
     996                if (wp)
     997                  *wp = '\r';
     998                p = pp;
     999              }
     1000            }
     1001            free(s);
     1002          }
     1003        }
     1004        if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)) && swp.cx > 6 && swp.cy > 6) {
     1005          GpiSetColor(hps, CLR_WHITE);
     1006          ptl.x = 1;
     1007          ptl.y = 1;
     1008          GpiMove(hps, &ptl);
     1009          ptl.y = swp.cy - 2;
     1010          GpiLine(hps, &ptl);
     1011          ptl.x = swp.cx - 2;
     1012          GpiLine(hps, &ptl);
     1013          ptl.x = 2;
     1014          ptl.y = 2;
     1015          GpiMove(hps, &ptl);
     1016          ptl.y = swp.cy - 3;
     1017          GpiLine(hps, &ptl);
     1018          ptl.x = swp.cx - 3;
     1019          GpiLine(hps, &ptl);
     1020          GpiSetColor(hps, CLR_BROWN);
     1021          ptl.x = 1;
     1022          ptl.y = 1;
     1023          GpiMove(hps, &ptl);
     1024          ptl.x = swp.cx - 2;
     1025          GpiLine(hps, &ptl);
     1026          ptl.y = swp.cy - 2;
     1027          GpiLine(hps, &ptl);
     1028          ptl.x = 2;
     1029          ptl.y = 2;
     1030          GpiMove(hps, &ptl);
     1031          ptl.x = swp.cx - 3;
     1032          GpiLine(hps, &ptl);
     1033          ptl.y = swp.cy - 3;
     1034          GpiLine(hps, &ptl);
     1035        }
     1036        WinEndPaint(hps);
    10381037      }
    10391038    }
     
    10621061      switch (WinQueryWindowUShort(hwnd, QWS_ID)) {
    10631062      case MAIN_LED:
    1064         hps = WinGetPS(hwnd);
    1065         hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID);
    1066         if (!fBlueLED) {
    1067           hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12);
    1068           hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12);
    1069         }
    1070         else {
    1071           hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12);
    1072           hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12);
    1073         }
    1074         if (hbmLEDoff && hbmLEDon)
    1075           WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID);
    1076         else {
    1077           if (hbmLEDoff)
    1078             GpiDeleteBitmap(hbmLEDoff);
    1079           if (hbmLEDon)
    1080             GpiDeleteBitmap(hbmLEDon);
    1081         }
    1082         if (hbmold &&
    1083             hbmLEDon &&
    1084             hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff)
    1085           GpiDeleteBitmap(hbmold);
    1086         if (hps)
    1087           WinReleasePS(hps);
    1088         break;
     1063        hps = WinGetPS(hwnd);
     1064        hbmold = (HBITMAP) WinSendMsg(hwnd, SM_QUERYHANDLE, MPVOID, MPVOID);
     1065        if (!fBlueLED) {
     1066          hbmLEDon = GpiLoadBitmap(hps, 0, LEDON_BMP, 12, 12);
     1067          hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF_BMP, 12, 12);
     1068        }
     1069        else {
     1070          hbmLEDon = GpiLoadBitmap(hps, 0, LEDON2_BMP, 12, 12);
     1071          hbmLEDoff = GpiLoadBitmap(hps, 0, LEDOFF2_BMP, 12, 12);
     1072        }
     1073        if (hbmLEDoff && hbmLEDon)
     1074          WinSendMsg(hwnd, SM_SETHANDLE, MPFROMLONG(hbmLEDoff), MPVOID);
     1075        else {
     1076          if (hbmLEDoff)
     1077            GpiDeleteBitmap(hbmLEDoff);
     1078          if (hbmLEDon)
     1079            GpiDeleteBitmap(hbmLEDon);
     1080        }
     1081        if (hbmold &&
     1082            hbmLEDon &&
     1083            hbmLEDoff && hbmold != hbmLEDon && hbmold != hbmLEDoff)
     1084          GpiDeleteBitmap(hbmold);
     1085        if (hps)
     1086          WinReleasePS(hps);
     1087        break;
    10891088      default:
    1090         SetPresParams(hwnd,
    1091                       &RGBGREY,
    1092                       &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
    1093         break;
     1089        SetPresParams(hwnd,
     1090                      &RGBGREY,
     1091                      &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
     1092        break;
    10941093      }
    10951094      return mr;
     
    11151114  case WM_BUTTON1CLICK:
    11161115    PostMsg(WinQueryWindow(hwnd, QW_PARENT),
    1117             WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID);
     1116            WM_COMMAND, MPFROM2SHORT(IDM_SHOWNOTEWND, 0), MPVOID);
    11181117    break;
    11191118
    11201119  case WM_BUTTON2CLICK:
    11211120    PostMsg(WinQueryWindow(hwnd, QW_PARENT),
    1122             WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID);
     1121            WM_COMMAND, MPFROM2SHORT(IDM_HIDENOTEWND, 0), MPVOID);
    11231122    break;
    11241123
     
    11261125  case WM_BUTTON3CLICK:
    11271126    PostMsg(WinQueryWindow(hwnd, QW_PARENT),
    1128             WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
     1127            WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
    11291128    break;
    11301129  }
     
    11491148    if (fToolbarHelp) {
    11501149      if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
    1151           && !WinQueryCapture(HWND_DESKTOP)) {
    1152         id = WinQueryWindowUShort(hwnd, QWS_ID);
    1153         tool = find_tool(id);
    1154         if (tool && tool->help && *tool->help) {
    1155 
    1156           char s[128];
    1157 
    1158           strcpy(s, tool->help);
    1159           if (tool->flags & T_DROPABLE)
    1160             strcat(s, GetPString(IDS_DROPONMETEXT));
    1161           MakeBubble(hwnd, FALSE, s);
    1162         }
     1150          && !WinQueryCapture(HWND_DESKTOP)) {
     1151        id = WinQueryWindowUShort(hwnd, QWS_ID);
     1152        tool = find_tool(id);
     1153        if (tool && tool->help && *tool->help) {
     1154
     1155          char s[128];
     1156
     1157          strcpy(s, tool->help);
     1158          if (tool->flags & T_DROPABLE)
     1159            strcat(s, GetPString(IDS_DROPONMETEXT));
     1160          MakeBubble(hwnd, FALSE, s);
     1161        }
    11631162      }
    11641163    }
     
    11691168    case IDM_HELP:
    11701169      if (hwndHelp)
    1171         WinSendMsg(hwndHelp,
    1172                    HM_DISPLAY_HELP,
    1173                    MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID));
     1170        WinSendMsg(hwndHelp,
     1171                   HM_DISPLAY_HELP,
     1172                   MPFROM2SHORT(HELP_TOOLBAR, 0), MPFROMSHORT(HM_RESOURCEID));
    11741173      break;
    11751174
    1176     case IDM_HIDEANYTOOL:               /* hide any tool */
    1177     case IDM_HIDETOOL:                  /* hide tool */
     1175    case IDM_HIDEANYTOOL:               /* hide any tool */
     1176    case IDM_HIDETOOL:                  /* hide tool */
    11781177      if (SHORT1FROMMP(mp1) == IDM_HIDETOOL)
    1179         id = WinQueryWindowUShort(hwnd, QWS_ID);
     1178        id = WinQueryWindowUShort(hwnd, QWS_ID);
    11801179      else
    1181         id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd,
    1182                                 PickToolProc, FM3ModHandle,
    1183                                 PICKBTN_FRAME, GetPString(IDS_HIDETEXT));
     1180        id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd,
     1181                                PickToolProc, FM3ModHandle,
     1182                                PICKBTN_FRAME, GetPString(IDS_HIDETEXT));
    11841183      if (id) {
    1185         tool = find_tool(id);
    1186         if (tool) {
    1187           tool->flags |= T_INVISIBLE;
    1188           fToolsChanged = TRUE;
    1189         }
     1184        tool = find_tool(id);
     1185        if (tool) {
     1186          tool->flags |= T_INVISIBLE;
     1187          fToolsChanged = TRUE;
     1188        }
    11901189      }
    11911190      break;
    11921191
    1193     case IDM_SHOWTOOLS:                 /* show all tools */
     1192    case IDM_SHOWTOOLS:                 /* show all tools */
    11941193      tool = toolhead;
    11951194      while (tool) {
    1196         tool->flags &= (~T_INVISIBLE);
    1197         tool = tool->next;
    1198         fToolsChanged = TRUE;
     1195        tool->flags &= (~T_INVISIBLE);
     1196        tool = tool->next;
     1197        fToolsChanged = TRUE;
    11991198      }
    12001199      break;
    12011200
    1202     case IDM_DELETEANYTOOL:             /* delete any button */
    1203     case IDM_DELETETOOL:                /* delete button */
     1201    case IDM_DELETEANYTOOL:             /* delete any button */
     1202    case IDM_DELETETOOL:                /* delete button */
    12041203      if (SHORT1FROMMP(mp1) == IDM_DELETETOOL)
    1205         id = WinQueryWindowUShort(hwnd, QWS_ID);
     1204        id = WinQueryWindowUShort(hwnd, QWS_ID);
    12061205      else
    1207         id =
    1208           (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
    1209                              PICKBTN_FRAME, GetPString(IDS_DELETETEXT));
     1206        id =
     1207          (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
     1208                             PICKBTN_FRAME, GetPString(IDS_DELETETEXT));
    12101209      if (id)
    1211         PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP,
    1212                 MPFROM2SHORT(id, 0), MPVOID);
     1210        PostMsg(WinQueryWindow(hwnd, QW_PARENT), UM_SETUP,
     1211                MPFROM2SHORT(id, 0), MPVOID);
    12131212      return 0;
    12141213
    1215     case IDM_EDITANYTOOL:               /* edit any button */
    1216     case IDM_EDITTOOL:                  /* edit button */
     1214    case IDM_EDITANYTOOL:               /* edit any button */
     1215    case IDM_EDITTOOL:                  /* edit button */
    12171216      if (SHORT1FROMMP(mp1) == IDM_EDITTOOL)
    1218         id = WinQueryWindowUShort(hwnd, QWS_ID);
     1217        id = WinQueryWindowUShort(hwnd, QWS_ID);
    12191218      else
    1220         id =
    1221           (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
    1222                              PICKBTN_FRAME, GetPString(IDS_EDITTEXT));
     1219        id =
     1220          (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, PickToolProc, FM3ModHandle,
     1221                             PICKBTN_FRAME, GetPString(IDS_EDITTEXT));
    12231222      if (id) {
    1224         tool = find_tool(id);
    1225         if (tool) {
    1226           if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
    1227                         ADDBTN_FRAME, (PVOID) tool))
    1228             WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
    1229                                                                      QW_PARENT),
    1230                                                       QW_PARENT), FID_CLIENT),
    1231                        WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
    1232                        MPFROM2SHORT(id, 0));
    1233         }
     1223        tool = find_tool(id);
     1224        if (tool) {
     1225          if (WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
     1226                        ADDBTN_FRAME, (PVOID) tool))
     1227            WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
     1228                                                                     QW_PARENT),
     1229                                                      QW_PARENT), FID_CLIENT),
     1230                       WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
     1231                       MPFROM2SHORT(id, 0));
     1232        }
    12341233      }
    12351234      break;
    12361235
    1237     case IDM_ADDTOOL:                   /* add tool */
     1236    case IDM_ADDTOOL:                   /* add tool */
    12381237      id = (USHORT) WinDlgBox(HWND_DESKTOP, hwnd, AddToolProc, FM3ModHandle,
    1239                               ADDBTN_FRAME, MPVOID);
     1238                              ADDBTN_FRAME, MPVOID);
    12401239      if (id && id != (USHORT) - 1)
    1241         WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
    1242                                                                 QW_PARENT),
    1243                                                   QW_PARENT), FID_CLIENT),
    1244                    WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
    1245                    MPFROM2SHORT(id, 0));
     1240        WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,
     1241                                                                QW_PARENT),
     1242                                                  QW_PARENT), FID_CLIENT),
     1243                   WM_COMMAND, MPFROM2SHORT(IDM_CREATETOOL, 0),
     1244                   MPFROM2SHORT(id, 0));
    12461245      break;
    12471246
    1248     case IDM_REORDERTOOLS:              /* reorder tools */
     1247    case IDM_REORDERTOOLS:              /* reorder tools */
    12491248      WinDlgBox(HWND_DESKTOP,
    1250                 hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID);
     1249                hwnd, ReOrderToolsProc, FM3ModHandle, RE_FRAME, MPVOID);
    12511250      break;
    12521251
     
    12541253    case IDM_LOADTOOLS:
    12551254      if (WinDlgBox(HWND_DESKTOP,
    1256                     hwnd,
    1257                     ToolIODlgProc,
    1258                     FM3ModHandle,
    1259                     SVBTN_FRAME,
    1260                     (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?
    1261                     "TRUE" : NULL))
    1262         BuildTools(hwndToolback, TRUE);
     1255                    hwnd,
     1256                    ToolIODlgProc,
     1257                    FM3ModHandle,
     1258                    SVBTN_FRAME,
     1259                    (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?
     1260                    "TRUE" : NULL))
     1261        BuildTools(hwndToolback, TRUE);
    12631262      break;
    12641263    }
     
    12851284  case DM_DRAGOVER:
    12861285    {
    1287       PDRAGINFO pDInfo;                 /* Pointer to DRAGINFO */
    1288 
    1289       pDInfo = (PDRAGINFO) mp1;         /* Get DRAGINFO pointer */
    1290       DrgAccessDraginfo(pDInfo);        /* Access DRAGINFO */
     1286      PDRAGINFO pDInfo;                 /* Pointer to DRAGINFO */
     1287
     1288      pDInfo = (PDRAGINFO) mp1;         /* Get DRAGINFO pointer */
     1289      DrgAccessDraginfo(pDInfo);        /* Access DRAGINFO */
    12911290      id = WinQueryWindowUShort(hwnd, QWS_ID);
    12921291      tool = find_tool(id);
    12931292      if (!tool) {
    1294         DrgFreeDraginfo(pDInfo);
    1295         return (MRFROM2SHORT(DOR_NEVERDROP, 0));        /* Drop not valid */
     1293        DrgFreeDraginfo(pDInfo);
     1294        return (MRFROM2SHORT(DOR_NEVERDROP, 0));        /* Drop not valid */
    12961295      }
    12971296      if (!(tool->flags & T_DROPABLE)) {
    1298         DrgFreeDraginfo(pDInfo);
    1299         return (MRFROM2SHORT(DOR_NEVERDROP, 0));        /* Drop not valid */
     1297        DrgFreeDraginfo(pDInfo);
     1298        return (MRFROM2SHORT(DOR_NEVERDROP, 0));        /* Drop not valid */
    13001299      }
    13011300      {
    1302         PDRAGITEM pDItem;               /* Pointer to DRAGITEM */
    1303 
    1304         pDItem = DrgQueryDragitemPtr(pDInfo,    /* Access DRAGITEM */
    1305                                      0);        /* Index to DRAGITEM */
    1306         if (DrgVerifyRMF(pDItem,        /* Check valid rendering */
    1307                          DRM_OS2FILE,   /* mechanisms and data */
    1308                          NULL)) {       /* formats */
    1309           if (!(tool->flags & T_EMPHASIZED)) {
    1310             tool->flags |= T_EMPHASIZED;
    1311             DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
    1312             DrgFreeDraginfo(pDInfo);
    1313           }
    1314           return (MRFROM2SHORT(DOR_DROP,        /* Return okay to drop */
    1315                                DO_MOVE));       /* Move operation valid */
    1316         }
    1317         DrgFreeDraginfo(pDInfo);
    1318       }
    1319     }
    1320     return (MRFROM2SHORT(DOR_NEVERDROP, 0));    /* Drop not valid */
     1301        PDRAGITEM pDItem;               /* Pointer to DRAGITEM */
     1302
     1303        pDItem = DrgQueryDragitemPtr(pDInfo,    /* Access DRAGITEM */
     1304                                     0);        /* Index to DRAGITEM */
     1305        if (DrgVerifyRMF(pDItem,        /* Check valid rendering */
     1306                         DRM_OS2FILE,   /* mechanisms and data */
     1307                         NULL)) {       /* formats */
     1308          if (!(tool->flags & T_EMPHASIZED)) {
     1309            tool->flags |= T_EMPHASIZED;
     1310            DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
     1311            DrgFreeDraginfo(pDInfo);
     1312          }
     1313          return (MRFROM2SHORT(DOR_DROP,        /* Return okay to drop */
     1314                               DO_MOVE));       /* Move operation valid */
     1315        }
     1316        DrgFreeDraginfo(pDInfo);
     1317      }
     1318    }
     1319    return (MRFROM2SHORT(DOR_NEVERDROP, 0));    /* Drop not valid */
    13211320
    13221321  case DM_DROPHELP:
     
    13321331    if (tool && (tool->flags & T_DROPABLE)) {
    13331332      if (tool->flags & T_EMPHASIZED) {
    1334         tool->flags &= (~T_EMPHASIZED);
    1335         DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
     1333        tool->flags &= (~T_EMPHASIZED);
     1334        DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
    13361335      }
    13371336    }
     
    13461345
    13471346      if (tool->flags & T_EMPHASIZED) {
    1348         DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
    1349         tool->flags &= (~T_EMPHASIZED);
     1347        DrawTargetEmphasis(hwnd, ((tool->flags & T_EMPHASIZED) != 0));
     1348        tool->flags &= (~T_EMPHASIZED);
    13501349      }
    13511350      memset(&cdi, 0, sizeof(cdi));
     
    13541353      CheckPmDrgLimit(cdi.pDragInfo);
    13551354      if (li) {
    1356         li->type = id;
    1357         if (!li->list || !li->list[0])
    1358           FreeListInfo(li);
    1359         else {
    1360           HWND hwndActive;
    1361 
    1362           hwndActive = TopWindow(hwndMain, (HWND) 0);
    1363           if (hwndActive) {
    1364             if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID))
    1365               FreeListInfo(li);
    1366           }
    1367           else
    1368             FreeListInfo(li);
    1369         }
     1355        li->type = id;
     1356        if (!li->list || !li->list[0])
     1357          FreeListInfo(li);
     1358        else {
     1359          HWND hwndActive;
     1360
     1361          hwndActive = TopWindow(hwndMain, (HWND) 0);
     1362          if (hwndActive) {
     1363            if (!WinSendMsg(hwndActive, UM_COMMAND, MPFROMP(li), MPVOID))
     1364              FreeListInfo(li);
     1365          }
     1366          else
     1367            FreeListInfo(li);
     1368        }
    13701369      }
    13711370    }
     
    14041403    if (!fTextTools) {
    14051404      if (!(tool->flags & T_MYICON)) {
    1406         hwndTool = WinCreateWindow(hwndT,
    1407                                    WC_TOOLBUTTONS,
    1408                                    s,
    1409                                    BS_NOPOINTERFOCUS |
    1410                                    BS_BITMAP | BS_PUSHBUTTON,
    1411                                    ctrlxpos,
    1412                                    14,
    1413                                    32,
    1414                                    32, hwndT, HWND_TOP, tool->id, NULL, NULL);
     1405        hwndTool = WinCreateWindow(hwndT,
     1406                                   WC_TOOLBUTTONS,
     1407                                   s,
     1408                                   BS_NOPOINTERFOCUS |
     1409                                   BS_BITMAP | BS_PUSHBUTTON,
     1410                                   ctrlxpos,
     1411                                   14,
     1412                                   32,
     1413                                   32, hwndT, HWND_TOP, tool->id, NULL, NULL);
    14151414      }
    14161415      if (!hwndTool) {
    1417         HBITMAP hbm = LoadBitmapFromFileNum(tool->id);
    1418 
    1419         if (hbm) {
    1420           BTNCDATA btc;
    1421 
    1422           memset(&btc, 0, sizeof(btc));
    1423           btc.cb = sizeof(btc);
    1424           btc.hImage = hbm;
    1425           hwndTool = WinCreateWindow(hwndT,
    1426                                      WC_TOOLBUTTONS,
    1427                                      NullStr,
    1428                                      BS_NOPOINTERFOCUS |
    1429                                      BS_BITMAP | BS_PUSHBUTTON,
    1430                                      ctrlxpos,
    1431                                      14,
    1432                                      32,
    1433                                      32,
    1434                                      hwndT, HWND_TOP, tool->id, &btc, NULL);
    1435           if (!hwndTool)
    1436             GpiDeleteBitmap(hbm);
    1437         }
     1416        HBITMAP hbm = LoadBitmapFromFileNum(tool->id);
     1417
     1418        if (hbm) {
     1419          BTNCDATA btc;
     1420
     1421          memset(&btc, 0, sizeof(btc));
     1422          btc.cb = sizeof(btc);
     1423          btc.hImage = hbm;
     1424          hwndTool = WinCreateWindow(hwndT,
     1425                                     WC_TOOLBUTTONS,
     1426                                     NullStr,
     1427                                     BS_NOPOINTERFOCUS |
     1428                                     BS_BITMAP | BS_PUSHBUTTON,
     1429                                     ctrlxpos,
     1430                                     14,
     1431                                     32,
     1432                                     32,
     1433                                     hwndT, HWND_TOP, tool->id, &btc, NULL);
     1434          if (!hwndTool)
     1435            GpiDeleteBitmap(hbm);
     1436        }
    14381437      }
    14391438      if (hwndTool)
    1440         tool->flags &= (~T_TEXT);
     1439        tool->flags &= (~T_TEXT);
    14411440    }
    14421441    if (!hwndTool) {
    14431442      hwndTool = WinCreateWindow(hwndT,
    1444                                 WC_TOOLBUTTONS,
    1445                                 (!tool->text && tool->id >= IDM_COMMANDSTART
    1446                                   && tool->id <
    1447                                   IDM_QUICKTOOLSTART) ? command_title(tool->
    1448                                                                       id -
    1449                                                                       IDM_COMMANDSTART)
    1450                                 : tool->text,
    1451                                 BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos,
    1452                                 2, 54, 24, hwndT, HWND_TOP, tool->id, NULL,
    1453                                 NULL);
     1443                                WC_TOOLBUTTONS,
     1444                                (!tool->text && tool->id >= IDM_COMMANDSTART
     1445                                  && tool->id <
     1446                                  IDM_QUICKTOOLSTART) ? command_title(tool->
     1447                                                                      id -
     1448                                                                      IDM_COMMANDSTART)
     1449                                : tool->text,
     1450                                BS_NOPOINTERFOCUS | BS_PUSHBUTTON, ctrlxpos,
     1451                                2, 54, 24, hwndT, HWND_TOP, tool->id, NULL,
     1452                                NULL);
    14541453      if (!hwndTool)
    1455         Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
    1456                    IDS_WINCREATEWINDOW);
     1454        Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
     1455                   IDS_WINCREATEWINDOW);
    14571456      tool->flags |= T_TEXT;
    14581457    }
    14591458    if (fToolTitles && !fTextTools) {
    14601459      hwndTool = WinCreateWindow(hwndT,
    1461                                 WC_STATIC,
    1462                                 tool->text,
    1463                                 SS_TEXT | DT_LEFT | DT_VCENTER,
    1464                                 ctrlxpos,
    1465                                 1,
    1466                                 32,
    1467                                 10,
    1468                                 hwndT,
    1469                                 HWND_TOP, tool->id + 25000, NULL, NULL);
     1460                                WC_STATIC,
     1461                                tool->text,
     1462                                SS_TEXT | DT_LEFT | DT_VCENTER,
     1463                                ctrlxpos,
     1464                                1,
     1465                                32,
     1466                                10,
     1467                                hwndT,
     1468                                HWND_TOP, tool->id + 25000, NULL, NULL);
    14701469      if (!hwndTool)
    1471         Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
    1472                    IDS_WINCREATEWINDOW);
     1470        Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
     1471                   IDS_WINCREATEWINDOW);
    14731472      else {
    1474         SetPresParams(hwndTool,
    1475                       &RGBGREY,
    1476                       &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT));
     1473        SetPresParams(hwndTool,
     1474                      &RGBGREY,
     1475                      &RGBBLACK, &RGBGREY, GetPString(IDS_2SYSTEMVIOTEXT));
    14771476      }
    14781477    }
    14791478    ctrlxpos += ((tool->flags & T_TEXT) ? 55L : 33L);
    14801479    SetPresParams(WinWindowFromID(hwndT, tool->id),
    1481                   NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));
     1480                  NULL, NULL, NULL, GetPString(IDS_8HELVTEXT));
    14821481    tool = tool->next;
    1483   }                                     // while tool
     1482  }                                     // while tool
    14841483
    14851484  hwndTool = WinCreateWindow(hwndT,
    1486                              WC_BUTTON,
    1487                              "#6010",
    1488                              BS_NOPOINTERFOCUS |
    1489                              BS_BITMAP | BS_PUSHBUTTON,
    1490                              1,
    1491                              19,
    1492                              14,
    1493                              13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL);
     1485                             WC_BUTTON,
     1486                             "#6010",
     1487                             BS_NOPOINTERFOCUS |
     1488                             BS_BITMAP | BS_PUSHBUTTON,
     1489                             1,
     1490                             19,
     1491                             14,
     1492                             13, hwndT, HWND_TOP, IDM_TOOLLEFT, NULL, NULL);
    14941493  if (!hwndTool)
    14951494    Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
    1496                IDS_WINCREATEWINDOW);
     1495               IDS_WINCREATEWINDOW);
    14971496  hwndTool =
    14981497    WinCreateWindow(hwndT, WC_BUTTON, "#6011",
    1499                     BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14,
    1500                     13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL);
     1498                    BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON, 1, 4, 14,
     1499                    13, hwndT, HWND_TOP, IDM_TOOLRIGHT, NULL, NULL);
    15011500  if (!hwndTool)
    15021501    Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
    1503                IDS_WINCREATEWINDOW);
     1502               IDS_WINCREATEWINDOW);
    15041503  if (resize)
    15051504    ResizeTools(hwndT);
     
    15071506
    15081507static MRESULT EXPENTRY CommandLineProc(HWND hwnd, ULONG msg, MPARAM mp1,
    1509                                         MPARAM mp2)
     1508                                        MPARAM mp2)
    15101509{
    15111510  PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
     
    15241523
    15251524      if (WinQueryWindowUShort((HWND) mp1, QWS_ID) == COMMAND_BUTTON)
    1526         break;
     1525        break;
    15271526      if (!WinQueryWindowProcess((HWND) mp1, &pid, &tid) || pid == mypid)
    1528         WinDestroyWindow(hwnd);
     1527        WinDestroyWindow(hwnd);
    15291528    }
    15301529    break;
     
    15371536      lbup = TRUE;
    15381537      if (WinDlgBox(HWND_DESKTOP,
    1539                     hwnd,
    1540                     CmdLine2DlgProc,
    1541                     FM3ModHandle, EXEC2_FRAME, MPFROMP(cl))) {
    1542         lstrip(cl);
    1543         WinSetWindowText(hwnd, cl);
     1538                    hwnd,
     1539                    CmdLine2DlgProc,
     1540                    FM3ModHandle, EXEC2_FRAME, MPFROMP(cl))) {
     1541        lstrip(cl);
     1542        WinSetWindowText(hwnd, cl);
    15441543      }
    15451544      PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
     
    15601559    case COMMAND_BUTTON:
    15611560      if (!lbup)
    1562         PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
     1561        PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    15631562      break;
    15641563    }
     
    15791578      bstrip(cl + len);
    15801579      if (strlen(cl) > len) {
    1581         WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
    1582                    UM_SETUP, MPFROMP(cl + len), MPVOID);
    1583         WinQueryWindowText(hwndStatus, CCHMAXPATH, directory);
    1584         bstrip(directory);
    1585         if (*directory && (IsRoot(directory) || !IsFile(directory))) {
    1586           if (!FM2Command(directory, cl + len)) {
    1587             hwndCnr = TopWindow(hwndMain, (HWND) 0);
    1588             if (hwndCnr) {
    1589               hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT);
    1590               if (hwndCnr) {
    1591                 hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR);
    1592                 if (hwndCnr)
    1593                   list = BuildList(hwndCnr);
    1594               }
    1595             }
    1596             WinSetActiveWindow(HWND_DESKTOP, hwndCnr);
    1597             if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds)
    1598               save_cmdlines(FALSE);
    1599             ExecOnList(hwndCnr,
    1600                        cl,
    1601                        WINDOWED | ((fKeepCmdLine) ?
    1602                                    SEPARATEKEEP : SEPARATE),
    1603                        directory, list, NULL, pszSrcFile, __LINE__);
    1604             if (list)
    1605               free(list);
    1606             WinDestroyWindow(hwnd);
    1607             break;
    1608           }
    1609         }
     1580        WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
     1581                   UM_SETUP, MPFROMP(cl + len), MPVOID);
     1582        WinQueryWindowText(hwndStatus, CCHMAXPATH, directory);
     1583        bstrip(directory);
     1584        if (*directory && (IsRoot(directory) || !IsFile(directory))) {
     1585          if (!FM2Command(directory, cl + len)) {
     1586            hwndCnr = TopWindow(hwndMain, (HWND) 0);
     1587            if (hwndCnr) {
     1588              hwndCnr = WinWindowFromID(hwndCnr, FID_CLIENT);
     1589              if (hwndCnr) {
     1590                hwndCnr = WinWindowFromID(hwndCnr, DIR_CNR);
     1591                if (hwndCnr)
     1592                  list = BuildList(hwndCnr);
     1593              }
     1594            }
     1595            WinSetActiveWindow(HWND_DESKTOP, hwndCnr);
     1596            if (add_cmdline(cl + len, FALSE) && fSaveMiniCmds)
     1597              save_cmdlines(FALSE);
     1598            ExecOnList(hwndCnr,
     1599                       cl,
     1600                       WINDOWED | ((fKeepCmdLine) ?
     1601                                   SEPARATEKEEP : SEPARATE),
     1602                       directory, list, NULL, pszSrcFile, __LINE__);
     1603            if (list)
     1604              free(list);
     1605            WinDestroyWindow(hwnd);
     1606            break;
     1607          }
     1608        }
    16101609      }
    16111610      WinSendMsg(hwnd, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
     
    16161615    if (!lbup && !(SHORT1FROMMP(mp1) & KC_KEYUP)) {
    16171616      if (SHORT1FROMMP(mp1) & KC_VIRTUALKEY) {
    1618         if ((SHORT1FROMMP(mp2) & 255) == '\r')
    1619           PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
    1620         else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b)
    1621           WinDestroyWindow(hwnd);
    1622         else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN)
    1623           PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
     1617        if ((SHORT1FROMMP(mp2) & 255) == '\r')
     1618          PostMsg(hwnd, UM_OPENWINDOWFORME, MPVOID, MPVOID);
     1619        else if ((SHORT1FROMMP(mp2) & 0xff) == 0x1b)
     1620          WinDestroyWindow(hwnd);
     1621        else if (SHORT2FROMMP(mp2) == VK_UP || SHORT2FROMMP(mp2) == VK_DOWN)
     1622          PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    16241623      }
    16251624    }
    16261625    else if ((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) &&
    1627              ((SHORT2FROMMP(mp2) == VK_UP ||
    1628                SHORT2FROMMP(mp2) == VK_DOWN) ||
    1629               (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r')))
     1626             ((SHORT2FROMMP(mp2) == VK_UP ||
     1627               SHORT2FROMMP(mp2) == VK_DOWN) ||
     1628              (SHORT1FROMMP(mp2) == '\x1b') || (SHORT1FROMMP(mp2) == '\r')))
    16301629      return 0;
    16311630    break;
     
    16531652      rgb.bRed = (BYTE)128;
    16541653      SetPresParams(hwnd,
    1655                     &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT));
     1654                    &RGBGREY, &rgb, &RGBGREY, GetPString(IDS_8HELVTEXT));
    16561655      SetTargetDir(hwnd, TRUE);
    16571656    }
     
    16831682  case WM_CONTROLPOINTER:
    16841683    if (!fNoFinger &&
    1685         (SHORT1FROMMP(mp1) >= IDM_DRIVEA &&
    1686         SHORT1FROMMP(mp1) < IDM_DRIVEA + 26))
     1684        (SHORT1FROMMP(mp1) >= IDM_DRIVEA &&
     1685        SHORT1FROMMP(mp1) < IDM_DRIVEA + 26))
    16871686      return MRFROMLONG(hptrFinger);
    16881687    break;
     
    16941693      *dv = 0;
    16951694      WinQueryWindowText(WinWindowFromID(hwnd, SHORT1FROMMP(mp1) + 50),
    1696                         2, dv);
     1695                        2, dv);
    16971696      if (isalpha(*dv)) {
    16981697
    1699         HWND hwndActive;
    1700 
    1701         dv[1] = ':';
    1702         dv[2] = '\\';
    1703         dv[3] = 0;
    1704         hwndActive = TopWindow(hwnd, (HWND) 0);
    1705         if (hwndActive)
    1706           WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT),
    1707                      UM_DRIVECMD, MPFROMP(dv), MPVOID);
     1698        HWND hwndActive;
     1699
     1700        dv[1] = ':';
     1701        dv[2] = '\\';
     1702        dv[3] = 0;
     1703        hwndActive = TopWindow(hwnd, (HWND) 0);
     1704        if (hwndActive)
     1705          WinSendMsg(WinWindowFromID(hwndActive, FID_CLIENT),
     1706                     UM_DRIVECMD, MPFROMP(dv), MPVOID);
    17081707      }
    17091708    }
     
    17331732  case WM_MOUSEMOVE:
    17341733    if (fDrivebarHelp &&
    1735         (!hwndBubble ||
    1736         WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
    1737         !WinQueryCapture(HWND_DESKTOP)) {
     1734        (!hwndBubble ||
     1735        WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
     1736        !WinQueryCapture(HWND_DESKTOP)) {
    17381737      id = WinQueryWindowUShort(hwnd, QWS_ID);
    17391738      if (helpid != id) {
    1740         helpid = id;
    1741         PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID);
     1739        helpid = id;
     1740        PostMsg(MainObjectHwnd, UM_SETUP6, MPFROMLONG((ULONG) hwnd), MPVOID);
    17421741      }
    17431742      else
    1744         helpid = 0;
     1743        helpid = 0;
    17451744    }
    17461745    break;
     
    17491748    if (helpid == WinQueryWindowUShort(hwnd, QWS_ID)) {
    17501749      if ((char *)mp1 &&
    1751           (!hwndBubble ||
    1752            WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
    1753           !WinQueryCapture(HWND_DESKTOP)) {
    1754 
    1755         RECTL rcl;
    1756         POINTL ptl;
    1757 
    1758         WinQueryPointerPos(HWND_DESKTOP, &ptl);
    1759         WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
    1760         WinQueryWindowRect(hwnd, &rcl);
    1761         if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl))
    1762           BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);
     1750          (!hwndBubble ||
     1751           WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
     1752          !WinQueryCapture(HWND_DESKTOP)) {
     1753
     1754        RECTL rcl;
     1755        POINTL ptl;
     1756
     1757        WinQueryPointerPos(HWND_DESKTOP, &ptl);
     1758        WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
     1759        WinQueryWindowRect(hwnd, &rcl);
     1760        if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl))
     1761          BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);
    17631762      }
    17641763    }
     
    17791778    *szDrv = 0;
    17801779    WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1781                                        id + 50), sizeof(szDrv), szDrv);
     1780                                       id + 50), sizeof(szDrv), szDrv);
    17821781    if (isalpha(*szDrv)) {
    17831782      hwndMenu = WinLoadMenu(HWND_DESKTOP, FM3ModHandle, MAIN_DRIVES);
    17841783      if (hwndMenu) {
    1785         BOOL rdy;
    1786         CHAR chDrv = *szDrv;
    1787         UINT iDrv;
    1788 
    1789         strcpy(szDrv + 2, "\\");
    1790         MakeValidDir(szDrv);
    1791         // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c
    1792         rdy = toupper(*szDrv) == toupper(chDrv);
    1793         iDrv = toupper(*szDrv) - 'A';
    1794         if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE)
    1795           WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE);
    1796 
    1797         if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) {
    1798           WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE);
    1799           WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE);
    1800           WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE);
    1801           WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE);
    1802         }
    1803         if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) {
    1804           WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE);
    1805           WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE);
    1806           WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE);
    1807         }
    1808         if (!rdy) {
    1809           WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE);
    1810           WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE);
    1811           WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE);
    1812           WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE);
    1813           WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE);
    1814         }
    1815         /* fixme to be gone?
    1816            if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) {
    1817            WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE);
    1818            }
    1819         */
    1820         PopupMenu(hwnd, hwnd, hwndMenu);
     1784        BOOL rdy;
     1785        CHAR chDrv = *szDrv;
     1786        UINT iDrv;
     1787
     1788        strcpy(szDrv + 2, "\\");
     1789        MakeValidDir(szDrv);
     1790        // Disable menus if MakeValidDir changes drive letter fixme this section doesn't do anything see treecnt.c
     1791        rdy = toupper(*szDrv) == toupper(chDrv);
     1792        iDrv = toupper(*szDrv) - 'A';
     1793        if (!rdy || ~driveflags[iDrv] & DRIVE_REMOTE)
     1794          WinEnableMenuItem(hwndMenu, IDM_DETACH, FALSE);
     1795
     1796        if (!rdy || driveflags[iDrv] & DRIVE_NOTWRITEABLE) {
     1797          WinEnableMenuItem(hwndMenu, IDM_MKDIR, FALSE);
     1798          WinEnableMenuItem(hwndMenu, IDM_FORMAT, FALSE);
     1799          WinEnableMenuItem(hwndMenu, IDM_OPTIMIZE, FALSE);
     1800          WinEnableMenuItem(hwndMenu, IDM_UNDELETE, FALSE);
     1801        }
     1802        if (!rdy || ~driveflags[iDrv] & DRIVE_REMOVABLE) {
     1803          WinEnableMenuItem(hwndMenu, IDM_EJECT, FALSE);
     1804          WinEnableMenuItem(hwndMenu, IDM_LOCK, FALSE);
     1805          WinEnableMenuItem(hwndMenu, IDM_UNLOCK, FALSE);
     1806        }
     1807        if (!rdy) {
     1808          WinEnableMenuItem(hwndMenu, IDM_INFO, FALSE);
     1809          WinEnableMenuItem(hwndMenu, IDM_ARCHIVE, FALSE);
     1810          WinEnableMenuItem(hwndMenu, IDM_SIZES, FALSE);
     1811          WinEnableMenuItem(hwndMenu, IDM_SHOWALLFILES, FALSE);
     1812          WinEnableMenuItem(hwndMenu, IDM_CHKDSK, FALSE);
     1813        }
     1814        /* fixme to be gone?
     1815           if (!rdy || ~driveflags[iDrv] & DRIVE_CDROM) {
     1816           WinEnableMenuItem(hwndMenu, IDM_CLOSETRAY, FALSE);
     1817           }
     1818        */
     1819        PopupMenu(hwnd, hwnd, hwndMenu);
    18211820      }
    18221821    }
     
    18331832    *szDrv = 0;
    18341833    WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1835                                        id + 50), sizeof(szDrv), szDrv);
     1834                                       id + 50), sizeof(szDrv), szDrv);
    18361835    if (isalpha(*szDrv)) {
    18371836      strcat(szDrv, "\\");
    18381837      if (!FindDirCnrByName(szDrv, TRUE))
    1839         OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);
     1838        OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szDrv);
    18401839    }
    18411840    break;
     
    18491848    *szDrv = 0;
    18501849    WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1851                                        id + 50), sizeof(szDrv), szDrv);
     1850                                       id + 50), sizeof(szDrv), szDrv);
    18521851    if (isalpha(*szDrv)) {
    18531852      strcat(szDrv, "\\");
     
    18601859    *szDrv = 0;
    18611860    WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1862                                        id + 50), sizeof(szDrv), szDrv);
     1861                                       id + 50), sizeof(szDrv), szDrv);
    18631862    if (isalpha(*szDrv) &&
    1864         !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
     1863        !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
    18651864      if (!emphasized) {
    1866         emphasized = TRUE;
    1867         DrawTargetEmphasis(hwnd, emphasized);
     1865        emphasized = TRUE;
     1866        DrawTargetEmphasis(hwnd, emphasized);
    18681867      }
    18691868      if (AcceptOneDrop(hwnd, mp1, mp2))
    1870         return MRFROM2SHORT(DOR_DROP, DO_MOVE);
     1869        return MRFROM2SHORT(DOR_DROP, DO_MOVE);
    18711870      return MRFROM2SHORT(DOR_NEVERDROP, 0);
    18721871    }
     
    18771876    *szDrv = 0;
    18781877    WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1879                                        id + 50), sizeof(szDrv), szDrv);
     1878                                       id + 50), sizeof(szDrv), szDrv);
    18801879    if (isalpha(*szDrv) &&
    1881         !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
     1880        !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
    18821881      if (emphasized) {
    1883         emphasized = FALSE;
    1884         DrawTargetEmphasis(hwnd, emphasized);
     1882        emphasized = FALSE;
     1883        DrawTargetEmphasis(hwnd, emphasized);
    18851884      }
    18861885    }
     
    18911890    *szDrv = 0;
    18921891    WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1893                                        id + 50), sizeof(szDrv), szDrv);
     1892                                       id + 50), sizeof(szDrv), szDrv);
    18941893    if (isalpha(*szDrv) &&
    1895         !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
     1894        !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
    18961895      DropHelp(mp1, mp2, hwnd, GetPString(IDS_DRIVEDROPHELP));
    18971896      return 0;
     
    19031902    *szDrv = 0;
    19041903    WinQueryWindowText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    1905                                        id + 50), sizeof(szDrv), szDrv);
     1904                                       id + 50), sizeof(szDrv), szDrv);
    19061905    if (isalpha(*szDrv) &&
    1907         !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
     1906        !(driveflags[toupper(*szDrv) - 'A'] & DRIVE_NOTWRITEABLE)) {
    19081907
    19091908      CNRDRAGINFO cnd;
     
    19121911
    19131912      if (emphasized) {
    1914         emphasized = FALSE;
    1915         DrawTargetEmphasis(hwnd, emphasized);
     1913        emphasized = FALSE;
     1914        DrawTargetEmphasis(hwnd, emphasized);
    19161915      }
    19171916      memset(&cnd, 0, sizeof(cnd));
     
    19191918      cnd.pRecord = NULL;
    19201919      li = DoFileDrop(hwnd,
    1921                       NULL,
    1922                       TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd));
     1920                      NULL,
     1921                      TRUE, MPFROM2SHORT(TREE_CNR, CN_DROP), MPFROMP(&cnd));
    19231922      CheckPmDrgLimit(cnd.pDragInfo);
    19241923      if (li) {
    1925         strcpy(li->targetpath, szDrv);
    1926         strcat(li->targetpath, "\\");
    1927         if (li->list && li->list[0] && IsRoot(li->list[0]))
    1928           li->type = DO_LINK;
    1929         else if (fDragndropDlg && (!*li->arcname || !li->info)) {
    1930 
    1931           CHECKLIST cl;
    1932 
    1933           memset(&cl, 0, sizeof(cl));
    1934           cl.size = sizeof(cl);
    1935           cl.flags = li->type;
    1936           cl.list = li->list;
    1937           cl.cmd = li->type;
    1938           cl.prompt = li->targetpath;
    1939           li->type = WinDlgBox(HWND_DESKTOP,
    1940                                hwndMain,
    1941                                DropListProc,
    1942                                FM3ModHandle, DND_FRAME, MPFROMP(&cl));
    1943           if (li->type == DID_ERROR)
    1944                   Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
    1945                             "Drag & Drop Dialog");
    1946           if (!li->type) {
    1947             FreeListInfo(li);
    1948             return 0;
    1949           }
    1950           li->list = cl.list;
    1951           if (!li->list || !li->list[0]) {
    1952             FreeListInfo(li);
    1953             return 0;
    1954           }
    1955         }
    1956         else {
    1957           if (!WinDlgBox(HWND_DESKTOP,
    1958                         hwndMain,
    1959                         WalkDlgProc,
    1960                         FM3ModHandle,
    1961                         WALK_FRAME,
    1962                         MPFROMP(li->targetpath)) || !*li->targetpath) {
    1963             FreeListInfo(li);
    1964             return 0;
    1965           }
    1966         }
    1967         switch (li->type) {
    1968         case DND_LAUNCH:
    1969           strcat(li->targetpath, " %a");
    1970           ExecOnList(hwndMain,
    1971                      li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL,
    1972                      pszSrcFile, __LINE__);
    1973           FreeList(li->list);
    1974           li->list = NULL;
    1975           break;
    1976         case DO_LINK:
    1977           if (fLinkSetsIcon) {
    1978             li->type = IDM_SETICON;
    1979             action = UM_MASSACTION;
    1980           }
    1981           else
    1982             li->type = IDM_COMPARE;
    1983           break;
    1984         case DND_EXTRACT:
    1985           if (*li->targetpath && !IsFile(li->targetpath))
    1986             li->type = IDM_EXTRACT;
    1987           break;
    1988         case DND_MOVE:
    1989           li->type = IDM_MOVE;
    1990           if (*li->targetpath && IsFile(li->targetpath) == 1) {
    1991             action = UM_MASSACTION;
    1992             li->type = IDM_ARCHIVEM;
    1993           }
    1994           break;
    1995         case DND_WILDMOVE:
    1996           li->type = IDM_WILDMOVE;
    1997           if (*li->targetpath && IsFile(li->targetpath) == 1) {
    1998             action = UM_MASSACTION;
    1999             li->type = IDM_ARCHIVEM;
    2000           }
    2001           break;
    2002         case DND_OBJECT:
    2003           li->type = IDM_OBJECT;
    2004           action = UM_MASSACTION;
    2005           break;
    2006         case DND_SHADOW:
    2007           li->type = IDM_SHADOW;
    2008           action = UM_MASSACTION;
    2009           break;
    2010         case DND_COMPARE:
    2011           li->type = IDM_COMPARE;
    2012           break;
    2013         case DND_SETICON:
    2014           action = UM_MASSACTION;
    2015           li->type = IDM_SETICON;
    2016           break;
    2017         case DND_COPY:
    2018           li->type = IDM_COPY;
    2019           if (*li->targetpath && IsFile(li->targetpath) == 1) {
    2020             action = UM_MASSACTION;
    2021             li->type = IDM_ARCHIVE;
    2022           }
    2023           break;
    2024         case DND_WILDCOPY:
    2025           li->type = IDM_WILDCOPY;
    2026           if (*li->targetpath && IsFile(li->targetpath) == 1) {
    2027             action = UM_MASSACTION;
    2028             li->type = IDM_ARCHIVE;
    2029           }
    2030           break;
    2031         default:
    2032           if (*li->arcname && li->info) {
    2033             action = UM_MASSACTION;
    2034             li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM :
    2035               IDM_FAKEEXTRACT;
    2036           }
    2037           else if (*li->targetpath && IsFile(li->targetpath) == 1) {
    2038             action = UM_MASSACTION;
    2039             li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
    2040           }
    2041           else
    2042             li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
    2043           break;
    2044         }
    2045         if (!li->list || !li->list[0])
    2046           FreeListInfo(li);
    2047         else
    2048           WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));
     1924        strcpy(li->targetpath, szDrv);
     1925        strcat(li->targetpath, "\\");
     1926        if (li->list && li->list[0] && IsRoot(li->list[0]))
     1927          li->type = DO_LINK;
     1928        else if (fDragndropDlg && (!*li->arcname || !li->info)) {
     1929
     1930          CHECKLIST cl;
     1931
     1932          memset(&cl, 0, sizeof(cl));
     1933          cl.size = sizeof(cl);
     1934          cl.flags = li->type;
     1935          cl.list = li->list;
     1936          cl.cmd = li->type;
     1937          cl.prompt = li->targetpath;
     1938          li->type = WinDlgBox(HWND_DESKTOP,
     1939                               hwndMain,
     1940                               DropListProc,
     1941                               FM3ModHandle, DND_FRAME, MPFROMP(&cl));
     1942          if (li->type == DID_ERROR)
     1943                  Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
     1944                            "Drag & Drop Dialog");
     1945          if (!li->type) {
     1946            FreeListInfo(li);
     1947            return 0;
     1948          }
     1949          li->list = cl.list;
     1950          if (!li->list || !li->list[0]) {
     1951            FreeListInfo(li);
     1952            return 0;
     1953          }
     1954        }
     1955        else {
     1956          if (!WinDlgBox(HWND_DESKTOP,
     1957                        hwndMain,
     1958                        WalkDlgProc,
     1959                        FM3ModHandle,
     1960                        WALK_FRAME,
     1961                        MPFROMP(li->targetpath)) || !*li->targetpath) {
     1962            FreeListInfo(li);
     1963            return 0;
     1964          }
     1965        }
     1966        switch (li->type) {
     1967        case DND_LAUNCH:
     1968          strcat(li->targetpath, " %a");
     1969          ExecOnList(hwndMain,
     1970                     li->targetpath, PROMPT | WINDOWED, NULL, li->list, NULL,
     1971                     pszSrcFile, __LINE__);
     1972          FreeList(li->list);
     1973          li->list = NULL;
     1974          break;
     1975        case DO_LINK:
     1976          if (fLinkSetsIcon) {
     1977            li->type = IDM_SETICON;
     1978            action = UM_MASSACTION;
     1979          }
     1980          else
     1981            li->type = IDM_COMPARE;
     1982          break;
     1983        case DND_EXTRACT:
     1984          if (*li->targetpath && !IsFile(li->targetpath))
     1985            li->type = IDM_EXTRACT;
     1986          break;
     1987        case DND_MOVE:
     1988          li->type = IDM_MOVE;
     1989          if (*li->targetpath && IsFile(li->targetpath) == 1) {
     1990            action = UM_MASSACTION;
     1991            li->type = IDM_ARCHIVEM;
     1992          }
     1993          break;
     1994        case DND_WILDMOVE:
     1995          li->type = IDM_WILDMOVE;
     1996          if (*li->targetpath && IsFile(li->targetpath) == 1) {
     1997            action = UM_MASSACTION;
     1998            li->type = IDM_ARCHIVEM;
     1999          }
     2000          break;
     2001        case DND_OBJECT:
     2002          li->type = IDM_OBJECT;
     2003          action = UM_MASSACTION;
     2004          break;
     2005        case DND_SHADOW:
     2006          li->type = IDM_SHADOW;
     2007          action = UM_MASSACTION;
     2008          break;
     2009        case DND_COMPARE:
     2010          li->type = IDM_COMPARE;
     2011          break;
     2012        case DND_SETICON:
     2013          action = UM_MASSACTION;
     2014          li->type = IDM_SETICON;
     2015          break;
     2016        case DND_COPY:
     2017          li->type = IDM_COPY;
     2018          if (*li->targetpath && IsFile(li->targetpath) == 1) {
     2019            action = UM_MASSACTION;
     2020            li->type = IDM_ARCHIVE;
     2021          }
     2022          break;
     2023        case DND_WILDCOPY:
     2024          li->type = IDM_WILDCOPY;
     2025          if (*li->targetpath && IsFile(li->targetpath) == 1) {
     2026            action = UM_MASSACTION;
     2027            li->type = IDM_ARCHIVE;
     2028          }
     2029          break;
     2030        default:
     2031          if (*li->arcname && li->info) {
     2032            action = UM_MASSACTION;
     2033            li->type = (li->type == DO_MOVE) ? IDM_FAKEEXTRACTM :
     2034              IDM_FAKEEXTRACT;
     2035          }
     2036          else if (*li->targetpath && IsFile(li->targetpath) == 1) {
     2037            action = UM_MASSACTION;
     2038            li->type = (li->type == DO_MOVE) ? IDM_ARCHIVEM : IDM_ARCHIVE;
     2039          }
     2040          else
     2041            li->type = (li->type == DO_MOVE) ? IDM_MOVE : IDM_COPY;
     2042          break;
     2043        }
     2044        if (!li->list || !li->list[0])
     2045          FreeListInfo(li);
     2046        else
     2047          WinSendMsg(hwndTree, UM_ACTION, MPFROMP(li), MPFROMLONG(action));
    20492048      }
    20502049      return 0;
     
    20802079    for (x = 0; x < 26; x++) {
    20812080      if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) {
    2082         if (x > 1) {
    2083           if (driveflags[x] & DRIVE_CDROM)
    2084             iconid = CDROM_ICON;
    2085           else
    2086             iconid = (driveflags[x] & DRIVE_REMOVABLE) ?
    2087               REMOVABLE_ICON :
    2088                      (driveflags[x] & DRIVE_VIRTUAL) ?
    2089                       VIRTUAL_ICON :
    2090               (driveflags[x] & DRIVE_REMOTE) ?
    2091               REMOTE_ICON :
    2092                      (driveflags[x] & DRIVE_RAMDISK) ?
    2093                       RAMDISK_ICON :
    2094                      (driveflags[x] & DRIVE_ZIPSTREAM) ?
    2095                       ZIPSTREAM_ICON :DRIVE_ICON;
    2096         }
    2097         else
    2098           iconid = FLOPPY_ICON;
    2099         sprintf(s, "#%lu", iconid);
    2100         hwndB = WinCreateWindow(hwndT,
    2101                                 WC_DRIVEBUTTONS,
    2102                                 s,
    2103                                 BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,
    2104                                 0,
    2105                                 0,
    2106                                 28,
    2107                                 18,
    2108                                 hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL);
    2109         if (!hwndB)
    2110           Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
    2111                      IDS_WINCREATEWINDOW);
    2112         else {
    2113           WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
    2114           sprintf(s, "%c:", (CHAR) x + 'A');
    2115           hwndB = WinCreateWindow(hwndT,
    2116                                   WC_STATIC,
    2117                                   s,
    2118                                   SS_TEXT | DT_LEFT | DT_VCENTER,
    2119                                   0,
    2120                                   0,
    2121                                   10,
    2122                                   18,
    2123                                   hwndT,
    2124                                   HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL);
    2125           if (!hwndB)
    2126             Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
    2127                        IDS_WINCREATEWINDOW);
    2128           else {
    2129             SetPresParams(hwndB,
    2130                           &RGBGREY,
    2131                           &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
    2132             WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
    2133           }
    2134           y++;
    2135         }
    2136       }
    2137     }                                   // for
    2138   }                                     // if drivebar
     2081        if (x > 1) {
     2082          if (driveflags[x] & DRIVE_CDROM)
     2083            iconid = CDROM_ICON;
     2084          else
     2085            iconid = (driveflags[x] & DRIVE_REMOVABLE) ?
     2086              REMOVABLE_ICON :
     2087                     (driveflags[x] & DRIVE_VIRTUAL) ?
     2088                      VIRTUAL_ICON :
     2089              (driveflags[x] & DRIVE_REMOTE) ?
     2090              REMOTE_ICON :
     2091                     (driveflags[x] & DRIVE_RAMDISK) ?
     2092                      RAMDISK_ICON :
     2093                     (driveflags[x] & DRIVE_ZIPSTREAM) ?
     2094                      ZIPSTREAM_ICON :DRIVE_ICON;
     2095        }
     2096        else
     2097          iconid = FLOPPY_ICON;
     2098        sprintf(s, "#%lu", iconid);
     2099        hwndB = WinCreateWindow(hwndT,
     2100                                WC_DRIVEBUTTONS,
     2101                                s,
     2102                                BS_NOPOINTERFOCUS | BS_BITMAP | BS_PUSHBUTTON,
     2103                                0,
     2104                                0,
     2105                                28,
     2106                                18,
     2107                                hwndT, HWND_TOP, y + IDM_DRIVEA, NULL, NULL);
     2108        if (!hwndB)
     2109          Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
     2110                     IDS_WINCREATEWINDOW);
     2111        else {
     2112          WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
     2113          sprintf(s, "%c:", (CHAR) x + 'A');
     2114          hwndB = WinCreateWindow(hwndT,
     2115                                  WC_STATIC,
     2116                                  s,
     2117                                  SS_TEXT | DT_LEFT | DT_VCENTER,
     2118                                  0,
     2119                                  0,
     2120                                  10,
     2121                                  18,
     2122                                  hwndT,
     2123                                  HWND_TOP, y + IDM_DRIVEATEXT, NULL, NULL);
     2124          if (!hwndB)
     2125            Win_Error2(hwndT, HWND_DESKTOP, pszSrcFile, __LINE__,
     2126                       IDS_WINCREATEWINDOW);
     2127          else {
     2128            SetPresParams(hwndB,
     2129                          &RGBGREY,
     2130                          &RGBBLACK, &RGBGREY, GetPString(IDS_6HELVTEXT));
     2131            WinSetWindowPos(hwndB, HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER);
     2132          }
     2133          y++;
     2134        }
     2135      }
     2136    }                                   // for
     2137  }                                     // if drivebar
    21392138  PostMsg(WinQueryWindow(hwndT, QW_PARENT),
    2140           WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     2139          WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    21412140}
    21422141
     
    21542153    WinQueryWindowRect(hwndT, &rcl);
    21552154    xwidth = rcl.xRight - ((WinQuerySysValue(HWND_DESKTOP,
    2156                                              SV_CYSIZEBORDER) * 2) + 2);
     2155                                             SV_CYSIZEBORDER) * 2) + 2);
    21572156  }
    21582157  henum = WinBeginEnumWindows(hwndT);
     
    21632162      ctrlxsize = 28;
    21642163    WinSetWindowPos(hwndB,
    2165                     HWND_TOP,
    2166                     ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW);
     2164                    HWND_TOP,
     2165                    ctrlxpos, ctrlypos, ctrlxsize, 18, SWP_MOVE | SWP_SHOW);
    21672166    ctrlxpos += (ctrlxsize + 2);
    21682167    if (ctrlxsize == 10) {
    21692168      if (ctrlxpos + (42 + ((fShowTarget && DriveLines == 0) ?
    2170                             256 : 0)) > xwidth) {
    2171         ctrlxpos = 2;
    2172         ctrlypos += 18;
    2173         DriveLines++;
     2169                            256 : 0)) > xwidth) {
     2170        ctrlxpos = 2;
     2171        ctrlypos += 18;
     2172        DriveLines++;
    21742173      }
    21752174    }
     
    21902189
    21912190      SetPresParams(hwnd,
    2192                     &RGBGREY,
    2193                     &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT));
     2191                    &RGBGREY,
     2192                    &RGBBLACK, &RGBGREY, GetPString(IDS_8HELVBOLDTEXT));
    21942193      return mr;
    21952194    }
     
    22012200
    22022201      cbRetLen = WinQueryPresParam(hwnd,
    2203                                    (ULONG) mp1,
    2204                                    0,
    2205                                    &AttrFound,
    2206                                    (ULONG) sizeof(AttrValue), &AttrValue, 0);
     2202                                   (ULONG) mp1,
     2203                                   0,
     2204                                   &AttrFound,
     2205                                   (ULONG) sizeof(AttrValue), &AttrValue, 0);
    22072206      if (cbRetLen) {
    2208         //switch (AttrFound) {
    2209         //case PP_FONTNAMESIZE:
    2210           PostMsg(WinQueryWindow(hwnd, QW_PARENT),
    2211                   WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    2212 // JBS2   break;
     2207        //switch (AttrFound) {
     2208        //case PP_FONTNAMESIZE:
     2209          PostMsg(WinQueryWindow(hwnd, QW_PARENT),
     2210                  WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     2211// JBS2   break;
    22132212
    22142213      }
     
    22282227      WinQueryWindowPos(hwndTree, &swp);
    22292228      if (!(swp.fl & SWP_MAXIMIZE))
    2230         fl |= SWP_RESTORE;
     2229        fl |= SWP_RESTORE;
    22312230      WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, fl);
    22322231    }
     
    22612260
    22622261      if (fOtherHelp) {
    2263         if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
    2264             && !WinQueryCapture(HWND_DESKTOP)) {
    2265           switch (id) {
    2266           case IDM_ATTRS:
    2267             if (WinQueryWindowTextLength(hwnd))
    2268               s = GetPString(IDS_ATTRSBUTTONHELP);
    2269             break;
    2270           case IDM_INFO:
    2271             if (WinQueryWindowTextLength(hwnd))
    2272               s = GetPString(IDS_INFOBUTTONHELP);
    2273             break;
    2274           case IDM_RENAME:
    2275             if (WinQueryWindowTextLength(hwnd))
    2276               s = GetPString(IDS_NAMEBUTTONHELP);
    2277             break;
    2278           case MAIN_STATUS2:
    2279             if (!hwndE)
    2280               s = GetPString(IDS_STATUS2HELP);
    2281             break;
    2282           default:
    2283             break;
    2284           }
    2285           if (s)
    2286             MakeBubble(hwnd, FALSE, s);
    2287           else if (hwndBubble)
    2288             WinDestroyWindow(hwndBubble);
    2289         }
     2262        if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
     2263            && !WinQueryCapture(HWND_DESKTOP)) {
     2264          switch (id) {
     2265          case IDM_ATTRS:
     2266            if (WinQueryWindowTextLength(hwnd))
     2267              s = GetPString(IDS_ATTRSBUTTONHELP);
     2268            break;
     2269          case IDM_INFO:
     2270            if (WinQueryWindowTextLength(hwnd))
     2271              s = GetPString(IDS_INFOBUTTONHELP);
     2272            break;
     2273          case IDM_RENAME:
     2274            if (WinQueryWindowTextLength(hwnd))
     2275              s = GetPString(IDS_NAMEBUTTONHELP);
     2276            break;
     2277          case MAIN_STATUS2:
     2278            if (!hwndE)
     2279              s = GetPString(IDS_STATUS2HELP);
     2280            break;
     2281          default:
     2282            break;
     2283          }
     2284          if (s)
     2285            MakeBubble(hwnd, FALSE, s);
     2286          else if (hwndBubble)
     2287            WinDestroyWindow(hwndBubble);
     2288        }
    22902289      }
    22912290      switch (id) {
     
    22942293      case IDM_RENAME:
    22952294      case MAIN_STATUS2:
    2296         return CommonTextProc(hwnd, msg, mp1, mp2);
     2295        return CommonTextProc(hwnd, msg, mp1, mp2);
    22972296      default:
    2298         break;
     2297        break;
    22992298      }
    23002299    }
     
    23192318      case IDM_RENAME:
    23202319      case MAIN_STATUS2:
    2321         return CommonTextButton(hwnd, msg, mp1, mp2);
     2320        return CommonTextButton(hwnd, msg, mp1, mp2);
    23222321      default:
    2323         PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
    2324         break;
     2322        PostMsg(hwnd, UM_FOCUSME, MPVOID, MPVOID);
     2323        break;
    23252324      }
    23262325    }
     
    23342333      id = WinQueryWindowUShort(hwnd, QWS_ID);
    23352334      if (id == MAIN_STATUS2 && hwndE)
    2336         WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
     2335        WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    23372336      else
    2338         return CommonTextButton(hwnd, msg, mp1, mp2);
     2337        return CommonTextButton(hwnd, msg, mp1, mp2);
    23392338    }
    23402339    break;
     
    23462345      id = WinQueryWindowUShort(hwnd, QWS_ID);
    23472346      if (id == MAIN_STATUS) {
    2348         if (SHORT2FROMMP(mp2) & KC_CTRL)
    2349           PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    2350                                   FID_CLIENT),
    2351                   WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
    2352         else if (hwndTree)
    2353           PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID);
     2347        if (SHORT2FROMMP(mp2) & KC_CTRL)
     2348          PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
     2349                                  FID_CLIENT),
     2350                  WM_COMMAND, MPFROM2SHORT(IDM_WINDOWDLG, 0), MPVOID);
     2351        else if (hwndTree)
     2352          PostMsg(hwndTree, UM_TIMER, MPVOID, MPVOID);
    23542353      }
    23552354    }
     
    23642363      if (id == MAIN_STATUS2 && !hwndE) {
    23652364
    2366         SWP swp;
    2367         CHAR directory[CCHMAXPATH];
    2368         PFNWP oldproce;
    2369 
    2370         *directory = 0;
    2371         TopWindowName(hwndMain, (HWND) 0, directory);
    2372         WinQueryWindowPos(hwnd, &swp);
    2373         hwndB = WinCreateWindow(hwnd,
    2374                                 WC_BUTTON,
    2375                                 "+",
    2376                                 WS_VISIBLE | BS_PUSHBUTTON |
    2377                                 BS_NOPOINTERFOCUS,
    2378                                 swp.cx - swp.cy,
    2379                                 0,
    2380                                 swp.cy,
    2381                                 swp.cy,
    2382                                 hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL);
    2383         if (!hwndB)
    2384           Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    2385         hwndE = WinCreateWindow(hwnd,
    2386                                 WC_ENTRYFIELD,
    2387                                 NULL,
    2388                                 WS_VISIBLE | ES_AUTOSCROLL,
    2389                                 0,
    2390                                 0,
    2391                                 swp.cx - swp.cy,
    2392                                 swp.cy,
    2393                                 hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL);
    2394         if (!hwndE)
    2395           Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    2396         if (!hwndE || !hwndB) {
    2397           PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
    2398           return 0;
    2399         }
    2400         WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID);
    2401         WinSetWindowText(hwndStatus, directory);
    2402         if (*lastcmd)
    2403           WinSetWindowText(hwndE, lastcmd);
    2404         else
    2405           WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT));
    2406         oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc);
    2407         if (oldproce)
    2408           WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce);
    2409         PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID);
    2410         PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
    2411         return 0;
     2365        SWP swp;
     2366        CHAR directory[CCHMAXPATH];
     2367        PFNWP oldproce;
     2368
     2369        *directory = 0;
     2370        TopWindowName(hwndMain, (HWND) 0, directory);
     2371        WinQueryWindowPos(hwnd, &swp);
     2372        hwndB = WinCreateWindow(hwnd,
     2373                                WC_BUTTON,
     2374                                "+",
     2375                                WS_VISIBLE | BS_PUSHBUTTON |
     2376                                BS_NOPOINTERFOCUS,
     2377                                swp.cx - swp.cy,
     2378                                0,
     2379                                swp.cy,
     2380                                swp.cy,
     2381                                hwnd, HWND_TOP, COMMAND_BUTTON, NULL, NULL);
     2382        if (!hwndB)
     2383          Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
     2384        hwndE = WinCreateWindow(hwnd,
     2385                                WC_ENTRYFIELD,
     2386                                NULL,
     2387                                WS_VISIBLE | ES_AUTOSCROLL,
     2388                                0,
     2389                                0,
     2390                                swp.cx - swp.cy,
     2391                                swp.cy,
     2392                                hwnd, HWND_TOP, COMMAND_LINE, NULL, NULL);
     2393        if (!hwndE)
     2394          Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
     2395        if (!hwndE || !hwndB) {
     2396          PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
     2397          return 0;
     2398        }
     2399        WinSendMsg(hwndE, EM_SETTEXTLIMIT, MPFROM2SHORT(1024, 0), MPVOID);
     2400        WinSetWindowText(hwndStatus, directory);
     2401        if (*lastcmd)
     2402          WinSetWindowText(hwndE, lastcmd);
     2403        else
     2404          WinSetWindowText(hwndE, GetPString(IDS_HELPCMDTEXT));
     2405        oldproce = WinSubclassWindow(hwndE, (PFNWP) CommandLineProc);
     2406        if (oldproce)
     2407          WinSetWindowPtr(hwndE, QWL_USER, (PVOID) oldproce);
     2408        PostMsg(hwndE, UM_FOCUSME, MPVOID, MPVOID);
     2409        PostMsg(hwndE, EM_SETSEL, MPFROM2SHORT(0, 1024), MPVOID);
     2410        return 0;
    24122411      }
    24132412      if (msg == UM_CLICKED3 || (SHORT2FROMMP(mp2) & KC_CTRL)) {
    2414         switch (id) {
    2415         case IDM_ATTRS:
    2416           id = IDM_SORTSIZE;
    2417           break;
    2418         case IDM_INFO:
    2419           id = IDM_SORTLWDATE;
    2420           break;
    2421         case IDM_RENAME:
    2422           id = IDM_SORTFILENAME;
    2423           break;
    2424         }
     2413        switch (id) {
     2414        case IDM_ATTRS:
     2415          id = IDM_SORTSIZE;
     2416          break;
     2417        case IDM_INFO:
     2418          id = IDM_SORTLWDATE;
     2419          break;
     2420        case IDM_RENAME:
     2421          id = IDM_SORTFILENAME;
     2422          break;
     2423        }
    24252424      }
    24262425      PostMsg(WinQueryWindow(hwnd, QW_PARENT),
    2427               WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID);
     2426              WM_COMMAND, MPFROM2SHORT(id, 0), MPVOID);
    24282427    }
    24292428    return 0;
     
    24392438      case IDM_RENAME:
    24402439      case MAIN_STATUS2:
    2441         PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
    2442         break;
     2440        PaintRecessedWindow(hwnd, (HPS) 0, TRUE, FALSE);
     2441        break;
    24432442      default:
    2444         PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE);
    2445         break;
     2443        PaintRecessedWindow(hwnd, (HPS) 0, FALSE, TRUE);
     2444        break;
    24462445      }
    24472446      if (id == IDM_RENAME) {
    24482447
    2449         HPS hps;
    2450 
    2451         hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
    2452         if (hps) {
    2453           PaintSTextWindow(hwnd, hps);
    2454           WinEndPaint(hps);
    2455         }
    2456         return 0;
     2448        HPS hps;
     2449
     2450        hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
     2451        if (hps) {
     2452          PaintSTextWindow(hwnd, hps);
     2453          WinEndPaint(hps);
     2454        }
     2455        return 0;
    24572456      }
    24582457    }
     
    24872486  case UM_COMMAND:
    24882487    return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    2489                                       FID_CLIENT), msg, mp1, mp2);
     2488                                      FID_CLIENT), msg, mp1, mp2);
    24902489
    24912490  case WM_PAINT:
     
    25232522      tool = find_tool(id);
    25242523      if (tool) {
    2525         del_tool(tool);
    2526         WinShowWindow(WinWindowFromID(hwnd, id), FALSE);
    2527         if (fToolTitles)
    2528           WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE);
    2529         ResizeTools(hwnd);
     2524        del_tool(tool);
     2525        WinShowWindow(WinWindowFromID(hwnd, id), FALSE);
     2526        if (fToolTitles)
     2527          WinShowWindow(WinWindowFromID(hwnd, id + 25000), FALSE);
     2528        ResizeTools(hwnd);
    25302529      }
    25312530    }
     
    25372536
    25382537      id = (USHORT) WinDlgBox(HWND_DESKTOP,
    2539                               hwnd,
    2540                               AddToolProc,
    2541                               FM3ModHandle, ADDBTN_FRAME, MPVOID);
     2538                              hwnd,
     2539                              AddToolProc,
     2540                              FM3ModHandle, ADDBTN_FRAME, MPVOID);
    25422541      if (id && id != (USHORT) - 1)
    2543         WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    2544                                    FID_CLIENT),
    2545                    WM_COMMAND,
    2546                    MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0));
     2542        WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
     2543                                   FID_CLIENT),
     2544                   WM_COMMAND,
     2545                   MPFROM2SHORT(IDM_CREATETOOL, 0), MPFROM2SHORT(id, 0));
    25472546    }
    25482547    break;
     
    25502549  case WM_CONTEXTMENU:
    25512550    if (WinDlgBox(HWND_DESKTOP,
    2552                   hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID))
     2551                  hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID))
    25532552      BuildTools(hwnd, TRUE);
    25542553    return MRFROMSHORT(TRUE);
     
    25732572  if (pswp) {
    25742573    if (WinQueryWindowPos(hwndTree, &swp) &&
    2575         !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) {
     2574        !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE))) {
    25762575      pswp->x = swp.cx;
    25772576      pswp->cx -= swp.cx;
     
    25802579  if (prectl) {
    25812580    if (WinQueryWindowPos(hwndTree, &swp) &&
    2582         !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) &&
    2583         WinQueryWindowRect(hwndTree, &rectl)) {
     2581        !(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)) &&
     2582        WinQueryWindowRect(hwndTree, &rectl)) {
    25842583      prectl->xLeft = rectl.xRight;
    25852584      prectl->xRight -= rectl.xRight;
     
    26332632    if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
    26342633      if (swp.x < swpT.cx) {
    2635         swp.x = swpT.cx;
    2636         if (swp.x + swp.cx > swpC.cx)
    2637           swp.cx = swpC.cx - swp.x;
    2638         if (swp.cx > 24)
    2639           WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
    2640                           SWP_SIZE | SWP_MOVE | SWP_SHOW);
     2634        swp.x = swpT.cx;
     2635        if (swp.x + swp.cx > swpC.cx)
     2636          swp.cx = swpC.cx - swp.x;
     2637        if (swp.cx > 24)
     2638          WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
     2639                          SWP_SIZE | SWP_MOVE | SWP_SHOW);
    26412640      }
    26422641    }
     
    26582657      WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
    26592658      WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
    2660                       SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE);
     2659                      SWP_MOVE | SWP_SHOW | SWP_FOCUSDEACTIVATE);
    26612660    }
    26622661  }
     
    26802679    if (hwndNext) {
    26812680      if (!WinQueryWindowUShort(hwndNext, QWS_ID))
    2682         continue;
     2681        continue;
    26832682      if (next)
    2684         break;
     2683        break;
    26852684      if (hwndNext == hwndActive) {
    2686         if (!previous && hwndPrev) {
    2687           hwndNext = hwndPrev;
    2688           break;
    2689         }
    2690         else if (previous)
    2691           next = TRUE;
     2685        if (!previous && hwndPrev) {
     2686          hwndNext = hwndPrev;
     2687          break;
     2688        }
     2689        else if (previous)
     2690          next = TRUE;
    26922691      }
    26932692      hwndPrev = hwndNext;
     
    26952694    else {
    26962695      if ((!next && previous) || once)
    2697         break;
     2696        break;
    26982697      else if (!previous) {
    2699         hwndNext = hwndPrev;
    2700         break;
     2698        hwndNext = hwndPrev;
     2699        break;
    27012700      }
    27022701      else
    2703         once = next = TRUE;
     2702        once = next = TRUE;
    27042703    }
    27052704  }
     
    27082707  if (hwndNext && hwndNext != hwndActive) {
    27092708    WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0,
    2710                     SWP_ZORDER | SWP_ACTIVATE);
     2709                    SWP_ZORDER | SWP_ACTIVATE);
    27112710    WinSetWindowPos(hwndActive, ((previous) ? HWND_BOTTOM : hwndNext), 0, 0,
    2712                     0, 0, SWP_ZORDER);
     2711                    0, 0, SWP_ZORDER);
    27132712  }
    27142713}
     
    27252724    if (hwndChild != hwndTree) {
    27262725      WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
    2727                 WM_SAVEAPPLICATION, MPVOID, MPVOID);
     2726                WM_SAVEAPPLICATION, MPVOID, MPVOID);
    27282727      if (WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
    2729                      WM_CLOSE, MPVOID, MPVOID)) {
    2730         ret = TRUE;
    2731         break;
     2728                     WM_CLOSE, MPVOID, MPVOID)) {
     2729        ret = TRUE;
     2730        break;
    27322731      }
    27332732    }
     
    27522751      hwndTemp = WinWindowFromID(hwndChild, FID_CLIENT);
    27532752      if (hwndTemp) {
    2754         hwndDir = WinWindowFromID(hwndTemp, DIR_CNR);
    2755         if (hwndDir) {
    2756           WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
    2757                      WM_CLOSE, MPVOID, MPVOID);
    2758           ret = TRUE;
    2759         }
     2753        hwndDir = WinWindowFromID(hwndTemp, DIR_CNR);
     2754        if (hwndDir) {
     2755          WinSendMsg(WinWindowFromID(hwndChild, FID_CLIENT),
     2756                     WM_CLOSE, MPVOID, MPVOID);
     2757          ret = TRUE;
     2758        }
    27602759      }
    27612760    }
     
    27732772 */
    27742773
    2775 #define STATE_NAME_MAX_BYTES    256
     2774#define STATE_NAME_MAX_BYTES    256
    27762775
    27772776INT SaveDirCnrState(HWND hwndClient, PSZ pszStateName)
     
    28022801      hwndC = WinWindowFromID(hwndChild, FID_CLIENT);
    28032802      if (hwndC) {
    2804         hwndDir = WinWindowFromID(hwndC, DIR_CNR);
    2805         if (hwndDir) {
    2806           WinQueryWindowPos(hwndChild, &swp);
    2807           *szDir = 0;
    2808           WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID);
    2809           if (*szDir) {
    2810            if (driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN)
    2811              continue;
    2812             sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves);
    2813             PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp,
    2814                                 sizeof(SWP));
    2815             dcd =
    2816               WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
    2817             if (dcd) {
    2818               sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves);
    2819               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags,
    2820                                   sizeof(INT));
    2821               sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves);
    2822               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask,
    2823                                   sizeof(MASK));
    2824               sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves);
    2825               flWindowAttr = dcd->flWindowAttr;
    2826               if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
    2827                 flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
    2828                 if (dcd->lastattr) {
    2829                   if (dcd->lastattr & CV_TEXT)
    2830                     flWindowAttr |= CV_TEXT;
    2831                   else if (dcd->lastattr & CV_DETAIL)
    2832                     flWindowAttr |= CV_DETAIL;
    2833                   else if (dcd->lastattr & CV_ICON)
    2834                     flWindowAttr |= CV_ICON;
    2835                   else
    2836                     flWindowAttr |= CV_NAME;
    2837                 }
    2838                 else
    2839                   flWindowAttr |= CV_NAME;
    2840               }
    2841               PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr,
    2842                                   sizeof(ULONG));
     2803        hwndDir = WinWindowFromID(hwndC, DIR_CNR);
     2804        if (hwndDir) {
     2805          WinQueryWindowPos(hwndChild, &swp);
     2806          *szDir = 0;
     2807          WinSendMsg(hwndC, UM_CONTAINERDIR, MPFROMP(szDir), MPVOID);
     2808          if (*szDir) {
     2809           if (driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN)
     2810             continue;
     2811            sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves);
     2812            PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp,
     2813                                sizeof(SWP));
     2814            dcd =
     2815              WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER);
     2816            if (dcd) {
     2817              sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves);
     2818              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags,
     2819                                  sizeof(INT));
     2820              sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves);
     2821              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask,
     2822                                  sizeof(MASK));
     2823              sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves);
     2824              flWindowAttr = dcd->flWindowAttr;
     2825              if (!fLeaveTree && (flWindowAttr & CV_TREE)) {
     2826                flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
     2827                if (dcd->lastattr) {
     2828                  if (dcd->lastattr & CV_TEXT)
     2829                    flWindowAttr |= CV_TEXT;
     2830                  else if (dcd->lastattr & CV_DETAIL)
     2831                    flWindowAttr |= CV_DETAIL;
     2832                  else if (dcd->lastattr & CV_ICON)
     2833                    flWindowAttr |= CV_ICON;
     2834                  else
     2835                    flWindowAttr |= CV_NAME;
     2836                }
     2837                else
     2838                  flWindowAttr |= CV_NAME;
     2839              }
     2840              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr,
     2841                                  sizeof(ULONG));
    28432842              sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, numsaves);
    28442843              PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->detailslongname,
     
    28792878              sprintf(szKey, "%sDirCnr.%lu", szPrefix, numsaves);
    28802879              SavePresParams(hwndDir, szKey);
    2881             }
    2882             sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++);
    2883             PrfWriteProfileString(fmprof, FM3Str, szKey, szDir);
    2884             nSaved++;
    2885           }
    2886         }
     2880            }
     2881            sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++);
     2882            PrfWriteProfileString(fmprof, FM3Str, szKey, szDir);
     2883            nSaved++;
     2884          }
     2885        }
    28872886      }
    28882887    }
     
    29262925    if (hwnd) {
    29272926      if (WinQueryWindowPos(hwnd, &swp)) {
    2928         if (pswp->x > swp.cx)
    2929           pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx;
    2930         if (pswp->y > swp.cy)
    2931           pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy;
    2932         if (pswp->x + pswp->cx > swp.cx)
    2933           pswp->cx = swp.cx - pswp->x;
    2934         if (pswp->y + pswp->cy > swp.cy)
    2935           pswp->cy = swp.cy - pswp->y;
     2927        if (pswp->x > swp.cx)
     2928          pswp->x = (swp.cx > 24) ? swp.cx - 24 : swp.cx;
     2929        if (pswp->y > swp.cy)
     2930          pswp->y = (swp.cy > 24) ? swp.cy - 24 : swp.cy;
     2931        if (pswp->x + pswp->cx > swp.cx)
     2932          pswp->cx = swp.cx - pswp->x;
     2933        if (pswp->y + pswp->cy > swp.cy)
     2934          pswp->cy = swp.cy - pswp->y;
    29362935      }
    29372936    }
     
    29712970  sprintf(szKey, "%sMySizeLastTime", szPrefix);
    29722971  if (!PrfQueryProfileData(fmprof,
    2973                            FM3Str,
    2974                            szKey,
    2975                            (PVOID) & swpO,
    2976                            &size) ||
     2972                           FM3Str,
     2973                           szKey,
     2974                           (PVOID) & swpO,
     2975                           &size) ||
    29772976      size != sizeof(SWP) || !swp.cx || !swp.cy)
    29782977  {
     
    30013000      swp.fl &= (~SWP_ACTIVATE);
    30023001      WinSetWindowPos(hwndTree,
    3003                       HWND_TOP,
    3004                       swp.x,
    3005                       swp.y,
    3006                       swp.cx,
    3007                       swp.cy,
    3008                       swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
     3002                      HWND_TOP,
     3003                      swp.x,
     3004                      swp.y,
     3005                      swp.cx,
     3006                      swp.cy,
     3007                      swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
    30093008    }
    30103009    else {
    30113010      WinSetWindowPos(hwndTree,
    3012                       HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
     3011                      HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
    30133012      WinSetWindowUShort(hwndTree, QWS_XRESTORE, (USHORT) swp.x);
    30143013      WinSetWindowUShort(hwndTree, QWS_CXRESTORE, (USHORT) swp.cx);
     
    30203019  sprintf(szKey, "%sNumDirsLastTime", szPrefix);
    30213020  if (PrfQueryProfileData(fmprof,
    3022                           FM3Str, szKey, (PVOID) & numsaves, &size) && numsaves) {
     3021                          FM3Str, szKey, (PVOID) & numsaves, &size) && numsaves) {
    30233022    if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
    30243023      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     
    30273026      size = sizeof(SWP);
    30283027      if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, &size)) {
    3029         if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
    3030           PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3031         sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x);
    3032         size = sizeof(szDir);
    3033         if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
    3034           if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
    3035             PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3036           if (driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
    3037             PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3038             continue;
    3039           }
     3028        if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
     3029          PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3030        sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x);
     3031        size = sizeof(szDir);
     3032        if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
     3033          if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
     3034            PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3035          if (driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
     3036            PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3037            continue;
     3038          }
    30403039          localdcd.detailslongname = detailslongname;  // Set default
    30413040          size = sizeof(BOOL);
     
    30483047                                  {
    30493048                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3050                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3049                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    30513050                                  }
    30523051          localdcd.detailssubject = detailssubject;  // Set default
     
    30603059                                  {
    30613060                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3062                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3061                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    30633062                                  }
    30643063          localdcd.detailsea = detailsea;  // Set default
     
    30723071                                  {
    30733072                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3074                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3073                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    30753074                                  }
    30763075          localdcd.detailssize = detailssize;  // Set default
     
    30843083                                  {
    30853084                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3086                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3085                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    30873086                                  }
    30883087          localdcd.detailsicon = detailsicon;  // Set default
     
    30963095                                  {
    30973096                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3098                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3097                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    30993098                                  }
    31003099          localdcd.detailsattr = detailsattr;  // Set default
     
    31083107                                  {
    31093108                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3110                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3109                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31113110                                  }
    31123111          localdcd.detailscrdate = detailscrdate;  // Set default
     
    31203119                                  {
    31213120                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3122                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3121                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31233122                                  }
    31243123          localdcd.detailscrtime = detailscrtime;  // Set default
     
    31323131                                  {
    31333132                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3134                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3133                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31353134                                  }
    31363135          localdcd.detailslwdate = detailslwdate;  // Set default
     
    31443143                                  {
    31453144                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3146                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3145                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31473146                                  }
    31483147          localdcd.detailslwtime = detailslwtime;  // Set default
     
    31563155                                  {
    31573156                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3158                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3157                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31593158                                  }
    31603159          localdcd.detailsladate = detailsladate;  // Set default
     
    31683167                                  {
    31693168                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3170                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3169                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31713170                                  }
    31723171          localdcd.detailslatime = detailslatime;  // Set default
     
    31803179                                  {
    31813180                                    if (!pszStateName || !strcmp(pszStateName, FM2_STATE_AT_CLOSE))
    3182                                       JBSDBG PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3181                                      PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    31833182                                  }
    31843183          sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
    31853184          RestorePresParams(hwndClient, szKey);
    31863185          SavePresParams(hwndClient, "DirCnr");
    3187           hwndDir = (HWND) WinSendMsg(hwndClient,
    3188                                       UM_SETDIR,
    3189                                       MPFROMP(szDir), MPFROMLONG(1));
    3190           if (hwndDir) {
    3191             hwndC = WinWindowFromID(hwndDir, FID_CLIENT);
    3192             if (hwndC) {
     3186          hwndDir = (HWND) WinSendMsg(hwndClient,
     3187                                      UM_SETDIR,
     3188                                      MPFROMP(szDir), MPFROMLONG(1));
     3189          if (hwndDir) {
     3190            hwndC = WinWindowFromID(hwndDir, FID_CLIENT);
     3191            if (hwndC) {
    31933192              HWND hwndCnr = WinWindowFromID(hwndC, DIR_CNR);
    31943193              dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
    3195               if (dcd) {
     3194              if (dcd) {
    31963195                dcd->detailslongname = localdcd.detailslongname;
    31973196                dcd->detailssubject  = localdcd.detailssubject ;
     
    32063205                dcd->detailslwdate   = localdcd.detailslwdate  ;
    32073206                dcd->detailslwtime   = localdcd.detailslwtime  ;
    3208                 size = sizeof(INT);
    3209                 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);
    3210                 if (PrfQueryProfileData(fmprof,
    3211                                         FM3Str,
    3212                                         szKey,
    3213                                         (PVOID) & dcd->sortFlags,
    3214                                         &size) && size == sizeof(INT)) {
    3215                   if (!dcd->sortFlags)
    3216                     dcd->sortFlags = SORT_PATHNAME;
    3217                 }
    3218                 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
    3219                   PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3220                 size = sizeof(MASK);
    3221                 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x);
    3222                 if (PrfQueryProfileData(fmprof,
    3223                                         FM3Str,
    3224                                         szKey,
    3225                                         (PVOID) & dcd->mask, &size) && size) {
    3226                   if (*dcd->mask.szMask)
    3227                     WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
    3228                                UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
    3229                 }
    3230                 *(dcd->mask.prompt) = 0;
    3231                 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
    3232                   PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3233                 size = sizeof(ULONG);
    3234                 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x);
    3235                 if (!noview) {
    3236                   if (PrfQueryProfileData(fmprof,
    3237                                           FM3Str,
    3238                                           szKey,
    3239                                           (PVOID) & dcd->flWindowAttr,
    3240                                           &size) && size == sizeof(ULONG)) {
    3241 
    3242                     CNRINFO cnri;
    3243 
    3244                     memset(&cnri, 0, sizeof(CNRINFO));
    3245                     cnri.cb = sizeof(CNRINFO);
    3246                     if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
    3247                                    CM_QUERYCNRINFO,
    3248                                    MPFROMP(&cnri),
    3249                                    MPFROMLONG(sizeof(CNRINFO)))) {
    3250                       cnri.flWindowAttr = dcd->flWindowAttr;
    3251                       WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
    3252                                 CM_SETCNRINFO,
    3253                                 MPFROMP(&cnri),
    3254                                 MPFROMLONG(CMA_FLWINDOWATTR));
    3255                     }
    3256                   }
    3257                 }
    3258                 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
    3259                   PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3207                size = sizeof(INT);
     3208                sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x);
     3209                if (PrfQueryProfileData(fmprof,
     3210                                        FM3Str,
     3211                                        szKey,
     3212                                        (PVOID) & dcd->sortFlags,
     3213                                        &size) && size == sizeof(INT)) {
     3214                  if (!dcd->sortFlags)
     3215                    dcd->sortFlags = SORT_PATHNAME;
     3216                }
     3217                if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
     3218                  PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3219                size = sizeof(MASK);
     3220                sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x);
     3221                if (PrfQueryProfileData(fmprof,
     3222                                        FM3Str,
     3223                                        szKey,
     3224                                        (PVOID) & dcd->mask, &size) && size) {
     3225                  if (*dcd->mask.szMask)
     3226                    WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
     3227                               UM_FILTER, MPFROMP(dcd->mask.szMask), MPVOID);
     3228                }
     3229                *(dcd->mask.prompt) = 0;
     3230                if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
     3231                  PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3232                size = sizeof(ULONG);
     3233                sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x);
     3234                if (!noview) {
     3235                  if (PrfQueryProfileData(fmprof,
     3236                                          FM3Str,
     3237                                          szKey,
     3238                                          (PVOID) & dcd->flWindowAttr,
     3239                                          &size) && size == sizeof(ULONG)) {
     3240
     3241                    CNRINFO cnri;
     3242
     3243                    memset(&cnri, 0, sizeof(CNRINFO));
     3244                    cnri.cb = sizeof(CNRINFO);
     3245                    if (WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
     3246                                   CM_QUERYCNRINFO,
     3247                                   MPFROMP(&cnri),
     3248                                   MPFROMLONG(sizeof(CNRINFO)))) {
     3249                      cnri.flWindowAttr = dcd->flWindowAttr;
     3250                      WinSendMsg(WinWindowFromID(hwndC, DIR_CNR),
     3251                                CM_SETCNRINFO,
     3252                                MPFROMP(&cnri),
     3253                                MPFROMLONG(CMA_FLWINDOWATTR));
     3254                    }
     3255                  }
     3256                }
     3257                if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)))
     3258                  PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    32603259                if (!PostMsg(hwndCnr, UM_SETUP2, NULL, NULL))
    32613260                  WinSendMsg(hwndCnr, UM_SETUP2, NULL, NULL);
    3262               }
    3263             }
    3264             fRestored = TRUE;
    3265             swp.hwnd = hwndDir;
    3266             TransformSwp(&swp, xtrans, ytrans);
    3267             if (!fAutoTile && !(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
    3268               WinSetWindowPos(hwndDir,
    3269                               HWND_TOP,
    3270                               swp.x,
    3271                               swp.y,
    3272                               swp.cx,
    3273                               swp.cy,
    3274                               swp.fl | SWP_MOVE |
    3275                               SWP_SIZE | SWP_SHOW | SWP_ZORDER |
    3276                               SWP_ACTIVATE);
    3277             else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
    3278               WinSetWindowPos(hwndDir,
    3279                               HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
    3280               WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x);
    3281               WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx);
    3282               WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y);
    3283               WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy);
    3284             }
    3285             else
    3286               WinSetWindowPos(hwndDir,
    3287                               HWND_TOP,
    3288                               0, 0, 0, 0, SWP_ZORDER | SWP_ACTIVATE);
    3289           }
    3290         }
     3261              }
     3262            }
     3263            fRestored = TRUE;
     3264            swp.hwnd = hwndDir;
     3265            TransformSwp(&swp, xtrans, ytrans);
     3266            if (!fAutoTile && !(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
     3267              WinSetWindowPos(hwndDir,
     3268                              HWND_TOP,
     3269                              swp.x,
     3270                              swp.y,
     3271                              swp.cx,
     3272                              swp.cy,
     3273                              swp.fl | SWP_MOVE |
     3274                              SWP_SIZE | SWP_SHOW | SWP_ZORDER |
     3275                              SWP_ACTIVATE);
     3276            else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
     3277              WinSetWindowPos(hwndDir,
     3278                              HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE | SWP_SHOW);
     3279              WinSetWindowUShort(hwndDir, QWS_XRESTORE, (USHORT) swp.x);
     3280              WinSetWindowUShort(hwndDir, QWS_CXRESTORE, (USHORT) swp.cx);
     3281              WinSetWindowUShort(hwndDir, QWS_YRESTORE, (USHORT) swp.y);
     3282              WinSetWindowUShort(hwndDir, QWS_CYRESTORE, (USHORT) swp.cy);
     3283            }
     3284            else
     3285              WinSetWindowPos(hwndDir,
     3286                              HWND_TOP,
     3287                              0, 0, 0, 0, SWP_ZORDER | SWP_ACTIVATE);
     3288          }
     3289        }
    32913290      }
    32923291    } // for
     
    33133312    if (ulNumMinChildren) {
    33143313      if (WinQueryWindowPos(hwndChild, &swp) && (swp.fl & SWP_MINIMIZE))
    3315         (*ulNumMinChildren)++;
     3314        (*ulNumMinChildren)++;
    33163315    }
    33173316  }
     
    33213320
    33223321VOID GetNextWindowPos(HWND hwndClient, PSWP pswp, ULONG * ulCntR,
    3323                       ULONG * ulNumMinChildrenR)
     3322                      ULONG * ulNumMinChildrenR)
    33243323{
    33253324  register ULONG ulCnt;
     
    33853384    if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
    33863385      if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
    3387         swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
     3386        swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
    33883387      if (swp.x != 0)
    3389         swp.x = 0;
     3388        swp.x = 0;
    33903389      if (swp.y < 0)
    3391         swp.y = 0;
     3390        swp.y = 0;
    33923391      if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
    3393         swp.cx = Rectl.xRight - Rectl.xLeft;
     3392        swp.cx = Rectl.xRight - Rectl.xLeft;
    33943393      WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
    3395                       SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
     3394                      SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
    33963395    }
    33973396  }
     
    34053404      GetNextWindowPos(hwndClient, &swp, &ulCnt, &ulNumMinChildren);
    34063405      WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
    3407                       SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE |
    3408                       SWP_ZORDER | SWP_ACTIVATE);
     3406                      SWP_SIZE | SWP_MOVE | SWP_SHOW | SWP_RESTORE |
     3407                      SWP_ZORDER | SWP_ACTIVATE);
    34093408      ulCnt++;
    34103409    }
     
    34593458    if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
    34603459      if (swp.y < 0)
    3461         swp.y = 0;
     3460        swp.y = 0;
    34623461      if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
    3463         swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
     3462        swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
    34643463      if (swp.x != 0)
    3465         swp.x = 0;
     3464        swp.x = 0;
    34663465      if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
    3467         swp.cx = Rectl.xRight - Rectl.xLeft;
     3466        swp.cx = Rectl.xRight - Rectl.xLeft;
    34683467      WinSetWindowPos(hwndTree,
    3469                       HWND_TOP,
    3470                       swp.x,
    3471                       swp.y,
    3472                       swp.cx,
    3473                       swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
     3468                      HWND_TOP,
     3469                      swp.x,
     3470                      swp.y,
     3471                      swp.cx,
     3472                      swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
    34743473      WinQueryWindowPos(hwndTree, &swp);
    34753474    }
     
    34963495
    34973496      for (ulCurRow = 0; ulCurRow < ulNumRows; ulCurRow++) {
    3498         if ((ulNumRows - ulCurRow) <= ulExtraCols)
    3499           ulNumCols++;
    3500         for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) {
    3501           ulWidth = Rectl.xRight / ulNumCols;
    3502 
    3503           while (hwndChild) {
    3504             id = WinQueryWindowUShort(hwndChild, QWS_ID);
    3505             if (id && (id != TREE_FRAME || fFreeTree)) {
    3506               WinQueryWindowPos(hwndChild, &swp);
    3507               if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
    3508                 break;
    3509             }
    3510             hwndChild = WinGetNextWindow(henum);
    3511           }
    3512 
    3513           if (hwndChild) {
    3514             if (!absolute && (swp.fl & SWP_MAXIMIZE)) {
    3515               WinGetMaxPosition(hwndChild, &swp);
    3516               WinSetWindowPos(hwndChild,
    3517                               HWND_TOP,
    3518                               swp.x,
    3519                               swp.y,
    3520                               swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW);
    3521               WinSetWindowUShort(hwndChild,
    3522                                 QWS_XRESTORE,
    3523                                 (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft);
    3524               WinSetWindowUShort(hwndChild,
    3525                                 QWS_YRESTORE,
    3526                                 (USHORT) (Rectl.yTop -
    3527                                            (ulHeight * (ulCurRow + 1))));
    3528               WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth);
    3529               WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight);
    3530             }
    3531             else
    3532               WinSetWindowPos(hwndChild,
    3533                               HWND_TOP,
    3534                               (ulWidth * ulCurCol) + Rectl.xLeft,
    3535                               Rectl.yTop - (ulHeight * (ulCurRow + 1)),
    3536                               ulWidth,
    3537                               ulHeight,
    3538                               SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
    3539             hwndChild = WinGetNextWindow(henum);
    3540           }
    3541         }
    3542         if ((ulNumRows - ulCurRow) <= ulExtraCols) {
    3543           ulNumCols--;
    3544           ulExtraCols--;
    3545         }
     3497        if ((ulNumRows - ulCurRow) <= ulExtraCols)
     3498          ulNumCols++;
     3499        for (ulCurCol = 0; ulCurCol < ulNumCols; ulCurCol++) {
     3500          ulWidth = Rectl.xRight / ulNumCols;
     3501
     3502          while (hwndChild) {
     3503            id = WinQueryWindowUShort(hwndChild, QWS_ID);
     3504            if (id && (id != TREE_FRAME || fFreeTree)) {
     3505              WinQueryWindowPos(hwndChild, &swp);
     3506              if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE)))
     3507                break;
     3508            }
     3509            hwndChild = WinGetNextWindow(henum);
     3510          }
     3511
     3512          if (hwndChild) {
     3513            if (!absolute && (swp.fl & SWP_MAXIMIZE)) {
     3514              WinGetMaxPosition(hwndChild, &swp);
     3515              WinSetWindowPos(hwndChild,
     3516                              HWND_TOP,
     3517                              swp.x,
     3518                              swp.y,
     3519                              swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | SWP_SHOW);
     3520              WinSetWindowUShort(hwndChild,
     3521                                QWS_XRESTORE,
     3522                                (USHORT) (ulWidth * ulCurCol) + Rectl.xLeft);
     3523              WinSetWindowUShort(hwndChild,
     3524                                QWS_YRESTORE,
     3525                                (USHORT) (Rectl.yTop -
     3526                                           (ulHeight * (ulCurRow + 1))));
     3527              WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth);
     3528              WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight);
     3529            }
     3530            else
     3531              WinSetWindowPos(hwndChild,
     3532                              HWND_TOP,
     3533                              (ulWidth * ulCurCol) + Rectl.xLeft,
     3534                              Rectl.yTop - (ulHeight * (ulCurRow + 1)),
     3535                              ulWidth,
     3536                              ulHeight,
     3537                              SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
     3538            hwndChild = WinGetNextWindow(henum);
     3539          }
     3540        }
     3541        if ((ulNumRows - ulCurRow) <= ulExtraCols) {
     3542          ulNumCols--;
     3543          ulExtraCols--;
     3544        }
    35463545      }
    35473546    }
     
    35533552
    35543553static VOID ResizeChildren(HWND hwndClient, SHORT oldcx, SHORT oldcy,
    3555                            SHORT newcx, SHORT newcy)
     3554                           SHORT newcx, SHORT newcy)
    35563555{
    35573556  /*
     
    35713570    while ((hwndChild = WinGetNextWindow(henum)) != NULLHANDLE) {
    35723571      if (!WinQueryWindowUShort(hwndChild, QWS_ID))
    3573         continue;
     3572        continue;
    35743573      if (WinQueryWindowPos(hwndChild, &swp)) {
    3575         if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
    3576           swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
    3577           swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
    3578           swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
    3579           swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
    3580         }
    3581         else if (swp.fl & SWP_MAXIMIZE) {
    3582           swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
    3583           swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
    3584           swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
    3585           swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
    3586         }
    3587         cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0;
    3588         cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0;
    3589         x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0;
    3590         y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0;
    3591         if (x < 0)
    3592           x = 0;
    3593         if (y < 0)
    3594           y = 0;
    3595         ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0;
    3596         uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0;
    3597         ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0;
    3598         ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0;
    3599         if (ux + ucx > newcx)
    3600           ucx = newcx - ux;
    3601         if (uy + ucy > newcy)
    3602           ucy = newcy - uy;
    3603 
    3604         if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)))
    3605           WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy,
    3606                           SWP_MOVE | SWP_SIZE | SWP_SHOW);
    3607         else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
    3608           WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
    3609           WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
    3610           WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
    3611                           SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE);
    3612           WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
    3613           WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
    3614           WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
    3615           WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
    3616         }
    3617         else {
    3618           WinGetMaxPosition(hwndChild, &swp);
    3619           WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
    3620                           SWP_MOVE | SWP_SIZE | SWP_SHOW);
    3621           WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
    3622           WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
    3623           WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
    3624           WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
    3625         }
     3574        if (swp.fl & (SWP_MINIMIZE | SWP_HIDE)) {
     3575          swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
     3576          swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
     3577          swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
     3578          swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
     3579        }
     3580        else if (swp.fl & SWP_MAXIMIZE) {
     3581          swp.x = WinQueryWindowUShort(hwndChild, QWS_XRESTORE);
     3582          swp.y = WinQueryWindowUShort(hwndChild, QWS_YRESTORE);
     3583          swp.cx = WinQueryWindowUShort(hwndChild, QWS_CXRESTORE);
     3584          swp.cy = WinQueryWindowUShort(hwndChild, QWS_CYRESTORE);
     3585        }
     3586        cx = (swp.cx) ? (LONG) (((double)oldcx * 100.0) / (double)swp.cx) : 0;
     3587        cy = (swp.cy) ? (LONG) (((double)oldcy * 100.0) / (double)swp.cy) : 0;
     3588        x = (swp.x) ? (LONG) (((double)oldcx * 100.0) / (double)swp.x) : 0;
     3589        y = (swp.y) ? (LONG) (((double)oldcy * 100.0) / (double)swp.y) : 0;
     3590        if (x < 0)
     3591          x = 0;
     3592        if (y < 0)
     3593          y = 0;
     3594        ux = (x) ? (LONG) (((double)newcx * 100.0) / (double)x) : 0;
     3595        uy = (y) ? (LONG) (((double)newcy * 100.0) / (double)y) : 0;
     3596        ucx = (cx) ? (LONG) (((double)newcx * 100.0) / (double)cx) : 0;
     3597        ucy = (cy) ? (LONG) (((double)newcy * 100.0) / (double)cy) : 0;
     3598        if (ux + ucx > newcx)
     3599          ucx = newcx - ux;
     3600        if (uy + ucy > newcy)
     3601          ucy = newcy - uy;
     3602
     3603        if (!(swp.fl & (SWP_MINIMIZE | SWP_HIDE | SWP_MAXIMIZE)))
     3604          WinSetWindowPos(hwndChild, HWND_TOP, ux, uy, ucx, ucy,
     3605                          SWP_MOVE | SWP_SIZE | SWP_SHOW);
     3606        else if (swp.fl & (SWP_HIDE | SWP_MINIMIZE)) {
     3607          WinSetWindowUShort(hwndChild, QWS_XMINIMIZE, (USHORT) - 1);
     3608          WinSetWindowUShort(hwndChild, QWS_YMINIMIZE, (USHORT) - 1);
     3609          WinSetWindowPos(hwndChild, HWND_TOP, 0, 0, 0, 0,
     3610                          SWP_SIZE | SWP_MOVE | SWP_FOCUSDEACTIVATE);
     3611          WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
     3612          WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
     3613          WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
     3614          WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
     3615        }
     3616        else {
     3617          WinGetMaxPosition(hwndChild, &swp);
     3618          WinSetWindowPos(hwndChild, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
     3619                          SWP_MOVE | SWP_SIZE | SWP_SHOW);
     3620          WinSetWindowUShort(hwndChild, QWS_XRESTORE, ux);
     3621          WinSetWindowUShort(hwndChild, QWS_YRESTORE, uy);
     3622          WinSetWindowUShort(hwndChild, QWS_CXRESTORE, ucx);
     3623          WinSetWindowUShort(hwndChild, QWS_CYRESTORE, ucy);
     3624        }
    36263625      }
    36273626    }
     
    36383637    if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
    36393638      if (swp.y + swp.cy < Rectl.yTop - Rectl.yBottom)
    3640         swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
     3639        swp.cy = (Rectl.yTop - Rectl.yBottom) - swp.y;
    36413640      if (swp.x != 0)
    3642         swp.x = 0;
     3641        swp.x = 0;
    36433642      if (swp.y < 0)
    3644         swp.y = 0;
     3643        swp.y = 0;
    36453644      if (swp.x + swp.cx > Rectl.xRight - Rectl.xLeft)
    3646         swp.cx = Rectl.xRight - Rectl.xLeft;
     3645        swp.cx = Rectl.xRight - Rectl.xLeft;
    36473646      WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy,
    3648                       SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
     3647                      SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_RESTORE);
    36493648    }
    36503649  }
     
    36743673
    36753674static MRESULT EXPENTRY ChildFrameButtonProc(HWND hwnd,
    3676                                              ULONG msg,
    3677                                              MPARAM mp1, MPARAM mp2)
     3675                                             ULONG msg,
     3676                                             MPARAM mp1, MPARAM mp2)
    36783677{
    36793678  USHORT id;
     
    36893688    if (fOtherHelp) {
    36903689      if ((!hwndBubble || WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd)
    3691           && !WinQueryCapture(HWND_DESKTOP)) {
    3692         id = WinQueryWindowUShort(hwnd, QWS_ID);
    3693         switch (id) {
    3694         case IDM_OPENWALK:
    3695           MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP));
    3696           break;
    3697         case IDM_USERLIST:
    3698           MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP));
    3699           break;
    3700         }
     3690          && !WinQueryCapture(HWND_DESKTOP)) {
     3691        id = WinQueryWindowUShort(hwnd, QWS_ID);
     3692        switch (id) {
     3693        case IDM_OPENWALK:
     3694          MakeBubble(hwnd, FALSE, GetPString(IDS_WALKBUTTONHELP));
     3695          break;
     3696        case IDM_USERLIST:
     3697          MakeBubble(hwnd, FALSE, GetPString(IDS_QUICKBUTTONHELP));
     3698          break;
     3699        }
    37013700      }
    37023701    }
     
    37123711      switch (id) {
    37133712      case IDM_OPENWALK:
    3714         switch (msg) {
    3715         case WM_BUTTON2CLICK:
    3716           if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
    3717               (KC_ALT | KC_SHIFT | KC_CTRL))
    3718             cmd = IDM_GREP;
    3719           else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
    3720             CascadeChildren(hwndMain);
     3713        switch (msg) {
     3714        case WM_BUTTON2CLICK:
     3715          if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
     3716              (KC_ALT | KC_SHIFT | KC_CTRL))
     3717            cmd = IDM_GREP;
     3718          else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
     3719            CascadeChildren(hwndMain);
    37213720
    37223721#ifdef NEVER
    3723           else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
    3724             cmd = IDM_SYSINFO;
     3722          else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
     3723            cmd = IDM_SYSINFO;
    37253724#endif
    37263725
    3727           else if (shiftstate & KC_SHIFT)
    3728             cmd = IDM_WINDOWDLG;
    3729           else if (shiftstate & KC_CTRL)
    3730             cmd = IDM_SEEALL;
    3731           else if (shiftstate & KC_ALT)
    3732             TileChildren(hwndMain, TRUE);
    3733           else
    3734             cmd = IDM_WALKDIR;
    3735           break;
    3736         case WM_BUTTON3CLICK:
    3737           TileChildren(hwndMain, TRUE);
    3738           break;
    3739         }
    3740         break;
     3726          else if (shiftstate & KC_SHIFT)
     3727            cmd = IDM_WINDOWDLG;
     3728          else if (shiftstate & KC_CTRL)
     3729            cmd = IDM_SEEALL;
     3730          else if (shiftstate & KC_ALT)
     3731            TileChildren(hwndMain, TRUE);
     3732          else
     3733            cmd = IDM_WALKDIR;
     3734          break;
     3735        case WM_BUTTON3CLICK:
     3736          TileChildren(hwndMain, TRUE);
     3737          break;
     3738        }
     3739        break;
    37413740      case IDM_USERLIST:
    3742         switch (msg) {
    3743         case WM_BUTTON2CLICK:
    3744           if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
    3745               (KC_ALT | KC_SHIFT | KC_CTRL))
    3746             cmd = IDM_COLORPALETTE;
    3747           else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
    3748             cmd = IDM_HIDEMENU;
    3749           else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
    3750             cmd = IDM_NOTEBOOK;
    3751           else if (shiftstate & KC_SHIFT)
    3752             cmd = IDM_TOOLTITLES;
    3753           else if (shiftstate & KC_CTRL)
    3754             cmd = IDM_TEXTTOOLS;
    3755           else if (shiftstate & KC_ALT)
    3756             cmd = IDM_FONTPALETTE;
    3757           else
    3758             cmd = IDM_TOOLBAR;
    3759           break;
    3760         case WM_BUTTON3CLICK:
    3761           cmd = IDM_DRIVEBAR;
    3762           break;
    3763         }
    3764         break;
    3765       }                                 // switch id
     3741        switch (msg) {
     3742        case WM_BUTTON2CLICK:
     3743          if ((shiftstate & (KC_ALT | KC_SHIFT | KC_CTRL)) ==
     3744              (KC_ALT | KC_SHIFT | KC_CTRL))
     3745            cmd = IDM_COLORPALETTE;
     3746          else if ((shiftstate & (KC_ALT | KC_CTRL)) == (KC_ALT | KC_CTRL))
     3747            cmd = IDM_HIDEMENU;
     3748          else if ((shiftstate & (KC_ALT | KC_SHIFT)) == (KC_ALT | KC_SHIFT))
     3749            cmd = IDM_NOTEBOOK;
     3750          else if (shiftstate & KC_SHIFT)
     3751            cmd = IDM_TOOLTITLES;
     3752          else if (shiftstate & KC_CTRL)
     3753            cmd = IDM_TEXTTOOLS;
     3754          else if (shiftstate & KC_ALT)
     3755            cmd = IDM_FONTPALETTE;
     3756          else
     3757            cmd = IDM_TOOLBAR;
     3758          break;
     3759        case WM_BUTTON3CLICK:
     3760          cmd = IDM_DRIVEBAR;
     3761          break;
     3762        }
     3763        break;
     3764      }                                 // switch id
    37663765
    37673766      if (cmd) {
    3768         PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT),
    3769                 WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
     3767        PostMsg(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT), FID_CLIENT),
     3768                WM_COMMAND, MPFROM2SHORT(cmd, 0), MPVOID);
    37703769      }
    37713770    }
     
    37763775    if (id == IDM_OPENWALK) {
    37773776      if (!emphasized) {
    3778         emphasized = TRUE;
    3779         DrawTargetEmphasis(hwnd, emphasized);
     3777        emphasized = TRUE;
     3778        DrawTargetEmphasis(hwnd, emphasized);
    37803779      }
    37813780      if (AcceptOneDrop(hwnd, mp1, mp2))
    3782         return MRFROM2SHORT(DOR_DROP, DO_MOVE);
     3781        return MRFROM2SHORT(DOR_DROP, DO_MOVE);
    37833782    }
    37843783    return MRFROM2SHORT(DOR_NEVERDROP, 0);
     
    38003799
    38013800      if (emphasized) {
    3802         emphasized = FALSE;
    3803         DrawTargetEmphasis(hwnd, emphasized);
     3801        emphasized = FALSE;
     3802        DrawTargetEmphasis(hwnd, emphasized);
    38043803      }
    38053804      if (GetOneDrop(hwnd, mp1, mp2, szFrom, sizeof(szFrom))) {
    3806         if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) {
    3807           OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom);
    3808         }
     3805        if (MakeValidDir(szFrom) && !FindDirCnrByName(szFrom, TRUE)) {
     3806          OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, szFrom);
     3807        }
    38093808      }
    38103809    }
     
    38193818
    38203819static MRESULT EXPENTRY MainFrameWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
    3821                                         MPARAM mp2)
     3820                                        MPARAM mp2)
    38223821{
    38233822  PFNWP oldproc = (PFNWP) WinQueryWindowPtr(hwnd, QWL_USER);
     
    38313830      pswp = (SWP *) mp1;
    38323831      if (fDataMin && !fAmClosing) {
    3833         if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
    3834 
    3835           SWP swp;
    3836 
    3837           WinQueryWindowPos(hwnd, &swp);
    3838           PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);
    3839           HideNote();
    3840         }
    3841         else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
    3842           if (DataHwnd)
    3843             PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);
    3844         }
     3832        if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE)) {
     3833
     3834          SWP swp;
     3835
     3836          WinQueryWindowPos(hwnd, &swp);
     3837          PostMsg(hwnd, UM_FOCUSME, MPFROMLONG(swp.fl), MPVOID);
     3838          HideNote();
     3839        }
     3840        else if (pswp->fl & (SWP_SHOW | SWP_RESTORE)) {
     3841          if (DataHwnd)
     3842            PostMsg(DataHwnd, WM_CLOSE, MPVOID, MPVOID);
     3843        }
    38453844      }
    38463845      if (!fAmClosing) {
    3847         if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
    3848           HideNote();
     3846        if (pswp->fl & (SWP_HIDE | SWP_MINIMIZE))
     3847          HideNote();
    38493848      }
    38503849    }
     
    38693868  case WM_CONTROL:
    38703869    return WinSendMsg(WinWindowFromID(hwnd, FID_CLIENT), UM_CONTROL, mp1,
    3871                       mp2);
     3870                      mp2);
    38723871
    38733872  case WM_COMMAND:
     
    38893888
    38903889      if (mr && mp2) {
    3891         prectl = (PRECTL) mp1;
    3892         if (prectl->yBottom != prectl->yTop) {
    3893           {
    3894             HPS hps;
    3895             POINTL aptl[TXTBOX_COUNT];
    3896 
    3897             hps = WinGetPS(hwndStatus);
    3898             if (hps) {
    3899               GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
    3900               bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
    3901               WinReleasePS(hps);
    3902             }
    3903           }
    3904           prectl->yBottom += (sheight + 4);
    3905           prectl->yTop -= (sheight + 4);
    3906           if (fMoreButtons) {
    3907 
    3908             HPS hps;
    3909             POINTL aptl[TXTBOX_COUNT];
    3910 
    3911             hps = WinGetPS(hwndName);
    3912             if (hps) {
    3913               GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
    3914               bheight = aptl[TXTBOX_TOPLEFT].y + 6;
    3915               WinReleasePS(hps);
    3916             }
    3917             prectl->yBottom += (bheight + 4);
    3918             prectl->yTop -= (bheight + 4);
    3919           }
    3920           if (fToolbar) {
    3921             if (!fTextTools)
    3922               prectl->yTop -= ((fToolTitles) ? 50 : 40);
    3923             else
    3924               prectl->yTop -= 32;
    3925           }
    3926           if (fDrivebar) {
    3927             ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),
    3928                         ((prectl->xRight -
    3929                            (WinQuerySysValue(HWND_DESKTOP,
    3930                                              SV_CYSIZEBORDER) * 2)) - 4));
    3931             prectl->yTop -= (16 * (DriveLines * 18));
    3932           }
    3933           if (fUserComboBox) {
    3934             if (!aheight) {
    3935 
    3936               SWP swpTemp;
    3937 
    3938               WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
    3939                                 &swpTemp);
    3940               aheight = swpTemp.cy;
    3941             }
    3942             prectl->yTop -= (aheight + 6L);
    3943           }
    3944           if (fAutoView) {
    3945             AutoviewHeight = min(AutoviewHeight,
    3946                                 (prectl->yTop - prectl->yBottom) - 116);
    3947             AutoviewHeight = max(AutoviewHeight, 36);
    3948             prectl->yBottom += (AutoviewHeight + 6);
    3949           }
    3950         }
     3890        prectl = (PRECTL) mp1;
     3891        if (prectl->yBottom != prectl->yTop) {
     3892          {
     3893            HPS hps;
     3894            POINTL aptl[TXTBOX_COUNT];
     3895
     3896            hps = WinGetPS(hwndStatus);
     3897            if (hps) {
     3898              GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
     3899              bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
     3900              WinReleasePS(hps);
     3901            }
     3902          }
     3903          prectl->yBottom += (sheight + 4);
     3904          prectl->yTop -= (sheight + 4);
     3905          if (fMoreButtons) {
     3906
     3907            HPS hps;
     3908            POINTL aptl[TXTBOX_COUNT];
     3909
     3910            hps = WinGetPS(hwndName);
     3911            if (hps) {
     3912              GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
     3913              bheight = aptl[TXTBOX_TOPLEFT].y + 6;
     3914              WinReleasePS(hps);
     3915            }
     3916            prectl->yBottom += (bheight + 4);
     3917            prectl->yTop -= (bheight + 4);
     3918          }
     3919          if (fToolbar) {
     3920            if (!fTextTools)
     3921              prectl->yTop -= ((fToolTitles) ? 50 : 40);
     3922            else
     3923              prectl->yTop -= 32;
     3924          }
     3925          if (fDrivebar) {
     3926            ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES),
     3927                        ((prectl->xRight -
     3928                           (WinQuerySysValue(HWND_DESKTOP,
     3929                                             SV_CYSIZEBORDER) * 2)) - 4));
     3930            prectl->yTop -= (16 * (DriveLines * 18));
     3931          }
     3932          if (fUserComboBox) {
     3933            if (!aheight) {
     3934
     3935              SWP swpTemp;
     3936
     3937              WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
     3938                                &swpTemp);
     3939              aheight = swpTemp.cy;
     3940            }
     3941            prectl->yTop -= (aheight + 6L);
     3942          }
     3943          if (fAutoView) {
     3944            AutoviewHeight = min(AutoviewHeight,
     3945                                (prectl->yTop - prectl->yBottom) - 116);
     3946            AutoviewHeight = max(AutoviewHeight, 36);
     3947            prectl->yBottom += (AutoviewHeight + 6);
     3948          }
     3949        }
    39513950      }
    39523951      return mr;
     
    39723971      pswp = (PSWP) mp1;
    39733972      {
    3974         SHORT x;
    3975 
    3976         for (x = 0; x < soldCount; x++) {
    3977           if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
    3978             pswpClient = pswp;
    3979             break;
    3980           }
    3981           pswp++;
    3982         }
     3973        SHORT x;
     3974
     3975        for (x = 0; x < soldCount; x++) {
     3976          if (WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_CLIENT) {
     3977            pswpClient = pswp;
     3978            break;
     3979          }
     3980          pswp++;
     3981        }
    39833982      }
    39843983
    39853984      {
    3986         HPS hps;
    3987         POINTL aptl[TXTBOX_COUNT];
    3988 
    3989         hps = WinGetPS(hwndStatus);
    3990         if (hps) {
    3991           GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
    3992           bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
    3993           WinReleasePS(hps);
    3994         }
    3995         if (fMoreButtons) {
    3996           hps = WinGetPS(hwndName);
    3997           if (hps) {
    3998             GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
    3999             bheight = aptl[TXTBOX_TOPLEFT].y + 6;
    4000             WinReleasePS(hps);
    4001           }
    4002         }
     3985        HPS hps;
     3986        POINTL aptl[TXTBOX_COUNT];
     3987
     3988        hps = WinGetPS(hwndStatus);
     3989        if (hps) {
     3990          GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
     3991          bheight = sheight = aptl[TXTBOX_TOPLEFT].y + 6;
     3992          WinReleasePS(hps);
     3993        }
     3994        if (fMoreButtons) {
     3995          hps = WinGetPS(hwndName);
     3996          if (hps) {
     3997            GpiQueryTextBox(hps, 6, "$`WjgT", TXTBOX_COUNT, aptl);
     3998            bheight = aptl[TXTBOX_TOPLEFT].y + 6;
     3999            WinReleasePS(hps);
     4000          }
     4001        }
    40034002      }
    40044003      pswpNew = (PSWP) mp1 + soldCount;
     
    40104009      pswpNew->y = swpClient.y + 2;
    40114010      if (!fSplitStatus)
    4012         width = swpClient.cx - (16 + (sheight * 2) + 4);
     4011        width = swpClient.cx - (16 + (sheight * 2) + 4);
    40134012      else
    4014         width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2;
     4013        width = (swpClient.cx - (16 + (sheight * 2) + 4)) / 2;
    40154014      width = max(width, 10);
    40164015      if (fSplitStatus)
    4017         pswpNew->cx = width - 6;
     4016        pswpNew->cx = width - 6;
    40184017      else
    4019         pswpNew->cx = width - 8;
     4018        pswpNew->cx = width - 8;
    40204019      pswpNew->cy = sheight;
    40214020      pswpClient->y = pswpNew->y + pswpNew->cy + 3;
     
    40244023
    40254024      if (fSplitStatus) {
    4026         pswpNew = (PSWP) mp1 + (soldCount + 1);
    4027         *pswpNew = *pswpClient;
    4028         pswpNew->hwnd = hwndStatus2;
    4029         pswpNew->hwndInsertBehind = HWND_BOTTOM;
    4030         pswpNew->x = width + 8;
    4031         pswpNew->y = swpClient.y + 2;
    4032         pswpNew->cx = width - 6;
    4033         pswpNew->cy = sheight;
    4034         sCount++;
     4025        pswpNew = (PSWP) mp1 + (soldCount + 1);
     4026        *pswpNew = *pswpClient;
     4027        pswpNew->hwnd = hwndStatus2;
     4028        pswpNew->hwndInsertBehind = HWND_BOTTOM;
     4029        pswpNew->x = width + 8;
     4030        pswpNew->y = swpClient.y + 2;
     4031        pswpNew->cx = width - 6;
     4032        pswpNew->cy = sheight;
     4033        sCount++;
    40354034      }
    40364035      else {
    4037         WinShowWindow(hwndStatus2, FALSE);
    4038         WinSetWindowText(hwndStatus2, NullStr);
     4036        WinShowWindow(hwndStatus2, FALSE);
     4037        WinSetWindowText(hwndStatus2, NullStr);
    40394038      }
    40404039
    40414040      if (fToolbar) {
    4042         if (fTextTools)
    4043           theight = 32L;
    4044         else if (!fToolTitles)
    4045           theight = 40L;
    4046         pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE));
    4047         *pswpNew = *pswpClient;
    4048         pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);
    4049         pswpNew->hwndInsertBehind = HWND_BOTTOM;
    4050         pswpNew->x = swpClient.x + 2;
    4051         pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);
    4052         pswpNew->cx = swpClient.cx - 4;
    4053         pswpNew->cy = theight - 4;
    4054         pswpClient->cy -= theight;
    4055         sCount++;
     4041        if (fTextTools)
     4042          theight = 32L;
     4043        else if (!fToolTitles)
     4044          theight = 40L;
     4045        pswpNew = (PSWP) mp1 + (soldCount + 1 + (fSplitStatus != FALSE));
     4046        *pswpNew = *pswpClient;
     4047        pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_TOOLS);
     4048        pswpNew->hwndInsertBehind = HWND_BOTTOM;
     4049        pswpNew->x = swpClient.x + 2;
     4050        pswpNew->y = (swpClient.y + swpClient.cy) - (theight - 2);
     4051        pswpNew->cx = swpClient.cx - 4;
     4052        pswpNew->cy = theight - 4;
     4053        pswpClient->cy -= theight;
     4054        sCount++;
    40564055      }
    40574056      else
    4058         WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);
     4057        WinShowWindow(WinWindowFromID(hwnd, MAIN_TOOLS), FALSE);
    40594058
    40604059      if (fDrivebar) {
    4061         ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);
    4062         pswpNew = (PSWP) mp1 + (soldCount + 1 +
    4063                                 (fSplitStatus != FALSE) +
    4064                                 (fToolbar != FALSE));
    4065         *pswpNew = *pswpClient;
    4066         pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
    4067         pswpNew->hwndInsertBehind = HWND_BOTTOM;
    4068         pswpNew->x = swpClient.x + 2;
    4069         dheight += ((dheight - 2) * DriveLines);
    4070         pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
    4071         if (fToolbar)
    4072           pswpNew->y -= theight;
    4073         pswpNew->cx = swpClient.cx - 4;
    4074         pswpNew->cy = dheight - 4;
    4075         pswpClient->cy -= dheight;
    4076         sCount++;
     4060        ResizeDrives(WinWindowFromID(hwnd, MAIN_DRIVES), pswpClient->cx - 4);
     4061        pswpNew = (PSWP) mp1 + (soldCount + 1 +
     4062                                (fSplitStatus != FALSE) +
     4063                                (fToolbar != FALSE));
     4064        *pswpNew = *pswpClient;
     4065        pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_DRIVES);
     4066        pswpNew->hwndInsertBehind = HWND_BOTTOM;
     4067        pswpNew->x = swpClient.x + 2;
     4068        dheight += ((dheight - 2) * DriveLines);
     4069        pswpNew->y = (swpClient.y + swpClient.cy) - (dheight - 2);
     4070        if (fToolbar)
     4071          pswpNew->y -= theight;
     4072        pswpNew->cx = swpClient.cx - 4;
     4073        pswpNew->cy = dheight - 4;
     4074        pswpClient->cy -= dheight;
     4075        sCount++;
    40774076      }
    40784077      else
    4079         WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE);
     4078        WinShowWindow(WinWindowFromID(hwnd, MAIN_DRIVES), FALSE);
    40804079
    40814080      if (fAutoView) {
    4082         pswpNew = (PSWP) mp1 + (soldCount + 1 +
    4083                                 (fToolbar != FALSE) +
    4084                                 (fDrivebar != FALSE) +
    4085                                 (fSplitStatus != FALSE));
    4086         *pswpNew = *pswpClient;
    4087         pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
    4088         pswpNew->x = pswpClient->x + 3;
    4089         pswpNew->y = pswpClient->y + 3;
    4090         if (fMoreButtons)
    4091           pswpNew->y += (bheight + 4);
    4092         pswpNew->cx = pswpClient->cx - 6;
    4093         AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
    4094         AutoviewHeight = max(AutoviewHeight, 36);
    4095         pswpNew->cy = AutoviewHeight;
    4096         pswpClient->y += (AutoviewHeight + 6);
    4097         pswpClient->cy -= (AutoviewHeight + 6);
    4098         sCount++;
    4099         WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);
     4081        pswpNew = (PSWP) mp1 + (soldCount + 1 +
     4082                                (fToolbar != FALSE) +
     4083                                (fDrivebar != FALSE) +
     4084                                (fSplitStatus != FALSE));
     4085        *pswpNew = *pswpClient;
     4086        pswpNew->hwnd = (fComments) ? hwndAutoMLE : hwndAutoview;
     4087        pswpNew->x = pswpClient->x + 3;
     4088        pswpNew->y = pswpClient->y + 3;
     4089        if (fMoreButtons)
     4090          pswpNew->y += (bheight + 4);
     4091        pswpNew->cx = pswpClient->cx - 6;
     4092        AutoviewHeight = min(AutoviewHeight, pswpClient->cy - 116);
     4093        AutoviewHeight = max(AutoviewHeight, 36);
     4094        pswpNew->cy = AutoviewHeight;
     4095        pswpClient->y += (AutoviewHeight + 6);
     4096        pswpClient->cy -= (AutoviewHeight + 6);
     4097        sCount++;
     4098        WinShowWindow((fComments) ? hwndAutoview : hwndAutoMLE, FALSE);
    41004099      }
    41014100      else {
    4102         WinShowWindow(hwndAutoview, FALSE);
    4103         WinShowWindow(hwndAutoMLE, FALSE);
     4101        WinShowWindow(hwndAutoview, FALSE);
     4102        WinShowWindow(hwndAutoMLE, FALSE);
    41044103      }
    41054104
    41064105      pswpNew = (PSWP) mp1 + (soldCount + 1 +
    4107                               (fToolbar != FALSE) +
    4108                               (fDrivebar != FALSE) +
    4109                               (fSplitStatus != FALSE) + (fAutoView != FALSE));
     4106                              (fToolbar != FALSE) +
     4107                              (fDrivebar != FALSE) +
     4108                              (fSplitStatus != FALSE) + (fAutoView != FALSE));
    41104109      *pswpNew = *pswpClient;
    41114110      pswpNew->hwnd = WinWindowFromID(hwnd, IDM_OPENWALK);
     
    41164115      sCount++;
    41174116      pswpNew = (PSWP) mp1 + (soldCount + 2 +
    4118                               (fToolbar != FALSE) +
    4119                               (fDrivebar != FALSE) +
    4120                               (fSplitStatus != FALSE) + (fAutoView != FALSE));
     4117                              (fToolbar != FALSE) +
     4118                              (fDrivebar != FALSE) +
     4119                              (fSplitStatus != FALSE) + (fAutoView != FALSE));
    41214120      *pswpNew = *pswpClient;
    41224121      pswpNew->hwnd = WinWindowFromID(hwnd, IDM_USERLIST);
     
    41274126      sCount++;
    41284127      pswpNew = (PSWP) mp1 + (soldCount + 3 +
    4129                               (fToolbar != FALSE) +
    4130                               (fDrivebar != FALSE) +
    4131                               (fSplitStatus != FALSE) + (fAutoView != FALSE));
     4128                              (fToolbar != FALSE) +
     4129                              (fDrivebar != FALSE) +
     4130                              (fSplitStatus != FALSE) + (fAutoView != FALSE));
    41324131      *pswpNew = *pswpClient;
    41334132      pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LED);
     
    41384137      sCount++;
    41394138      pswpNew = (PSWP) mp1 + (soldCount + 4 +
    4140                               (fToolbar != FALSE) +
    4141                               (fDrivebar != FALSE) +
    4142                               (fSplitStatus != FALSE) + (fAutoView != FALSE));
     4139                              (fToolbar != FALSE) +
     4140                              (fDrivebar != FALSE) +
     4141                              (fSplitStatus != FALSE) + (fAutoView != FALSE));
    41434142      *pswpNew = *pswpClient;
    41444143      pswpNew->hwnd = WinWindowFromID(hwnd, MAIN_LEDHDR);
     
    41494148      sCount++;
    41504149      if (fUserComboBox) {
    4151         if (!aheight) {
    4152 
    4153           SWP swpTemp;
    4154 
    4155           WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
    4156                             &swpTemp);
    4157           aheight = swpTemp.cy;
    4158         }
    4159         pswpNew = (PSWP) mp1 + (soldCount + 5 +
    4160                                 (fToolbar != FALSE) +
    4161                                 (fSplitStatus != FALSE) +
    4162                                 (fDrivebar != FALSE) + (fAutoView != FALSE));
    4163         *pswpNew = *pswpClient;
    4164         pswpNew->hwnd = hwndDrivelist;
    4165         pswpNew->x = swpClient.x;
    4166         pswpNew->cx = 48;
    4167         pswpClient->cy -= (aheight + 6L);
    4168         pswpNew->y = pswpClient->y;
    4169         pswpNew->cy = pswpClient->cy + (aheight + 5L);
    4170         sCount++;
    4171         pswpNew = (PSWP) mp1 + (soldCount + 6 +
    4172                                 (fToolbar != FALSE) +
    4173                                 (fDrivebar != FALSE) +
    4174                                 (fSplitStatus != FALSE) +
    4175                                 (fAutoView != FALSE));
    4176         *pswpNew = *pswpClient;
    4177         pswpNew->hwnd = hwndStatelist;
    4178         pswpNew->x = swpClient.x + 48;
    4179         pswpNew->cx = (swpClient.cx - 48) / 7;
    4180         pswpNew->y = pswpClient->y;
    4181         pswpNew->cy = pswpClient->cy + (aheight + 5L);
    4182         sCount++;
    4183         pswpNew = (PSWP) mp1 + (soldCount + 7 +
    4184                                 (fToolbar != FALSE) +
    4185                                 (fDrivebar != FALSE) +
    4186                                 (fSplitStatus != FALSE) +
    4187                                 (fAutoView != FALSE));
    4188         *pswpNew = *pswpClient;
    4189         pswpNew->hwnd = hwndCmdlist;
    4190         pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7);
    4191         pswpNew->cx = (swpClient.cx - 48) / 5 +
    4192           ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7);
    4193         pswpNew->y = pswpClient->y;
    4194         pswpNew->cy = pswpClient->cy + (aheight + 5L);
    4195         sCount++;
    4196         pswpNew = (PSWP) mp1 + (soldCount + 8 +
    4197                                 (fToolbar != FALSE) +
    4198                                 (fDrivebar != FALSE) +
    4199                                 (fSplitStatus != FALSE) +
    4200                                 (fAutoView != FALSE));
    4201         *pswpNew = *pswpClient;
    4202         pswpNew->hwnd = hwndUserlist;
    4203         pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2);
    4204         pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) -
    4205           ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0);
    4206         pswpNew->y = pswpClient->y;
    4207         pswpNew->cy = pswpClient->cy + (aheight + 5L);
    4208         sCount++;
    4209         if (fToolbar) {
    4210           pswpNew = (PSWP) mp1 + (soldCount + 9 +
    4211                                   (fToolbar != FALSE) +
    4212                                   (fDrivebar != FALSE) +
    4213                                   (fSplitStatus != FALSE) +
    4214                                   (fAutoView != FALSE));
    4215           *pswpNew = *pswpClient;
    4216           pswpNew->hwnd = hwndButtonlist;
    4217           pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4;
    4218           pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x;
    4219           pswpNew->y = pswpClient->y;
    4220           pswpNew->cy = pswpClient->cy + (aheight + 5L);
    4221           sCount++;
    4222         }
    4223         else
    4224           WinShowWindow(hwndButtonlist, FALSE);
     4150        if (!aheight) {
     4151
     4152          SWP swpTemp;
     4153
     4154          WinQueryWindowPos(WinWindowFromID(hwndDrivelist, CBID_EDIT),
     4155                            &swpTemp);
     4156          aheight = swpTemp.cy;
     4157        }
     4158        pswpNew = (PSWP) mp1 + (soldCount + 5 +
     4159                                (fToolbar != FALSE) +
     4160                                (fSplitStatus != FALSE) +
     4161                                (fDrivebar != FALSE) + (fAutoView != FALSE));
     4162        *pswpNew = *pswpClient;
     4163        pswpNew->hwnd = hwndDrivelist;
     4164        pswpNew->x = swpClient.x;
     4165        pswpNew->cx = 48;
     4166        pswpClient->cy -= (aheight + 6L);
     4167        pswpNew->y = pswpClient->y;
     4168        pswpNew->cy = pswpClient->cy + (aheight + 5L);
     4169        sCount++;
     4170        pswpNew = (PSWP) mp1 + (soldCount + 6 +
     4171                                (fToolbar != FALSE) +
     4172                                (fDrivebar != FALSE) +
     4173                                (fSplitStatus != FALSE) +
     4174                                (fAutoView != FALSE));
     4175        *pswpNew = *pswpClient;
     4176        pswpNew->hwnd = hwndStatelist;
     4177        pswpNew->x = swpClient.x + 48;
     4178        pswpNew->cx = (swpClient.cx - 48) / 7;
     4179        pswpNew->y = pswpClient->y;
     4180        pswpNew->cy = pswpClient->cy + (aheight + 5L);
     4181        sCount++;
     4182        pswpNew = (PSWP) mp1 + (soldCount + 7 +
     4183                                (fToolbar != FALSE) +
     4184                                (fDrivebar != FALSE) +
     4185                                (fSplitStatus != FALSE) +
     4186                                (fAutoView != FALSE));
     4187        *pswpNew = *pswpClient;
     4188        pswpNew->hwnd = hwndCmdlist;
     4189        pswpNew->x = swpClient.x + 48 + ((swpClient.cx - 48) / 7);
     4190        pswpNew->cx = (swpClient.cx - 48) / 5 +
     4191          ((swpClient.cx - 48) / 5) - ((swpClient.cx - 48) / 7);
     4192        pswpNew->y = pswpClient->y;
     4193        pswpNew->cy = pswpClient->cy + (aheight + 5L);
     4194        sCount++;
     4195        pswpNew = (PSWP) mp1 + (soldCount + 8 +
     4196                                (fToolbar != FALSE) +
     4197                                (fDrivebar != FALSE) +
     4198                                (fSplitStatus != FALSE) +
     4199                                (fAutoView != FALSE));
     4200        *pswpNew = *pswpClient;
     4201        pswpNew->hwnd = hwndUserlist;
     4202        pswpNew->x = swpClient.x + 48 + (((swpClient.cx - 48) / 5) * 2);
     4203        pswpNew->cx = ((swpClient.x + swpClient.cx) - pswpNew->x) -
     4204          ((fToolbar) ? ((swpClient.cx - 48) / 7) : 0);
     4205        pswpNew->y = pswpClient->y;
     4206        pswpNew->cy = pswpClient->cy + (aheight + 5L);
     4207        sCount++;
     4208        if (fToolbar) {
     4209          pswpNew = (PSWP) mp1 + (soldCount + 9 +
     4210                                  (fToolbar != FALSE) +
     4211                                  (fDrivebar != FALSE) +
     4212                                  (fSplitStatus != FALSE) +
     4213                                  (fAutoView != FALSE));
     4214          *pswpNew = *pswpClient;
     4215          pswpNew->hwnd = hwndButtonlist;
     4216          pswpNew->x = swpClient.cx - ((swpClient.cx - 48) / 7) + 4;
     4217          pswpNew->cx = (swpClient.x + swpClient.cx) - pswpNew->x;
     4218          pswpNew->y = pswpClient->y;
     4219          pswpNew->cy = pswpClient->cy + (aheight + 5L);
     4220          sCount++;
     4221        }
     4222        else
     4223          WinShowWindow(hwndButtonlist, FALSE);
    42254224      }
    42264225      else {
    4227         WinShowWindow(hwndUserlist, FALSE);
    4228         WinShowWindow(hwndDrivelist, FALSE);
    4229         WinShowWindow(hwndStatelist, FALSE);
    4230         WinShowWindow(hwndButtonlist, FALSE);
    4231         WinShowWindow(hwndCmdlist, FALSE);
     4226        WinShowWindow(hwndUserlist, FALSE);
     4227        WinShowWindow(hwndDrivelist, FALSE);
     4228        WinShowWindow(hwndStatelist, FALSE);
     4229        WinShowWindow(hwndButtonlist, FALSE);
     4230        WinShowWindow(hwndCmdlist, FALSE);
    42324231      }
    42334232      {
    4234         PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;
    4235         SHORT x;
    4236 
    4237         pswpNew = (PSWP) mp1 + (soldCount + 5 +
    4238                                 (fToolbar != FALSE) +
    4239                                 (fDrivebar != FALSE) +
    4240                                 (fSplitStatus != FALSE) +
    4241                                 (fAutoView != FALSE) +
    4242                                 ((fUserComboBox != FALSE) * 4) +
    4243                                 (fUserComboBox != FALSE &&
    4244                                 fToolbar != FALSE));
    4245         pswp = (PSWP) mp1;
    4246         for (x = 0; x < soldCount; x++) {
    4247           if (!pswpTitlebar &&
    4248               WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)
    4249             pswpTitlebar = pswp;
    4250           else if (!pswpMinbutton &&
    4251                    WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)
    4252             pswpMinbutton = pswp;
    4253           if (pswpTitlebar && pswpMinbutton)
    4254             break;
    4255           pswp++;
    4256         }
    4257         if (pswpMinbutton && pswpTitlebar) {
    4258           *pswpNew = *pswpMinbutton;
    4259           pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE);
    4260           pswpNew->cy = pswpMinbutton->cy + 3;
    4261           pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);
    4262           pswpTitlebar->cx -= (pswpNew->cx - 1);
    4263           pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx);
    4264           pswpNew->y = pswpMinbutton->y - 1;
    4265           sCount++;
    4266         }
    4267         else
    4268           WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE);
     4233        PSWP pswpTitlebar = (PSWP) 0, pswpMinbutton = (PSWP) 0;
     4234        SHORT x;
     4235
     4236        pswpNew = (PSWP) mp1 + (soldCount + 5 +
     4237                                (fToolbar != FALSE) +
     4238                                (fDrivebar != FALSE) +
     4239                                (fSplitStatus != FALSE) +
     4240                                (fAutoView != FALSE) +
     4241                                ((fUserComboBox != FALSE) * 4) +
     4242                                (fUserComboBox != FALSE &&
     4243                                fToolbar != FALSE));
     4244        pswp = (PSWP) mp1;
     4245        for (x = 0; x < soldCount; x++) {
     4246          if (!pswpTitlebar &&
     4247              WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_TITLEBAR)
     4248            pswpTitlebar = pswp;
     4249          else if (!pswpMinbutton &&
     4250                   WinQueryWindowUShort(pswp->hwnd, QWS_ID) == FID_MINMAX)
     4251            pswpMinbutton = pswp;
     4252          if (pswpTitlebar && pswpMinbutton)
     4253            break;
     4254          pswp++;
     4255        }
     4256        if (pswpMinbutton && pswpTitlebar) {
     4257          *pswpNew = *pswpMinbutton;
     4258          pswpNew->hwnd = WinWindowFromID(hwnd, IDM_IDEALSIZE);
     4259          pswpNew->cy = pswpMinbutton->cy + 3;
     4260          pswpNew->cx = min(pswpNew->cy, (pswpMinbutton->cx / 2) + 3);
     4261          pswpTitlebar->cx -= (pswpNew->cx - 1);
     4262          pswpNew->x = pswpTitlebar->x + (pswpTitlebar->cx);
     4263          pswpNew->y = pswpMinbutton->y - 1;
     4264          sCount++;
     4265        }
     4266        else
     4267          WinShowWindow(WinWindowFromID(hwnd, IDM_IDEALSIZE), FALSE);
    42694268      }
    42704269
    42714270      if (fMoreButtons) {
    42724271
    4273         LONG lastx;
    4274 
    4275         pswpNew = (PSWP) mp1 + (soldCount + 6 +
    4276                                 (fToolbar != FALSE) +
    4277                                 (fDrivebar != FALSE) +
    4278                                 (fSplitStatus != FALSE) +
    4279                                 (fAutoView != FALSE) +
    4280                                 ((fUserComboBox != FALSE) * 4) +
    4281                                 (fUserComboBox != FALSE &&
    4282                                 fToolbar != FALSE));
    4283         *pswpNew = *pswpClient;
    4284         pswpNew->hwnd = hwndName;
    4285         pswpNew->x = swpClient.x + 3;
    4286         pswpNew->y = swpClient.y + (sheight + 6);
    4287         pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;
    4288         lastx = pswpNew->x + pswpNew->cx;
    4289         pswpNew->cy = bheight;
    4290         pswpClient->y += (bheight + 4);
    4291         pswpClient->cy -= (bheight + 4);
    4292         sCount++;
    4293         pswpNew = (PSWP) mp1 + (soldCount + 7 +
    4294                                 (fToolbar != FALSE) +
    4295                                 (fDrivebar != FALSE) +
    4296                                 (fSplitStatus != FALSE) +
    4297                                 (fAutoView != FALSE) +
    4298                                 ((fUserComboBox != FALSE) * 4) +
    4299                                 (fUserComboBox != FALSE &&
    4300                                 fToolbar != FALSE));
    4301         *pswpNew = *pswpClient;
    4302         pswpNew->hwnd = hwndDate;
    4303         pswpNew->x = lastx + 3;
    4304         pswpNew->y = swpClient.y + (sheight + 6);
    4305         pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;
    4306         lastx = pswpNew->x + pswpNew->cx;
    4307         pswpNew->cy = bheight;
    4308         sCount++;
    4309         pswpNew = (PSWP) mp1 + (soldCount + 8 +
    4310                                 (fToolbar != FALSE) +
    4311                                 (fDrivebar != FALSE) +
    4312                                 (fSplitStatus != FALSE) +
    4313                                 (fAutoView != FALSE) +
    4314                                 ((fUserComboBox != FALSE) * 4) +
    4315                                 (fUserComboBox != FALSE &&
    4316                                 fToolbar != FALSE));
    4317         *pswpNew = *pswpClient;
    4318         pswpNew->hwnd = hwndAttr;
    4319         pswpNew->x = lastx + 3;
    4320         pswpNew->y = swpClient.y + (sheight + 6);
    4321         pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;
    4322         pswpNew->cy = bheight;
    4323         sCount++;
     4272        LONG lastx;
     4273
     4274        pswpNew = (PSWP) mp1 + (soldCount + 6 +
     4275                                (fToolbar != FALSE) +
     4276                                (fDrivebar != FALSE) +
     4277                                (fSplitStatus != FALSE) +
     4278                                (fAutoView != FALSE) +
     4279                                ((fUserComboBox != FALSE) * 4) +
     4280                                (fUserComboBox != FALSE &&
     4281                                fToolbar != FALSE));
     4282        *pswpNew = *pswpClient;
     4283        pswpNew->hwnd = hwndName;
     4284        pswpNew->x = swpClient.x + 3;
     4285        pswpNew->y = swpClient.y + (sheight + 6);
     4286        pswpNew->cx = ((swpClient.cx / 2) + (swpClient.cx / 5)) - 3;
     4287        lastx = pswpNew->x + pswpNew->cx;
     4288        pswpNew->cy = bheight;
     4289        pswpClient->y += (bheight + 4);
     4290        pswpClient->cy -= (bheight + 4);
     4291        sCount++;
     4292        pswpNew = (PSWP) mp1 + (soldCount + 7 +
     4293                                (fToolbar != FALSE) +
     4294                                (fDrivebar != FALSE) +
     4295                                (fSplitStatus != FALSE) +
     4296                                (fAutoView != FALSE) +
     4297                                ((fUserComboBox != FALSE) * 4) +
     4298                                (fUserComboBox != FALSE &&
     4299                                fToolbar != FALSE));
     4300        *pswpNew = *pswpClient;
     4301        pswpNew->hwnd = hwndDate;
     4302        pswpNew->x = lastx + 3;
     4303        pswpNew->y = swpClient.y + (sheight + 6);
     4304        pswpNew->cx = (swpClient.cx / 6) + (swpClient.cx / 16) - 3;
     4305        lastx = pswpNew->x + pswpNew->cx;
     4306        pswpNew->cy = bheight;
     4307        sCount++;
     4308        pswpNew = (PSWP) mp1 + (soldCount + 8 +
     4309                                (fToolbar != FALSE) +
     4310                                (fDrivebar != FALSE) +
     4311                                (fSplitStatus != FALSE) +
     4312                                (fAutoView != FALSE) +
     4313                                ((fUserComboBox != FALSE) * 4) +
     4314                                (fUserComboBox != FALSE &&
     4315                                fToolbar != FALSE));
     4316        *pswpNew = *pswpClient;
     4317        pswpNew->hwnd = hwndAttr;
     4318        pswpNew->x = lastx + 3;
     4319        pswpNew->y = swpClient.y + (sheight + 6);
     4320        pswpNew->cx = (swpClient.cx - pswpNew->x) - 1;
     4321        pswpNew->cy = bheight;
     4322        sCount++;
    43244323      }
    43254324      else {
    4326         WinShowWindow(hwndAttr, FALSE);
    4327         WinShowWindow(hwndName, FALSE);
    4328         WinShowWindow(hwndDate, FALSE);
     4325        WinShowWindow(hwndAttr, FALSE);
     4326        WinShowWindow(hwndName, FALSE);
     4327        WinShowWindow(hwndDate, FALSE);
    43294328      }
    43304329      return MRFROMSHORT(sCount);
     
    43394338      sCount += 6;
    43404339      if (fSplitStatus)
    4341         sCount++;
     4340        sCount++;
    43424341      if (fToolbar)
    4343         sCount++;
     4342        sCount++;
    43444343      if (fUserComboBox) {
    4345         sCount += 4;
    4346         if (fToolbar)
    4347           sCount++;
     4344        sCount += 4;
     4345        if (fToolbar)
     4346          sCount++;
    43484347      }
    43494348      if (fDrivebar)
    4350         sCount++;
     4349        sCount++;
    43514350      if (fAutoView)
    4352         sCount++;
     4351        sCount++;
    43534352      if (fMoreButtons)
    4354         sCount += 3;
     4353        sCount += 3;
    43554354      return MRFROMSHORT(sCount);
    43564355    }
     
    43734372      // DbgMsg(pszSrcFile, __LINE__, "IDM_CONTEXTMENU %x", hwnd);
    43744373      if (hwnd != NULLHANDLE) {
    4375         HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
    4376         USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID);
    4377         switch (id) {
    4378         case MAIN_SETUPLIST:
    4379         case MAIN_USERLIST:
    4380         case MAIN_CMDLIST:
    4381           // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU");
    4382           WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0);
    4383         }
     4374        HWND hwndParent = WinQueryWindow(hwnd, QW_PARENT);
     4375        USHORT id = WinQueryWindowUShort(hwndParent, QWS_ID);
     4376        switch (id) {
     4377        case MAIN_SETUPLIST:
     4378        case MAIN_USERLIST:
     4379        case MAIN_CMDLIST:
     4380          // DbgMsg(pszSrcFile, __LINE__, "WM_CONTEXTMENU");
     4381          WinPostMsg(hwnd, WM_CONTEXTMENU, 0, 0);
     4382        }
    43844383      }
    43854384    }
     
    44104409      wa.size = sizeof(wa);
    44114410      pci =
    4412         (PCNRITEM)
    4413         WinSendMsg(WinWindowFromID
    4414                    (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
    4415                    CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
    4416                    MPFROMSHORT(CRA_CURSORED));
     4411        (PCNRITEM)
     4412        WinSendMsg(WinWindowFromID
     4413                   (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR),
     4414                   CM_QUERYRECORDEMPHASIS, MPFROMLONG(CMA_FIRST),
     4415                   MPFROMSHORT(CRA_CURSORED));
    44174416      if (pci && (INT) pci != -1) {
    4418         strcpy(wa.szCurrentPath1, pci->pszFileName);
    4419         MakeValidDir(wa.szCurrentPath1);
     4417        strcpy(wa.szCurrentPath1, pci->pszFileName);
     4418        MakeValidDir(wa.szCurrentPath1);
    44204419      }
    44214420      else
    4422         save_dir2(wa.szCurrentPath1);
     4421        save_dir2(wa.szCurrentPath1);
    44234422      TopWindowName(hwndMain, (HWND) 0, wa.szCurrentPath2);
    44244423      if (!*wa.szCurrentPath2)
    4425         strcpy(wa.szCurrentPath2, wa.szCurrentPath1);
     4424        strcpy(wa.szCurrentPath2, wa.szCurrentPath1);
    44264425      MakeValidDir(wa.szCurrentPath2);
    44274426      if (WinDlgBox(HWND_DESKTOP,
    4428                     hwnd,
    4429                     WalkTwoCmpDlgProc,
    4430                     FM3ModHandle,
    4431                     WALK2_FRAME,
    4432                     MPFROMP(&wa)) &&
    4433           !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) {
    4434         if (!*dircompare) {
    4435 
    4436           COMPARE *cmp;
    4437 
    4438           cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
    4439           if (cmp) {
    4440             cmp->size = sizeof(COMPARE);
    4441             strcpy(cmp->leftdir, wa.szCurrentPath1);
    4442             strcpy(cmp->rightdir, wa.szCurrentPath2);
    4443             cmp->hwndParent = hwnd;
    4444             cmp->dcd.hwndParent = hwnd;
    4445             WinDlgBox(HWND_DESKTOP,
    4446                       HWND_DESKTOP,
    4447                       CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
    4448           }
    4449         }
    4450         else {
    4451 
    4452           CHAR szPath1[CCHMAXPATH];
    4453           CHAR szPath2[CCHMAXPATH];
    4454           runemf2(SEPARATE,
    4455                   HWND_DESKTOP, pszSrcFile, __LINE__,
    4456                   NULL, NULL,
    4457                   "%s %s %s",
    4458                   dircompare,
    4459                   BldQuotedFileName(szPath1, wa.szCurrentPath1),
    4460                   BldQuotedFileName(szPath2, wa.szCurrentPath2));
    4461         }
     4427                    hwnd,
     4428                    WalkTwoCmpDlgProc,
     4429                    FM3ModHandle,
     4430                    WALK2_FRAME,
     4431                    MPFROMP(&wa)) &&
     4432          !IsFile(wa.szCurrentPath1) && !IsFile(wa.szCurrentPath2)) {
     4433        if (!*dircompare) {
     4434
     4435          COMPARE *cmp;
     4436
     4437          cmp = xmallocz(sizeof(COMPARE), pszSrcFile, __LINE__);
     4438          if (cmp) {
     4439            cmp->size = sizeof(COMPARE);
     4440            strcpy(cmp->leftdir, wa.szCurrentPath1);
     4441            strcpy(cmp->rightdir, wa.szCurrentPath2);
     4442            cmp->hwndParent = hwnd;
     4443            cmp->dcd.hwndParent = hwnd;
     4444            WinDlgBox(HWND_DESKTOP,
     4445                      HWND_DESKTOP,
     4446                      CompareDlgProc, FM3ModHandle, COMP_FRAME, MPFROMP(cmp));
     4447          }
     4448        }
     4449        else {
     4450
     4451          CHAR szPath1[CCHMAXPATH];
     4452          CHAR szPath2[CCHMAXPATH];
     4453          runemf2(SEPARATE,
     4454                  HWND_DESKTOP, pszSrcFile, __LINE__,
     4455                  NULL, NULL,
     4456                  "%s %s %s",
     4457                  dircompare,
     4458                  BldQuotedFileName(szPath1, wa.szCurrentPath1),
     4459                  BldQuotedFileName(szPath2, wa.szCurrentPath2));
     4460        }
    44624461      }
    44634462    }
     
    44714470  case IDM_CLI:
    44724471    if (fSplitStatus &&
    4473         hwndStatus2 &&
    4474         !WinIsWindow(WinQueryAnchorBlock(hwnd),
    4475                      WinWindowFromID(hwndStatus2, COMMAND_LINE)))
     4472        hwndStatus2 &&
     4473        !WinIsWindow(WinQueryAnchorBlock(hwnd),
     4474                     WinWindowFromID(hwndStatus2, COMMAND_LINE)))
    44764475      PostMsg(hwndStatus2, UM_CLICKED, MPVOID, MPVOID);
    44774476    break;
     
    44864485      bstrip(temp);
    44874486      if (*temp &&
    4488           !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) {
    4489         if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {
    4490           add_udir(TRUE, path);
    4491           if (fUdirsChanged)
    4492             save_udirs();
    4493           WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
    4494         }
    4495         else {
    4496           if (!remove_udir(path))
    4497             Runtime_Error(pszSrcFile, __LINE__, "remove_udir");
    4498           else {
    4499             if (fUdirsChanged)
    4500               save_udirs();
    4501             WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
    4502           }
    4503         }
     4487          !DosQueryPathInfo(temp, FIL_QUERYFULLNAME, path, sizeof(path))) {
     4488        if (SHORT1FROMMP(mp1) == IDM_ADDTOUSERLIST) {
     4489          add_udir(TRUE, path);
     4490          if (fUdirsChanged)
     4491            save_udirs();
     4492          WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
     4493        }
     4494        else {
     4495          if (!remove_udir(path))
     4496            Runtime_Error(pszSrcFile, __LINE__, "remove_udir");
     4497          else {
     4498            if (fUdirsChanged)
     4499              save_udirs();
     4500            WinSendMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
     4501          }
     4502        }
    45044503      }
    45054504    }
     
    45164515      // Ignore request if blank or attempting to using illegal name
    45174516      if (*szStateName && stricmp(szStateName, GetPString(IDS_STATETEXT))) {
    4518         if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {
    4519           // Save
    4520           INT nSaved = SaveDirCnrState(hwnd, szStateName);
    4521           if (nSaved > 0) {
    4522             INT ret = add_setup(szStateName);
    4523             if (ret == 0) {
    4524               WinSendMsg(hwndStatelist, LM_INSERTITEM,
    4525                         MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName));
    4526               save_setups();
    4527             }
    4528             else if (ret != 1) {
    4529               saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
    4530                      GetPString(IDS_WARNINGTEXT),
    4531                      "\"%s\" state name add failed", szStateName);      // 15 Apr 07 SHL failed
    4532               WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
    4533             }
    4534           }
    4535           else {
    4536             saymsg(MB_ENTER | MB_ICONASTERISK,
    4537                    hwnd,
    4538                    GetPString(IDS_WARNINGTEXT),
    4539                    nSaved == 0 ?
    4540                      "Nothing to save" :
    4541                      "State data save failed");
    4542             WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
    4543           }
    4544         }
    4545         else {
    4546           // Delete
    4547           ULONG numsaves = 0, size, x;
    4548           CHAR s[STATE_NAME_MAX_BYTES + 80];
    4549 
    4550           INT ret = remove_setup(szStateName);
    4551           if (ret == 1)
    4552             save_setups();
    4553           sprintf(s, "%s.NumDirsLastTime", szStateName);
    4554           size = sizeof(ULONG);
    4555           if (!PrfQueryProfileData(fmprof,
    4556                                    FM3Str,
    4557                                    s,
    4558                                    (PVOID)&numsaves,
    4559                                    &size)) {
    4560             saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
    4561                    GetPString(IDS_WARNINGTEXT),
    4562                    GetPString(IDS_DOESNTEXISTTEXT), szStateName);
    4563           }
    4564           else if (!size)
    4565             Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    4566           else {
    4567             PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L);
    4568             for (x = 0; x < numsaves; x++) {
    4569               sprintf(s, "%s.DirCnrPos.%lu", szStateName, x);
    4570               PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4571               sprintf(s, "%s.DirCnrDir.%lu", szStateName, x);
    4572               PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4573               sprintf(s, "%s.DirCnrSort.%lu", szStateName, x);
    4574               PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4575               sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x);
    4576               PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4577               sprintf(s, "%s.DirCnrView.%lu", szStateName, x);
    4578               PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4517        if (SHORT1FROMMP(mp1) == IDM_SAVEDIRCNRSTATE) {
     4518          // Save
     4519          INT nSaved = SaveDirCnrState(hwnd, szStateName);
     4520          if (nSaved > 0) {
     4521            INT ret = add_setup(szStateName);
     4522            if (ret == 0) {
     4523              WinSendMsg(hwndStatelist, LM_INSERTITEM,
     4524                        MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName));
     4525              save_setups();
     4526            }
     4527            else if (ret != 1) {
     4528              saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
     4529                     GetPString(IDS_WARNINGTEXT),
     4530                     "\"%s\" state name add failed", szStateName);      // 15 Apr 07 SHL failed
     4531              WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
     4532            }
     4533          }
     4534          else {
     4535            saymsg(MB_ENTER | MB_ICONASTERISK,
     4536                   hwnd,
     4537                   GetPString(IDS_WARNINGTEXT),
     4538                   nSaved == 0 ?
     4539                     "Nothing to save" :
     4540                     "State data save failed");
     4541            WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
     4542          }
     4543        }
     4544        else {
     4545          // Delete
     4546          ULONG numsaves = 0, size, x;
     4547          CHAR s[STATE_NAME_MAX_BYTES + 80];
     4548
     4549          INT ret = remove_setup(szStateName);
     4550          if (ret == 1)
     4551            save_setups();
     4552          sprintf(s, "%s.NumDirsLastTime", szStateName);
     4553          size = sizeof(ULONG);
     4554          if (!PrfQueryProfileData(fmprof,
     4555                                   FM3Str,
     4556                                   s,
     4557                                   (PVOID)&numsaves,
     4558                                   &size)) {
     4559            saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
     4560                   GetPString(IDS_WARNINGTEXT),
     4561                   GetPString(IDS_DOESNTEXISTTEXT), szStateName);
     4562          }
     4563          else if (!size)
     4564            Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     4565          else {
     4566            PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0L);
     4567            for (x = 0; x < numsaves; x++) {
     4568              sprintf(s, "%s.DirCnrPos.%lu", szStateName, x);
     4569              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4570              sprintf(s, "%s.DirCnrDir.%lu", szStateName, x);
     4571              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4572              sprintf(s, "%s.DirCnrSort.%lu", szStateName, x);
     4573              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4574              sprintf(s, "%s.DirCnrFilter.%lu", szStateName, x);
     4575              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4576              sprintf(s, "%s.DirCnrView.%lu", szStateName, x);
     4577              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    45794578              sprintf(s, "%s.DirCnr.%lu.DetailsLongname", szStateName, x);
    45804579              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     
    45994598              sprintf(s, "%s.DirCnr.%lu.DetailsCRTime", szStateName, x);
    46004599              PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4601             }
    4602             sprintf(s, "%s.LastTreePos", szStateName);
    4603             PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4604             sprintf(s, "%s.MySizeLastTime", szStateName);
    4605             PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
    4606           }
    4607           PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
    4608         }
     4600            }
     4601            sprintf(s, "%s.LastTreePos", szStateName);
     4602            PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4603            sprintf(s, "%s.MySizeLastTime", szStateName);
     4604            PrfWriteProfileData(fmprof, FM3Str, s, NULL, 0);
     4605          }
     4606          PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
     4607        }
    46094608      }
    46104609    }
     
    46194618      WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
    46204619      if (swp.fl & SWP_MAXIMIZE) {
    4621         WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND,
    4622                    MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
    4623         WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
     4620        WinSendMsg(WinQueryWindow(hwnd, QW_PARENT), WM_SYSCOMMAND,
     4621                   MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
     4622        WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
    46244623      }
    46254624      WinGetMaxPosition(WinQueryWindow(hwnd, QW_PARENT), &swpD);
     
    46294628      swpD.cy -= (icz + bsz);
    46304629      if (swp.x == swpD.x && swp.y == swpD.y &&
    4631           swp.cx == swpD.cx && swp.cy == swpD.cy &&
    4632           // fixme to be #defined someday
    4633           WinQueryWindowUShort(hwnd, QWL_USER + 10) &&
    4634           WinQueryWindowUShort(hwnd, QWL_USER + 14)) {
    4635         swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8);
    4636         swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10);
    4637         swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12);
    4638         swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14);
     4630          swp.cx == swpD.cx && swp.cy == swpD.cy &&
     4631          // fixme to be #defined someday
     4632          WinQueryWindowUShort(hwnd, QWL_USER + 10) &&
     4633          WinQueryWindowUShort(hwnd, QWL_USER + 14)) {
     4634        swpD.x = WinQueryWindowUShort(hwnd, QWL_USER + 8);
     4635        swpD.cx = WinQueryWindowUShort(hwnd, QWL_USER + 10);
     4636        swpD.y = WinQueryWindowUShort(hwnd, QWL_USER + 12);
     4637        swpD.cy = WinQueryWindowUShort(hwnd, QWL_USER + 14);
    46394638      }
    46404639      else {
    4641         WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x);
    4642         WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx);
    4643         WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y);
    4644         WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy);
     4640        WinSetWindowUShort(hwnd, QWL_USER + 8, (USHORT) swp.x);
     4641        WinSetWindowUShort(hwnd, QWL_USER + 10, (USHORT) swp.cx);
     4642        WinSetWindowUShort(hwnd, QWL_USER + 12, (USHORT) swp.y);
     4643        WinSetWindowUShort(hwnd, QWL_USER + 14, (USHORT) swp.cy);
    46454644      }
    46464645      WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP,
    4647                       swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE);
     4646                      swpD.x, swpD.y, swpD.cx, swpD.cy, SWP_MOVE | SWP_SIZE);
    46484647    }
    46494648    break;
     
    46514650  case IDM_BLINK:
    46524651    WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
    4653                     SWP_MINIMIZE);
     4652                    SWP_MINIMIZE);
    46544653    WinSetWindowPos(WinQueryWindow(hwnd, QW_PARENT), HWND_TOP, 0, 0, 0, 0,
    4655                     SWP_RESTORE | SWP_ZORDER);
     4654                    SWP_RESTORE | SWP_ZORDER);
    46564655    break;
    46574656
     
    46614660
    46624661      if (hwndTop)
    4663         WinSetFocus(HWND_DESKTOP, hwndTop);
     4662        WinSetFocus(HWND_DESKTOP, hwndTop);
    46644663    }
    46654664    break;
     
    46744673  case IDM_QUICKSETTINGS:
    46754674    WinDlgBox(HWND_DESKTOP,
    4676               hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1));
     4675              hwnd, CfgDlgProc, FM3ModHandle, CFG_FRAME, MPFROMLONG(mp1));
    46774676    break;
    46784677
     
    46804679  case IDM_VIEWINFS:
    46814680    WinDlgBox(HWND_DESKTOP,
    4682               HWND_DESKTOP,
    4683               ViewInfProc,
    4684               FM3ModHandle,
    4685               VINF_FRAME,
    4686               ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ?
    4687                MPFROMP(NullStr) : MPVOID));
     4681              HWND_DESKTOP,
     4682              ViewInfProc,
     4683              FM3ModHandle,
     4684              VINF_FRAME,
     4685              ((SHORT1FROMMP(mp1) == IDM_VIEWHELPS) ?
     4686               MPFROMP(NullStr) : MPVOID));
    46884687    break;
    46894688
     
    46954694      TopWindowName(hwnd, (HWND) 0, newpath);
    46964695      if (WinDlgBox(HWND_DESKTOP,
    4697                     hwnd,
    4698                     WalkAllDlgProc,
    4699                     FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath)
    4700         OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath);
     4696                    hwnd,
     4697                    WalkAllDlgProc,
     4698                    FM3ModHandle, WALK_FRAME, MPFROMP(newpath)) && *newpath)
     4699        OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, newpath);
    47014700    }
    47024701    break;
     
    47194718      if (SHORT1FROMMP(mp2) == CMDSRC_MENU) {
    47204719
    4721         RECTL rcl;
    4722         ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
    4723 
    4724         WinQueryWindowRect(HWND_DESKTOP, &rcl);
    4725         rcl.yBottom += icz;
    4726         rcl.yTop -= icz;
    4727         rcl.xLeft += icz;
    4728         rcl.xRight -= icz;
    4729         WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
     4720        RECTL rcl;
     4721        ULONG icz = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2L;
     4722
     4723        WinQueryWindowRect(HWND_DESKTOP, &rcl);
     4724        rcl.yBottom += icz;
     4725        rcl.yTop -= icz;
     4726        rcl.xLeft += icz;
     4727        rcl.xRight -= icz;
     4728        WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
    47304729      }
    47314730      else {
    47324731
    4733         RECTL rcl;
    4734 
    4735         WinQueryWindowRect(HWND_DESKTOP, &rcl);
    4736         rcl.yBottom += 8;
    4737         rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7);
    4738         rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7);
    4739         rcl.xRight -= 8;
    4740         WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
     4732        RECTL rcl;
     4733
     4734        WinQueryWindowRect(HWND_DESKTOP, &rcl);
     4735        rcl.yBottom += 8;
     4736        rcl.yTop = (rcl.yTop / 2) + (rcl.yTop / 7);
     4737        rcl.xLeft = (rcl.xRight / 2) - (rcl.xRight / 7);
     4738        rcl.xRight -= 8;
     4739        WinSendMsg(hwndHelp, HM_SET_COVERPAGE_SIZE, MPFROMP(&rcl), MPVOID);
    47414740      }
    47424741      switch (SHORT1FROMMP(mp1)) {
    47434742      case IDM_HELPCONTEXT:
    4744         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    4745                    MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID));
    4746         break;
     4743        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     4744                   MPFROM2SHORT(HELP_CONTEXT, 0), MPFROMSHORT(HM_RESOURCEID));
     4745        break;
    47474746
    47484747      case IDM_HELPMOUSE:
    4749         if (hwndHelp)
    4750           WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    4751                      MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID));
    4752         break;
     4748        if (hwndHelp)
     4749          WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     4750                     MPFROM2SHORT(HELP_MOUSE, 0), MPFROMSHORT(HM_RESOURCEID));
     4751        break;
    47534752
    47544753      case IDM_HELPPIX:
    4755         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    4756                    MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID));
    4757         break;
     4754        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     4755                   MPFROM2SHORT(HELP_BITMAP1, 0), MPFROMSHORT(HM_RESOURCEID));
     4756        break;
    47584757
    47594758      case IDM_HELPTUTOR:
    4760         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    4761                    MPFROM2SHORT(HELP_TUTORIAL, 0),
    4762                    MPFROMSHORT(HM_RESOURCEID));
    4763         break;
     4759        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     4760                   MPFROM2SHORT(HELP_TUTORIAL, 0),
     4761                   MPFROMSHORT(HM_RESOURCEID));
     4762        break;
    47644763
    47654764      case IDM_HELPHINTS:
    4766         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    4767                    MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID));
    4768         break;
     4765        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     4766                   MPFROM2SHORT(HELP_HINTS, 0), MPFROMSHORT(HM_RESOURCEID));
     4767        break;
    47694768
    47704769      case IDM_HELPGENERAL:
    4771         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    4772                    MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID));
    4773         break;
     4770        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     4771                   MPFROM2SHORT(HELP_MAIN, 0), MPFROMSHORT(HM_RESOURCEID));
     4772        break;
    47744773      case IDM_HELPKEYS:
    4775         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    4776                    MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID));
    4777         break;
     4774        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     4775                   MPFROM2SHORT(HELP_KEYS, 0), MPFROMSHORT(HM_RESOURCEID));
     4776        break;
    47784777
    47794778      case IDM_HELP:
    47804779      case IDM_HELPCONTENTS:
    4781         WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
    4782         break;
     4780        WinSendMsg(hwndHelp, HM_HELP_CONTENTS, MPVOID, MPVOID);
     4781        break;
    47834782
    47844783      case IDM_HELPUSERLIST:
    4785         WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
    4786                    MPFROM2SHORT(HELP_USERLISTS, 0),
    4787                    MPFROMSHORT(HM_RESOURCEID));
    4788         break;
     4784        WinSendMsg(hwndHelp, HM_DISPLAY_HELP,
     4785                   MPFROM2SHORT(HELP_USERLISTS, 0),
     4786                   MPFROMSHORT(HM_RESOURCEID));
     4787        break;
    47894788      }
    47904789    }
     
    47974796  case IDM_ABOUT:
    47984797    WinDlgBox(HWND_DESKTOP, hwnd, AboutDlgProc, FM3ModHandle,
    4799               ABT_FRAME, MPVOID);
     4798              ABT_FRAME, MPVOID);
    48004799    break;
    48014800
     
    48114810
    48124811      if (!DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR,
    4813                            (PVOID) & version, (ULONG) sizeof(version))) {
    4814         if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) {
    4815           if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE)
    4816             palette = "<WP_HIRESCLRPAL>";
    4817           else
    4818             palette = "<WP_LORESCLRPAL>";
    4819         }
     4812                           (PVOID) & version, (ULONG) sizeof(version))) {
     4813        if (version[0] > 20L || (version[0] == 20L && version[1] > 29L)) {
     4814          if (SHORT1FROMMP(mp1) == IDM_HICOLORPALETTE)
     4815            palette = "<WP_HIRESCLRPAL>";
     4816          else
     4817            palette = "<WP_LORESCLRPAL>";
     4818        }
    48204819      }
    48214820      OpenObject(palette, Default, hwnd);
     
    48334832      hWPSObject = WinQueryObject("<WP_SCHPAL>");
    48344833      if (hWPSObject != NULLHANDLE)
    4835         WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter,"
    4836                         "Spring:PM_Spring,Summer:PM_Summer,"
    4837                         "System:PM_System,Windows:PM_Windows;"
    4838                         "OPEN=DEFAULT");
     4834        WinSetObjectData(hWPSObject, "SCHEMES=Winter:PM_Winter,"
     4835                        "Spring:PM_Spring,Summer:PM_Summer,"
     4836                        "System:PM_System,Windows:PM_Windows;"
     4837                        "OPEN=DEFAULT");
    48394838    }
    48404839    break;
     
    48474846  case IDM_SYSINFO:
    48484847    WinDlgBox(HWND_DESKTOP, HWND_DESKTOP, SysInfoDlgProc, FM3ModHandle,
    4849               SYS_FRAME, NULL);
     4848              SYS_FRAME, NULL);
    48504849    break;
    48514850#endif
     
    48574856
    48584857      if (hwndTree)
    4859         pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS,
    4860                                     MPFROMLONG(CMA_FIRST),
    4861                                     MPFROMSHORT(CRA_CURSORED));
     4858        pci = (PCNRITEM) WinSendMsg(hwndTree, CM_QUERYRECORDEMPHASIS,
     4859                                    MPFROMLONG(CMA_FIRST),
     4860                                    MPFROMSHORT(CRA_CURSORED));
    48624861      if (pci && (INT) pci != -1) {
    4863         strcpy(path, pci->pszFileName);
    4864         MakeValidDir(path);
     4862        strcpy(path, pci->pszFileName);
     4863        MakeValidDir(path);
    48654864      }
    48664865      else
    4867         save_dir2(path);
     4866        save_dir2(path);
    48684867      WinDlgBox(HWND_DESKTOP, hwnd, InstantDlgProc, FM3ModHandle,
    4869                 BAT_FRAME, MPFROMP(path));
     4868                BAT_FRAME, MPFROMP(path));
    48704869    }
    48714870    break;
     
    48814880      TopWindowName(hwnd, (HWND) 0, path);
    48824881      if (SHORT1FROMMP(mp1) == IDM_DOSCOMMANDLINE)
    4883         env = GetCmdSpec(TRUE);
     4882        env = GetCmdSpec(TRUE);
    48844883      else if (SHORT1FROMMP(mp1) != IDM_COMMANDLINE) {
    4885         env = "WINOS2.COM";
    4886         type = SEPARATE | FULLSCREEN;
     4884        env = "WINOS2.COM";
     4885        type = SEPARATE | FULLSCREEN;
    48874886      }
    48884887      runemf2(type, hwnd, pszSrcFile, __LINE__,
    4889               path, NULL, "%s", env);
     4888              path, NULL, "%s", env);
    48904889    }
    48914890    break;
     
    48934892  case IDM_KILLPROC:
    48944893    WinDlgBox(HWND_DESKTOP, hwnd, KillDlgProc, FM3ModHandle,
    4895               KILL_FRAME, NULL);
     4894              KILL_FRAME, NULL);
    48964895    break;
    48974896
     
    49084907  case IDM_AUTOVIEW:
    49094908    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
    4910                 &fAutoView, TRUE, "AutoView");
     4909                &fAutoView, TRUE, "AutoView");
    49114910  AutoChange:
    49124911    PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
    4913             MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     4912            MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    49144913    if (fAutoView) {
    49154914
     
    49204919      hwndDir = TopWindowName(hwnd, (HWND) 0, s);
    49214920      if (hwndDir) {
    4922         hwndDir = WinWindowFromID(hwndDir, FID_CLIENT);
    4923         if (hwndDir) {
    4924           hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
    4925           if (hwndDir) {
    4926             pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS,
    4927                                         MPFROMLONG(CMA_FIRST),
    4928                                         MPFROMSHORT(CRA_CURSORED));
    4929             if (pci && (INT) pci != -1 &&
    4930                 (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
    4931               WinSendMsg(hwnd,
    4932                         UM_LOADFILE,
    4933                         MPFROMP(pci->pszFileName),
    4934                         (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ?
    4935                         MPVOID : MPFROMLONG(1));
    4936           }
    4937         }
     4921        hwndDir = WinWindowFromID(hwndDir, FID_CLIENT);
     4922        if (hwndDir) {
     4923          hwndDir = WinWindowFromID(hwndDir, DIR_CNR);
     4924          if (hwndDir) {
     4925            pci = (PCNRITEM) WinSendMsg(hwndDir, CM_QUERYRECORDEMPHASIS,
     4926                                        MPFROMLONG(CMA_FIRST),
     4927                                        MPFROMSHORT(CRA_CURSORED));
     4928            if (pci && (INT) pci != -1 &&
     4929                (!(driveflags[toupper(*pci->pszFileName) - 'A'] & DRIVE_SLOW)))
     4930              WinSendMsg(hwnd,
     4931                        UM_LOADFILE,
     4932                        MPFROMP(pci->pszFileName),
     4933                        (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ?
     4934                        MPVOID : MPFROMLONG(1));
     4935          }
     4936        }
    49384937      }
    49394938    }
     
    49424941  case IDM_TEXTTOOLS:
    49434942    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
    4944                 &fTextTools, TRUE, "TextTools");
     4943                &fTextTools, TRUE, "TextTools");
    49454944    BuildTools(hwndToolback, TRUE);
    49464945    PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
    4947             MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     4946            MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    49484947    break;
    49494948
    49504949  case IDM_TOOLTITLES:
    49514950    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
    4952                 &fToolTitles, TRUE, "ToolTitles");
     4951                &fToolTitles, TRUE, "ToolTitles");
    49534952    BuildTools(hwndToolback, TRUE);
    49544953    PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
    4955             MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     4954            MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    49564955    break;
    49574956
     
    49634962      MenuInvisible = (MenuInvisible) ? FALSE : TRUE;
    49644963      if (MenuInvisible) {
    4965         WinSetParent(hwndMenu, HWND_OBJECT, FALSE);
    4966         WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    4967                                            FID_SYSMENU), IDM_HIDEMENU,
    4968                            GetPString(IDS_UNHIDEMENUTEXT));
     4964        WinSetParent(hwndMenu, HWND_OBJECT, FALSE);
     4965        WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
     4966                                           FID_SYSMENU), IDM_HIDEMENU,
     4967                           GetPString(IDS_UNHIDEMENUTEXT));
    49694968      }
    49704969      else {
    4971         WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE);
    4972         WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    4973                                            FID_SYSMENU), IDM_HIDEMENU,
    4974                            GetPString(IDS_HIDEMENUTEXT));
     4970        WinSetParent(hwndMenu, WinQueryWindow(hwnd, QW_PARENT), FALSE);
     4971        WinSetMenuItemText(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
     4972                                           FID_SYSMENU), IDM_HIDEMENU,
     4973                           GetPString(IDS_HIDEMENUTEXT));
    49754974      }
    49764975      PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
    4977               MPFROMLONG(FCF_MENU), MPVOID);
     4976              MPFROMLONG(FCF_MENU), MPVOID);
    49784977      PrfWriteProfileData(fmprof, FM3Str, "MenuInvisible",
    4979                           &MenuInvisible, sizeof(BOOL));
     4978                          &MenuInvisible, sizeof(BOOL));
    49804979    }
    49814980    break;
     
    49904989
    49914990      if (Collector)
    4992         already = TRUE;
     4991        already = TRUE;
    49934992      if (!already && !fAutoTile && !fExternalCollector)
    4994         GetNextWindowPos(hwnd, &swp, NULL, NULL);
     4993        GetNextWindowPos(hwnd, &swp, NULL, NULL);
    49954994      hwndC = StartCollector(fExternalCollector ? HWND_DESKTOP : hwnd, 4);
    49964995      if (hwndC) {
    4997         if (!already && !fAutoTile && !fExternalCollector)
    4998           WinSetWindowPos(hwndC, HWND_TOP,
    4999                           swp.x, swp.y, swp.cx, swp.cy,
    5000                           SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
    5001         else if (fAutoTile && !already)
    5002           TileChildren(hwnd, TRUE);
    5003         WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE |
    5004                         SWP_ACTIVATE);
    5005         if (SHORT1FROMMP(mp1) == IDM_GREP)
    5006           PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
    5007                   MPFROM2SHORT(IDM_GREP, 0), MPVOID);
    5008         if (SHORT1FROMMP(mp1) == IDM_SEEALL)
    5009           PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
    5010                   MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
     4996        if (!already && !fAutoTile && !fExternalCollector)
     4997          WinSetWindowPos(hwndC, HWND_TOP,
     4998                          swp.x, swp.y, swp.cx, swp.cy,
     4999                          SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER);
     5000        else if (fAutoTile && !already)
     5001          TileChildren(hwnd, TRUE);
     5002        WinSetWindowPos(hwndC, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_RESTORE |
     5003                        SWP_ACTIVATE);
     5004        if (SHORT1FROMMP(mp1) == IDM_GREP)
     5005          PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
     5006                  MPFROM2SHORT(IDM_GREP, 0), MPVOID);
     5007        if (SHORT1FROMMP(mp1) == IDM_SEEALL)
     5008          PostMsg(WinWindowFromID(hwndC, FID_CLIENT), WM_COMMAND,
     5009                  MPFROM2SHORT(IDM_SEEALL, 0), MPVOID);
    50115010      }
    50125011    }
     
    50195018
    50205019      if (!toolhead || !toolhead->next) {
    5021         firsttool = (toolhead) ? toolhead->id : 0;
    5022         break;
     5020        firsttool = (toolhead) ? toolhead->id : 0;
     5021        break;
    50235022      }
    50245023      tool = find_tool(firsttool);
    50255024      if (!tool)
    5026         tool = toolhead;
     5025        tool = toolhead;
    50275026      if (SHORT1FROMMP(mp1) == IDM_TOOLRIGHT) {
    5028         tool = prev_tool(tool, TRUE);
    5029         firsttool = tool->id;
     5027        tool = prev_tool(tool, TRUE);
     5028        firsttool = tool->id;
    50305029      }
    50315030      else {
    5032         tool = next_tool(tool, TRUE);
    5033         firsttool = tool->id;
     5031        tool = next_tool(tool, TRUE);
     5032        firsttool = tool->id;
    50345033      }
    50355034      ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    5036                                   MAIN_TOOLS));
     5035                                  MAIN_TOOLS));
    50375036    }
    50385037    break;
     
    50445043  case IDM_TOOLBAR:
    50455044    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
    5046                 IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar");
     5045                IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar");
    50475046    BuildTools(hwndToolback, TRUE);
    50485047    WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    5049                                   MAIN_TOOLS), fToolbar);
     5048                                  MAIN_TOOLS), fToolbar);
    50505049    WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
    5051                WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     5050               WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    50525051    if (fDrivebar)
    50535052      WinInvalidateRect(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    5054                                         MAIN_DRIVES), NULL, TRUE);
     5053                                        MAIN_DRIVES), NULL, TRUE);
    50555054    break;
    50565055
    50575056  case IDM_DRIVEBAR:
    50585057    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
    5059                 IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar");
     5058                IDM_DRIVEBAR, &fDrivebar, TRUE, "Drivebar");
    50605059    WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    5061                                   MAIN_DRIVES), fDrivebar);
     5060                                  MAIN_DRIVES), fDrivebar);
    50625061    PostMsg(WinQueryWindow(hwnd, QW_PARENT),
    5063             WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     5062            WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    50645063    PostMsg(hwnd, UM_BUILDDRIVEBAR, MPVOID, MPVOID);
    50655064    break;
     
    50675066  case IDM_USERLIST:
    50685067    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
    5069                 SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox");
     5068                SHORT1FROMMP(mp1), &fUserComboBox, TRUE, "UserComboBox");
    50705069    WinShowWindow(hwndUserlist, fUserComboBox);
    50715070    PostMsg(WinQueryWindow(hwnd, QW_PARENT),
    5072             WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     5071            WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    50735072    PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
    50745073    PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
     
    50825081    WinSetWindowText(hwndAttr, NullStr);
    50835082    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
    5084                 SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons");
     5083                SHORT1FROMMP(mp1), &fMoreButtons, TRUE, "MoreButtons");
    50855084    if (fMoreButtons) {
    50865085
     
    50905089
    50915090      if (hwndTemp) {
    5092         WinSetFocus(HWND_DESKTOP, hwnd);
    5093         WinSetFocus(HWND_DESKTOP, hwndTemp);
     5091        WinSetFocus(HWND_DESKTOP, hwnd);
     5092        WinSetFocus(HWND_DESKTOP, hwndTemp);
    50945093      }
    50955094    }
    50965095    PostMsg(WinQueryWindow(hwnd, QW_PARENT),
    5097             WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     5096            WM_UPDATEFRAME, MPFROMLONG(FCF_SIZEBORDER), MPVOID);
    50985097    break;
    50995098
    51005099  case IDM_TOGGLEDRAGDIALOG:
    51015100    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
    5102                 IDM_TOGGLEDRAGDIALOG,
    5103                 &fDragndropDlg,
    5104                 TRUE,
    5105                 "Drag&DropDlg");
     5101                IDM_TOGGLEDRAGDIALOG,
     5102                &fDragndropDlg,
     5103                TRUE,
     5104                "Drag&DropDlg");
    51065105    break;
    51075106
    51085107  case IDM_SYNCUPDATES:
    51095108    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
    5110                 IDM_SYNCUPDATES,
    5111                 &fSyncUpdates,
    5112                 TRUE,
    5113                 "SyncUpdates");
     5109                IDM_SYNCUPDATES,
     5110                &fSyncUpdates,
     5111                TRUE,
     5112                "SyncUpdates");
    51145113    break;
    51155114
     
    51215120      WinQueryWindowPos(hwnd, &swp);
    51225121      WinSetWindowPos(hwndTree, HWND_TOP, 0, swp.cy - swpT.cy, 0, 0,
    5123                       SWP_MOVE);
     5122                      SWP_MOVE);
    51245123    }
    51255124    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
    5126                 &fFreeTree, TRUE, "FreeTree");
     5125                &fFreeTree, TRUE, "FreeTree");
    51275126    if (fAutoTile)
    51285127      TileChildren(hwnd, TRUE);
     
    51315130  case IDM_AUTOTILE:
    51325131    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
    5133                 SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile");
     5132                SHORT1FROMMP(mp1), &fAutoTile, TRUE, "AutoTile");
    51345133    if (fAutoTile)
    51355134      TileChildren(hwnd, TRUE);
     
    51385137  case IDM_TILEBACKWARDS:
    51395138    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
    5140                 SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards");
     5139                SHORT1FROMMP(mp1), &fTileBackwards, TRUE, "TileBackwards");
    51415140    if (fAutoTile)
    51425141      TileChildren(hwnd, TRUE);
     
    51835182  default:
    51845183    if (!SwitchCommand((HWND) WinQueryWindowULong(hwnd, QWL_USER),
    5185                        SHORT1FROMMP(mp1))) {
     5184                       SHORT1FROMMP(mp1))) {
    51865185      if (SHORT1FROMMP(mp1) >= IDM_COMMANDSTART &&
    5187           SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
    5188 
    5189         INT x;
    5190         HWND hwndCnr;
    5191 
    5192         if (!cmdloaded)
    5193           load_commands();
    5194         hwndCnr = TopWindow(hwnd, (HWND) 0);
    5195         hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),
    5196                                     UM_CONTAINERHWND, MPVOID, MPVOID);
    5197         if (!hwndCnr) {
    5198           Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT);
    5199           break;
    5200         }
    5201         x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
    5202         if (x >= 0) {
    5203           x++;
    5204           RunCommand(hwndCnr, x);
    5205           if (fUnHilite) {
    5206 
    5207             PCNRITEM pci;
    5208             DIRCNRDATA *dcd = NULL;
    5209 
    5210             // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR?
    5211             if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)
    5212               dcd = INSTDATA(hwndCnr);
    5213             pci = (PCNRITEM) WinSendMsg(hwndCnr,
    5214                                         CM_QUERYRECORDEMPHASIS,
    5215                                         MPFROMLONG(CMA_FIRST),
    5216                                         MPFROMSHORT(CRA_CURSORED));
    5217             if (pci && (INT) pci != -1 &&
    5218                 (pci->rc.flRecordAttr & CRA_SELECTED))
    5219             {
    5220               UnHilite(hwnd,
    5221                        TRUE,
    5222                        dcd ? &dcd->lastselection : NULL,
    5223                        dcd ? dcd ->ulItemsToUnHilite : 0);
    5224             }
    5225           }
    5226         }
     5186          SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART) {
     5187
     5188        INT x;
     5189        HWND hwndCnr;
     5190
     5191        if (!cmdloaded)
     5192          load_commands();
     5193        hwndCnr = TopWindow(hwnd, (HWND) 0);
     5194        hwndCnr = (HWND) WinSendMsg(WinWindowFromID(hwndCnr, FID_CLIENT),
     5195                                    UM_CONTAINERHWND, MPVOID, MPVOID);
     5196        if (!hwndCnr) {
     5197          Runtime_Error2(pszSrcFile, __LINE__, IDS_NOWINDOWTEXT);
     5198          break;
     5199        }
     5200        x = SHORT1FROMMP(mp1) - IDM_COMMANDSTART;
     5201        if (x >= 0) {
     5202          x++;
     5203          RunCommand(hwndCnr, x);
     5204          if (fUnHilite) {
     5205
     5206            PCNRITEM pci;
     5207            DIRCNRDATA *dcd = NULL;
     5208
     5209            // 12 May 07 SHL fixme to understand? backwards maybe? looking for DIR_CNR?
     5210            if (WinQueryWindowUShort(hwndCnr, QWS_ID) != TREE_CNR)
     5211              dcd = INSTDATA(hwndCnr);
     5212            pci = (PCNRITEM) WinSendMsg(hwndCnr,
     5213                                        CM_QUERYRECORDEMPHASIS,
     5214                                        MPFROMLONG(CMA_FIRST),
     5215                                        MPFROMSHORT(CRA_CURSORED));
     5216            if (pci && (INT) pci != -1 &&
     5217                (pci->rc.flRecordAttr & CRA_SELECTED))
     5218            {
     5219              UnHilite(hwnd,
     5220                       TRUE,
     5221                       dcd ? &dcd->lastselection : NULL,
     5222                       dcd ? dcd ->ulItemsToUnHilite : 0);
     5223            }
     5224          }
     5225        }
    52275226      }
    52285227      else if (SHORT1FROMMP(mp1) >= IDM_QUICKTOOLSTART &&
    5229                SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) {
    5230         if (!qtloaded)
    5231           load_quicktools();
    5232         if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) {
    5233           if (fToolsChanged)
    5234             save_tools(NULL);
    5235           if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]))
    5236             load_tools(NULL);
    5237           else {
    5238             strcpy(lasttoolbox,
    5239                    quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]);
    5240             PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox);
    5241           }
    5242           BuildTools(hwndToolback, TRUE);
    5243         }
     5228               SHORT1FROMMP(mp1) < IDM_QUICKTOOLSTART + 50) {
     5229        if (!qtloaded)
     5230          load_quicktools();
     5231        if (quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]) {
     5232          if (fToolsChanged)
     5233            save_tools(NULL);
     5234          if (!load_tools(quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]))
     5235            load_tools(NULL);
     5236          else {
     5237            strcpy(lasttoolbox,
     5238                   quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]);
     5239            PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox);
     5240          }
     5241          BuildTools(hwndToolback, TRUE);
     5242        }
    52445243      }
    52455244      else {
    52465245
    5247         HWND hwndActive;
    5248 
    5249         hwndActive = TopWindow(hwnd, (HWND) 0);
    5250         if (hwndActive)
    5251           PostMsg(WinWindowFromID(hwndActive, FID_CLIENT),
    5252                   WM_COMMAND, mp1, mp2);
    5253       }
    5254     }
    5255     break;                              // default
     5246        HWND hwndActive;
     5247
     5248        hwndActive = TopWindow(hwnd, (HWND) 0);
     5249        if (hwndActive)
     5250          PostMsg(WinWindowFromID(hwndActive, FID_CLIENT),
     5251                  WM_COMMAND, mp1, mp2);
     5252      }
     5253    }
     5254    break;                              // default
    52565255  } // switch mp1
    52575256  return 0;
     
    52595258
    52605259static MRESULT EXPENTRY MainWMOnce(HWND hwnd, ULONG msg, MPARAM mp1,
    5261                                    MPARAM mp2)
     5260                                   MPARAM mp2)
    52625261{
    52635262  TID tid;
     
    52825281    if (_beginthread(MakeMainObjWin, NULL, 245760, MPVOID) == -1) {
    52835282      Runtime_Error(pszSrcFile, __LINE__,
    5284                     GetPString(IDS_COULDNTSTARTTHREADTEXT));
     5283                    GetPString(IDS_COULDNTSTARTTHREADTEXT));
    52855284      PostMsg(hwnd, WM_CLOSE, MPVOID, MPVOID);
    52865285      return 0;
     
    53015300
    53025301    if (!WinCreateWindow(hwndFrame,
    5303                         WC_BUTTON,
    5304                         "I",
    5305                         WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS,
    5306                         ((swp.cx -
    5307                            WinQuerySysValue(HWND_DESKTOP,
    5308                                             SV_CXMINMAXBUTTON)) -
    5309                           WinQuerySysValue(HWND_DESKTOP,
    5310                                            SV_CXMINMAXBUTTON) / 2) -
    5311                         WinQuerySysValue(HWND_DESKTOP,
    5312                                           SV_CXSIZEBORDER),
    5313                         (swp.cy - WinQuerySysValue(HWND_DESKTOP,
    5314                                                     SV_CYMINMAXBUTTON)) -
    5315                         WinQuerySysValue(HWND_DESKTOP,
    5316                                           SV_CYSIZEBORDER),
    5317                         WinQuerySysValue(HWND_DESKTOP,
    5318                                           SV_CXMINMAXBUTTON) / 2,
    5319                         WinQuerySysValue(HWND_DESKTOP,
    5320                                           SV_CYMINMAXBUTTON),
    5321                         hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) {
     5302                        WC_BUTTON,
     5303                        "I",
     5304                        WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS,
     5305                        ((swp.cx -
     5306                           WinQuerySysValue(HWND_DESKTOP,
     5307                                            SV_CXMINMAXBUTTON)) -
     5308                          WinQuerySysValue(HWND_DESKTOP,
     5309                                           SV_CXMINMAXBUTTON) / 2) -
     5310                        WinQuerySysValue(HWND_DESKTOP,
     5311                                          SV_CXSIZEBORDER),
     5312                        (swp.cy - WinQuerySysValue(HWND_DESKTOP,
     5313                                                    SV_CYMINMAXBUTTON)) -
     5314                        WinQuerySysValue(HWND_DESKTOP,
     5315                                          SV_CYSIZEBORDER),
     5316                        WinQuerySysValue(HWND_DESKTOP,
     5317                                          SV_CXMINMAXBUTTON) / 2,
     5318                        WinQuerySysValue(HWND_DESKTOP,
     5319                                          SV_CYMINMAXBUTTON),
     5320                        hwnd, HWND_TOP, IDM_IDEALSIZE, NULL, NULL)) {
    53225321      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    53235322    }
    53245323    else {
    53255324      WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_IDEALSIZE),
    5326                         IdealButtonProc);
     5325                        IdealButtonProc);
    53275326      SetPresParams(WinWindowFromID(hwndFrame,
    5328                                     IDM_IDEALSIZE),
    5329                     NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT));
     5327                                    IDM_IDEALSIZE),
     5328                    NULL, NULL, NULL, GetPString(IDS_10SYSTEMVIOTEXT));
    53305329    }
    53315330
    53325331    hwndTmp = WinCreateWindow(hwndFrame,
    5333                               WC_BUTTON,
    5334                               "#1019",
    5335                               WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
    5336                               BS_BITMAP,
    5337                               swp.cx - 46,
    5338                               swp.y + 2,
    5339                               24,
    5340                               22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL);
     5332                              WC_BUTTON,
     5333                              "#1019",
     5334                              WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
     5335                              BS_BITMAP,
     5336                              swp.cx - 46,
     5337                              swp.y + 2,
     5338                              24,
     5339                              22, hwnd, HWND_TOP, IDM_OPENWALK, NULL, NULL);
    53415340    if (!hwndTmp)
    53425341      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    53435342
    53445343    hwndTmp = WinCreateWindow(hwndFrame,
    5345                               WC_BUTTON,
    5346                               "#3062",
    5347                               WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
    5348                               BS_BITMAP,
    5349                               swp.cx - 22,
    5350                               swp.y + 2,
    5351                               24,
    5352                               22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL);
     5344                              WC_BUTTON,
     5345                              "#3062",
     5346                              WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS |
     5347                              BS_BITMAP,
     5348                              swp.cx - 22,
     5349                              swp.y + 2,
     5350                              24,
     5351                              22, hwnd, HWND_TOP, IDM_USERLIST, NULL, NULL);
    53535352    if (!hwndTmp)
    53545353      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    53555354
    53565355    hwndUserlist = WinCreateWindow(hwndFrame,
    5357                                    WC_COMBOBOX,
    5358                                    (PSZ) NULL,
    5359                                    WS_VISIBLE | CBS_DROPDOWN |
    5360                                    LS_HORZSCROLL,
    5361                                    (swp.x +
    5362                                     WinQuerySysValue(HWND_DESKTOP,
    5363                                                      SV_CXSIZEBORDER) + 48L),
    5364                                    (swp.cy -
    5365                                     WinQuerySysValue(HWND_DESKTOP,
    5366                                                      SV_CYSIZEBORDER)) - 60,
    5367                                    ((swp.cx -
    5368                                      (WinQuerySysValue(HWND_DESKTOP,
    5369                                                        SV_CXSIZEBORDER) *
    5370                                       2)) - 64L), 60L, hwndFrame, HWND_TOP,
    5371                                    MAIN_USERLIST, NULL, NULL);
     5356                                   WC_COMBOBOX,
     5357                                   (PSZ) NULL,
     5358                                   WS_VISIBLE | CBS_DROPDOWN |
     5359                                   LS_HORZSCROLL,
     5360                                   (swp.x +
     5361                                    WinQuerySysValue(HWND_DESKTOP,
     5362                                                     SV_CXSIZEBORDER) + 48L),
     5363                                   (swp.cy -
     5364                                    WinQuerySysValue(HWND_DESKTOP,
     5365                                                     SV_CYSIZEBORDER)) - 60,
     5366                                   ((swp.cx -
     5367                                     (WinQuerySysValue(HWND_DESKTOP,
     5368                                                       SV_CXSIZEBORDER) *
     5369                                      2)) - 64L), 60L, hwndFrame, HWND_TOP,
     5370                                   MAIN_USERLIST, NULL, NULL);
    53725371    if (!hwndUserlist)
    53735372      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    53745373    hwndCmdlist = WinCreateWindow(hwndFrame,
    5375                                   WC_COMBOBOX,
    5376                                   (PSZ) NULL,
    5377                                   WS_VISIBLE | CBS_DROPDOWN |
    5378                                   LS_HORZSCROLL,
    5379                                   (swp.x +
    5380                                    WinQuerySysValue(HWND_DESKTOP,
    5381                                                     SV_CXSIZEBORDER) + 48L),
    5382                                   (swp.cy -
    5383                                    WinQuerySysValue(HWND_DESKTOP,
    5384                                                     SV_CYSIZEBORDER)) - 60,
    5385                                   ((swp.cx -
    5386                                     (WinQuerySysValue(HWND_DESKTOP,
    5387                                                       SV_CXSIZEBORDER) * 2)) -
    5388                                    64L), 60L, hwndFrame, HWND_TOP,
    5389                                   MAIN_CMDLIST, NULL, NULL);
     5374                                  WC_COMBOBOX,
     5375                                  (PSZ) NULL,
     5376                                  WS_VISIBLE | CBS_DROPDOWN |
     5377                                  LS_HORZSCROLL,
     5378                                  (swp.x +
     5379                                   WinQuerySysValue(HWND_DESKTOP,
     5380                                                    SV_CXSIZEBORDER) + 48L),
     5381                                  (swp.cy -
     5382                                   WinQuerySysValue(HWND_DESKTOP,
     5383                                                    SV_CYSIZEBORDER)) - 60,
     5384                                  ((swp.cx -
     5385                                    (WinQuerySysValue(HWND_DESKTOP,
     5386                                                      SV_CXSIZEBORDER) * 2)) -
     5387                                   64L), 60L, hwndFrame, HWND_TOP,
     5388                                  MAIN_CMDLIST, NULL, NULL);
    53905389    if (!hwndCmdlist)
    53915390      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    53925391    WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
    53935392    hwndStatelist = WinCreateWindow(hwndFrame,
    5394                                     WC_COMBOBOX,
    5395                                     (PSZ) NULL,
    5396                                     WS_VISIBLE | CBS_DROPDOWN |
    5397                                     LS_HORZSCROLL,
    5398                                     (swp.x +
    5399                                      WinQuerySysValue(HWND_DESKTOP,
    5400                                                       SV_CXSIZEBORDER) + 48L),
    5401                                     (swp.cy -
    5402                                      WinQuerySysValue(HWND_DESKTOP,
    5403                                                       SV_CYSIZEBORDER)) - 60,
    5404                                     ((swp.cx -
    5405                                       (WinQuerySysValue(HWND_DESKTOP,
    5406                                                         SV_CXSIZEBORDER) *
    5407                                        2)) - 64L), 60L, hwndFrame, HWND_TOP,
    5408                                     MAIN_SETUPLIST, NULL, NULL);
     5393                                    WC_COMBOBOX,
     5394                                    (PSZ) NULL,
     5395                                    WS_VISIBLE | CBS_DROPDOWN |
     5396                                    LS_HORZSCROLL,
     5397                                    (swp.x +
     5398                                     WinQuerySysValue(HWND_DESKTOP,
     5399                                                      SV_CXSIZEBORDER) + 48L),
     5400                                    (swp.cy -
     5401                                     WinQuerySysValue(HWND_DESKTOP,
     5402                                                      SV_CYSIZEBORDER)) - 60,
     5403                                    ((swp.cx -
     5404                                      (WinQuerySysValue(HWND_DESKTOP,
     5405                                                        SV_CXSIZEBORDER) *
     5406                                       2)) - 64L), 60L, hwndFrame, HWND_TOP,
     5407                                    MAIN_SETUPLIST, NULL, NULL);
    54095408    if (!hwndStatelist)
    54105409      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    54115410
    54125411    hwndDrivelist = WinCreateWindow(hwndFrame,
    5413                                     WC_COMBOBOX,
    5414                                     (PSZ) NULL,
    5415                                     WS_VISIBLE | CBS_DROPDOWN,
    5416                                     (swp.x +
    5417                                      WinQuerySysValue(HWND_DESKTOP,
    5418                                                       SV_CXSIZEBORDER)),
    5419                                     (swp.cy -
    5420                                      WinQuerySysValue(HWND_DESKTOP,
    5421                                                       SV_CYSIZEBORDER)) - 60,
    5422                                     48L,
    5423                                     60L,
    5424                                     hwndFrame,
    5425                                     HWND_TOP, MAIN_DRIVELIST, NULL, NULL);
     5412                                    WC_COMBOBOX,
     5413                                    (PSZ) NULL,
     5414                                    WS_VISIBLE | CBS_DROPDOWN,
     5415                                    (swp.x +
     5416                                     WinQuerySysValue(HWND_DESKTOP,
     5417                                                      SV_CXSIZEBORDER)),
     5418                                    (swp.cy -
     5419                                     WinQuerySysValue(HWND_DESKTOP,
     5420                                                      SV_CYSIZEBORDER)) - 60,
     5421                                    48L,
     5422                                    60L,
     5423                                    hwndFrame,
     5424                                    HWND_TOP, MAIN_DRIVELIST, NULL, NULL);
    54265425    if (!hwndDrivelist)
    54275426      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    54285427    SetPresParams(hwndDrivelist,
    5429                   NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT));
     5428                  NULL, NULL, NULL, GetPString(IDS_10SYSTEMMONOTEXT));
    54305429    hwndButtonlist = WinCreateWindow(hwndFrame,
    5431                                      WC_COMBOBOX,
    5432                                      (PSZ) NULL,
    5433                                      WS_VISIBLE | CBS_DROPDOWN |
    5434                                      LS_HORZSCROLL,
    5435                                      (swp.cx -
    5436                                       WinQuerySysValue(HWND_DESKTOP,
    5437                                                        SV_CXSIZEBORDER)) -
    5438                                      164L,
    5439                                      (swp.cy -
    5440                                       WinQuerySysValue(HWND_DESKTOP,
    5441                                                        SV_CYSIZEBORDER)) - 60,
    5442                                      164L, 60L, hwndFrame, HWND_TOP,
    5443                                      MAIN_BUTTONLIST, NULL, NULL);
     5430                                     WC_COMBOBOX,
     5431                                     (PSZ) NULL,
     5432                                     WS_VISIBLE | CBS_DROPDOWN |
     5433                                     LS_HORZSCROLL,
     5434                                     (swp.cx -
     5435                                      WinQuerySysValue(HWND_DESKTOP,
     5436                                                       SV_CXSIZEBORDER)) -
     5437                                     164L,
     5438                                     (swp.cy -
     5439                                      WinQuerySysValue(HWND_DESKTOP,
     5440                                                       SV_CYSIZEBORDER)) - 60,
     5441                                     164L, 60L, hwndFrame, HWND_TOP,
     5442                                     MAIN_BUTTONLIST, NULL, NULL);
    54445443    if (!hwndButtonlist)
    54455444      Win_Error2(hwnd, hwnd, pszSrcFile, __LINE__, IDS_WINCREATEWINDOW);
    54465445    WinSendMsg(WinWindowFromID(hwndUserlist, CBID_EDIT),
    5447                EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     5446               EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
    54485447    WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT),
    5449                EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID);
     5448               EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID);
    54505449    WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT),
    5451                EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
     5450               EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
    54525451    WinSendMsg(WinWindowFromID(hwndButtonlist, CBID_EDIT),
    5453                EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
     5452               EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
    54545453    WinSendMsg(WinWindowFromID(hwndCmdlist, CBID_EDIT),
    5455                EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
     5454               EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID);
    54565455
    54575456    oldproc = WinSubclassWindow(WinWindowFromID(hwndUserlist, CBID_EDIT),
    5458                                 DropDownListProc);
     5457                                DropDownListProc);
    54595458    WinSetWindowPtr(WinWindowFromID(hwndUserlist, CBID_EDIT),
    5460                     QWL_USER, (PVOID) oldproc);
     5459                    QWL_USER, (PVOID) oldproc);
    54615460    oldproc = WinSubclassWindow(WinWindowFromID(hwndCmdlist, CBID_EDIT),
    5462                                 DropDownListProc);
     5461                                DropDownListProc);
    54635462    WinSetWindowPtr(WinWindowFromID(hwndCmdlist, CBID_EDIT),
    5464                     QWL_USER, (PVOID) oldproc);
     5463                    QWL_USER, (PVOID) oldproc);
    54655464    oldproc = WinSubclassWindow(WinWindowFromID(hwndButtonlist, CBID_EDIT),
    5466                                 DropDownListProc);
     5465                                DropDownListProc);
    54675466    WinSetWindowPtr(WinWindowFromID(hwndButtonlist, CBID_EDIT),
    5468                     QWL_USER, (PVOID) oldproc);
     5467                    QWL_USER, (PVOID) oldproc);
    54695468    oldproc = WinSubclassWindow(WinWindowFromID(hwndStatelist, CBID_EDIT),
    5470                                 DropDownListProc);
     5469                                DropDownListProc);
    54715470    WinSetWindowPtr(WinWindowFromID(hwndStatelist, CBID_EDIT),
    5472                     QWL_USER, (PVOID) oldproc);
     5471                    QWL_USER, (PVOID) oldproc);
    54735472    oldproc = WinSubclassWindow(WinWindowFromID(hwndDrivelist, CBID_EDIT),
    5474                                 DropDownListProc);
     5473                                DropDownListProc);
    54755474    WinSetWindowPtr(WinWindowFromID(hwndDrivelist, CBID_EDIT),
    5476                     QWL_USER, (PVOID) oldproc);
     5475                    QWL_USER, (PVOID) oldproc);
    54775476    oldproc = WinSubclassWindow(hwndUserlist, DropDownListProc);
    54785477    WinSetWindowPtr(hwndUserlist, QWL_USER, (PVOID) oldproc);
     
    54865485    WinSetWindowPtr(hwndButtonlist, QWL_USER, (PVOID) oldproc);
    54875486    oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_USERLIST),
    5488                                 ChildFrameButtonProc);
     5487                                ChildFrameButtonProc);
    54895488    WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_USERLIST),
    5490                     QWL_USER, (PVOID) oldproc);
     5489                    QWL_USER, (PVOID) oldproc);
    54915490    oldproc = WinSubclassWindow(WinWindowFromID(hwndFrame, IDM_OPENWALK),
    5492                                 ChildFrameButtonProc);
     5491                                ChildFrameButtonProc);
    54935492    WinSetWindowPtr(WinWindowFromID(hwndFrame, IDM_OPENWALK),
    5494                     QWL_USER, (PVOID) oldproc);
     5493                    QWL_USER, (PVOID) oldproc);
    54955494    hwndMenu = WinWindowFromID(hwndFrame, FID_MENU);
    54965495    WinSendMsg(hwnd, UM_ADDTOMENU, MPVOID, MPVOID);
     
    55045503    hwndSysMenu = WinWindowFromID(hwndFrame, FID_SYSMENU);
    55055504    idSysMenu = SHORT1FROMMR(WinSendMsg(hwndSysMenu,
    5506                                         MM_ITEMIDFROMPOSITION,
    5507                                         MPVOID, MPVOID));
     5505                                        MM_ITEMIDFROMPOSITION,
     5506                                        MPVOID, MPVOID));
    55085507    WinSendMsg(hwndSysMenu,
    5509                MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit));
     5508               MM_QUERYITEM, MPFROM2SHORT(idSysMenu, 0), MPFROMP(&mit));
    55105509    hwndSysSubMenu = mit.hwndSubMenu;
    55115510    mi.iPosition = MIT_END;
     
    55165515    mi.id = IDM_IDEALSIZE;
    55175516    WinSendMsg(hwndSysSubMenu,
    5518                MM_INSERTITEM,
    5519                MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT)));
     5517               MM_INSERTITEM,
     5518               MPFROMP(&mi), MPFROMP(GetPString(IDS_IDEALMENUTEXT)));
    55205519    mi.afStyle = MIS_TEXT;
    55215520    mi.id = IDM_HIDEMENU;
    55225521    WinSendMsg(hwndSysSubMenu,
    5523                MM_INSERTITEM,
    5524                MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT)));
     5522               MM_INSERTITEM,
     5523               MPFROMP(&mi), MPFROMP(GetPString(IDS_HIDEMENUTEXT)));
    55255524    SetSysMenu(hwndSysMenu);
    55265525
    55275526    size = sizeof(BOOL);
    55285527    if (PrfQueryProfileData(fmprof,
    5529                             FM3Str,
    5530                             "MenuInvisible", &temp, &size) && size && temp)
     5528                            FM3Str,
     5529                            "MenuInvisible", &temp, &size) && size && temp)
    55315530      WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
    55325531    size = sizeof(BOOL);
    55335532    if (PrfQueryProfileData(fmprof,
    5534                             FM3Str, "FreeTree", &temp, &size) && size && temp)
     5533                            FM3Str, "FreeTree", &temp, &size) && size && temp)
    55355534      WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
    55365535    size = sizeof(BOOL);
    55375536    if (PrfQueryProfileData(fmprof,
    5538                             FM3Str,
    5539                             "AutoTile", &temp, &size) && size && !temp)
     5537                            FM3Str,
     5538                            "AutoTile", &temp, &size) && size && !temp)
    55405539      WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
    55415540    size = sizeof(BOOL);
    55425541    if (PrfQueryProfileData(fmprof,
    5543                             FM3Str, "Toolbar", &temp, &size) && size && !temp)
     5542                            FM3Str, "Toolbar", &temp, &size) && size && !temp)
    55445543      WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TOOLBAR, 0), MPVOID);
    55455544
    55465545    WinSetWindowText(WinWindowFromID(hwndFrame, FID_TITLEBAR), "FM/2");
    55475546    FixSwitchList(hwndFrame, NULL);
    5548     break;                              // WM_CREATE
     5547    break;                              // WM_CREATE
    55495548
    55505549  case UM_SETUP:
     
    55665565      hwndTree = StartTreeCnr(hwnd, 0);
    55675566      if (!hwndTree)
    5568         WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
     5567        WinDestroyWindow(WinQueryWindow(hwnd, QW_PARENT));
    55695568      else {
    5570         if (!fSaveState ||
    5571             !PrfQueryProfileData(fmprof,
    5572                                 FM3Str,
    5573                                 "LastTreePos",
    5574                                 &swp, &size) || size != sizeof(SWP)) {
    5575 
    5576           INT ratio, height = 0;
    5577 
    5578           if (!fNoTreeGap)
    5579             height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
    5580           size = sizeof(ratio);
    5581           if (!PrfQueryProfileData(fmprof,
    5582                                    FM3Str,
    5583                                    "TreeWindowRatio",
    5584                                    (PVOID) & ratio,
    5585                                    &size) || size < sizeof(ratio))
    5586             ratio = 400;
    5587           WinSetWindowPos(hwndTree,
    5588                           HWND_TOP,
    5589                           0,
    5590                           height,
    5591                           (swp.cx * 100) / ratio,
    5592                           swp.cy - height,
    5593                           SWP_SHOW | SWP_SIZE | SWP_MOVE |
    5594                           SWP_ACTIVATE | SWP_ZORDER);
    5595         }
    5596         else
    5597           WinSetWindowPos(hwndTree,
    5598                           HWND_TOP,
    5599                           swp.x,
    5600                           swp.y,
    5601                           swp.cx,
    5602                           swp.cy,
    5603                           swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW |
    5604                           SWP_ZORDER | SWP_ACTIVATE);
     5569        if (!fSaveState ||
     5570            !PrfQueryProfileData(fmprof,
     5571                                FM3Str,
     5572                                "LastTreePos",
     5573                                &swp, &size) || size != sizeof(SWP)) {
     5574
     5575          INT ratio, height = 0;
     5576
     5577          if (!fNoTreeGap)
     5578            height = WinQuerySysValue(HWND_DESKTOP, SV_CYICON) * 2;
     5579          size = sizeof(ratio);
     5580          if (!PrfQueryProfileData(fmprof,
     5581                                   FM3Str,
     5582                                   "TreeWindowRatio",
     5583                                   (PVOID) & ratio,
     5584                                   &size) || size < sizeof(ratio))
     5585            ratio = 400;
     5586          WinSetWindowPos(hwndTree,
     5587                          HWND_TOP,
     5588                          0,
     5589                          height,
     5590                          (swp.cx * 100) / ratio,
     5591                          swp.cy - height,
     5592                          SWP_SHOW | SWP_SIZE | SWP_MOVE |
     5593                          SWP_ACTIVATE | SWP_ZORDER);
     5594        }
     5595        else
     5596          WinSetWindowPos(hwndTree,
     5597                          HWND_TOP,
     5598                          swp.x,
     5599                          swp.y,
     5600                          swp.cx,
     5601                          swp.cy,
     5602                          swp.fl | SWP_MOVE | SWP_SIZE | SWP_SHOW |
     5603                          SWP_ZORDER | SWP_ACTIVATE);
    56055604      }
    56065605      ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    5607                                   MAIN_TOOLS));
     5606                                  MAIN_TOOLS));
    56085607    }
    56095608    PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2);
     
    56135612    /* start remaining child windows */
    56145613    if (!fNoSaveState && fSaveState)
    5615 // JBS PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPVOID);
    56165614      PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(FM2_STATE_AT_CLOSE), MPVOID);
    56175615    PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2);
     
    56245622
    56255623      for (x = 1; x < argc; x++) {
    5626         if (*argv[x] == '/' || *argv[x] == ';')
    5627           continue;
    5628         if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE))
    5629           OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);
     5624        if (*argv[x] == '/' || *argv[x] == ';')
     5625          continue;
     5626        if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE))
     5627          OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);
    56305628      }
    56315629    }
     
    56455643      hwndActive = TopWindow(hwnd, hwndTree);
    56465644      if (hwndActive)
    5647         WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
     5645        WinSetWindowPos(hwndActive, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE);
    56485646    }
    56495647    if (fStartMinimized || fReminimize)
     
    56755673  case WM_CONTROLPOINTER:
    56765674    if (!fNoFinger &&
    5677         (SHORT1FROMMP(mp1) == IDM_OPENWALK ||
    5678         SHORT1FROMMP(mp1) == IDM_USERLIST))
     5675        (SHORT1FROMMP(mp1) == IDM_OPENWALK ||
     5676        SHORT1FROMMP(mp1) == IDM_USERLIST))
    56795677      return MRFROMLONG(hptrFinger);
    56805678    break;
     
    57165714    if (mp1) {
    57175715      if (fUserComboBox)
    5718         WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT),
    5719                         (CHAR *) mp1);
     5716        WinSetWindowText(WinWindowFromID(hwndUserlist, CBID_EDIT),
     5717                        (CHAR *) mp1);
    57205718      if (add_udir(FALSE, (CHAR *) mp1)) {
    5721         if (fUserComboBox && fAutoAddDirs) {
    5722           WinSendMsg(hwndUserlist, LM_INSERTITEM,
    5723                      MPFROM2SHORT(LIT_SORTASCENDING, 0),
    5724                      MPFROMP((CHAR *) mp1));
    5725         }
     5719        if (fUserComboBox && fAutoAddDirs) {
     5720          WinSendMsg(hwndUserlist, LM_INSERTITEM,
     5721                     MPFROM2SHORT(LIT_SORTASCENDING, 0),
     5722                     MPFROMP((CHAR *) mp1));
     5723        }
    57265724      }
    57275725    }
     
    57555753      WinQueryWindowPos(WinQueryWindow(hwnd, QW_PARENT), &swp);
    57565754      if (!(swp.fl & (SWP_HIDE | SWP_MINIMIZE))) {
    5757         WinStoreWindowPos(FM2Str,
    5758                           "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));
    5759         if (!fNoSaveState && fSaveState)
    5760 // JBS    SaveDirCnrState(hwnd, NULL);
     5755        WinStoreWindowPos(FM2Str,
     5756                          "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));
     5757        if (!fNoSaveState && fSaveState)
    57615758          SaveDirCnrState(hwnd, FM2_STATE_AT_CLOSE);
    57625759      }
     
    57695766    case 1:
    57705767      {
    5771         HWND hwndCurrent;
    5772         ULONG wmsg;
    5773 
    5774         wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
    5775         hwndCurrent = TopWindow(hwnd, (HWND) 0);
    5776         PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent,
    5777                                                        FID_CLIENT), wmsg,
    5778                                        MPVOID, MPVOID), mp1, mp2);
     5768        HWND hwndCurrent;
     5769        ULONG wmsg;
     5770
     5771        wmsg = (SHORT1FROMMP(mp1) == 0) ? UM_FILESMENU : UM_VIEWSMENU;
     5772        hwndCurrent = TopWindow(hwnd, (HWND) 0);
     5773        PortholeInit((HWND) WinSendMsg(WinWindowFromID(hwndCurrent,
     5774                                                       FID_CLIENT), wmsg,
     5775                                       MPVOID, MPVOID), mp1, mp2);
    57795776      }
    57805777      break;
     
    57945791       */
    57955792      {
    5796         HWND hwndMenu, hwndSubMenu;
    5797         MENUITEM mi;
    5798 
    5799         hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
    5800         memset(&mi, 0, sizeof(mi));
    5801         mi.iPosition = MIT_END;
    5802         mi.afStyle = MIS_TEXT;
    5803         if (!WinSendMsg(hwndMenu, MM_QUERYITEM,
    5804                         MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
    5805           break;
    5806         hwndSubMenu = mi.hwndSubMenu;
    5807         SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT));
     5793        HWND hwndMenu, hwndSubMenu;
     5794        MENUITEM mi;
     5795
     5796        hwndMenu = WinQueryWindowULong(hwnd, QWL_USER);
     5797        memset(&mi, 0, sizeof(mi));
     5798        mi.iPosition = MIT_END;
     5799        mi.afStyle = MIS_TEXT;
     5800        if (!WinSendMsg(hwndMenu, MM_QUERYITEM,
     5801                        MPFROM2SHORT(IDM_WINDOWSMENU, TRUE), MPFROMP(&mi)))
     5802          break;
     5803        hwndSubMenu = mi.hwndSubMenu;
     5804        SetupWinList(hwndSubMenu, hwnd, WinQueryWindow(hwnd, QW_PARENT));
    58085805      }
    58095806      break;
     
    58115808    default:
    58125809      {
    5813         HWND hwndCurrent;
    5814 
    5815         hwndCurrent = TopWindow(hwnd, (HWND) 0);
    5816         if (hwndCurrent)
    5817           WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2);
     5810        HWND hwndCurrent;
     5811
     5812        hwndCurrent = TopWindow(hwnd, (HWND) 0);
     5813        if (hwndCurrent)
     5814          WinSendMsg(hwndCurrent, UM_INITMENU, mp1, mp2);
    58185815      }
    58195816      break;
     
    58235820  case UM_ADDTOMENU:
    58245821    AddToMenu((CHAR *) mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    5825                                             FID_MENU));
     5822                                            FID_MENU));
    58265823    return 0;
    58275824
     
    58365833      info = cmdhead;
    58375834      while (info) {
    5838         WinSendMsg(hwndCmdlist, LM_INSERTITEM,
    5839                    MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title));
    5840         info = info->next;
     5835        WinSendMsg(hwndCmdlist, LM_INSERTITEM,
     5836                   MPFROM2SHORT(LIT_END, 0), MPFROMP(info->title));
     5837        info = info->next;
    58415838      }
    58425839    }
     
    58625859      ulSearchCount = 1;
    58635860      if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED,
    5864                         &findbuf, sizeof(FILEFINDBUF3),
    5865                         &ulSearchCount, FIL_STANDARD)) {
    5866         do {
    5867           priority_bumped();
    5868           if (!foundit) {
    5869             thisone = FALSE;
    5870             p = strrchr(lasttoolbox, '\\');
    5871             if (!p)
    5872               p = lasttoolbox;
    5873             else
    5874               p++;
    5875             if (!stricmp(findbuf.achName, p))
    5876               thisone = TRUE;
    5877           }
    5878           p = strrchr(findbuf.achName, '.');
    5879           if (p)
    5880             *p = 0;
    5881           sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM,
    5882                                        MPFROM2SHORT(LIT_SORTASCENDING, 0),
    5883                                        MPFROMP(findbuf.achName));
    5884           if (!foundit && thisone && sSelect >= 0) {
    5885             WinSendMsg(hwndButtonlist, LM_SELECTITEM,
    5886                        MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE));
    5887             foundit = TRUE;
    5888           }
    5889         }
    5890         while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3),
    5891                             &ulSearchCount));
    5892         DosFindClose(hDir);
    5893         priority_bumped();
     5861                        &findbuf, sizeof(FILEFINDBUF3),
     5862                        &ulSearchCount, FIL_STANDARD)) {
     5863        do {
     5864          priority_bumped();
     5865          if (!foundit) {
     5866            thisone = FALSE;
     5867            p = strrchr(lasttoolbox, '\\');
     5868            if (!p)
     5869              p = lasttoolbox;
     5870            else
     5871              p++;
     5872            if (!stricmp(findbuf.achName, p))
     5873              thisone = TRUE;
     5874          }
     5875          p = strrchr(findbuf.achName, '.');
     5876          if (p)
     5877            *p = 0;
     5878          sSelect = (SHORT) WinSendMsg(hwndButtonlist, LM_INSERTITEM,
     5879                                       MPFROM2SHORT(LIT_SORTASCENDING, 0),
     5880                                       MPFROMP(findbuf.achName));
     5881          if (!foundit && thisone && sSelect >= 0) {
     5882            WinSendMsg(hwndButtonlist, LM_SELECTITEM,
     5883                       MPFROM2SHORT(sSelect, 0), MPFROMLONG(TRUE));
     5884            foundit = TRUE;
     5885          }
     5886        }
     5887        while (!DosFindNext(hDir, &findbuf, sizeof(FILEFINDBUF3),
     5888                            &ulSearchCount));
     5889        DosFindClose(hDir);
     5890        priority_bumped();
    58945891      }
    58955892      WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));
     
    59105907
    59115908      if (!loadedudirs)
    5912         load_udirs();
     5909        load_udirs();
    59135910      DosError(FERR_DISABLEHARDERR);
    59145911      DosQCurDisk(&ulDriveNum, &ulDriveMap);
    59155912      info = udirhead;
    59165913      while (info) {
    5917         if (IsFullName(info->path) &&
    5918             !(driveflags[toupper(*info->path) - 'A'] &
    5919               (DRIVE_IGNORE | DRIVE_INVALID))) {
    5920           DosError(FERR_DISABLEHARDERR);
    5921           hDir = HDIR_CREATE;
    5922           ulSearchCount = 1;
    5923           if (!IsRoot(info->path))
    5924             rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
    5925                               MUST_HAVE_DIRECTORY | FILE_READONLY |
    5926                               FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
    5927                               &findbuf, sizeof(FILEFINDBUF3),
    5928                               &ulSearchCount, FIL_STANDARD);
    5929           else {
    5930             rc = 0;
    5931             findbuf.attrFile = FILE_DIRECTORY;
    5932           }
    5933           priority_bumped();
    5934           if (!rc) {
    5935             if (!IsRoot(info->path))
    5936               DosFindClose(hDir);
    5937             if (findbuf.attrFile & FILE_DIRECTORY)
    5938               WinSendMsg(hwndUserlist, LM_INSERTITEM,
    5939                         MPFROM2SHORT(LIT_SORTASCENDING, 0),
    5940                         MPFROMP(info->path));
    5941             else {
    5942               temp = info->next;
    5943               remove_udir(info->path);
    5944               info = temp;
    5945               continue;
    5946             }
    5947           }
    5948           else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
    5949             temp = info->next;
    5950             remove_udir(info->path);
    5951             info = temp;
    5952             continue;
    5953           }
    5954         }
    5955         info = info->next;
     5914        if (IsFullName(info->path) &&
     5915            !(driveflags[toupper(*info->path) - 'A'] &
     5916              (DRIVE_IGNORE | DRIVE_INVALID))) {
     5917          DosError(FERR_DISABLEHARDERR);
     5918          hDir = HDIR_CREATE;
     5919          ulSearchCount = 1;
     5920          if (!IsRoot(info->path))
     5921            rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
     5922                              MUST_HAVE_DIRECTORY | FILE_READONLY |
     5923                              FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
     5924                              &findbuf, sizeof(FILEFINDBUF3),
     5925                              &ulSearchCount, FIL_STANDARD);
     5926          else {
     5927            rc = 0;
     5928            findbuf.attrFile = FILE_DIRECTORY;
     5929          }
     5930          priority_bumped();
     5931          if (!rc) {
     5932            if (!IsRoot(info->path))
     5933              DosFindClose(hDir);
     5934            if (findbuf.attrFile & FILE_DIRECTORY)
     5935              WinSendMsg(hwndUserlist, LM_INSERTITEM,
     5936                        MPFROM2SHORT(LIT_SORTASCENDING, 0),
     5937                        MPFROMP(info->path));
     5938            else {
     5939              temp = info->next;
     5940              remove_udir(info->path);
     5941              info = temp;
     5942              continue;
     5943            }
     5944          }
     5945          else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
     5946            temp = info->next;
     5947            remove_udir(info->path);
     5948            info = temp;
     5949            continue;
     5950          }
     5951        }
     5952        info = info->next;
    59565953      }
    59575954      info = ldirhead;
    59585955      while (info) {
    5959         if (IsFullName(info->path) &&
    5960             !(driveflags[toupper(*info->path) - 'A'] &
    5961               (DRIVE_IGNORE | DRIVE_INVALID))) {
    5962           DosError(FERR_DISABLEHARDERR);
    5963           hDir = HDIR_CREATE;
    5964           ulSearchCount = 1;
    5965           if (!IsRoot(info->path))
    5966             rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
    5967                               MUST_HAVE_DIRECTORY | FILE_READONLY |
    5968                               FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
    5969                               &findbuf, sizeof(FILEFINDBUF3),
    5970                               &ulSearchCount, FIL_STANDARD);
    5971           else {
    5972             rc = 0;
    5973             findbuf.attrFile = FILE_DIRECTORY;
    5974           }
    5975           priority_bumped();
    5976           if (!rc) {
    5977             if (!IsRoot(info->path))
    5978               DosFindClose(hDir);
    5979             if (findbuf.attrFile & FILE_DIRECTORY)
    5980               WinSendMsg(hwndUserlist, LM_INSERTITEM,
    5981                         MPFROM2SHORT(LIT_SORTASCENDING, 0),
    5982                         MPFROMP(info->path));
    5983             else {
    5984               temp = info->next;
    5985               remove_udir(info->path);
    5986               info = temp;
    5987               continue;
    5988             }
    5989           }
    5990           else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
    5991             temp = info->next;
    5992             remove_udir(info->path);
    5993             info = temp;
    5994             continue;
    5995           }
    5996         }
    5997         info = info->next;
     5956        if (IsFullName(info->path) &&
     5957            !(driveflags[toupper(*info->path) - 'A'] &
     5958              (DRIVE_IGNORE | DRIVE_INVALID))) {
     5959          DosError(FERR_DISABLEHARDERR);
     5960          hDir = HDIR_CREATE;
     5961          ulSearchCount = 1;
     5962          if (!IsRoot(info->path))
     5963            rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY |
     5964                              MUST_HAVE_DIRECTORY | FILE_READONLY |
     5965                              FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
     5966                              &findbuf, sizeof(FILEFINDBUF3),
     5967                              &ulSearchCount, FIL_STANDARD);
     5968          else {
     5969            rc = 0;
     5970            findbuf.attrFile = FILE_DIRECTORY;
     5971          }
     5972          priority_bumped();
     5973          if (!rc) {
     5974            if (!IsRoot(info->path))
     5975              DosFindClose(hDir);
     5976            if (findbuf.attrFile & FILE_DIRECTORY)
     5977              WinSendMsg(hwndUserlist, LM_INSERTITEM,
     5978                        MPFROM2SHORT(LIT_SORTASCENDING, 0),
     5979                        MPFROMP(info->path));
     5980            else {
     5981              temp = info->next;
     5982              remove_udir(info->path);
     5983              info = temp;
     5984              continue;
     5985            }
     5986          }
     5987          else if (!(ulDriveMap & (1 << (toupper(*info->path) - 'A')))) {
     5988            temp = info->next;
     5989            remove_udir(info->path);
     5990            info = temp;
     5991            continue;
     5992          }
     5993        }
     5994        info = info->next;
    59985995      }
    59995996      WinSendMsg(hwndUserlist, LM_INSERTITEM,
    6000                 MPFROM2SHORT(0, 0),
    6001                 MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT)));
     5997                MPFROM2SHORT(0, 0),
     5998                MPFROMP(GetPString(IDS_NEWDIRECTORYTEXT)));
    60025999      WinSetWindowText(hwndUserlist, GetPString(IDS_COMMONDIRTEXT));
    60036000    }
     
    60136010  case WM_SIZE:
    60146011    ResizeChildren(hwnd, SHORT1FROMMP(mp1), SHORT2FROMMP(mp1),
    6015                    SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
     6012                   SHORT1FROMMP(mp2), SHORT2FROMMP(mp2));
    60166013    break;
    60176014
     
    60276024      hps = WinBeginPaint(hwnd, (HPS) 0, NULL);
    60286025      if (hps) {
    6029         WinQueryWindowRect(hwnd, &rcl);
    6030         WinFillRect(hps, &rcl, CLR_PALEGRAY);
    6031         WinEndPaint(hps);
     6026        WinQueryWindowRect(hwnd, &rcl);
     6027        WinFillRect(hps, &rcl, CLR_PALEGRAY);
     6028        WinEndPaint(hps);
    60326029      }
    60336030    }
     
    60436040      switch (SHORT2FROMMP(mp1)) {
    60446041      case CBN_ENTER:
    6045         {
    6046           HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    6047                                         SHORT1FROMMP(mp1));
    6048           CHAR path[CCHMAXPATH];
    6049           ULONG ul;
    6050 
    6051           switch (SHORT1FROMMP(mp1)) {
    6052           case MAIN_USERLIST:
    6053             ul = CCHMAXPATH;
    6054             break;
    6055           case MAIN_SETUPLIST:
    6056             ul = STATE_NAME_MAX_BYTES;
    6057             break;
    6058           default:
    6059             ul = 13;                    // fixme to not be hardcoded
    6060           }
    6061 
    6062           SetShiftState();
    6063           WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path);
    6064           bstrip(path);
    6065           if (*path) {
    6066             if (SHORT1FROMMP(mp1) == MAIN_USERLIST) {
    6067               if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) {
    6068                 if (!LastDir ||
    6069                     !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT),
    6070                                 UM_CONTAINERDIR, MPFROMP(path), MPVOID))
    6071                   save_dir2(path);
    6072                 if (!PMMkDir(hwnd, path, TRUE)) {
    6073                   WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT));
    6074                   break;
    6075                 }
    6076               }
    6077               if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) {
    6078 
    6079                 HWND hwndDir;
    6080 
    6081                 if ((fUserListSwitches &&
    6082                      !(shiftstate & KC_SHIFT)) ||
    6083                     (!fUserListSwitches && (shiftstate & KC_SHIFT))) {
    6084                   hwndDir = FindDirCnr(hwnd);
    6085                   if (hwndDir) {
    6086                     WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID);
    6087                     break;
    6088                   }
    6089                 }
    6090                 OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path);
    6091               }
    6092             }
    6093             else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) {
    6094               ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree,
    6095                                                           FID_CLIENT),
    6096                                           TREE_CNR), path, FALSE, TRUE);
    6097               WinSetFocus(HWND_DESKTOP, hwndTree);
    6098             }
    6099             else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) {
    6100               strcat(path, ".TLS");
    6101               load_tools(path);
    6102               PrfWriteProfileString(fmprof,
    6103                                     FM3Str, "LastToolBox", lasttoolbox);
    6104               BuildTools(hwndToolback, TRUE);
    6105               WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));
    6106             }
    6107             else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
    6108 
    6109               CHAR szKey[80];
    6110               ULONG size, numsaves = 0;
    6111 
    6112               SetShiftState();
    6113               size = sizeof(ULONG);
    6114               sprintf(szKey, "%s.NumDirsLastTime", path);       // path is state name
    6115               if (!PrfQueryProfileData(fmprof,
    6116                                        FM3Str,
    6117                                        szKey,
    6118                                        (PVOID)&numsaves,
    6119                                        &size))
    6120               {
    6121                 if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) {
    6122                   saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
    6123                         GetPString(IDS_WARNINGTEXT),
    6124                         GetPString(IDS_DOESNTEXISTTEXT), path);
    6125                 }
    6126                 else {
    6127                   Win_Error2(hwnd, hwnd, __FILE__, __LINE__,
    6128                              IDS_PRFQUERYPROFILEDATA);
    6129                 }
    6130               }
    6131               else if (!numsaves)
    6132                 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
    6133               else {
    6134                 if ((shiftstate & KC_SHIFT) == 0)
    6135                   PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));
    6136                 {
    6137                   char *temp;
    6138 
    6139                   temp = xstrdup(path, pszSrcFile, __LINE__);
    6140                   if (!temp) {
    6141                     if ((shiftstate & KC_SHIFT) != 0 || fAutoTile)
    6142                       PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID,
    6143                               MPFROMLONG(1));
    6144                   }
    6145                   else {
    6146                     if (!PostMsg
    6147                         (MainObjectHwnd, UM_RESTORE, MPFROMP(temp), MPVOID))
    6148                       free(temp);
    6149                   }
    6150                 }
    6151               }
    6152               // fixme to hold restored state name for a while
    6153               // WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));    // 15 Apr 07 SHL
    6154             }
    6155             else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
    6156 
    6157               SHORT sSelect;
    6158 
    6159               sSelect = (SHORT) WinSendMsg(hwndCmdlist,
    6160                                            LM_QUERYSELECTION,
    6161                                            MPFROMSHORT(LIT_FIRST), MPVOID);
    6162               if (sSelect >= 0)
    6163                 WinPostMsg(hwnd,
    6164                            WM_COMMAND,
    6165                            MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0),
    6166                            MPVOID);
    6167               WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
    6168             }
    6169           }
    6170         }
    6171         break;
     6042        {
     6043          HWND hwndUL = WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
     6044                                        SHORT1FROMMP(mp1));
     6045          CHAR path[CCHMAXPATH];
     6046          ULONG ul;
     6047
     6048          switch (SHORT1FROMMP(mp1)) {
     6049          case MAIN_USERLIST:
     6050            ul = CCHMAXPATH;
     6051            break;
     6052          case MAIN_SETUPLIST:
     6053            ul = STATE_NAME_MAX_BYTES;
     6054            break;
     6055          default:
     6056            ul = 13;                    // fixme to not be hardcoded
     6057          }
     6058
     6059          SetShiftState();
     6060          WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path);
     6061          bstrip(path);
     6062          if (*path) {
     6063            if (SHORT1FROMMP(mp1) == MAIN_USERLIST) {
     6064              if (!strcmp(path, GetPString(IDS_NEWDIRECTORYTEXT))) {
     6065                if (!LastDir ||
     6066                    !WinSendMsg(WinQueryWindow(LastDir, QW_PARENT),
     6067                                UM_CONTAINERDIR, MPFROMP(path), MPVOID))
     6068                  save_dir2(path);
     6069                if (!PMMkDir(hwnd, path, TRUE)) {
     6070                  WinSetWindowText(hwndUL, GetPString(IDS_COMMONDIRTEXT));
     6071                  break;
     6072                }
     6073              }
     6074              if (!IsFile(path) && !FindDirCnrByName(path, TRUE)) {
     6075
     6076                HWND hwndDir;
     6077
     6078                if ((fUserListSwitches &&
     6079                     !(shiftstate & KC_SHIFT)) ||
     6080                    (!fUserListSwitches && (shiftstate & KC_SHIFT))) {
     6081                  hwndDir = FindDirCnr(hwnd);
     6082                  if (hwndDir) {
     6083                    WinSendMsg(LastDir, UM_SETDIR, MPFROMP(path), MPVOID);
     6084                    break;
     6085                  }
     6086                }
     6087                OpenDirCnr((HWND) 0, hwndMain, hwndTree, FALSE, path);
     6088              }
     6089            }
     6090            else if (SHORT1FROMMP(mp1) == MAIN_DRIVELIST) {
     6091              ShowTreeRec(WinWindowFromID(WinWindowFromID(hwndTree,
     6092                                                          FID_CLIENT),
     6093                                          TREE_CNR), path, FALSE, TRUE);
     6094              WinSetFocus(HWND_DESKTOP, hwndTree);
     6095            }
     6096            else if (SHORT1FROMMP(mp1) == MAIN_BUTTONLIST) {
     6097              strcat(path, ".TLS");
     6098              load_tools(path);
     6099              PrfWriteProfileString(fmprof,
     6100                                    FM3Str, "LastToolBox", lasttoolbox);
     6101              BuildTools(hwndToolback, TRUE);
     6102              WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));
     6103            }
     6104            else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
     6105
     6106              CHAR szKey[80];
     6107              ULONG size, numsaves = 0;
     6108
     6109              SetShiftState();
     6110              size = sizeof(ULONG);
     6111              sprintf(szKey, "%s.NumDirsLastTime", path);       // path is state name
     6112              if (!PrfQueryProfileData(fmprof,
     6113                                       FM3Str,
     6114                                       szKey,
     6115                                       (PVOID)&numsaves,
     6116                                       &size))
     6117              {
     6118                if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) {
     6119                  saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
     6120                        GetPString(IDS_WARNINGTEXT),
     6121                        GetPString(IDS_DOESNTEXISTTEXT), path);
     6122                }
     6123                else {
     6124                  Win_Error2(hwnd, hwnd, __FILE__, __LINE__,
     6125                             IDS_PRFQUERYPROFILEDATA);
     6126                }
     6127              }
     6128              else if (!numsaves)
     6129                Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT);
     6130              else {
     6131                if ((shiftstate & KC_SHIFT) == 0)
     6132                  PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, MPFROMLONG(2L));
     6133                {
     6134                  char *temp;
     6135
     6136                  temp = xstrdup(path, pszSrcFile, __LINE__);
     6137                  if (!temp) {
     6138                    if ((shiftstate & KC_SHIFT) != 0 || fAutoTile)
     6139                      PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID,
     6140                              MPFROMLONG(1));
     6141                  }
     6142                  else {
     6143                    if (!PostMsg
     6144                        (MainObjectHwnd, UM_RESTORE, MPFROMP(temp), MPVOID))
     6145                      free(temp);
     6146                  }
     6147                }
     6148              }
     6149              // fixme to hold restored state name for a while
     6150              // WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));    // 15 Apr 07 SHL
     6151            }
     6152            else if (SHORT1FROMMP(mp1) == MAIN_CMDLIST) {
     6153
     6154              SHORT sSelect;
     6155
     6156              sSelect = (SHORT) WinSendMsg(hwndCmdlist,
     6157                                           LM_QUERYSELECTION,
     6158                                           MPFROMSHORT(LIT_FIRST), MPVOID);
     6159              if (sSelect >= 0)
     6160                WinPostMsg(hwnd,
     6161                           WM_COMMAND,
     6162                           MPFROM2SHORT(IDM_COMMANDSTART + sSelect, 0),
     6163                           MPVOID);
     6164              WinSetWindowText(hwndCmdlist, GetPString(IDS_COMMANDSTEXT));
     6165            }
     6166          }
     6167        }
     6168        break;
    61726169
    61736170      default:
    6174         break;
     6171        break;
    61756172      }
    61766173      break;
     
    61926189  case WM_CLOSE:
    61936190    WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
    6194                WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
     6191               WM_SYSCOMMAND, MPFROM2SHORT(SC_RESTORE, 0), MPVOID);
    61956192    WinSendMsg(hwnd, WM_SAVEAPPLICATION, MPVOID, MPVOID);
    61966193    fAmClosing = TRUE;
    61976194    WinSendMsg(WinQueryWindow(hwnd, QW_PARENT),
    6198                WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID);
     6195               WM_SYSCOMMAND, MPFROM2SHORT(SC_MINIMIZE, 0), MPVOID);
    61996196    if (CloseChildren(hwnd)) {
    62006197      fAmClosing = FALSE;
    62016198      if (fAutoTile)
    6202         PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID);
     6199        PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_TILE, 0), MPVOID);
    62036200      return 0;
    62046201    }
    62056202    if (hwndTree) {
    62066203      if (!PostMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID))
    6207         WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
     6204        WinSendMsg(hwndTree, WM_CLOSE, MPVOID, MPVOID);
    62086205    }
    62096206    DosSleep(1);
    6210     return 0;                           // Hold off WM_QUIT
     6207    return 0;                           // Hold off WM_QUIT
    62116208
    62126209  case UM_CLOSE:
     
    62216218      temp = xstrdup(GetPString(IDS_FM2TEMPTEXT), pszSrcFile, __LINE__);
    62226219      if (temp) {
    6223         if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(temp), MPVOID))
    6224           free(temp);
     6220        if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(temp), MPVOID))
     6221          free(temp);
    62256222      }
    62266223    }
     
    62316228    if (mp1)
    62326229      return MRFROMLONG(OpenDirCnr((HWND) 0,
    6233                                    hwndMain,
    6234                                    hwndTree, (BOOL) mp2, (char *)mp1));
     6230                                   hwndMain,
     6231                                   hwndTree, (BOOL) mp2, (char *)mp1));
    62356232    return 0;
    62366233
  • trunk/dll/misc.c

    r923 r930  
    3737  22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus
    3838  12 Jan 08 SHL Document SetConditionalCascade
     39  xx Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
    3940
    4041***********************************************************************/
     
    4445#include <ctype.h>
    4546#include <share.h>
    46 #include <malloc.h>                     // _heapmin
     47#include <malloc.h>                  // _heapmin
    4748
    4849#define INCL_DOS
     
    5354#include "fm3dlg.h"
    5455#include "fm3str.h"
    55 #include "pathutil.h"                   // BldQuotedFileName
    56 #include "errutil.h"                    // Dos_Error...
    57 #include "strutil.h"                    // GetPString
     56#include "pathutil.h"              // BldQuotedFileName
     57#include "errutil.h"                // Dos_Error...
     58#include "strutil.h"                // GetPString
    5859#include "fm3dll.h"
    5960
     
    6364
    6465#ifndef BEGIN_LIBPATH
    65 #define BEGIN_LIBPATH            1
     66#define BEGIN_LIBPATH       1
    6667#endif
    6768
    6869#ifndef END_LIBPATH
    69 #define END_LIBPATH              2
     70#define END_LIBPATH           2
    7071#endif
    7172
     
    803804            if (strcmp(szData, testname)) {
    804805              if (stricmp(szData, testname) && IsFile(testname) != -1) {
    805                 DosBeep(50, 100);       /* exists; disallow */
     806                DosBeep(50, 100);       /* exists; disallow */
    806807                return (MRESULT) FALSE;
    807808              }
     
    13431344      PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
    13441345      if (dcd->SubjectDisplayWidth < 50)
    1345         dcd->SubjectDisplayWidth = 0;
     1346        dcd->SubjectDisplayWidth = 0;
    13461347      else if (dcd->SubjectDisplayWidth > 1000)
    1347         dcd->SubjectDisplayWidth = 1000;
     1348        dcd->SubjectDisplayWidth = 1000;
    13481349    }
    13491350  }
     
    13581359      PrfQueryProfileData(fmprof, appname, s, (PVOID) bool, &size);
    13591360      if (SubjectDisplayWidth < 50)
    1360         SubjectDisplayWidth = 0;
     1361        SubjectDisplayWidth = 0;
    13611362      else if (SubjectDisplayWidth > 1000)
    1362         SubjectDisplayWidth = 1000;
     1363        SubjectDisplayWidth = 1000;
    13631364    }
    13641365  }
     
    14531454                                       MPFROMLONG(CMA_FIRST),
    14541455                                       MPFROMSHORT(attrib));
    1455     if ((!pmi || (INT) pmi == -1) && attrib == CRA_SELECTED)    /* punt */
     1456    if ((!pmi || (INT) pmi == -1) && attrib == CRA_SELECTED)    /* punt */
    14561457      attrib = CRA_CURSORED;
    14571458    else
     
    14791480        if (WinPeekMsg((HAB) 0, &qmsg, (HWND) 0, 0, 0, PM_NOREMOVE))
    14801481          break;                        // Queue has message(s)
    1481       }                         // for
     1482      }                  // for
    14821483    }
    14831484  }
  • trunk/dll/notebook.c

    r927 r930  
    2424  10 Jan 08 SHL Remember last settings page
    2525  10 Jan 08 SHL Rework page select logic
     26  xx Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen
    2627
    2728***********************************************************************/
     
    200201      szCLBuf[MAXCOMLINESTRG - 1] = 0;
    201202      if (strcmp(szCLBuf, virus)){
    202         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    203         memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1);
    204         xfree(pszWorkBuf);
    205         if (!strchr(virus, '%') && strlen(virus) > 3)
    206           strcat(virus, " %p");
     203        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     204        memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1);
     205        xfree(pszWorkBuf);
     206        if (!strchr(virus, '%') && strlen(virus) > 3)
     207          strcat(virus, " %p");
    207208      }
    208209      if (!*virus)
     
    212213      bstrip(szPathBuf);
    213214      if (strcmp(extractpath, szPathBuf)) {
    214         memcpy(extractpath, szPathBuf, strlen(szPathBuf) + 1);
    215         if (*extractpath){
    216           MakeFullName(extractpath);
    217           if (IsFile(extractpath)) {
    218             ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
    219                               GetPString(IDS_WARNINGTEXT),
    220                               GetPString(IDS_EXTPATHNOTVALIDTEXT),
    221                               extractpath);
    222             if (ulResult == MBID_YES)
    223               *extractpath = 0;
    224             if (ulResult == MBID_CANCEL){
    225               WinDlgBox(HWND_DESKTOP,
     215        memcpy(extractpath, szPathBuf, strlen(szPathBuf) + 1);
     216        if (*extractpath){
     217          MakeFullName(extractpath);
     218          if (IsFile(extractpath)) {
     219            ulResult = saymsg(MB_YESNOCANCEL | MB_ICONQUESTION | MB_DEFBUTTON1, HWND_DESKTOP,
     220                              GetPString(IDS_WARNINGTEXT),
     221                              GetPString(IDS_EXTPATHNOTVALIDTEXT),
     222                              extractpath);
     223            if (ulResult == MBID_YES)
     224              *extractpath = 0;
     225            if (ulResult == MBID_CANCEL){
     226              WinDlgBox(HWND_DESKTOP,
    226227                        hwnd,
    227228                        CfgDlgProc,
     
    229230                        CFG_FRAME,
    230231                        MPFROMLONG(IDM_ARCHIVERSETTINGS));
    231               break;
    232             }
    233           }
    234         }
     232              break;
     233            }
     234          }
     235        }
    235236      }
    236237    }
     
    465466      szCLBuf[MAXCOMLINESTRG - 1] = 0;
    466467      if (strcmp(szCLBuf, viewer)){
    467         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    468         memcpy(viewer, pszWorkBuf, strlen(pszWorkBuf) + 1);
    469         if (!strchr(viewer, '%') && strlen(viewer) > 3)
    470           strcat(viewer, " %a");
     468        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     469        memcpy(viewer, pszWorkBuf, strlen(pszWorkBuf) + 1);
     470        if (!strchr(viewer, '%') && strlen(viewer) > 3)
     471          strcat(viewer, " %a");
    471472      }
    472473      WinQueryDlgItemText(hwnd, CFGV_EDITOR, MAXCOMLINESTRG, szCLBuf);
    473474      szCLBuf[MAXCOMLINESTRG - 1] = 0;
    474475      if (strcmp(szCLBuf, editor)){
    475         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    476         memcpy(editor, pszWorkBuf, strlen(pszWorkBuf) + 1);
    477         if (!strchr(editor, '%') && strlen(editor) > 3)
    478           strcat(editor, " %a");
     476        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     477        memcpy(editor, pszWorkBuf, strlen(pszWorkBuf) + 1);
     478        if (!strchr(editor, '%') && strlen(editor) > 3)
     479          strcat(editor, " %a");
    479480      }
    480481      WinQueryDlgItemText(hwnd, CFGV_BINVIEW, MAXCOMLINESTRG, szCLBuf);
    481482      szCLBuf[MAXCOMLINESTRG - 1] = 0;
    482483      if (strcmp(szCLBuf, binview)){
    483         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    484         memcpy(binview, pszWorkBuf, strlen(pszWorkBuf) + 1);
    485         if (!strchr(binview, '%') && strlen(binview) > 3)
    486           strcat(binview, " %a");
     484        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     485        memcpy(binview, pszWorkBuf, strlen(pszWorkBuf) + 1);
     486        if (!strchr(binview, '%') && strlen(binview) > 3)
     487          strcat(binview, " %a");
    487488      }
    488489      WinQueryDlgItemText(hwnd, CFGV_BINED, MAXCOMLINESTRG, szCLBuf);
    489490      szCLBuf[MAXCOMLINESTRG - 1] = 0;
    490491      if (strcmp(szCLBuf, bined)){
    491         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    492         memcpy(bined, pszWorkBuf, strlen(pszWorkBuf) + 1);
    493         if (!strchr(bined, '%') && strlen(bined) > 3)
    494           strcat(bined, " %a");
     492        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     493        memcpy(bined, pszWorkBuf, strlen(pszWorkBuf) + 1);
     494        if (!strchr(bined, '%') && strlen(bined) > 3)
     495          strcat(bined, " %a");
    495496      }
    496497      xfree(pszWorkBuf);
     
    537538                      MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
    538539    WinSendDlgItemMsg(hwnd, CFGH_HTTPRUN, EM_SETTEXTLIMIT,
    539                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     540                      MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
    540541    WinSendDlgItemMsg(hwnd, CFGH_MAILRUN, EM_SETTEXTLIMIT,
    541                       MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
     542                      MPFROM2SHORT(MAXCOMLINESTRG, 0), MPVOID);
    542543    WinSendDlgItemMsg(hwnd, CFGH_RUNMAILWORKDIR, EM_SETTEXTLIMIT,
    543544                      MPFROM2SHORT(CCHMAXPATH, 0), MPVOID);
     
    672673      szCLBuf[MAXCOMLINESTRG - 1] = 0;
    673674      if (strcmp(szCLBuf, ftprun)){
    674         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    675         memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
     675        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     676        memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    676677      }
    677678      WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, MAXCOMLINESTRG, szCLBuf);
    678679      szCLBuf[MAXCOMLINESTRG - 1] = 0;
    679680      if (strcmp(szCLBuf, httprun)){
    680         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    681         memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
     681        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     682        memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    682683      }
    683684      WinQueryDlgItemText(hwnd, CFGH_MAILRUN, MAXCOMLINESTRG, szCLBuf);
    684685      szCLBuf[MAXCOMLINESTRG - 1] = 0;
    685686      if (strcmp(szCLBuf, mailrun)){
    686         NormalizeCmdLine(pszWorkBuf, szCLBuf);
    687         memcpy(mailrun, pszWorkBuf, strlen(pszWorkBuf) + 1);
     687        NormalizeCmdLine(pszWorkBuf, szCLBuf);
     688        memcpy(mailrun, pszWorkBuf, strlen(pszWorkBuf) + 1);
    688689      }
    689690      xfree(pszWorkBuf);
     
    12701271      pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__);
    12711272      WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, MAXCOMLINESTRG, szCLBuf);
    1272         szCLBuf[MAXCOMLINESTRG - 1] = 0;
    1273         if (strcmp(szCLBuf, dircompare)){
    1274           NormalizeCmdLine(pszWorkBuf, szCLBuf);
    1275           memcpy(dircompare, pszWorkBuf, strlen(pszWorkBuf) + 1);
    1276           if (!strchr(dircompare, '%') && strlen(dircompare) > 3)
    1277             strcat(dircompare, " %a");
    1278         }
     1273        szCLBuf[MAXCOMLINESTRG - 1] = 0;
     1274        if (strcmp(szCLBuf, dircompare)){
     1275          NormalizeCmdLine(pszWorkBuf, szCLBuf);
     1276          memcpy(dircompare, pszWorkBuf, strlen(pszWorkBuf) + 1);
     1277          if (!strchr(dircompare, '%') && strlen(dircompare) > 3)
     1278            strcat(dircompare, " %a");
     1279        }
    12791280      PrfWriteProfileString(fmprof, appname, "DirCompare", dircompare);
    12801281      WinQueryDlgItemText(hwnd, CFGC_COMPARE, MAXCOMLINESTRG, szCLBuf);
    1281         szCLBuf[MAXCOMLINESTRG - 1] = 0;
    1282         if (strcmp(szCLBuf, compare)){
    1283           NormalizeCmdLine(pszWorkBuf, szCLBuf);
    1284           memcpy(compare, pszWorkBuf, strlen(pszWorkBuf) + 1);
    1285           if (!strchr(compare, '%') && strlen(compare) > 3)
    1286             strcat(compare, " %a");
    1287         }
     1282        szCLBuf[MAXCOMLINESTRG - 1] = 0;
     1283        if (strcmp(szCLBuf, compare)){
     1284          NormalizeCmdLine(pszWorkBuf, szCLBuf);
     1285          memcpy(compare, pszWorkBuf, strlen(pszWorkBuf) + 1);
     1286          if (!strchr(compare, '%') && strlen(compare) > 3)
     1287            strcat(compare, " %a");
     1288        }
    12881289      xfree(pszWorkBuf);
    12891290      PrfWriteProfileString(fmprof, appname, "Compare", compare);
     
    16831684      WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, fSubjectLengthMax);
    16841685      WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETCURRENTVALUE,
    1685                         MPFROMLONG(SubjectDisplayWidth), MPVOID);
     1686                        MPFROMLONG(SubjectDisplayWidth), MPVOID);
    16861687    }
    16871688    return 0;
     
    17531754    PrfWriteProfileData(fmprof, appname, "DetailsLongname",
    17541755                        &detailslongname, sizeof(BOOL));
    1755 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLongname",
    1756 // JBS                  &detailslongname, sizeof(BOOL));
    17571756    detailssubject = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSUBJECT);
    17581757    PrfWriteProfileData(fmprof, appname, "DetailsSubject",
    17591758                        &detailssubject, sizeof(BOOL));
    1760 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSubject",
    1761 // JBS                  &detailssubject, sizeof(BOOL));
    1762     detailsea = WinQueryButtonCheckstate(hwnd, CFG5_SHOWEAS);
    17631759    PrfWriteProfileData(fmprof, appname, "DetailsEA",
    17641760                        &detailsea, sizeof(BOOL));
    1765 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsEA",
    1766 // JBS                  &detailsea, sizeof(BOOL));
    17671761    detailssize = WinQueryButtonCheckstate(hwnd, CFG5_SHOWSIZE);
    17681762    PrfWriteProfileData(fmprof, appname, "DetailsSize",
    17691763                        &detailssize, sizeof(BOOL));
    1770 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSize",
    1771 // JBS                  &detailssize, sizeof(BOOL));
    17721764    detailsicon = WinQueryButtonCheckstate(hwnd, CFG5_SHOWICON);
    17731765    PrfWriteProfileData(fmprof, appname, "DetailsIcon",
    17741766                        &detailsicon, sizeof(BOOL));
    1775 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsIcon",
    1776 // JBS                  &detailsicon, sizeof(BOOL));
    17771767    detailslwdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWDATE);
    17781768    PrfWriteProfileData(fmprof, appname, "DetailsLWDate",
    17791769                        &detailslwdate, sizeof(BOOL));
    1780 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWDate",
    1781 // JBS                  &detailslwdate, sizeof(BOOL));
    17821770    detailslwtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLWTIME);
    17831771    PrfWriteProfileData(fmprof, appname, "DetailsLWTime",
    17841772                        &detailslwtime, sizeof(BOOL));
    1785 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWTime",
    1786 // JBS                  &detailslwtime, sizeof(BOOL));
    17871773    detailsladate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLADATE);
    17881774    PrfWriteProfileData(fmprof, appname, "DetailsLADate",
    17891775                        &detailsladate, sizeof(BOOL));
    1790 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLADate",
    1791 // JBS                  &detailsladate, sizeof(BOOL));
    17921776    detailslatime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWLATIME);
    17931777    PrfWriteProfileData(fmprof, appname, "DetailsLATime",
    17941778                        &detailslatime, sizeof(BOOL));
    1795 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLATime",
    1796 // JBS                  &detailslatime, sizeof(BOOL));
    17971779    detailscrdate = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRDATE);
    17981780    PrfWriteProfileData(fmprof, appname, "DetailsCRDate",
    17991781                        &detailscrdate, sizeof(BOOL));
    1800 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRDate",
    1801 // JBS                  &detailscrdate, sizeof(BOOL));
    18021782    detailscrtime = WinQueryButtonCheckstate(hwnd, CFG5_SHOWCRTIME);
    18031783    PrfWriteProfileData(fmprof, appname, "DetailsCRTime",
    18041784                        &detailscrtime, sizeof(BOOL));
    1805 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRTime",
    1806 // JBS                  &detailscrtime, sizeof(BOOL));
    18071785    detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR);
    18081786    PrfWriteProfileData(fmprof, appname, "DetailsAttr",
    18091787                        &detailsattr, sizeof(BOOL));
    1810 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsAttr",
    1811 // JBS                  &detailsattr, sizeof(BOOL));
    18121788    fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE);
    18131789    PrfWriteProfileData(fmprof, appname, "SubjectInLeftPane",
    18141790                        &fSubjectInLeftPane, sizeof(BOOL));
    1815 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.SubjectInLeftPane",
    1816 // JBS                  &fSubjectInLeftPane, sizeof(BOOL));
    18171791    fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX);
    18181792    PrfWriteProfileData(fmprof, appname, "SubjectLengthMax",
    18191793                        &fSubjectLengthMax, sizeof(BOOL));
    1820 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.SubjectLengthMax",
    1821 // JBS                  &fSubjectLengthMax, sizeof(BOOL));
    18221794    *mask.prompt = 0;
    18231795    PrfWriteProfileData(fmprof, appname, "DirFilter", &mask, sizeof(MASK));
     
    20392011      WinCheckButton(hwnd, CFG5_SUBJECTLENGTHMAX, dcd.fSubjectLengthMax);
    20402012      WinSendDlgItemMsg(hwnd, CFG5_SUBJECTDISPLAYWIDTH, SPBM_SETCURRENTVALUE,
    2041                         MPFROMLONG(dcd.SubjectDisplayWidth), MPVOID);
     2013                        MPFROMLONG(dcd.SubjectDisplayWidth), MPVOID);
    20422014
    20432015    }
     
    21492121      dcd.detailsattr = WinQueryButtonCheckstate(hwnd, CFG5_SHOWATTR);
    21502122      PrfWriteProfileData(fmprof, appname, "Collector.DetailsAttr",
    2151                           &dcd.detailsattr, sizeof(BOOL));
     2123                          &dcd.detailsattr, sizeof(BOOL));
    21522124      dcd.fSubjectInLeftPane = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTINLEFTPANE);
    21532125      PrfWriteProfileData(fmprof, appname, "Collector.SubjectInLeftPane",
    2154                           &dcd.fSubjectInLeftPane, sizeof(BOOL));
     2126                          &dcd.fSubjectInLeftPane, sizeof(BOOL));
    21552127      dcd.fSubjectLengthMax = WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX);
    21562128      PrfWriteProfileData(fmprof, appname, "Collector.SubjectLengthMax",
     
    21582130      *mask.prompt = 0;
    21592131      PrfWriteProfileData(fmprof,
    2160                           appname, "CollectorFilter", &mask, sizeof(MASK));
     2132                          appname, "CollectorFilter", &mask, sizeof(MASK));
    21612133      {
    21622134        if (!WinQueryButtonCheckstate(hwnd, CFG5_SUBJECTLENGTHMAX)) {
     
    29392911    PrfWriteProfileData(fmprof, appname, "DetailsLongname",
    29402912                        &detailslongname, sizeof(BOOL));
    2941 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLongname",
    2942 // JBS                  &detailslongname, sizeof(BOOL));
    29432913    PrfWriteProfileData(fmprof, appname, "DetailsSubject",
    29442914                        &detailssubject, sizeof(BOOL));
    2945 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSubject",
    2946 // JBS                  &detailssubject, sizeof(BOOL));
    29472915    PrfWriteProfileData(fmprof, appname, "DetailsEA",
    29482916                        &detailsea, sizeof(BOOL));
    2949 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsEA",
    2950 // JBS                  &detailsea, sizeof(BOOL));
    29512917    PrfWriteProfileData(fmprof, appname, "DetailsSize",
    29522918                        &detailssize, sizeof(BOOL));
    2953 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsSize",
    2954 // JBS                  &detailssize, sizeof(BOOL));
    29552919    PrfWriteProfileData(fmprof, appname, "DetailsIcon",
    29562920                        &detailsicon, sizeof(BOOL));
    2957 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsIcon",
    2958 // JBS                  &detailsicon, sizeof(BOOL));
    29592921    PrfWriteProfileData(fmprof, appname, "DetailsLWDate",
    29602922                        &detailslwdate, sizeof(BOOL));
    2961 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWDate",
    2962 // JBS                  &detailslwdate, sizeof(BOOL));
    29632923    PrfWriteProfileData(fmprof, appname, "DetailsLWTime",
    29642924                        &detailslwtime, sizeof(BOOL));
    2965 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLWTime",
    2966 // JBS                  &detailslwtime, sizeof(BOOL));
    29672925    PrfWriteProfileData(fmprof, appname, "DetailsLADate",
    29682926                        &detailsladate, sizeof(BOOL));
    2969 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLADate",
    2970 // JBS                  &detailsladate, sizeof(BOOL));
    29712927    PrfWriteProfileData(fmprof, appname, "DetailsLATime",
    29722928                        &detailslatime, sizeof(BOOL));
    2973 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsLATime",
    2974 // JBS                  &detailslatime, sizeof(BOOL));
    29752929    PrfWriteProfileData(fmprof, appname, "DetailsCRDate",
    29762930                        &detailscrdate, sizeof(BOOL));
    2977 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRDate",
    2978 // JBS                  &detailscrdate, sizeof(BOOL));
    29792931    PrfWriteProfileData(fmprof, appname, "DetailsCRTime",
    29802932                        &detailscrtime, sizeof(BOOL));
    2981 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsCRTime",
    2982 // JBS                  &detailscrtime, sizeof(BOOL));
    29832933    PrfWriteProfileData(fmprof, appname, "DetailsAttr",
    29842934                        &detailsattr, sizeof(BOOL));
    2985 // JBS    PrfWriteProfileData(fmprof, appname, "DirCnr.DetailsAttr",
    2986 // JBS                  &detailsattr, sizeof(BOOL));
    29872935    if (hwndMain) {
    29882936      if (SaveDirCnrState(hwndMain, GetPString(IDS_FM2TEMPTEXT)) > 0) {
Note: See TracChangeset for help on using the changeset viewer.