Index: trunk/src/Makefile.dep =================================================================== --- trunk/src/Makefile.dep (revision 6724) +++ trunk/src/Makefile.dep (revision 6725) @@ -1983,22 +1983,11 @@ ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ ../src_3rd/liblihata/genht/ht.h ../src_3rd/genvector/vtp0.h list_conf.h \ - compat_nls.h plug_footprint.h vtlibrary.h compat_misc.h \ - ../src_plugins/lib_gtk_common/dlg_file_chooser.h plug_io.h library.h \ - ../src_plugins/lib_gtk_common/util_str.h \ - ../src_plugins/lib_gtk_common/../hid_gtk/gui.h board.h const.h macro.h \ - vtroutestyle.h rats_patch.h board.h font.h box.h math_helper.h move.h \ - misc_util.h hid.h hid_cfg.h hid_cfg_input.h \ - ../src_3rd/liblihata/genht/htip.h hid_cfg.h data.h crosshair.h \ - vtonpoint.h buffer.h \ - ../src_plugins/lib_gtk_common/../hid_gtk/ghid-main-menu.h \ - ../src_plugins/lib_gtk_common/wt_layer_selector.h \ - ../src_plugins/lib_gtk_common/wt_route_style.h route_style.h event.h \ - ../src_plugins/lib_gtk_common/../hid_gtk/colors.h \ - ../src_plugins/lib_gtk_common/../hid_gtk/hid_gtk_conf.h conf.h \ - ../src_plugins/lib_gtk_common/bu_cursor_pos.h \ - ../src_plugins/lib_gtk_common/ui_zoompan.h pcb_bool.h \ - ../src_plugins/lib_gtk_common/dlg_propedit.h + compat_nls.h plug_footprint.h vtlibrary.h compat_misc.h board.h const.h \ + macro.h vtroutestyle.h library.h rats_patch.h board.h font.h box.h \ + math_helper.h move.h misc_util.h data.h crosshair.h vtonpoint.h buffer.h \ + ../src_plugins/lib_gtk_common/dlg_file_chooser.h plug_io.h \ + ../src_plugins/lib_gtk_common/util_str.h ../src_plugins/lib_gtk_common/act_print.o: \ ../src_plugins/lib_gtk_common/act_print.c ../config.h \ ../src_plugins/lib_gtk_common/act_print.h board.h const.h macro.h \ @@ -2165,36 +2154,27 @@ ../src_plugins/lib_gtk_common/dlg_print.h pcb-printf.h hid_attrib.h \ hid.h hid_init.h misc_util.h compat_misc.h compat_nls.h ../src_plugins/lib_gtk_common/dlg_file_chooser.o: \ - ../src_plugins/lib_gtk_common/dlg_file_chooser.c ../config.h \ + ../src_plugins/lib_gtk_common/dlg_file_chooser.c ../config.h board.h \ + const.h macro.h global_typedefs.h pcb_bool.h unit.h vtroutestyle.h \ + attrib.h ../src_3rd/genvector/genvector_impl.h \ + ../src_3rd/genvector/genvector_undef.h layer.h globalconst.h \ + obj_all_list.h obj_arc_list.h obj_common.h \ + ../src_3rd/liblihata/genht/hash.h ../src_3rd/genlist/gendlist.h flag.h \ + obj_arc.h ../src_3rd/genlist/gentdlist_impl.h \ + ../src_3rd/genlist/gendlist.h ../src_3rd/genlist/gentdlist_undef.h \ + obj_elem_list.h obj_elem.h obj_line_list.h obj_line.h obj_pad_list.h \ + obj_pad.h obj_pinvia_list.h obj_pinvia.h obj_text.h ht_element.h \ + ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + obj_poly_list.h obj_poly.h polyarea.h obj_text_list.h obj_rat_list.h \ + obj_rat.h layer_grp.h library.h rats_patch.h board.h font.h box.h \ + math_helper.h move.h misc_util.h hid.h error.h drc.h \ ../src_plugins/lib_gtk_common/dlg_file_chooser.h compat_nls.h plug_io.h \ - library.h global_typedefs.h pcb_bool.h unit.h conf.h pcb-printf.h \ - ../src_3rd/genvector/gds_char.h ../src_3rd/genvector/genvector_impl.h \ - ../src_3rd/genvector/genvector_undef.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/dom.h ../src_3rd/liblihata/lihata.h \ - ../src_3rd/liblihata/parser.h ../src_3rd/liblihata/genht/htsp.h \ - ../src_3rd/liblihata/genht/ht.h ../src_3rd/liblihata/genht/ht_inlines.h \ + conf.h pcb-printf.h ../src_3rd/genvector/gds_char.h \ + ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/dom.h \ + ../src_3rd/liblihata/lihata.h ../src_3rd/liblihata/parser.h \ + ../src_3rd/liblihata/genht/htsp.h ../src_3rd/liblihata/genht/ht.h \ ../src_3rd/genvector/vtp0.h list_conf.h \ - ../src_3rd/genlist/gentdlist_undef.h ../src_3rd/genlist/gentdlist_impl.h \ - ../src_3rd/genlist/gendlist.h ../src_plugins/lib_gtk_common/util_str.h \ - ../src_plugins/lib_gtk_common/../hid_gtk/gui.h board.h const.h macro.h \ - vtroutestyle.h attrib.h layer.h globalconst.h obj_all_list.h \ - obj_arc_list.h obj_common.h ../src_3rd/liblihata/genht/hash.h \ - ../src_3rd/genlist/gendlist.h flag.h obj_arc.h obj_elem_list.h \ - obj_elem.h obj_line_list.h obj_line.h obj_pad_list.h obj_pad.h \ - obj_pinvia_list.h obj_pinvia.h obj_text.h ht_element.h \ - ../src_3rd/liblihata/genht/ht.h obj_poly_list.h obj_poly.h polyarea.h \ - obj_text_list.h obj_rat_list.h obj_rat.h layer_grp.h rats_patch.h \ - board.h font.h box.h math_helper.h move.h misc_util.h hid.h error.h \ - drc.h hid_cfg.h hid_cfg_input.h ../src_3rd/liblihata/genht/htip.h \ - hid_cfg.h data.h crosshair.h vtonpoint.h hid.h buffer.h \ - ../src_plugins/lib_gtk_common/../hid_gtk/ghid-main-menu.h \ - ../src_plugins/lib_gtk_common/wt_layer_selector.h \ - ../src_plugins/lib_gtk_common/wt_route_style.h route_style.h conf_core.h \ - event.h compat_misc.h ../src_plugins/lib_gtk_common/../hid_gtk/colors.h \ - ../src_plugins/lib_gtk_common/../hid_gtk/hid_gtk_conf.h conf.h \ - ../src_plugins/lib_gtk_common/bu_cursor_pos.h \ - ../src_plugins/lib_gtk_common/ui_zoompan.h unit.h pcb_bool.h \ - ../src_plugins/lib_gtk_common/dlg_propedit.h + ../src_plugins/lib_gtk_common/util_str.h ../src_plugins/lib_gtk_common/dlg_input.o: \ ../src_plugins/lib_gtk_common/dlg_input.c ../config.h \ ../src_plugins/lib_gtk_common/dlg_input.h Index: trunk/src_plugins/hid_gtk/gtkhid-main.c =================================================================== --- trunk/src_plugins/hid_gtk/gtkhid-main.c (revision 6724) +++ trunk/src_plugins/hid_gtk/gtkhid-main.c (revision 6725) @@ -668,6 +668,21 @@ pcb_gtk_get_coords(&gport->view, msg, x, y); } +int act_load(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +{ + return pcb_gtk_act_load(ghid_port.top_window, argc, argv, x, y); +} + +int act_save(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +{ + return pcb_gtk_act_save(ghid_port.top_window, argc, argv, x, y); +} + +int act_importgui(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +{ + return pcb_gtk_act_importgui(ghid_port.top_window, argc, argv, x, y); +} + void ghid_status_line_set_text(const gchar *text) { if (!ghidgui->command_entry_status_line_active) @@ -700,11 +715,11 @@ , {"GetXY", "", GetXY, getxy_help, getxy_syntax} , - {"ImportGUI", 0, pcb_gtk_act_importgui, pcb_gtk_acth_importgui, pcb_gtk_acts_importgui} + {"ImportGUI", 0, act_importgui, pcb_gtk_acth_importgui, pcb_gtk_acts_importgui} , {"LayerGroupsChanged", 0, LayerGroupsChanged} , - {"Load", 0, pcb_gtk_act_load } + {"Load", 0, act_load } , {"Pan", 0, PanAction, pcb_acth_pan, pcb_acts_pan} , @@ -714,7 +729,7 @@ , {"PrintCalibrate", 0, pcb_gtk_act_printcalibrate, pcb_gtk_acth_printcalibrate, pcb_gtk_acts_printcalibrate} , - {"Save", 0, pcb_gtk_act_save, pcb_gtk_acth_save, pcb_gtk_acts_save} + {"Save", 0, act_save, pcb_gtk_acth_save, pcb_gtk_acts_save} , {"SaveWindowGeometry", 0, SaveWinGeo, savewingeo_help, savewingeo_syntax} , Index: trunk/src_plugins/lib_gtk_common/act_fileio.c =================================================================== --- trunk/src_plugins/lib_gtk_common/act_fileio.c (revision 6724) +++ trunk/src_plugins/lib_gtk_common/act_fileio.c (revision 6725) @@ -35,6 +35,8 @@ #include "plug_footprint.h" #include "compat_misc.h" #include "conf_core.h" +#include "board.h" +#include "data.h" #include "dlg_file_chooser.h" @@ -51,7 +53,7 @@ return pcb_strdup(getcwd(tmp, sizeof(tmp))); } -int pcb_gtk_act_load(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +int pcb_gtk_act_load(GtkWidget *top_window, int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) { const char *function; char *name = NULL; @@ -74,17 +76,17 @@ function = argc ? argv[0] : "Layout"; if (pcb_strcasecmp(function, "Netlist") == 0) { - name = ghid_dialog_file_select_open(_("Load netlist file"), ¤t_netlist_dir, conf_core.rc.file_path); + name = ghid_dialog_file_select_open(top_window, _("Load netlist file"), ¤t_netlist_dir, conf_core.rc.file_path); } else if (pcb_strcasecmp(function, "ElementToBuffer") == 0) { gchar *path = (gchar *) pcb_fp_default_search_path(); - name = ghid_dialog_file_select_open(_("Load element to buffer"), ¤t_element_dir, path); + name = ghid_dialog_file_select_open(top_window, _("Load element to buffer"), ¤t_element_dir, path); } else if (pcb_strcasecmp(function, "LayoutToBuffer") == 0) { - name = ghid_dialog_file_select_open(_("Load layout file to buffer"), ¤t_layout_dir, conf_core.rc.file_path); + name = ghid_dialog_file_select_open(top_window, _("Load layout file to buffer"), ¤t_layout_dir, conf_core.rc.file_path); } else if (pcb_strcasecmp(function, "Layout") == 0) { - name = ghid_dialog_file_select_open(_("Load layout file"), ¤t_layout_dir, conf_core.rc.file_path); + name = ghid_dialog_file_select_open(top_window, _("Load layout file"), ¤t_layout_dir, conf_core.rc.file_path); } if (name) { @@ -110,7 +112,7 @@ %end-doc */ -int pcb_gtk_act_save(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +int pcb_gtk_act_save(GtkWidget *top_window, int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) { const char *function; char *name, *name_in = NULL; @@ -185,9 +187,7 @@ else name_in = pcb_strdup(PCB->Filename); } - name = - ghid_dialog_file_select_save(prompt, ¤t_dir, name_in, conf_core.rc.file_path, formats_param, extensions_param, - fmt_param); + name = ghid_dialog_file_select_save(top_window, prompt, ¤t_dir, name_in, conf_core.rc.file_path, formats_param, extensions_param, fmt_param); free(name_in); } @@ -227,7 +227,7 @@ const char pcb_gtk_acts_importgui[] = "ImportGUI()"; const char pcb_gtk_acth_importgui[] = N_("Asks user which schematics to import into PCB.\n"); -int pcb_gtk_act_importgui(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) +int pcb_gtk_act_importgui(GtkWidget *top_window, int argc, const char **argv, pcb_coord_t x, pcb_coord_t y) { char *name = NULL; static gchar *current_layout_dir = NULL; @@ -241,7 +241,7 @@ return 1; - name = ghid_dialog_file_select_open(_("Load schematics"), ¤t_layout_dir, conf_core.rc.file_path); + name = ghid_dialog_file_select_open(top_window, _("Load schematics"), ¤t_layout_dir, conf_core.rc.file_path); #ifdef DEBUG printf("File selected = %s\n", name); Index: trunk/src_plugins/lib_gtk_common/act_fileio.h =================================================================== --- trunk/src_plugins/lib_gtk_common/act_fileio.h (revision 6724) +++ trunk/src_plugins/lib_gtk_common/act_fileio.h (revision 6725) @@ -1,11 +1,12 @@ +#include #include "unit.h" -int pcb_gtk_act_load(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y); +int pcb_gtk_act_load(GtkWidget *top_window, int argc, const char **argv, pcb_coord_t x, pcb_coord_t y); extern const char pcb_gtk_acts_save[]; extern const char pcb_gtk_acth_save[]; -int pcb_gtk_act_save(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y); +int pcb_gtk_act_save(GtkWidget *top_window, int argc, const char **argv, pcb_coord_t x, pcb_coord_t y); extern const char pcb_gtk_acts_importgui[]; extern const char pcb_gtk_acth_importgui[]; -int pcb_gtk_act_importgui(int argc, const char **argv, pcb_coord_t x, pcb_coord_t y); +int pcb_gtk_act_importgui(GtkWidget *top_window, int argc, const char **argv, pcb_coord_t x, pcb_coord_t y); Index: trunk/src_plugins/lib_gtk_common/dlg_file_chooser.c =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_file_chooser.c (revision 6724) +++ trunk/src_plugins/lib_gtk_common/dlg_file_chooser.c (revision 6725) @@ -29,19 +29,21 @@ #include "config.h" +#include "board.h" +#include "hid.h" + #include "dlg_file_chooser.h" /* ---------------------------------------------- */ /* Caller must g_free() the returned filename.*/ -gchar *ghid_dialog_file_select_open(const gchar * title, gchar ** path, const gchar * shortcuts) +gchar *ghid_dialog_file_select_open(GtkWidget *top_window, const gchar *title, gchar **path, const gchar *shortcuts) { GtkWidget *dialog; gchar *result = NULL, *folder, *seed; - GHidPort *out = &ghid_port; GtkFileFilter *no_filter, *any_filter; dialog = gtk_file_chooser_dialog_new(title, - GTK_WINDOW(out->top_window), + GTK_WINDOW(top_window), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); @@ -210,18 +212,16 @@ /* ---------------------------------------------- */ /* Caller must g_free() the returned filename. */ -gchar *ghid_dialog_file_select_save(const gchar * title, gchar ** path, const gchar * file, const gchar * shortcuts, - const char **formats, const char **extensions, int *format) +gchar *ghid_dialog_file_select_save(GtkWindow *top_window, const gchar *title, gchar **path, const gchar *file, const gchar *shortcuts, const char **formats, const char **extensions, int *format) { GtkWidget *fmt, *tmp, *fmt_combo; gchar *result = NULL, *folder, *seed; - GHidPort *out = &ghid_port; ghid_save_ctx_t ctx; ctx.formats = formats; ctx.extensions = extensions; ctx.dialog = gtk_file_chooser_dialog_new(title, - GTK_WINDOW(out->top_window), + GTK_WINDOW(top_window), GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); @@ -308,12 +308,10 @@ /* ---------------------------------------------- */ /* Caller must g_free() the returned filename. */ -gchar *ghid_fileselect(const char *title, const char *descr, - const char *default_file, const char *default_ext, const char *history_tag, int flags) +gchar *ghid_fileselect(GtkWidget *top_window, const char *title, const char *descr, const char *default_file, const char *default_ext, const char *history_tag, int flags) { GtkWidget *dialog; gchar *result = NULL; - GHidPort *out = &ghid_port; gchar *path = NULL, *base = NULL; int history_pool = -1; int i; @@ -361,7 +359,7 @@ } dialog = gtk_file_chooser_dialog_new(title, - GTK_WINDOW(out->top_window), + GTK_WINDOW(top_window), (flags & HID_FILESELECT_READ) ? GTK_FILE_CHOOSER_ACTION_OPEN : GTK_FILE_CHOOSER_ACTION_SAVE, Index: trunk/src_plugins/lib_gtk_common/dlg_file_chooser.h =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_file_chooser.h (revision 6724) +++ trunk/src_plugins/lib_gtk_common/dlg_file_chooser.h (revision 6725) @@ -5,12 +5,8 @@ #include "util_str.h" +gchar *ghid_dialog_file_select_open(GtkWidget *top_window, const gchar *title, gchar **path, const gchar *shortcuts); -/* This needs to be changed */ -#include "../hid_gtk/gui.h" +gchar *ghid_dialog_file_select_save(GtkWindow *top_window, const gchar *title, gchar **path, const gchar *file, const gchar *shortcuts, const char **formats, const char **extensions, int *format); -gchar *ghid_dialog_file_select_open(const gchar * title, gchar ** path, const gchar * shortcuts); -gchar *ghid_dialog_file_select_save(const gchar * title, gchar ** path, const gchar * file, const gchar * shortcuts, - const char **formats, const char **extensions, int *format); -gchar *ghid_fileselect(const char *title, const char *descr, - const char *default_file, const char *default_ext, const char *history_tag, int flags); +gchar *ghid_fileselect(GtkWidget *top_window, const char *title, const char *descr, const char *default_file, const char *default_ext, const char *history_tag, int flags);