Wx: Implement the new debugger icons
This commit is contained in:
parent
ff59297213
commit
0f8c51dfe4
|
@ -35,20 +35,12 @@ public:
|
|||
: DolphinAuiToolBar(parent, id, wxDefaultPosition, wxDefaultSize,
|
||||
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT)
|
||||
{
|
||||
wxSize bitmap_size = FromDIP(wxSize(24, 24));
|
||||
SetToolBitmapSize(bitmap_size);
|
||||
|
||||
static const std::array<const char* const, Num_Bitmaps> image_names{
|
||||
{"toolbar_debugger_delete", "toolbar_add_breakpoint", "toolbar_add_memorycheck"}};
|
||||
for (std::size_t i = 0; i < image_names.size(); ++i)
|
||||
m_Bitmaps[i] =
|
||||
WxUtils::LoadScaledResourceBitmap(image_names[i], this, bitmap_size, wxDefaultSize,
|
||||
WxUtils::LSI_SCALE_DOWN | WxUtils::LSI_ALIGN_CENTER);
|
||||
InitializeThemedBitmaps();
|
||||
|
||||
AddTool(ID_DELETE, _("Delete"), m_Bitmaps[Toolbar_Delete]);
|
||||
Bind(wxEVT_TOOL, &CBreakPointWindow::OnDelete, parent, ID_DELETE);
|
||||
|
||||
AddTool(ID_CLEAR, _("Clear"), m_Bitmaps[Toolbar_Delete]);
|
||||
AddTool(ID_CLEAR, _("Clear"), m_Bitmaps[Toolbar_Clear]);
|
||||
Bind(wxEVT_TOOL, &CBreakPointWindow::OnClear, parent, ID_CLEAR);
|
||||
|
||||
AddTool(ID_ADDBP, "+BP", m_Bitmaps[Toolbar_Add_BP]);
|
||||
|
@ -57,32 +49,64 @@ public:
|
|||
AddTool(ID_ADDMC, "+MBP", m_Bitmaps[Toolbar_Add_MC]);
|
||||
Bind(wxEVT_TOOL, &CBreakPointWindow::OnAddMemoryCheck, parent, ID_ADDMC);
|
||||
|
||||
AddTool(ID_LOAD, _("Load"), m_Bitmaps[Toolbar_Delete]);
|
||||
AddTool(ID_LOAD, _("Load"), m_Bitmaps[Toolbar_Load]);
|
||||
Bind(wxEVT_TOOL, &CBreakPointWindow::Event_LoadAll, parent, ID_LOAD);
|
||||
|
||||
AddTool(ID_SAVE, _("Save"), m_Bitmaps[Toolbar_Delete]);
|
||||
AddTool(ID_SAVE, _("Save"), m_Bitmaps[Toolbar_Save]);
|
||||
Bind(wxEVT_TOOL, &CBreakPointWindow::Event_SaveAll, parent, ID_SAVE);
|
||||
}
|
||||
|
||||
void ReloadBitmaps()
|
||||
{
|
||||
Freeze();
|
||||
|
||||
InitializeThemedBitmaps();
|
||||
for (int i = 0; i < ID_NUM; ++i)
|
||||
SetToolBitmap(i, m_Bitmaps[i]);
|
||||
|
||||
Thaw();
|
||||
}
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
Toolbar_Delete,
|
||||
Toolbar_Delete = 0,
|
||||
Toolbar_Clear,
|
||||
Toolbar_Add_BP,
|
||||
Toolbar_Add_MC,
|
||||
Toolbar_Load,
|
||||
Toolbar_Save,
|
||||
Num_Bitmaps
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ID_DELETE = 2000,
|
||||
ID_DELETE = 0,
|
||||
ID_CLEAR,
|
||||
ID_ADDBP,
|
||||
ID_ADDMC,
|
||||
ID_LOAD,
|
||||
ID_SAVE
|
||||
ID_SAVE,
|
||||
ID_NUM
|
||||
};
|
||||
|
||||
void InitializeThemedBitmaps()
|
||||
{
|
||||
wxSize bitmap_size = FromDIP(wxSize(24, 24));
|
||||
SetToolBitmapSize(bitmap_size);
|
||||
|
||||
static const std::array<const char* const, Num_Bitmaps> m_image_names{
|
||||
{"debugger_delete", "debugger_clear", "debugger_add_breakpoint", "debugger_add_memorycheck",
|
||||
"debugger_load", "debugger_save"}};
|
||||
|
||||
for (std::size_t i = 0; i < m_image_names.size(); ++i)
|
||||
{
|
||||
m_Bitmaps[i] =
|
||||
WxUtils::LoadScaledThemeBitmap(m_image_names[i], this, bitmap_size, wxDefaultSize,
|
||||
WxUtils::LSI_SCALE_DOWN | WxUtils::LSI_ALIGN_CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
wxBitmap m_Bitmaps[Num_Bitmaps];
|
||||
};
|
||||
|
||||
|
@ -97,7 +121,9 @@ CBreakPointWindow::CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent
|
|||
m_BreakPointListView = new CBreakPointView(this, wxID_ANY);
|
||||
m_BreakPointListView->Bind(wxEVT_LIST_ITEM_SELECTED, &CBreakPointWindow::OnSelectBP, this);
|
||||
|
||||
m_mgr.AddPane(new CBreakPointBar(this, wxID_ANY), wxAuiPaneInfo()
|
||||
m_breakpointBar = new CBreakPointBar(this, wxID_ANY);
|
||||
|
||||
m_mgr.AddPane(m_breakpointBar, wxAuiPaneInfo()
|
||||
.ToolbarPane()
|
||||
.Top()
|
||||
.LeftDockable(true)
|
||||
|
@ -118,6 +144,11 @@ void CBreakPointWindow::NotifyUpdate()
|
|||
m_BreakPointListView->Repopulate();
|
||||
}
|
||||
|
||||
void CBreakPointWindow::ReloadBitmaps()
|
||||
{
|
||||
m_breakpointBar->ReloadBitmaps();
|
||||
}
|
||||
|
||||
void CBreakPointWindow::OnDelete(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_BreakPointListView->DeleteCurrentSelection();
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
class CBreakPointView;
|
||||
class CCodeWindow;
|
||||
class wxListEvent;
|
||||
class CBreakPointBar;
|
||||
|
||||
class CBreakPointWindow : public wxPanel
|
||||
{
|
||||
|
@ -23,6 +24,7 @@ public:
|
|||
void NotifyUpdate();
|
||||
void SaveAll();
|
||||
void LoadAll();
|
||||
void ReloadBitmaps();
|
||||
|
||||
private:
|
||||
friend class CBreakPointBar;
|
||||
|
@ -38,4 +40,5 @@ private:
|
|||
wxAuiManager m_mgr;
|
||||
CBreakPointView* m_BreakPointListView;
|
||||
CCodeWindow* m_pCodeWindow;
|
||||
CBreakPointBar* m_breakpointBar;
|
||||
};
|
||||
|
|
|
@ -178,6 +178,13 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
|
|||
case IDM_UPDATE_JIT_PANE:
|
||||
RequirePanel<CJitWindow>()->ViewAddr(codeview->GetSelection());
|
||||
break;
|
||||
|
||||
case IDM_RELOAD_THEME_BITMAPS:
|
||||
if (HasPanel<CBreakPointWindow>())
|
||||
GetPanel<CBreakPointWindow>()->ReloadBitmaps();
|
||||
if (HasPanel<CWatchWindow>())
|
||||
GetPanel<CWatchWindow>()->ReloadBitmaps();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,33 +25,57 @@ public:
|
|||
: DolphinAuiToolBar(parent, id, wxDefaultPosition, wxDefaultSize,
|
||||
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT)
|
||||
{
|
||||
wxSize bitmap_size = FromDIP(wxSize(16, 16));
|
||||
SetToolBitmapSize(bitmap_size);
|
||||
InitialiseThemedBitmaps();
|
||||
|
||||
m_Bitmaps[Toolbar_File] = WxUtils::LoadScaledResourceBitmap(
|
||||
"toolbar_debugger_delete", this, bitmap_size, wxDefaultSize,
|
||||
WxUtils::LSI_SCALE_DOWN | WxUtils::LSI_ALIGN_CENTER);
|
||||
|
||||
AddTool(ID_LOAD, _("Load"), m_Bitmaps[Toolbar_File]);
|
||||
AddTool(ID_LOAD, _("Load"), m_Bitmaps[Toolbar_Load]);
|
||||
Bind(wxEVT_TOOL, &CWatchWindow::Event_LoadAll, parent, ID_LOAD);
|
||||
|
||||
AddTool(ID_SAVE, _("Save"), m_Bitmaps[Toolbar_File]);
|
||||
AddTool(ID_SAVE, _("Save"), m_Bitmaps[Toolbar_Save]);
|
||||
Bind(wxEVT_TOOL, &CWatchWindow::Event_SaveAll, parent, ID_SAVE);
|
||||
}
|
||||
|
||||
void ReloadBitmaps()
|
||||
{
|
||||
Freeze();
|
||||
|
||||
InitialiseThemedBitmaps();
|
||||
for (int i = 0; i < ID_NUM; ++i)
|
||||
SetToolBitmap(i, m_Bitmaps[i]);
|
||||
|
||||
Thaw();
|
||||
}
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
Toolbar_File,
|
||||
Toolbar_Load,
|
||||
Toolbar_Save,
|
||||
Num_Bitmaps
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ID_LOAD,
|
||||
ID_SAVE
|
||||
ID_LOAD = 0,
|
||||
ID_SAVE,
|
||||
ID_NUM
|
||||
};
|
||||
|
||||
void InitialiseThemedBitmaps()
|
||||
{
|
||||
wxSize bitmap_size = FromDIP(wxSize(24, 24));
|
||||
SetToolBitmapSize(bitmap_size);
|
||||
|
||||
static const std::array<const char* const, Num_Bitmaps> m_image_names{
|
||||
{"debugger_load", "debugger_save"}};
|
||||
|
||||
for (std::size_t i = 0; i < m_image_names.size(); ++i)
|
||||
{
|
||||
m_Bitmaps[i] =
|
||||
WxUtils::LoadScaledThemeBitmap(m_image_names[i], this, bitmap_size, wxDefaultSize,
|
||||
WxUtils::LSI_SCALE_DOWN | WxUtils::LSI_ALIGN_CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
wxBitmap m_Bitmaps[Num_Bitmaps];
|
||||
};
|
||||
|
||||
|
@ -64,7 +88,9 @@ CWatchWindow::CWatchWindow(wxWindow* parent, wxWindowID id, const wxPoint& posit
|
|||
|
||||
m_GPRGridView = new CWatchView(this);
|
||||
|
||||
m_mgr.AddPane(new CWatchToolbar(this, wxID_ANY), wxAuiPaneInfo()
|
||||
m_watch_toolbar = new CWatchToolbar(this, wxID_ANY);
|
||||
|
||||
m_mgr.AddPane(m_watch_toolbar, wxAuiPaneInfo()
|
||||
.ToolbarPane()
|
||||
.Top()
|
||||
.LeftDockable(true)
|
||||
|
@ -124,3 +150,8 @@ void CWatchWindow::LoadAll()
|
|||
|
||||
NotifyUpdate();
|
||||
}
|
||||
|
||||
void CWatchWindow::ReloadBitmaps()
|
||||
{
|
||||
m_watch_toolbar->ReloadBitmaps();
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <wx/panel.h>
|
||||
|
||||
class CWatchView;
|
||||
class CWatchToolbar;
|
||||
|
||||
class CWatchWindow : public wxPanel
|
||||
{
|
||||
|
@ -24,8 +25,10 @@ public:
|
|||
void SaveAll();
|
||||
void Event_LoadAll(wxCommandEvent& WXUNUSED(event));
|
||||
void LoadAll();
|
||||
void ReloadBitmaps();
|
||||
|
||||
private:
|
||||
CWatchToolbar* m_watch_toolbar;
|
||||
wxAuiManager m_mgr;
|
||||
|
||||
// Owned by wx. Deleted implicitly upon destruction.
|
||||
|
|
|
@ -1107,6 +1107,12 @@ void CFrame::OnReloadThemeBitmaps(wxCommandEvent& WXUNUSED(event))
|
|||
reload_event.SetEventObject(this);
|
||||
wxPostEvent(GetToolBar(), reload_event);
|
||||
|
||||
if (m_code_window)
|
||||
{
|
||||
wxCommandEvent evt(wxEVT_HOST_COMMAND, IDM_RELOAD_THEME_BITMAPS);
|
||||
m_code_window->GetEventHandler()->AddPendingEvent(evt);
|
||||
}
|
||||
|
||||
GameListRefresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -305,6 +305,7 @@ enum
|
|||
IDM_UPDATE_TITLE,
|
||||
IDM_UPDATE_BREAKPOINTS,
|
||||
IDM_UPDATE_JIT_PANE,
|
||||
IDM_RELOAD_THEME_BITMAPS,
|
||||
IDM_PANIC,
|
||||
IDM_KEYSTATE,
|
||||
IDM_WINDOW_SIZE_REQUEST,
|
||||
|
|
|
@ -98,13 +98,12 @@ void MainToolBar::InitializeThemeBitmaps()
|
|||
|
||||
void MainToolBar::InitializeDebuggerBitmaps()
|
||||
{
|
||||
m_icon_bitmaps.insert(
|
||||
{{TOOLBAR_DEBUG_STEP, CreateDebuggerBitmap("toolbar_debugger_step")},
|
||||
{TOOLBAR_DEBUG_STEPOVER, CreateDebuggerBitmap("toolbar_debugger_step_over")},
|
||||
{TOOLBAR_DEBUG_STEPOUT, CreateDebuggerBitmap("toolbar_debugger_step_out")},
|
||||
{TOOLBAR_DEBUG_SKIP, CreateDebuggerBitmap("toolbar_debugger_skip")},
|
||||
{TOOLBAR_DEBUG_GOTOPC, CreateDebuggerBitmap("toolbar_debugger_goto_pc")},
|
||||
{TOOLBAR_DEBUG_SETPC, CreateDebuggerBitmap("toolbar_debugger_set_pc")}});
|
||||
m_icon_bitmaps.insert({{TOOLBAR_DEBUG_STEP, CreateBitmap("debugger_step_in")},
|
||||
{TOOLBAR_DEBUG_STEPOVER, CreateBitmap("debugger_step_over")},
|
||||
{TOOLBAR_DEBUG_STEPOUT, CreateBitmap("debugger_step_out")},
|
||||
{TOOLBAR_DEBUG_SKIP, CreateBitmap("debugger_skip")},
|
||||
{TOOLBAR_DEBUG_GOTOPC, CreateBitmap("debugger_show_pc")},
|
||||
{TOOLBAR_DEBUG_SETPC, CreateBitmap("debugger_set_pc")}});
|
||||
}
|
||||
|
||||
wxBitmap MainToolBar::CreateBitmap(const std::string& name) const
|
||||
|
@ -112,14 +111,6 @@ wxBitmap MainToolBar::CreateBitmap(const std::string& name) const
|
|||
return WxUtils::LoadScaledThemeBitmap(name, this, GetToolBitmapSize());
|
||||
}
|
||||
|
||||
wxBitmap MainToolBar::CreateDebuggerBitmap(const std::string& name) const
|
||||
{
|
||||
constexpr auto scale_flags = WxUtils::LSI_SCALE_DOWN | WxUtils::LSI_ALIGN_CENTER;
|
||||
|
||||
return WxUtils::LoadScaledResourceBitmap(name, this, GetToolBitmapSize(), wxDefaultSize,
|
||||
scale_flags);
|
||||
}
|
||||
|
||||
void MainToolBar::ApplyThemeBitmaps()
|
||||
{
|
||||
constexpr std::array<std::pair<int, ToolBarBitmapID>, 8> bitmap_entries{
|
||||
|
|
|
@ -60,7 +60,6 @@ private:
|
|||
void InitializeDebuggerBitmaps();
|
||||
|
||||
wxBitmap CreateBitmap(const std::string& name) const;
|
||||
wxBitmap CreateDebuggerBitmap(const std::string& name) const;
|
||||
|
||||
void ApplyThemeBitmaps();
|
||||
void ApplyDebuggerBitmaps();
|
||||
|
|
Loading…
Reference in New Issue