Index: trunk/src/actions_pcb.c =================================================================== --- trunk/src/actions_pcb.c (revision 31250) +++ trunk/src/actions_pcb.c (revision 31251) @@ -46,6 +46,7 @@ const char *PCB_PTR_DOMAIN_LAYER = "pcb_fgw_ptr_domain_layer"; const char *PCB_PTR_DOMAIN_LAYERGRP = "pcb_fgw_ptr_domain_layergrp"; const char *PCB_PTR_DOMAIN_VIEWLIST = "pcb_fgw_ptr_domain_viewlist"; +const char *PCB_PTR_DOMAIN_FPMAP = "pcb_fgw_ptr_domain_fpmap"; #define conv_str2layerid(dst, src) \ Index: trunk/src/actions_pcb.h =================================================================== --- trunk/src/actions_pcb.h (revision 31250) +++ trunk/src/actions_pcb.h (revision 31251) @@ -1,6 +1,7 @@ extern const char *PCB_PTR_DOMAIN_LAYER; extern const char *PCB_PTR_DOMAIN_LAYERGRP; extern const char *PCB_PTR_DOMAIN_VIEWLIST; +extern const char *PCB_PTR_DOMAIN_FPMAP; void pcb_actions_init_pcb_only(void); Index: trunk/src/global_typedefs.h =================================================================== --- trunk/src/global_typedefs.h (revision 31250) +++ trunk/src/global_typedefs.h (revision 31251) @@ -60,6 +60,7 @@ typedef union pcb_parent_s pcb_parent_t; typedef struct pcb_plug_io_s pcb_plug_io_t; +typedef struct pcb_plug_fp_map_s pcb_plug_fp_map_t; typedef struct pcb_view_s pcb_view_t; #endif Index: trunk/src/plug_footprint.c =================================================================== --- trunk/src/plug_footprint.c (revision 31250) +++ trunk/src/plug_footprint.c (revision 31251) @@ -34,7 +34,10 @@ #include #include #include "conf_core.h" +#include "actions_pcb.h" +#include "plug_io.h" #include +#include #include #include "event.h" @@ -481,3 +484,24 @@ } return -1; } + +const char *pcb_fp_map_choose(rnd_hidlib_t *hidlib, const pcb_plug_fp_map_t *map) +{ + if (RND_HAVE_GUI_ATTR_DLG) { + fgw_arg_t res; + fgw_arg_t args[2]; + + fgw_ptr_reg(&rnd_fgw, &args[1], PCB_PTR_DOMAIN_FPMAP, FGW_PTR | FGW_STRUCT, (void *)map); + rnd_actionv_bin(hidlib, "gui_fpmap_choose", &res, 2, args); + fgw_ptr_unreg(&rnd_fgw, &args[1], PCB_PTR_DOMAIN_FPMAP); + + if (res.type & FGW_STR) + return res.val.str; + } + else { + rnd_message(RND_MSG_ERROR, "No gui available, automatically choosing the first footprint from the available footprints.\n"); + return map->name; + } + + return NULL; +} Index: trunk/src/plug_footprint.h =================================================================== --- trunk/src/plug_footprint.h (revision 31250) +++ trunk/src/plug_footprint.h (revision 31251) @@ -95,4 +95,8 @@ /* rescan/reload all footprints in the library cache */ int pcb_fp_rehash(rnd_hidlib_t *hidlib, pcb_fplibrary_t *l); +/* invoke the GUI to choose one footprint name from a footprint map; if + there's no GUI available, throws a warning and returns the first */ +const char *pcb_fp_map_choose(rnd_hidlib_t *hidlib, const pcb_plug_fp_map_t *map); + #endif Index: trunk/src/plug_io.h =================================================================== --- trunk/src/plug_io.h (revision 31250) +++ trunk/src/plug_io.h (revision 31251) @@ -43,7 +43,6 @@ } pcb_plug_iot_t; /* Returned by map_footprint() to tell what type of footprint(s) a file contains */ -typedef struct pcb_plug_fp_map_s pcb_plug_fp_map_t; struct pcb_plug_fp_map_s { pcb_fptype_t type; pcb_fplibrary_type_t libtype; /* normally LIB_FOOTPRINT */