mirror of
http://git.hugovil.com/git/emu8051.git
synced 2025-10-14 02:48:29 +08:00
Save window position in configuration file
This commit is contained in:
@@ -41,6 +41,8 @@ app_config_init(void)
|
||||
/* UI settings */
|
||||
cfg->win_width = 640;
|
||||
cfg->win_height = 480;
|
||||
cfg->win_pos_x = 10;
|
||||
cfg->win_pos_y = 10;
|
||||
cfg->hpane_pos = 100;
|
||||
cfg->vpane_pos = 200;
|
||||
cfg->main_pane_pos = 200;
|
||||
@@ -79,6 +81,8 @@ app_config_load_from_key_file(GKeyFile *kf)
|
||||
/* ui */
|
||||
app_config_key_file_get_int(kf, "ui", "win_width", &cfg->win_width);
|
||||
app_config_key_file_get_int(kf, "ui", "win_height", &cfg->win_height);
|
||||
app_config_key_file_get_int(kf, "ui", "win_pos_x", &cfg->win_pos_x);
|
||||
app_config_key_file_get_int(kf, "ui", "win_pos_y", &cfg->win_pos_y);
|
||||
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", "main_pane_pos",
|
||||
@@ -173,6 +177,8 @@ app_config_save(void)
|
||||
|
||||
g_string_append_printf(buf, "win_width=%d\n", cfg->win_width);
|
||||
g_string_append_printf(buf, "win_height=%d\n", cfg->win_height);
|
||||
g_string_append_printf(buf, "win_pos_x=%d\n", cfg->win_pos_x);
|
||||
g_string_append_printf(buf, "win_pos_y=%d\n", cfg->win_pos_y);
|
||||
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, "main_pane_pos=%d\n",
|
||||
|
@@ -30,6 +30,8 @@ struct app_config_t {
|
||||
/* UI settings */
|
||||
int win_width;
|
||||
int win_height;
|
||||
int win_pos_x;
|
||||
int win_pos_y;
|
||||
int hpane_pos; /* For registers and program windows. */
|
||||
int vpane_pos; /* For internal and external memory windows. */
|
||||
int main_pane_pos; /* Between hpane and vpane. */
|
||||
|
@@ -265,6 +265,8 @@ mainwin_configure_event(GtkWindow *window, GdkEvent *event, gpointer data)
|
||||
|
||||
cfg->win_width = event->configure.width;
|
||||
cfg->win_height = event->configure.height;
|
||||
cfg->win_pos_x = event->configure.x;
|
||||
cfg->win_pos_y = event->configure.y;
|
||||
|
||||
/*
|
||||
* Important:
|
||||
@@ -592,6 +594,8 @@ emugtk_window_init(void)
|
||||
log_err("Use saved window size");
|
||||
gtk_window_set_default_size(GTK_WINDOW(mainwin),
|
||||
cfg->win_width, cfg->win_height);
|
||||
gtk_window_move(GTK_WINDOW(mainwin),
|
||||
cfg->win_pos_x, cfg->win_pos_y);
|
||||
}
|
||||
|
||||
gtk_widget_show_all(mainwin);
|
||||
|
Reference in New Issue
Block a user