void CFrame::AddPane(int dir) { int PaneNum = GetNotebookCount() + 1; wxString PaneName = wxString::Format("Pane %i", PaneNum); wxAuiPaneInfo PaneInfo = wxAuiPaneInfo() .CaptionVisible(m_bEdit).Dockable(!m_bNoDocking) .Name(PaneName).Caption(PaneName) .Position(GetNotebookCount()); switch (dir) { case ADD_PANE_TOP: PaneInfo = PaneInfo.Top(); break; case ADD_PANE_BOTTOM: PaneInfo = PaneInfo.Bottom(); break; case ADD_PANE_LEFT: PaneInfo = PaneInfo.Left(); break; case ADD_PANE_RIGHT: PaneInfo = PaneInfo.Right(); break; case ADD_PANE_CENTER: PaneInfo = PaneInfo.Center(); break; default: break; } m_Mgr->AddPane(CreateEmptyNotebook(), PaneInfo); AddRemoveBlankPage(); m_Mgr->Update(); }
void CFrame::AddPane() { int PaneNum = GetNotebookCount() + 1; wxString PaneName = wxString::Format("Pane %i", PaneNum); m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo() .CaptionVisible(m_bEdit).Dockable(!m_bNoDocking) .Name(PaneName).Caption(PaneName) .Position(GetNotebookCount())); AddRemoveBlankPage(); m_Mgr->Update(); }
void CFrame::DoAddPage(wxWindow *Win, int i, bool Float) { if (!Win) return; if (i < 0 || i > GetNotebookCount()-1) i = 0; if (Win && GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return; if (!Float) GetNotebookFromId(i)->AddPage(Win, Win->GetName(), true); else CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, Win->GetName(), Win); }
void CFrame::DoRemovePage(wxWindow *Win, bool bHide) { if (!Win) return; wxWindow *Parent = FindWindowById(Win->GetId() + IDM_LOG_WINDOW_PARENT - IDM_LOG_WINDOW); if (Parent) { if (bHide) { Win->Hide(); Win->Reparent(this); } else { Win->Destroy(); } Parent->Destroy(); } else { for (int i = 0; i < GetNotebookCount(); i++) { int PageIndex = GetNotebookFromId(i)->GetPageIndex(Win); if (PageIndex != wxNOT_FOUND) { GetNotebookFromId(i)->RemovePage(PageIndex); if (bHide) { Win->Hide(); Win->Reparent(this); } else { Win->Destroy(); } } } } if (g_pCodeWindow) AddRemoveBlankPage(); }
void CFrame::DoAddPage(wxWindow *Win, int i, bool Float) { if (!Win) return; // Ensure accessor remains within valid bounds. if (i < 0 || i > GetNotebookCount() - 1) i = 0; // The page was already previously added, no need to add it again. if (Win && GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return; if (!Float) GetNotebookFromId(i)->AddPage(Win, Win->GetName(), true); else CreateParentFrame(Win->GetId() + IDM_LOG_WINDOW_PARENT - IDM_LOG_WINDOW, Win->GetName(), Win); }
void CFrame::OnPaneClose(wxAuiManagerEvent& event) { event.Veto(); wxAuiNotebook * nb = (wxAuiNotebook*)event.pane->window; if (!nb) return; if (!g_pCodeWindow) { if (nb->GetPage(0)->GetId() == IDM_LOGWINDOW || nb->GetPage(0)->GetId() == IDM_LOGCONFIGWINDOW || nb->GetPage(0)->GetId() == IDM_CONSOLEWINDOW) { // Closing a pane containing the logwindow or a console closes both SConfig::GetInstance().m_InterfaceConsole = false; SConfig::GetInstance().m_InterfaceLogWindow = false; SConfig::GetInstance().m_InterfaceLogConfigWindow = false; ToggleConsole(false); ToggleLogWindow(false); ToggleLogConfigWindow(false); } } else { if (GetNotebookCount() == 1) { wxMessageBox(_("At least one pane must remain open."), _("Notice"), wxOK, this); } else if (nb->GetPageCount() != 0 && !nb->GetPageText(0).IsSameAs(wxT("<>"))) { wxMessageBox(_("You can't close panes that have pages in them."), _("Notice"), wxOK, this); } else { // Detach and delete the empty notebook event.pane->DestroyOnClose(true); m_Mgr->ClosePane(*event.pane); } } m_Mgr->Update(); }
void CFrame::DoFloatNotebookPage(wxWindowID Id) { wxPanel *Win = (wxPanel*)FindWindowById(Id); if (!Win) return; for (int i = 0; i < GetNotebookCount(); i++) { wxAuiNotebook *nb = GetNotebookFromId(i); if (nb->GetPageIndex(Win) != wxNOT_FOUND) { nb->RemovePage(nb->GetPageIndex(Win)); // Create the parent frame and reparent the window CreateParentFrame(Win->GetId() + IDM_LOG_WINDOW_PARENT - IDM_LOG_WINDOW, Win->GetName(), Win); if (nb->GetPageCount() == 0) AddRemoveBlankPage(); } } }