GUI: Fixed some GUI related start/stop crashes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4223 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-09-07 12:40:43 +00:00
parent 49601e0af2
commit 7e115dcb00
27 changed files with 424 additions and 190 deletions

View File

@ -123,8 +123,8 @@ EVT_MENU(IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu)
// Menu tooltips
//EVT_MENU_HIGHLIGHT_ALL( CCodeWindow::OnStatusBar)
/* Do this to to avoid that the ToolTips get stuck when only the wxMenu is changed
and not any wxMenuItem that is required by EVT_MENU_HIGHLIGHT_ALL */
// Do this to to avoid that the ToolTips get stuck when only the wxMenu is changed
// and not any wxMenuItem that is required by EVT_MENU_HIGHLIGHT_ALL
//EVT_UPDATE_UI(wxID_ANY, CCodeWindow::OnStatusBar_)
// Toolbar
@ -136,25 +136,25 @@ EVT_MENU(IDM_SETPC, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep)
EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange)
// Other
EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange)
EVT_LISTBOX(ID_CALLSTACKLIST, CCodeWindow::OnCallstackListChange)
EVT_LISTBOX(ID_CALLERSLIST, CCodeWindow::OnCallersListChange)
EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange)
EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
//EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
EVT_COMMAND(ID_CODEVIEW, wxEVT_CODEVIEW_CHANGE, CCodeWindow::OnCodeViewChange)
//EVT_COMMAND(ID_CODEVIEW, wxEVT_CODEVIEW_CHANGE, CCodeWindow::OnCodeViewChange)
END_EVENT_TABLE()
// Class
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *ParentObject, wxWindow* parent,
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *parent,
wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& name)
: wxPanel(parent, id, position, size, style, name)
, Parent(ParentObject)
: wxPanel((wxWindow*)parent, id, position, size, style, name)
, Parent(parent)
, codeview(NULL)
, m_RegisterWindow(NULL)
, m_BreakpointWindow(NULL)
, m_MemoryWindow(NULL)
@ -163,10 +163,6 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
InitBitmaps();
CreateGUIControls(_LocalCoreStartupParameter);
// Create the toolbar
//RecreateToolbar();
// Update bitmap buttons
//UpdateButtonStates();
// Connect keyboard
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN,
@ -201,6 +197,8 @@ void CCodeWindow::OnKeyDown(wxKeyEvent& event)
void CCodeWindow::OnHostMessage(wxCommandEvent& event)
{
return;
switch (event.GetId())
{
case IDM_NOTIFYMAPLOADED:
@ -295,7 +293,6 @@ void CCodeWindow::JumpToAddress(u32 _Address)
void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
{
//PanicAlert("boo");
UpdateLists();
}
@ -391,6 +388,10 @@ void CCodeWindow::UpdateLists()
void CCodeWindow::UpdateCallstack()
{
return;
//if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return;
//if (Core::GetState() == Core::CORE_STOPPING) return;
callstack->Clear();
std::vector<Dolphin_Debugger::CallstackEntry> stack;
@ -410,9 +411,7 @@ void CCodeWindow::UpdateCallstack()
}
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
{
//CreateMenu(_LocalCoreStartupParameter);
{
// Configure the code window
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
@ -679,13 +678,17 @@ void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar)
void CCodeWindow::Update()
{
return;
if (!codeview) return;
codeview->Refresh();
UpdateCallstack();
UpdateButtonStates();
/* DO NOT Automatically show the current PC position when a breakpoint is hit or
when we pause SINCE THIS CAN BE CALLED AT OTHER TIMES TOO */
// codeview->Center(PC);
//codeview->Center(PC);
}
void CCodeWindow::UpdateButtonStates()

View File

@ -44,8 +44,8 @@ class CCodeWindow
{
public:
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *,
wxWindow* parent,
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter,
CFrame * parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,

View File

@ -386,6 +386,8 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
void CCodeWindow::NotifyMapLoaded()
{
if (!codeview) return;
g_symbolDB.FillInCallers();
//symbols->Show(false); // hide it for faster filling
symbols->Freeze(); // HyperIris: wx style fast filling
@ -455,6 +457,7 @@ void CCodeWindow::OpenPages()
}
void CCodeWindow::OnToggleWindow(wxCommandEvent& event)
{
event.Skip();
Parent->DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId()));
}
void CCodeWindow::OnToggleCodeWindow(bool _Show, int i)
@ -552,108 +555,137 @@ Notice: This windows docking for plugin windows will produce several wx debuggin
//Toggle Sound Debugging Window
void CCodeWindow::OnToggleSoundWindow(bool _Show, int i)
{
// ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
#ifdef _WIN32
// ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
if (_Show)
{
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->GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
{
#endif
//Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug\n").c_str());
CPluginManager::GetInstance().OpenDebug(
Parent->GetHandle(),
//GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, true // DSP, show
);
#ifdef _WIN32
}
CPluginManager::GetInstance().OpenDebug(
Parent->GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, true // DSP, show
);
Win = Parent->GetWxWindow(wxT("Sound"));
if (Win)
{
Win->SetName(wxT("Sound"));
Win->Reparent(Parent);
Parent->GetNotebookFromId(i)->AddPage(Win, wxT("Sound"), true, Parent->aNormalFile );
//Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str());
//Parent->ListChildren();
//Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug: Win %i\n", FindWindowByName(wxT("Sound"))).c_str());
Win->SetId(IDM_SOUNDWINDOW);
Parent->GetNotebookFromId(i)->AddPage(Win, wxT("Sound"), true, Parent->aNormalFile);
}
else
{
//Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug: Win not found\n").c_str());
}
#endif
}
else // hide
{
#ifdef _WIN32
else
{
wxWindow *Win = Parent->GetWxWindow(wxT("Sound"));
if (Win)
{
{
Parent->DoRemovePage(Win, false);
//Console->Log(LogTypes::LNOTICE, StringFromFormat("Sound removed from NB (Win %i)\n", FindWindowByName(wxT("Sound"))).c_str());
//Win->Reparent(NULL);
// Destroy
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, false
);
//WARN_LOG(CONSOLE, "Sound removed from NB");
}
else
{
//Console->Log(LogTypes::LNOTICE, StringFromFormat("Sound not found (Win %i)\n", FindWindowByName(wxT("Sound"))).c_str());
//WARN_LOG(CONSOLE, "Sound not found (Win %i)", FindWindowByName(wxT("Sound")));
}
#endif
// Close the sound dll that has an open debugger
}
#else
if (_Show)
{
CPluginManager::GetInstance().OpenDebug(
Parent->GetHandle(),
//GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, true // DSP, show
);
}
else
{
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, false // DSP, hide
);
}
#endif
}
// Toggle Video Debugging Window
void CCodeWindow::OnToggleVideoWindow(bool _Show, int i)
{
#ifdef _WIN32
//GetMenuBar()->Check(event.GetId(), false); // Turn off
if (_Show)
{
if (Parent->GetNotebookCount() == 0) return;
if (i < 0 || i > Parent->GetNotebookCount()-1) i = 0;
#ifdef _WIN32
wxWindow *Win = Parent->GetWxWindow(wxT("Video"));
Win->SetId(IDM_VIDEOWINDOW);
if (Win && Parent->GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
{
#endif
// Show and/or create the window
CPluginManager::GetInstance().OpenDebug(
Parent->GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, true // Video, show
);
#ifdef _WIN32
}
// Show and/or create the window
CPluginManager::GetInstance().OpenDebug(
Parent->GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, true // Video, show
);
Win = Parent->GetWxWindow(wxT("Video"));
if (Win) Parent->GetNotebookFromId(i)->AddPage(Win, wxT("Video"), true, Parent->aNormalFile );
#endif
}
else // hide
{
#ifdef _WIN32
wxWindow *Win = Parent->GetWxWindow(wxT("Video"));
Parent->DoRemovePage (Win, false);
#endif
// Close the video dll that has an open debugger
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, false // Video, hide
);
if (Win)
{
Parent->DoRemovePage (Win, false);
Win->Reparent(NULL);
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, false // Video, hide
);
}
}
#else
if (_Show)
{
CPluginManager::GetInstance().OpenDebug(
Parent->GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, true // Video, show
);
}
else
{
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, false // Video, hide
);
}
#endif
}