void CMainFrame::OnViewCustomize() { CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog(this, TRUE /* 扫描菜单*/); pDlgCust->EnableUserDefinedToolbars(); pDlgCust->Create(); }
/// <summary>Display tool window.</summary> void MainWnd::OnPerformCommand(UINT nID) { CMFCToolBarsCustomizeDialog* pDlgCust; try { switch (nID) { // Window Manager case ID_WINDOW_MANAGER: ShowWindowsDialog(); break; // Show/Hide window case ID_VIEW_STRING_LIBRARY: theApp.OpenStringLibrary(); break; case ID_VIEW_CONSOLE: OnCommand_Console(); break; case ID_VIEW_PROJECT: m_wndProject.ShowPane(!m_wndProject.IsVisible(), FALSE, TRUE); break; case ID_VIEW_SCRIPT_OBJECTS: m_wndScriptObjects.ShowPane(!m_wndScriptObjects.IsVisible(), FALSE, TRUE); break; case ID_VIEW_GAME_OBJECTS: m_wndGameObjects.ShowPane(!m_wndGameObjects.IsVisible(), FALSE, TRUE); break; case ID_VIEW_COMMANDS: m_wndCommands.ShowPane(!m_wndCommands.IsVisible(), FALSE, TRUE); break; case ID_VIEW_OUTPUT: m_wndOutput.ShowPane(!m_wndOutput.IsVisible(), FALSE, TRUE); break; case ID_VIEW_BACKUP: m_wndBackups.ShowPane(!m_wndBackups.IsVisible(), FALSE, TRUE); break; case ID_VIEW_PROPERTIES: m_wndProperties.ShowPane(!m_wndProperties.IsVisible(), FALSE, TRUE); break; case ID_EDIT_FIND: m_dlgFind.ShowWindow(m_dlgFind.IsWindowVisible() ? SW_HIDE : SW_SHOW); break; // Customize Toolbar case ID_VIEW_CUSTOMIZE: pDlgCust = new CMFCToolBarsCustomizeDialog(this, TRUE /* scan menus */); pDlgCust->EnableUserDefinedToolbars(); pDlgCust->Create(); break; // Run Test case ID_TEST_RUN_ALL: Testing::LogicTests::RunAll(); break; case ID_BATCH_VALIDATION: Testing::LogicTests::BatchTest_ScriptCompiler(); break; case ID_TEST_DESCRIPTIONS: Testing::LogicTests::Test_DescriptionReader(); break; case ID_TEST_FILE_SYSTEM: Testing::LogicTests::Test_FileSystem(); break; case ID_TEST_GZIP_COMPRESS: Testing::LogicTests::Test_GZip_Compress(); break; case ID_TEST_GZIP_DECOMPRESS: Testing::LogicTests::Test_GZip_Decompress(); break; case ID_TEST_LANGUAGE: Testing::LogicTests::Test_LanguageFileReader(); break; case ID_TEST_STRING_PARSER: Testing::LogicTests::Test_StringParser(); break; case ID_TEST_TFILE_READER: Testing::LogicTests::Test_TFileReader(); break; case ID_TEST_XML_WRITER: Testing::LogicTests::Test_XmlWriter(); break; case ID_TEST_SYNTAX_WRITER: Testing::LogicTests::Test_SyntaxWriter(); break; // Document tests case ID_TEST_SCRIPT_COMPILE: Testing::LogicTests::Test_ScriptCompiler(ScriptDocument::GetActive()->FullPath); break; case ID_TEST_SCRIPT_VALIDATE: Testing::LogicTests::Test_ScriptValidator(ScriptDocument::GetActive()->FullPath); break; } } catch (ExceptionBase& e) { theApp.ShowError(HERE, e); } }
void CMainFrame::OnViewCustomize() { CWordPadView* pView = DYNAMIC_DOWNCAST (CWordPadView, GetActiveView()); if (pView != NULL && pView->GetInPlaceActiveItem () != NULL) { return; } //------------------------------------ // Create a customize toolbars dialog: //------------------------------------ CMFCToolBarsCustomizeDialog* pDlgCust = new CMFCToolBarsCustomizeDialog (this, TRUE /* Automatic menus scaning */, AFX_CUSTOMIZE_MENU_SHADOWS | AFX_CUSTOMIZE_TEXT_LABELS | AFX_CUSTOMIZE_MENU_ANIMATIONS); pDlgCust->AddToolBar (_T("Format"), IDR_FORMATBAR); CMFCToolBarFontComboBox* pFontButton = m_wndFormatBar.CreateFontComboButton (); pDlgCust->ReplaceButton (IDC_FONTNAME, *pFontButton); delete pFontButton; CMFCToolBarFontSizeComboBox comboButtonFontSize (IDC_FONTSIZE, GetCmdMgr ()->GetCmdImage (IDC_FONTSIZE, FALSE), WS_TABSTOP|WS_VISIBLE|WS_TABSTOP|WS_VSCROLL|CBS_DROPDOWN, 10*m_wndFormatBar.m_szBaseUnits.cx + 10); pDlgCust->ReplaceButton (IDC_FONTSIZE, comboButtonFontSize); CMFCColorMenuButton* pColorButton = m_wndFormatBar.CreateColorButton (); pDlgCust->ReplaceButton (ID_CHAR_COLOR, *pColorButton); delete pColorButton; CMFCToolBarMenuButton* pBorderTypeButton = m_wndFormatBar.CreateBorderTypeButton (); pDlgCust->ReplaceButton (ID_BORDER_1, *pBorderTypeButton); delete pBorderTypeButton; pDlgCust->EnableUserDefinedToolbars (); pDlgCust->Create (); }