GUI: Fixed debugging toolbar

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4070 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-08-27 00:54:44 +00:00
parent 1b6b56692d
commit d46927207a
4 changed files with 42 additions and 30 deletions

View File

@ -163,7 +163,7 @@ END_EVENT_TABLE()
// Class, input event handler and host message handler
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent,
wxWindowID id)
: wxPanel(parent, id)
: wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER, wxT("Dolphin-Debugger"))
/* Remember to initialize potential new controls with NULL there, otherwise m_dialog = true and
things may crash */
@ -749,7 +749,9 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
break;
}
UpdateButtonStates();
UpdateButtonStates();
// Update all toolbars in the aui manager
UpdateManager();
}
@ -883,7 +885,6 @@ void CCodeWindow::UpdateCallstack()
void CCodeWindow::Update()
{
codeview->Refresh();
UpdateCallstack();
UpdateButtonStates();
@ -893,9 +894,6 @@ void CCodeWindow::Update()
}
// Update GUI
void CCodeWindow::UpdateButtonStates()
@ -903,36 +901,38 @@ void CCodeWindow::UpdateButtonStates()
bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED);
bool Running = (Core::GetState() == Core::CORE_RUN);
bool Pause = (Core::GetState() == Core::CORE_PAUSE);
wxAuiToolBar* toolBar = GetToolBar();
wxAuiToolBar* ToolBar = GetToolBar();
if (!toolBar) return;
if (!ToolBar) return;
if (Core::GetState() == Core::CORE_UNINITIALIZED)
{
toolBar->EnableTool(IDM_DEBUG_GO, false);
toolBar->EnableTool(IDM_STEP, false);
toolBar->EnableTool(IDM_STEPOVER, false);
toolBar->EnableTool(IDM_SKIP, false);
ToolBar->EnableTool(IDM_DEBUG_GO, false);
ToolBar->EnableTool(IDM_STEP, false);
ToolBar->EnableTool(IDM_STEPOVER, false);
ToolBar->EnableTool(IDM_SKIP, false);
}
else
{
if (!CCPU::IsStepping())
{
toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Pause"));
toolBar->SetToolBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_Pause]);
toolBar->EnableTool(IDM_DEBUG_GO, true);
toolBar->EnableTool(IDM_STEP, false);
toolBar->EnableTool(IDM_STEPOVER, false);
toolBar->EnableTool(IDM_SKIP, false);
ToolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Pause"));
ToolBar->SetToolLabel(IDM_DEBUG_GO, _("Pause"));
ToolBar->SetToolBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_Pause]);
ToolBar->EnableTool(IDM_DEBUG_GO, true);
ToolBar->EnableTool(IDM_STEP, false);
ToolBar->EnableTool(IDM_STEPOVER, false);
ToolBar->EnableTool(IDM_SKIP, false);
}
else
{
toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Play"));
toolBar->SetToolBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_DebugGo]);
toolBar->EnableTool(IDM_DEBUG_GO, true);
toolBar->EnableTool(IDM_STEP, true);
toolBar->EnableTool(IDM_STEPOVER, true);
toolBar->EnableTool(IDM_SKIP, true);
ToolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Play"));
ToolBar->SetToolLabel(IDM_DEBUG_GO, _("Play"));
ToolBar->SetToolBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_DebugGo]);
ToolBar->EnableTool(IDM_DEBUG_GO, true);
ToolBar->EnableTool(IDM_STEP, true);
ToolBar->EnableTool(IDM_STEPOVER, true);
ToolBar->EnableTool(IDM_SKIP, true);
}
}
@ -959,6 +959,15 @@ void CCodeWindow::UpdateButtonStates()
symbols->SetFont(DebuggerFont);
callers->SetFont(DebuggerFont);
calls->SetFont(DebuggerFont);
if (ToolBar) ToolBar->Realize();
}
// Update manager
void CCodeWindow::UpdateManager()
{
// Caution: This can cause an endless loop if this event comes back to this function
wxCommandEvent evnt(wxEVT_HOST_COMMAND, IDM_UPDATEGUI);
wxPostEvent(GetParentFrame(), evnt);
}
void CCodeWindow::RecreateToolbar(wxAuiToolBar * toolBar)

View File

@ -86,6 +86,7 @@ class CCodeWindow
void PopulateToolbar(wxAuiToolBar* toolBar);
void CreateSymbolsMenu();
void UpdateButtonStates();
void CCodeWindow::UpdateManager();
// Sub dialogs
wxMenuBar* pMenuBar;

View File

@ -473,7 +473,6 @@ CFrame::CFrame(bool showLogWindow,
// Update controls
UpdateGUI();
if (UseDebugger) g_pCodeWindow->UpdateButtonStates();
// If we are rerecording create the status bar now instead of later when a game starts
#ifdef RERECORDING
@ -501,7 +500,6 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event))
void CFrame::OnClose(wxCloseEvent& event)
{
// Don't forget the skip or the window won't be destroyed
event.Skip();

View File

@ -261,7 +261,7 @@ void CFrame::PopulateToolbar(wxAuiToolBar* toolBar)
toolBar->AddTool(wxID_REFRESH, _T("Refresh"), m_Bitmaps[Toolbar_Refresh], _T("Refresh"));
toolBar->AddTool(IDM_BROWSE, _T("Browse"), m_Bitmaps[Toolbar_Browse], _T("Browse for an ISO directory..."));
toolBar->AddSeparator();
toolBar->AddTool(IDM_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play], _T("Play"));
toolBar->AddTool(IDM_PLAY, wxT(""), m_Bitmaps[Toolbar_Play], _T("Play"));
toolBar->AddTool(IDM_STOP, _T("Stop"), m_Bitmaps[Toolbar_Stop], _T("Stop"));
#ifdef _WIN32
toolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _T("Fullscr."), m_Bitmaps[Toolbar_FullScreen], _T("Toggle Fullscreen"));
@ -969,13 +969,11 @@ void CFrame::UpdateGUI()
{
m_ToolBar->SetToolBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Play]);
m_ToolBar->SetToolShortHelp(IDM_PLAY, _("Play"));
m_ToolBar->SetToolLabel(IDM_PLAY, _("Play"));
m_ToolBar->SetToolLabel(IDM_PLAY, wxT(" Play "));
}
GetMenuBar()->FindItem(IDM_PLAY)->SetText(_("&Play\tF10"));
}
// Commit changes to toolbar
if (m_ToolBar != NULL) m_ToolBar->Realize();
if (!initialized)
{
@ -994,6 +992,12 @@ void CFrame::UpdateGUI()
m_GameListCtrl->Hide();
}
}
// Commit changes to toolbar
if (m_ToolBar != NULL) m_ToolBar->Realize();
if (UseDebugger) g_pCodeWindow->Update();
// Commit changes to manager
m_Mgr->Update();
}
void CFrame::GameListChanged(wxCommandEvent& event)