// Copyright 2008 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include #include #include #include "Common/CommonTypes.h" #include "Common/Event.h" #include "DolphinWX/Globals.h" class CCodeView; class CFrame; struct SConfig; class CBreakPointWindow; class CRegisterWindow; class CWatchWindow; class CMemoryWindow; class CJitWindow; class DSPDebuggerLLE; class GFXDebuggerPanel; class DolphinAuiToolBar; class wxListBox; class wxMenu; class wxMenuBar; class wxSearchCtrl; class wxToolBar; namespace Details { template struct DebugPanelToID; template <> struct DebugPanelToID { static constexpr int ID = IDM_BREAKPOINT_WINDOW; }; template <> struct DebugPanelToID { static constexpr int ID = IDM_REGISTER_WINDOW; }; template <> struct DebugPanelToID { static constexpr int ID = IDM_WATCH_WINDOW; }; template <> struct DebugPanelToID { static constexpr int ID = IDM_MEMORY_WINDOW; }; template <> struct DebugPanelToID { static constexpr int ID = IDM_JIT_WINDOW; }; template <> struct DebugPanelToID { static constexpr int ID = IDM_SOUND_WINDOW; }; template <> struct DebugPanelToID { static constexpr int ID = IDM_VIDEO_WINDOW; }; } class CCodeWindow : public wxPanel { public: explicit CCodeWindow(CFrame* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL | wxBORDER_NONE, const wxString& name = _("Code")); ~CCodeWindow(); void Load(); void Save(); bool JumpToAddress(u32 address); void Repopulate(bool refresh_codeview = true); void NotifyMapLoaded(); void OpenPages(); // FIXME: This belongs in a separate class. void TogglePanel(int id, bool show); wxPanel* GetUntypedPanel(int id) const; bool HasUntypedPanel(int id) const { return GetUntypedPanel(id) != nullptr; } template T* GetPanel() const { return static_cast(GetUntypedPanel(Details::DebugPanelToID::ID)); } template bool HasPanel() const { return HasUntypedPanel(Details::DebugPanelToID::ID); } template T* RequirePanel() { if (T* p = GetPanel()) return p; TogglePanel(Details::DebugPanelToID::ID, true); return GetPanel(); } // Settings bool bShowOnStart[IDM_DEBUG_WINDOW_LIST_END - IDM_DEBUG_WINDOW_LIST_START]; int iNbAffiliation[IDM_DEBUG_WINDOW_LIST_END - IDM_DEBUG_WINDOW_LIST_START]; private: wxMenuBar* GetParentMenuBar(); void OnCPUMode(wxCommandEvent& event); void OnChangeFont(wxCommandEvent& event); void OnCodeStep(wxCommandEvent& event); void OnAddrBoxChange(wxCommandEvent& event); void OnSymbolFilterText(wxCommandEvent& event); void OnSymbolsMenu(wxCommandEvent& event); void OnJitMenu(wxCommandEvent& event); void OnProfilerMenu(wxCommandEvent& event); void OnBootToPauseSelected(wxCommandEvent& event); void OnAutomaticStartSelected(wxCommandEvent& event); void OnSymbolListChange(wxCommandEvent& event); void OnCallstackListChange(wxCommandEvent& event); void OnCallersListChange(wxCommandEvent& event); void OnCallsListChange(wxCommandEvent& event); void OnCodeViewChange(wxCommandEvent& event); void OnHostMessage(wxCommandEvent& event); // Debugger functions void SingleStep(); void StepOver(); void StepOut(); void ToggleBreakpoint(); void UpdateFonts(); void UpdateLists(); void UpdateCallstack(); void ReloadSymbolListBox(); wxPanel* CreateSiblingPanel(int id); // Sibling debugger panels // FIXME: This obviously belongs in some manager class above this one. std::array m_sibling_panels{}; CFrame* Parent; CCodeView* codeview; wxSearchCtrl* m_symbol_filter_ctrl; wxListBox* callstack; wxListBox* symbols; wxListBox* callers; wxListBox* calls; Common::Event sync_event; wxAuiManager m_aui_manager; DolphinAuiToolBar* m_aui_toolbar; };