Index: trunk/src_plugins/hid_gtk/gtkhid-main.c =================================================================== --- trunk/src_plugins/hid_gtk/gtkhid-main.c (revision 2257) +++ trunk/src_plugins/hid_gtk/gtkhid-main.c (revision 2258) @@ -1810,7 +1810,7 @@ static int SaveWinGeo(int argc, char **argv, Coord x, Coord y) { - ghid_wgeo_save(1); + ghid_wgeo_save(1, 0); return 0; } @@ -1896,6 +1896,7 @@ void hid_hid_gtk_uninit() { + event_unbind_allcookie(ghid_cookie); conf_hid_unreg(ghid_cookie); } @@ -2006,6 +2007,8 @@ conf_reg_field(conf_hid_gtk, field,isarray,type_name,cpath,cname,desc,flags); #include "hid_gtk_conf_fields.h" + event_bind(EVENT_SAVE_PRE, ghid_conf_save_pre_wgeo, NULL, ghid_cookie); + return hid_hid_gtk_uninit; } Index: trunk/src_plugins/hid_gtk/gui-config.c =================================================================== --- trunk/src_plugins/hid_gtk/gui-config.c (revision 2257) +++ trunk/src_plugins/hid_gtk/gui-config.c (revision 2258) @@ -87,7 +87,7 @@ } -void ghid_wgeo_save(int save_to_file) +void ghid_wgeo_save(int save_to_file, int skip_user) { if (conf_hid_gtk.plugins.hid_gtk.auto_save_window_geometry.to_design) { GHID_WGEO_ALL(hid_gtk_wgeo_save_, CFR_DESIGN); @@ -101,10 +101,12 @@ conf_save_file(NULL, (PCB == NULL ? NULL : PCB->Filename), CFR_PROJECT, NULL); } - if (conf_hid_gtk.plugins.hid_gtk.auto_save_window_geometry.to_user) { - GHID_WGEO_ALL(hid_gtk_wgeo_save_, CFR_USER); - if (save_to_file) - conf_save_file(NULL, (PCB == NULL ? NULL : PCB->Filename), CFR_USER, NULL); + if (!skip_user) { + if (conf_hid_gtk.plugins.hid_gtk.auto_save_window_geometry.to_user) { + GHID_WGEO_ALL(hid_gtk_wgeo_save_, CFR_USER); + if (save_to_file) + conf_save_file(NULL, (PCB == NULL ? NULL : PCB->Filename), CFR_USER, NULL); + } } } @@ -134,7 +136,14 @@ #undef hid_gtk_wgeo_update_ #undef hid_gtk_wgeo_save_ +/* event handler that runs before the current pcb is saved - save win geo + in the corresponding lihata trees if the checkbox is selected. */ +void ghid_conf_save_pre_wgeo(void *user_data, int argc, event_arg_t * argv[]) +{ + ghid_wgeo_save(1, 1); +} + RCSID("$Id$"); enum ConfigType { Index: trunk/src_plugins/hid_gtk/gui.h =================================================================== --- trunk/src_plugins/hid_gtk/gui.h (revision 2257) +++ trunk/src_plugins/hid_gtk/gui.h (revision 2258) @@ -41,6 +41,7 @@ #include "ghid-main-menu.h" #include "gui-pinout-preview.h" #include "conf_core.h" +#include "event.h" #include "hid_gtk_conf.h" @@ -206,7 +207,8 @@ void ghid_config_groups_changed(void); void ghid_config_init(void); -void ghid_wgeo_save(int save_to_file); +void ghid_wgeo_save(int save_to_file, int skip_user); +void ghid_conf_save_pre_wgeo(void *user_data, int argc, event_arg_t * argv[]); void ghid_mode_buttons_update(void); void ghid_pack_mode_buttons(void);