Changeset 1635 for trunk/dll/mainwnd.c


Ignore:
Timestamp:
Oct 4, 2011, 4:05:05 AM (14 years ago)
Author:
Steven Levine
Message:

Add needTile to ensure containers opened on command line render correctly
Minor code cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/mainwnd.c

    r1582 r1635  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2010 Steven H. Levine
     9  Copyright (c) 2001, 2011 Steven H. Levine
    1010
    1111  11 Jun 02 SHL Drop obsolete xor code
     
    100100  14 Sep 09 SHL Blink thread LEDs when workers busy
    101101  13 Dec 09 GKY Fixed separate paramenters. Please note that appname should be used in
    102                 profile calls for user settings that work and are setable in more than one
    103                 miniapp; FM3Str should be used for setting only relavent to FM/2 or that
    104                 aren't user settable; realappname should be used for setting applicable to
    105                 one or more miniapp but not to FM/2
     102                profile calls for user settings that work and are setable in more than one
     103                miniapp; FM3Str should be used for setting only relavent to FM/2 or that
     104                aren't user settable; realappname should be used for setting applicable to
     105                one or more miniapp but not to FM/2
    106106  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast
    107                 CHAR CONSTANT * as CHAR *.
     107                CHAR CONSTANT * as CHAR *.
    108108  11 Apr 10 GKY Fix drive tree rescan failure and program hang caused by event sem
    109                 never being posted
     109                never being posted
    110110  23 Oct 10 GKY Changes to populate and utilize a HELPTABLE for context specific help
     111  03 Oct 11 SHL Add needTile to ensure containers opened on command line render correctly
     112  03 Oct 11 SHL Minor code cleanup
    111113
    112114***********************************************************************/
     
    115117#include <string.h>
    116118#include <ctype.h>
    117 // #include <process.h>                 // _beginthread
    118119
    119120#define INCL_DOS
     
    310311            CommaFmtULL(szQty, sizeof(szQty), ullFreeQty, ' ');
    311312            sprintf(s, "%s %s (%lu%%) %s", dv, szQty, ulPctFree, GetPString(IDS_FREETEXT));
    312           }
    313           else
    314             sprintf(s, "%s ", dv);
     313          }
     314          else
     315            sprintf(s, "%s ", dv);
    315316        }
    316317      }
     
    19431944      }
    19441945      else
    1945         helpid = 0;
     1946        helpid = 0;
    19461947    }
    19471948    break;
     
    20292030          (!hwndBubble ||
    20302031           WinQueryWindowULong(hwndBubble, QWL_USER) != hwnd) &&
    2031           !WinQueryCapture(HWND_DESKTOP)) {
    2032 
    2033         RECTL rcl;
     2032          !WinQueryCapture(HWND_DESKTOP)) {
     2033
     2034        RECTL rcl;
    20342035        POINTL ptl;
    20352036
     
    20372038        WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1);
    20382039        WinQueryWindowRect(hwnd, &rcl);
    2039         if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl)) {
    2040           BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);
    2041         }
     2040        if (WinPtInRect(WinQueryAnchorBlock(hwnd), &rcl, &ptl)) {
     2041          BubbleHelp(hwnd, FALSE, TRUE, FALSE, (char *)mp1);
     2042        }
    20422043      }
    20432044    }
     
    33163317        strcpy(eos, "Dir"); ;
    33173318        size = sizeof(szDir);
    3318         if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
     3319        if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) {
    33193320          // If restoring shutdown state and drive marked no prescan
    33203321          // bypass window restore
     
    33243325            RemoveOldCnrSwitches(szPrefix, x);
    33253326            continue;
    3326           }
    3327           if (x == 0 && fSwitchTree)
    3328             pszFocusDir = xstrdup(szDir, pszSrcFile, __LINE__);
     3327          }
     3328          if (x == 0 && fSwitchTree)
     3329            pszFocusDir = xstrdup(szDir, pszSrcFile, __LINE__);
    33293330          LoadDetailsSwitches(szKeyBase, &localdcd.ds, TRUE);
    33303331          hwndDir = (HWND) WinSendMsg(hwndClient,
     
    35653566  RECTL Rectl;
    35663567  HWND hwndChild;
     3568  SWP swp;
    35673569
    35683570  if (fNoTileUpdate || hwndClient == HWND_DESKTOP)
    35693571    return;
    3570   {
    3571     SWP swp;
    3572 
    3573     WinQueryWindowPos(hwndClient, &swp);
    3574     if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
    3575       return;
    3576   }
     3572
     3573  WinQueryWindowPos(hwndClient, &swp);
     3574  if (swp.fl & (SWP_HIDE | SWP_MINIMIZE))
     3575    return;
     3576
    35773577  ulChildCnt = CountChildren(hwndClient, &ulNumMinChildren);
    35783578  ulChildCnt -= ulNumMinChildren;
     
    35983598
    35993599  if (!fFreeTree) {
    3600 
    3601     SWP swp;
    3602 
    36033600    WinQueryWindowPos(hwndTree, &swp);
    36043601    if (!(swp.fl & (SWP_MAXIMIZE | SWP_HIDE | SWP_MINIMIZE))) {
     
    36663663              WinSetWindowUShort(hwndChild,
    36673664                                 QWS_XRESTORE,
    3668                                  (USHORT) ((USHORT) ulWidth * (USHORT) ulCurCol)
    3669                                  + (USHORT) Rectl.xLeft);
     3665                                 (USHORT) ((USHORT) ulWidth * (USHORT) ulCurCol)
     3666                                 + (USHORT) Rectl.xLeft);
    36703667              WinSetWindowUShort(hwndChild,
    36713668                                 QWS_YRESTORE,
     
    54365433  MENUITEM mi, mit;
    54375434  ULONG size;
    5438   BOOL temp = FALSE;
     5435  BOOL temp;
     5436
     5437  static BOOL needTile;
    54395438
    54405439  switch (msg) {
     
    57135712    size = sizeof(BOOL);
    57145713    if (PrfQueryProfileData(fmprof, FM3Str, "MenuInvisible", &temp, &size) &&
    5715         size && temp)
     5714        size && temp)
    57165715      WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_HIDEMENU, 0), MPVOID);
    57175716    size = sizeof(BOOL);
    57185717    if (PrfQueryProfileData(fmprof, FM3Str, "FreeTree", &temp, &size) &&
    5719         size && temp)
     5718        size && temp)
    57205719      WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_FREETREE, 0), MPVOID);
    57215720    size = sizeof(BOOL);
    57225721    if (PrfQueryProfileData(fmprof, FM3Str, "AutoTile", &temp, &size) &&
    5723         size && !temp)
     5722        size && !temp)
    57245723      WinSendMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_AUTOTILE, 0), MPVOID);
    57255724    size = sizeof(BOOL);
     
    57855784                          SWP_ZORDER | SWP_ACTIVATE);
    57865785      }
    5787 //       ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    5788 //                                MAIN_TOOLS));
     5786#     if 0
     5787      ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
     5788                  MAIN_TOOLS));
     5789#     endif
    57895790    }
    57905791    PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2);
     
    58145815        if (*argv[x] == '/' || *argv[x] == ';')
    58155816          continue;
    5816         if (!IsFile(argv[x]) && !FindDirCnrByName(argv[x], FALSE)) {
     5817        if (IsFile(argv[x]) == 0 && !FindDirCnrByName(argv[x], FALSE)) {
    58175818          OpenDirCnr((HWND) 0, hwndMain, hwndTree, TRUE, argv[x]);
     5819          needTile = TRUE; // 2011-10-03 SHL
    58185820        }
    58195821      }
     
    58235825
    58245826  case UM_SETUP5:
    5825 //     if (fAutoTile)
    5826 //       TileChildren(hwnd, TRUE);
     5827#   if 0
     5828    if (fAutoTile)
     5829      TileChildren(hwnd, TRUE);
     5830#   endif
    58275831    PostMsg(hwnd, UM_FILLUSERLIST, MPVOID, MPVOID);
    58285832    PostMsg(hwnd, UM_FILLSETUPLIST, MPVOID, MPVOID);
     
    58405844    else if (fStartMaximized)
    58415845      PostMsg(hwndTree, UM_MAXIMIZE, MPVOID, MPVOID);
    5842     fRunning = TRUE;
     5846    else if (needTile)
     5847      WinSendMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);      // 2011-10-03 SHL
     5848
     5849    fRunning = TRUE;                    // Allow status window PRESPARM updates
     5850
    58435851    if (fWantFirstTimeInit) {
    58445852      fWantFirstTimeInit = FALSE;
     
    58465854    }
    58475855    return 0;
    5848   }
     5856  } // switch
    58495857
    58505858  return WinDefWindowProc(hwnd, msg, mp1, mp2);
     
    60156023  case UM_ADDTOMENU:
    60166024    AddToMenu((
    6017                CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
     6025               CHAR *)mp1, WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    60186026                                            FID_MENU));
    60196027    return 0;
     
    63516359
    63526360              SHORT sSelect = (SHORT) WinSendMsg(hwndCmdlist,
    6353                                                 LM_QUERYSELECTION,
     6361                                                LM_QUERYSELECTION,
    63546362                                                 MPFROMSHORT(LIT_FIRST), MPVOID);
    6355               if (sSelect >= 0) {
    6356                 CHAR s[CCHMAXPATH];
    6357                 CHAR *p;
    6358 
    6359                 WinSendMsg(hwndCmdlist, LM_QUERYITEMTEXT,
    6360                            MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));
    6361                 p = strrchr(s, '}');
    6362                 p = 0;
    6363                 p = strrchr(s, '{');
    6364                 p++;
     6363              if (sSelect >= 0) {
     6364                CHAR s[CCHMAXPATH];
     6365                CHAR *p;
     6366
     6367                WinSendMsg(hwndCmdlist, LM_QUERYITEMTEXT,
     6368                           MPFROM2SHORT(sSelect, CCHMAXPATH), MPFROMP(s));
     6369                p = strrchr(s, '}');
     6370                p = 0;
     6371                p = strrchr(s, '{');
     6372                p++;
    63656373                WinPostMsg(hwnd,
    63666374                           WM_COMMAND,
    63676375                           MPFROM2SHORT(atol(p), 0), //IDM_COMMANDSTART + sSelect, 0),
    6368                            MPVOID);
    6369               }
    6370                 WinSetWindowText(hwndCmdlist, (CHAR *) GetPString(IDS_COMMANDSTEXT));
     6376                           MPVOID);
     6377              }
     6378                WinSetWindowText(hwndCmdlist, (CHAR *) GetPString(IDS_COMMANDSTEXT));
    63716379            }
    63726380          }
Note: See TracChangeset for help on using the changeset viewer.