GUI: Fixed the debugging toolbar

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4061 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-08-25 10:58:13 +00:00
parent c1f091e4bc
commit 9ae08121d0
5 changed files with 47 additions and 34 deletions

View File

@ -292,6 +292,8 @@ EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
// Debugger Menu Entries
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)
@ -313,7 +315,7 @@ CFrame::CFrame(bool showLogWindow,
: wxFrame(parent, id, title, pos, size, style)
, UseDebugger(_UseDebugger)
, m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false)
, HaveSpeakers(false), m_Panel(NULL)
, HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBar2(NULL)
, m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow)
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
#if wxUSE_TIMER
@ -402,6 +404,7 @@ CFrame::CFrame(bool showLogWindow,
if (!SConfig::GetInstance().m_InterfaceToolbar)
{ m_Mgr->GetPane(wxT("TBMain")).Hide(); if (UseDebugger) m_Mgr->GetPane(wxT("TBDebug")).Hide(); }
AuiMode1 = m_Mgr->SavePerspective();
if (UseDebugger) g_pCodeWindow->UpdateToolbar(m_ToolBar2);
// Save perspectives
AuiMode2 = m_Mgr->SavePerspective();
@ -547,16 +550,17 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
}
// Post events
// Warning: This may cause an endless loop if the event is propagated back to its parent
void CFrame::PostEvent(wxCommandEvent& event)
{
// Restrict the post events to the minimum necessary, it seems like these events are
// somtimes posted to the parent wxFrame too so that it creates and endless loop
{
event.Skip();
event.StopPropagation();
if (g_pCodeWindow
&& event.GetId() >= IDM_INTERPRETER && event.GetId() <= IDM_ADDRBOX
&& event.GetId() != IDM_JITUNLIMITED
)
wxPostEvent(g_pCodeWindow, event);
event.Skip();
}
void CFrame::PostMenuEvent(wxMenuEvent& event)
{

View File

@ -102,13 +102,13 @@ class CFrame : public wxFrame
wxBoxSizer* sizerFrame;
CGameListCtrl* m_GameListCtrl;
wxPanel* m_Panel;
wxToolBar* m_ToolBar;
wxToolBarToolBase* m_ToolPlay;
bool m_bLogWindow;
CLogWindow* m_LogWindow;
// AUI
wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBar2;
// Perspectives
wxString AuiFullscreen;
wxString AuiMode1;

View File

@ -285,7 +285,7 @@ void CFrame::PopulateToolbar(wxAuiToolBar* toolBar)
// Delete and recreate the toolbar
void CFrame::RecreateToolbar()
{
wxAuiToolBar* m_ToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize,
m_ToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT);
PopulateToolbar(m_ToolBar);
@ -299,7 +299,7 @@ void CFrame::RecreateToolbar()
if (UseDebugger)
{
wxAuiToolBar* m_ToolBar2 = new wxAuiToolBar(this, ID_TOOLBAR2, wxDefaultPosition, wxDefaultSize,
m_ToolBar2 = new wxAuiToolBar(this, ID_TOOLBAR2, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT);
g_pCodeWindow->PopulateToolbar(m_ToolBar2);
@ -919,14 +919,14 @@ void CFrame::UpdateGUI()
bool paused = Core::GetState() == Core::CORE_PAUSE;
// Make sure that we have a toolbar
if (GetToolBar() != NULL)
if (m_ToolBar != NULL)
{
// Enable/disable the Config and Stop buttons
//GetToolBar()->EnableTool(IDM_CONFIG_MAIN, !initialized);
GetToolBar()->EnableTool(wxID_OPEN, !initialized);
GetToolBar()->EnableTool(wxID_REFRESH, !initialized); // Don't allow refresh when we don't show the list
GetToolBar()->EnableTool(IDM_STOP, running || paused);
GetToolBar()->EnableTool(IDM_SCREENSHOT, running || paused);
m_ToolBar->EnableTool(wxID_OPEN, !initialized);
m_ToolBar->EnableTool(wxID_REFRESH, !initialized); // Don't allow refresh when we don't show the list
m_ToolBar->EnableTool(IDM_STOP, running || paused);
m_ToolBar->EnableTool(IDM_SCREENSHOT, running || paused);
}
// File
@ -954,28 +954,28 @@ void CFrame::UpdateGUI()
if (running)
{
if (GetToolBar() != NULL)
if (m_ToolBar != NULL)
{
GetToolBar()->FindById(IDM_PLAY)->SetNormalBitmap(m_Bitmaps[Toolbar_Pause]);
GetToolBar()->FindById(IDM_PLAY)->SetShortHelp(_("Pause"));
GetToolBar()->FindById(IDM_PLAY)->SetLabel(_("Pause"));
m_ToolBar->SetToolBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Pause]);
m_ToolBar->SetToolShortHelp(IDM_PLAY, _("Pause"));
m_ToolBar->SetToolLabel(IDM_PLAY, _("Pause"));
}
GetMenuBar()->FindItem(IDM_PLAY)->SetText(_("&Pause\tF10"));
}
else
{
if (GetToolBar() != NULL)
if (m_ToolBar != NULL)
{
GetToolBar()->FindById(IDM_PLAY)->SetNormalBitmap(m_Bitmaps[Toolbar_Play]);
GetToolBar()->FindById(IDM_PLAY)->SetShortHelp(_("Play"));
GetToolBar()->FindById(IDM_PLAY)->SetLabel(_("Play"));
m_ToolBar->SetToolBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Play]);
m_ToolBar->SetToolShortHelp(IDM_PLAY, _("Play"));
m_ToolBar->SetToolLabel(IDM_PLAY, _("Play"));
}
GetMenuBar()->FindItem(IDM_PLAY)->SetText(_("&Play\tF10"));
}
// Commit changes to toolbar
if (GetToolBar() != NULL) GetToolBar()->Realize();
if (m_ToolBar != NULL) m_ToolBar->Realize();
if (!initialized)
{