Changed toolbar to be static, increasing UI integration

This commit is contained in:
archshift
2014-08-08 03:43:13 -07:00
parent b38022df43
commit 019d5aee49
5 changed files with 34 additions and 38 deletions

View File

@ -128,7 +128,7 @@ wxMenuBar *CCodeWindow::GetMenuBar()
return Parent->GetMenuBar(); return Parent->GetMenuBar();
} }
wxAuiToolBar *CCodeWindow::GetToolBar() wxToolBar *CCodeWindow::GetToolBar()
{ {
return Parent->m_ToolBarDebug; return Parent->m_ToolBarDebug;
} }
@ -588,7 +588,7 @@ void CCodeWindow::InitBitmaps()
bitmap = wxBitmap(bitmap.ConvertToImage().Scale(24, 24)); bitmap = wxBitmap(bitmap.ConvertToImage().Scale(24, 24));
} }
void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar) void CCodeWindow::PopulateToolbar(wxToolBar* toolBar)
{ {
int w = m_Bitmaps[0].GetWidth(), int w = m_Bitmaps[0].GetWidth(),
h = m_Bitmaps[0].GetHeight(); h = m_Bitmaps[0].GetHeight();
@ -625,7 +625,7 @@ void CCodeWindow::UpdateButtonStates()
bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED); bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED);
bool Pause = (Core::GetState() == Core::CORE_PAUSE); bool Pause = (Core::GetState() == Core::CORE_PAUSE);
bool Stepping = CCPU::IsStepping(); bool Stepping = CCPU::IsStepping();
wxAuiToolBar* ToolBar = GetToolBar(); wxToolBar* ToolBar = GetToolBar();
// Toolbar // Toolbar
if (!ToolBar) if (!ToolBar)

View File

@ -27,7 +27,7 @@ class DSPDebuggerLLE;
class GFXDebuggerPanel; class GFXDebuggerPanel;
struct SCoreStartupParameter; struct SCoreStartupParameter;
class wxAuiToolBar; class wxToolBar;
class wxListBox; class wxListBox;
class wxMenu; class wxMenu;
class wxMenuBar; class wxMenuBar;
@ -52,7 +52,7 @@ class CCodeWindow
// Parent interaction // Parent interaction
CFrame *Parent; CFrame *Parent;
wxMenuBar * GetMenuBar(); wxMenuBar * GetMenuBar();
wxAuiToolBar * GetToolBar(); wxToolBar * GetToolBar();
wxBitmap m_Bitmaps[ToolbarDebugBitmapMax]; wxBitmap m_Bitmaps[ToolbarDebugBitmapMax];
bool UseInterpreter(); bool UseInterpreter();
@ -67,8 +67,8 @@ class CCodeWindow
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar); void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar);
void CreateMenuOptions(wxMenu *pMenu); void CreateMenuOptions(wxMenu *pMenu);
void CreateMenuSymbols(wxMenuBar *pMenuBar); void CreateMenuSymbols(wxMenuBar *pMenuBar);
void RecreateToolbar(wxAuiToolBar*); void RecreateToolbar(wxToolBar*);
void PopulateToolbar(wxAuiToolBar* toolBar); void PopulateToolbar(wxToolBar* toolBar);
void UpdateButtonStates(); void UpdateButtonStates();
void OpenPages(); void OpenPages();
void UpdateManager(); void UpdateManager();

View File

@ -138,9 +138,10 @@ public:
X11Utils::XRRConfiguration *m_XRRConfig; X11Utils::XRRConfiguration *m_XRRConfig;
#endif #endif
wxToolBar *m_ToolBar, *m_ToolBarDebug;
// AUI // AUI
wxAuiManager *m_Mgr; wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui; wxAuiToolBar *m_ToolBarAui;
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1]; bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
// Perspectives (Should find a way to make all of this private) // Perspectives (Should find a way to make all of this private)
@ -195,7 +196,7 @@ private:
wxBitmap m_Bitmaps[EToolbar_Max]; wxBitmap m_Bitmaps[EToolbar_Max];
wxBitmap m_BitmapsMenu[EToolbar_Max]; wxBitmap m_BitmapsMenu[EToolbar_Max];
void PopulateToolbar(wxAuiToolBar* toolBar); void PopulateToolbar(wxToolBar* toolBar);
void PopulateToolbarAui(wxAuiToolBar* toolBar); void PopulateToolbarAui(wxAuiToolBar* toolBar);
void RecreateToolbar(); void RecreateToolbar();
void CreateMenu(); void CreateMenu();

View File

@ -584,7 +584,7 @@ void CFrame::OnToolBar(wxCommandEvent& event)
break; break;
case IDM_EDIT_PERSPECTIVES: case IDM_EDIT_PERSPECTIVES:
m_bEdit = !m_bEdit; m_bEdit = !m_bEdit;
m_ToolBarAui->SetToolSticky(IDM_EDIT_PERSPECTIVES, m_bEdit); //m_ToolBarAui->SetToolSticky(IDM_EDIT_PERSPECTIVES, m_bEdit);
TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES); TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES);
break; break;
} }

View File

@ -501,7 +501,7 @@ wxString CFrame::GetMenuLabel(int Id)
// Create toolbar items // Create toolbar items
// --------------------- // ---------------------
void CFrame::PopulateToolbar(wxAuiToolBar* ToolBar) void CFrame::PopulateToolbar(wxToolBar* ToolBar)
{ {
int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(), int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(),
h = m_Bitmaps[Toolbar_FileOpen].GetHeight(); h = m_Bitmaps[Toolbar_FileOpen].GetHeight();
@ -553,26 +553,16 @@ void CFrame::RecreateToolbar()
m_ToolBar->Destroy(); m_ToolBar->Destroy();
} }
long TOOLBAR_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT /*wxAUI_TB_OVERFLOW overflow visible*/; long TOOLBAR_STYLE = wxAUI_TB_PLAIN_BACKGROUND | wxAUI_TB_TEXT /*wxAUI_TB_OVERFLOW overflow visible*/;
m_ToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize, TOOLBAR_STYLE);
m_ToolBar = CreateToolBar(TOOLBAR_STYLE, wxID_ANY, "TBMain");
PopulateToolbar(m_ToolBar); PopulateToolbar(m_ToolBar);
m_Mgr->AddPane(m_ToolBar, wxAuiPaneInfo().
Name("TBMain").Caption("TBMain").
ToolbarPane().Top().
LeftDockable(false).RightDockable(false).Floatable(false));
if (g_pCodeWindow && !m_ToolBarDebug) if (g_pCodeWindow && !m_ToolBarDebug)
{ {
m_ToolBarDebug = new wxAuiToolBar(this, ID_TOOLBAR_DEBUG, wxDefaultPosition, wxDefaultSize, TOOLBAR_STYLE); m_ToolBarDebug = CreateToolBar(TOOLBAR_STYLE, wxID_ANY, "TBDebug");
g_pCodeWindow->PopulateToolbar(m_ToolBarDebug); g_pCodeWindow->PopulateToolbar(m_ToolBarDebug);
m_Mgr->AddPane(m_ToolBarDebug, wxAuiPaneInfo().
Name("TBDebug").Caption("TBDebug").
ToolbarPane().Top().
LeftDockable(false).RightDockable(false).Floatable(false));
m_ToolBarAui = new wxAuiToolBar(this, ID_TOOLBAR_AUI, wxDefaultPosition, wxDefaultSize, TOOLBAR_STYLE); m_ToolBarAui = new wxAuiToolBar(this, ID_TOOLBAR_AUI, wxDefaultPosition, wxDefaultSize, TOOLBAR_STYLE);
PopulateToolbarAui(m_ToolBarAui); PopulateToolbarAui(m_ToolBarAui);
m_Mgr->AddPane(m_ToolBarAui, wxAuiPaneInfo(). m_Mgr->AddPane(m_ToolBarAui, wxAuiPaneInfo().
@ -1721,22 +1711,27 @@ void CFrame::UpdateGUI()
AccessWiiMote(0x0104)->IsConnected()); AccessWiiMote(0x0104)->IsConnected());
} }
if (Running) if (m_ToolBar)
{ {
if (m_ToolBar) // Get the tool that controls pausing/playing
wxToolBarToolBase * PlayTool = m_ToolBar->FindById(IDM_PLAY);
if (PlayTool)
{ {
m_ToolBar->SetToolBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Pause]); if (Running)
m_ToolBar->SetToolShortHelp(IDM_PLAY, _("Pause")); {
m_ToolBar->SetToolLabel(IDM_PLAY, _("Pause")); PlayTool->SetLabel(_("Pause"));
} PlayTool->SetShortHelp(_("Pause"));
} // TODO: Change icon
else // m_ToolBar->SetToolBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Pause]);
{ }
if (m_ToolBar) else
{ {
m_ToolBar->SetToolBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Play]); PlayTool->SetLabel(_("Play"));
m_ToolBar->SetToolShortHelp(IDM_PLAY, _("Play")); PlayTool->SetShortHelp(_("Play"));
m_ToolBar->SetToolLabel(IDM_PLAY, _("Play")); // TODO: Change icon
// m_ToolBar->SetToolBitmap(IDM_PLAY, m_Bitmaps[Toolbar_Play]);
}
} }
} }