void CMakePlugin::UnPlug() { wxASSERT(m_mgr); Notebook* notebook = m_mgr->GetWorkspacePaneNotebook(); wxASSERT(notebook); size_t pos = notebook->GetPageIndex("CMake Help"); if (pos != Notebook::npos) { CMakeHelpTab* helpTab = dynamic_cast<CMakeHelpTab*>( notebook->GetPage(pos) ); if ( helpTab ) { helpTab->Stop(); } notebook->RemovePage(pos); } // Unbind events wxTheApp->Unbind(wxEVT_COMMAND_MENU_SELECTED, &CMakePlugin::OnSettings, this, XRCID("cmake_settings")); EventNotifier::Get()->Unbind(wxEVT_CMD_PROJ_SETTINGS_SAVED, wxCommandEventHandler(CMakePlugin::OnSaveConfig), this); EventNotifier::Get()->Unbind(wxEVT_GET_PROJECT_BUILD_CMD, clBuildEventHandler(CMakePlugin::OnGetBuildCommand), this); EventNotifier::Get()->Unbind(wxEVT_GET_PROJECT_CLEAN_CMD, clBuildEventHandler(CMakePlugin::OnGetCleanCommand), this); EventNotifier::Get()->Unbind(wxEVT_GET_IS_PLUGIN_MAKEFILE, clBuildEventHandler(CMakePlugin::OnGetIsPluginMakefile), this); EventNotifier::Get()->Unbind(wxEVT_PLUGIN_EXPORT_MAKEFILE, clBuildEventHandler(CMakePlugin::OnExportMakefile), this); EventNotifier::Get()->Unbind(wxEVT_WORKSPACE_LOADED, wxCommandEventHandler(CMakePlugin::OnWorkspaceLoaded), this); }
void CMakePlugin::UnPlug() { wxASSERT(m_mgr); Notebook* notebook = m_mgr->GetWorkspacePaneNotebook(); wxASSERT(notebook); int pos = notebook->GetPageIndex("CMake Help"); if(pos != wxNOT_FOUND) { CMakeHelpTab* helpTab = dynamic_cast<CMakeHelpTab*>(notebook->GetPage(pos)); if(helpTab) { helpTab->Stop(); } notebook->RemovePage(pos); } // Unbind events wxTheApp->Unbind(wxEVT_COMMAND_MENU_SELECTED, &CMakePlugin::OnSettings, this, XRCID("cmake_settings")); EventNotifier::Get()->Unbind(wxEVT_SHOW_WORKSPACE_TAB, &CMakePlugin::OnToggleHelpTab, this); EventNotifier::Get()->Unbind(wxEVT_CONTEXT_MENU_PROJECT, &CMakePlugin::OnProjectContextMenu, this); EventNotifier::Get()->Unbind(wxEVT_CONTEXT_MENU_WORKSPACE, &CMakePlugin::OnWorkspaceContextMenu, this); EventNotifier::Get()->Unbind(wxEVT_PROJ_FILE_ADDED, &CMakePlugin::OnFileAdded, this); EventNotifier::Get()->Unbind(wxEVT_PROJ_FILE_REMOVED, &CMakePlugin::OnFileRemoved, this); Unbind(wxEVT_ASYNC_PROCESS_OUTPUT, &CMakePlugin::OnCMakeOutput, this); Unbind(wxEVT_ASYNC_PROCESS_TERMINATED, &CMakePlugin::OnCMakeTerminated, this); }
wxWindow* clMultiBook::GetPage(size_t index) const { Notebook* book; size_t modIndex; size_t bookIndex; if(!GetBookByPageIndex(index, &book, bookIndex, modIndex)) { return nullptr; } return book->GetPage(modIndex); }
int clMultiBook::SetSelection(size_t tabIdx) { Notebook* book; size_t bookIndex; size_t modIndex; if(GetBookByPageIndex(tabIdx, &book, bookIndex, modIndex)) { // Update the current selection bool pageChanged = (m_selection != (int)tabIdx); // Grab a pointer of the page we want to make active wxWindow* focusedPage = book->GetPage(modIndex); // And perform the actual selection change int oldSelection = book->GetSelection(); if(oldSelection != (int)modIndex) { m_selection = tabIdx; m_history->Pop(focusedPage); m_history->Push(focusedPage); return book->SetSelection(modIndex); } else { // There is no point on calling Notebook::SetSelection since it is already selected // However, in the term of 'multi book' control, we might need to generate the events ourselves here // But only if we actually modified the selection if(pageChanged) { wxBookCtrlEvent changingEvent(wxEVT_BOOK_PAGE_CHANGING); changingEvent.SetEventObject(this); changingEvent.SetOldSelection(m_selection); changingEvent.SetSelection(tabIdx); GetEventHandler()->ProcessEvent(changingEvent); if(!changingEvent.IsAllowed()) { return wxNOT_FOUND; } // User vetoed // Update the history m_history->Pop(focusedPage); m_history->Push(focusedPage); // Update the selection before we fire the event again // Or we might end up with stackoverflow... m_selection = tabIdx; wxBookCtrlEvent changedEvent(wxEVT_BOOK_PAGE_CHANGED); changedEvent.SetEventObject(this); changedEvent.SetOldSelection(m_selection); changedEvent.SetSelection(tabIdx); GetEventHandler()->ProcessEvent(changedEvent); } } } return wxNOT_FOUND; }
bool clMultiBook::DeletePage(size_t page, bool notify) { Notebook* book; size_t modIndex; size_t bookIndex; if(!GetBookByPageIndex(page, &book, bookIndex, modIndex)) { return false; } // Update the history wxWindow* pageToDelete = book->GetPage(modIndex); m_history->Pop(pageToDelete); // Delete the page bool res = book->DeletePage(modIndex, notify); UpdateView(); return res; }
void SvnConsole::EnsureVisible() { // Ensure that the Output View is displayed wxAuiPaneInfo& pi = m_plugin->GetManager()->GetDockingManager()->GetPane("Output View"); if ( pi.IsOk() && !pi.IsShown() ) { pi.Show( true ); m_plugin->GetManager()->GetDockingManager()->Update(); } Notebook* book = m_plugin->GetManager()->GetOutputPaneNotebook(); for(size_t i=0; i<book->GetPageCount(); i++) { if(this == book->GetPage(i)) { book->SetSelection(i); break; } } }
bool clMultiBook::RemovePage(size_t page, bool notify) { Notebook* book; size_t bookIndex; size_t modIndex; if(GetBookByPageIndex(page, &book, bookIndex, modIndex)) { // Make sure that after we remove the page from its notebook // it has a valid parent (UpdateView() below might destory its parent // Notebook control) wxWindow* removedPage = book->GetPage(modIndex); // Update the history m_history->Pop(removedPage); removedPage->Reparent(this); bool res = book->RemovePage(modIndex, notify); UpdateView(); return res; } return false; }
int SymbolViewPlugin::DoFindTabIndex() { std::vector<wxWindow*> windows; Notebook *book = m_mgr->GetWorkspacePaneNotebook(); #if !CL_USE_NATIVEBOOK book->GetEditorsInOrder(windows); #else for(size_t i=0; i<book->GetPageCount(); i++) { windows.push_back( book->GetPage(i) ); } #endif for(size_t i=0; i<windows.size(); i++) { if(windows.at(i) == m_view ) return i; } return wxNOT_FOUND; }