-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUI.cpp
More file actions
172 lines (156 loc) · 3.12 KB
/
Copy pathUI.cpp
File metadata and controls
172 lines (156 loc) · 3.12 KB
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
162
163
164
165
166
167
168
169
170
171
172
#include "pch.h"
#include "ConfigStore.h"
#include "UI.h"
#ifndef _TEST
UI::~UI()
{
for (auto obj : si_vect) {
if (obj != nullptr) {
delete obj;
}
}
si_vect.clear();
}
void UI::dumpsingle()
{
auto* si = new sample_info_t();
Dumper dumper(*si);
if (!dumper.start(false))
{
display(*si);
si_vect.push_back(si);
}
else
delete si;
};
void UI::dumprecursive()
{
auto* si = new sample_info_t();
Dumper dumper(*si);
if (!dumper.start(true))
{
display(*si);
si_vect.push_back(si);
}
else
delete si;
};
void UI::dumpselecteddata()
{
auto* si = new sample_info_t();
Dumper dumper(*si);
dumper.dump_data_var();
display(*si);
si_vect.push_back(si);
};
void UI::dumpalldatas()
{
auto* si = new sample_info_t();
Dumper dumper(*si);
dumper.dump_all_data();
display(*si);
si_vect.push_back(si);
};
static int idaapi modcb(int fid, form_actions_t& fa)
{
//switch (fid)
//{
//case CB_INIT:
// //initializing
// break;
//case CB_YES:
// //terminating
// break;
//case 3: // fasm
// //()
// break;
//case 4: // fasmg
// break;
//default:
// DEBUG_MSG("unknown id %d\n", fid);
// break;
//}
return 1;
}
void UI::settings_menu()
{
//static const char form[] =
// "STARTITEM 0\n\n"
// "%*"
// "Chose assembler type:\n\n"
// "<IDA_asm: R1>"
// "<fasm: R2>"
// "<fasmg: R3>>\n"
// "\n";
const char* form = ([]() {
qstring _form =
"STARTITEM 0\n"
"FASM-ASM settings\n"
"\n"
"Chose assembler type:\n"
"\n"
;
int i, length = sizeof(config_asm_type_strings) / sizeof(config_asm_type_strings[0]);
char buffer[MAXSTR];
for (i = 0; i < length; i++) {
qsnprintf(buffer, sizeof(buffer), "<%s:R>", config_asm_type_strings[i]);
_form += buffer;
if (i == length - 1) {
_form += ">";
}
_form += "\n";
}
_form += "\n";
return _form;
})().c_str();
ushort asm_type = config.asm_type();
if (ask_form(form, &asm_type) > 0)
{
config.asm_type = (ConfigAsmType)asm_type;
}
};
static void idaapi cv_popup(TWidget* cv, void* ud) {
attach_action_to_popup(cv, NULL, "rithien:data_selectall", NULL, SETMENU_FIRST);
};
static const custom_viewer_handlers_t handlers(
NULL, //keyboard
cv_popup, //popup
NULL, //mouse_moved
NULL, //click
NULL, //dblclick
NULL, //curpos
NULL, //close
NULL, //help
NULL, //adjust_place
NULL, //get_place_xcoord
NULL, //location_changed
NULL //can_navigate
);
//void DisplayFct::show_var()
//{
// for (auto vt = varline.begin(); vt != varline.end(); ++vt) {
// const char* s = vt->line.c_str();
// msg("%s\n", s);
// }
// //varline.clear();
//}
//
//
////show dump tab [TODO] colorize
void UI::display(sample_info_t& si)
{
si.cv = find_widget(si.name.c_str());
if (si.cv != NULL) {
// activate_widget(widget, true);
close_widget(si.cv, WCLS_SAVE);
}
si.sv.insert(si.sv.end(), si.vv.begin(), si.vv.end());
simpleline_place_t s1;
simpleline_place_t s2(si.sv.size() - 1);
si.cv = create_custom_viewer(si.name.c_str(), &s1, &s2, &s1, NULL, &si.sv, &handlers, this);
TWidget* cw = create_code_viewer(si.cv);
set_code_viewer_is_source(cw);
display_widget(cw, WOPN_DP_TAB | WOPN_RESTORE);
//activate_widget(cw, true);}
}
#endif // ! _TEST