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 // Class, input event handler and host message handler
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent,
wxWindowID id) 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 /* Remember to initialize potential new controls with NULL there, otherwise m_dialog = true and
things may crash */ things may crash */
@ -750,6 +750,8 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
} }
UpdateButtonStates(); UpdateButtonStates();
// Update all toolbars in the aui manager
UpdateManager();
} }
@ -883,7 +885,6 @@ void CCodeWindow::UpdateCallstack()
void CCodeWindow::Update() void CCodeWindow::Update()
{ {
codeview->Refresh(); codeview->Refresh();
UpdateCallstack(); UpdateCallstack();
UpdateButtonStates(); UpdateButtonStates();
@ -893,9 +894,6 @@ void CCodeWindow::Update()
} }
// Update GUI // Update GUI
void CCodeWindow::UpdateButtonStates() void CCodeWindow::UpdateButtonStates()
@ -903,36 +901,38 @@ void CCodeWindow::UpdateButtonStates()
bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED); bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED);
bool Running = (Core::GetState() == Core::CORE_RUN); bool Running = (Core::GetState() == Core::CORE_RUN);
bool Pause = (Core::GetState() == Core::CORE_PAUSE); 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) if (Core::GetState() == Core::CORE_UNINITIALIZED)
{ {
toolBar->EnableTool(IDM_DEBUG_GO, false); ToolBar->EnableTool(IDM_DEBUG_GO, false);
toolBar->EnableTool(IDM_STEP, false); ToolBar->EnableTool(IDM_STEP, false);
toolBar->EnableTool(IDM_STEPOVER, false); ToolBar->EnableTool(IDM_STEPOVER, false);
toolBar->EnableTool(IDM_SKIP, false); ToolBar->EnableTool(IDM_SKIP, false);
} }
else else
{ {
if (!CCPU::IsStepping()) if (!CCPU::IsStepping())
{ {
toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Pause")); ToolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Pause"));
toolBar->SetToolBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_Pause]); ToolBar->SetToolLabel(IDM_DEBUG_GO, _("Pause"));
toolBar->EnableTool(IDM_DEBUG_GO, true); ToolBar->SetToolBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_Pause]);
toolBar->EnableTool(IDM_STEP, false); ToolBar->EnableTool(IDM_DEBUG_GO, true);
toolBar->EnableTool(IDM_STEPOVER, false); ToolBar->EnableTool(IDM_STEP, false);
toolBar->EnableTool(IDM_SKIP, false); ToolBar->EnableTool(IDM_STEPOVER, false);
ToolBar->EnableTool(IDM_SKIP, false);
} }
else else
{ {
toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Play")); ToolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Play"));
toolBar->SetToolBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_DebugGo]); ToolBar->SetToolLabel(IDM_DEBUG_GO, _("Play"));
toolBar->EnableTool(IDM_DEBUG_GO, true); ToolBar->SetToolBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_DebugGo]);
toolBar->EnableTool(IDM_STEP, true); ToolBar->EnableTool(IDM_DEBUG_GO, true);
toolBar->EnableTool(IDM_STEPOVER, true); ToolBar->EnableTool(IDM_STEP, true);
toolBar->EnableTool(IDM_SKIP, true); ToolBar->EnableTool(IDM_STEPOVER, true);
ToolBar->EnableTool(IDM_SKIP, true);
} }
} }
@ -959,6 +959,15 @@ void CCodeWindow::UpdateButtonStates()
symbols->SetFont(DebuggerFont); symbols->SetFont(DebuggerFont);
callers->SetFont(DebuggerFont); callers->SetFont(DebuggerFont);
calls->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) void CCodeWindow::RecreateToolbar(wxAuiToolBar * toolBar)

View File

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

View File

@ -473,7 +473,6 @@ CFrame::CFrame(bool showLogWindow,
// Update controls // Update controls
UpdateGUI(); UpdateGUI();
if (UseDebugger) g_pCodeWindow->UpdateButtonStates();
// If we are rerecording create the status bar now instead of later when a game starts // If we are rerecording create the status bar now instead of later when a game starts
#ifdef RERECORDING #ifdef RERECORDING
@ -501,7 +500,6 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event))
void CFrame::OnClose(wxCloseEvent& event) void CFrame::OnClose(wxCloseEvent& event)
{ {
// Don't forget the skip or the window won't be destroyed // Don't forget the skip or the window won't be destroyed
event.Skip(); 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(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->AddTool(IDM_BROWSE, _T("Browse"), m_Bitmaps[Toolbar_Browse], _T("Browse for an ISO directory..."));
toolBar->AddSeparator(); 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")); toolBar->AddTool(IDM_STOP, _T("Stop"), m_Bitmaps[Toolbar_Stop], _T("Stop"));
#ifdef _WIN32 #ifdef _WIN32
toolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _T("Fullscr."), m_Bitmaps[Toolbar_FullScreen], _T("Toggle Fullscreen")); 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->SetToolBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Play]);
m_ToolBar->SetToolShortHelp(IDM_PLAY, _("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")); GetMenuBar()->FindItem(IDM_PLAY)->SetText(_("&Play\tF10"));
} }
// Commit changes to toolbar
if (m_ToolBar != NULL) m_ToolBar->Realize();
if (!initialized) if (!initialized)
{ {
@ -994,6 +992,12 @@ void CFrame::UpdateGUI()
m_GameListCtrl->Hide(); 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) void CFrame::GameListChanged(wxCommandEvent& event)