Changeset 1402 for trunk/dll/mainwnd.c


Ignore:
Timestamp:
Mar 14, 2009, 6:17:59 PM (16 years ago)
Author:
Gregg Young
Message:

Remove variable aurgs from docopy & unlinkf (not used); Move more strings to PCSZs and string table; Move PCSZs to compile time initialization; Fix hang on startup caused by a drive scan and a dircnr scan trying to update a drive in the tree at the same time (related to the "treeswitch options); Code cleanup mainly removal of old printfs, SayMsgs, DbgMsg and unneeded %s.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/mainwnd.c

    r1400 r1402  
    8181  07 Feb 09 GKY Eliminate Win_Error2 by moving function names to PCSZs used in Win_Error
    8282  08 Mar 09 GKY Renamed commafmt.h i18nutil.h
    83   08 Mar 09 GKY Additional strings move to PCSZs in init.c
     83  08 Mar 09 GKY Additional strings move to PCSZs & String Table
    8484  08 Mar 09 GKY Add WriteDetailsSwitches and use LoadDetailsSwitches to replace in line code
    8585
     
    207207#pragma data_seg(GLOBAL2)
    208208HMODULE FM3ModHandle;
    209 CHAR *FM3Str;
     209PCSZ FM3Str  = "FM/3";
    210210RGB2 RGBGREY;
    211211
     
    427427      henum = WinBeginEnumWindows(hwndMain);
    428428      while ((hwndC = WinGetNextWindow(henum)) != NULLHANDLE) {
    429          //saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu",hwndTree,exclude,hwndC);
    430         if (hwndC != exclude && hwndC != hwndTree) {
     429         if (hwndC != exclude && hwndC != hwndTree) {
    431430          id = WinQueryWindowUShort(hwndC, QWS_ID);
    432431          if (id) {
     
    446445                               UM_CONTAINERDIR, MPFROMP(ret), MPVOID)) {
    447446                  MakeValidDir(ret);
    448                   //saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Tree = %lu\rExclude = %lu\rFound = %lu\r\"%s\"",hwndTree,exclude,hwndC,ret);
    449447                  WinEndEnumWindows(henum);
    450448                  return hwndC;
     
    698696          if (haccelSaved == NULLHANDLE)
    699697            Win_Error(hwnd, HWND_DESKTOP, pszSrcFile, __LINE__, "WinQueryAccelTable");
    700           // else
    701             // DbgMsg(pszSrcFile, __LINE__, "WinQueryAccelTable SAVED %x", haccelSaved);
    702698        }
    703699        if (haccelSaved != NULLHANDLE) {
     
    712708              if (!WinSetAccelTable(hab, haccelDriveList, hwndFrame))
    713709                Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, PCSZ_WINSETACCELTABLE);
    714               // else
    715                 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_DRIVELIST %x %x", hwndFrame, haccelDriveList);
    716710            }
    717711            break;
     
    725719              if (!WinSetAccelTable(hab, haccelSetupList, hwndFrame))
    726720                Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, PCSZ_WINSETACCELTABLE);
    727               // else
    728                 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_SETUPLIST %x %x", hwndFrame, haccelSetupList);
    729721            }
    730722            break;
     
    738730              if (!WinSetAccelTable(hab, haccelCmdList, hwndFrame))
    739731                Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, PCSZ_WINSETACCELTABLE);
    740               // else
    741                 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_CMDLIST %x %x", hwndFrame, haccelCmdList);
    742732            }
    743733            break;
     
    751741              if (!WinSetAccelTable(hab, haccelUserList, hwndFrame))
    752742                Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, PCSZ_WINSETACCELTABLE);
    753               // else
    754                 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_USERLIST %x %x", hwndFrame, haccelUserList);
    755743            }
    756744            break;
     
    764752              if (!WinSetAccelTable(hab, haccelButtonList, hwndFrame))
    765753                Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, PCSZ_WINSETACCELTABLE);
    766               // else
    767                 // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable MAIN_BUTTONLIST %x %x", hwndFrame, haccelButtonList);
    768754            }
    769755            break;
     
    782768            if (!WinSetAccelTable(hab, haccelSaved, hwndFrame))
    783769              Win_Error(hwndFrame, HWND_DESKTOP, pszSrcFile, __LINE__, PCSZ_WINSETACCELTABLE);
    784             // else
    785               // DbgMsg(pszSrcFile, __LINE__, "WinSetAccelTable SAVED %x %x", hwndFrame, haccelSaved);
    786770          }
    787771          break;
     
    865849  case WM_BEGINDRAG:
    866850    id = WinQueryWindowUShort(hwnd, QWS_ID);
    867     // 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);
    868851    if (id == CBID_EDIT &&
    869         WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==
     852        WinQueryWindowUShort(WinQueryWindow(hwnd, QW_PARENT), QWS_ID) ==
    870853        MAIN_USERLIST) {
    871854
     
    875858      WinQueryWindowText(hwnd, CCHMAXPATH, path);
    876859      bstrip(path);
    877       // saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING,"Dragging: %s",path);
    878860      if (*path && !IsRoot(path))
    879861        DragOne(hwnd, (HWND) 0, path, FALSE);
     
    20972079          if (li->type == DID_ERROR)
    20982080                  Win_Error(DND_FRAME, HWND_DESKTOP, pszSrcFile, __LINE__,
    2099                             "Drag & Drop Dialog");
     2081                            GetPString(IDS_DRAGDROPDIALOGTEXT));
    21002082          if (!li->type) {
    21012083            FreeListInfo(li);
     
    29522934  }
    29532935
    2954   fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
     2936  fIsShutDownState = strcmp(pszStateName, PCSZ_SHUTDOWNSTATE) == 0;
    29552937  sprintf(szPrefix, "%s.", pszStateName);
    29562938
     
    31313113
    31323114  // If restoring shutdown state bypass no-prescan drives
    3133   fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
     3115  fIsShutDownState = strcmp(pszStateName, PCSZ_SHUTDOWNSTATE) == 0;
    31343116  // Delete saved state if internally saved state
    3135   fDeleteState = strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)) == 0;
     3117  fDeleteState = strcmp(pszStateName, PCSZ_FM2TEMPTEXT) == 0;
    31363118
    31373119  //size = (ULONG)0;
     
    32233205          if (fIsShutDownState &&
    32243206              driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) {
    3225             PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3207            PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
     3208            sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
     3209            WriteDetailsSwitches(szKey, NULL);
    32263210            continue;
    32273211          }
    32283212          if (fDeleteState)
    32293213            PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3230           localdcd.ds.detailslongname = dsDirCnrDefault.detailslongname;  // Set default
    3231           sprintf(szKey, "%sDirCnr.%lu.DetailsLongname", szPrefix, x);
    3232           size = sizeof(BOOL);
    3233           if (PrfQueryProfileData(fmprof,
    3234                                   FM3Str,
    3235                                   szKey,
    3236                                   (PVOID) &localdcd.ds.detailslongname,
    3237                                   &size))
    3238           {
    3239             if (fDeleteState)
    3240               PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L);
    3241           }
    3242 
    32433214          sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
    32443215          LoadDetailsSwitches(szKey, &localdcd.ds);
     
    32673238                RestorePresParams(hwndPPSave, PCSZ_DIRCNR);
    32683239              }
    3269               sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
     3240              //sprintf(szKey, "%sDirCnr.%lu", szPrefix, x);
    32703241              RestorePresParams(hwndCnr, szKey);
    32713242              dcd = WinQueryWindowPtr(hwndCnr, QWL_USER);
     
    46054576      // Complain if attempting to use reserved name
    46064577      if (stricmp(szStateName, GetPString(IDS_STATETEXT)) == 0 ||
    4607           stricmp(szStateName, GetPString(IDS_FM2TEMPTEXT)) == 0)
     4578          stricmp(szStateName, PCSZ_FM2TEMPTEXT) == 0)
    46084579      {
    46094580        saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
    46104581               GetPString(IDS_WARNINGTEXT),
    4611                "\"%s\" is a reserved state name", szStateName);
     4582               GetPString(IDS_STATERESERVENAMETEXT), szStateName);
    46124583      }
    46134584      // Ignore request if blank
    46144585      else if (*szStateName) {
    46154586        BOOL fAbortOperation = FALSE;
    4616         if (!fNoSaveState && fSaveState && stricmp(szStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0)
     4587        if (!fNoSaveState && fSaveState && stricmp(szStateName, PCSZ_SHUTDOWNSTATE) == 0)
    46174588         {
    46184589          if (saymsg(MB_YESNO | MB_DEFBUTTON2 | MB_ICONASTERISK, hwnd,
     
    46354606                saymsg(MB_ENTER | MB_ICONASTERISK, hwnd,
    46364607                       GetPString(IDS_WARNINGTEXT),
    4637                        "\"%s\" state name add failed", szStateName);      // 15 Apr 07 SHL failed
     4608                       GetPString(IDS_STATEADDFAILEDTEXT), szStateName);      // 15 Apr 07 SHL failed
    46384609                WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
    46394610              }
     
    46434614                     hwnd,
    46444615                     GetPString(IDS_WARNINGTEXT),
    4645                      "State data save failed");
     4616                     GetPString(IDS_STATEDATASAVEFAILED));
    46464617              WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT));
    46474618            }
     
    57325703    /* start remaining child windows */
    57335704    if (!fNoSaveState && fSaveState) {
    5734       PCSZ pszStatename = GetPString(IDS_SHUTDOWNSTATE);
     5705      PCSZ pszStatename = PCSZ_SHUTDOWNSTATE;
    57355706      PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID);
    57365707      if (!add_setup(pszStatename))
     
    58875858                          "MainWindowPos", WinQueryWindow(hwnd, QW_PARENT));
    58885859        if (!fNoSaveState && fSaveState)
    5889           SaveDirCnrState(hwnd, GetPString(IDS_SHUTDOWNSTATE));
     5860          SaveDirCnrState(hwnd, PCSZ_SHUTDOWNSTATE);
    58905861      }
    58915862    }
     
    63446315    {
    63456316      // Try to restore saved shutdown state
    6346       char *pszDefaultStateName = xstrdup(GetPString(IDS_SHUTDOWNSTATE),
    6347                                           pszSrcFile, __LINE__);
     6317      char *pszDefaultStateName = xstrdup(PCSZ_SHUTDOWNSTATE, pszSrcFile, __LINE__);
    63486318      if (pszDefaultStateName) {
    63496319        if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID))
Note: See TracChangeset for help on using the changeset viewer.