1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
// license:BSD-3-Clause
// copyright-holders:Aaron Giles, Vas Crabb
//============================================================
//
// pointswininfo.c - Win32 debug window handling
//
//============================================================
#include "pointswininfo.h"
#include "debugviewinfo.h"
#include "winutf8.h"
pointswin_info::pointswin_info(debugger_windows_interface &debugger) :
debugwin_info(debugger, false, std::string("All Breakpoints").c_str(), NULL)
{
if (!window())
return;
m_views[0].reset(global_alloc(debugview_info(debugger, *this, window(), DVT_BREAK_POINTS)));
if ((m_views[0] == NULL) || !m_views[0]->is_valid())
{
m_views[0].reset();
return;
}
// create the options menu
HMENU const optionsmenu = CreatePopupMenu();
AppendMenu(optionsmenu, MF_ENABLED, ID_SHOW_BREAKPOINTS, TEXT("Breakpoints\tCtrl+1"));
AppendMenu(optionsmenu, MF_ENABLED, ID_SHOW_WATCHPOINTS, TEXT("Watchpoints\tCtrl+2"));
AppendMenu(GetMenu(window()), MF_ENABLED | MF_POPUP, (UINT_PTR)optionsmenu, TEXT("Options"));
// compute a client rect
RECT bounds;
bounds.top = bounds.left = 0;
bounds.right = m_views[0]->maxwidth() + (2 * EDGE_WIDTH);
bounds.bottom = 200;
AdjustWindowRectEx(&bounds, DEBUG_WINDOW_STYLE, FALSE, DEBUG_WINDOW_STYLE_EX);
// clamp the min/max size
set_maxwidth(bounds.right - bounds.left);
// position the window at the bottom-right
SetWindowPos(window(), HWND_TOP, 100, 100, bounds.right - bounds.left, bounds.bottom - bounds.top, SWP_SHOWWINDOW);
// recompute the children
recompute_children();
}
pointswin_info::~pointswin_info()
{
}
bool pointswin_info::handle_key(WPARAM wparam, LPARAM lparam)
{
if (GetAsyncKeyState(VK_CONTROL) & 0x8000)
{
switch (wparam)
{
case '1':
SendMessage(window(), WM_COMMAND, ID_SHOW_BREAKPOINTS, 0);
return true;
case '2':
SendMessage(window(), WM_COMMAND, ID_SHOW_WATCHPOINTS, 0);
return true;
}
}
return debugwin_info::handle_key(wparam, lparam);
}
void pointswin_info::update_menu()
{
debugwin_info::update_menu();
HMENU const menu = GetMenu(window());
CheckMenuItem(menu, ID_SHOW_BREAKPOINTS, MF_BYCOMMAND | (m_views[0]->type() == DVT_BREAK_POINTS ? MF_CHECKED : MF_UNCHECKED));
CheckMenuItem(menu, ID_SHOW_WATCHPOINTS, MF_BYCOMMAND | (m_views[0]->type() == DVT_WATCH_POINTS ? MF_CHECKED : MF_UNCHECKED));
}
bool pointswin_info::handle_command(WPARAM wparam, LPARAM lparam)
{
switch (HIWORD(wparam))
{
// menu selections
case 0:
switch (LOWORD(wparam))
{
case ID_SHOW_BREAKPOINTS:
m_views[0].reset();
m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_BREAK_POINTS)));
if (!m_views[0]->is_valid())
m_views[0].reset();
win_set_window_text_utf8(window(), "All Breakpoints");
recompute_children();
return true;
case ID_SHOW_WATCHPOINTS:
m_views[0].reset();
m_views[0].reset(global_alloc(debugview_info(debugger(), *this, window(), DVT_WATCH_POINTS)));
if (!m_views[0]->is_valid())
m_views[0].reset();
win_set_window_text_utf8(window(), "All Watchpoints");
recompute_children();
return true;
}
break;
}
return debugwin_info::handle_command(wparam, lparam);
}
|