Index: Makefile =================================================================== --- Makefile (nonexistent) +++ Makefile (revision 3905) @@ -0,0 +1,5 @@ +all: + cd ../../src && make mod_polystitch + +clean: + rm *.o *.so 2>/dev/null ; true Index: Plug.tmpasm =================================================================== --- Plug.tmpasm (nonexistent) +++ 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: README =================================================================== --- README (nonexistent) +++ 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: polystitch.c =================================================================== --- polystitch.c (revision 3904) +++ 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; +}