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:
parent
c1f091e4bc
commit
9ae08121d0
|
@ -161,12 +161,8 @@ END_EVENT_TABLE()
|
|||
|
||||
|
||||
// Class, input event handler and host message handler
|
||||
/*
|
||||
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, wxWindowID id,
|
||||
const wxString& title, const wxPoint& pos, const wxSize& size, long style)
|
||||
: wxFrame(parent, id, title, pos, size, style)
|
||||
*/
|
||||
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent, wxWindowID id)
|
||||
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, wxWindow* parent,
|
||||
wxWindowID id)
|
||||
: wxPanel(parent, id)
|
||||
|
||||
/* Remember to initialize potential new controls with NULL there, otherwise m_dialog = true and
|
||||
|
@ -175,6 +171,7 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
|
|||
, m_BreakpointWindow(NULL)
|
||||
, m_MemoryWindow(NULL)
|
||||
, m_JitWindow(NULL)
|
||||
, m_ToolBar2(NULL)
|
||||
{
|
||||
// Load ini settings
|
||||
IniFile file;
|
||||
|
@ -231,14 +228,18 @@ wxMenuBar *CCodeWindow::GetMenuBar()
|
|||
{
|
||||
if (GetParentFrame()) return GetParentFrame()->GetMenuBar();
|
||||
}
|
||||
wxToolBar *CCodeWindow::GetToolBar()
|
||||
wxAuiToolBar *CCodeWindow::GetToolBar()
|
||||
{
|
||||
if (GetParentFrame()) return GetParentFrame()->GetToolBar();
|
||||
if (GetParentFrame()) return m_ToolBar2;
|
||||
}
|
||||
bool CCodeWindow::IsActive()
|
||||
{
|
||||
if (GetParentFrame()) return GetParentFrame()->IsActive();
|
||||
}
|
||||
void CCodeWindow::UpdateToolbar(wxAuiToolBar * _ToolBar2)
|
||||
{
|
||||
m_ToolBar2 = _ToolBar2;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
@ -771,6 +772,12 @@ void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
|
|||
|
||||
void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event)
|
||||
{
|
||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
Console->Log(LogTypes::LNOTICE, StringFromFormat(
|
||||
"GetToolBar():%i\n", GetToolBar()).c_str());
|
||||
|
||||
if (!GetToolBar()) return;
|
||||
|
||||
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(IDM_ADDRBOX);
|
||||
wxString txt = pAddrCtrl->GetValue();
|
||||
|
||||
|
@ -900,7 +907,7 @@ void CCodeWindow::UpdateButtonStates()
|
|||
bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED);
|
||||
bool Running = (Core::GetState() == Core::CORE_RUN);
|
||||
bool Pause = (Core::GetState() == Core::CORE_PAUSE);
|
||||
wxToolBar* toolBar = GetToolBar();
|
||||
wxAuiToolBar* toolBar = GetToolBar();
|
||||
|
||||
if (!toolBar) return;
|
||||
|
||||
|
@ -916,7 +923,7 @@ void CCodeWindow::UpdateButtonStates()
|
|||
if (!CCPU::IsStepping())
|
||||
{
|
||||
toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Pause"));
|
||||
toolBar->SetToolNormalBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_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);
|
||||
|
@ -925,7 +932,7 @@ void CCodeWindow::UpdateButtonStates()
|
|||
else
|
||||
{
|
||||
toolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Play"));
|
||||
toolBar->SetToolNormalBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_DebugGo]);
|
||||
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);
|
||||
|
|
|
@ -54,8 +54,10 @@ class CCodeWindow
|
|||
// Function redirection
|
||||
wxFrame *GetParentFrame();
|
||||
wxMenuBar * GetMenuBar();
|
||||
wxToolBar * GetToolBar();
|
||||
wxAuiToolBar * GetToolBar();
|
||||
wxAuiToolBar * m_ToolBar2;
|
||||
bool IsActive();
|
||||
void UpdateToolbar(wxAuiToolBar *);
|
||||
|
||||
void Load_(IniFile &file);
|
||||
void Load(IniFile &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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue