trunk/src/osd/modules/debugger/win/debugwininfo.c
r243672 | r243673 | |
233 | 233 | return true; |
234 | 234 | } |
235 | 235 | break; |
| 236 | |
| 237 | case 'B': |
| 238 | if (GetAsyncKeyState(VK_CONTROL) & 0x8000) |
| 239 | { |
| 240 | SendMessage(m_wnd, WM_COMMAND, ID_NEW_POINTS_WND, 0); |
| 241 | return true; |
| 242 | } |
| 243 | break; |
236 | 244 | } |
237 | 245 | |
238 | 246 | return false; |
239 | 247 | } |
240 | 248 | |
241 | 249 | |
| 250 | void debugwin_info::recompute_children() |
| 251 | { |
| 252 | if (m_views[0] != NULL) |
| 253 | { |
| 254 | // compute a client rect |
| 255 | RECT bounds; |
| 256 | bounds.top = bounds.left = 0; |
| 257 | bounds.right = m_views[0]->prefwidth() + (2 * EDGE_WIDTH); |
| 258 | bounds.bottom = 200; |
| 259 | AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); |
| 260 | |
| 261 | // clamp the min/max size |
| 262 | set_maxwidth(bounds.right - bounds.left); |
| 263 | |
| 264 | // get the parent's dimensions |
| 265 | RECT parent; |
| 266 | GetClientRect(window(), &parent); |
| 267 | |
| 268 | // view gets the remaining space |
| 269 | InflateRect(&parent, -EDGE_WIDTH, -EDGE_WIDTH); |
| 270 | m_views[0]->set_bounds(parent); |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | |
242 | 275 | bool debugwin_info::handle_command(WPARAM wparam, LPARAM lparam) |
243 | 276 | { |
244 | 277 | if (HIWORD(wparam) == 0) |
r243672 | r243673 | |
257 | 290 | debugger().create_log_window(); |
258 | 291 | return true; |
259 | 292 | |
| 293 | case ID_NEW_POINTS_WND: |
| 294 | debugger().create_points_window(); |
| 295 | return true; |
| 296 | |
260 | 297 | case ID_RUN_AND_HIDE: |
261 | 298 | debugger().hide_all(); |
262 | 299 | case ID_RUN: |
r243672 | r243673 | |
484 | 521 | AppendMenu(debugmenu, MF_ENABLED, ID_NEW_MEMORY_WND, TEXT("New Memory Window\tCtrl+M")); |
485 | 522 | AppendMenu(debugmenu, MF_ENABLED, ID_NEW_DISASM_WND, TEXT("New Disassembly Window\tCtrl+D")); |
486 | 523 | AppendMenu(debugmenu, MF_ENABLED, ID_NEW_LOG_WND, TEXT("New Error Log Window\tCtrl+L")); |
| 524 | AppendMenu(debugmenu, MF_ENABLED, ID_NEW_POINTS_WND, TEXT("New (Break|Watch)points Window\tCtrl+B")); |
487 | 525 | AppendMenu(debugmenu, MF_DISABLED | MF_SEPARATOR, 0, TEXT("")); |
488 | 526 | AppendMenu(debugmenu, MF_ENABLED, ID_RUN, TEXT("Run\tF5")); |
489 | 527 | AppendMenu(debugmenu, MF_ENABLED, ID_RUN_AND_HIDE, TEXT("Run and Hide Debugger\tF12")); |
trunk/src/osd/modules/debugger/win/disasmbasewininfo.c
r243672 | r243673 | |
60 | 60 | { |
61 | 61 | case 'R': |
62 | 62 | SendMessage(window(), WM_COMMAND, ID_SHOW_RAW, 0); |
63 | | return 1; |
| 63 | return true; |
64 | 64 | |
65 | 65 | case 'E': |
66 | 66 | SendMessage(window(), WM_COMMAND, ID_SHOW_ENCRYPTED, 0); |
67 | | return 1; |
| 67 | return true; |
68 | 68 | |
69 | 69 | case 'N': |
70 | 70 | SendMessage(window(), WM_COMMAND, ID_SHOW_COMMENTS, 0); |
71 | | return 1; |
| 71 | return true; |
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
r243672 | r243673 | |
77 | 77 | /* ajg - steals the F4 from the global key handler - but ALT+F4 didn't work anyways ;) */ |
78 | 78 | case VK_F4: |
79 | 79 | SendMessage(window(), WM_COMMAND, ID_RUN_TO_CURSOR, 0); |
80 | | return 1; |
| 80 | return true; |
81 | 81 | |
82 | 82 | case VK_F9: |
83 | 83 | SendMessage(window(), WM_COMMAND, ID_TOGGLE_BREAKPOINT, 0); |
84 | | return 1; |
| 84 | return true; |
85 | 85 | |
86 | 86 | case VK_RETURN: |
87 | 87 | if (m_views[0]->cursor_visible()) |
88 | 88 | { |
89 | 89 | SendMessage(window(), WM_COMMAND, ID_STEP, 0); |
90 | | return 1; |
| 90 | return true; |
91 | 91 | } |
92 | 92 | break; |
93 | 93 | } |
r243672 | r243673 | |
100 | 100 | { |
101 | 101 | editwin_info::update_menu(); |
102 | 102 | |
| 103 | disasmview_info *const dasmview = downcast<disasmview_info *>(m_views[0].get()); |
103 | 104 | HMENU const menu = GetMenu(window()); |
104 | 105 | |
105 | | bool const disasm_cursor_visible = m_views[0]->cursor_visible(); |
| 106 | bool const disasm_cursor_visible = dasmview->cursor_visible(); |
| 107 | if (disasm_cursor_visible) |
| 108 | { |
| 109 | offs_t const address = dasmview->selected_address(); |
| 110 | device_debug *const debug = dasmview->source_device()->debug(); |
| 111 | INT32 bpindex = -1; |
| 112 | |
| 113 | // first find an existing breakpoint at this address |
| 114 | for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != NULL; bp = bp->next()) |
| 115 | { |
| 116 | if (address == bp->address()) |
| 117 | { |
| 118 | bpindex = bp->index(); |
| 119 | break; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | if (bpindex == -1) |
| 124 | ModifyMenu(menu, ID_TOGGLE_BREAKPOINT, MF_BYCOMMAND, ID_TOGGLE_BREAKPOINT, TEXT("Set breakpoint at cursor\tF9")); |
| 125 | else |
| 126 | ModifyMenu(menu, ID_TOGGLE_BREAKPOINT, MF_BYCOMMAND, ID_TOGGLE_BREAKPOINT, TEXT("Clear breakpoint at cursor\tF9")); |
| 127 | } |
| 128 | else |
| 129 | { |
| 130 | ModifyMenu(menu, ID_TOGGLE_BREAKPOINT, MF_BYCOMMAND, ID_TOGGLE_BREAKPOINT, TEXT("Toggle breakpoint at cursor\tF9")); |
| 131 | } |
106 | 132 | EnableMenuItem(menu, ID_TOGGLE_BREAKPOINT, MF_BYCOMMAND | (disasm_cursor_visible ? MF_ENABLED : MF_GRAYED)); |
107 | 133 | EnableMenuItem(menu, ID_RUN_TO_CURSOR, MF_BYCOMMAND | (disasm_cursor_visible ? MF_ENABLED : MF_GRAYED)); |
108 | 134 | |
109 | | disasm_right_column const rightcol = downcast<disasmview_info *>(m_views[0].get())->right_column(); |
| 135 | disasm_right_column const rightcol = dasmview->right_column(); |
110 | 136 | CheckMenuItem(menu, ID_SHOW_RAW, MF_BYCOMMAND | (rightcol == DASM_RIGHTCOL_RAW ? MF_CHECKED : MF_UNCHECKED)); |
111 | 137 | CheckMenuItem(menu, ID_SHOW_ENCRYPTED, MF_BYCOMMAND | (rightcol == DASM_RIGHTCOL_ENCRYPTED ? MF_CHECKED : MF_UNCHECKED)); |
112 | 138 | CheckMenuItem(menu, ID_SHOW_COMMENTS, MF_BYCOMMAND | (rightcol == DASM_RIGHTCOL_COMMENTS ? MF_CHECKED : MF_UNCHECKED)); |
r243672 | r243673 | |
123 | 149 | case 0: |
124 | 150 | switch (LOWORD(wparam)) |
125 | 151 | { |
126 | | case ID_SHOW_RAW: |
127 | | dasmview->set_right_column(DASM_RIGHTCOL_RAW); |
128 | | recompute_children(); |
129 | | return true; |
130 | | |
131 | | case ID_SHOW_ENCRYPTED: |
132 | | dasmview->set_right_column(DASM_RIGHTCOL_ENCRYPTED); |
133 | | recompute_children(); |
134 | | return true; |
135 | | |
136 | | case ID_SHOW_COMMENTS: |
137 | | dasmview->set_right_column(DASM_RIGHTCOL_COMMENTS); |
138 | | recompute_children(); |
139 | | return true; |
140 | | |
141 | | case ID_RUN_TO_CURSOR: |
142 | | if (dasmview->cursor_visible()) |
143 | | { |
144 | | offs_t const address = dasmview->selected_address(); |
145 | | if (dasmview->source_is_visible_cpu()) |
146 | | { |
147 | | astring command; |
148 | | command.printf("go 0x%X", address); |
149 | | debug_console_execute_command(machine(), command, 1); |
150 | | } |
151 | | else |
152 | | { |
153 | | dasmview->source_device()->debug()->go(address); |
154 | | } |
155 | | } |
156 | | return true; |
157 | | |
158 | 152 | case ID_TOGGLE_BREAKPOINT: |
159 | 153 | if (dasmview->cursor_visible()) |
160 | 154 | { |
r243672 | r243673 | |
162 | 156 | device_debug *const debug = dasmview->source_device()->debug(); |
163 | 157 | INT32 bpindex = -1; |
164 | 158 | |
165 | | /* first find an existing breakpoint at this address */ |
| 159 | // first find an existing breakpoint at this address |
166 | 160 | for (device_debug::breakpoint *bp = debug->breakpoint_first(); bp != NULL; bp = bp->next()) |
167 | 161 | { |
168 | 162 | if (address == bp->address()) |
r243672 | r243673 | |
172 | 166 | } |
173 | 167 | } |
174 | 168 | |
175 | | /* if it doesn't exist, add a new one */ |
| 169 | // if it doesn't exist, add a new one |
176 | 170 | if (dasmview->source_is_visible_cpu()) |
177 | 171 | { |
178 | 172 | astring command; |
r243672 | r243673 | |
199 | 193 | } |
200 | 194 | } |
201 | 195 | return true; |
| 196 | |
| 197 | case ID_RUN_TO_CURSOR: |
| 198 | if (dasmview->cursor_visible()) |
| 199 | { |
| 200 | offs_t const address = dasmview->selected_address(); |
| 201 | if (dasmview->source_is_visible_cpu()) |
| 202 | { |
| 203 | astring command; |
| 204 | command.printf("go 0x%X", address); |
| 205 | debug_console_execute_command(machine(), command, 1); |
| 206 | } |
| 207 | else |
| 208 | { |
| 209 | dasmview->source_device()->debug()->go(address); |
| 210 | } |
| 211 | } |
| 212 | return true; |
| 213 | |
| 214 | case ID_SHOW_RAW: |
| 215 | dasmview->set_right_column(DASM_RIGHTCOL_RAW); |
| 216 | recompute_children(); |
| 217 | return true; |
| 218 | |
| 219 | case ID_SHOW_ENCRYPTED: |
| 220 | dasmview->set_right_column(DASM_RIGHTCOL_ENCRYPTED); |
| 221 | recompute_children(); |
| 222 | return true; |
| 223 | |
| 224 | case ID_SHOW_COMMENTS: |
| 225 | dasmview->set_right_column(DASM_RIGHTCOL_COMMENTS); |
| 226 | recompute_children(); |
| 227 | return true; |
202 | 228 | } |
203 | 229 | break; |
204 | 230 | } |
trunk/src/osd/modules/debugger/win/logwininfo.c
r243672 | r243673 | |
27 | 27 | // compute a client rect |
28 | 28 | RECT bounds; |
29 | 29 | bounds.top = bounds.left = 0; |
30 | | bounds.right = m_views[0]->prefwidth() + (2 * EDGE_WIDTH); |
| 30 | bounds.right = m_views[0]->maxwidth() + (2 * EDGE_WIDTH); |
31 | 31 | bounds.bottom = 200; |
32 | 32 | AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); |
33 | 33 | |
r243672 | r243673 | |
45 | 45 | logwin_info::~logwin_info() |
46 | 46 | { |
47 | 47 | } |
48 | | |
49 | | |
50 | | void logwin_info::recompute_children() |
51 | | { |
52 | | // compute a client rect |
53 | | RECT bounds; |
54 | | bounds.top = bounds.left = 0; |
55 | | bounds.right = m_views[0]->maxwidth() + (2 * EDGE_WIDTH); |
56 | | bounds.bottom = 200; |
57 | | AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); |
58 | | |
59 | | // clamp the min/max size |
60 | | set_maxwidth(bounds.right - bounds.left); |
61 | | |
62 | | // get the parent's dimensions |
63 | | RECT parent; |
64 | | GetClientRect(window(), &parent); |
65 | | |
66 | | // view gets the remaining space |
67 | | InflateRect(&parent, -EDGE_WIDTH, -EDGE_WIDTH); |
68 | | m_views[0]->set_bounds(parent); |
69 | | } |
trunk/src/osd/modules/debugger/win/pointswininfo.c
r0 | r243673 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:Aaron Giles, Vas Crabb |
| 3 | //============================================================ |
| 4 | // |
| 5 | // pointswininfo.c - Win32 debug window handling |
| 6 | // |
| 7 | //============================================================ |
| 8 | |
| 9 | #include "pointswininfo.h" |
| 10 | |
| 11 | #include "debugviewinfo.h" |
| 12 | |
| 13 | #include "winutf8.h" |
| 14 | |
| 15 | |
| 16 | pointswin_info::pointswin_info(debugger_windows_interface &debugger) : |
| 17 | debugwin_info(debugger, false, astring("All Breakpoints"), NULL) |
| 18 | { |
| 19 | if (!window()) |
| 20 | return; |
| 21 | |
| 22 | m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_BREAK_POINTS))); |
| 23 | if ((m_views[0] == NULL) || !m_views[0]->is_valid()) |
| 24 | { |
| 25 | m_views[0].reset(); |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | // create the options menu |
| 30 | HMENU const optionsmenu = CreatePopupMenu(); |
| 31 | AppendMenu(optionsmenu, MF_ENABLED, ID_SHOW_BREAKPOINTS, TEXT("Breakpoints\tCtrl+1")); |
| 32 | AppendMenu(optionsmenu, MF_ENABLED, ID_SHOW_WATCHPOINTS, TEXT("Watchpoints\tCtrl+2")); |
| 33 | AppendMenu(GetMenu(window()), MF_ENABLED | MF_POPUP, (UINT_PTR)optionsmenu, TEXT("Options")); |
| 34 | |
| 35 | // compute a client rect |
| 36 | RECT bounds; |
| 37 | bounds.top = bounds.left = 0; |
| 38 | bounds.right = m_views[0]->maxwidth() + (2 * EDGE_WIDTH); |
| 39 | bounds.bottom = 200; |
| 40 | AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX); |
| 41 | |
| 42 | // clamp the min/max size |
| 43 | set_maxwidth(bounds.right - bounds.left); |
| 44 | |
| 45 | // position the window at the bottom-right |
| 46 | SetWindowPos(window(), HWND_TOP, 100, 100, bounds.right - bounds.left, bounds.bottom - bounds.top, SWP_SHOWWINDOW); |
| 47 | |
| 48 | // recompute the children |
| 49 | recompute_children(); |
| 50 | } |
| 51 | |
| 52 | |
| 53 | pointswin_info::~pointswin_info() |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | |
| 58 | bool pointswin_info::handle_key(WPARAM wparam, LPARAM lparam) |
| 59 | { |
| 60 | if (GetAsyncKeyState(VK_CONTROL) & 0x8000) |
| 61 | { |
| 62 | switch (wparam) |
| 63 | { |
| 64 | case '1': |
| 65 | SendMessage(window(), WM_COMMAND, ID_SHOW_BREAKPOINTS, 0); |
| 66 | return true; |
| 67 | |
| 68 | case '2': |
| 69 | SendMessage(window(), WM_COMMAND, ID_SHOW_WATCHPOINTS, 0); |
| 70 | return true; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | return debugwin_info::handle_key(wparam, lparam); |
| 75 | } |
| 76 | |
| 77 | |
| 78 | void pointswin_info::update_menu() |
| 79 | { |
| 80 | debugwin_info::update_menu(); |
| 81 | |
| 82 | HMENU const menu = GetMenu(window()); |
| 83 | CheckMenuItem(menu, ID_SHOW_BREAKPOINTS, MF_BYCOMMAND | (m_views[0]->type() == DVT_BREAK_POINTS ? MF_CHECKED : MF_UNCHECKED)); |
| 84 | CheckMenuItem(menu, ID_SHOW_WATCHPOINTS, MF_BYCOMMAND | (m_views[0]->type() == DVT_WATCH_POINTS ? MF_CHECKED : MF_UNCHECKED)); |
| 85 | } |
| 86 | |
| 87 | |
| 88 | bool pointswin_info::handle_command(WPARAM wparam, LPARAM lparam) |
| 89 | { |
| 90 | switch (HIWORD(wparam)) |
| 91 | { |
| 92 | // menu selections |
| 93 | case 0: |
| 94 | switch (LOWORD(wparam)) |
| 95 | { |
| 96 | case ID_SHOW_BREAKPOINTS: |
| 97 | m_views[0].reset(); |
| 98 | m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_BREAK_POINTS))); |
| 99 | if (!m_views[0]->is_valid()) |
| 100 | m_views[0].reset(); |
| 101 | win_set_window_text_utf8(window(), "All Breakpoints"); |
| 102 | recompute_children(); |
| 103 | return true; |
| 104 | |
| 105 | case ID_SHOW_WATCHPOINTS: |
| 106 | m_views[0].reset(); |
| 107 | m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_WATCH_POINTS))); |
| 108 | if (!m_views[0]->is_valid()) |
| 109 | m_views[0].reset(); |
| 110 | win_set_window_text_utf8(window(), "All Watchpoints"); |
| 111 | recompute_children(); |
| 112 | return true; |
| 113 | } |
| 114 | break; |
| 115 | } |
| 116 | return debugwin_info::handle_command(wparam, lparam); |
| 117 | } |