Search
lxdream.org :: lxdream :: r28:81c206f59dc7
lxdream 0.9.1
released Jun 29
Download Now
changeset28:81c206f59dc7
parent27:1ef09a52cd1e
child29:c29373ff63ee
authornkeynes
dateSun Dec 25 03:35:08 2005 +0000 (14 years ago)
Enable/disable run+stop buttons depending on state
src/gui/debug_win.c
src/gui/gui.c
src/gui/gui.h
1.1 --- a/src/gui/debug_win.c Sun Dec 25 01:28:39 2005 +0000
1.2 +++ b/src/gui/debug_win.c Sun Dec 25 03:35:08 2005 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: debug_win.c,v 1.7 2005-12-24 08:02:18 nkeynes Exp $
1.6 + * $Id: debug_win.c,v 1.8 2005-12-25 03:35:08 nkeynes Exp $
1.7 * This file is responsible for the main debugger gui frame.
1.8 *
1.9 * Copyright (c) 2005 Nathan Keynes.
1.10 @@ -35,6 +35,7 @@
1.11 GtkCList *regs_list;
1.12 GtkCList *disasm_list;
1.13 GtkEntry *page_field;
1.14 + GtkWidget *win;
1.15 GtkProgressBar *icounter;
1.16 char icounter_text[16];
1.17 char saved_regs[0];
1.18 @@ -52,6 +53,7 @@
1.19 data->cpu_list = cpu_list;
1.20
1.21 data->regs_list= gtk_object_get_data(GTK_OBJECT(win), "reg_list");
1.22 + data->win = win;
1.23 gtk_widget_modify_font( GTK_WIDGET(data->regs_list), fixed_list_font );
1.24 init_register_list( data );
1.25 data->msgs_list = gtk_object_get_data(GTK_OBJECT(win), "output_list");
1.26 @@ -64,6 +66,7 @@
1.27 gtk_progress_bar_set_text(data->icounter, "1");
1.28
1.29 gtk_object_set_data( GTK_OBJECT(win), "debug_data", data );
1.30 + debug_win_set_running( data, FALSE );
1.31 return data;
1.32 }
1.33
1.34 @@ -268,3 +271,17 @@
1.35 return data;
1.36 }
1.37
1.38 +void debug_win_enable_widget( debug_info_t data, const char *name,
1.39 + gboolean enabled )
1.40 +{
1.41 + GtkWidget *widget = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(data->win), name));
1.42 + gtk_widget_set_sensitive( widget, enabled );
1.43 +}
1.44 +
1.45 +void debug_win_set_running( debug_info_t data, gboolean isRunning )
1.46 +{
1.47 + debug_win_enable_widget( data, "stop_btn", isRunning );
1.48 + debug_win_enable_widget( data, "step_btn", !isRunning );
1.49 + debug_win_enable_widget( data, "run_btn", !isRunning );
1.50 + debug_win_enable_widget( data, "runto_btn", !isRunning );
1.51 +}
2.1 --- a/src/gui/gui.c Sun Dec 25 01:28:39 2005 +0000
2.2 +++ b/src/gui/gui.c Sun Dec 25 03:35:08 2005 +0000
2.3 @@ -21,12 +21,14 @@
2.4
2.5 void gtk_gui_init( void );
2.6 void gtk_gui_update( void );
2.7 +void gtk_gui_start( void );
2.8 +void gtk_gui_stop( void );
2.9 int gtk_gui_run_slice( int microsecs );
2.10
2.11 struct dreamcast_module gtk_gui_module = { "Debugger", gtk_gui_init,
2.12 - gtk_gui_update, NULL,
2.13 + gtk_gui_update, gtk_gui_start,
2.14 gtk_gui_run_slice,
2.15 - gtk_gui_update,
2.16 + gtk_gui_stop,
2.17 NULL, NULL };
2.18
2.19 const cpu_desc_t cpu_descs[4] = { &sh4_cpu_desc, &arm_cpu_desc, &armt_cpu_desc, NULL };
2.20 @@ -67,6 +69,25 @@
2.21
2.22 }
2.23
2.24 +/**
2.25 + * Hook called when DC starts running. Just disables the run/step buttons
2.26 + * and enables the stop button.
2.27 + */
2.28 +void gtk_gui_start( void )
2.29 +{
2.30 + debug_win_set_running( main_debug, TRUE );
2.31 +}
2.32 +
2.33 +/**
2.34 + * Hook called when DC stops running. Enables the run/step buttons
2.35 + * and disables the stop button.
2.36 + */
2.37 +void gtk_gui_stop( void )
2.38 +{
2.39 + debug_win_set_running( main_debug, FALSE );
2.40 + gtk_gui_update();
2.41 +}
2.42 +
2.43 int gtk_gui_run_slice( int microsecs )
2.44 {
2.45 while( gtk_events_pending() )
3.1 --- a/src/gui/gui.h Sun Dec 25 01:28:39 2005 +0000
3.2 +++ b/src/gui/gui.h Sun Dec 25 03:35:08 2005 +0000
3.3 @@ -42,6 +42,7 @@
3.4 void set_disassembly_cpu( debug_info_t debug, const gchar *cpu_name );
3.5 void jump_to_disassembly( debug_info_t debug, unsigned int addr, gboolean select );
3.6 void jump_to_pc( debug_info_t debug, gboolean select );
3.7 +void debug_win_set_running( debug_info_t debug, gboolean isRunning );
3.8 uint32_t row_to_address( debug_info_t debug, int row );
3.9 int address_to_row( debug_info_t debug, uint32_t address );
3.10
.