Changeset 930 for trunk/dll/notebook.c


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

Some code "cleanup" for ticket 150.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.