Search
lxdream.org :: lxdream :: r455:3080881d00d4
lxdream 0.9.1
released Jun 29
Download Now
changeset455:3080881d00d4
parent454:f6586b97813a
child456:968df17c4900
authornkeynes
dateSun Oct 21 05:21:35 2007 +0000 (12 years ago)
More GUI WIP
src/gui/ctrl_dlg.c
src/gui/debug_win.c
src/gui/debugcb.c
src/gui/debugif.c
src/gui/dump_win.c
src/gui/gtkcb.c
src/gui/gtkui.c
src/gui/gtkui.h
src/gui/main_win.c
src/gui/mmio_win.c
src/gui/path_dlg.c
1.1 --- a/src/gui/ctrl_dlg.c Sun Oct 21 05:20:35 2007 +0000
1.2 +++ b/src/gui/ctrl_dlg.c Sun Oct 21 05:21:35 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: ctrl_dlg.c,v 1.2 2007-10-17 11:26:45 nkeynes Exp $
1.6 + * $Id: ctrl_dlg.c,v 1.3 2007-10-21 05:21:35 nkeynes Exp $
1.7 *
1.8 * Define the main (emu) GTK window, along with its menubars,
1.9 * toolbars, etc.
1.10 @@ -26,6 +26,13 @@
1.11
1.12 #define MAX_DEVICES 4
1.13
1.14 +static void controller_device_configure(maple_device_t device);
1.15 +
1.16 +struct maple_config_class {
1.17 + const char *name;
1.18 + void (*config_func)(maple_device_t device);
1.19 +};
1.20 +
1.21 typedef struct maple_slot_data {
1.22 maple_device_t old_device;
1.23 maple_device_t new_device;
1.24 @@ -33,15 +40,90 @@
1.25 GtkWidget *combo;
1.26 } *maple_slot_data_t;
1.27
1.28 +static struct maple_config_class maple_device_config[] = {
1.29 + { "Sega Controller", controller_device_configure },
1.30 + { NULL, NULL } };
1.31 +
1.32 static struct maple_slot_data maple_data[MAX_DEVICES];
1.33
1.34 +static gboolean config_key_keypress( GtkWidget *widget, GdkEventKey *event, gpointer user_data )
1.35 +{
1.36 + GdkKeymap *keymap = gdk_keymap_get_default();
1.37 + guint keyval;
1.38 +
1.39 + gdk_keymap_translate_keyboard_state( keymap, event->hardware_keycode, 0, 0, &keyval,
1.40 + NULL, NULL, NULL );
1.41 + gtk_entry_set_text( GTK_ENTRY(widget), gdk_keyval_name(keyval) );
1.42 + return TRUE;
1.43 +}
1.44
1.45 -gboolean controller_properties_activated( GtkButton *button, gpointer user_data )
1.46 +static void controller_config_done( GtkWidget *panel, gboolean isOK )
1.47 +{
1.48 +
1.49 +
1.50 +}
1.51 +
1.52 +static void controller_device_configure( maple_device_t device )
1.53 +{
1.54 + lxdream_config_entry_t conf = device->get_config(device);
1.55 + int count, i;
1.56 + for( count=0; conf[count].key != NULL; count++ );
1.57 +
1.58 + GtkWidget *table = gtk_table_new( (count+1)>>1, 6, FALSE );
1.59 + for( i=0; i<count; i++ ) {
1.60 + GtkWidget *text, *text2;
1.61 + int x=0;
1.62 + int y=i;
1.63 + if( i >= (count+1)>>1 ) {
1.64 + x = 3;
1.65 + y -= (count+1)>>1;
1.66 + }
1.67 + gtk_table_attach( GTK_TABLE(table), gtk_label_new(conf[i].key), x, x+1, y, y+1,
1.68 + GTK_SHRINK, GTK_SHRINK, 0, 0 );
1.69 + gchar **parts = g_strsplit(conf[i].value,",",3);
1.70 +
1.71 + text = gtk_entry_new();
1.72 + gtk_entry_set_width_chars( GTK_ENTRY(text), 8 );
1.73 + g_signal_connect( text, "key_press_event",
1.74 + G_CALLBACK(config_key_keypress), NULL );
1.75 + gtk_table_attach_defaults( GTK_TABLE(table), text, x+1, x+2, y, y+1);
1.76 +
1.77 + text2 = gtk_entry_new();
1.78 + gtk_entry_set_width_chars( GTK_ENTRY(text2), 8 );
1.79 + g_signal_connect( text2, "key_press_event",
1.80 + G_CALLBACK(config_key_keypress), NULL );
1.81 + gtk_table_attach_defaults( GTK_TABLE(table), text2, x+2, x+3, y, y+1);
1.82 + if( parts[0] != NULL ) {
1.83 + gtk_entry_set_text( GTK_ENTRY(text), g_strstrip(parts[0]) );
1.84 + if( parts[1] != NULL ) {
1.85 + gtk_entry_set_text( GTK_ENTRY(text2), g_strstrip(parts[1]) );
1.86 + }
1.87 + }
1.88 + g_strfreev(parts);
1.89 + }
1.90 + gtk_gui_run_property_dialog( "Controller Configuration", table, controller_config_done );
1.91 +}
1.92 +
1.93 +
1.94 +gboolean maple_properties_activated( GtkButton *button, gpointer user_data )
1.95 {
1.96 maple_slot_data_t data = (maple_slot_data_t)user_data;
1.97 + if( data->new_device != NULL ) {
1.98 + int i;
1.99 + for( i=0; maple_device_config[i].name != NULL; i++ ) {
1.100 + if( strcmp(data->new_device->device_class->name, maple_device_config[i].name) == 0 ) {
1.101 + maple_device_config[i].config_func(data->new_device);
1.102 + break;
1.103 + }
1.104 + }
1.105 + if( maple_device_config[i].name == NULL ) {
1.106 + gui_error_dialog( "No configuration page available for device type" );
1.107 + }
1.108 + }
1.109 + return TRUE;
1.110 }
1.111
1.112 -gboolean controller_device_changed( GtkComboBox *combo, gpointer user_data )
1.113 +gboolean maple_device_changed( GtkComboBox *combo, gpointer user_data )
1.114 {
1.115 maple_slot_data_t data = (maple_slot_data_t)user_data;
1.116 int active = gtk_combo_box_get_active(combo);
1.117 @@ -64,9 +146,10 @@
1.118 }
1.119 data->new_device = NULL;
1.120 }
1.121 + return TRUE;
1.122 }
1.123
1.124 -void controller_commit_changes( )
1.125 +void maple_commit_changes( )
1.126 {
1.127 int i;
1.128 for( i=0; i<MAX_DEVICES; i++ ) {
1.129 @@ -82,7 +165,7 @@
1.130 lxdream_save_config();
1.131 }
1.132
1.133 -void controller_cancel_changes( )
1.134 +void maple_cancel_changes( )
1.135 {
1.136 int i;
1.137 for( i=0; i<MAX_DEVICES; i++ ) {
1.138 @@ -93,7 +176,7 @@
1.139 }
1.140 }
1.141
1.142 -GtkWidget *controller_panel_new()
1.143 +GtkWidget *maple_panel_new()
1.144 {
1.145 GtkWidget *table = gtk_table_new(4, 3, TRUE);
1.146 GtkTreeIter iter;
1.147 @@ -126,20 +209,20 @@
1.148 maple_data[i].combo = combo;
1.149 maple_data[i].button = button;
1.150 g_signal_connect( button, "clicked",
1.151 - G_CALLBACK( controller_properties_activated ), &maple_data[i] );
1.152 + G_CALLBACK( maple_properties_activated ), &maple_data[i] );
1.153 g_signal_connect( combo, "changed",
1.154 - G_CALLBACK( controller_device_changed ), &maple_data[i] );
1.155 + G_CALLBACK( maple_device_changed ), &maple_data[i] );
1.156
1.157 }
1.158 return table;
1.159 }
1.160
1.161 -void controller_dialog_run( GtkWindow *parent )
1.162 +void maple_dialog_run( GtkWindow *parent )
1.163 {
1.164 - gint result = gtk_gui_run_property_dialog( "Controller Settings", controller_panel_new() );
1.165 + gint result = gtk_gui_run_property_dialog( "Controller Settings", maple_panel_new(), NULL );
1.166 if( result == GTK_RESPONSE_ACCEPT ) {
1.167 - controller_commit_changes();
1.168 + maple_commit_changes();
1.169 } else {
1.170 - controller_cancel_changes();
1.171 + maple_cancel_changes();
1.172 }
1.173 }
2.1 --- a/src/gui/debug_win.c Sun Oct 21 05:20:35 2007 +0000
2.2 +++ b/src/gui/debug_win.c Sun Oct 21 05:21:35 2007 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: debug_win.c,v 1.24 2007-10-11 08:22:03 nkeynes Exp $
2.6 + * $Id: debug_win.c,v 1.25 2007-10-21 05:21:35 nkeynes Exp $
2.7 * This file is responsible for the main debugger gui frame.
2.8 *
2.9 * Copyright (c) 2005 Nathan Keynes.
2.10 @@ -17,11 +17,10 @@
2.11 #include <stdlib.h>
2.12 #include <stdarg.h>
2.13 #include <stdio.h>
2.14 +#include <math.h>
2.15 #include <gnome.h>
2.16 -#include <math.h>
2.17 #include "mem.h"
2.18 #include "cpu.h"
2.19 -#include "debugif.h"
2.20 #include "gui/gtkui.h"
2.21 #include "sh4/sh4dasm.h"
2.22 #include "aica/armdasm.h"
2.23 @@ -37,61 +36,153 @@
2.24 void set_disassembly_region( debug_window_t data, unsigned int page );
2.25 void set_disassembly_cpu( debug_window_t data, const gchar *cpu );
2.26
2.27 +void on_mode_field_changed ( GtkEditable *editable, gpointer user_data);
2.28 +gboolean on_page_field_key_press_event( GtkWidget * widget, GdkEventKey *event,
2.29 + gpointer user_data);
2.30 +void on_jump_pc_btn_clicked( GtkButton *button, gpointer user_data);
2.31 +void on_disasm_list_select_row (GtkCList *clist, gint row, gint column,
2.32 + GdkEvent *event, gpointer user_data);
2.33 +void on_disasm_list_unselect_row (GtkCList *clist, gint row, gint column,
2.34 + GdkEvent *event, gpointer user_data);
2.35 +
2.36 +
2.37 struct debug_window_info {
2.38 int disasm_from;
2.39 int disasm_to;
2.40 int disasm_pc;
2.41 const struct cpu_desc_struct *cpu;
2.42 const cpu_desc_t *cpu_list;
2.43 - GtkCList *msgs_list;
2.44 GtkCList *regs_list;
2.45 GtkCList *disasm_list;
2.46 GtkEntry *page_field;
2.47 - GtkWidget *win;
2.48 - GtkProgressBar *icounter;
2.49 - char icounter_text[16];
2.50 + GtkWidget *window;
2.51 + GtkWidget *statusbar;
2.52 char saved_regs[0];
2.53 };
2.54
2.55 -debug_window_t debug_window_new( )
2.56 +debug_window_t debug_window_new( const gchar *title, GtkWidget *menubar,
2.57 + GtkWidget *toolbar, GtkAccelGroup *accel_group )
2.58 {
2.59 - GtkWidget *win = create_debug_win();
2.60 - GnomeAppBar *appbar;
2.61 + debug_window_t data = g_malloc0( sizeof(struct debug_window_info) + cpu_list[0]->regs_size );
2.62 + GtkWidget *vbox;
2.63 + GtkWidget *frame;
2.64 +
2.65 + data->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
2.66 + gtk_window_set_default_size (GTK_WINDOW (data->window), 1000, 700);
2.67 + gtk_window_set_title( GTK_WINDOW(data->window), title );
2.68 + gtk_window_add_accel_group (GTK_WINDOW (data->window), accel_group);
2.69 +
2.70 + gtk_toolbar_set_style( GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS );
2.71 +
2.72 + data->statusbar = gtk_statusbar_new();
2.73 +
2.74 + GtkWidget *hpaned = gtk_hpaned_new ();
2.75 + gtk_paned_set_position (GTK_PANED (hpaned), 800);
2.76 +
2.77 +
2.78 + GtkWidget *disasm_box = gtk_vbox_new(FALSE,0);
2.79 + gtk_paned_pack1 (GTK_PANED (hpaned), disasm_box, TRUE, TRUE);
2.80 +
2.81 + GtkWidget *hbox1 = gtk_hbox_new (FALSE, 0);
2.82 + gtk_box_pack_start (GTK_BOX (disasm_box), hbox1, FALSE, FALSE, 3);
2.83 + gtk_box_pack_start (GTK_BOX (hbox1), gtk_label_new (_("Page")), FALSE, FALSE, 4);
2.84
2.85 - debug_window_t data = g_malloc0( sizeof(struct debug_window_info) + cpu_list[0]->regs_size );
2.86 + data->page_field = GTK_ENTRY(gtk_entry_new ());
2.87 + gtk_box_pack_start (GTK_BOX (hbox1), GTK_WIDGET(data->page_field), FALSE, TRUE, 0);
2.88 +
2.89 + GtkWidget *jump_pc_btn = gtk_button_new_with_mnemonic (_(" Jump to PC "));
2.90 + gtk_box_pack_start (GTK_BOX (hbox1), jump_pc_btn, FALSE, FALSE, 4);
2.91 +
2.92 + gtk_box_pack_start (GTK_BOX (hbox1), gtk_label_new(_("Mode")), FALSE, FALSE, 5);
2.93 +
2.94 + GtkWidget *mode_box = gtk_combo_new ();
2.95 + gtk_box_pack_start (GTK_BOX (hbox1), mode_box, FALSE, FALSE, 0);
2.96 + GList *mode_box_items = NULL;
2.97 + mode_box_items = g_list_append (mode_box_items, (gpointer) _("SH4"));
2.98 + mode_box_items = g_list_append (mode_box_items, (gpointer) _("ARM7"));
2.99 + mode_box_items = g_list_append (mode_box_items, (gpointer) _("ARM7T"));
2.100 + gtk_combo_set_popdown_strings (GTK_COMBO (mode_box), mode_box_items);
2.101 + g_list_free (mode_box_items);
2.102 +
2.103 + GtkWidget *mode_field = GTK_COMBO (mode_box)->entry;
2.104 + gtk_editable_set_editable (GTK_EDITABLE (mode_field), FALSE);
2.105 +
2.106 + GtkWidget *disasm_scroll = gtk_scrolled_window_new (NULL, NULL);
2.107 + gtk_box_pack_start (GTK_BOX (disasm_box), disasm_scroll, TRUE, TRUE, 0);
2.108 + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (disasm_scroll), GTK_SHADOW_IN);
2.109 + data->disasm_list = GTK_CLIST(gtk_clist_new (4));
2.110 + gtk_clist_set_column_width (GTK_CLIST (data->disasm_list), 0, 80);
2.111 + gtk_clist_set_column_width (GTK_CLIST (data->disasm_list), 2, 80);
2.112 + gtk_clist_set_column_width (GTK_CLIST (data->disasm_list), 3, 80);
2.113 + gtk_clist_set_column_width( data->disasm_list, 1, 16 );
2.114 + gtk_clist_column_titles_hide (GTK_CLIST (data->disasm_list));
2.115 + gtk_container_add (GTK_CONTAINER (disasm_scroll), GTK_WIDGET(data->disasm_list));
2.116 +
2.117 + GtkWidget *reg_scroll = gtk_scrolled_window_new (NULL, NULL);
2.118 + gtk_paned_pack2 (GTK_PANED (hpaned), reg_scroll, FALSE, TRUE);
2.119 + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (reg_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
2.120 + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (reg_scroll), GTK_SHADOW_IN);
2.121 +
2.122 + data->regs_list = GTK_CLIST(gtk_clist_new (2));
2.123 + gtk_container_add (GTK_CONTAINER (reg_scroll), GTK_WIDGET(data->regs_list));
2.124 + gtk_clist_set_column_width (GTK_CLIST (data->regs_list), 0, 80);
2.125 + gtk_clist_set_column_width (GTK_CLIST (data->regs_list), 1, 80);
2.126 + gtk_clist_column_titles_hide (GTK_CLIST (data->regs_list));
2.127 + gtk_widget_modify_font( GTK_WIDGET(data->regs_list), gui_fixed_font );
2.128 +
2.129 + vbox = gtk_vbox_new(FALSE, 0);
2.130 + gtk_container_add( GTK_CONTAINER(data->window), vbox );
2.131 + gtk_box_pack_start( GTK_BOX(vbox), menubar, FALSE, FALSE, 0 );
2.132 + gtk_box_pack_start( GTK_BOX(vbox), toolbar, FALSE, FALSE, 0 );
2.133 + gtk_box_pack_start( GTK_BOX(vbox), hpaned, TRUE, TRUE, 0 );
2.134 + gtk_box_pack_start( GTK_BOX(vbox), data->statusbar, FALSE, FALSE, 0 );
2.135 +
2.136 + g_signal_connect ((gpointer) data->page_field, "key_press_event",
2.137 + G_CALLBACK (on_page_field_key_press_event),
2.138 + data);
2.139 + g_signal_connect ((gpointer) jump_pc_btn, "clicked",
2.140 + G_CALLBACK (on_jump_pc_btn_clicked),
2.141 + data);
2.142 + g_signal_connect ((gpointer) mode_field, "changed",
2.143 + G_CALLBACK (on_mode_field_changed),
2.144 + data);
2.145 + g_signal_connect ((gpointer) data->disasm_list, "select_row",
2.146 + G_CALLBACK (on_disasm_list_select_row),
2.147 + data);
2.148 + g_signal_connect ((gpointer) data->disasm_list, "unselect_row",
2.149 + G_CALLBACK (on_disasm_list_unselect_row),
2.150 + data);
2.151 +
2.152 data->disasm_from = -1;
2.153 data->disasm_to = -1;
2.154 data->disasm_pc = -1;
2.155 data->cpu = cpu_list[0];
2.156 data->cpu_list = cpu_list;
2.157
2.158 - data->regs_list= gtk_object_get_data(GTK_OBJECT(win), "reg_list");
2.159 - data->win = win;
2.160 - gtk_widget_modify_font( GTK_WIDGET(data->regs_list), gui_fixed_font );
2.161 init_register_list( data );
2.162 - data->msgs_list = gtk_object_get_data(GTK_OBJECT(win), "output_list");
2.163 - data->disasm_list = gtk_object_get_data(GTK_OBJECT(win), "disasm_list");
2.164 - gtk_clist_set_column_width( data->disasm_list, 1, 16 );
2.165 - data->page_field = gtk_object_get_data(GTK_OBJECT(win), "page_field");
2.166 -
2.167 - appbar = gtk_object_get_data(GTK_OBJECT(win), "debug_appbar");
2.168 - data->icounter = gnome_appbar_get_progress( appbar );
2.169 - gtk_progress_bar_set_text(data->icounter, "1");
2.170 -
2.171 - gtk_object_set_data( GTK_OBJECT(win), "debug_data", data );
2.172 + gtk_object_set_data( GTK_OBJECT(data->window), "debug_data", data );
2.173 set_disassembly_pc( data, *data->cpu->pc, FALSE );
2.174 debug_window_set_running( data, FALSE );
2.175
2.176 - gtk_widget_show( win );
2.177 + gtk_widget_show_all( data->window );
2.178 return data;
2.179 }
2.180
2.181 void debug_window_show( debug_window_t data, gboolean show )
2.182 {
2.183 if( show ) {
2.184 - gtk_widget_show( data->win );
2.185 + gtk_widget_show( data->window );
2.186 } else {
2.187 - gtk_widget_hide( data->win );
2.188 + gtk_widget_hide( data->window );
2.189 + }
2.190 +}
2.191 +
2.192 +int debug_window_get_selected_row( debug_window_t data )
2.193 +{
2.194 + if( data->disasm_list->selection == NULL ) {
2.195 + return -1;
2.196 + } else {
2.197 + return GPOINTER_TO_INT(data->disasm_list->selection->data);
2.198 }
2.199 }
2.200
2.201 @@ -144,7 +235,7 @@
2.202 }
2.203 }
2.204
2.205 - set_disassembly_pc( data, *data->cpu->pc, FALSE );
2.206 + set_disassembly_pc( data, *data->cpu->pc, TRUE );
2.207 memcpy( data->saved_regs, data->cpu->regs, data->cpu->regs_size );
2.208 }
2.209
2.210 @@ -250,7 +341,7 @@
2.211 }
2.212 }
2.213
2.214 -void debug_win_toggle_breakpoint( debug_window_t data, int row )
2.215 +void debug_window_toggle_breakpoint( debug_window_t data, int row )
2.216 {
2.217 uint32_t pc = row_to_address( data, row );
2.218 int oldType = data->cpu->get_breakpoint( pc );
2.219 @@ -263,7 +354,7 @@
2.220 }
2.221 }
2.222
2.223 -void debug_win_set_oneshot_breakpoint( debug_window_t data, int row )
2.224 +void debug_window_set_oneshot_breakpoint( debug_window_t data, int row )
2.225 {
2.226 uint32_t pc = row_to_address( data, row );
2.227 data->cpu->clear_breakpoint( pc, BREAK_ONESHOT );
2.228 @@ -274,7 +365,7 @@
2.229 /**
2.230 * Execute a single instruction using the current CPU mode.
2.231 */
2.232 -void debug_win_single_step( debug_window_t data )
2.233 +void debug_window_single_step( debug_window_t data )
2.234 {
2.235 data->cpu->step_func();
2.236 gtk_gui_update();
2.237 @@ -290,52 +381,6 @@
2.238 return (address - data->disasm_from) / data->cpu->instr_size;
2.239 }
2.240
2.241 -#if 0
2.242 -void emit( void *ptr, int level, const gchar *source, const char *msg, ... )
2.243 -{
2.244 - char buf[20], addr[10] = "", *p;
2.245 - const gchar *arr[4] = {buf, source, addr};
2.246 - int posn;
2.247 - time_t tm = time(NULL);
2.248 - va_list ap;
2.249 - debug_window_t data = NULL;
2.250 - /*
2.251 - if( ptr == NULL )
2.252 - data = debug_win;
2.253 - else data = (debug_window_t)ptr;
2.254 - */
2.255 - if( level > global_msg_level ) {
2.256 - return; // ignored
2.257 - }
2.258 - va_start(ap, msg);
2.259 -
2.260 - strftime( buf, sizeof(buf), "%H:%M:%S", localtime(&tm) );
2.261 -
2.262 - if( data == NULL ) {
2.263 - fprintf( stderr, "%s %08X %-5s ", buf, *sh4_cpu_desc.pc, msg_levels[level] );
2.264 - vfprintf( stderr, msg, ap );
2.265 - fprintf( stderr, "\n" );
2.266 - va_end(ap);
2.267 - return;
2.268 - }
2.269 -
2.270 - p = g_strdup_vprintf( msg, ap );
2.271 - sprintf( addr, "%08X", *data->cpu->pc );
2.272 - arr[3] = p;
2.273 - posn = gtk_clist_append(data->msgs_list, (gchar **)arr);
2.274 - free(p);
2.275 - va_end(ap);
2.276 -
2.277 - gtk_clist_set_foreground( data->msgs_list, posn, msg_colors[level] );
2.278 - gtk_clist_moveto( data->msgs_list, posn, 0, 1.0, 0.0 );
2.279 -
2.280 - /* emit _really_ slows down the emu, to the point where the gui can be
2.281 - * completely unresponsive if I don't include this:
2.282 - */
2.283 - while( gtk_events_pending() )
2.284 - gtk_main_iteration();
2.285 -}
2.286 -#endif
2.287 debug_window_t get_debug_info( GtkWidget *widget ) {
2.288
2.289 GtkWidget *win = gtk_widget_get_toplevel(widget);
2.290 @@ -343,19 +388,57 @@
2.291 return data;
2.292 }
2.293
2.294 -void debug_win_enable_widget( debug_window_t data, const char *name,
2.295 - gboolean enabled )
2.296 -{
2.297 - GtkWidget *widget = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(data->win), name));
2.298 - gtk_widget_set_sensitive( widget, enabled );
2.299 -}
2.300 -
2.301 void debug_window_set_running( debug_window_t data, gboolean isRunning )
2.302 {
2.303 if( data != NULL ) {
2.304 - debug_win_enable_widget( data, "stop_btn", isRunning );
2.305 - debug_win_enable_widget( data, "step_btn", !isRunning );
2.306 - debug_win_enable_widget( data, "run_btn", !isRunning );
2.307 - debug_win_enable_widget( data, "runto_btn", !isRunning );
2.308 + gtk_gui_enable_action( "SingleStep", !isRunning );
2.309 + gtk_gui_enable_action( "RunTo", !isRunning );
2.310 }
2.311 }
2.312 +
2.313 +void on_mode_field_changed ( GtkEditable *editable, gpointer user_data)
2.314 +{
2.315 + const gchar *text = gtk_entry_get_text( GTK_ENTRY(editable) );
2.316 + set_disassembly_cpu( gtk_gui_get_debugger(), text );
2.317 +}
2.318 +
2.319 +
2.320 +gboolean on_page_field_key_press_event( GtkWidget * widget, GdkEventKey *event,
2.321 + gpointer user_data)
2.322 +{
2.323 + if( event->keyval == GDK_Return || event->keyval == GDK_Linefeed ) {
2.324 + debug_window_t data = get_debug_info(widget);
2.325 + const gchar *text = gtk_entry_get_text( GTK_ENTRY(widget) );
2.326 + gchar *endptr;
2.327 + unsigned int val = strtoul( text, &endptr, 16 );
2.328 + if( text == endptr ) { /* invalid input */
2.329 + char buf[10];
2.330 + sprintf( buf, "%08X", row_to_address(data,0) );
2.331 + gtk_entry_set_text( GTK_ENTRY(widget), buf );
2.332 + } else {
2.333 + set_disassembly_region(data, val);
2.334 + }
2.335 + }
2.336 + return FALSE;
2.337 +}
2.338 +
2.339 +
2.340 +void on_jump_pc_btn_clicked( GtkButton *button, gpointer user_data)
2.341 +{
2.342 + debug_window_t data = get_debug_info( GTK_WIDGET(button) );
2.343 + jump_to_pc( data, TRUE );
2.344 +}
2.345 +
2.346 +void on_disasm_list_select_row (GtkCList *clist, gint row, gint column,
2.347 + GdkEvent *event, gpointer user_data)
2.348 +{
2.349 + gtk_gui_enable_action( "SetBreakpoint", TRUE );
2.350 + gtk_gui_enable_action( "RunTo", TRUE );
2.351 +}
2.352 +
2.353 +void on_disasm_list_unselect_row (GtkCList *clist, gint row, gint column,
2.354 + GdkEvent *event, gpointer user_data)
2.355 +{
2.356 + gtk_gui_enable_action( "SetBreakpoint", FALSE );
2.357 + gtk_gui_enable_action( "RunTo", FALSE );
2.358 +}
3.1 --- a/src/gui/debugcb.c Sun Oct 21 05:20:35 2007 +0000
3.2 +++ b/src/gui/debugcb.c Sun Oct 21 05:21:35 2007 +0000
3.3 @@ -1,5 +1,5 @@
3.4 /**
3.5 - * $Id: debugcb.c,v 1.2 2007-10-17 11:26:45 nkeynes Exp $
3.6 + * $Id: debugcb.c,v 1.3 2007-10-21 05:21:35 nkeynes Exp $
3.7 *
3.8 * All GTK callbacks go here (stubs are autogenerated by Glade)
3.9 *
3.10 @@ -29,140 +29,6 @@
3.11 #include "loader.h"
3.12 #include "pvr2/pvr2.h"
3.13
3.14 -int selected_pc = -1;
3.15 -int selected_row = -1;
3.16 -
3.17 -debug_window_t get_debug_info( GtkWidget *widget );
3.18 -
3.19 -void
3.20 -on_new_file1_activate (GtkMenuItem *menuitem,
3.21 - gpointer user_data)
3.22 -{
3.23 -
3.24 -}
3.25 -
3.26 -
3.27 -void
3.28 -on_open1_activate (GtkMenuItem *menuitem,
3.29 - gpointer user_data)
3.30 -{
3.31 - const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);
3.32 - open_file_dialog( "Open...", file_load_magic, NULL, NULL, dir );
3.33 -}
3.34 -
3.35 -
3.36 -void
3.37 -on_save1_activate (GtkMenuItem *menuitem,
3.38 - gpointer user_data)
3.39 -{
3.40 -
3.41 -}
3.42 -
3.43 -
3.44 -void
3.45 -on_save_as1_activate (GtkMenuItem *menuitem,
3.46 - gpointer user_data)
3.47 -{
3.48 -
3.49 -}
3.50 -
3.51 -void
3.52 -on_save_next_scene_activate( GtkMenuItem *menuitem,
3.53 - gpointer user_data)
3.54 -{
3.55 - const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);
3.56 - save_file_dialog( "Save next scene...", pvr2_save_next_scene, "*.dsc", "lxdream scene file (*.dsc)", dir );
3.57 -}
3.58 -
3.59 -void
3.60 -on_exit1_activate (GtkMenuItem *menuitem,
3.61 - gpointer user_data)
3.62 -{
3.63 - gtk_main_quit();
3.64 -}
3.65 -
3.66 -
3.67 -void
3.68 -on_preferences1_activate (GtkMenuItem *menuitem,
3.69 - gpointer user_data)
3.70 -{
3.71 -
3.72 -}
3.73 -
3.74 -
3.75 -void
3.76 -on_about1_activate (GtkMenuItem *menuitem,
3.77 - gpointer user_data)
3.78 -{
3.79 - GtkWidget *about = create_about_win();
3.80 - gtk_widget_show(about);
3.81 -}
3.82 -
3.83 -
3.84 -void
3.85 -on_load_btn_clicked (GtkButton *button,
3.86 - gpointer user_data)
3.87 -{
3.88 - const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);
3.89 - open_file_dialog( "Open...", gdrom_mount_image, NULL, NULL, dir );
3.90 -}
3.91 -
3.92 -
3.93 -void
3.94 -on_reset_btn_clicked (GtkButton *button,
3.95 - gpointer user_data)
3.96 -{
3.97 - dreamcast_reset();
3.98 -}
3.99 -
3.100 -
3.101 -void
3.102 -on_stop_btn_clicked (GtkButton *button,
3.103 - gpointer user_data)
3.104 -{
3.105 - dreamcast_stop();
3.106 -}
3.107 -
3.108 -
3.109 -void
3.110 -on_step_btn_clicked (GtkButton *button,
3.111 - gpointer user_data)
3.112 -{
3.113 - debug_window_t data = get_debug_info(GTK_WIDGET(button));
3.114 - debug_win_single_step(data);
3.115 -}
3.116 -
3.117 -
3.118 -void
3.119 -on_run_btn_clicked (GtkButton *button,
3.120 - gpointer user_data)
3.121 -{
3.122 - dreamcast_run();
3.123 -}
3.124 -
3.125 -
3.126 -void
3.127 -on_runto_btn_clicked (GtkButton *button,
3.128 - gpointer user_data)
3.129 -{
3.130 - if( selected_pc == -1 )
3.131 - WARN( "No address selected, so can't run to it", NULL );
3.132 - else {
3.133 - debug_window_t data = get_debug_info(GTK_WIDGET(button));
3.134 - debug_win_set_oneshot_breakpoint( data, selected_row );
3.135 - dreamcast_run();
3.136 - }
3.137 -}
3.138 -
3.139 -
3.140 -void
3.141 -on_break_btn_clicked (GtkButton *button,
3.142 - gpointer user_data)
3.143 -{
3.144 - debug_window_t data = get_debug_info(GTK_WIDGET(button));
3.145 - debug_win_toggle_breakpoint( data, selected_row );
3.146 -}
3.147 -
3.148 void on_trace_button_toggled (GtkToggleButton *button,
3.149 gpointer user_data)
3.150 {
3.151 @@ -175,51 +41,6 @@
3.152
3.153
3.154 gboolean
3.155 -on_debug_win_delete_event (GtkWidget *widget,
3.156 - GdkEvent *event,
3.157 - gpointer user_data)
3.158 -{
3.159 - dreamcast_shutdown();
3.160 - gtk_main_quit();
3.161 - return FALSE;
3.162 -}
3.163 -
3.164 -
3.165 -void
3.166 -on_disasm_list_select_row (GtkCList *clist,
3.167 - gint row,
3.168 - gint column,
3.169 - GdkEvent *event,
3.170 - gpointer user_data)
3.171 -{
3.172 - debug_window_t data = get_debug_info(GTK_WIDGET(clist));
3.173 - selected_pc = row_to_address(data, row);
3.174 - selected_row = row;
3.175 -}
3.176 -
3.177 -
3.178 -void
3.179 -on_disasm_list_unselect_row (GtkCList *clist,
3.180 - gint row,
3.181 - gint column,
3.182 - GdkEvent *event,
3.183 - gpointer user_data)
3.184 -{
3.185 - debug_window_t data = get_debug_info(GTK_WIDGET(clist));
3.186 - int pc = row_to_address(data,row);
3.187 - if( selected_pc == pc ) selected_pc = -1;
3.188 -}
3.189 -
3.190 -
3.191 -void
3.192 -on_mem_mapped_regs1_activate (GtkMenuItem *menuitem,
3.193 - gpointer user_data)
3.194 -{
3.195 - mmr_open_win();
3.196 -}
3.197 -
3.198 -
3.199 -gboolean
3.200 on_mmr_win_delete_event (GtkWidget *widget,
3.201 GdkEvent *event,
3.202 gpointer user_data)
3.203 @@ -235,122 +56,3 @@
3.204 {
3.205 mmr_close_win();
3.206 }
3.207 -
3.208 -
3.209 -void
3.210 -on_mode_field_changed (GtkEditable *editable,
3.211 - gpointer user_data)
3.212 -{
3.213 - const gchar *text = gtk_entry_get_text( GTK_ENTRY(editable) );
3.214 - debug_window_t data = get_debug_info( GTK_WIDGET(editable) );
3.215 - set_disassembly_cpu( data, text );
3.216 -}
3.217 -
3.218 -
3.219 -void
3.220 -on_page_locked_btn_toggled (GtkToggleButton *togglebutton,
3.221 - gpointer user_data)
3.222 -{
3.223 -
3.224 -}
3.225 -
3.226 -
3.227 -gboolean
3.228 -on_page_field_key_press_event (GtkWidget *widget,
3.229 - GdkEventKey *event,
3.230 - gpointer user_data)
3.231 -{
3.232 - if( event->keyval == GDK_Return || event->keyval == GDK_Linefeed ) {
3.233 - debug_window_t data = get_debug_info(widget);
3.234 - const gchar *text = gtk_entry_get_text( GTK_ENTRY(widget) );
3.235 - gchar *endptr;
3.236 - unsigned int val = strtoul( text, &endptr, 16 );
3.237 - if( text == endptr ) { /* invalid input */
3.238 - char buf[10];
3.239 - sprintf( buf, "%08X", row_to_address(data,0) );
3.240 - gtk_entry_set_text( GTK_ENTRY(widget), buf );
3.241 - } else {
3.242 - set_disassembly_region(data, val);
3.243 - }
3.244 - }
3.245 - return FALSE;
3.246 -}
3.247 -
3.248 -
3.249 -void
3.250 -on_output_list_select_row (GtkCList *clist,
3.251 - gint row,
3.252 - gint column,
3.253 - GdkEvent *event,
3.254 - gpointer user_data)
3.255 -{
3.256 - if( event->type == GDK_2BUTTON_PRESS && event->button.button == 1 ) {
3.257 - char *val;
3.258 - gtk_clist_get_text( clist, row, 2, &val );
3.259 - if( val[0] != '\0' ) {
3.260 - int addr = strtoul( val, NULL, 16 );
3.261 - debug_window_t data = get_debug_info( GTK_WIDGET(clist) );
3.262 - jump_to_disassembly( data, addr, TRUE );
3.263 - }
3.264 - }
3.265 -}
3.266 -
3.267 -
3.268 -void
3.269 -on_jump_pc_btn_clicked (GtkButton *button,
3.270 - gpointer user_data)
3.271 -{
3.272 - debug_window_t data = get_debug_info( GTK_WIDGET(button) );
3.273 - jump_to_pc( data, TRUE );
3.274 -}
3.275 -
3.276 -
3.277 -void
3.278 -on_button_add_watch_clicked (GtkButton *button,
3.279 - gpointer user_data)
3.280 -{
3.281 -
3.282 -}
3.283 -
3.284 -
3.285 -void
3.286 -on_button_clear_all_clicked (GtkButton *button,
3.287 - gpointer user_data)
3.288 -{
3.289 -
3.290 -}
3.291 -
3.292 -
3.293 -void
3.294 -on_button_close_clicked (GtkButton *button,
3.295 - gpointer user_data)
3.296 -{
3.297 -
3.298 -}
3.299 -
3.300 -
3.301 -void
3.302 -on_view_memory_activate (GtkMenuItem *menuitem,
3.303 - gpointer user_data)
3.304 -{
3.305 - dump_window_new();
3.306 -}
3.307 -
3.308 -
3.309 -void
3.310 -on_loadstate_button_clicked (GtkToolButton *toolbutton,
3.311 - gpointer user_data)
3.312 -{
3.313 - const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);
3.314 - open_file_dialog( "Load state...", dreamcast_load_state, "*.dst", "lxDream Save State (*.dst)", dir );
3.315 -}
3.316 -
3.317 -
3.318 -void
3.319 -on_savestate_button_clicked (GtkToolButton *toolbutton,
3.320 - gpointer user_data)
3.321 -{
3.322 - const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);
3.323 - save_file_dialog( "Save state...", dreamcast_save_state, "*.dst", "lxDream Save State (*.dst)", dir );
3.324 -}
3.325 -
4.1 --- a/src/gui/debugif.c Sun Oct 21 05:20:35 2007 +0000
4.2 +++ b/src/gui/debugif.c Sun Oct 21 05:21:35 2007 +0000
4.3 @@ -26,477 +26,6 @@
4.4 #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
4.5 g_object_set_data (G_OBJECT (component), name, widget)
4.6
4.7 -static GnomeUIInfo file1_menu_uiinfo[] =
4.8 -{
4.9 - GNOMEUIINFO_MENU_NEW_ITEM (N_("_New"), NULL, on_new_file1_activate, NULL),
4.10 - GNOMEUIINFO_MENU_OPEN_ITEM (on_open1_activate, NULL),
4.11 - GNOMEUIINFO_MENU_SAVE_ITEM (on_save1_activate, NULL),
4.12 - GNOMEUIINFO_MENU_SAVE_AS_ITEM (on_save_as1_activate, NULL),
4.13 - {
4.14 - GNOME_APP_UI_ITEM, N_("Save next scene..."),
4.15 - NULL,
4.16 - (gpointer) on_save_next_scene_activate, NULL, NULL,
4.17 - GNOME_APP_PIXMAP_NONE, NULL,
4.18 - 0, (GdkModifierType) 0, NULL
4.19 - },
4.20 - GNOMEUIINFO_SEPARATOR,
4.21 - GNOMEUIINFO_MENU_EXIT_ITEM (on_exit1_activate, NULL),
4.22 - GNOMEUIINFO_END
4.23 -};
4.24 -
4.25 -static GnomeUIInfo view1_menu_uiinfo[] =
4.26 -{
4.27 - {
4.28 - GNOME_APP_UI_ITEM, N_("Memory..."),
4.29 - NULL,
4.30 - (gpointer) on_view_memory_activate, NULL, NULL,
4.31 - GNOME_APP_PIXMAP_NONE, NULL,
4.32 - 0, (GdkModifierType) 0, NULL
4.33 - },
4.34 - {
4.35 - GNOME_APP_UI_ITEM, N_("Mem mapped Regs..."),
4.36 - NULL,
4.37 - (gpointer) on_mem_mapped_regs1_activate, NULL, NULL,
4.38 - GNOME_APP_PIXMAP_NONE, NULL,
4.39 - 0, (GdkModifierType) 0, NULL
4.40 - },
4.41 - GNOMEUIINFO_END
4.42 -};
4.43 -
4.44 -static GnomeUIInfo settings1_menu_uiinfo[] =
4.45 -{
4.46 - GNOMEUIINFO_MENU_PREFERENCES_ITEM (on_preferences1_activate, NULL),
4.47 - GNOMEUIINFO_END
4.48 -};
4.49 -
4.50 -static GnomeUIInfo help1_menu_uiinfo[] =
4.51 -{
4.52 - GNOMEUIINFO_MENU_ABOUT_ITEM (on_about1_activate, NULL),
4.53 - GNOMEUIINFO_END
4.54 -};
4.55 -
4.56 -static GnomeUIInfo menubar1_uiinfo[] =
4.57 -{
4.58 - {
4.59 - GNOME_APP_UI_SUBTREE, N_("_File"),
4.60 - NULL,
4.61 - file1_menu_uiinfo, NULL, NULL,
4.62 - GNOME_APP_PIXMAP_NONE, NULL,
4.63 - 0, (GdkModifierType) 0, NULL
4.64 - },
4.65 - {
4.66 - GNOME_APP_UI_SUBTREE, N_("_View"),
4.67 - NULL,
4.68 - view1_menu_uiinfo, NULL, NULL,
4.69 - GNOME_APP_PIXMAP_NONE, NULL,
4.70 - 0, (GdkModifierType) 0, NULL
4.71 - },
4.72 - {
4.73 - GNOME_APP_UI_SUBTREE, N_("_Settings"),
4.74 - NULL,
4.75 - settings1_menu_uiinfo, NULL, NULL,
4.76 - GNOME_APP_PIXMAP_NONE, NULL,
4.77 - 0, (GdkModifierType) 0, NULL
4.78 - },
4.79 - {
4.80 - GNOME_APP_UI_SUBTREE, N_("_Help"),
4.81 - NULL,
4.82 - help1_menu_uiinfo, NULL, NULL,
4.83 - GNOME_APP_PIXMAP_NONE, NULL,
4.84 - 0, (GdkModifierType) 0, NULL
4.85 - },
4.86 - GNOMEUIINFO_END
4.87 -};
4.88 -
4.89 -GtkWidget*
4.90 -create_debug_win (void)
4.91 -{
4.92 - GtkWidget *debug_win;
4.93 - GtkWidget *dock1;
4.94 - GtkWidget *toolbar1;
4.95 - GtkIconSize tmp_toolbar_icon_size;
4.96 - GtkWidget *tmp_image;
4.97 - GtkWidget *load_btn;
4.98 - GtkWidget *reset_btn;
4.99 - GtkWidget *stop_btn;
4.100 - GtkWidget *step_btn;
4.101 - GtkWidget *run_btn;
4.102 - GtkWidget *runto_btn;
4.103 - GtkWidget *break_btn;
4.104 - GtkWidget *loadstate_button;
4.105 - GtkWidget *savestate_button;
4.106 - GtkWidget *vpaned1;
4.107 - GtkWidget *hpaned1;
4.108 - GtkWidget *vbox2;
4.109 - GtkWidget *hbox1;
4.110 - GtkWidget *label21;
4.111 - GtkWidget *page_field;
4.112 - GtkWidget *page_locked_btn;
4.113 - GtkWidget *jump_pc_btn;
4.114 - GtkWidget *label22;
4.115 - GtkWidget *mode_box;
4.116 - GList *mode_box_items = NULL;
4.117 - GtkWidget *mode_field;
4.118 - GtkWidget *label23;
4.119 - GtkWidget *scrolledwindow7;
4.120 - GtkWidget *disasm_list;
4.121 - GtkWidget *label24;
4.122 - GtkWidget *label27;
4.123 - GtkWidget *label28;
4.124 - GtkWidget *label29;
4.125 - GtkWidget *scrolledwindow4;
4.126 - GtkWidget *reg_list;
4.127 - GtkWidget *label25;
4.128 - GtkWidget *label30;
4.129 - GtkWidget *scrolledwindow8;
4.130 - GtkWidget *output_list;
4.131 - GtkWidget *label26;
4.132 - GtkWidget *label31;
4.133 - GtkWidget *label32;
4.134 - GtkWidget *debug_appbar;
4.135 - GtkTooltips *tooltips;
4.136 -
4.137 - tooltips = gtk_tooltips_new ();
4.138 -
4.139 - debug_win = gnome_app_new ("Dream", _("lxDream! Debugger"));
4.140 - gtk_window_set_default_size (GTK_WINDOW (debug_win), 1000, 700);
4.141 -
4.142 - dock1 = GNOME_APP (debug_win)->dock;
4.143 - gtk_widget_show (dock1);
4.144 -
4.145 - gnome_app_create_menus (GNOME_APP (debug_win), menubar1_uiinfo);
4.146 -
4.147 - toolbar1 = gtk_toolbar_new ();
4.148 - gtk_widget_show (toolbar1);
4.149 - gnome_app_add_toolbar (GNOME_APP (debug_win), GTK_TOOLBAR (toolbar1), "toolbar1",
4.150 - BONOBO_DOCK_ITEM_BEH_EXCLUSIVE,
4.151 - BONOBO_DOCK_TOP, 1, 0, 0);
4.152 - gtk_container_set_border_width (GTK_CONTAINER (toolbar1), 1);
4.153 - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar1), GTK_TOOLBAR_BOTH);
4.154 - tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (toolbar1));
4.155 -
4.156 - tmp_image = gtk_image_new_from_stock ("gtk-cdrom", tmp_toolbar_icon_size);
4.157 - gtk_widget_show (tmp_image);
4.158 - load_btn = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Mount"));
4.159 - gtk_widget_show (load_btn);
4.160 - gtk_container_add (GTK_CONTAINER (toolbar1), load_btn);
4.161 - gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (load_btn), tooltips, _("Mount CD-Rom"), NULL);
4.162 -
4.163 - tmp_image = gtk_image_new_from_stock ("gtk-refresh", tmp_toolbar_icon_size);
4.164 - gtk_widget_show (tmp_image);
4.165 - reset_btn = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Reset"));
4.166 - gtk_widget_show (reset_btn);
4.167 - gtk_container_add (GTK_CONTAINER (toolbar1), reset_btn);
4.168 - gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (reset_btn), tooltips, _("Reset emulator"), NULL);
4.169 -
4.170 - tmp_image = gtk_image_new_from_stock ("gtk-stop", tmp_toolbar_icon_size);
4.171 - gtk_widget_show (tmp_image);
4.172 - stop_btn = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Stop"));
4.173 - gtk_widget_show (stop_btn);
4.174 - gtk_container_add (GTK_CONTAINER (toolbar1), stop_btn);
4.175 - gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (stop_btn), tooltips, _("Stop"), NULL);
4.176 -
4.177 - tmp_image = gtk_image_new_from_stock ("gtk-redo", tmp_toolbar_icon_size);
4.178 - gtk_widget_show (tmp_image);
4.179 - step_btn = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Step"));
4.180 - gtk_widget_show (step_btn);
4.181 - gtk_container_add (GTK_CONTAINER (toolbar1), step_btn);
4.182 - gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (step_btn), tooltips, _("Single step"), NULL);
4.183 -
4.184 - tmp_image = gtk_image_new_from_stock ("gtk-go-forward", tmp_toolbar_icon_size);
4.185 - gtk_widget_show (tmp_image);
4.186 - run_btn = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Run"));
4.187 - gtk_widget_show (run_btn);
4.188 - gtk_container_add (GTK_CONTAINER (toolbar1), run_btn);
4.189 - gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (run_btn), tooltips, _("Run"), NULL);
4.190 -
4.191 - tmp_image = gtk_image_new_from_stock ("gtk-goto-last", tmp_toolbar_icon_size);
4.192 - gtk_widget_show (tmp_image);
4.193 - runto_btn = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Run to"));
4.194 - gtk_widget_show (runto_btn);
4.195 - gtk_container_add (GTK_CONTAINER (toolbar1), runto_btn);
4.196 - gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (runto_btn), tooltips, _("Run to current selection"), NULL);
4.197 -
4.198 - tmp_image = gtk_image_new_from_stock ("gtk-close", tmp_toolbar_icon_size);
4.199 - gtk_widget_show (tmp_image);
4.200 - break_btn = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Break"));
4.201 - gtk_widget_show (break_btn);
4.202 - gtk_container_add (GTK_CONTAINER (toolbar1), break_btn);
4.203 - gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (break_btn), tooltips, _("Set breakpoint"), NULL);
4.204 -
4.205 - tmp_image = gtk_image_new_from_stock ("gtk-open", tmp_toolbar_icon_size);
4.206 - gtk_widget_show (tmp_image);
4.207 - loadstate_button = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Load"));
4.208 - gtk_widget_show (loadstate_button);
4.209 - gtk_container_add (GTK_CONTAINER (toolbar1), loadstate_button);
4.210 - gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (loadstate_button), tooltips, _("Load save-state file"), NULL);
4.211 -
4.212 - tmp_image = gtk_image_new_from_stock ("gtk-save", tmp_toolbar_icon_size);
4.213 - gtk_widget_show (tmp_image);
4.214 - savestate_button = (GtkWidget*) gtk_tool_button_new (tmp_image, _("Save"));
4.215 - gtk_widget_show (savestate_button);
4.216 - gtk_container_add (GTK_CONTAINER (toolbar1), savestate_button);
4.217 - gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (savestate_button), tooltips, _("Save save-state file"), NULL);
4.218 -
4.219 - vpaned1 = gtk_vpaned_new ();
4.220 - gtk_widget_show (vpaned1);
4.221 - gnome_app_set_contents (GNOME_APP (debug_win), vpaned1);
4.222 - gtk_paned_set_position (GTK_PANED (vpaned1), 430);
4.223 -
4.224 - hpaned1 = gtk_hpaned_new ();
4.225 - gtk_widget_show (hpaned1);
4.226 - gtk_paned_pack1 (GTK_PANED (vpaned1), hpaned1, TRUE, TRUE);
4.227 - gtk_paned_set_position (GTK_PANED (hpaned1), 800);
4.228 -
4.229 - vbox2 = gtk_vbox_new (FALSE, 0);
4.230 - gtk_widget_show (vbox2);
4.231 - gtk_paned_pack1 (GTK_PANED (hpaned1), vbox2, FALSE, TRUE);
4.232 -
4.233 - hbox1 = gtk_hbox_new (FALSE, 0);
4.234 - gtk_widget_show (hbox1);
4.235 - gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 3);
4.236 -
4.237 - label21 = gtk_label_new (_("Page"));
4.238 - gtk_widget_show (label21);
4.239 - gtk_box_pack_start (GTK_BOX (hbox1), label21, FALSE, FALSE, 4);
4.240 - gtk_label_set_justify (GTK_LABEL (label21), GTK_JUSTIFY_CENTER);
4.241 -
4.242 - page_field = gtk_entry_new ();
4.243 - gtk_widget_show (page_field);
4.244 - gtk_box_pack_start (GTK_BOX (hbox1), page_field, FALSE, TRUE, 0);
4.245 -
4.246 - page_locked_btn = gtk_check_button_new_with_mnemonic (_("Locked"));
4.247 - gtk_widget_show (page_locked_btn);
4.248 - gtk_box_pack_start (GTK_BOX (hbox1), page_locked_btn, FALSE, FALSE, 5);
4.249 -
4.250 - jump_pc_btn = gtk_button_new_with_mnemonic (_(" Jump to PC "));
4.251 - gtk_widget_show (jump_pc_btn);
4.252 - gtk_box_pack_start (GTK_BOX (hbox1), jump_pc_btn, FALSE, FALSE, 4);
4.253 -
4.254 - label22 = gtk_label_new (_("Mode"));
4.255 - gtk_widget_show (label22);
4.256 - gtk_box_pack_start (GTK_BOX (hbox1), label22, FALSE, FALSE, 5);
4.257 - gtk_label_set_justify (GTK_LABEL (label22), GTK_JUSTIFY_RIGHT);
4.258 - gtk_misc_set_alignment (GTK_MISC (label22), 1, 0.5);
4.259 -
4.260 - mode_box = gtk_combo_new ();
4.261 - g_object_set_data (G_OBJECT (GTK_COMBO (mode_box)->popwin),
4.262 - "GladeParentKey", mode_box);
4.263 - gtk_widget_show (mode_box);
4.264 - gtk_box_pack_start (GTK_BOX (hbox1), mode_box, FALSE, FALSE, 0);
4.265 - mode_box_items = g_list_append (mode_box_items, (gpointer) _("SH4"));
4.266 - mode_box_items = g_list_append (mode_box_items, (gpointer) _("ARM7"));
4.267 - mode_box_items = g_list_append (mode_box_items, (gpointer) _("ARM7T"));
4.268 - gtk_combo_set_popdown_strings (GTK_COMBO (mode_box), mode_box_items);
4.269 - g_list_free (mode_box_items);
4.270 -
4.271 - mode_field = GTK_COMBO (mode_box)->entry;
4.272 - gtk_widget_show (mode_field);
4.273 - gtk_editable_set_editable (GTK_EDITABLE (mode_field), FALSE);
4.274 -
4.275 - label23 = gtk_label_new ("");
4.276 - gtk_widget_show (label23);
4.277 - gtk_box_pack_start (GTK_BOX (hbox1), label23, TRUE, TRUE, 4);
4.278 - gtk_label_set_justify (GTK_LABEL (label23), GTK_JUSTIFY_CENTER);
4.279 -
4.280 - scrolledwindow7 = gtk_scrolled_window_new (NULL, NULL);
4.281 - gtk_widget_show (scrolledwindow7);
4.282 - gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow7, TRUE, TRUE, 0);
4.283 - GTK_WIDGET_UNSET_FLAGS (scrolledwindow7, GTK_CAN_FOCUS);
4.284 - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow7), GTK_SHADOW_IN);
4.285 -
4.286 - disasm_list = gtk_clist_new (4);
4.287 - gtk_widget_show (disasm_list);
4.288 - gtk_container_add (GTK_CONTAINER (scrolledwindow7), disasm_list);
4.289 - gtk_clist_set_column_width (GTK_CLIST (disasm_list), 0, 80);
4.290 - gtk_clist_set_column_width (GTK_CLIST (disasm_list), 1, 80);
4.291 - gtk_clist_set_column_width (GTK_CLIST (disasm_list), 2, 80);
4.292 - gtk_clist_set_column_width (GTK_CLIST (disasm_list), 3, 80);
4.293 - gtk_clist_column_titles_hide (GTK_CLIST (disasm_list));
4.294 -
4.295 - label24 = gtk_label_new ("");
4.296 - gtk_widget_show (label24);
4.297 - gtk_clist_set_column_widget (GTK_CLIST (disasm_list), 0, label24);
4.298 -
4.299 - label27 = gtk_label_new ("");
4.300 - gtk_widget_show (label27);
4.301 - gtk_clist_set_column_widget (GTK_CLIST (disasm_list), 1, label27);
4.302 -
4.303 - label28 = gtk_label_new ("");
4.304 - gtk_widget_show (label28);
4.305 - gtk_clist_set_column_widget (GTK_CLIST (disasm_list), 2, label28);
4.306 -
4.307 - label29 = gtk_label_new ("");
4.308 - gtk_widget_show (label29);
4.309 - gtk_clist_set_column_widget (GTK_CLIST (disasm_list), 3, label29);
4.310 -
4.311 - scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL);
4.312 - gtk_widget_show (scrolledwindow4);
4.313 - gtk_paned_pack2 (GTK_PANED (hpaned1), scrolledwindow4, FALSE, TRUE);
4.314 - GTK_WIDGET_UNSET_FLAGS (scrolledwindow4, GTK_CAN_FOCUS);
4.315 - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
4.316 - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_SHADOW_IN);
4.317 -
4.318 - reg_list = gtk_clist_new (2);
4.319 - gtk_widget_show (reg_list);
4.320 - gtk_container_add (GTK_CONTAINER (scrolledwindow4), reg_list);
4.321 - gtk_clist_set_column_width (GTK_CLIST (reg_list), 0, 80);
4.322 - gtk_clist_set_column_width (GTK_CLIST (reg_list), 1, 80);
4.323 - gtk_clist_column_titles_hide (GTK_CLIST (reg_list));
4.324 -
4.325 - label25 = gtk_label_new ("");
4.326 - gtk_widget_show (label25);
4.327 - gtk_clist_set_column_widget (GTK_CLIST (reg_list), 0, label25);
4.328 -
4.329 - label30 = gtk_label_new ("");
4.330 - gtk_widget_show (label30);
4.331 - gtk_clist_set_column_widget (GTK_CLIST (reg_list), 1, label30);
4.332 -
4.333 - scrolledwindow8 = gtk_scrolled_window_new (NULL, NULL);
4.334 - gtk_widget_show (scrolledwindow8);
4.335 - gtk_paned_pack2 (GTK_PANED (vpaned1), scrolledwindow8, FALSE, TRUE);
4.336 - GTK_WIDGET_UNSET_FLAGS (scrolledwindow8, GTK_CAN_FOCUS);
4.337 - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow8), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
4.338 - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow8), GTK_SHADOW_IN);
4.339 -
4.340 - output_list = gtk_clist_new (4);
4.341 - gtk_widget_show (output_list);
4.342 - gtk_container_add (GTK_CONTAINER (scrolledwindow8), output_list);
4.343 - gtk_clist_set_column_width (GTK_CLIST (output_list), 0, 80);
4.344 - gtk_clist_set_column_width (GTK_CLIST (output_list), 1, 80);
4.345 - gtk_clist_set_column_width (GTK_CLIST (output_list), 2, 80);
4.346 - gtk_clist_set_column_width (GTK_CLIST (output_list), 3, 80);
4.347 - gtk_clist_column_titles_hide (GTK_CLIST (output_list));
4.348 -
4.349 - label26 = gtk_label_new ("");
4.350 - gtk_widget_show (label26);
4.351 - gtk_clist_set_column_widget (GTK_CLIST (output_list), 0, label26);
4.352 -
4.353 - label31 = gtk_label_new ("");
4.354 - gtk_widget_show (label31);
4.355 - gtk_clist_set_column_widget (GTK_CLIST (output_list), 1, label31);
4.356 -
4.357 - label32 = gtk_label_new ("");
4.358 - gtk_widget_show (label32);
4.359 - gtk_clist_set_column_widget (GTK_CLIST (output_list), 2, label32);
4.360 -
4.361 - debug_appbar = gnome_appbar_new (TRUE, TRUE, GNOME_PREFERENCES_NEVER);
4.362 - gtk_widget_show (debug_appbar);
4.363 - gnome_app_set_statusbar (GNOME_APP (debug_win), debug_appbar);
4.364 -
4.365 - g_signal_connect ((gpointer) debug_win, "delete_event",
4.366 - G_CALLBACK (on_debug_win_delete_event),
4.367 - NULL);
4.368 - gnome_app_install_menu_hints (GNOME_APP (debug_win), menubar1_uiinfo);
4.369 - g_signal_connect ((gpointer) load_btn, "clicked",
4.370 - G_CALLBACK (on_load_btn_clicked),
4.371 - NULL);
4.372 - g_signal_connect ((gpointer) reset_btn, "clicked",
4.373 - G_CALLBACK (on_reset_btn_clicked),
4.374 - NULL);
4.375 - g_signal_connect ((gpointer) stop_btn, "clicked",
4.376 - G_CALLBACK (on_stop_btn_clicked),
4.377 - NULL);
4.378 - g_signal_connect ((gpointer) step_btn, "clicked",
4.379 - G_CALLBACK (on_step_btn_clicked),
4.380 - NULL);
4.381 - g_signal_connect ((gpointer) run_btn, "clicked",
4.382 - G_CALLBACK (on_run_btn_clicked),
4.383 - NULL);
4.384 - g_signal_connect ((gpointer) runto_btn, "clicked",
4.385 - G_CALLBACK (on_runto_btn_clicked),
4.386 - NULL);
4.387 - g_signal_connect ((gpointer) break_btn, "clicked",
4.388 - G_CALLBACK (on_break_btn_clicked),
4.389 - NULL);
4.390 - g_signal_connect ((gpointer) loadstate_button, "clicked",
4.391 - G_CALLBACK (on_loadstate_button_clicked),
4.392 - NULL);
4.393 - g_signal_connect ((gpointer) savestate_button, "clicked",
4.394 - G_CALLBACK (on_savestate_button_clicked),
4.395 - NULL);
4.396 - g_signal_connect ((gpointer) page_field, "key_press_event",
4.397 - G_CALLBACK (on_page_field_key_press_event),
4.398 - NULL);
4.399 - g_signal_connect ((gpointer) page_locked_btn, "toggled",
4.400 - G_CALLBACK (on_page_locked_btn_toggled),
4.401 - NULL);
4.402 - g_signal_connect ((gpointer) jump_pc_btn, "clicked",
4.403 - G_CALLBACK (on_jump_pc_btn_clicked),
4.404 - NULL);
4.405 - g_signal_connect ((gpointer) mode_field, "changed",
4.406 - G_CALLBACK (on_mode_field_changed),
4.407 - NULL);
4.408 - g_signal_connect ((gpointer) disasm_list, "select_row",
4.409 - G_CALLBACK (on_disasm_list_select_row),
4.410 - NULL);
4.411 - g_signal_connect ((gpointer) disasm_list, "unselect_row",
4.412 - G_CALLBACK (on_disasm_list_unselect_row),
4.413 - NULL);
4.414 - g_signal_connect ((gpointer) output_list, "select_row",
4.415 - G_CALLBACK (on_output_list_select_row),
4.416 - NULL);
4.417 -
4.418 - /* Store pointers to all widgets, for use by lookup_widget(). */
4.419 - GLADE_HOOKUP_OBJECT_NO_REF (debug_win, debug_win, "debug_win");
4.420 - GLADE_HOOKUP_OBJECT (debug_win, dock1, "dock1");
4.421 - GLADE_HOOKUP_OBJECT (debug_win, menubar1_uiinfo[0].widget, "file1");
4.422 - GLADE_HOOKUP_OBJECT (debug_win, file1_menu_uiinfo[0].widget, "new_file1");
4.423 - GLADE_HOOKUP_OBJECT (debug_win, file1_menu_uiinfo[1].widget, "open1");
4.424 - GLADE_HOOKUP_OBJECT (debug_win, file1_menu_uiinfo[2].widget, "save1");
4.425 - GLADE_HOOKUP_OBJECT (debug_win, file1_menu_uiinfo[3].widget, "save_as1");
4.426 - GLADE_HOOKUP_OBJECT (debug_win, file1_menu_uiinfo[4].widget, "separator1");
4.427 - GLADE_HOOKUP_OBJECT (debug_win, file1_menu_uiinfo[5].widget, "exit1");
4.428 - GLADE_HOOKUP_OBJECT (debug_win, menubar1_uiinfo[1].widget, "view1");
4.429 - GLADE_HOOKUP_OBJECT (debug_win, view1_menu_uiinfo[0].widget, "view_memory");
4.430 - GLADE_HOOKUP_OBJECT (debug_win, view1_menu_uiinfo[1].widget, "mem_mapped_regs1");
4.431 - GLADE_HOOKUP_OBJECT (debug_win, menubar1_uiinfo[2].widget, "settings1");
4.432 - GLADE_HOOKUP_OBJECT (debug_win, settings1_menu_uiinfo[0].widget, "preferences1");
4.433 - GLADE_HOOKUP_OBJECT (debug_win, menubar1_uiinfo[3].widget, "help1");
4.434 - GLADE_HOOKUP_OBJECT (debug_win, help1_menu_uiinfo[0].widget, "about1");
4.435 - GLADE_HOOKUP_OBJECT (debug_win, toolbar1, "toolbar1");
4.436 - GLADE_HOOKUP_OBJECT (debug_win, load_btn, "load_btn");
4.437 - GLADE_HOOKUP_OBJECT (debug_win, reset_btn, "reset_btn");
4.438 - GLADE_HOOKUP_OBJECT (debug_win, stop_btn, "stop_btn");
4.439 - GLADE_HOOKUP_OBJECT (debug_win, step_btn, "step_btn");
4.440 - GLADE_HOOKUP_OBJECT (debug_win, run_btn, "run_btn");
4.441 - GLADE_HOOKUP_OBJECT (debug_win, runto_btn, "runto_btn");
4.442 - GLADE_HOOKUP_OBJECT (debug_win, break_btn, "break_btn");
4.443 - GLADE_HOOKUP_OBJECT (debug_win, loadstate_button, "loadstate_button");
4.444 - GLADE_HOOKUP_OBJECT (debug_win, savestate_button, "savestate_button");
4.445 - GLADE_HOOKUP_OBJECT (debug_win, vpaned1, "vpaned1");
4.446 - GLADE_HOOKUP_OBJECT (debug_win, hpaned1, "hpaned1");
4.447 - GLADE_HOOKUP_OBJECT (debug_win, vbox2, "vbox2");
4.448 - GLADE_HOOKUP_OBJECT (debug_win, hbox1, "hbox1");
4.449 - GLADE_HOOKUP_OBJECT (debug_win, label21, "label21");
4.450 - GLADE_HOOKUP_OBJECT (debug_win, page_field, "page_field");
4.451 - GLADE_HOOKUP_OBJECT (debug_win, page_locked_btn, "page_locked_btn");
4.452 - GLADE_HOOKUP_OBJECT (debug_win, jump_pc_btn, "jump_pc_btn");
4.453 - GLADE_HOOKUP_OBJECT (debug_win, label22, "label22");
4.454 - GLADE_HOOKUP_OBJECT (debug_win, mode_box, "mode_box");
4.455 - GLADE_HOOKUP_OBJECT (debug_win, mode_field, "mode_field");
4.456 - GLADE_HOOKUP_OBJECT (debug_win, label23, "label23");
4.457 - GLADE_HOOKUP_OBJECT (debug_win, scrolledwindow7, "scrolledwindow7");
4.458 - GLADE_HOOKUP_OBJECT (debug_win, disasm_list, "disasm_list");
4.459 - GLADE_HOOKUP_OBJECT (debug_win, label24, "label24");
4.460 - GLADE_HOOKUP_OBJECT (debug_win, label27, "label27");
4.461 - GLADE_HOOKUP_OBJECT (debug_win, label28, "label28");
4.462 - GLADE_HOOKUP_OBJECT (debug_win, label29, "label29");
4.463 - GLADE_HOOKUP_OBJECT (debug_win, scrolledwindow4, "scrolledwindow4");
4.464 - GLADE_HOOKUP_OBJECT (debug_win, reg_list, "reg_list");
4.465 - GLADE_HOOKUP_OBJECT (debug_win, label25, "label25");
4.466 - GLADE_HOOKUP_OBJECT (debug_win, label30, "label30");
4.467 - GLADE_HOOKUP_OBJECT (debug_win, scrolledwindow8, "scrolledwindow8");
4.468 - GLADE_HOOKUP_OBJECT (debug_win, output_list, "output_list");
4.469 - GLADE_HOOKUP_OBJECT (debug_win, label26, "label26");
4.470 - GLADE_HOOKUP_OBJECT (debug_win, label31, "label31");
4.471 - GLADE_HOOKUP_OBJECT (debug_win, label32, "label32");
4.472 - GLADE_HOOKUP_OBJECT (debug_win, debug_appbar, "debug_appbar");
4.473 - GLADE_HOOKUP_OBJECT_NO_REF (debug_win, tooltips, "tooltips");
4.474 -
4.475 - return debug_win;
4.476 -}
4.477 -
4.478 GtkWidget*
4.479 create_mmr_win (void)
4.480 {
4.481 @@ -559,38 +88,6 @@
4.482 }
4.483
4.484 GtkWidget*
4.485 -create_about_win (void)
4.486 -{
4.487 - const gchar *authors[] = {
4.488 - "Nathan Keynes",
4.489 - NULL
4.490 - };
4.491 - const gchar *documenters[] = { NULL };
4.492 - /* TRANSLATORS: Replace this string with your names, one name per line. */
4.493 - gchar *translators = _("translator_credits");
4.494 - GdkPixbuf *about_win_logo_pixbuf;
4.495 - GtkWidget *about_win;
4.496 -
4.497 - if (!strcmp (translators, "translator_credits"))
4.498 - translators = NULL;
4.499 - about_win_logo_pixbuf = create_pixbuf ("dream/dcemu.gif");
4.500 - about_win = gnome_about_new ("Dream", VERSION,
4.501 - _("Copyright(c) 2002 Nathan Keynes"),
4.502 - "",
4.503 - authors,
4.504 - documenters,
4.505 - translators,
4.506 - about_win_logo_pixbuf);
4.507 - gtk_container_set_border_width (GTK_CONTAINER (about_win), 1);
4.508 - gtk_window_set_type_hint (GTK_WINDOW (about_win), GDK_WINDOW_TYPE_HINT_DIALOG);
4.509 -
4.510 - /* Store pointers to all widgets, for use by lookup_widget(). */
4.511 - GLADE_HOOKUP_OBJECT_NO_REF (about_win, about_win, "about_win");
4.512 -
4.513 - return about_win;
4.514 -}
4.515 -
4.516 -GtkWidget*
4.517 create_dump_win (void)
4.518 {
4.519 GtkWidget *dump_win;
4.520 @@ -665,125 +162,3 @@
4.521 return dump_win;
4.522 }
4.523
4.524 -GtkWidget*
4.525 -create_watch_win (void)
4.526 -{
4.527 - GtkWidget *watch_win;
4.528 - GtkWidget *vbox4;
4.529 - GtkWidget *hbox4;
4.530 - GtkWidget *label37;
4.531 - GtkWidget *watch_start_addr;
4.532 - GtkWidget *label38;
4.533 - GtkWidget *watch_end_addr;
4.534 - GtkWidget *label39;
4.535 - GtkWidget *combo1;
4.536 - GtkWidget *watch_type;
4.537 - GtkWidget *button_add_watch;
4.538 - GtkWidget *scrolledwindow10;
4.539 - GtkWidget *treeview1;
4.540 - GtkWidget *hbox5;
4.541 - GtkWidget *label40;
4.542 - GtkWidget *button_clear_all;
4.543 - GtkWidget *button_close;
4.544 -
4.545 - watch_win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
4.546 - gtk_window_set_title (GTK_WINDOW (watch_win), _("Watchpoints"));
4.547 -
4.548 - vbox4 = gtk_vbox_new (FALSE, 0);
4.549 - gtk_widget_show (vbox4);
4.550 - gtk_container_add (GTK_CONTAINER (watch_win), vbox4);
4.551 -
4.552 - hbox4 = gtk_hbox_new (FALSE, 0);
4.553 - gtk_widget_show (hbox4);
4.554 - gtk_box_pack_start (GTK_BOX (vbox4), hbox4, FALSE, TRUE, 3);
4.555 -
4.556 - label37 = gtk_label_new (_("Start addr "));
4.557 - gtk_widget_show (label37);
4.558 - gtk_box_pack_start (GTK_BOX (hbox4), label37, FALSE, FALSE, 3);
4.559 -
4.560 - watch_start_addr = gtk_entry_new ();
4.561 - gtk_widget_show (watch_start_addr);
4.562 - gtk_box_pack_start (GTK_BOX (hbox4), watch_start_addr, FALSE, TRUE, 0);
4.563 -
4.564 - label38 = gtk_label_new (_("End addr"));
4.565 - gtk_widget_show (label38);
4.566 - gtk_box_pack_start (GTK_BOX (hbox4), label38, FALSE, FALSE, 3);
4.567 -
4.568 - watch_end_addr = gtk_entry_new ();
4.569 - gtk_widget_show (watch_end_addr);
4.570 - gtk_box_pack_start (GTK_BOX (hbox4), watch_end_addr, FALSE, TRUE, 0);
4.571 -
4.572 - label39 = gtk_label_new (_("Type"));
4.573 - gtk_widget_show (label39);
4.574 - gtk_box_pack_start (GTK_BOX (hbox4), label39, FALSE, FALSE, 3);
4.575 -
4.576 - combo1 = gtk_combo_new ();
4.577 - g_object_set_data (G_OBJECT (GTK_COMBO (combo1)->popwin),
4.578 - "GladeParentKey", combo1);
4.579 - gtk_widget_show (combo1);
4.580 - gtk_box_pack_start (GTK_BOX (hbox4), combo1, TRUE, TRUE, 0);
4.581 -
4.582 - watch_type = GTK_COMBO (combo1)->entry;
4.583 - gtk_widget_show (watch_type);
4.584 -
4.585 - button_add_watch = gtk_button_new_with_mnemonic (_("Add Watch"));
4.586 - gtk_widget_show (button_add_watch);
4.587 - gtk_box_pack_start (GTK_BOX (hbox4), button_add_watch, FALSE, FALSE, 3);
4.588 -
4.589 - scrolledwindow10 = gtk_scrolled_window_new (NULL, NULL);
4.590 - gtk_widget_show (scrolledwindow10);
4.591 - gtk_box_pack_start (GTK_BOX (vbox4), scrolledwindow10, TRUE, TRUE, 0);
4.592 -
4.593 - treeview1 = gtk_tree_view_new ();
4.594 - gtk_widget_show (treeview1);
4.595 - gtk_container_add (GTK_CONTAINER (scrolledwindow10), treeview1);
4.596 - gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview1), FALSE);
4.597 -
4.598 - hbox5 = gtk_hbox_new (FALSE, 0);
4.599 - gtk_widget_show (hbox5);
4.600 - gtk_box_pack_start (GTK_BOX (vbox4), hbox5, FALSE, TRUE, 3);
4.601 -
4.602 - label40 = gtk_label_new ("");
4.603 - gtk_widget_show (label40);
4.604 - gtk_box_pack_start (GTK_BOX (hbox5), label40, TRUE, TRUE, 0);
4.605 -
4.606 - button_clear_all = gtk_button_new_with_mnemonic (_("Clear all"));
4.607 - gtk_widget_show (button_clear_all);
4.608 - gtk_box_pack_start (GTK_BOX (hbox5), button_clear_all, FALSE, FALSE, 3);
4.609 -
4.610 - button_close = gtk_button_new_with_mnemonic (_("Close"));
4.611 - gtk_widget_show (button_close);
4.612 - gtk_box_pack_start (GTK_BOX (hbox5), button_close, FALSE, FALSE, 5);
4.613 -
4.614 - g_signal_connect ((gpointer) button_add_watch, "clicked",
4.615 - G_CALLBACK (on_button_add_watch_clicked),
4.616 - NULL);
4.617 - g_signal_connect ((gpointer) button_clear_all, "clicked",
4.618 - G_CALLBACK (on_button_clear_all_clicked),
4.619 - NULL);
4.620 - g_signal_connect ((gpointer) button_close, "clicked",
4.621 - G_CALLBACK (on_button_close_clicked),
4.622 - NULL);
4.623 -
4.624 - /* Store pointers to all widgets, for use by lookup_widget(). */
4.625 - GLADE_HOOKUP_OBJECT_NO_REF (watch_win, watch_win, "watch_win");
4.626 - GLADE_HOOKUP_OBJECT (watch_win, vbox4, "vbox4");
4.627 - GLADE_HOOKUP_OBJECT (watch_win, hbox4, "hbox4");
4.628 - GLADE_HOOKUP_OBJECT (watch_win, label37, "label37");
4.629 - GLADE_HOOKUP_OBJECT (watch_win, watch_start_addr, "watch_start_addr");
4.630 - GLADE_HOOKUP_OBJECT (watch_win, label38, "label38");
4.631 - GLADE_HOOKUP_OBJECT (watch_win, watch_end_addr, "watch_end_addr");
4.632 - GLADE_HOOKUP_OBJECT (watch_win, label39, "label39");
4.633 - GLADE_HOOKUP_OBJECT (watch_win, combo1, "combo1");
4.634 - GLADE_HOOKUP_OBJECT (watch_win, watch_type, "watch_type");
4.635 - GLADE_HOOKUP_OBJECT (watch_win, button_add_watch, "button_add_watch");
4.636 - GLADE_HOOKUP_OBJECT (watch_win, scrolledwindow10, "scrolledwindow10");
4.637 - GLADE_HOOKUP_OBJECT (watch_win, treeview1, "treeview1");
4.638 - GLADE_HOOKUP_OBJECT (watch_win, hbox5, "hbox5");
4.639 - GLADE_HOOKUP_OBJECT (watch_win, label40, "label40");
4.640 - GLADE_HOOKUP_OBJECT (watch_win, button_clear_all, "button_clear_all");
4.641 - GLADE_HOOKUP_OBJECT (watch_win, button_close, "button_close");
4.642 -
4.643 - return watch_win;
4.644 -}
4.645 -
5.1 --- a/src/gui/dump_win.c Sun Oct 21 05:20:35 2007 +0000
5.2 +++ b/src/gui/dump_win.c Sun Oct 21 05:21:35 2007 +0000
5.3 @@ -1,5 +1,5 @@
5.4 /**
5.5 - * $Id: dump_win.c,v 1.4 2007-10-10 11:02:04 nkeynes Exp $
5.6 + * $Id: dump_win.c,v 1.5 2007-10-21 05:21:35 nkeynes Exp $
5.7 *
5.8 * Implements the memory dump window.
5.9 *
5.10 @@ -43,13 +43,13 @@
5.11
5.12 static dump_data_t dump_list_head = NULL;
5.13
5.14 -gboolean on_dump_win_delete_event( GtkWidget *widget, GdkEvent *event,
5.15 +gboolean on_dump_window_delete_event( GtkWidget *widget, GdkEvent *event,
5.16 gpointer user_data );
5.17 -void on_dump_win_button_view_clicked( GtkWidget *widget, gpointer user_data );
5.18 -void dump_win_set_text( dump_data_t data, unsigned char *old_data, unsigned char *new_data );
5.19 +void on_dump_window_button_view_clicked( GtkWidget *widget, gpointer user_data );
5.20 +void dump_window_set_text( dump_data_t data, unsigned char *old_data, unsigned char *new_data );
5.21
5.22
5.23 -void dump_window_new( void ) {
5.24 +void dump_window_new( const gchar *title ) {
5.25 GtkWidget *win = create_dump_win();
5.26 GtkWidget *dump_view_button = (GtkWidget *)g_object_get_data(G_OBJECT(win), "dump_view_button");
5.27 dump_data_t data = malloc( sizeof(struct dump_data) );
5.28 @@ -73,10 +73,10 @@
5.29 gtk_widget_modify_font(GTK_WIDGET(data->textArea),gui_fixed_font);
5.30
5.31 g_signal_connect ((gpointer) win, "delete_event",
5.32 - G_CALLBACK (on_dump_win_delete_event),
5.33 + G_CALLBACK (on_dump_window_delete_event),
5.34 data);
5.35 g_signal_connect ((gpointer) dump_view_button, "clicked",
5.36 - G_CALLBACK (on_dump_win_button_view_clicked),
5.37 + G_CALLBACK (on_dump_window_button_view_clicked),
5.38 data);
5.39 gtk_widget_show( GTK_WIDGET(win) );
5.40 }
5.41 @@ -105,7 +105,7 @@
5.42 }
5.43
5.44
5.45 -gboolean on_dump_win_delete_event( GtkWidget *widget, GdkEvent *event,
5.46 +gboolean on_dump_window_delete_event( GtkWidget *widget, GdkEvent *event,
5.47 gpointer user_data )
5.48 {
5.49 dump_data_t data = (dump_data_t)user_data;
5.50 @@ -125,7 +125,7 @@
5.51 return FALSE;
5.52 }
5.53
5.54 -void on_dump_win_button_view_clicked( GtkWidget *widget, gpointer user_data )
5.55 +void on_dump_window_button_view_clicked( GtkWidget *widget, gpointer user_data )
5.56 {
5.57 dump_data_t data = (dump_data_t)user_data;
5.58 uint32_t startVal, endVal;
5.59 @@ -156,12 +156,12 @@
5.60 if( startVal != endVal ) {
5.61 data->data = malloc( endVal - startVal );
5.62 mem_copy_from_sh4( data->data, startVal, endVal-startVal );
5.63 - dump_win_set_text( data, data->data, data->data );
5.64 + dump_window_set_text( data, data->data, data->data );
5.65 }
5.66 }
5.67 }
5.68
5.69 -void dump_win_update( dump_data_t data )
5.70 +void dump_window_update( dump_data_t data )
5.71 {
5.72 if( data->data == NULL )
5.73 return;
5.74 @@ -169,19 +169,19 @@
5.75 int length = data->end-data->start;
5.76 memcpy( tmp, data->data, length );
5.77 mem_copy_from_sh4( data->data, data->start, length );
5.78 - dump_win_set_text( data, tmp, data->data );
5.79 + dump_window_set_text( data, tmp, data->data );
5.80 }
5.81
5.82 -void dump_win_update_all( )
5.83 +void dump_window_update_all( )
5.84 {
5.85 dump_data_t node = dump_list_head;
5.86 while( node != NULL ) {
5.87 - dump_win_update(node);
5.88 + dump_window_update(node);
5.89 node = node->next;
5.90 }
5.91 }
5.92
5.93 -void dump_win_set_text( dump_data_t data, unsigned char *old_data, unsigned char *new_data )
5.94 +void dump_window_set_text( dump_data_t data, unsigned char *old_data, unsigned char *new_data )
5.95 {
5.96 GtkTextBuffer *buf = data->textBuffer;
5.97 GtkTextTag *changedTag = data->changedTag;
6.1 --- a/src/gui/gtkcb.c Sun Oct 21 05:20:35 2007 +0000
6.2 +++ b/src/gui/gtkcb.c Sun Oct 21 05:21:35 2007 +0000
6.3 @@ -1,5 +1,5 @@
6.4 /**
6.5 - * $Id: gtkcb.c,v 1.4 2007-10-17 11:26:45 nkeynes Exp $
6.6 + * $Id: gtkcb.c,v 1.5 2007-10-21 05:21:35 nkeynes Exp $
6.7 *
6.8 * Action callbacks from the main window
6.9 *
6.10 @@ -21,6 +21,7 @@
6.11 #include "dreamcast.h"
6.12 #include "gdrom/gdrom.h"
6.13 #include "gui/gtkui.h"
6.14 +#include "pvr2/pvr2.h"
6.15
6.16 typedef gboolean (*file_callback_t)( const gchar *filename );
6.17
6.18 @@ -161,11 +162,6 @@
6.19 exit(0);
6.20 }
6.21
6.22 -void debugger_action_callback( GtkAction *action, gpointer user_data)
6.23 -{
6.24 - gtk_gui_show_debugger();
6.25 -}
6.26 -
6.27 void path_settings_callback( GtkAction *action, gpointer user_data)
6.28 {
6.29 path_dialog_run();
6.30 @@ -175,9 +171,9 @@
6.31 {
6.32 }
6.33
6.34 -void controller_settings_callback( GtkAction *action, gpointer user_data)
6.35 +void maple_settings_callback( GtkAction *action, gpointer user_data)
6.36 {
6.37 - controller_dialog_run( );
6.38 + maple_dialog_run( );
6.39 }
6.40
6.41 void network_settings_callback( GtkAction *action, gpointer user_data)
6.42 @@ -191,3 +187,50 @@
6.43 void fullscreen_toggle_callback( GtkToggleAction *action, gpointer user_data)
6.44 {
6.45 }
6.46 +
6.47 +void debugger_action_callback( GtkAction *action, gpointer user_data)
6.48 +{
6.49 + gtk_gui_show_debugger();
6.50 +}
6.51 +
6.52 +void debug_memory_action_callback( GtkAction *action, gpointer user_data)
6.53 +{
6.54 + dump_window_new( APP_NAME " " APP_VERSION " :: Memory dump" );
6.55 +}
6.56 +
6.57 +void debug_mmio_action_callback( GtkAction *action, gpointer user_data)
6.58 +{
6.59 + gtk_gui_show_mmio();
6.60 +}
6.61 +
6.62 +void save_scene_action_callback( GtkAction *action, gpointer user_data)
6.63 +{
6.64 + const gchar *dir = lxdream_get_config_value(CONFIG_SAVE_PATH);
6.65 + save_file_dialog( "Save next scene...", pvr2_save_next_scene, "*.dsc", "lxdream scene file (*.dsc)", dir );
6.66 +}
6.67 +
6.68 +void debug_step_action_callback( GtkAction *action, gpointer user_data)
6.69 +{
6.70 + debug_window_single_step(gtk_gui_get_debugger());
6.71 +}
6.72 +
6.73 +void debug_runto_action_callback( GtkAction *action, gpointer user_data)
6.74 +{
6.75 + debug_window_t debug = gtk_gui_get_debugger();
6.76 + int selected_row = debug_window_get_selected_row(debug);
6.77 + if( selected_row == -1 ) {
6.78 + WARN( "No address selected, so can't run to it", NULL );
6.79 + } else {
6.80 + debug_window_set_oneshot_breakpoint( debug, selected_row );
6.81 + dreamcast_run();
6.82 + }
6.83 +}
6.84 +
6.85 +void debug_breakpoint_action_callback( GtkAction *action, gpointer user_data)
6.86 +{
6.87 + debug_window_t debug = gtk_gui_get_debugger();
6.88 + int selected_row = debug_window_get_selected_row(debug);
6.89 + if( selected_row != -1 ) {
6.90 + debug_window_toggle_breakpoint( debug, selected_row );
6.91 + }
6.92 +}
7.1 --- a/src/gui/gtkui.c Sun Oct 21 05:20:35 2007 +0000
7.2 +++ b/src/gui/gtkui.c Sun Oct 21 05:21:35 2007 +0000
7.3 @@ -1,5 +1,5 @@
7.4 /**
7.5 - * $Id: gtkui.c,v 1.4 2007-10-17 11:26:45 nkeynes Exp $
7.6 + * $Id: gtkui.c,v 1.5 2007-10-21 05:21:35 nkeynes Exp $
7.7 *
7.8 * Core GTK-based user interface
7.9 *
7.10 @@ -44,11 +44,144 @@
7.11 static mmio_window_t mmio_win = NULL;
7.12
7.13 /**
7.14 + * UIManager and action helpers
7.15 + */
7.16 +static GtkUIManager *global_ui_manager;
7.17 +static GtkAccelGroup *global_accel_group;
7.18 +static GtkActionGroup *global_action_group;
7.19 +
7.20 +/**
7.21 * Count of running nanoseconds - used to cut back on the GUI runtime
7.22 */
7.23 static uint32_t gtk_gui_nanos = 0;
7.24 static struct timeval gtk_gui_lasttv;
7.25
7.26 +
7.27 +#define ENABLE_ACTION(win,name) SET_ACTION_ENABLED(win,name,TRUE)
7.28 +#define DISABLE_ACTION(win,name) SET_ACTION_ENABLED(win,name,FALSE)
7.29 +
7.30 +// UI Actions
7.31 +static const GtkActionEntry ui_actions[] = {
7.32 + { "FileMenu", NULL, "_File" },
7.33 + { "SettingsMenu", NULL, "_Settings" },
7.34 + { "HelpMenu", NULL, "_Help" },
7.35 + { "Mount", GTK_STOCK_CDROM, "_Mount...", "<control>O", "Mount a cdrom disc", G_CALLBACK(mount_action_callback) },
7.36 + { "Reset", GTK_STOCK_REFRESH, "_Reset", "<control>R", "Reset dreamcast", G_CALLBACK(reset_action_callback) },
7.37 + { "Pause", GTK_STOCK_MEDIA_PAUSE, "_Pause", NULL, "Pause dreamcast", G_CALLBACK(pause_action_callback) },
7.38 + { "Run", GTK_STOCK_MEDIA_PLAY, "Resume", NULL, "Resume", G_CALLBACK(resume_action_callback) },
7.39 + { "LoadState", GTK_STOCK_REVERT_TO_SAVED, "_Load state...", "F4", "Load an lxdream save state", G_CALLBACK(load_state_action_callback) },
7.40 + { "SaveState", GTK_STOCK_SAVE_AS, "_Save state...", "F3", "Create an lxdream save state", G_CALLBACK(save_state_action_callback) },
7.41 + { "Exit", GTK_STOCK_QUIT, "E_xit", NULL, "Exit lxdream", G_CALLBACK(exit_action_callback) },
7.42 + { "PathSettings", NULL, "_Paths...", NULL, "Configure files and paths", G_CALLBACK(path_settings_callback) },
7.43 + { "AudioSettings", NULL, "_Audio...", NULL, "Configure audio output", G_CALLBACK(audio_settings_callback) },
7.44 + { "ControllerSettings", NULL, "_Controllers...", NULL, "Configure controllers", G_CALLBACK(maple_settings_callback) },
7.45 + { "NetworkSettings", NULL, "_Network...", NULL, "Configure network settings", G_CALLBACK(network_settings_callback) },
7.46 + { "VideoSettings", NULL, "_Video...", NULL, "Configure video output", G_CALLBACK(video_settings_callback) },
7.47 + { "About", GTK_STOCK_ABOUT, "_About...", NULL, "About lxdream", G_CALLBACK(about_action_callback) },
7.48 + { "DebugMenu", NULL, "_Debug" },
7.49 + { "Debugger", NULL, "_Debugger", NULL, "Open debugger window", G_CALLBACK(debugger_action_callback) },
7.50 + { "DebugMem", NULL, "View _Memory", NULL, "View memory dump", G_CALLBACK(debug_memory_action_callback) },
7.51 + { "DebugMmio", NULL, "View IO _Registers", NULL, "View MMIO Registers", G_CALLBACK(debug_mmio_action_callback) },
7.52 + { "SaveScene", NULL, "_Save Scene", NULL, "Save next rendered scene", G_CALLBACK(save_scene_action_callback) },
7.53 + { "SingleStep", GTK_STOCK_REDO, "_Single Step", NULL, "Single step", G_CALLBACK(debug_step_action_callback) },
7.54 + { "RunTo", GTK_STOCK_GOTO_LAST, "Run _To", NULL, "Run to", G_CALLBACK( debug_runto_action_callback) },
7.55 + { "SetBreakpoint", GTK_STOCK_CLOSE, "_Breakpoint", NULL, "Toggle breakpoint", G_CALLBACK( debug_breakpoint_action_callback) }
7.56 +};
7.57 +static const GtkToggleActionEntry ui_toggle_actions[] = {
7.58 + { "FullScreen", NULL, "_Full Screen", "<alt>Return", "Toggle full screen video", G_CALLBACK(fullscreen_toggle_callback), 0 },
7.59 +};
7.60 +
7.61 +// Menus and toolbars
7.62 +static const char *ui_description =
7.63 + "<ui>"
7.64 + " <menubar name='MainMenu'>"
7.65 + " <menu action='FileMenu'>"
7.66 + " <menuitem action='Mount'/>"
7.67 + " <separator/>"
7.68 + " <menuitem action='Reset'/>"
7.69 + " <menuitem action='Pause'/>"
7.70 + " <menuitem action='Run'/>"
7.71 + " <menuitem action='Debugger'/>"
7.72 + " <separator/>"
7.73 + " <menuitem action='LoadState'/>"
7.74 + " <menuitem action='SaveState'/>"
7.75 + " <separator/>"
7.76 + " <menuitem action='Exit'/>"
7.77 + " </menu>"
7.78 + " <menu action='SettingsMenu'>"
7.79 + " <menuitem action='PathSettings'/>"
7.80 + " <menuitem action='AudioSettings'/>"
7.81 + " <menuitem action='ControllerSettings'/>"
7.82 + " <menuitem action='NetworkSettings'/>"
7.83 + " <menuitem action='VideoSettings'/>"
7.84 + " <separator/>"
7.85 + " <menuitem action='FullScreen'/>"
7.86 + " </menu>"
7.87 + " <menu action='HelpMenu'>"
7.88 + " <menuitem action='About'/>"
7.89 + " </menu>"
7.90 + " </menubar>"
7.91 + " <toolbar name='MainToolbar'>"
7.92 + " <toolitem action='Mount'/>"
7.93 + " <toolitem action='Reset'/>"
7.94 + " <toolitem action='Pause'/>"
7.95 + " <toolitem action='Run'/>"
7.96 + " <separator/>"
7.97 + " <toolitem action='LoadState'/>"
7.98 + " <toolitem action='SaveState'/>"
7.99 + " </toolbar>"
7.100 + " <menubar name='DebugMenu'>"
7.101 + " <menu action='FileMenu'>"
7.102 + " <menuitem action='Mount'/>"
7.103 + " <separator/>"
7.104 + " <menuitem action='Reset'/>"
7.105 + " <separator/>"
7.106 + " <menuitem action='LoadState'/>"
7.107 + " <menuitem action='SaveState'/>"
7.108 + " <separator/>"
7.109 + " <menuitem action='Exit'/>"
7.110 + " </menu>"
7.111 + " <menu action='DebugMenu'>"
7.112 + " <menuitem action='DebugMem'/>"
7.113 + " <menuitem action='DebugMmio'/>"
7.114 + " <menuitem action='SaveScene'/>"
7.115 + " <separator/>"
7.116 + " <menuitem action='SetBreakpoint'/>"
7.117 + " <menuitem action='Pause'/>"
7.118 + " <menuitem action='SingleStep'/>"
7.119 + " <menuitem action='RunTo'/>"
7.120 + " <menuitem action='Run'/>"
7.121 + " </menu>"
7.122 + " <menu action='SettingsMenu'>"
7.123 + " <menuitem action='PathSettings'/>"
7.124 + " <menuitem action='AudioSettings'/>"
7.125 + " <menuitem action='ControllerSettings'/>"
7.126 + " <menuitem action='NetworkSettings'/>"
7.127 + " <menuitem action='VideoSettings'/>"
7.128 + " <separator/>"
7.129 + " <menuitem action='FullScreen'/>"
7.130 + " </menu>"
7.131 + " <menu action='HelpMenu'>"
7.132 + " <menuitem action='About'/>"
7.133 + " </menu>"
7.134 + " </menubar>"
7.135 + " <toolbar name='DebugToolbar'>"
7.136 + " <toolitem action='Mount'/>"
7.137 + " <toolitem action='Reset'/>"
7.138 + " <toolitem action='Pause'/>"
7.139 + " <separator/>"
7.140 + " <toolitem action='SingleStep'/>"
7.141 + " <toolitem action='RunTo'/>"
7.142 + " <toolitem action='Run'/>"
7.143 + " <toolitem action='SetBreakpoint'/>"
7.144 + " <separator/>"
7.145 + " <toolitem action='LoadState'/>"
7.146 + " <toolitem action='SaveState'/>"
7.147 + " </toolbar>"
7.148 + "</ui>";
7.149 +
7.150 +
7.151 +
7.152 gboolean gui_parse_cmdline( int *argc, char **argv[] )
7.153 {
7.154 return gtk_init_check( argc, argv );
7.155 @@ -56,12 +189,34 @@
7.156
7.157 gboolean gui_init( gboolean withDebug )
7.158 {
7.159 + GError *error = NULL;
7.160 dreamcast_register_module( &gtk_gui_module );
7.161 gtk_gui_alloc_resources();
7.162 +
7.163 + global_action_group = gtk_action_group_new("MenuActions");
7.164 + gtk_action_group_add_actions( global_action_group, ui_actions, G_N_ELEMENTS(ui_actions), NULL );
7.165 + gtk_action_group_add_toggle_actions( global_action_group, ui_toggle_actions, G_N_ELEMENTS(ui_toggle_actions), NULL );
7.166 + gtk_gui_enable_action("AudioSettings", FALSE);
7.167 + gtk_gui_enable_action("NetworkSettings", FALSE);
7.168 + gtk_gui_enable_action("VideoSettings", FALSE);
7.169 + global_ui_manager = gtk_ui_manager_new();
7.170 + gtk_ui_manager_set_add_tearoffs(global_ui_manager, TRUE);
7.171 + gtk_ui_manager_insert_action_group( global_ui_manager, global_action_group, 0 );
7.172 +
7.173 + if (!gtk_ui_manager_add_ui_from_string (global_ui_manager, ui_description, -1, &error)) {
7.174 + g_message ("building menus failed: %s", error->message);
7.175 + g_error_free (error);
7.176 + exit(1);
7.177 + }
7.178 + GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group (global_ui_manager);
7.179 + GtkWidget *menubar = gtk_ui_manager_get_widget(global_ui_manager, "/MainMenu");
7.180 + GtkWidget *toolbar = gtk_ui_manager_get_widget(global_ui_manager, "/MainToolbar");
7.181 + main_win = main_window_new( APP_NAME " " APP_VERSION, menubar, toolbar, accel_group );
7.182 +
7.183 if( withDebug ) {
7.184 - debug_win = debug_window_new();
7.185 + gtk_gui_show_debugger();
7.186 }
7.187 - main_win = main_window_new( APP_NAME " " APP_VERSION );
7.188 +
7.189 return TRUE;
7.190 }
7.191
7.192 @@ -99,9 +254,37 @@
7.193 if( debug_win ) {
7.194 debug_window_show(debug_win, TRUE);
7.195 } else {
7.196 - debug_win = debug_window_new();
7.197 + GtkAccelGroup *accel_group = gtk_ui_manager_get_accel_group (global_ui_manager);
7.198 + GtkWidget *menubar = gtk_ui_manager_get_widget(global_ui_manager, "/DebugMenu");
7.199 + GtkWidget *toolbar = gtk_ui_manager_get_widget(global_ui_manager, "/DebugToolbar");
7.200 + debug_win = debug_window_new( APP_NAME " " APP_VERSION " :: Debugger", menubar, toolbar, accel_group );
7.201 }
7.202 -}
7.203 +}
7.204 +
7.205 +void gtk_gui_show_mmio()
7.206 +{
7.207 + if( mmio_win ) {
7.208 + mmio_window_show(mmio_win, TRUE);
7.209 + } else {
7.210 + mmio_win = mmio_window_new( APP_NAME " " APP_VERSION " :: MMIO Registers" );
7.211 + }
7.212 +}
7.213 +
7.214 +
7.215 +main_window_t gtk_gui_get_main()
7.216 +{
7.217 + return main_win;
7.218 +}
7.219 +
7.220 +debug_window_t gtk_gui_get_debugger()
7.221 +{
7.222 + return debug_win;
7.223 +}
7.224 +
7.225 +mmio_window_t gtk_gui_get_mmio()
7.226 +{
7.227 + return mmio_win;
7.228 +}
7.229
7.230 GtkWidget *gtk_gui_get_renderarea()
7.231 {
7.232 @@ -141,7 +324,7 @@
7.233 if( mmio_win ) {
7.234 mmio_win_update(mmio_win);
7.235 }
7.236 - dump_win_update_all();
7.237 + dump_window_update_all();
7.238 }
7.239
7.240 /**
7.241 @@ -211,7 +394,7 @@
7.242 gui_fixed_font = pango_font_description_from_string("Courier 10");
7.243 }
7.244
7.245 -gint gtk_gui_run_property_dialog( const gchar *title, GtkWidget *panel )
7.246 +gint gtk_gui_run_property_dialog( const gchar *title, GtkWidget *panel, gtk_dialog_done_fn fn )
7.247 {
7.248 GtkWidget *dialog =
7.249 gtk_dialog_new_with_buttons(title, main_window_get_frame(main_win),
7.250 @@ -223,6 +406,14 @@
7.251 gtk_widget_show_all(panel);
7.252 gtk_container_add( GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), panel );
7.253 result = gtk_dialog_run( GTK_DIALOG(dialog) );
7.254 + if( fn != NULL ) {
7.255 + fn(panel, result == GTK_RESPONSE_ACCEPT);
7.256 + }
7.257 gtk_widget_destroy( dialog );
7.258 return result;
7.259 }
7.260 +
7.261 +void gtk_gui_enable_action( const gchar *action, gboolean enable )
7.262 +{
7.263 + gtk_action_set_sensitive( gtk_action_group_get_action( global_action_group, action), enable);
7.264 +}
8.1 --- a/src/gui/gtkui.h Sun Oct 21 05:20:35 2007 +0000
8.2 +++ b/src/gui/gtkui.h Sun Oct 21 05:21:35 2007 +0000
8.3 @@ -1,5 +1,5 @@
8.4 /**
8.5 - * $Id: gtkui.h,v 1.4 2007-10-17 11:26:45 nkeynes Exp $
8.6 + * $Id: gtkui.h,v 1.5 2007-10-21 05:21:35 nkeynes Exp $
8.7 *
8.8 * Core GTK-based user interface
8.9 *
8.10 @@ -33,27 +33,41 @@
8.11 * Construct and show the main window, returning an
8.12 * opaque pointer to the window.
8.13 */
8.14 -main_window_t main_window_new( const gchar *title );
8.15 +main_window_t main_window_new( const gchar *title, GtkWidget *menubar,
8.16 + GtkWidget *toolbar, GtkAccelGroup *accel );
8.17 GtkWindow *main_window_get_frame( main_window_t win );
8.18 GtkWidget *main_window_get_renderarea( main_window_t win );
8.19 void main_window_set_running( main_window_t win, gboolean running );
8.20 void main_window_set_framerate( main_window_t win, float rate );
8.21 void main_window_set_speed( main_window_t win, double speed );
8.22
8.23 -debug_window_t debug_window_new();
8.24 +debug_window_t debug_window_new( const gchar *title, GtkWidget *menubar,
8.25 + GtkWidget *toolbar, GtkAccelGroup *accel );
8.26 void debug_window_show( debug_window_t win, gboolean show );
8.27 void debug_window_set_running( debug_window_t win, gboolean running );
8.28 void debug_window_update(debug_window_t win);
8.29 +void debug_window_single_step( debug_window_t data );
8.30 +void debug_window_set_oneshot_breakpoint( debug_window_t data, int row );
8.31 +void debug_window_toggle_breakpoint( debug_window_t data, int row );
8.32
8.33 -mmio_window_t mmio_window_new();
8.34 +
8.35 +mmio_window_t mmio_window_new( const gchar *title );
8.36 void mmio_window_show( mmio_window_t win, gboolean show );
8.37
8.38 -void controller_dialog_run();
8.39 +void dump_window_new( const gchar *title );
8.40 +
8.41 +void maple_dialog_run();
8.42 void path_dialog_run();
8.43
8.44 +main_window_t gtk_gui_get_main();
8.45 +debug_window_t gtk_gui_get_debugger();
8.46 +mmio_window_t gtk_gui_get_mmio();
8.47 +
8.48 /********************* Helper functions **********************/
8.49
8.50 -gint gtk_gui_run_property_dialog( const gchar *title, GtkWidget *panel );
8.51 +typedef void (*gtk_dialog_done_fn)(GtkWidget *panel, gboolean isOK);
8.52 +void gtk_gui_enable_action( const gchar *action, gboolean enabled );
8.53 +gint gtk_gui_run_property_dialog( const gchar *title, GtkWidget *panel, gtk_dialog_done_fn fn );
8.54
8.55 /******************** Video driver hooks *********************/
8.56
8.57 @@ -68,16 +82,23 @@
8.58 void load_state_action_callback( GtkAction *action, gpointer user_data);
8.59 void save_state_action_callback( GtkAction *action, gpointer user_data);
8.60 void about_action_callback( GtkAction *action, gpointer user_data);
8.61 -void debugger_action_callback( GtkAction *action, gpointer user_data);
8.62 void exit_action_callback( GtkAction *action, gpointer user_data);
8.63
8.64 void path_settings_callback( GtkAction *action, gpointer user_data);
8.65 void audio_settings_callback( GtkAction *action, gpointer user_data);
8.66 -void controller_settings_callback( GtkAction *action, gpointer user_data);
8.67 +void maple_settings_callback( GtkAction *action, gpointer user_data);
8.68 void network_settings_callback( GtkAction *action, gpointer user_data);
8.69 void video_settings_callback( GtkAction *action, gpointer user_data);
8.70 void fullscreen_toggle_callback( GtkToggleAction *action, gpointer user_data);
8.71
8.72 +void debugger_action_callback( GtkAction *action, gpointer user_data);
8.73 +void debug_memory_action_callback( GtkAction *action, gpointer user_data);
8.74 +void debug_mmio_action_callback( GtkAction *action, gpointer user_data);
8.75 +void save_scene_action_callback( GtkAction *action, gpointer user_data);
8.76 +void debug_step_action_callback( GtkAction *action, gpointer user_data);
8.77 +void debug_runto_action_callback( GtkAction *action, gpointer user_data);
8.78 +void debug_breakpoint_action_callback( GtkAction *action, gpointer user_data);
8.79 +
8.80 /*************** Constant colour/font values *****************/
8.81 extern PangoFontDescription *gui_fixed_font;
8.82 extern GdkColor gui_colour_normal, gui_colour_changed, gui_colour_error;
9.1 --- a/src/gui/main_win.c Sun Oct 21 05:20:35 2007 +0000
9.2 +++ b/src/gui/main_win.c Sun Oct 21 05:21:35 2007 +0000
9.3 @@ -1,5 +1,5 @@
9.4 /**
9.5 - * $Id: main_win.c,v 1.5 2007-10-17 11:26:45 nkeynes Exp $
9.6 + * $Id: main_win.c,v 1.6 2007-10-21 05:21:35 nkeynes Exp $
9.7 *
9.8 * Define the main (emu) GTK window, along with its menubars,
9.9 * toolbars, etc.
9.10 @@ -30,119 +30,26 @@
9.11 #include "dream.h"
9.12 #include "gui/gtkui.h"
9.13
9.14 -#define SET_ACTION_ENABLED(win,name,b) gtk_action_set_sensitive( gtk_action_group_get_action( win->actions, name), b)
9.15 -#define ENABLE_ACTION(win,name) SET_ACTION_ENABLED(win,name,TRUE)
9.16 -#define DISABLE_ACTION(win,name) SET_ACTION_ENABLED(win,name,FALSE)
9.17 -
9.18 -static const GtkActionEntry ui_actions[] = {
9.19 - { "FileMenu", NULL, "_File" },
9.20 - { "SettingsMenu", NULL, "_Settings" },
9.21 - { "HelpMenu", NULL, "_Help" },
9.22 - { "Mount", GTK_STOCK_CDROM, "_Mount...", "<control>O", "Mount a cdrom disc", G_CALLBACK(mount_action_callback) },
9.23 - { "Reset", GTK_STOCK_REFRESH, "_Reset", "<control>R", "Reset dreamcast", G_CALLBACK(reset_action_callback) },
9.24 - { "Pause", GTK_STOCK_MEDIA_PAUSE, "_Pause", NULL, "Pause dreamcast", G_CALLBACK(pause_action_callback) },
9.25 - { "Run", GTK_STOCK_MEDIA_PLAY, "Resume", NULL, "Resume", G_CALLBACK(resume_action_callback) },
9.26 - { "LoadState", GTK_STOCK_REVERT_TO_SAVED, "_Load state...", "F4", "Load an lxdream save state", G_CALLBACK(load_state_action_callback) },
9.27 - { "SaveState", GTK_STOCK_SAVE_AS, "_Save state...", "F3", "Create an lxdream save state", G_CALLBACK(save_state_action_callback) },
9.28 - { "Debugger", NULL, "_Debugger", NULL, "Open debugger window", G_CALLBACK(debugger_action_callback) },
9.29 - { "Exit", GTK_STOCK_QUIT, "E_xit", NULL, "Exit lxdream", G_CALLBACK(exit_action_callback) },
9.30 - { "PathSettings", NULL, "_Paths...", NULL, "Configure files and paths", G_CALLBACK(path_settings_callback) },
9.31 - { "AudioSettings", NULL, "_Audio...", NULL, "Configure audio output", G_CALLBACK(audio_settings_callback) },
9.32 - { "ControllerSettings", NULL, "_Controllers...", NULL, "Configure controllers", G_CALLBACK(controller_settings_callback) },
9.33 - { "NetworkSettings", NULL, "_Network...", NULL, "Configure network settings", G_CALLBACK(network_settings_callback) },
9.34 - { "VideoSettings", NULL, "_Video...", NULL, "Configure video output", G_CALLBACK(video_settings_callback) },
9.35 - { "About", GTK_STOCK_ABOUT, "_About...", NULL, "About lxdream", G_CALLBACK(about_action_callback) }
9.36 -};
9.37 -static const GtkToggleActionEntry ui_toggle_actions[] = {
9.38 - { "FullScreen", NULL, "_Full Screen", "<alt>Return", "Toggle full screen video", G_CALLBACK(fullscreen_toggle_callback), 0 },
9.39 -};
9.40 -
9.41 -
9.42 -static const char *ui_description =
9.43 - "<ui>"
9.44 - " <menubar name='MainMenu'>"
9.45 - " <menu action='FileMenu'>"
9.46 - " <menuitem action='Mount'/>"
9.47 - " <separator/>"
9.48 - " <menuitem action='Reset'/>"
9.49 - " <menuitem action='Pause'/>"
9.50 - " <menuitem action='Run'/>"
9.51 - " <separator/>"
9.52 - " <menuitem action='LoadState'/>"
9.53 - " <menuitem action='SaveState'/>"
9.54 - " <separator/>"
9.55 - " <menuitem action='Exit'/>"
9.56 - " </menu>"
9.57 - " <menu action='SettingsMenu'>"
9.58 - " <menuitem action='PathSettings'/>"
9.59 - " <menuitem action='AudioSettings'/>"
9.60 - " <menuitem action='ControllerSettings'/>"
9.61 - " <menuitem action='NetworkSettings'/>"
9.62 - " <menuitem action='VideoSettings'/>"
9.63 - " <separator/>"
9.64 - " <menuitem action='FullScreen'/>"
9.65 - " </menu>"
9.66 - " <menu action='HelpMenu'>"
9.67 - " <menuitem action='About'/>"
9.68 - " </menu>"
9.69 - " </menubar>"
9.70 - " <toolbar name='MainToolbar'>"
9.71 - " <toolitem action='Mount'/>"
9.72 - " <toolitem action='Reset'/>"
9.73 - " <toolitem action='Pause'/>"
9.74 - " <toolitem action='Run'/>"
9.75 - " <separator/>"
9.76 - " <toolitem action='LoadState'/>"
9.77 - " <toolitem action='SaveState'/>"
9.78 - " </toolbar>"
9.79 - "</ui>";
9.80 -
9.81
9.82 struct main_window_info {
9.83 GtkWidget *window;
9.84 - GtkWidget *menubar;
9.85 - GtkWidget *toolbar;
9.86 GtkWidget *video;
9.87 GtkWidget *statusbar;
9.88 GtkActionGroup *actions;
9.89 };
9.90
9.91 -main_window_t main_window_new( const gchar *title )
9.92 +main_window_t main_window_new( const gchar *title, GtkWidget *menubar, GtkWidget *toolbar,
9.93 + GtkAccelGroup *accel_group )
9.94 {
9.95 GtkWidget *vbox;
9.96 - GtkUIManager *ui_manager;
9.97 - GtkAccelGroup *accel_group;
9.98 GtkWidget *frame;
9.99 - GError *error = NULL;
9.100 main_window_t win = g_malloc0( sizeof(struct main_window_info) );
9.101
9.102 win->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
9.103 gtk_window_set_title( GTK_WINDOW(win->window), title );
9.104 -
9.105 - win->actions = gtk_action_group_new("MenuActions");
9.106 - gtk_action_group_add_actions( win->actions, ui_actions, G_N_ELEMENTS(ui_actions), win->window );
9.107 - gtk_action_group_add_toggle_actions( win->actions, ui_toggle_actions, G_N_ELEMENTS(ui_toggle_actions), win->window );
9.108 - DISABLE_ACTION(win, "AudioSettings");
9.109 - DISABLE_ACTION(win, "NetworkSettings");
9.110 - DISABLE_ACTION(win, "VideoSettings");
9.111 -
9.112 - ui_manager = gtk_ui_manager_new();
9.113 - gtk_ui_manager_set_add_tearoffs(ui_manager, TRUE);
9.114 - gtk_ui_manager_insert_action_group( ui_manager, win->actions, 0 );
9.115 -
9.116 - if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, &error)) {
9.117 - g_message ("building menus failed: %s", error->message);
9.118 - g_error_free (error);
9.119 - exit(1);
9.120 - }
9.121 -
9.122 - accel_group = gtk_ui_manager_get_accel_group (ui_manager);
9.123 gtk_window_add_accel_group (GTK_WINDOW (win->window), accel_group);
9.124
9.125 - win->menubar = gtk_ui_manager_get_widget(ui_manager, "/MainMenu");
9.126 - win->toolbar = gtk_ui_manager_get_widget(ui_manager, "/MainToolbar");
9.127 -
9.128 - gtk_toolbar_set_style( GTK_TOOLBAR(win->toolbar), GTK_TOOLBAR_ICONS );
9.129 + gtk_toolbar_set_style( GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS );
9.130
9.131 win->video = gtk_drawing_area_new();
9.132 GTK_WIDGET_SET_FLAGS(win->video, GTK_CAN_FOCUS|GTK_CAN_DEFAULT);
9.133 @@ -155,8 +62,8 @@
9.134
9.135 vbox = gtk_vbox_new(FALSE, 0);
9.136 gtk_container_add( GTK_CONTAINER(win->window), vbox );
9.137 - gtk_box_pack_start( GTK_BOX(vbox), win->menubar, FALSE, FALSE, 0 );
9.138 - gtk_box_pack_start( GTK_BOX(vbox), win->toolbar, FALSE, FALSE, 0 );
9.139 + gtk_box_pack_start( GTK_BOX(vbox), menubar, FALSE, FALSE, 0 );
9.140 + gtk_box_pack_start( GTK_BOX(vbox), toolbar, FALSE, FALSE, 0 );
9.141 gtk_box_pack_start( GTK_BOX(vbox), frame, TRUE, TRUE, 0 );
9.142 gtk_box_pack_start( GTK_BOX(vbox), win->statusbar, FALSE, FALSE, 0 );
9.143 gtk_widget_show_all( win->window );
9.144 @@ -168,8 +75,8 @@
9.145
9.146 void main_window_set_running( main_window_t win, gboolean running )
9.147 {
9.148 - SET_ACTION_ENABLED( win, "Pause", running );
9.149 - SET_ACTION_ENABLED( win, "Run", !running );
9.150 + gtk_gui_enable_action( "Pause", running );
9.151 + gtk_gui_enable_action( "Run", !running );
9.152 gtk_statusbar_pop( GTK_STATUSBAR(win->statusbar), 1 );
9.153 gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, running ? "Running" : "Stopped" );
9.154 }
10.1 --- a/src/gui/mmio_win.c Sun Oct 21 05:20:35 2007 +0000
10.2 +++ b/src/gui/mmio_win.c Sun Oct 21 05:21:35 2007 +0000
10.3 @@ -1,5 +1,5 @@
10.4 /**
10.5 - * $Id: mmio_win.c,v 1.7 2007-10-10 11:02:04 nkeynes Exp $
10.6 + * $Id: mmio_win.c,v 1.8 2007-10-21 05:21:35 nkeynes Exp $
10.7 *
10.8 * Implements the MMIO register viewing window
10.9 *
10.10 @@ -107,7 +107,7 @@
10.11 return list;
10.12 }
10.13
10.14 -void update_mmr_win( void )
10.15 +void mmio_win_update( mmio_window_t win )
10.16 {
10.17 int i,j, count = 0;
10.18 GtkCList *page, *all_page;
10.19 @@ -174,7 +174,14 @@
10.20 }
10.21 }
10.22
10.23 -void mmr_open_win( void )
10.24 +mmio_window_t mmio_window_new( const gchar *title )
10.25 +{
10.26 + init_mmr_win();
10.27 + gtk_widget_show( mmr_win );
10.28 + return NULL;
10.29 +}
10.30 +
10.31 +void mmio_window_show( mmio_window_t mmio, gboolean show )
10.32 {
10.33 gtk_widget_show( mmr_win );
10.34 }
11.1 --- a/src/gui/path_dlg.c Sun Oct 21 05:20:35 2007 +0000
11.2 +++ b/src/gui/path_dlg.c Sun Oct 21 05:21:35 2007 +0000
11.3 @@ -1,5 +1,5 @@
11.4 /**
11.5 - * $Id: path_dlg.c,v 1.1 2007-10-17 11:26:45 nkeynes Exp $
11.6 + * $Id: path_dlg.c,v 1.2 2007-10-21 05:21:35 nkeynes Exp $
11.7 *
11.8 * Define the main (emu) GTK window, along with its menubars,
11.9 * toolbars, etc.
11.10 @@ -101,7 +101,7 @@
11.11 gtk_button_set_image( GTK_BUTTON(button), image );
11.12 g_signal_connect( button, "clicked", G_CALLBACK(path_file_button_clicked), text );
11.13 } else {
11.14 - GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_BUTTON);
11.15 + GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
11.16 gtk_button_set_image( GTK_BUTTON(button), image );
11.17 g_signal_connect( button, "clicked", G_CALLBACK(path_dir_button_clicked), text );
11.18 }
.