⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainwin.cpp

📁 ecos实时嵌入式操作系统
💻 CPP
📖 第 1 页 / 共 5 页
字号:
//####COPYRIGHTBEGIN####//// ----------------------------------------------------------------------------// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.// Copyright (C) 2003 John Dallaway//// This program is part of the eCos host tools.//// This program is free software; you can redistribute it and/or modify it// under the terms of the GNU General Public License as published by the Free// Software Foundation; either version 2 of the License, or (at your option)// any later version.//// This program is distributed in the hope that it will be useful, but WITHOUT// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for// more details.//// You should have received a copy of the GNU General Public License along with// this program; if not, write to the Free Software Foundation, Inc.,// 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.//// ----------------------------------------------------------------------------////####COPYRIGHTEND####// mainwin.cpp :////===========================================================================//#####DESCRIPTIONBEGIN####//// Author(s):   julians, jld// Contact(s):  julians, jld// Date:        2000/08/24// Version:     $Id: mainwin.cpp,v 1.57 2002/02/28 18:30:35 julians Exp $// Purpose:// Description: Implementation file for the ConfigTool main window// Requires:// Provides:// See also:// Known bugs:// Usage:////####DESCRIPTIONEND####////===========================================================================// ============================================================================// declarations// ============================================================================// ----------------------------------------------------------------------------// headers// ----------------------------------------------------------------------------#ifdef __GNUG__#pragma implementation "mainwin.h"#endif// Includes other headers for precompiled compilation#include "ecpch.h"#ifdef __BORLANDC__#pragma hdrstop#endif#include "wx/cshelp.h"#include "wx/wxhtml.h"#include "wx/filedlg.h"#include "wx/wfstream.h"#include "mainwin.h"#include "configtool.h"#include "configtree.h"#include "propertywin.h"#include "conflictwin.h"#include "mltwin.h"#include "outputwin.h"#include "shortdescrwin.h"#include "conflictsdlg.h"#include "aboutdlg.h"#include "finddlg.h"#include "settingsdlg.h"#include "platformsdlg.h"#include "buildoptionsdlg.h"#include "templatesdlg.h"#include "admindlg.h"#include "packagesdlg.h"#include "configtooldoc.h"#include "configtoolview.h"#include "folderdlg.h"#include "reposdlg.h"#include "docsystem.h"#include "symbols.h"#ifdef __WXMSW__#include "wx/msw/winundef.h"#endif// ----------------------------------------------------------------------------// resources// ----------------------------------------------------------------------------// the application icon#if defined(__WXGTK__) || defined(__WXMOTIF__)#include "bitmaps/configtool.xpm"#include "bitmaps/new.xpm"#include "bitmaps/open.xpm"#include "bitmaps/save.xpm"#include "bitmaps/copy.xpm"#include "bitmaps/paste.xpm"#include "bitmaps/cut.xpm"#include "bitmaps/delete.xpm"#include "bitmaps/help.xpm"#include "bitmaps/cshelp.xpm"#include "bitmaps/search.xpm"#include "bitmaps/stopbuild.xpm"#include "bitmaps/buildlibrary.xpm"#include "bitmaps/newregion.xpm"#include "bitmaps/newsection.xpm"#include "bitmaps/properties.xpm"#endif// ----------------------------------------------------------------------------// event tables and other macros for wxWindows// ----------------------------------------------------------------------------BEGIN_EVENT_TABLE(ecMainFrame, wxDocParentFrame)    EVT_MENU(wxID_EXIT,  ecMainFrame::OnQuit)    EVT_MENU(wxID_ABOUT, ecMainFrame::OnAbout)    EVT_MENU(ecID_REPOSITORY_INFO, ecMainFrame::OnRepositoryInfo)    EVT_MENU(wxID_FIND, ecMainFrame::OnFind)    EVT_MENU(ecID_FIND_NEXT, ecMainFrame::OnFindNext)    EVT_SASH_DRAGGED_RANGE(ecID_CONFIG_SASH_WINDOW, ecID_OUTPUT_SASH_WINDOW, ecMainFrame::OnSashDrag)    EVT_SIZE(ecMainFrame::OnSize)    EVT_IDLE(ecMainFrame::OnIdle)    EVT_CLOSE(ecMainFrame::OnCloseWindow)    EVT_MENU(ecID_TOGGLE_CONFLICTS, ecMainFrame::OnToggleWindow)    EVT_MENU(ecID_TOGGLE_PROPERTIES, ecMainFrame::OnToggleWindow)    EVT_MENU(ecID_TOGGLE_MEMORY, ecMainFrame::OnToggleWindow)    EVT_MENU(ecID_TOGGLE_SHORT_DESCR, ecMainFrame::OnToggleWindow)    EVT_MENU(ecID_TOGGLE_OUTPUT, ecMainFrame::OnToggleWindow)    EVT_MENU(ecID_TOOLBARS, ecMainFrame::OnToggleToolbar)    EVT_MENU(ecID_CONFIGTOOL_HELP, ecMainFrame::OnHelpConfigtool)    EVT_MENU(ecID_ECOS_HELP, ecMainFrame::OnHelpEcos)    EVT_MENU(ecID_CONTEXT_HELP, ecMainFrame::OnHelpContext)    EVT_MENU(ecID_RESOLVE_CONFLICTS, ecMainFrame::OnResolveConflicts)    EVT_UPDATE_UI(ecID_RESOLVE_CONFLICTS, ecMainFrame::OnUpdateResolveConflicts)    EVT_MENU(ecID_SETTINGS, ecMainFrame::OnSettings)    EVT_MENU(ecID_PLATFORMS, ecMainFrame::OnPlatforms)    EVT_MENU(ecID_BUILD_OPTIONS, ecMainFrame::OnBuildOptions)    EVT_MENU(ecID_PATHS_BUILD_TOOLS, ecMainFrame::OnBuildToolsPath)    EVT_MENU(ecID_PATHS_USER_TOOLS, ecMainFrame::OnUserToolsPath)    EVT_MENU(ecID_BUILD_TEMPLATES, ecMainFrame::OnTemplates)    EVT_MENU(ecID_ADMINISTRATION, ecMainFrame::OnAdmin)    EVT_MENU(ecID_BUILD_PACKAGES, ecMainFrame::OnPackages)    EVT_MENU(ecID_RUN_TESTS, ecMainFrame::OnRunTests)    EVT_MENU(ecID_BUILD_REPOSITORY, ecMainFrame::OnChooseRepository)    EVT_MENU(ecID_WHATS_THIS, ecMainFrame::OnWhatsThis)    EVT_MENU(ecID_SAVE_OUTPUT, ecMainFrame::OnSaveOutput)    EVT_MENU(ecID_IMPORT, ecMainFrame::OnImport)    EVT_MENU(ecID_EXPORT, ecMainFrame::OnExport)    EVT_MENU(ecID_REDHAT_WEB_HOME, ecMainFrame::OnWebRedHatHome)    EVT_MENU(ecID_REDHAT_WEB_ECOS, ecMainFrame::OnWebEcos)    EVT_MENU(ecID_REDHAT_WEB_NET_RELEASE, ecMainFrame::OnWebNetRelease)    EVT_MENU(ecID_REDHAT_WEB_UITRON, ecMainFrame::OnWebUitron)    EVT_MENU(ecID_STOP_BUILD, ecMainFrame::OnStopBuild)    EVT_MENU(ecID_BUILD_LIBRARY, ecMainFrame::OnBuildLibrary)    EVT_MENU(ecID_BUILD_TESTS, ecMainFrame::OnBuildTests)    EVT_MENU(ecID_CLEAN, ecMainFrame::OnClean)    EVT_MENU(ecID_SHELL, ecMainFrame::OnShell)    EVT_MENU(ecID_INDEX_DOCS, ecMainFrame::OnIndexDocs)    EVT_MENU(ecID_GENERATE_BUILD_TREE, ecMainFrame::OnGenerateBuildTree)    EVT_UPDATE_UI(ecID_PLATFORMS, ecMainFrame::OnUpdatePlatforms)    EVT_UPDATE_UI(ecID_BUILD_OPTIONS, ecMainFrame::OnUpdateBuildOptions)    EVT_UPDATE_UI(ecID_PATHS_BUILD_TOOLS, ecMainFrame::OnUpdateBuildToolsPath)    EVT_UPDATE_UI(ecID_PATHS_USER_TOOLS, ecMainFrame::OnUpdateUserToolsPath)    EVT_UPDATE_UI(ecID_BUILD_TEMPLATES, ecMainFrame::OnUpdateTemplates)    EVT_UPDATE_UI(ecID_ADMINISTRATION, ecMainFrame::OnUpdateAdmin)    EVT_UPDATE_UI(ecID_BUILD_PACKAGES, ecMainFrame::OnUpdatePackages)    EVT_UPDATE_UI(ecID_RUN_TESTS, ecMainFrame::OnUpdateRunTests)    EVT_UPDATE_UI(ecID_BUILD_REPOSITORY, ecMainFrame::OnUpdateChooseRepository)    EVT_UPDATE_UI(ecID_CLEAN, ecMainFrame::OnUpdateClean)    EVT_UPDATE_UI(ecID_REPOSITORY_INFO, ecMainFrame::OnUpdateRepositoryInfo)      EVT_UPDATE_UI(ecID_INDEX_DOCS, ecMainFrame::OnUpdateIndexDocs)    EVT_UPDATE_UI(ecID_TOGGLE_CONFLICTS, ecMainFrame::OnUpdateToggleWindow)    EVT_UPDATE_UI(ecID_TOGGLE_PROPERTIES, ecMainFrame::OnUpdateToggleWindow)    EVT_UPDATE_UI(ecID_TOGGLE_MEMORY, ecMainFrame::OnUpdateToggleWindow)    EVT_UPDATE_UI(ecID_TOGGLE_SHORT_DESCR, ecMainFrame::OnUpdateToggleWindow)    EVT_UPDATE_UI(ecID_TOGGLE_OUTPUT, ecMainFrame::OnUpdateToggleWindow)    EVT_UPDATE_UI(ecID_TOOLBARS, ecMainFrame::OnUpdateToggleToolbar)    // Disable commands that don't make sense immediately or are not yet implemented.    // Also, for text controls, disable if they are not being enabled by currently-focussed controls.    EVT_UPDATE_UI(wxID_COPY, ecMainFrame::OnUpdateDisable)    EVT_UPDATE_UI(wxID_CUT, ecMainFrame::OnUpdateDisable)    EVT_UPDATE_UI(wxID_PASTE, ecMainFrame::OnUpdateDisable)    EVT_UPDATE_UI(wxID_SELECTALL, ecMainFrame::OnUpdateSelectAll)    EVT_UPDATE_UI(wxID_CLEAR, ecMainFrame::OnUpdateClear)    EVT_UPDATE_UI(wxID_FIND, ecMainFrame::OnUpdateFind)    EVT_UPDATE_UI(ecID_FIND_NEXT, ecMainFrame::OnUpdateFindNext)    EVT_MENU(ecID_NEW_REGION, ecMainFrame::OnNewRegion)    EVT_MENU(ecID_NEW_SECTION, ecMainFrame::OnNewSection)    EVT_MENU(ecID_DELETE, ecMainFrame::OnDeleteRegionOrSection)    EVT_MENU(ecID_PROPERTIES, ecMainFrame::OnRegionOrSectionProperties)    EVT_UPDATE_UI(ecID_STOP_BUILD, ecMainFrame::OnUpdateStopBuild)    EVT_UPDATE_UI(ecID_BUILD_LIBRARY, ecMainFrame::OnUpdateBuildLibrary)    EVT_UPDATE_UI(ecID_BUILD_TESTS, ecMainFrame::OnUpdateBuildTests)    EVT_UPDATE_UI(ecID_GENERATE_BUILD_TREE, ecMainFrame::OnUpdateGenerateBuildTree)    EVT_UPDATE_UI(ecID_SHELL, ecMainFrame::OnUpdateShell)    EVT_UPDATE_UI(ecID_NEW_REGION, ecMainFrame::OnUpdateNewRegion)    EVT_UPDATE_UI(ecID_NEW_SECTION, ecMainFrame::OnUpdateNewSection)    EVT_UPDATE_UI(ecID_DELETE, ecMainFrame::OnUpdateDeleteRegionOrSection)    EVT_UPDATE_UI(ecID_PROPERTIES, ecMainFrame::OnUpdateRegionOrSectionProperties)    EVT_UPDATE_UI(ecID_IMPORT, ecMainFrame::OnUpdateImport)    EVT_UPDATE_UI(ecID_EXPORT, ecMainFrame::OnUpdateExport)END_EVENT_TABLE()// ----------------------------------------------------------------------------// main frame// ----------------------------------------------------------------------------// Frame constructorecMainFrame::ecMainFrame(wxDocManager *manager, const wxString& title, const wxPoint& pos, const wxSize& size):    wxDocParentFrame(manager, (wxFrame *)NULL, ecID_MAIN_FRAME, title, pos, size, wxDEFAULT_FRAME_STYLE|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE ){    m_splitter = NULL;    m_scrolledWindow = NULL;    m_tree = NULL;    m_configSashWindow = NULL;    m_valueWindow = NULL;    m_outputWindow = NULL;    m_shortDescrWindow = NULL;    m_conflictsSashWindow = NULL;    m_propertiesSashWindow = NULL;    m_memorySashWindow = NULL;    m_shortDescrSashWindow = NULL;    m_outputSashWindow = NULL;    m_propertyListWindow = NULL;    m_findDialog = NULL;    m_mltWindow = NULL;    #ifdef __WXMAC__    // we need this in order to allow the about menu relocation, since ABOUT is    // not the default id of the about menu    wxApp::s_macAboutMenuItemId = wxID_EXIT;#endif        CreateWindows();    wxIcon mainIcon(wxICON(configtool));    wxGetApp().SetMainIcon(mainIcon);        // set the frame icon    SetIcon(mainIcon);        // create a menu bar    // File menu    wxMenu *fileMenu = new wxMenu(wxT(""), wxMENU_TEAROFF);        fileMenu->Append(wxID_NEW, _("&New\tCtrl+N"), _("Creates a new document"));#if 0    wxMenuItem* menuItem = new wxMenuItem(fileMenu, wxID_NEW, _("&New\tCtrl+N"), _("Creates a new document"));    menuItem->SetBitmaps(wxBITMAP(new));    fileMenu->Append(menuItem);#endif        fileMenu->Append(wxID_OPEN, _("&Open\tCtrl+O"), _("Opens an existing document"));    fileMenu->Append(wxID_SAVE, _("&Save\tCtrl+S"), _("Saves the active document"));    fileMenu->Append(wxID_SAVEAS, _("Save &As..."), _("Saves the active document with a new name"));    fileMenu->AppendSeparator();    fileMenu->Append(ecID_IMPORT, _("&Import..."), _("Imports a minimal configuration exported from another configuration"));    fileMenu->Append(ecID_EXPORT, _("&Export..."), _("Exports a minimal configuration for importing into another configuration"));    fileMenu->AppendSeparator();       fileMenu->Append(wxID_EXIT, _("E&xit\tAlt+X"), _("Quits the application"));    // A history of files visited. Use this menu.    wxGetApp().GetDocManager()->FileHistoryUseMenu(fileMenu);    // Load file history    {        wxConfig config(wxGetApp().GetSettings().GetConfigAppName());	config.SetPath(wxT("FileHistory/"));        wxGetApp().GetDocManager()->FileHistoryLoad(config);    }        // Edit menu    wxMenu* editMenu = new wxMenu(wxT(""), wxMENU_TEAROFF);        editMenu->Append(wxID_CUT, _("Cu&t\tCtrl+X"), _("Cuts the output pane selection and moves it to the Clipboard"));    editMenu->Append(wxID_COPY, _("&Copy\tCtrl+C"), _("Copies the output pane selection to the clipboard"));    editMenu->Append(wxID_PASTE, _("&Paste\tCtrl+V"), _("Inserts Clipboard contents"));    editMenu->Append(wxID_CLEAR, _("&Clear"), _("Erases everything in the output pane"));    editMenu->AppendSeparator();    editMenu->Append(wxID_SELECTALL, _("&Select All\tCtrl+A"), _("Selects the entire output pane"));    editMenu->AppendSeparator();    editMenu->Append(wxID_FIND, _("&Find...\tCtrl+F"), _("Finds the specified text"));    editMenu->Append(ecID_FIND_NEXT, _("Find &Next\tF3"), _("Finds the next item matching the Find text"));    editMenu->AppendSeparator();    editMenu->Append(ecID_SAVE_OUTPUT, _("Sa&ve Output..."), _("Saves the contents of the output pane"));        // View menu    wxMenu* viewMenu = new wxMenu(wxT(""), wxMENU_TEAROFF);        viewMenu->Append(ecID_SETTINGS, _("&Settings...\tCtrl+T"), _("Shows the application settings dialog"));    viewMenu->AppendSeparator();    viewMenu->Append(ecID_TOOLBARS, _("&Toolbar"), _("Shows or hides the toolbar"), TRUE);    viewMenu->Append(ecID_TOGGLE_PROPERTIES, _("&Properties\tAlt+1"), _("Shows or hides the properties window"), TRUE);    viewMenu->Append(ecID_TOGGLE_OUTPUT, _("&Output\tAlt+2"), _("Shows the output window"), TRUE);    viewMenu->Append(ecID_TOGGLE_SHORT_DESCR, _("&Short Description\tAlt+3"), _("Shows or hides the short description window"), TRUE);    viewMenu->Append(ecID_TOGGLE_CONFLICTS, _("&Conflicts\tAlt+4"), _("Shows or hides the conflicts window"), TRUE);#if ecUSE_MLT    viewMenu->Append(ecID_TOGGLE_MEMORY, _("&Memory Layout\tAlt+5"), _("Shows or hides the memory layout window"), TRUE);    //viewMenu->Enable(ecID_TOGGLE_MEMORY, FALSE);#endif    // Not clear what these do, so let's not have them.    //viewMenu->Append(ecID_VIEW_NEXT, _("&Next\tAlt+F6"), _("Selects the next visible pane"));    //viewMenu->Append(ecID_VIEW_PREVIOUS, _("&Previous\tShift+Alt+F6"), _("Selects the previous visible pane"));        // Build menu    wxMenu* buildMenu = new wxMenu(wxT(""), wxMENU_TEAROFF);        buildMenu->Append(ecID_BUILD_LIBRARY, _("&Library\tF7"), _("Builds the library"));    buildMenu->Append(ecID_BUILD_TESTS, _("&Tests\tShift+F7"), _("Builds the tests"));    buildMenu->Append(ecID_CLEAN, _("&Clean"), _("Deletes intermediate and output files"));    buildMenu->Append(ecID_STOP_BUILD, _("&Stop"), _("Stops the build"));    buildMenu->AppendSeparator();    buildMenu->Append(ecID_GENERATE_BUILD_TREE, _("&Generate Build Tree"), _("Explicitly recreates the build tree"));    buildMenu->AppendSeparator();    buildMenu->Append(ecID_BUILD_OPTIONS, _("&Options..."), _("Changes build options"));    buildMenu->Append(ecID_BUILD_REPOSITORY, _("&Repository..."), _("Selects repository"));    buildMenu->Append(ecID_BUILD_TEMPLATES, _("&Templates..."), _("Selects the package templates"));    buildMenu->Append(ecID_BUILD_PACKAGES, _("&Packages..."), _("Selects individual packages"));        // Tools menu    wxMenu* toolsMenu = new wxMenu(wxT(""), wxMENU_TEAROFF);        wxMenu* pathMenu = new wxMenu;    pathMenu->Append(ecID_PATHS_BUILD_TOOLS, _("&Build Tools..."), _("Specifies the folder containing the build tools"));    pathMenu->Append(ecID_PATHS_USER_TOOLS, _("&User Tools..."), _("Specifies the folder containing the user tools"));    toolsMenu->Append(ecID_PATHS, _("&Paths"), pathMenu);    toolsMenu->Append(ecID_SHELL, _("&Shell..."), _("Invokes a command shell"));    toolsMenu->Append(ecID_RUN_TESTS, _("&Run Tests...\tCtrl+F5"), _("Runs the configuration tests"));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -