From: Hugo Villeneuve Date: Wed, 23 Oct 2013 02:56:02 +0000 (-0400) Subject: Add view menu option to enable/disable IRAM/XRAM windows X-Git-Tag: v2.0.0~112 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=4c86604f944240034b02db1bd37b9092455d5d9f;p=emu8051.git Add view menu option to enable/disable IRAM/XRAM windows --- diff --git a/src/emugtk.c b/src/emugtk.c index 1c114fc..9ade2cd 100644 --- a/src/emugtk.c +++ b/src/emugtk.c @@ -63,8 +63,12 @@ emugtk_UpdateDisplay(void) log_debug("UpdateDisplay()"); regwin_refresh(); pgmwin_refresh(); - memwin_refresh(INT_MEM_ID); - memwin_refresh(EXT_MEM_ID); + + if (cfg->view_int_memory) + memwin_refresh(INT_MEM_ID); + + if (cfg->view_ext_memory) + memwin_refresh(EXT_MEM_ID); } /* Step out of running state */ @@ -393,19 +397,6 @@ emugtk_window_init(void) scrollwin = pgmwin_init(); gtk_paned_pack2(GTK_PANED(hpaned), scrollwin, TRUE, FALSE); - 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. */ - scrollwin = memwin_init("Internal memory (IRAM)", INT_MEM_ID); - gtk_paned_pack1(GTK_PANED(vpaned), scrollwin, FALSE, FALSE); - - /* External memory dump frame. */ - scrollwin = memwin_init("External memory (XRAM)", EXT_MEM_ID); - gtk_paned_pack2(GTK_PANED(vpaned), scrollwin, TRUE, FALSE); - /* * main_paned will contain two groups: * group1: registers and disassembly windows. @@ -420,7 +411,32 @@ emugtk_window_init(void) g_signal_connect(G_OBJECT(main_paned), "notify::position", G_CALLBACK(main_paned_notify_event), main_paned); gtk_paned_pack1(GTK_PANED(main_paned), hpaned, FALSE, FALSE); - gtk_paned_pack2(GTK_PANED(main_paned), vpaned, TRUE, FALSE); + + /* 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); + } + + gtk_paned_pack2(GTK_PANED(main_paned), vpaned, TRUE, FALSE); + } /* * vbox contains the menu bar and body_vbox (for all remaining diff --git a/src/viewmenu.c b/src/viewmenu.c index 37d5b9a..99fa0ab 100644 --- a/src/viewmenu.c +++ b/src/viewmenu.c @@ -62,7 +62,7 @@ void toggle_bits_per_row(GtkWidget *widget, gpointer data) void toggle_int_memory(GtkWidget *widget, gpointer data) { if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { - log_info(" View internal memory (TODO)"); + log_info(" View internal memory"); cfg->view_int_memory = 1; } else { cfg->view_int_memory = 0; @@ -74,7 +74,7 @@ void toggle_int_memory(GtkWidget *widget, gpointer data) 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 (TODO)"); + log_info(" View external memory"); cfg->view_ext_memory = 1; } else { cfg->view_ext_memory = 0; @@ -162,13 +162,15 @@ ViewAddMenu(GtkWidget *menu_bar) item = gtk_check_menu_item_new_with_label("Internal Memory"); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), + cfg->view_int_memory); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(toggle_int_memory), NULL); item = gtk_check_menu_item_new_with_label("External Memory"); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), + cfg->view_ext_memory); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(toggle_ext_memory), NULL);