Index: src/plug_io.c =================================================================== --- src/plug_io.c (revision 2639) +++ src/plug_io.c (revision 2640) @@ -149,7 +149,7 @@ } /* Find the plugin that offers the highest write prio for the format */ -static plug_io_t *find_writer(const char *fmt) +static plug_io_t *find_writer(plug_iot_t typ, const char *fmt) { find_t available[32]; /* wish we had more than 32 IO plugins... */ int len = 0; @@ -168,7 +168,7 @@ } \ } while(0) - HOOK_CALL_ALL(plug_io_t, plug_io_chain, fmt_support_prio, cb_append, 1, fmt); + HOOK_CALL_ALL(plug_io_t, plug_io_chain, fmt_support_prio, cb_append, typ, 1, fmt); if (len == 0) return NULL; @@ -181,7 +181,7 @@ { int res; - plug_io_t *p = find_writer(fmt); + plug_io_t *p = find_writer(PCB_IOT_BUFFER, fmt); if (p != NULL) res = p->write_buffer(p, f, buff); @@ -194,7 +194,7 @@ { int res; - plug_io_t *p = find_writer(fmt); + plug_io_t *p = find_writer(PCB_IOT_FOOTPRINT, fmt); if (p != NULL) res = p->write_element(p, f, e); @@ -206,7 +206,7 @@ int WritePCB(FILE *f, const char *fmt) { int res; - plug_io_t *p = find_writer(fmt); + plug_io_t *p = find_writer(PCB_IOT_PCB, fmt); if (p != NULL) { event(EVENT_SAVE_PRE, "s", fmt); Index: src/plug_io.h =================================================================== --- src/plug_io.h (revision 2639) +++ src/plug_io.h (revision 2640) @@ -31,6 +31,13 @@ #include "global.h" #include "conf.h" +typedef enum { + PCB_IOT_PCB = 1, + PCB_IOT_FOOTPRINT = 2, + PCB_IOT_FONT = 4, + PCB_IOT_BUFFER = 8 +} plug_iot_t; + /**************************** API definition *********************************/ struct plug_io_s { plug_io_t *next; @@ -37,10 +44,11 @@ void *plugin_data; /* Check if the plugin supports format fmt, for writing (if wr != 0) or for - reading (if wr == 0). Return 0 if not supported or an integer priority - if supported. The higher the prio is the more likely the plugin gets - the next operation on the file. Base prio should be 100 for native formats. */ - int (*fmt_support_prio)(plug_io_t *ctx, int wr, const char *fmt); + reading (if wr == 0) for I/O type typ. Return 0 if not supported or an + integer priority if supported. The higher the prio is the more likely + the plugin gets the next operation on the file. Base prio should be + 100 for native formats. */ + int (*fmt_support_prio)(plug_io_t *ctx, plug_iot_t typ, int wr, const char *fmt); /* Attempt to load a pcb design from Filename to Ptr. Conf subtree at settings_dest is replaced by settings loaded from the Index: src_plugins/io_kicad_legacy/io_kicad_legacy.c =================================================================== --- src_plugins/io_kicad_legacy/io_kicad_legacy.c (revision 2639) +++ src_plugins/io_kicad_legacy/io_kicad_legacy.c (revision 2640) @@ -31,9 +31,9 @@ static plug_io_t io_kicad_legacy; -int io_kicad_legacy_fmt(plug_io_t *ctx, int wr, const char *fmt) +int io_kicad_legacy_fmt(plug_io_t *ctx, plug_iot_t typ, int wr, const char *fmt) { - if (strcmp(fmt, "kicadl") != 0) + if ((strcmp(fmt, "kicadl") != 0) || ((typ & (~(PCB_IOT_FOOTPRINT | PCB_IOT_BUFFER))) != 0)) return 0; if (wr) return 100; Index: src_plugins/io_pcb/io_pcb.c =================================================================== --- src_plugins/io_pcb/io_pcb.c (revision 2639) +++ src_plugins/io_pcb/io_pcb.c (revision 2640) @@ -31,8 +31,9 @@ static plug_io_t io_pcb; -int io_pcb_fmt(plug_io_t *ctx, int wr, const char *fmt) +int io_pcb_fmt(plug_io_t *ctx, plug_iot_t typ, int wr, const char *fmt) { + /* All types are supported. */ if (strcmp(fmt, "pcb") != 0) return 0; return 100; /* read-write */