Fix a segmentation fault when changing perspectives.

Some general code clean up.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5948 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice
2010-07-23 03:53:18 +00:00
parent ba67333053
commit 2e6c5b36ab
5 changed files with 188 additions and 247 deletions

View File

@ -320,8 +320,6 @@ EVT_AUINOTEBOOK_TAB_RIGHT_UP(wxID_ANY, CFrame::OnTab)
// Post events to child panels
EVT_MENU(wxID_ANY, CFrame::PostEvent)
EVT_TEXT(wxID_ANY, CFrame::PostEvent)
//EVT_MENU_HIGHLIGHT_ALL(CFrame::PostMenuEvent)
//EVT_UPDATE_UI(wxID_ANY, CFrame::PostUpdateUIEvent)
END_EVENT_TABLE()
@ -361,6 +359,7 @@ CFrame::CFrame(wxFrame* parent,
if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();
m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW);
m_LogWindow->Hide();
m_LogWindow->Disable();
// Start debugging mazimized
if (UseDebugger) this->Maximize(true);
@ -600,14 +599,6 @@ void CFrame::PostEvent(wxCommandEvent& event)
else
event.Skip();
}
void CFrame::PostMenuEvent(wxMenuEvent& event)
{
if (g_pCodeWindow) g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
}
void CFrame::PostUpdateUIEvent(wxUpdateUIEvent& event)
{
if (g_pCodeWindow) g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
}
void CFrame::OnMove(wxMoveEvent& event)
{

View File

@ -126,8 +126,6 @@ class CFrame : public CRenderFrame
void ToggleLogWindow(bool, int i = -1);
void ToggleConsole(bool, int i = -1);
void PostEvent(wxCommandEvent& event);
void PostMenuEvent(wxMenuEvent& event);
void PostUpdateUIEvent(wxUpdateUIEvent& event);
void StatusBarMessage(const char * Text, ...);
void ClearStatusBar();
void OnSizeRequest(int& x, int& y, int& width, int& height);

View File

@ -99,10 +99,14 @@ void CFrame::ToggleLogWindow(bool bShow, int i)
if (bShow)
{
if (!m_LogWindow) m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW);
m_LogWindow->Enable();
DoAddPage(m_LogWindow, i, bFloatWindow[0]);
}
else
{
m_LogWindow->Disable();
DoRemovePage(m_LogWindow, bShow);
}
// Hide or Show the pane
if (!g_pCodeWindow)
@ -142,6 +146,7 @@ void CFrame::ToggleConsole(bool bShow, int i)
ConsoleWin->AdoptAttributesFromHWND();
ConsoleWin->Reparent(ConsoleParent);
ConsoleParent->Enable();
DoAddPage(ConsoleParent, i, bFloatWindow[1]);
}
else // Hide
@ -149,6 +154,10 @@ void CFrame::ToggleConsole(bool bShow, int i)
if(GetConsoleWindow())
ShowWindow(GetConsoleWindow(), SW_HIDE); // WIN32
wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW);
if (ConsoleParent)
ConsoleParent->Disable();
// Then close the page
DoRemovePageId(IDM_CONSOLEWINDOW, true, true);
}
@ -268,7 +277,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
for (int i = IDM_LOGWINDOW; i <= IDM_VIDEOWINDOW; i++)
{
wxWindow *Win = FindWindowById(i);
if (Win)
if (Win && Win->IsEnabled())
{
Item = new wxMenuItem(MenuPopup, i + IDM_FLOAT_LOGWINDOW - IDM_LOGWINDOW,
Win->GetName(), wxT(""), wxITEM_CHECK);
@ -330,7 +339,10 @@ void CFrame::DoRemovePage(wxWindow * Win, bool _Hide)
{
GetNotebookFromId(i)->RemovePage(GetNotebookFromId(i)->GetPageIndex(Win));
if (_Hide)
Win->Hide();
{
Win->Hide();
Win->Reparent(this);
}
else
Win->Close();
}