Save vpane position for memory windows
authorHugo Villeneuve <hugo@hugovil.com>
Mon, 21 Oct 2013 01:33:40 +0000 (21:33 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 6 Nov 2013 02:50:17 +0000 (21:50 -0500)
src/app-config.c
src/app-config.h
src/emugtk.c

index b61b900..6d65df9 100644 (file)
@@ -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();
 
index 22af733..f6c27b9 100644 (file)
@@ -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
index 6425311..f4f9301 100644 (file)
@@ -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);