My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#include "Debuggers.h"

void DbgDisas::MouseWheel(Point, int zdelta, dword)
{
sb.Wheel(zdelta);
}

Size DbgDisas::GetBox() const
{
return GetTextSize("12345678", Courier(12));
}

void DbgDisas::Layout()
{
sb.SetPage(GetSize().cy / GetBox().cy);
}

void DbgDisas::Paint(Draw& w)
{
Size sz = GetSize();
Size box = GetBox();
int i = sb;
int y = 0;
while(i < inst.GetCount() && y < sz.cy) {
Inst& n = inst[i];
Color ink = HasFocus() && i == cursor ? SColorPaper : SColorText;
int x = 0;
w.DrawRect(0, y, sz.cx, box.cy, i == cursor ? HasFocus() ? SColorHighlight : SColorFace
: SColorPaper);
if(sz.cx > 3 * box.cx) {
w.DrawText(0, y, Sprintf("%08X", addr[i]), Courier(12),
HasFocus() && i == cursor ? SColorPaper
: taddr.Find(addr[i]) >= 0 ? LtRed : SColorText);
x += box.cx;
}
if(i == ip)
DrawHighlightImage(w, x + 2, y + (box.cy - 12) / 2, ipimg);
x += 18;
w.DrawText(x, y, n.code, StdFont(12), ink);
w.DrawText(x + codecx, y, n.args, StdFont(12), ink);
y += box.cy;
i++;
}
w.DrawRect(0, y, sz.cx, sz.cy, SColorPaper);
}

void DbgDisas::LeftDown(Point p, dword)
{
SetFocus();
cursor = minmax(p.y / GetBox().cy + sb, 0, addr.GetCount() - 1);
WhenCursor();
Refresh();
}

bool DbgDisas::Key(dword key, int)
{
int p = GetSize().cy / GetBox().cy;
switch(key) {
case K_UP:
cursor--;
break;
case K_DOWN:
cursor++;
break;
case K_HOME:
cursor = 0;
break;
case K_END:
cursor = INT_MAX;
break;
case K_PAGEUP:
cursor -= p;
break;
case K_PAGEDOWN:
cursor += p;
break;
default:
return false;
}
cursor = minmax(cursor, 0, addr.GetCount() - 1);
sb.ScrollInto(cursor);
Refresh();
WhenCursor();
return true;
}

void DbgDisas::Clear()
{
low = 0xffffffff;
high = 0;
cursor = -1;
inst.Clear();
taddr.Clear();
addr.Clear();
codecx = GetTextSize("movlmo", StdFont(12)).cx;
}

void DbgDisas::Add(adr_t adr, const String& code, const String& args)
{
if(adr < low)
low = adr;
if(adr > high)
high = adr;
addr.Add(adr);
Inst& n = inst.Add();
n.code = code;
n.args = args;
sb.SetTotal(inst.GetCount());
Refresh();
int cx = GetTextSize(n.code, StdFont(12)).cx;
if(cx > codecx)
codecx = cx;
}

void DbgDisas::Scroll()
{
Refresh();
}

void DbgDisas::SetCursor(adr_t adr)
{
cursor = addr.Find(adr);
if(cursor >= 0)
sb.ScrollInto(cursor);
Refresh();
}

void DbgDisas::SetIp(adr_t adr, const Image& img)
{
ip = addr.Find(adr);
ipimg = img;
Refresh();
}

void DbgDisas::GotFocus()
{
WhenFocus();
Refresh();
}

void DbgDisas::LostFocus()
{
WhenFocus();
Refresh();
}

void DbgDisas::WriteClipboard()
{
String s;
for(int i = 0; i < addr.GetCount(); i++)
s << Format("%08X ", (int)addr[i]) << inst[i].code << " " << inst[i].args << "\n";
WriteClipboardText(s);
}

DbgDisas::DbgDisas()
{
SetFrame(InsetFrame());
AddFrame(sb);
sb.WhenScroll = THISBACK(Scroll);
low = high = 0;
}

Change log

r4546 by micio on Feb 4, 2012   Diff
ide/Debuggers : fixed disassembly pane
text size for GUI non-standard font size
12
Go to: 
Project members, sign in to write a code review

Older revisions

r281 by mdelfede on Jun 7, 2008   Diff
changed svn layout
r216 by mdelfede on Apr 17, 2008   Diff
new uvs2 releases : uppsrc-2516
tutorial-38  examples-140
reference-110
r61 by unodgs on Jul 15, 2007   Diff
[No log message]
All revisions of this file

File info

Size: 2969 bytes, 161 lines

File properties

svn:eol-style
native
Powered by Google Project Hosting