static int running_function_tag;
static int restart_gui = true;
+static int emugtk_window_init_complete;
+static GtkWidget *vpaned1;
+static GtkWidget *scrollwin_int;
+static GtkWidget *scrollwin_ext;
+
GtkWidget *mainwin;
extern struct app_config_t *cfg;
pgmwin_refresh();
pswwin_refresh();
- if (cfg->view_int_memory)
+ if (cfg->view_int_memory && scrollwin_int)
memwin_refresh(INT_MEM_ID);
- if (cfg->view_ext_memory)
+ if (cfg->view_ext_memory && scrollwin_ext)
memwin_refresh(EXT_MEM_ID);
}
restart_gui = false;
}
+static void
+emugtk_show_memory_paned(void)
+{
+ gtk_widget_show_all(mainwin);
+ emugtk_UpdateDisplay();
+}
+
+void
+emugtk_create_int_memory_paned(void)
+{
+ scrollwin_int = memwin_init("Internal memory (IRAM)",
+ INT_MEM_ID);
+ gtk_paned_pack1(GTK_PANED(vpaned1), scrollwin_int,
+ FALSE, FALSE);
+ if (emugtk_window_init_complete == true)
+ emugtk_show_memory_paned();
+}
+
+void
+emugtk_destroy_int_memory_paned(void)
+{
+ if (scrollwin_int == NULL)
+ return;
+
+ gtk_widget_destroy(scrollwin_int);
+ scrollwin_int = NULL;
+}
+
+void
+emugtk_create_ext_memory_paned(void)
+{
+ scrollwin_ext = memwin_init("External memory (XRAM)",
+ EXT_MEM_ID);
+
+ gtk_paned_pack2(GTK_PANED(vpaned1), scrollwin_ext,
+ TRUE, FALSE);
+
+ if (emugtk_window_init_complete == true)
+ emugtk_show_memory_paned();
+}
+
+void
+emugtk_destroy_ext_memory_paned(void)
+{
+ if (scrollwin_ext == NULL)
+ return;
+
+ gtk_widget_destroy(scrollwin_ext);
+ scrollwin_ext = NULL;
+}
+
+void
+emugtk_recreate_memory_paned(void)
+{
+ if (cfg->view_int_memory) {
+ emugtk_destroy_int_memory_paned();
+ emugtk_create_int_memory_paned();
+ }
+
+ if (cfg->view_ext_memory) {
+ emugtk_destroy_ext_memory_paned();
+ emugtk_create_ext_memory_paned();
+ }
+
+ if (emugtk_window_init_complete == true)
+ emugtk_show_memory_paned();
+}
+
static GtkWidget *
emugtk_create_memory_paned(void)
{
- GtkWidget *vpaned;
- GtkWidget *scrollwin;
-
/* Create vpaned (memory windows) only if necessary. */
if (cfg->view_int_memory || cfg->view_ext_memory) {
- vpaned = gtk_vpaned_new();
- gtk_paned_set_position(GTK_PANED(vpaned), cfg->vpane_pos);
- g_signal_connect(G_OBJECT(vpaned), "notify::position",
- G_CALLBACK(vpaned_notify_event), vpaned);
-
- /* Internal memory dump frame. */
- if (cfg->view_int_memory) {
- scrollwin = memwin_init("Internal memory (IRAM)",
- INT_MEM_ID);
- gtk_paned_pack1(GTK_PANED(vpaned), scrollwin,
- FALSE, FALSE);
- }
-
- /* External memory dump frame. */
- if (cfg->view_ext_memory) {
- scrollwin = memwin_init("External memory (XRAM)",
- EXT_MEM_ID);
- gtk_paned_pack2(GTK_PANED(vpaned), scrollwin,
- TRUE, FALSE);
- }
-
- return vpaned;
+ vpaned1 = gtk_vpaned_new();
+
+ gtk_paned_set_position(GTK_PANED(vpaned1), cfg->vpane_pos);
+ g_signal_connect(G_OBJECT(vpaned1), "notify::position",
+ G_CALLBACK(vpaned_notify_event), vpaned1);
+
+ emugtk_recreate_memory_paned();
+
+ return vpaned1;
} else
return NULL;
}
GtkWidget *vpaned;
GtkWidget *main_paned;
+ emugtk_window_init_complete = false;
+
mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(mainwin), PACKAGE);
gtk_window_set_default_size(GTK_WINDOW(mainwin),
g_signal_connect(mainwin, "destroy", G_CALLBACK(emugtk_quit_gui), NULL);
gtk_widget_show_all(mainwin);
+
+ emugtk_window_init_complete = true;
}
void
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
log_info(" Bytes per row = %d", bytes_per_row);
cfg->bytes_per_row = bytes_per_row;
- emugtk_restart_gui();
+ emugtk_destroy_int_memory_paned();
+ emugtk_destroy_ext_memory_paned();
+ emugtk_recreate_memory_paned();
}
}
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
log_info(" View internal memory");
cfg->view_int_memory = 1;
+ emugtk_create_int_memory_paned();
} else {
cfg->view_int_memory = 0;
+ emugtk_destroy_int_memory_paned();
}
-
- emugtk_restart_gui();
}
void toggle_ext_memory(GtkWidget *widget, gpointer data)
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
log_info(" View external memory");
cfg->view_ext_memory = 1;
+ emugtk_create_ext_memory_paned();
} else {
cfg->view_ext_memory = 0;
+ emugtk_destroy_ext_memory_paned();
}
-
- emugtk_restart_gui();
}
void