Fix a segmentation fault when changing perspectives.
[dolphin.git] / Source / Core / DebuggerWX / Src / CodeWindow.h
blob4d04eefec1a7c54783e4ad3dd2df36c79e38308d
1 // Copyright (C) 2003 Dolphin Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official SVN repository and contact information can be found at
16 // http://code.google.com/p/dolphin-emu/
19 #ifndef CODEWINDOW_H_
20 #define CODEWINDOW_H_
22 #include <wx/dialog.h>
23 #include <wx/textctrl.h>
24 #include <wx/listbox.h>
25 #include <wx/artprov.h>
27 #include "Thread.h"
28 #include "CoreParameter.h"
30 // GUI global
31 #include "../../DolphinWX/Src/Globals.h"
32 #include "../../DolphinWX/Src/Frame.h"
34 class CFrame;
35 class CRegisterWindow;
36 class CBreakPointWindow;
37 class CMemoryWindow;
38 class CJitWindow;
39 class CCodeView;
41 class CCodeWindow
42 : public wxPanel
44 public:
46 CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter,
47 CFrame * parent,
48 wxWindowID id = wxID_ANY,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 long style = wxTAB_TRAVERSAL,
52 const wxString& name = wxT("Code")
55 void Load();
56 void Save();
58 // Parent interaction
59 CFrame *Parent;
60 wxMenuBar * GetMenuBar();
61 wxAuiToolBar * GetToolBar();
62 wxBitmap m_Bitmaps[ToolbarDebugBitmapMax];
64 bool UseInterpreter();
65 bool BootToPause();
66 bool AutomaticStart();
67 bool JITNoBlockCache();
68 bool JITBlockLinking();
69 void JumpToAddress(u32 _Address);
71 void Update();
72 void NotifyMapLoaded();
73 void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter,
74 wxMenuBar * pMenuBar);
75 void CreateMenuView(wxMenuBar * pMenuBar, wxMenu*);
76 void CreateMenuOptions(wxMenuBar * pMenuBar, wxMenu*);
77 void CreateMenuSymbols();
78 void RecreateToolbar(wxAuiToolBar*);
79 void PopulateToolbar(wxAuiToolBar* toolBar);
80 void UpdateButtonStates();
81 void OpenPages();
82 void UpdateManager();
84 // Menu bar
85 // -------------------
86 void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
87 void OnJITOff(wxCommandEvent& event);
89 void OnToggleWindow(wxCommandEvent& event);
90 void ToggleCodeWindow(bool bShow);
91 void ToggleRegisterWindow(bool bShow);
92 void ToggleBreakPointWindow(bool bShow);
93 void ToggleMemoryWindow(bool bShow);
94 void ToggleJitWindow(bool bShow);
95 void ToggleDLLWindow(int Id, bool bShow);
97 void OnChangeFont(wxCommandEvent& event);
99 void OnCodeStep(wxCommandEvent& event);
100 void OnAddrBoxChange(wxCommandEvent& event);
101 void OnSymbolsMenu(wxCommandEvent& event);
102 void OnJitMenu(wxCommandEvent& event);
103 void OnProfilerMenu(wxCommandEvent& event);
105 // Sub dialogs
106 wxMenuBar* pMenuBar;
107 CRegisterWindow* m_RegisterWindow;
108 CBreakPointWindow* m_BreakpointWindow;
109 CMemoryWindow* m_MemoryWindow;
110 CJitWindow* m_JitWindow;
112 // Settings
113 bool bAutomaticStart; bool bBootToPause;
114 int iLogWindow;
115 int iConsoleWindow;
116 bool bCodeWindow; int iCodeWindow;
117 bool bRegisterWindow; int iRegisterWindow;
118 bool bBreakpointWindow; int iBreakpointWindow;
119 bool bMemoryWindow; int iMemoryWindow;
120 bool bJitWindow; int iJitWindow;
121 bool bSoundWindow; int iSoundWindow;
122 bool bVideoWindow; int iVideoWindow;
124 private:
126 enum
128 // Debugger GUI Objects
129 ID_CODEVIEW,
130 ID_CALLSTACKLIST,
131 ID_CALLERSLIST,
132 ID_CALLSLIST,
133 ID_SYMBOLLIST
136 void OnSymbolListChange(wxCommandEvent& event);
137 void OnSymbolListContextMenu(wxContextMenuEvent& event);
138 void OnCallstackListChange(wxCommandEvent& event);
139 void OnCallersListChange(wxCommandEvent& event);
140 void OnCallsListChange(wxCommandEvent& event);
141 void OnCodeViewChange(wxCommandEvent &event);
142 void SingleCPUStep();
143 void OnHostMessage(wxCommandEvent& event);
145 void UpdateLists();
146 void UpdateCallstack();
147 void OnKeyDown(wxKeyEvent& event);
149 void InitBitmaps();
150 void CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter);
152 wxMenuItem* jitblocklinking, *jitnoblockcache, *jitoff;
153 wxMenuItem* jitlsoff, *jitlslxzoff, *jitlslwzoff, *jitlslbzxoff;
154 wxMenuItem* jitlspoff;
155 wxMenuItem* jitlsfoff;
156 wxMenuItem* jitfpoff;
157 wxMenuItem* jitioff;
158 wxMenuItem* jitpoff;
159 wxMenuItem* jitsroff;
161 std::string fontDesc;
163 CCodeView* codeview;
164 wxListBox* callstack;
165 wxListBox* symbols;
166 wxListBox* callers;
167 wxListBox* calls;
168 Common::Event sync_event;
170 DECLARE_EVENT_TABLE()
173 #endif // CODEWINDOW_H_