GUI: Views toolbar, save view on exit

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4074 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-08-27 07:33:07 +00:00
parent 217e0da0e6
commit cb0eafcfc8
6 changed files with 257 additions and 112 deletions

View File

@ -27,9 +27,6 @@
#include <wx/mstream.h>
#include <wx/tipwin.h>
// ugly that this lib included code from the main
#include "../../DolphinWX/Src/Globals.h"
#include "Host.h"
#include "Debugger.h"
@ -171,7 +168,7 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
, m_BreakpointWindow(NULL)
, m_MemoryWindow(NULL)
, m_JitWindow(NULL)
, m_ToolBar2(NULL), m_NB0(NULL), m_NB1(NULL)
, m_ToolBarDebug(NULL), m_NB0(NULL), m_NB1(NULL)
{
// Load ini settings
this->Load();
@ -211,7 +208,7 @@ wxMenuBar *CCodeWindow::GetMenuBar()
}
wxAuiToolBar *CCodeWindow::GetToolBar()
{
if (GetParentFrame()) return m_ToolBar2;
if (GetParentFrame()) return m_ToolBarDebug;
}
bool CCodeWindow::IsActive()
{
@ -219,7 +216,7 @@ bool CCodeWindow::IsActive()
}
void CCodeWindow::UpdateToolbar(wxAuiToolBar * _ToolBar2)
{
m_ToolBar2 = _ToolBar2;
m_ToolBarDebug = _ToolBar2;
}
void CCodeWindow::UpdateNotebook(int _i, wxAuiNotebook * _NB)
{
@ -508,11 +505,10 @@ void CCodeWindow::InitBitmaps()
m_Bitmaps[Toolbar_Skip] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_GotoPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_SetPC] = wxGetBitmapFromMemory(toolbar_add_memcheck_png);
m_Bitmaps[Toolbar_Pause] = wxGetBitmapFromMemory(toolbar_pause_png);
m_Bitmaps[Toolbar_DebugPause] = wxGetBitmapFromMemory(toolbar_pause_png);
// scale to 16x16 for toolbar
for (size_t n = Toolbar_DebugGo; n < Bitmaps_max; n++)
for (size_t n = Toolbar_DebugGo; n < ToolbarDebugBitmapMax; n++)
{
m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(16, 16));
}
@ -859,7 +855,7 @@ void CCodeWindow::UpdateButtonStates()
{
ToolBar->SetToolShortHelp(IDM_DEBUG_GO, _T("&Pause"));
ToolBar->SetToolLabel(IDM_DEBUG_GO, _("Pause"));
ToolBar->SetToolBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_Pause]);
ToolBar->SetToolBitmap(IDM_DEBUG_GO, m_Bitmaps[Toolbar_DebugPause]);
ToolBar->EnableTool(IDM_DEBUG_GO, true);
ToolBar->EnableTool(IDM_STEP, false);
ToolBar->EnableTool(IDM_STEPOVER, false);
@ -922,7 +918,7 @@ void CCodeWindow::RecreateToolbar(wxAuiToolBar * toolBar)
long style = TOOLBAR_STYLE;
style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT | wxTB_TOP);
wxToolBar* theToolBar = CreateToolBar(style, ID_TOOLBAR2);
wxToolBar* theToolBar = CreateToolBar(style, ID_TOOLBAR_DEBUG);
PopulateToolbar(theToolBar);
SetToolBar(theToolBar);

View File

@ -28,6 +28,9 @@
#include "Thread.h"
#include "CoreParameter.h"
// GUI global
#include "../../DolphinWX/Src/Globals.h"
class CRegisterWindow;
class CBreakPointWindow;
class CMemoryWindow;
@ -54,10 +57,10 @@ class CCodeWindow
void Load();
void Save();
// Function redirection
// Function redirection and parent interaction
wxFrame *GetParentFrame();
wxMenuBar * GetMenuBar();
wxAuiToolBar * GetToolBar(), * m_ToolBar2;
wxAuiToolBar * GetToolBar(), * m_ToolBarDebug;
wxAuiNotebook *m_NB0, *m_NB1;
bool IsActive();
void UpdateToolbar(wxAuiToolBar *);
@ -68,13 +71,13 @@ class CCodeWindow
#endif
wxWindow * GetNootebookPage(wxString);
void DoToggleWindow(int,bool);
wxBitmap m_Bitmaps[ToolbarDebugBitmapMax];
bool UseInterpreter();
bool BootToPause();
bool AutomaticStart();
bool UnlimitedJITCache();
bool JITBlockLinking();
//bool UseDualCore(); // not used
void JumpToAddress(u32 _Address);
void Update();
@ -106,18 +109,6 @@ class CCodeWindow
ID_SYMBOLLIST
};
enum
{
Toolbar_DebugGo,
Toolbar_Pause,
Toolbar_Step,
Toolbar_StepOver,
Toolbar_Skip,
Toolbar_GotoPC,
Toolbar_SetPC,
Bitmaps_max
};
// Settings
bool bAutomaticStart; bool bBootToPause;
bool bRegisterWindow;
@ -161,6 +152,9 @@ class CCodeWindow
void DoTip(wxString text);
void OnKeyDown(wxKeyEvent& event);
void InitBitmaps();
void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter);
wxMenuItem* jitblocklinking, *jitunlimited, *jitoff;
wxMenuItem* jitlsoff, *jitlslxzoff, *jitlslwzoff, *jitlslbzxoff;
wxMenuItem* jitlspoff;
@ -177,12 +171,7 @@ class CCodeWindow
wxListBox* calls;
Common::Event sync_event;
wxBitmap m_Bitmaps[Bitmaps_max];
DECLARE_EVENT_TABLE()
void InitBitmaps();
void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter);
};
#endif /*CODEWINDOW_*/

View File

@ -245,6 +245,9 @@ EVT_MENU(IDM_CONFIG_DSP_PLUGIN, CFrame::OnPluginDSP)
EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnPluginPAD)
EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnPluginWiimote)
EVT_MENU(IDM_PERSPECTIVE_0, CFrame::OnToolBar)
EVT_MENU(IDM_PERSPECTIVE_1, CFrame::OnToolBar)
#if defined(HAVE_SFML) && HAVE_SFML
EVT_MENU(IDM_NETPLAY, CFrame::OnNetPlay)
#endif
@ -318,7 +321,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), m_ToolBar(NULL), m_ToolBar2(NULL)
, HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL)
, m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow)
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
#if wxUSE_TIMER
@ -369,12 +372,11 @@ CFrame::CFrame(bool showLogWindow,
{
wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
static int Style =
wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_TAB_SPLIT |
wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
m_NB1 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(430,200), Style);
m_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(430,200), Style);
m_NB0->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile );
static int Style = wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
m_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB1 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB2 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Style);
m_NB0->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile);
g_pCodeWindow->UpdateNotebook(0, m_NB0);
g_pCodeWindow->UpdateNotebook(1, m_NB1);
@ -392,29 +394,31 @@ CFrame::CFrame(bool showLogWindow,
m_Mgr = new wxAuiManager();
m_Mgr->SetManagedWindow(this);
// Window perspectives
/*
-------------------
| Pane 0 | |
|--------| Pane 2 |
| Pane 1 | |
-------------------
----------------------------
| Pane 0 | | |
|--------| Pane 2 | Pane 3 |
| Pane 1 | | |
----------------------------
*/
// This panel is the parent for rendering and it holds the gamelistctrl
if (UseDebugger)
{
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().
Name(wxT("Pane1")).Caption(wxT("Pane1")).
CenterPane().Layer(0).PaneBorder(false));
AuiFullscreen = m_Mgr->SavePerspective();
m_Mgr->GetPane(wxT("Pane1")).PaneBorder(true);
m_Mgr->AddPane(m_NB1, wxAuiPaneInfo().
Name(wxT("Pane2")).Caption(wxT("Pane2")).
CenterPane().Layer(1));
m_Mgr->AddPane(m_NB0, wxAuiPaneInfo().
Name(wxT("Pane3")).Caption(wxT("Pane3")).
CenterPane().Layer(2));
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane0")).Caption(wxT("Pane0")).Hide());
m_Mgr->AddPane(m_NB0, wxAuiPaneInfo().Name(wxT("Pane1")).Caption(wxT("Pane1")).Hide());
m_Mgr->AddPane(m_NB1, wxAuiPaneInfo().Name(wxT("Pane2")).Caption(wxT("Pane2")).Hide());
m_Mgr->AddPane(m_NB2, wxAuiPaneInfo().Name(wxT("Pane3")).Caption(wxT("Pane3")).Hide());
}
else
{
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().
Name(wxT("Pane1")).Caption(wxT("Pane1")).
CenterPane().PaneBorder(false));
AuiFullscreen = m_Mgr->SavePerspective();
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane0")).Caption(wxT("Pane0")).Hide());
}
// Open log window
@ -423,15 +427,47 @@ CFrame::CFrame(bool showLogWindow,
// Create toolbar
RecreateToolbar();
if (!SConfig::GetInstance().m_InterfaceToolbar) DoToggleToolbar(false);
if (UseDebugger) g_pCodeWindow->UpdateToolbar(m_ToolBarDebug);
AuiMode1 = m_Mgr->SavePerspective();
if (UseDebugger) g_pCodeWindow->UpdateToolbar(m_ToolBar2);
// Position the panes
m_Mgr->GetPane(wxT("Pane0")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane1")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane2")).CaptionVisible(true);
m_Mgr->GetPane(wxT("Pane3")).CaptionVisible(true);
// Save perspectives
AuiMode2 = m_Mgr->SavePerspective();
m_Mgr->GetPane(wxT("Pane2")).Layer(0);
m_Mgr->GetPane(wxT("Pane3")).Layer(0).Right();
AuiMode1 = m_Mgr->SavePerspective();
if (UseDebugger)
{
// Setup perspectives
m_Mgr->GetPane(wxT("Pane0")).CenterPane().PaneBorder(false);
AuiFullscreen = m_Mgr->SavePerspective();
m_Mgr->GetPane(wxT("Pane0")).Show().PaneBorder(true).Layer(0).Center().Position(0);
m_Mgr->GetPane(wxT("Pane1")).Show().PaneBorder(true).Layer(0).Center().Position(1);
m_Mgr->GetPane(wxT("Pane2")).Show().PaneBorder(true).Layer(0).Right();
AuiPerspective.Add(m_Mgr->SavePerspective());
m_Mgr->GetPane(wxT("Pane0")).Left();
m_Mgr->GetPane(wxT("Pane1")).Left();
m_Mgr->GetPane(wxT("Pane2")).Center();
m_Mgr->GetPane(wxT("Pane3")).Show().Right();
AuiPerspective.Add(m_Mgr->SavePerspective());
// Load perspective
int iPerspective;
IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE);
ini.Get("Perspectives", "Perspective", &iPerspective, 0);
ini.Get("Perspective 0", "LeftWidth", &iLeftWidth[0], 50);
ini.Get("Perspective 0", "AutomaticStart", &iLeftWidth[1], 33);
ini.Get("Perspective 1", "BootToPause", &iMidWidth[1], 33);
DoLoadPerspective(iPerspective);
}
else
{
m_Mgr->GetPane(wxT("Pane0")).Layer(0).CenterPane().PaneBorder(false);
AuiFullscreen = m_Mgr->SavePerspective();
}
// Show window
Show();
@ -508,6 +544,7 @@ void CFrame::OnClose(wxCloseEvent& event)
event.Skip();
// Save GUI settings
if (UseDebugger) g_pCodeWindow->Save();
if (UseDebugger) Save();
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
@ -554,6 +591,74 @@ void CFrame::DoFullscreen(bool _F)
m_Mgr->LoadPerspective(AuiCurrent, true);
}
}
void CFrame::DoLoadPerspective(int i)
{
//Save();
m_Mgr->LoadPerspective(AuiPerspective[i], true);
int _iLeftWidth, _iMidWidth, _iRightWidth, iClientSize = this->GetSize().GetX();
// Check limits
if (iLeftWidth[0] > 95) iLeftWidth[0] = 95; if (iLeftWidth[0] < 5) iLeftWidth[0] = 5;
if (iLeftWidth[1] > 95) iLeftWidth[1] = 95; if (iLeftWidth[1] < 5) iLeftWidth[1] = 5;
if (iMidWidth[1] > 95) iMidWidth[1] = 95; if (iMidWidth[1] < 5) iMidWidth[1] = 5;
// Set the size
if (i == 0)
{
_iLeftWidth = iClientSize * (float)(iLeftWidth[0]/100.0);
_iRightWidth = iClientSize - _iLeftWidth;
m_Mgr->GetPane(wxT("Pane0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
//m_Mgr->GetPane(wxT("Pane1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
m_Mgr->GetPane(wxT("Pane2")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
}
else
{
_iLeftWidth = iClientSize * (float)(iLeftWidth[1]/100.0);
_iMidWidth = iClientSize * (float)(iMidWidth[1]/100.0);
_iRightWidth = iClientSize - _iLeftWidth - _iMidWidth;
m_Mgr->GetPane(wxT("Pane0")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
//m_Mgr->GetPane(wxT("Pane1")).BestSize(_iLeftWidth, -1).MinSize(_iLeftWidth, -1).MaxSize(_iLeftWidth, -1);
m_Mgr->GetPane(wxT("Pane2")).BestSize(_iMidWidth, -1).MinSize(_iMidWidth, -1).MaxSize(_iMidWidth, -1);
m_Mgr->GetPane(wxT("Pane3")).BestSize(_iRightWidth, -1).MinSize(_iRightWidth, -1).MaxSize(_iRightWidth, -1);
}
m_Mgr->Update();
// Remove the size limits
m_Mgr->GetPane(wxT("Pane0")).MinSize(-1, -1).MaxSize(-1, -1);
m_Mgr->GetPane(wxT("Pane1")).MinSize(-1, -1).MaxSize(-1, -1);
m_Mgr->GetPane(wxT("Pane2")).MinSize(-1, -1).MaxSize(-1, -1);
m_Mgr->GetPane(wxT("Pane3")).MinSize(-1, -1).MaxSize(-1, -1);
}
void CFrame::Save()
{
if (!m_Mgr->GetPane(wxT("Pane0")).IsOk() || !m_Mgr->GetPane(wxT("Pane2")).IsOk() ) return;
// Get client size
int _iLeftWidth, _iMidWidth, iClientSize = this->GetSize().GetX();
_iLeftWidth = (int)(((float)m_Mgr->GetPane(wxT("Pane0")).window->GetClientSize().GetX() / (float)iClientSize) * 100.0);
_iMidWidth = (int)(((float)m_Mgr->GetPane(wxT("Pane2")).window->GetClientSize().GetX() / (float)iClientSize) * 100.0);
IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE);
ini.Set("Perspectives", "Perspective", m_Mgr->GetPane(wxT("Pane3")).IsShown() ? 1 : 0);
if (!m_Mgr->GetPane(wxT("Pane3")).IsShown())
{
ini.Set("Perspective 0", "LeftWidth", _iLeftWidth);
}
else
{
ini.Set("Perspective 1", "LeftWidth", _iLeftWidth);
ini.Set("Perspective 1", "MidWidth", _iMidWidth);
}
ini.Save(DEBUGGER_CONFIG_FILE);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -109,15 +109,16 @@ class CFrame : public wxFrame
// AUI
wxAuiManager *m_Mgr;
wxAuiToolBar *m_ToolBar, *m_ToolBar2;
wxAuiNotebook *m_NB0, *m_NB1;
wxAuiToolBar *m_ToolBar, *m_ToolBarDebug, *m_ToolBarAui;
wxAuiNotebook *m_NB0, *m_NB1, *m_NB2;
int iLeftWidth[2], iMidWidth[2];
// Perspectives
wxString AuiFullscreen;
wxString AuiMode1;
wxString AuiMode2;
wxString AuiCurrent;
wxString AuiFullscreen, AuiCurrent;
wxArrayString AuiPerspective;
void OnNotebookPageClose(wxAuiNotebookEvent& event);
void OnAllowNotebookDnD(wxAuiNotebookEvent& event);
void DoLoadPerspective(int);
void Save();
char **drives;
@ -161,6 +162,7 @@ class CFrame : public wxFrame
wxBitmap m_BitmapsMenu[EToolbar_Max];
void PopulateToolbar(wxAuiToolBar* toolBar);
void PopulateToolbarAui(wxAuiToolBar* toolBar);
void RecreateToolbar();
void CreateMenu();
@ -171,6 +173,7 @@ class CFrame : public wxFrame
// Event functions
void OnQuit(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event);
void OnToolBar(wxCommandEvent& event);
void OnOpen(wxCommandEvent& event); // File menu
void DoOpen(bool Boot);
@ -208,6 +211,7 @@ class CFrame : public wxFrame
void OnToggleThrottle(wxCommandEvent& event);
void OnResize(wxSizeEvent& event);
void OnToggleToolbar(wxCommandEvent& event);
void DoToggleToolbar(bool);
void OnToggleStatusbar(wxCommandEvent& event);
void OnToggleLogWindow(wxCommandEvent& event);
void OnToggleConsole(wxCommandEvent& event);

View File

@ -251,49 +251,54 @@ void CFrame::CreateMenu()
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create toolbar items
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::PopulateToolbar(wxAuiToolBar* toolBar)
void CFrame::PopulateToolbar(wxAuiToolBar* ToolBar)
{
int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(),
h = m_Bitmaps[Toolbar_FileOpen].GetHeight();
ToolBar->SetToolBitmapSize(wxSize(w, h));
toolBar->SetToolBitmapSize(wxSize(w, h));
toolBar->AddTool(wxID_OPEN, _T("Open"), m_Bitmaps[Toolbar_FileOpen], _T("Open file..."));
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, wxT(""), m_Bitmaps[Toolbar_Play], _T("Play"));
toolBar->AddTool(IDM_STOP, _T("Stop"), m_Bitmaps[Toolbar_Stop], _T("Stop"));
ToolBar->AddTool(wxID_OPEN, _T("Open"), m_Bitmaps[Toolbar_FileOpen], _T("Open file..."));
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, 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"));
ToolBar->AddTool(IDM_TOGGLE_FULLSCREEN, _T("Fullscr."), m_Bitmaps[Toolbar_FullScreen], _T("Toggle Fullscreen"));
#endif
toolBar->AddTool(IDM_SCREENSHOT, _T("Scr.Shot"), m_Bitmaps[Toolbar_FullScreen], _T("Take Screenshot"));
toolBar->AddSeparator();
toolBar->AddTool(IDM_CONFIG_MAIN, _T("Config"), m_Bitmaps[Toolbar_PluginOptions], _T("Configure..."));
toolBar->AddTool(IDM_CONFIG_GFX_PLUGIN, _T("Gfx"), m_Bitmaps[Toolbar_PluginGFX], _T("Graphics settings"));
toolBar->AddTool(IDM_CONFIG_DSP_PLUGIN, _T("DSP"), m_Bitmaps[Toolbar_PluginDSP], _T("DSP settings"));
toolBar->AddTool(IDM_CONFIG_PAD_PLUGIN, _T("Pad"), m_Bitmaps[Toolbar_PluginPAD], _T("Pad settings"));
toolBar->AddTool(IDM_CONFIG_WIIMOTE_PLUGIN, _T("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _T("Wiimote settings"));
toolBar->AddSeparator();
toolBar->AddTool(IDM_HELPABOUT, _T("About"), m_Bitmaps[Toolbar_Help], _T("About Dolphin"));
ToolBar->AddTool(IDM_SCREENSHOT, _T("Scr.Shot"), m_Bitmaps[Toolbar_FullScreen], _T("Take Screenshot"));
ToolBar->AddSeparator();
ToolBar->AddTool(IDM_CONFIG_MAIN, _T("Config"), m_Bitmaps[Toolbar_PluginOptions], _T("Configure..."));
ToolBar->AddTool(IDM_CONFIG_GFX_PLUGIN, _T("Gfx"), m_Bitmaps[Toolbar_PluginGFX], _T("Graphics settings"));
ToolBar->AddTool(IDM_CONFIG_DSP_PLUGIN, _T("DSP"), m_Bitmaps[Toolbar_PluginDSP], _T("DSP settings"));
ToolBar->AddTool(IDM_CONFIG_PAD_PLUGIN, _T("Pad"), m_Bitmaps[Toolbar_PluginPAD], _T("Pad settings"));
ToolBar->AddTool(IDM_CONFIG_WIIMOTE_PLUGIN, _T("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _T("Wiimote settings"));
ToolBar->AddSeparator();
ToolBar->AddTool(IDM_HELPABOUT, _T("About"), m_Bitmaps[Toolbar_Help], _T("About Dolphin"));
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
toolBar->Realize();
ToolBar->Realize();
}
void CFrame::PopulateToolbarAui(wxAuiToolBar* ToolBar)
{
int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(),
h = m_Bitmaps[Toolbar_FileOpen].GetHeight();
ToolBar->SetToolBitmapSize(wxSize(w, h));
ToolBar->AddTool(IDM_PERSPECTIVE_0, wxT("View 1"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("View 1"));
ToolBar->AddTool(IDM_PERSPECTIVE_1, wxT("View 2"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], wxT("View 2"));
ToolBar->Realize();
}
// Delete and recreate the toolbar
void CFrame::RecreateToolbar()
{
if (m_ToolBar) {
m_Mgr->DetachPane(m_ToolBar);
delete m_ToolBar; }
m_ToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT);
PopulateToolbar(m_ToolBar);
m_Mgr->AddPane(m_ToolBar, wxAuiPaneInfo().
Name(wxT("TBMain")).Caption(wxT("TBMain")).
ToolbarPane().Top().
@ -301,26 +306,38 @@ void CFrame::RecreateToolbar()
if (UseDebugger)
{
if (m_ToolBar2) {
m_Mgr->DetachPane(m_ToolBar2);
delete m_ToolBar2; }
m_ToolBar2 = new wxAuiToolBar(this, ID_TOOLBAR2, wxDefaultPosition, wxDefaultSize,
m_ToolBarDebug = new wxAuiToolBar(this, ID_TOOLBAR_DEBUG, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT);
g_pCodeWindow->PopulateToolbar(m_ToolBar2);
m_Mgr->AddPane(m_ToolBar2, wxAuiPaneInfo().
g_pCodeWindow->PopulateToolbar(m_ToolBarDebug);
m_Mgr->AddPane(m_ToolBarDebug, wxAuiPaneInfo().
Name(wxT("TBDebug")).Caption(wxT("TBDebug")).
ToolbarPane().Top().
LeftDockable(false).RightDockable(false).Floatable(false));
m_ToolBarAui = new wxAuiToolBar(this, ID_TOOLBAR_AUI, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT);
PopulateToolbarAui(m_ToolBarAui);
m_Mgr->AddPane(m_ToolBarAui, wxAuiPaneInfo().
Name(wxT("TBAui")).Caption(wxT("TBAui")).
ToolbarPane().Top().
LeftDockable(false).RightDockable(false).Floatable(false));
}
// Hide toolbars if disabled
if (!SConfig::GetInstance().m_InterfaceToolbar)
{ m_Mgr->GetPane(wxT("TBMain")).Hide(); if (UseDebugger) m_Mgr->GetPane(wxT("TBDebug")).Hide(); }
//UpdateGUI();
/*
wxToolBarBase* ToolBar = GetToolBar();
long style = ToolBar ? ToolBar->GetWindowStyle() : TOOLBAR_STYLE;
delete ToolBar;
SetToolBar(NULL);
style &= ~(wxTB_HORIZONTAL | wxTB_VERTICAL | wxTB_BOTTOM | wxTB_RIGHT | wxTB_HORZ_LAYOUT | wxTB_TOP);
m_ToolBar = CreateToolBar(style, ID_TOOLBAR);
PopulateToolbar(m_ToolBar);
SetToolBar(m_ToolBar);
UpdateGUI();
*/
}
void CFrame::InitBitmaps()
@ -420,7 +437,7 @@ void CFrame::InitBitmaps()
}
// Update in case the bitmap has been updated
if (m_ToolBar != NULL)
if (GetToolBar() != NULL)
RecreateToolbar();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -699,6 +716,19 @@ void CFrame::OnHelp(wxCommandEvent& event)
break;
}
}
void CFrame::OnToolBar(wxCommandEvent& event)
{
switch (event.GetId())
{
case IDM_PERSPECTIVE_0:
DoLoadPerspective(0);
break;
case IDM_PERSPECTIVE_1:
DoLoadPerspective(1);
break;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -846,15 +876,20 @@ void CFrame::OnResize(wxSizeEvent& event)
void CFrame::OnToggleToolbar(wxCommandEvent& event)
{
SConfig::GetInstance().m_InterfaceToolbar = event.IsChecked();
if (event.IsChecked())
DoToggleToolbar(event.IsChecked());
}
void CFrame::DoToggleToolbar(bool Show)
{
if (Show)
{
m_Mgr->GetPane(wxT("TBMain")).Show(); if (UseDebugger) m_Mgr->GetPane(wxT("TBDebug")).Show();
m_Mgr->GetPane(wxT("TBMain")).Show();
if (UseDebugger) { m_Mgr->GetPane(wxT("TBDebug")).Show(); m_Mgr->GetPane(wxT("TBAui")).Show(); }
m_Mgr->Update();
}
else
{
m_Mgr->GetPane(wxT("TBMain")).Hide(); if (UseDebugger) m_Mgr->GetPane(wxT("TBDebug")).Hide();
m_Mgr->GetPane(wxT("TBMain")).Hide();
if (UseDebugger) { m_Mgr->GetPane(wxT("TBDebug")).Hide(); m_Mgr->GetPane(wxT("TBAui")).Hide(); }
m_Mgr->Update();
}
}

View File

@ -29,6 +29,18 @@
// Constant Colors
const unsigned long COLOR_GRAY = 0xDCDCDC;
enum
{
Toolbar_DebugGo,
Toolbar_DebugPause,
Toolbar_Step,
Toolbar_StepOver,
Toolbar_Skip,
Toolbar_GotoPC,
Toolbar_SetPC,
ToolbarDebugBitmapMax
};
enum
{
IDM_LOADSTATE = 200, // File menu
@ -153,7 +165,7 @@ enum
// --------------------------------------------------------------
// Debugger Toolbar
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
ID_TOOLBAR2,
ID_TOOLBAR_DEBUG,
IDM_DEBUG_GO,
IDM_STEP,
IDM_STEPOVER,
@ -161,6 +173,10 @@ enum
IDM_SETPC,
IDM_GOTOPC,
IDM_ADDRBOX,
ID_TOOLBAR_AUI,
IDM_PERSPECTIVE_0,
IDM_PERSPECTIVE_1,
// --------------------------------------------------------------
IDM_TOGGLE_DUALCORE, // Other