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

📄 mainwin.cpp

📁 ecos实时嵌入式操作系统
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    toolsMenu->Append(ecID_PLATFORMS, _("&Platforms..."), _("Edits the platforms list"));    toolsMenu->Append(ecID_RESOLVE_CONFLICTS, _("Resolve &Conflicts..."), _("Resolves conflicts"));    toolsMenu->Append(ecID_ADMINISTRATION, _("&Administration..."), _("Performs repository administration tasks"));#if 0    toolsMenu->AppendSeparator();    toolsMenu->Append(ecID_TOOLS_OPTIONS, _("&Options..."), _("Changes configuration options"));#endif    toolsMenu->Append(ecID_INDEX_DOCS, _("Regenerate Help &Index"), _("Regenerates the online help contents"));        // Help menu    wxMenu* helpMenu = new wxMenu;    helpMenu->Append(ecID_CONFIGTOOL_HELP, _("&Configuration Tool Help\tShift+F1"), _("Displays help"));    helpMenu->Append(ecID_ECOS_HELP, _("&eCos Documentation"), _("Displays the documentation home page"));    helpMenu->Append(ecID_CONTEXT_HELP, _("&Help On..."), _("Displays help for clicked-on windows"));    helpMenu->AppendSeparator();        wxMenu* webMenu = new wxMenu;    webMenu->Append(ecID_REDHAT_WEB_HOME, _("&Red Hat Home Page"), _("Opens the Red Hat home page"));    webMenu->Append(ecID_REDHAT_WEB_ECOS, _("&eCos Product Page"), _("Opens the eCos product page"));    webMenu->Append(ecID_REDHAT_WEB_NET_RELEASE, _("eCos &Net Release Page"), _("Opens the eCos net release page"));    webMenu->AppendSeparator();    webMenu->Append(ecID_REDHAT_WEB_UITRON, _("&ITRON"), _("Opens the ITRON specification page"));    //    helpMenu->Append(ecID_REDHAT_WEB, _("&Red Hat on the Web"), webMenu);//    helpMenu->AppendSeparator();    helpMenu->Append(ecID_REPOSITORY_INFO, _("Repository &Information...\tCtrl+I"), _("Displays information about the current repository"));    helpMenu->Append(wxID_ABOUT, _("&About the Configuration Tool..."), _("Displays program information, version and copyright"));        wxMenuBar *menuBar = new wxMenuBar();    menuBar->Append(fileMenu, _("&File"));    menuBar->Append(editMenu, _("&Edit"));    menuBar->Append(viewMenu, _("&View"));    menuBar->Append(buildMenu, _("&Build"));    menuBar->Append(toolsMenu, _("&Tools"));    menuBar->Append(helpMenu, _("&Help"));        // ... and attach this menu bar to the frame    SetMenuBar(menuBar);        // Create the toolbar    RecreateToolbar();        if (!wxGetApp().GetSettings().m_showToolBar)        GetToolBar()->Show( FALSE );        // Create the status bar    CreateStatusBar(4, wxST_SIZEGRIP);        int* widths = new int[4];    widths[0] = -1; widths[1] = 100; widths[2] = 40; widths[3] = 80;    SetStatusWidths(4, widths);    delete[] widths;        SetStatusText(_("No conflicts"), ecFailRulePane);    SetStatusText(_("Ready"), ecStatusPane);}// Create the windowsvoid ecMainFrame::CreateWindows(){    ecSettings& stg = wxGetApp().GetSettings();        // Create the sash layout windows first        // Sash window for the output window    m_outputSashWindow = new wxSashLayoutWindow(this, ecID_OUTPUT_SASH_WINDOW, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxCLIP_SIBLINGS);    m_outputSashWindow->SetDefaultSize(stg.m_outputSashSize);    m_outputSashWindow->SetOrientation(wxLAYOUT_HORIZONTAL);    m_outputSashWindow->SetAlignment(wxLAYOUT_BOTTOM);    m_outputSashWindow->SetSashVisible(wxSASH_TOP, TRUE);    m_outputWindow = new ecOutputWindow(m_outputSashWindow, ecID_OUTPUT_WINDOW, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxCLIP_CHILDREN|wxTE_READONLY|wxTE_RICH);    m_outputWindow->SetHelpText(_("The output window displays various warning and informational messages."));        // Sash window for the memory window    m_memorySashWindow = new wxSashLayoutWindow(this, ecID_MEMORY_SASH_WINDOW, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxSW_3D|wxCLIP_SIBLINGS);    m_memorySashWindow->SetDefaultSize(stg.m_memorySashSize);    m_memorySashWindow->SetOrientation(wxLAYOUT_HORIZONTAL);    m_memorySashWindow->SetAlignment(wxLAYOUT_BOTTOM);    m_memorySashWindow->SetSashVisible(wxSASH_TOP, TRUE);    //wxTextCtrl* memoryWindow = new wxTextCtrl(m_memorySashWindow, ecID_MEMORY_WINDOW, wxT("This will be the memory layout window."), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxCLIP_CHILDREN|wxTE_NO_VSCROLL|wxTE_READONLY);    m_mltWindow = new ecMemoryLayoutWindow(m_memorySashWindow, ecID_MEMORY_WINDOW, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN|wxSUNKEN_BORDER);    m_mltWindow->SetHelpText(_("The memory layout window presents a graphical view of the memory layout of the currently selected\ncombination of target architecture, platform and start-up type."));        // Sash window for the config tree    m_configSashWindow = new wxSashLayoutWindow(this, ecID_CONFIG_SASH_WINDOW, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxCLIP_CHILDREN/*|wxCLIP_SIBLINGS*/);    m_configSashWindow->SetDefaultSize(stg.m_treeSashSize);    m_configSashWindow->SetOrientation(wxLAYOUT_VERTICAL);    m_configSashWindow->SetAlignment(wxLAYOUT_LEFT);    m_configSashWindow->SetSashVisible(wxSASH_RIGHT, TRUE);        // Sash window for the conflicts window    m_conflictsSashWindow = new wxSashLayoutWindow(this, ecID_CONFLICTS_SASH_WINDOW, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxCLIP_SIBLINGS);    m_conflictsSashWindow->SetDefaultSize(stg.m_conflictsSashSize);    m_conflictsSashWindow->SetOrientation(wxLAYOUT_HORIZONTAL);    m_conflictsSashWindow->SetAlignment(wxLAYOUT_TOP);    m_conflictsSashWindow->SetSashVisible(wxSASH_BOTTOM, TRUE);    m_conflictsWindow = new ecConflictListCtrl(m_conflictsSashWindow, ecID_CONFLICTS_WINDOW, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxCLIP_CHILDREN|wxSUNKEN_BORDER);    m_conflictsWindow->SetHelpText(_("The conflicts window lists any outstanding conflicts in the configuration."));        // Sash window for the properties window    m_propertiesSashWindow = new wxSashLayoutWindow(this, ecID_PROPERTIES_SASH_WINDOW, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxCLIP_SIBLINGS);    m_propertiesSashWindow->SetDefaultSize(stg.m_propertiesSashSize);    m_propertiesSashWindow->SetOrientation(wxLAYOUT_HORIZONTAL);    m_propertiesSashWindow->SetAlignment(wxLAYOUT_TOP);    m_propertiesSashWindow->SetSashVisible(wxSASH_BOTTOM, TRUE);//    wxTextCtrl* propertiesWindow = new wxTextCtrl(m_propertiesSashWindow, ecID_PROPERTIES_WINDOW, wxT("This will be the properties window."), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxCLIP_CHILDREN|wxTE_NO_VSCROLL|wxTE_READONLY);    m_propertyListWindow = new ecPropertyListCtrl(m_propertiesSashWindow, ecID_PROPERTIES_WINDOW, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxCLIP_CHILDREN|wxLC_VRULES|wxLC_HRULES|wxSUNKEN_BORDER);    m_propertyListWindow->SetHelpText(_("The properties window shows the properties of the selected configuration item."));        // Sash window for the short description window    m_shortDescrSashWindow = new wxSashLayoutWindow(this, ecID_SHORT_DESCR_SASH_WINDOW, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxCLIP_SIBLINGS);    m_shortDescrSashWindow->SetDefaultSize(stg.m_shortDescrSashSize);    m_shortDescrSashWindow->SetOrientation(wxLAYOUT_HORIZONTAL);    m_shortDescrSashWindow->SetAlignment(wxLAYOUT_TOP);    //m_shortDescrSashWindow->SetSashVisible(wxSASH_TOP, TRUE);    m_shortDescrWindow = new ecShortDescriptionWindow(m_shortDescrSashWindow, ecID_SHORT_DESCR_WINDOW, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxCLIP_CHILDREN/*|wxTE_NO_VSCROLL*/|wxTE_READONLY);    m_shortDescrWindow->SetBackgroundColour(wxColour(255, 255, 225));    m_shortDescrWindow->SetHelpText(_("The short description window displays brief help on a selected configuration item."));        // Create a composite widget to represent the scrolling config window    m_scrolledWindow = new ecSplitterScrolledWindow(m_configSashWindow, ecID_SCROLLED_WINDOW, wxDefaultPosition,        wxSize(400, 100), wxNO_BORDER | wxCLIP_CHILDREN | wxVSCROLL);    m_splitter = new wxThinSplitterWindow(m_scrolledWindow, ecID_SPLITTER_WINDOW, wxDefaultPosition,        wxSize(400, 100), wxSP_3DBORDER | wxCLIP_CHILDREN /* | wxSP_LIVE_UPDATE */);    m_splitter->SetSashSize(2);    m_tree = new ecConfigTreeCtrl(m_splitter, ecID_TREE_CTRL, wxDefaultPosition,        wxSize(200, 100), wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER );    m_valueWindow = new ecValueWindow(m_splitter, ecID_VALUE_WINDOW, wxDefaultPosition,        wxSize(200, 100), wxNO_BORDER);    m_splitter->SplitVertically(m_tree, m_valueWindow);    m_splitter->SetMinimumPaneSize(100);    //m_splitter->AdjustScrollbars();    m_splitter->SetSashPosition(wxGetApp().GetSettings().m_configPaneWidth);    m_scrolledWindow->SetTargetWindow(m_tree);      m_scrolledWindow->EnableScrolling(FALSE, FALSE);    m_tree->SetHelpText(_("The configuration window is the principal window used to configure eCos.\nIt takes the form of a tree-based representation of the configuration items within the currently loaded eCos packages."));    m_valueWindow->SetHelpText(m_tree->GetHelpText());        // Let the two controls know about each other    m_valueWindow->SetTreeCtrl(m_tree);    m_tree->SetCompanionWindow(m_valueWindow);    // Set visibility according to config settings    if (!wxGetApp().GetSettings().m_showConflictsWindow)        m_conflictsSashWindow->Show(FALSE);    if (!wxGetApp().GetSettings().m_showPropertiesWindow)        m_propertiesSashWindow->Show(FALSE);    if (!wxGetApp().GetSettings().m_showShortDescrWindow)        m_shortDescrSashWindow->Show(FALSE);    if (!wxGetApp().GetSettings().m_showOutputWindow)        m_outputSashWindow->Show(FALSE);    if (!wxGetApp().GetSettings().m_showMemoryWindow)        m_memorySashWindow->Show(FALSE);}// event handlersvoid ecMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)){    Close();}void ecMainFrame::OnFind(wxCommandEvent& event){    if (m_findDialog)    {        m_findDialog->Raise();        return;    }    m_findDialog = new ecFindDialog (this, ecID_FIND_DIALOG, _("Find in configuration"));    m_findDialog->Show(TRUE);    // For some reason, under Windows, the text control doesn't get the focus if we set the focus    // and then call Show. We have to set the focus afterwards instead.    m_findDialog->FindWindow(ecID_FIND_DIALOG_WHAT)->SetFocus();}void ecMainFrame::OnFindNext(wxCommandEvent& event){    if (wxGetApp().GetConfigToolDoc())    {        ecConfigToolView* view = (ecConfigToolView*) wxGetApp().GetConfigToolDoc()->GetFirstView() ;        view->DoFind(wxGetApp().GetSettings().m_findText, this);    }}void ecMainFrame::OnUpdateFind(wxUpdateUIEvent& event){    event.Enable( wxGetApp().GetConfigToolDoc() != NULL );}void ecMainFrame::OnUpdateFindNext(wxUpdateUIEvent& event){    event.Enable( (wxGetApp().GetConfigToolDoc() != NULL) && !wxGetApp().GetSettings().m_findText.IsEmpty() );}void ecMainFrame::OnAbout(wxCommandEvent& WXUNUSED(event)){//    ecAboutDialog dialog(this, ecID_ABOUT_DIALOG, _("About eCos Configuration Tool"));//    dialog.ShowModal();	wxString msg;	msg.Printf("eCos Configuration Tool %s (%s %s)\n\nCopyright (c) Red Hat, Inc. 1998-2002\nCopyright (c) John Dallaway 2003", ecCONFIGURATION_TOOL_VERSION, __DATE__, __TIME__);    wxMessageBox(msg, _("About eCos Configuration Tool"), wxICON_INFORMATION | wxOK);}void ecMainFrame::OnSize(wxSizeEvent& WXUNUSED(event)){    // First, we need to resize the sash windows proportionately,    // or we may end up with negative sizes, etc.    wxRect rect = GetRect();    if (rect != wxGetApp().GetSettings().m_frameSize)    {        double factorX = ((double) rect.GetWidth() / (double) wxGetApp().GetSettings().m_frameSize.GetWidth());        double factorY = ((double) rect.GetHeight() / (double) wxGetApp().GetSettings().m_frameSize.GetHeight());                wxNode* node = GetChildren().First();        while (node)        {            wxWindow* win = (wxWindow*) node->Data();            if (win->IsKindOf(CLASSINFO(wxSashLayoutWindow)))            {                wxSashLayoutWindow* sashWin = (wxSashLayoutWindow*) win;                wxSize sz = sashWin->GetSize();                sashWin->SetDefaultSize(wxSize((int) ((double) sz.x * factorX), (int) ((double) sz.y * factorY)));            }            node = node->Next();        }    }        wxLayoutAlgorithm layout;    layout.LayoutFrame(this);        wxGetApp().GetSettings().m_frameSize = rect;}void ecMainFrame::RecreateToolbar(){    // delete and recreate the toolbar    wxToolBarBase *toolBar = GetToolBar();    if (toolBar)    {        delete toolBar;        SetToolBar(NULL);    }        long style = wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL | wxTB_DOCKABLE;        toolBar = CreateToolBar(style, ecID_TOOLBAR);        toolBar->SetMargins( 4, 4 );        // Set up toolbar    wxBitmap toolBarBitmaps[20];        toolBarBitmaps[0] = wxBITMAP(new);    toolBarBitmaps[1] = wxBITMAP(open);    toolBarBitmaps[2] = wxBITMAP(save);    toolBarBitmaps[3] = wxBITMAP(copy);    toolBarBitmaps[4] = wxBITMAP(cut);    toolBarBitmaps[5] = wxBITMAP(paste);    toolBarBitmaps[6] = wxBITMAP(search);    toolBarBitmaps[7] = wxBITMAP(stopbuild);    toolBarBitmaps[8] = wxBITMAP(buildlibrary);    toolBarBitmaps[9] = wxBITMAP(help);    toolBarBitmaps[10] = wxBITMAP(newregion);    toolBarBitmaps[11] = wxBITMAP(newsection);    toolBarBitmaps[12] = wxBITMAP(delete);    toolBarBitmaps[13] = wxBITMAP(properties);    toolBarBitmaps[14] = wxBITMAP(cshelp);        toolBar->AddTool(wxID_NEW, toolBarBitmaps[0], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("New file"));    toolBar->AddTool(wxID_OPEN, toolBarBitmaps[1], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("Open file"));    toolBar->AddTool(wxID_SAVE, toolBarBitmaps[2], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, wxT("Save file"));        toolBar->AddSeparator();        toolBar->AddTool(wxID_CUT, toolBarBitmaps[4], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "Cut");    toolBar->AddTool(wxID_COPY, toolBarBitmaps[3], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "Copy");    toolBar->AddTool(wxID_PASTE, toolBarBitmaps[5], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "Paste");    toolBar->AddTool(wxID_FIND, toolBarBitmaps[6], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "Search");        toolBar->AddSeparator();        toolBar->AddTool(ecID_STOP_BUILD, toolBarBitmaps[7], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "Stop build");    toolBar->AddTool(ecID_BUILD_LIBRARY, toolBarBitmaps[8], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "Build library");#if ecUSE_MLT    toolBar->AddSeparator();    toolBar->AddTool(ecID_NEW_REGION, toolBarBitmaps[10], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "New region");    toolBar->AddTool(ecID_NEW_SECTION, toolBarBitmaps[11], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "New section");    toolBar->AddTool(ecID_DELETE, toolBarBitmaps[12], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "Delete");    toolBar->AddTool(ecID_PROPERTIES, toolBarBitmaps[13], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "Properties");#endif    toolBar->AddSeparator();    toolBar->AddTool(ecID_CONTEXT_HELP, toolBarBitmaps[14], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "Show help for clicked-on windows");    toolBar->AddTool(ecID_ECOS_HELP, toolBarBitmaps[9], wxNullBitmap, FALSE, -1, -1, (wxObject *) NULL, "Show help");        // after adding the buttons to the toolbar, must call Realize() to reflect    // the changes    toolBar->Realize();    toolBar->SetHelpText(_("The toolbar allows quick access to commonly-used commands."));}// Toggle one of the windowsvoid ecMainFrame::OnToggleWindow(wxCommandEvent& event){    ToggleWindow(event.GetId());}// Toggle the given window on or offvoid ecMainFrame::ToggleWindow(int windowId){    wxWindow* win = NULL;    bool *configSetting = NULL;    switch (windowId)    {    case ecID_TOGGLE_CONFLICTS:        win = m_conflictsSashWindow;        configSetting = & wxGetApp().GetSettings().m_showConflictsWindow;        break;    case ecID_TOGGLE_PROPERTIES:        win = m_propertiesSashWindow;        configSetting = & wxGetApp().GetSettings().m_showPropertiesWindow;        break;    case ecID_TOGGLE_MEMORY:        win = m_memorySashWindow;        configSetting = & wxGetApp().GetSettings().m_showMemoryWindow;        break;    case ecID_TOGGLE_SHORT_DESCR:        win = m_shortDescrSashWindow;        configSetting = & wxGetApp().GetSettings().m_showShortDescrWindow;        break;    case ecID_TOGGLE_OUTPUT:        win = m_outputSashWindow;        configSetting = & wxGetApp().GetSettings().m_showOutputWindow;        break;    }    if (win)    {        bool showing = !win->IsShown();        win->Show(showing);        * configSetting = showing;        // Make sure we don't have ridiculous sizes        if (showing && (windowId == ecID_TOGGLE_CONFLICTS || windowId == ecID_TOGGLE_PROPERTIES || windowId == ecID_TOGGLE_SHORT_DESCR))        {            m_conflictsSashWindow->SetDefaultSize(wxSize(2000, 50));            m_propertiesSashWindow->SetDefaultSize(wxSize(2000, 50));            m_shortDescrSashWindow->SetDefaultSize(wxSize(2000, 50));

⌨️ 快捷键说明

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