X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fgtk%2Fregwin.c;h=d3fcb8dd042d3ec5c852a3360ecc76f5356a894b;hb=121bcb38f29409f10de63a68d86620c4beb75c97;hp=a2b0f6e91e69a13fb22cb9393016dc25dbebe17f;hpb=a43a2e343e4620c10b1a383f419b2d7b2714f78b;p=emu8051.git diff --git a/src/gtk/regwin.c b/src/gtk/regwin.c index a2b0f6e..d3fcb8d 100644 --- a/src/gtk/regwin.c +++ b/src/gtk/regwin.c @@ -4,19 +4,7 @@ * Copyright (C) 1999 Jonathan St-André * Copyright (C) 1999 Hugo Villeneuve * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * This file is released under the GPLv2 */ #if HAVE_CONFIG_H @@ -35,15 +23,14 @@ #include "pgmwin.h" #include "instructions_8051.h" #include "hexfile.h" -#include "emugtk.h" +#include "main.h" static GtkWidget *reglist; #define LIST_VIEW_NAME "Registers" #define DATA_ROWS SFR_REGS -enum -{ +enum { COL_NAME = 0, COL_VAL, N_COLUMNS, @@ -85,12 +72,11 @@ regwin_cell_edited(GtkCellRendererText *cell, gchar *path_string, (void) cell; /* Remove compiler warning about unused variables. */ - if (!model) { - g_error("Unable to get model from cell renderer"); - } + if (!model) + log_err("Unable to get model from cell renderer"); /* Get the iterator */ - gtk_tree_model_get_iter_from_string(model, &iter, path_string); + gtk_tree_model_get_iter_from_string(model, &iter, path_string); /* Get register name. */ gtk_tree_model_get(model, &iter, COL_NAME, &str, -1); @@ -102,10 +88,16 @@ regwin_cell_edited(GtkCellRendererText *cell, gchar *path_string, /* Read current (old) value. */ gtk_tree_model_get(model, &iter, COL_VAL, &str, -1); + /* No need to check error, has already been validated. */ old = asciihex2int(str); log_info(" old value: $%04X", old); new = asciihex2int(new_str); + if (asciihex2int_get_error()) { + log_warn(" new value: invalid"); + return; + } + log_info(" new value: $%04X", new); /* Store new value in emulator register (if in range). */ @@ -113,13 +105,14 @@ regwin_cell_edited(GtkCellRendererText *cell, gchar *path_string, if (rc == 0) { /* Store new value in gtk model. */ int2asciihex(new, str, regwin_infos->w); - gtk_list_store_set(GTK_LIST_STORE(model), &iter, COL_VAL, str, -1); + gtk_list_store_set(GTK_LIST_STORE(model), &iter, COL_VAL, str, + -1); /* * Make sure to update all windows. * For example, R0-R7 values depends on internal memory values. */ - emugtk_UpdateDisplay(); + emugtk_update_display(); } };