Use single function to refresh all windows
authorHugo Villeneuve <hugo@hugovil.com>
Mon, 21 Oct 2013 00:46:07 +0000 (20:46 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 6 Nov 2013 02:50:17 +0000 (21:50 -0500)
Use emugtk_UpdateDisplay() to replace individual calls to these functions:
  regwin_Show();
  memwin_DumpD();
  pgmwin_Disasm();

src/emugtk.c
src/emugtk.h
src/regwin.c

index de5d48b..0711248 100644 (file)
@@ -55,6 +55,15 @@ GtkWidget *mainwin;
 extern struct app_config_t *cfg;
 extern struct options_t options;
 
+void
+emugtk_UpdateDisplay(void)
+{
+       log_debug("UpdateDisplay()");
+       regwin_Show();
+       pgmwin_Disasm();
+       memwin_DumpD(INT_MEM_ID);
+}
+
 /* Step out of running state */
 static void
 emugtk_stop_running()
@@ -63,9 +72,7 @@ emugtk_stop_running()
                log_info("StopRunning()");
                g_source_remove(running_function_tag);
                running = 0;
-               regwin_Show();
-               pgmwin_Disasm();
-               memwin_DumpD();
+               emugtk_UpdateDisplay();
        }
 }
 
@@ -116,9 +123,7 @@ static void
 emugtk_Reset(void)
 {
        cpu8051_Reset();
-       regwin_Show();
-       pgmwin_Disasm();
-       memwin_DumpD();
+       emugtk_UpdateDisplay();
 }
 
 /* Signal ResetEvent (ResetButton) */
@@ -135,9 +140,7 @@ static void
 emugtk_Step(void)
 {
        cpu8051_Exec();
-       regwin_Show();
-       pgmwin_Disasm();
-       memwin_DumpD();
+       emugtk_UpdateDisplay();
 }
 
 /* Signal RunEvent (RunButton) */
@@ -383,15 +386,6 @@ emugtk_window_init(void)
        gtk_widget_show_all(mainwin);
 }
 
-static void
-emugtk_UpdateDisplay(void)
-{
-       log_debug("UpdateDisplay()");
-       regwin_Show();
-       pgmwin_Disasm();
-       memwin_DumpD();
-}
-
 void
 AddMenuSeparator(GtkWidget *menu)
 {
index 75714be..35ac1e4 100644 (file)
@@ -30,4 +30,7 @@ AddMenuSeparator(GtkWidget *menu);
 void
 emugtk_new_file(char *file);
 
+void
+emugtk_UpdateDisplay(void);
+
 #endif /* EMUGTK_H */
index e3b79d7..aaa006b 100644 (file)
@@ -33,6 +33,7 @@
 #include "pgmwin.h"
 #include "instructions_8051.h"
 #include "hexfile.h"
+#include "emugtk.h"
 
 static GtkWidget *reglist;
 
@@ -387,9 +388,7 @@ regwin_cell_edited(GtkCellRendererText *cell, gchar *path_string,
         * Make sure to update all windows.
         * For example, R0-R7 values depends on internal memory values.
         */
-       regwin_Show();
-       memwin_DumpD();
-       pgmwin_Disasm();
+       emugtk_UpdateDisplay();
 };
 
 static void