GUI: Simplified away the notebook vector, bugfixes
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4112 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
6b97c0b764
commit
63786d5438
|
@ -618,6 +618,11 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
|
|||
|
||||
wxMenuItem* pRegister = pDebugDialogs->Append(IDM_REGISTERWINDOW, _T("&Registers"), wxEmptyString, wxITEM_CHECK);
|
||||
pRegister->Check(bRegisterWindow);
|
||||
|
||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
|
||||
"bRegisterWindow: %i\n", bRegisterWindow).c_str());
|
||||
|
||||
wxMenuItem* pBreakPoints = pDebugDialogs->Append(IDM_BREAKPOINTWINDOW, _T("&BreakPoints"), wxEmptyString, wxITEM_CHECK);
|
||||
pBreakPoints->Check(bBreakpointWindow);
|
||||
wxMenuItem* pMemory = pDebugDialogs->Append(IDM_MEMORYWINDOW, _T("&Memory"), wxEmptyString, wxITEM_CHECK);
|
||||
|
|
|
@ -406,11 +406,11 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, int i)
|
|||
|
||||
if (Show)
|
||||
{
|
||||
if (Parent->m_NB.size() == 0) return;
|
||||
if (i < 0 || i > Parent->m_NB.size()-1) i = 0;
|
||||
if (Parent->GetNotebookCount() == 0) return;
|
||||
if (i < 0 || i > Parent->GetNotebookCount()-1) i = 0;
|
||||
#ifdef _WIN32
|
||||
wxWindow *Win = Parent->GetWxWindow(wxT("Sound"));
|
||||
if (Win && Parent->m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) return;
|
||||
if (Win && Parent->GetNotebook(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
|
||||
|
||||
{
|
||||
#endif
|
||||
|
@ -428,7 +428,7 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, int i)
|
|||
if (Win)
|
||||
{
|
||||
//Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str());
|
||||
Parent->m_NB[i]->AddPage(Win, wxT("Sound"), true, Parent->aNormalFile );
|
||||
Parent->GetNotebook(i)->AddPage(Win, wxT("Sound"), true, Parent->aNormalFile );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, int i)
|
|||
{
|
||||
#ifdef _WIN32
|
||||
wxWindow *Win = Parent->GetWxWindow(wxT("Sound"));
|
||||
Parent->DoRemovePage (Win, false);
|
||||
Parent->DoRemovePage(Win, false);
|
||||
#endif
|
||||
// Close the sound dll that has an open debugger
|
||||
CPluginManager::GetInstance().OpenDebug(
|
||||
|
@ -454,10 +454,11 @@ void CCodeWindow::OnToggleVideoWindow(bool Show, int i)
|
|||
|
||||
if (Show)
|
||||
{
|
||||
if (i < 0 || i > Parent->m_NB.size()-1) return;
|
||||
if (Parent->GetNotebookCount() == 0) return;
|
||||
if (i < 0 || i > Parent->GetNotebookCount()-1) i = 0;
|
||||
#ifdef _WIN32
|
||||
wxWindow *Win = Parent->GetWxWindow(wxT("Video"));
|
||||
if (Win && Parent->m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) return;
|
||||
if (Win && Parent->GetNotebook(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
|
||||
|
||||
{
|
||||
#endif
|
||||
|
@ -471,7 +472,7 @@ void CCodeWindow::OnToggleVideoWindow(bool Show, int i)
|
|||
}
|
||||
|
||||
Win = Parent->GetWxWindow(wxT("Video"));
|
||||
if (Win) Parent->m_NB[i]->AddPage(Win, wxT("Video"), true, Parent->aNormalFile );
|
||||
if (Win) Parent->GetNotebook(i)->AddPage(Win, wxT("Video"), true, Parent->aNormalFile );
|
||||
#endif
|
||||
}
|
||||
else // hide
|
||||
|
|
|
@ -347,6 +347,7 @@ CFrame::CFrame(bool showLogWindow,
|
|||
{
|
||||
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this);
|
||||
g_pCodeWindow->Hide();
|
||||
g_pCodeWindow->Load();
|
||||
}
|
||||
|
||||
// Create timer
|
||||
|
@ -393,15 +394,6 @@ CFrame::CFrame(bool showLogWindow,
|
|||
DefaultNBStyle = wxAUI_NB_TOP | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
|
||||
wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
|
||||
|
||||
if (UseDebugger)
|
||||
{
|
||||
//m_NB[g_pCodeWindow->iCodeWindow]->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NB.push_back(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
|
||||
}
|
||||
|
||||
if (UseDebugger)
|
||||
{
|
||||
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Show());
|
||||
|
@ -409,14 +401,15 @@ CFrame::CFrame(bool showLogWindow,
|
|||
else
|
||||
{
|
||||
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Hide());
|
||||
m_Mgr->AddPane(m_NB[0], wxAuiPaneInfo().Name(wxT("Pane1")).Caption(wxT("Pane1")).Hide());
|
||||
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Name(wxT("Pane 1")).Caption(wxT("Pane 1")).Hide());
|
||||
}
|
||||
|
||||
// Setup perspectives
|
||||
if (UseDebugger)
|
||||
{
|
||||
m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(true);
|
||||
m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(false);
|
||||
AuiFullscreen = m_Mgr->SavePerspective();
|
||||
m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -479,8 +472,7 @@ CFrame::CFrame(bool showLogWindow,
|
|||
// Create new panes with notebooks
|
||||
for (int j = 0; j < Perspectives.at(0).Width.size() - 1; j++)
|
||||
{
|
||||
m_NB.push_back(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
|
||||
m_Mgr->AddPane(m_NB.at(m_NB.size()-1));
|
||||
m_Mgr->AddPane(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
|
||||
|
||||
}
|
||||
NamePanes();
|
||||
|
@ -499,15 +491,15 @@ CFrame::CFrame(bool showLogWindow,
|
|||
// Create one pane by default
|
||||
else
|
||||
{
|
||||
m_NB.push_back(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
|
||||
m_Mgr->AddPane(m_NB.at(m_NB.size()-1));
|
||||
m_Mgr->AddPane(new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle));
|
||||
}
|
||||
|
||||
//Console->Log(LogTypes::LCUSTOM, StringFromFormat("Panes: %i\n", m_Mgr->GetAllPanes().GetCount()).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mgr->GetPane(wxT("Pane1")).Hide().PaneBorder(false).CaptionVisible(false).Layer(0).Right();
|
||||
m_Mgr->GetPane(wxT("Pane 1")).Hide().PaneBorder(false).CaptionVisible(false).Layer(0).Right();
|
||||
//if (m_bLogWindow || SConfig::GetInstance().m_InterfaceConsole) m_Mgr->GetPane(wxT("Pane 1")).Show();
|
||||
}
|
||||
|
||||
// Show window
|
||||
|
@ -608,6 +600,12 @@ wxPanel* CFrame::CreateEmptyPanel()
|
|||
wxPanel* Panel = new wxPanel(this, wxID_ANY);
|
||||
return Panel;
|
||||
}
|
||||
wxAuiNotebook* CFrame::CreateEmptyNotebook()
|
||||
{
|
||||
wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, DefaultNBStyle);
|
||||
return NB;
|
||||
}
|
||||
|
||||
|
||||
void CFrame::DoFullscreen(bool _F)
|
||||
{
|
||||
|
@ -642,13 +640,13 @@ void CFrame::SetPaneSize(wxArrayInt Pane, wxArrayInt Size)
|
|||
// Produce pixel width from percentage width
|
||||
Size[i] = iClientSize * (float)(Size[i]/100.0);
|
||||
// Update size
|
||||
m_Mgr->GetPane(wxString::Format(wxT("Pane%i"), Pane[i])).BestSize(Size[i], -1).MinSize(Size[i], -1).MaxSize(Size[i], -1);
|
||||
m_Mgr->GetPane(wxString::Format(wxT("Pane %i"), Pane[i])).BestSize(Size[i], -1).MinSize(Size[i], -1).MaxSize(Size[i], -1);
|
||||
}
|
||||
m_Mgr->Update();
|
||||
for (int i = 0; i < Pane.size(); i++)
|
||||
{
|
||||
// Remove the size limits
|
||||
m_Mgr->GetPane(wxString::Format(wxT("Pane%i"), Pane[i])).MinSize(-1, -1).MaxSize(-1, -1);
|
||||
m_Mgr->GetPane(wxString::Format(wxT("Pane %i"), Pane[i])).MinSize(-1, -1).MaxSize(-1, -1);
|
||||
}
|
||||
}
|
||||
void CFrame::DoLoadPerspective(wxString Perspective)
|
||||
|
@ -667,8 +665,8 @@ void CFrame::DoLoadPerspective(wxString Perspective)
|
|||
_iRightWidth = 100 - iLeftWidth[0];
|
||||
i.Add(0); j.Add(iLeftWidth[0]);
|
||||
i.Add(2); j.Add(_iRightWidth);
|
||||
//m_Mgr->GetPane(wxT("Pane1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
|
||||
//m_Mgr->GetPane(wxT("Pane2")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
|
||||
//m_Mgr->GetPane(wxT("Pane 1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
|
||||
//m_Mgr->GetPane(wxT("Pane 2")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -712,20 +710,32 @@ void CFrame::AddPane()
|
|||
|
||||
void CFrame::OnPaneClose(wxAuiManagerEvent& event)
|
||||
{
|
||||
event.Veto();
|
||||
|
||||
wxAuiNotebook * nb = (wxAuiNotebook*)event.pane->window;
|
||||
if (!nb->GetPageCount() == 0 && !(nb->GetPageCount() == 1 && nb->GetPageText(0).IsSameAs(wxT("<>"))))
|
||||
if (!nb) return;
|
||||
if (! (nb->GetPageCount() == 0 || (nb->GetPageCount() == 1 && nb->GetPageText(0).IsSameAs(wxT("<>")))))
|
||||
{
|
||||
wxMessageBox(wxT("You can't close panes that have pages in them."),
|
||||
wxT("Notice"),
|
||||
wxOK,
|
||||
this);
|
||||
event.Veto();
|
||||
return;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
Console->Log(LogTypes::LCUSTOM, StringFromFormat("GetNotebookCount before: %i\n", GetNotebookCount()).c_str());
|
||||
|
||||
// Detach and delete the empty notebook
|
||||
m_Mgr->DetachPane(event.pane->window);
|
||||
//event.pane->window->Close();
|
||||
event.pane->window->Destroy();
|
||||
|
||||
Console->Log(LogTypes::LCUSTOM, StringFromFormat("GetNotebookCount after: %i\n", GetNotebookCount()).c_str());
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
m_Mgr->DetachPane(event.pane->window);
|
||||
event.pane->window->Hide();
|
||||
m_Mgr->Update();
|
||||
}
|
||||
|
||||
void CFrame::Save()
|
||||
|
|
|
@ -100,7 +100,6 @@ class CFrame : public wxFrame
|
|||
// AUI
|
||||
wxAuiManager *m_Mgr;
|
||||
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
|
||||
std::vector<wxAuiNotebook*> m_NB;
|
||||
int DefaultNBStyle;
|
||||
int iLeftWidth[2], iMidWidth[2];
|
||||
// Perspectives
|
||||
|
@ -109,12 +108,14 @@ class CFrame : public wxFrame
|
|||
wxWindow * GetWxWindowHwnd(HWND);
|
||||
#endif
|
||||
wxWindow * GetNootebookPage(wxString);
|
||||
wxAuiNotebook * GetNotebook(int);
|
||||
void AddRemoveBlankPage();
|
||||
void OnNotebookPageClose(wxAuiNotebookEvent& event);
|
||||
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
|
||||
void OnNotebookPageChanged(wxAuiNotebookEvent& event);
|
||||
int GetNootebookAffiliation(wxString Name);
|
||||
void DoToggleWindow(int,bool);
|
||||
int GetNotebookCount();
|
||||
void DoAddPage(wxWindow *, int, std::string);
|
||||
void DoRemovePage(wxWindow *, bool Hide = true);
|
||||
void DoRemovePageString(wxString, bool Hide = true);
|
||||
|
@ -202,6 +203,7 @@ class CFrame : public wxFrame
|
|||
void RecreateToolbar();
|
||||
void CreateMenu();
|
||||
wxPanel *CreateEmptyPanel();
|
||||
wxAuiNotebook *CreateEmptyNotebook();
|
||||
|
||||
#ifdef _WIN32
|
||||
// Override window proc for tricks like screensaver disabling
|
||||
|
|
|
@ -728,12 +728,6 @@ void CFrame::OnToolBar(wxCommandEvent& event)
|
|||
case IDM_PERSPECTIVES_ADD_PANE:
|
||||
AddPane();
|
||||
break;
|
||||
/*
|
||||
case IDM_PERSPECTIVE_1:
|
||||
m_ToolBarAui->ToggleTool(IDM_PERSPECTIVE_0, false);
|
||||
DoLoadPerspective(1);
|
||||
break;
|
||||
*/
|
||||
case IDM_EDIT_PERSPECTIVES:
|
||||
TogglePaneStyle(m_ToolBarAui->GetToolToggled(IDM_EDIT_PERSPECTIVES));
|
||||
break;
|
||||
|
@ -835,12 +829,12 @@ void CFrame::ToggleNotebookStyle(long Style)
|
|||
}
|
||||
void CFrame::ResizeConsole()
|
||||
{
|
||||
for (int i = 0; i < m_NB.size(); i++)
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_NB[i]) continue;
|
||||
for(u32 j = 0; j <= m_NB[i]->GetPageCount(); j++)
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
for(u32 j = 0; j <= wxDynamicCast(m_Mgr->GetAllPanes().Item(i).window, wxAuiNotebook)->GetPageCount(); j++)
|
||||
{
|
||||
if (m_NB[i]->GetPageText(j).IsSameAs(wxT("Console")))
|
||||
if (wxDynamicCast(m_Mgr->GetAllPanes().Item(i).window, wxAuiNotebook)->GetPageText(j).IsSameAs(wxT("Console")))
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// ----------------------------------------------------------
|
||||
|
@ -870,8 +864,8 @@ void CFrame::ResizeConsole()
|
|||
WidthReduction = 30 - Border;
|
||||
// --------------------------------
|
||||
// Get the client size
|
||||
int X = m_NB[i]->GetClientSize().GetX();
|
||||
int Y = m_NB[i]->GetClientSize().GetY();
|
||||
int X = m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetX();
|
||||
int Y = m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetY();
|
||||
int InternalWidth = X - wxBorder*2 - ScrollBar;
|
||||
int InternalHeight = Y - wxBorder*2;
|
||||
int WindowWidth = InternalWidth + Border*2;
|
||||
|
@ -1062,37 +1056,41 @@ wxWindow * CFrame::GetWxWindow(wxString Name)
|
|||
}
|
||||
wxWindow * CFrame::GetNootebookPage(wxString Name)
|
||||
{
|
||||
for (int i = 0; i < m_NB.size(); i++)
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_NB[i]) continue;
|
||||
for(u32 j = 0; j < m_NB[i]->GetPageCount(); j++)
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
for(u32 j = 0; j < NB->GetPageCount(); j++)
|
||||
{
|
||||
if (m_NB[i]->GetPageText(j).IsSameAs(Name)) return m_NB[i]->GetPage(j);
|
||||
if (NB->GetPageText(j).IsSameAs(Name)) return NB->GetPage(j);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
void CFrame::AddRemoveBlankPage()
|
||||
{
|
||||
for (int i = 0; i < m_NB.size(); i++)
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_NB[i]) continue;
|
||||
for(u32 j = 0; j < m_NB[i]->GetPageCount(); j++)
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
for(u32 j = 0; j < NB->GetPageCount(); j++)
|
||||
{
|
||||
if (m_NB[i]->GetPageText(j).IsSameAs(wxT("<>")) && m_NB[i]->GetPageCount() > 1) m_NB[i]->DeletePage(j);
|
||||
if (NB->GetPageText(j).IsSameAs(wxT("<>")) && NB->GetPageCount() > 1) NB->DeletePage(j);
|
||||
}
|
||||
if (m_NB[i]->GetPageCount() == 0) m_NB[i]->AddPage(CreateEmptyPanel(), wxT("<>"), true);
|
||||
if (NB->GetPageCount() == 0) NB->AddPage(CreateEmptyPanel(), wxT("<>"), true);
|
||||
}
|
||||
}
|
||||
int CFrame::GetNootebookAffiliation(wxString Name)
|
||||
{
|
||||
for (int i = 0; i < m_NB.size(); i++)
|
||||
for (int i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_NB[i]) continue;
|
||||
for(u32 j = 0; j < m_NB[i]->GetPageCount(); j++)
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
for(u32 k = 0; k < NB->GetPageCount(); k++)
|
||||
{
|
||||
if (m_NB[i]->GetPageText(j).IsSameAs(Name)) return i;
|
||||
if (NB->GetPageText(k).IsSameAs(Name)) return j;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -1156,36 +1154,61 @@ void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
|
|||
}
|
||||
void CFrame::HidePane()
|
||||
{
|
||||
if (m_NB[0]->GetPageCount() == 0)
|
||||
m_Mgr->GetPane(wxT("Pane1")).Hide();
|
||||
// Get the first notebook
|
||||
wxAuiNotebook * NB;
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
|
||||
NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
}
|
||||
if (NB->GetPageCount() == 0)
|
||||
m_Mgr->GetPane(wxT("Pane 1")).Hide();
|
||||
else
|
||||
m_Mgr->GetPane(wxT("Pane1")).Show();
|
||||
m_Mgr->GetPane(wxT("Pane 1")).Show();
|
||||
m_Mgr->Update();
|
||||
|
||||
SetSimplePaneSize();
|
||||
}
|
||||
void CFrame::DoRemovePageString(wxString Str, bool Hide)
|
||||
{
|
||||
for (int i = 0; i < m_NB.size(); i++)
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (m_NB[i])
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
for (int j = 0; j < NB->GetPageCount(); j++)
|
||||
{
|
||||
for (int j = 0; j < m_NB[i]->GetPageCount(); j++)
|
||||
{
|
||||
if (m_NB[i]->GetPageText(j).IsSameAs(Str)) { m_NB[i]->RemovePage(j); break; }
|
||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
}
|
||||
if (NB->GetPageText(j).IsSameAs(Str)) { NB->RemovePage(j); break; }
|
||||
}
|
||||
}
|
||||
//if (Hide) Win->Hide();
|
||||
}
|
||||
wxAuiNotebook * CFrame::GetNotebook(int NBId)
|
||||
{
|
||||
int Ret = 0;
|
||||
for (int i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
|
||||
if (j == NBId) return (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
|
||||
j++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
int CFrame::GetNotebookCount()
|
||||
{
|
||||
int Ret = 0;
|
||||
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
|
||||
{
|
||||
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) Ret++;
|
||||
}
|
||||
return Ret;
|
||||
}
|
||||
void CFrame::DoAddPage(wxWindow * Win, int i, std::string Name)
|
||||
{
|
||||
if (!Win) return;
|
||||
if (m_NB.size() == 0) return;
|
||||
if (i < 0 || i > m_NB.size()-1) i = 0;
|
||||
if (Win && m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) return;
|
||||
m_NB[i]->AddPage(Win, wxString::FromAscii(Name.c_str()), true, aNormalFile );
|
||||
if (GetNotebookCount() == 0) return;
|
||||
if (i < 0 || i > GetNotebookCount()-1) i = 0;
|
||||
if (Win && GetNotebook(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
|
||||
GetNotebook(i)->AddPage(Win, wxString::FromAscii(Name.c_str()), true, aNormalFile );
|
||||
|
||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
Console->Log(LogTypes::LCUSTOM, StringFromFormat("Add: %s\n", Name.c_str()).c_str());
|
||||
|
@ -1198,12 +1221,9 @@ void CFrame::DoRemovePage(wxWindow * Win, bool Hide)
|
|||
|
||||
if (Win)
|
||||
{
|
||||
for (int i = 0; i < m_NB.size(); i++)
|
||||
for (int i = 0; i < GetNotebookCount(); i++)
|
||||
{
|
||||
if (m_NB[i])
|
||||
{
|
||||
if (m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) m_NB[i]->RemovePage(m_NB[i]->GetPageIndex(Win));
|
||||
}
|
||||
if (GetNotebook(i)->GetPageIndex(Win) != wxNOT_FOUND) GetNotebook(i)->RemovePage(GetNotebook(i)->GetPageIndex(Win));
|
||||
}
|
||||
if (Hide) Win->Hide();
|
||||
}
|
||||
|
@ -1279,11 +1299,12 @@ void CFrame::ToggleConsole(bool Show, int i)
|
|||
|
||||
if (Show)
|
||||
{
|
||||
if (m_NB.size() == 0) return;
|
||||
if (i < 0 || i > m_NB.size()-1) i = 0;
|
||||
if (GetNotebookCount() == 0) return;
|
||||
if (i < 0 || i > GetNotebookCount()-1) i = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
wxWindow *Win = GetWxWindowHwnd(GetConsoleWindow());
|
||||
if (Win && m_NB[i]->GetPageIndex(Win) != wxNOT_FOUND) return;
|
||||
if (Win && GetNotebook(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
|
||||
{
|
||||
#else
|
||||
Console->Open();
|
||||
|
@ -1300,8 +1321,8 @@ void CFrame::ToggleConsole(bool Show, int i)
|
|||
wxPanel * ConsoleParent = CreateEmptyPanel();
|
||||
::SetParent(GetConsoleWindow(), (HWND)ConsoleParent->GetHWND());
|
||||
//Win->SetParent(ConsoleParent);
|
||||
//if (Win) m_NB[i]->AddPage(Win, wxT("Console"), true, aNormalFile );
|
||||
if (Win) m_NB[i]->AddPage(ConsoleParent, wxT("Console"), true, aNormalFile );
|
||||
//if (Win) m_Mgr->GetAllPanes().Item(i)->AddPage(Win, wxT("Console"), true, aNormalFile );
|
||||
if (Win) GetNotebook(i)->AddPage(ConsoleParent, wxT("Console"), true, aNormalFile );
|
||||
#endif
|
||||
}
|
||||
else // hide
|
||||
|
|
Loading…
Reference in New Issue