Changeset 1125 for trunk/dll/mainwnd.c


Ignore:
Timestamp:
Aug 27, 2008, 6:35:43 PM (17 years ago)
Author:
John Small
Message:

Ticket 259: Support saving and restoring a toolbar with DirCnr states.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/mainwnd.c

    r1121 r1125  
    107107static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview);
    108108static VOID DeletePresParams(PSZ pszKeyroot);
     109static VOID BuildTools(HWND hwndT, BOOL resize);
    109110
    110111static MRESULT EXPENTRY MainObjectWndProc(HWND hwnd, ULONG msg, MPARAM mp1,
     
    12911292                    (PVOID) (SHORT1FROMMP(mp1) == IDM_SAVETOOLS) ?
    12921293                    "TRUE" : NULL))
    1293         BuildTools(hwndToolback, TRUE);
     1294        PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
    12941295      break;
    12951296    }
     
    14101411}
    14111412
    1412 VOID BuildTools(HWND hwndT, BOOL resize)
     1413static VOID BuildTools(HWND hwndT, BOOL resize)
    14131414{
    14141415  TOOL *tool;
     
    14201421  henum = WinBeginEnumWindows(hwndT);
    14211422  while ((hwndTool = WinGetNextWindow(henum)) != NULLHANDLE)
    1422     WinDestroyWindow(hwndTool);
     1423    if (!WinDestroyWindow(hwndTool))
     1424      Runtime_Error(pszSrcFile, __LINE__, "Unable to destroy toolbar button");
    14231425  WinEndEnumWindows(henum);
    14241426  if (!fToolbar) {
     
    25652567    return 0;
    25662568
     2569  case UM_SETUP2:  /* Used to load a new a toolbar */
     2570    BuildTools(hwnd, TRUE);
     2571    return 0;
     2572
    25672573  case WM_CHORD:
    25682574    {
     
    25842590    if (WinDlgBox(HWND_DESKTOP,
    25852591                  hwnd, ToolIODlgProc, FM3ModHandle, SVBTN_FRAME, MPVOID))
    2586       BuildTools(hwnd, TRUE);
     2592      PostMsg(hwnd, UM_SETUP2, MPVOID, MPVOID);
    25872593    return MRFROMSHORT(TRUE);
    25882594
     
    28322838  fIsShutDownState = strcmp(pszStateName, GetPString(IDS_SHUTDOWNSTATE)) == 0;
    28332839  sprintf(szPrefix, "%s.", pszStateName);
     2840
     2841  sprintf(szKey, "%sToolbar", szPrefix);
     2842  PrfWriteProfileString(fmprof, FM3Str, szKey, lasttoolbar);
    28342843
    28352844  henum = WinBeginEnumWindows(hwndClient);
     
    30593068  fDeleteState = strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT)) == 0;
    30603069
     3070  size = (ULONG)0;
     3071  sprintf(szKey, "%sToolbar", szPrefix);
     3072  if (PrfQueryProfileSize(fmprof, FM3Str, szKey, &size) && size)
     3073  {
     3074    if (fToolsChanged)
     3075      save_tools(NULL);
     3076    PrfQueryProfileData(fmprof, FM3Str, szKey, lasttoolbar, &size);
     3077    PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar);
     3078    load_tools(NULL);
     3079    PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
     3080  }
    30613081  size = sizeof(SWP);
    30623082  sprintf(szKey, "%sMySizeLastTime", szPrefix);
     
    51075127    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
    51085128                 &fTextTools, TRUE, "TextTools");
    5109     BuildTools(hwndToolback, TRUE);
     5129    PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
    51105130    PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
    51115131            MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     
    51155135    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER), SHORT1FROMMP(mp1),
    51165136                 &fToolTitles, TRUE, "ToolTitles");
    5117     BuildTools(hwndToolback, TRUE);
     5137    PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
    51185138    PostMsg(WinQueryWindow(hwnd, QW_PARENT), WM_UPDATEFRAME,
    51195139            MPFROMLONG(FCF_SIZEBORDER), MPVOID);
     
    52015221
    52025222  case IDM_CREATETOOL:
    5203     BuildTools(hwndToolback, TRUE);
     5223    PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
    52045224    break;
    52055225
     
    52075227    SetMenuCheck(WinQueryWindowULong(hwnd, QWL_USER),
    52085228                 IDM_TOOLSUBMENU, &fToolbar, TRUE, "Toolbar");
    5209     BuildTools(hwndToolback, TRUE);
     5229    PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
    52105230    WinShowWindow(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    52115231                                  MAIN_TOOLS), fToolbar);
     
    53985418            load_tools(NULL);
    53995419          else {
    5400             strcpy(lasttoolbox,
     5420            strcpy(lasttoolbar,
    54015421                   quicktool[SHORT1FROMMP(mp1) - IDM_QUICKTOOLSTART]);
    5402             PrfWriteProfileString(fmprof, FM3Str, "LastToolBox", lasttoolbox);
     5422            PrfWriteProfileString(fmprof, FM3Str, "LastToolbar", lasttoolbar);
    54035423          }
    5404           BuildTools(hwndToolback, TRUE);
     5424          PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
    54055425        }
    54065426      }
     
    57165736     * start up some initial children
    57175737     */
    5718     load_tools(NULL);
    5719     BuildTools(hwndToolback, TRUE);
    57205738    WinShowWindow(WinQueryWindow(hwnd, QW_PARENT), TRUE);
    57215739    PostMsg(MainObjectHwnd, UM_SETUP2, mp1, mp2);
     
    57685786                          SWP_ZORDER | SWP_ACTIVATE);
    57695787      }
    5770       ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
    5771                                   MAIN_TOOLS));
     5788//       ResizeTools(WinWindowFromID(WinQueryWindow(hwnd, QW_PARENT),
     5789//                                MAIN_TOOLS));
    57725790    }
    57735791    PostMsg(MainObjectHwnd, UM_SETUP3, mp1, mp2);
     
    57805798      PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszStatename), MPVOID);
    57815799      if (!add_setup(pszStatename))
    5782               save_setups();
     5800        save_setups();
     5801    } else {
     5802      load_tools(NULL);
     5803      PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
    57835804    }
    57845805    PostMsg(MainObjectHwnd, UM_SETUP4, mp1, mp2);
     
    60376058          if (!foundit) {
    60386059            thisone = FALSE;
    6039             p = strrchr(lasttoolbox, '\\');
     6060            p = strrchr(lasttoolbar, '\\');
    60406061            if (!p)
    6041               p = lasttoolbox;
     6062              p = lasttoolbar;
    60426063            else
    60436064              p++;
     
    60626083        priority_bumped();
    60636084      }
    6064       WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));
     6085      WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT));
    60656086    }
    60666087    return 0;
     
    62706291              load_tools(path);
    62716292              PrfWriteProfileString(fmprof,
    6272                                     FM3Str, "LastToolBox", lasttoolbox);
    6273               BuildTools(hwndToolback, TRUE);
    6274               WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBOXTEXT));
     6293                                    FM3Str, "LastToolbar", lasttoolbar);
     6294              PostMsg(hwndToolback, UM_SETUP2, MPVOID, MPVOID);
     6295              WinSetWindowText(hwndButtonlist, GetPString(IDS_TOOLBARTEXT));
    62756296            }
    62766297            else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) {
Note: See TracChangeset for help on using the changeset viewer.