From 1aa4da2dd777823a4aa5f40cf8cf7b1c09401a34 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Sun, 20 Oct 2013 21:33:40 -0400 Subject: [PATCH] Save vpane position for memory windows --- src/app-config.c | 5 +++++ src/app-config.h | 3 ++- src/emugtk.c | 17 +++++++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/app-config.c b/src/app-config.c index b61b900..6d65df9 100644 --- a/src/app-config.c +++ b/src/app-config.c @@ -55,6 +55,7 @@ app_config_init(void) cfg->win_height = 480; cfg->hpane_pos = 100; cfg->vpane_pos = 200; + cfg->vpane_mem_pos = 200; } static int @@ -85,6 +86,8 @@ app_config_load_from_key_file(GKeyFile *kf) app_config_key_file_get_int(kf, "ui", "win_height", &cfg->win_height); app_config_key_file_get_int(kf, "ui", "hpane_pos", &cfg->hpane_pos); app_config_key_file_get_int(kf, "ui", "vpane_pos", &cfg->vpane_pos); + app_config_key_file_get_int(kf, "ui", "vpane_mem_pos", + &cfg->vpane_mem_pos); } static char * @@ -165,6 +168,8 @@ app_config_save(void) g_string_append_printf(buf, "win_height=%d\n", cfg->win_height); g_string_append_printf(buf, "hpane_pos=%d\n", cfg->hpane_pos); g_string_append_printf(buf, "vpane_pos=%d\n", cfg->vpane_pos); + g_string_append_printf(buf, "vpane_mem_pos=%d\n", + cfg->vpane_mem_pos); file_path = app_config_get_file_path(); diff --git a/src/app-config.h b/src/app-config.h index 22af733..f6c27b9 100644 --- a/src/app-config.h +++ b/src/app-config.h @@ -30,7 +30,8 @@ struct app_config_t int win_width; int win_height; int hpane_pos; - int vpane_pos; + int vpane_pos; /* Registers and memory windows. */ + int vpane_mem_pos; /* Internal and external memory windows. */ }; int diff --git a/src/emugtk.c b/src/emugtk.c index 6425311..f4f9301 100644 --- a/src/emugtk.c +++ b/src/emugtk.c @@ -261,6 +261,14 @@ vpaned_notify_event(GtkWindow *window, GdkEvent *event, gpointer data) cfg->vpane_pos = gtk_paned_get_position(GTK_PANED(vpaned)); } +static void +vpaned_mem_notify_event(GtkWindow *window, GdkEvent *event, gpointer data) +{ + GtkWidget *vpaned = data; + + cfg->vpane_mem_pos = gtk_paned_get_position(GTK_PANED(vpaned)); +} + /* * mainwin * +---------------------------------------------------------------------+ @@ -389,19 +397,16 @@ emugtk_window_init(void) gtk_paned_pack1(GTK_PANED(vpaned), hpaned, FALSE, FALSE); vpaned_mem = gtk_vpaned_new(); - log_info("TODO: set vpaned_mem position and save in config file"); -#ifdef seewfdewfw gtk_paned_set_position(GTK_PANED(vpaned_mem), cfg->vpane_mem_pos); g_signal_connect(G_OBJECT(vpaned_mem), "notify::position", - G_CALLBACK(vpaned_mem__notify_event), vpaned_mem); -#endif + G_CALLBACK(vpaned_mem_notify_event), vpaned_mem); /* Internal memory dump frame. */ - scrollwin = memwin_init("Internal memory", INT_MEM_ID); + scrollwin = memwin_init("Internal memory (IRAM)", INT_MEM_ID); gtk_paned_pack1(GTK_PANED(vpaned_mem), scrollwin, FALSE, FALSE); /* External memory dump frame. */ - scrollwin = memwin_init("External memory", EXT_MEM_ID); + scrollwin = memwin_init("External memory (XRAM)", EXT_MEM_ID); gtk_paned_pack2(GTK_PANED(vpaned_mem), scrollwin, TRUE, FALSE); gtk_paned_pack2(GTK_PANED(vpaned), vpaned_mem, TRUE, FALSE); -- 2.20.1