From 64444129c34463dd9fbebfa222aaa34e610cff63 Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Mon, 25 May 2020 20:44:39 -0400 Subject: [PATCH] Added callback functions for editing break cycle/instruction limit text fields --- src/drivers/sdl/debugger.cpp | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/drivers/sdl/debugger.cpp b/src/drivers/sdl/debugger.cpp index ef441fa2..3804e23f 100644 --- a/src/drivers/sdl/debugger.cpp +++ b/src/drivers/sdl/debugger.cpp @@ -1185,6 +1185,23 @@ static void breakOnCyclesCB( GtkToggleButton *togglebutton, debuggerWin_t * dw) updateAllDebugWindows(); } +static void +breakOnCyclesLimitCB (GtkEntry *entry, +// gchar *string, + gpointer user_data) +{ + const char *txt; + + txt = gtk_entry_get_text( entry ); + + //printf("'%s'\n", txt ); + + if ( isdigit(txt[0]) ) + { + break_cycles_limit = strtoul( txt, NULL, 0 ); + } +} + static void breakOnInstructionsCB( GtkToggleButton *togglebutton, debuggerWin_t * dw) { break_on_instructions = !break_on_instructions; @@ -1192,6 +1209,23 @@ static void breakOnInstructionsCB( GtkToggleButton *togglebutton, debuggerWin_t updateAllDebugWindows(); } +static void +breakOnInstructionsLimitCB (GtkEntry *entry, +// gchar *string, + gpointer user_data) +{ + const char *txt; + + txt = gtk_entry_get_text( entry ); + + //printf("'%s'\n", txt ); + + if ( isdigit(txt[0]) ) + { + break_instructions_limit = strtoul( txt, NULL, 0 ); + } +} + static void romOffsetToggleCB( GtkToggleButton *togglebutton, debuggerWin_t * dw) { dw->displayROMoffsets = gtk_toggle_button_get_active( togglebutton ); @@ -1668,6 +1702,9 @@ void openDebuggerWindow (void) G_CALLBACK (breakOnCyclesCB), dw); gtk_grid_attach( GTK_GRID(grid), dw->brkcycles_chkbox, 1, 1, 1, 1 ); entry = gtk_entry_new (); + //g_signal_connect (entry, "preedit-changed", + g_signal_connect (entry, "activate", + G_CALLBACK (breakOnCyclesLimitCB), dw); gtk_grid_attach( GTK_GRID(grid), entry, 2, 1, 1, 1 ); dw->brkinstrs_chkbox = gtk_check_button_new_with_label("Break when exceed"); @@ -1675,6 +1712,8 @@ void openDebuggerWindow (void) G_CALLBACK (breakOnInstructionsCB), dw); gtk_grid_attach( GTK_GRID(grid), dw->brkinstrs_chkbox, 1, 3, 1, 1 ); entry = gtk_entry_new (); + g_signal_connect (entry, "activate", + G_CALLBACK (breakOnInstructionsLimitCB), dw); gtk_grid_attach( GTK_GRID(grid), entry, 2, 3, 1, 1 ); gtk_box_pack_start (GTK_BOX (vbox1), grid, FALSE, FALSE, 2);