-
Notifications
You must be signed in to change notification settings - Fork 225
/
TabRTTIs.cpp
154 lines (145 loc) · 5.24 KB
/
TabRTTIs.cpp
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
//---------------------------------------------------------------------------
int __fastcall SortRTTIsByAdr(void *item1, void *item2)
{
PTypeRec rec1 = (PTypeRec)item1;
PTypeRec rec2 = (PTypeRec)item2;
if (rec1->adr > rec2->adr) return 1;
if (rec1->adr < rec2->adr) return -1;
return 0;
}
//---------------------------------------------------------------------------
int __fastcall SortRTTIsByKnd(void *item1, void *item2)
{
PTypeRec rec1 = (PTypeRec)item1;
PTypeRec rec2 = (PTypeRec)item2;
if (rec1->kind > rec2->kind) return 1;
if (rec1->kind < rec2->kind) return -1;
return CompareText(rec1->name, rec2->name);
}
//---------------------------------------------------------------------------
int __fastcall SortRTTIsByNam(void *item1, void *item2)
{
PTypeRec rec1 = (PTypeRec)item1;
PTypeRec rec2 = (PTypeRec)item2;
return CompareText(rec1->name, rec2->name);
}
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::ShowRTTIs()
{
lbRTTIs->Clear();
//as
lbRTTIs->Items->BeginUpdate();
if (OwnTypeList->Count)
{
switch (RTTISortField)
{
case 0:
OwnTypeList->Sort(SortRTTIsByAdr);
break;
case 1:
OwnTypeList->Sort(SortRTTIsByKnd);
break;
case 2:
OwnTypeList->Sort(SortRTTIsByNam);
break;
}
}
int wid, maxwid = 0;
TCanvas *canvas = lbUnits->Canvas;
String line;
for (int n = 0; n < OwnTypeList->Count; n++)
{
PTypeRec recT = (PTypeRec)OwnTypeList->Items[n];
if (recT->kind == ikVMT)
line = Val2Str8(recT->adr) + " <VMT> " + recT->name;
else
line = Val2Str8(recT->adr) + " <" + TypeKind2Name(recT->kind) + "> " + recT->name;
lbRTTIs->Items->Add(line);
wid = canvas->TextWidth(line); if (wid > maxwid) maxwid = wid;
}
lbRTTIs->Items->EndUpdate();
lbRTTIs->ScrollWidth = maxwid + 2;
}
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::lbRTTIsDblClick(TObject *Sender)
{
DWORD adr;
char tkName[32], typeName[1024];
sscanf(lbRTTIs->Items->Strings[lbRTTIs->ItemIndex].c_str(), "%lX%s%s", &adr, tkName, typeName);
String name = String(tkName);
if (SameText(name, "<VMT>") && tsClassView->TabVisible)
{
ShowClassViewer(adr);
return;
}
FTypeInfo_11011981->ShowRTTI(adr);
}
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::lbRTTIsMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
if (lbRTTIs->CanFocus()) ActiveControl = lbRTTIs;
}
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::lbRTTIsClick(TObject *Sender)
{
RTTIsSearchFrom = lbRTTIs->ItemIndex;
WhereSearch = SEARCH_RTTIS;
}
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::lbRTTIsKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Key == VK_RETURN) lbRTTIsDblClick(Sender);
}
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::miSearchRTTIClick(TObject *Sender)
{
WhereSearch = SEARCH_RTTIS;
FindDlg_11011981->cbText->Clear();
for (int n = 0; n < RTTIsSearchList->Count; n++)
FindDlg_11011981->cbText->AddItem(RTTIsSearchList->Strings[n], 0);
if (FindDlg_11011981->ShowModal() == mrOk && FindDlg_11011981->cbText->Text != "")
{
if (lbRTTIs->ItemIndex < 0)
RTTIsSearchFrom = 0;
else
RTTIsSearchFrom = lbRTTIs->ItemIndex;
RTTIsSearchText = FindDlg_11011981->cbText->Text;
if (RTTIsSearchList->IndexOf(RTTIsSearchText) == -1) RTTIsSearchList->Add(RTTIsSearchText);
FindText(RTTIsSearchText);
}
}
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::pmRTTIsPopup(TObject *Sender)
{
if (lbRTTIs->ItemIndex < 0) return;
}
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::miSortRTTIsByAdrClick(TObject *Sender)
{
miSortRTTIsByAdr->Checked = true;
miSortRTTIsByKnd->Checked = false;
miSortRTTIsByNam->Checked = false;
RTTISortField = 0;
ShowRTTIs();
}
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::miSortRTTIsByKndClick(TObject *Sender)
{
miSortRTTIsByAdr->Checked = false;
miSortRTTIsByKnd->Checked = true;
miSortRTTIsByNam->Checked = false;
RTTISortField = 1;
ShowRTTIs();
}
//---------------------------------------------------------------------------
void __fastcall TFMain_11011981::miSortRTTIsByNamClick(TObject *Sender)
{
miSortRTTIsByAdr->Checked = false;
miSortRTTIsByKnd->Checked = false;
miSortRTTIsByNam->Checked = true;
RTTISortField = 2;
ShowRTTIs();
}
//---------------------------------------------------------------------------