1 /*
2  * TilEm II
3  *
4  * Copyright (c) 2011-2012 Benjamin Moody
5  *
6  * This program is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation, either version 3 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 G_BEGIN_DECLS
21 
22 #define TILEM_TYPE_DISASM_VIEW           (tilem_disasm_view_get_type())
23 #define TILEM_DISASM_VIEW(obj)           (G_TYPE_CHECK_INSTANCE_CAST((obj), TILEM_TYPE_DISASM_VIEW, TilemDisasmView))
24 #define TILEM_DISASM_VIEW_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST((cls), TILEM_TYPE_DISASM_VIEW, TilemDisasmViewClass))
25 #define TILEM_IS_DISASM_VIEW(obj)        (G_TYPE_CHECK_INSTANCE_TYPE((obj), TILEM_TYPE_DISASM_VIEW))
26 #define TILEM_IS_DISASM_VIEW_CLASS(cls)  (G_TYPE_CHECK_CLASS_TYPE((cls), TILEM_TYPE_DISASM_VIEW))
27 #define TILEM_DISASM_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TILEM_TYPE_DISASM_VIEW, TilemDisasmViewClass))
28 
29 typedef struct _TilemDisasmView {
30 	GtkTreeView parent;
31 
32 	TilemDebugger *dbg;
33 
34 	gboolean use_logical;
35 
36 	int base_height;  /* base height of tree view */
37 	int line_height;  /* height of each row */
38 
39 	dword startpos;   /* position at start of window */
40 	dword endpos;     /* position at end of window */
41 	int nlines;       /* number of lines visible */
42 
43 	GtkTreeViewColumn *icon_column;
44 	GtkWidget *popup_menu;
45 } TilemDisasmView;
46 
47 typedef struct _TilemDisasmViewClass {
48 	GtkTreeViewClass parent_class;
49 } TilemDisasmViewClass;
50 
51 GType tilem_disasm_view_get_type(void) G_GNUC_CONST;
52 
53 /* Create a new TilemDisasmView. */
54 GtkWidget * tilem_disasm_view_new(TilemDebugger *dbg);
55 
56 /* Select memory addressing mode. */
57 void tilem_disasm_view_set_logical(TilemDisasmView *dv, gboolean logical);
58 
59 /* Refresh contents of view. */
60 void tilem_disasm_view_refresh(TilemDisasmView *dv);
61 
62 /* Highlight the specified address. */
63 void tilem_disasm_view_go_to_address(TilemDisasmView *dv, dword addr,
64                                      gboolean logical);
65 
66 /* Get currently selected address. */
67 gboolean tilem_disasm_view_get_cursor(TilemDisasmView *dv, dword *addr,
68                                       gboolean *is_logical);
69 
70 /* Toggle breakpoint at selected address. */
71 void tilem_disasm_view_toggle_breakpoint(TilemDisasmView *dv);
72 
73 G_END_DECLS
74