Changeset 1092 for trunk/dll/notebook.c

Show
Ignore:
Timestamp:
07/21/08 22:31:21 (4 months ago)
Author:
jbs
Message:

Ticket 114: Added code to reset the "emphasis" of the Drive Tree after the rescan.
Also added a more accurate memory allocation and additional error handling.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/dll/notebook.c

    r1083 r1092  
    11681168MRESULT EXPENTRY CfgTDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 
    11691169{ 
     1170  BOOL fShowEnvChanged = FALSE; 
     1171  BOOL fTreeEnvVarListChanged = FALSE; 
     1172 
    11701173  switch (msg) { 
    11711174  case WM_INITDLG: 
     
    12601263    PrfWriteProfileData(fmprof, FM3Str, "DoubleClickOpens", &fDCOpens, 
    12611264                        sizeof(BOOL)); 
    1262     if (hwndTree && fShowEnv != WinQueryButtonCheckstate(hwnd, CFGT_SHOWENV)) 
    1263       PostMsg(WinWindowFromID 
    1264               (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), WM_COMMAND, 
    1265               MPFROM2SHORT(IDM_RESCAN, 0), MPVOID); 
     1265    fShowEnvChanged = (fShowEnv != WinQueryButtonCheckstate(hwnd, CFGT_SHOWENV)); 
    12661266    fShowEnv = WinQueryButtonCheckstate(hwnd, CFGT_SHOWENV); 
    12671267    PrfWriteProfileData(fmprof, appname, "ShowEnv", &fShowEnv, sizeof(BOOL)); 
    12681268    { 
    1269       char * pszTemp = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 
     1269      char * pszTemp = xmalloc(WinQueryDlgItemTextLength(hwnd, CFGT_ENVVARLIST) + 1, pszSrcFile, __LINE__); 
    12701270      if (pszTemp) 
    12711271      { 
    12721272        WinQueryDlgItemText(hwnd, CFGT_ENVVARLIST, MaxComLineStrg, pszTemp); 
    12731273        strupr(pszTemp); 
    1274         if (strcmp(pszTemp, pszTreeEnvVarList)) 
    1275         { 
     1274        if (strcmp(pszTemp, pszTreeEnvVarList)) { 
     1275          fTreeEnvVarListChanged = TRUE; 
    12761276          strcpy(pszTreeEnvVarList, pszTemp); 
    12771277          PrfWriteProfileString(fmprof, appname, "TreeEnvVarList", pszTreeEnvVarList); 
    1278           if (hwndTree && fShowEnv) { 
    1279             PostMsg(WinWindowFromID 
    1280                     (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), WM_COMMAND, 
    1281                     MPFROM2SHORT(IDM_RESCAN, 0), MPVOID); 
    1282           } 
    12831278        } 
    12841279        free(pszTemp); 
    12851280      } else { 
    1286         // Report error? 
     1281        Runtime_Error(pszSrcFile, __LINE__, "Unable to allocate memory"); 
     1282      } 
     1283      if (hwndTree && (fShowEnvChanged || (fShowEnv && fTreeEnvVarListChanged))) 
     1284      { 
     1285        PCNRITEM pci = WinSendMsg(WinWindowFromID 
     1286                (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), CM_QUERYRECORDEMPHASIS, 
     1287                                  MPFROMLONG(CMA_FIRST), 
     1288                                  MPFROMSHORT(CRA_SELECTED)); 
     1289        PostMsg(WinWindowFromID 
     1290                (WinWindowFromID(hwndTree, FID_CLIENT), TREE_CNR), WM_COMMAND, 
     1291                MPFROM2SHORT(IDM_RESCAN, 0), MPVOID); 
     1292        PostMsg(hwndTree, UM_SHOWME, MPFROMP(pci->pszFileName), MPVOID); 
     1293 
    12871294      } 
    12881295    }