Index: trunk/doc-rnd/features/oldplugins.html =================================================================== --- trunk/doc-rnd/features/oldplugins.html (revision 3904) +++ trunk/doc-rnd/features/oldplugins.html (revision 3905) @@ -30,6 +30,7 @@
  • distaligntext
  • jostle - doesn't work properly
  • polycombine +
  • polystich - segfaults

    Plugins that won't be imported: Index: trunk/scconfig/plugins.h =================================================================== --- trunk/scconfig/plugins.h (revision 3904) +++ trunk/scconfig/plugins.h (revision 3905) @@ -8,6 +8,7 @@ plugin_def("distaligntext", "distribute and align text", sbuildin, 1) plugin_def("jostle", "push lines out of the way", sbuildin, 1) plugin_def("polycombine", "combine selected polygons", sbuildin, 1) +plugin_def("polystitch", "stitch polygon at cursor", sdisable, 0) plugin_def("toporouter", "topological autorouter", sdisable, 0) plugin_def("autoplace", "auto place components", sbuildin, 1) plugin_def("vendordrill", "vendor drill mapping", sbuildin, 1) Index: trunk/src_plugins/plugins_feature.tmpasm =================================================================== --- trunk/src_plugins/plugins_feature.tmpasm (revision 3904) +++ trunk/src_plugins/plugins_feature.tmpasm (revision 3905) @@ -8,6 +8,7 @@ include {../src_plugins/distaligntext/Plug.tmpasm} include {../src_plugins/jostle/Plug.tmpasm} include {../src_plugins/polycombine/Plug.tmpasm} +include {../src_plugins/polystitch/Plug.tmpasm} include {../src_plugins/vendordrill/Plug.tmpasm} include {../src_plugins/puller/Plug.tmpasm} include {../src_plugins/djopt/Plug.tmpasm} Index: trunk/src_plugins/polystitch/Makefile =================================================================== --- trunk/src_plugins/polystitch/Makefile (nonexistent) +++ trunk/src_plugins/polystitch/Makefile (revision 3905) @@ -0,0 +1,5 @@ +all: + cd ../../src && make mod_polystitch + +clean: + rm *.o *.so 2>/dev/null ; true Index: trunk/src_plugins/polystitch/Plug.tmpasm =================================================================== --- trunk/src_plugins/polystitch/Plug.tmpasm (nonexistent) +++ trunk/src_plugins/polystitch/Plug.tmpasm (revision 3905) @@ -0,0 +1,8 @@ +put /local/pcb/mod {polystitch} +put /local/pcb/mod/OBJS [@ $(PLUGDIR)/polystitch/polystitch.o @] + +switch /local/pcb/polystitch/controls + case {buildin} include /local/pcb/tmpasm/buildin; end; + case {plugin} include /local/pcb/tmpasm/plugin; end; + case {disable} include /local/pcb/tmpasm/disable; end; +end Index: trunk/src_plugins/polystitch/README =================================================================== --- trunk/src_plugins/polystitch/README (nonexistent) +++ trunk/src_plugins/polystitch/README (revision 3905) @@ -0,0 +1,8 @@ +The polygon under the cursor (based on closest-corner) is stitched +together with the polygon surrounding it on the same layer. +Use with pstoedit conversions where there's a "hole" in the shape - +select the hole. + +#state: segfaults +#default: disable +#implements: (feature) Index: trunk/src_plugins/polystitch/polystitch.c =================================================================== --- trunk/src_plugins/polystitch/polystitch.c (revision 3904) +++ trunk/src_plugins/polystitch/polystitch.c (revision 3905) @@ -8,14 +8,10 @@ * \copyright Licensed under the terms of the GNU General Public * License, version 2 or later. * - * http://www.delorie.com/pcb/polystitch.c + * Ported to pcb-rnd by Tibor 'Igor2' Palinkas in 2016. * - * Compile like this: + * Original source: http://www.delorie.com/pcb/polystitch.c * - * gcc -I$HOME/geda/pcb-cvs/src -I$HOME/geda/pcb-cvs -O2 -shared polystitch.c -o polystitch.so - * - * The resulting polystitch.so goes in $HOME/.pcb/plugins/polystitch.so. - * * Usage: PolyStitch() * * The polygon under the cursor (based on closest-corner) is stitched @@ -40,6 +36,8 @@ #include "set.h" #include "polygon.h" #include "misc.h" +#include "plugins.h" +#include "hid_actions.h" static PolygonType *inner_poly, *outer_poly; static LayerType *poly_layer; @@ -104,7 +102,7 @@ } ENDALL_LOOP; if (!inner_poly) { - Message("Cannot find any polygons"); + Message(PCB_MSG_ERROR, "Cannot find any polygons"); return; } } @@ -129,7 +127,7 @@ } } END_LOOP; - Message("Cannot find a polygon enclosing the one you selected"); + Message(PCB_MSG_ERROR, "Cannot find a polygon enclosing the one you selected"); } static void check_windings() @@ -216,7 +214,7 @@ for (i = 0; i < inner_poly->PointN; i++) CreateNewPointInPolygon(outer_poly, inner_poly->Points[i].X, inner_poly->Points[i].Y); - SetChangedFlag(true); + SetChangedFlag(pcb_true); outer_poly->NoHolesValid = 0; SetPolygonBoundingBox(outer_poly); @@ -229,7 +227,7 @@ RemovePolygon(poly_layer, inner_poly); } -static int polystitch(int argc, char **argv, Coord x, Coord y) +static int polystitch(int argc, const char **argv, Coord x, Coord y) { find_crosshair_poly(x, y); if (inner_poly) { @@ -247,10 +245,18 @@ NULL, NULL} }; -REGISTER_ACTIONS(polystitch_action_list) +char *polystitch_cookie = "polystitch plugin"; - void - pcb_plugin_init() +REGISTER_ACTIONS(polystitch_action_list, polystitch_cookie) + +static void hid_polystitch_uninit(void) { - register_polystitch_action_list(); + hid_remove_actions_by_cookie(polystitch_cookie); } + +#include "dolists.h" +pcb_uninit_t hid_polystitch_init() +{ + REGISTER_ACTIONS(polystitch_action_list, polystitch_cookie); + return hid_polystitch_uninit; +}