Index: trunk/doc-rnd/features/oldplugins.html
===================================================================
--- trunk/doc-rnd/features/oldplugins.html (revision 3907)
+++ trunk/doc-rnd/features/oldplugins.html (revision 3908)
@@ -31,6 +31,7 @@
jostle - doesn't work properly
polycombine
polystich - segfaults
+ teardrops
Plugins that won't be imported:
@@ -41,6 +42,7 @@
lockelements - [query] can select elements then SetFlag(selected) should be able to lock the,
sedrename - [query] will take care of that
upth2pth - [query] will take care of that
+ ratsel - written in C++
save/load and compatibility
Index: trunk/scconfig/plugins.h
===================================================================
--- trunk/scconfig/plugins.h (revision 3907)
+++ trunk/scconfig/plugins.h (revision 3908)
@@ -9,6 +9,7 @@
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("teardrops", "draw teardrops on pins", sbuildin, 1)
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 3907)
+++ trunk/src_plugins/plugins_feature.tmpasm (revision 3908)
@@ -9,6 +9,7 @@
include {../src_plugins/jostle/Plug.tmpasm}
include {../src_plugins/polycombine/Plug.tmpasm}
include {../src_plugins/polystitch/Plug.tmpasm}
+include {../src_plugins/teardrops/Plug.tmpasm}
include {../src_plugins/vendordrill/Plug.tmpasm}
include {../src_plugins/puller/Plug.tmpasm}
include {../src_plugins/djopt/Plug.tmpasm}
Index: trunk/src_plugins/teardrops/Makefile
===================================================================
--- trunk/src_plugins/teardrops/Makefile (nonexistent)
+++ trunk/src_plugins/teardrops/Makefile (revision 3908)
@@ -0,0 +1,5 @@
+all:
+ cd ../../src && make mod_teardrops
+
+clean:
+ rm *.o *.so 2>/dev/null ; true
Index: trunk/src_plugins/teardrops/Plug.tmpasm
===================================================================
--- trunk/src_plugins/teardrops/Plug.tmpasm (nonexistent)
+++ trunk/src_plugins/teardrops/Plug.tmpasm (revision 3908)
@@ -0,0 +1,8 @@
+put /local/pcb/mod {teardrops}
+put /local/pcb/mod/OBJS [@ $(PLUGDIR)/teardrops/teardrops.o @]
+
+switch /local/pcb/teardrops/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/teardrops/README
===================================================================
--- trunk/src_plugins/teardrops/README (nonexistent)
+++ trunk/src_plugins/teardrops/README (revision 3908)
@@ -0,0 +1,5 @@
+Draw teardrops on pins.
+
+#state: works
+#default: buildin
+#implements: (feature)
Index: trunk/src_plugins/teardrops/teardrops.c
===================================================================
--- trunk/src_plugins/teardrops/teardrops.c (revision 3907)
+++ trunk/src_plugins/teardrops/teardrops.c (revision 3908)
@@ -8,7 +8,9 @@
* \copyright Licensed under the terms of the GNU General Public
* License, version 2 or later.
*
- * http://www.delorie.com/pcb/teardrops/
+ * Ported to pcb-rnd by Tibor 'Igor2' Palinkas in 2016.
+ *
+ * Original source: http://www.delorie.com/pcb/teardrops/
*/
#include
@@ -22,6 +24,8 @@
#include "create.h"
#include "rtree.h"
#include "undo.h"
+#include "plugins.h"
+#include "hid_actions.h"
#define MIN_LINE_LENGTH 700
#define MAX_DISTANCE 700
@@ -36,7 +40,6 @@
static PadType *pad;
static int layer;
static int px, py;
-static LayerType *silk;
static Coord thickness;
static ElementType *element;
@@ -53,7 +56,7 @@
return distance;
}
-static int check_line_callback(const BoxType * box, void *cl)
+static r_dir_t check_line_callback(const BoxType * box, void *cl)
{
LayerType *lay = &PCB->Data->Layer[layer];
LineType *l = (LineType *) box;
@@ -67,7 +70,7 @@
ArcType *arc;
fprintf(stderr, "...Line ((%.6f, %.6f), (%.6f, %.6f)): ",
- COORD_TO_MM(l->Point1.X), COORD_TO_MM(l->Point1.Y), COORD_TO_MM(l->Point2.X), COORD_TO_MM(l->Point2.Y));
+ PCB_COORD_TO_MM(l->Point1.X), PCB_COORD_TO_MM(l->Point1.Y), PCB_COORD_TO_MM(l->Point2.X), PCB_COORD_TO_MM(l->Point2.Y));
/* if our line is to short ignore it */
if (distance_between_points(l->Point1.X, l->Point1.Y, l->Point2.X, l->Point2.Y) < MIN_LINE_LENGTH) {
@@ -75,7 +78,7 @@
return 1;
}
- fprintf(stderr, "......Point (%.6f, %.6f): ", COORD_TO_MM(px), COORD_TO_MM(py));
+ fprintf(stderr, "......Point (%.6f, %.6f): ", PCB_COORD_TO_MM(px), PCB_COORD_TO_MM(py));
if (distance_between_points(l->Point1.X, l->Point1.Y, px, py) < MAX_DISTANCE) {
x1 = l->Point1.X;
@@ -99,7 +102,7 @@
t = l->Thickness / 2.0;
if (t > r) {
- fprintf(stderr, "t > r: t = %3.6f, r = %3.6f\n", COORD_TO_MM(t), COORD_TO_MM(r));
+ fprintf(stderr, "t > r: t = %3.6f, r = %3.6f\n", PCB_COORD_TO_MM(t), PCB_COORD_TO_MM(r));
return 1;
}
@@ -119,7 +122,7 @@
if (radius < r || radius < t) {
fprintf(stderr,
"(radius < r || radius < t): radius = %3.6f, r = %3.6f, t = %3.6f\n",
- COORD_TO_MM(radius), COORD_TO_MM(r), COORD_TO_MM(t));
+ PCB_COORD_TO_MM(radius), PCB_COORD_TO_MM(r), PCB_COORD_TO_MM(t));
return 1;
}
}
@@ -169,7 +172,7 @@
arc = CreateNewArcOnLayer(lay, (int) ax, (int) ay, (int) radius,
(int) radius, (int) theta + 90 + aoffset, delta - aoffset, l->Thickness, l->Clearance, l->Flags);
if (arc)
- AddObjectToCreateUndoList(ARC_TYPE, lay, arc, arc);
+ AddObjectToCreateUndoList(PCB_TYPE_ARC, lay, arc, arc);
ax = lx + dy * (x + t);
ay = ly - dx * (x + t);
@@ -177,7 +180,7 @@
arc = CreateNewArcOnLayer(lay, (int) ax, (int) ay, (int) radius,
(int) radius, (int) theta - 90 - aoffset, -delta + aoffset, l->Thickness, l->Clearance, l->Flags);
if (arc)
- AddObjectToCreateUndoList(ARC_TYPE, lay, arc, arc);
+ AddObjectToCreateUndoList(PCB_TYPE_ARC, lay, arc, arc);
radius += t * 1.9;
aoffset = acos((double) adist / radius) * 180.0 / M_PI;
@@ -208,12 +211,12 @@
fprintf(stderr, "Pin %s (%s) at %.6f, %.6f (element %s, %s, %s)\n", EMPTY(pin->Number), EMPTY(pin->Name),
/* 0.01 * pin->X, 0.01 * pin->Y, */
- COORD_TO_MM(pin->X), COORD_TO_MM(pin->Y),
+ PCB_COORD_TO_MM(pin->X), PCB_COORD_TO_MM(pin->Y),
EMPTY(NAMEONPCB_NAME(element)), EMPTY(VALUE_NAME(element)), EMPTY(DESCRIPTION_NAME(element)));
for (layer = 0; layer < max_copper_layer; layer++) {
LayerType *l = &(PCB->Data->Layer[layer]);
- r_search(l->line_tree, &spot, NULL, check_line_callback, l);
+ r_search(l->line_tree, &spot, NULL, check_line_callback, l, NULL);
}
}
@@ -231,11 +234,11 @@
spot.X2 = px + 10;
spot.Y2 = py + 10;
- fprintf(stderr, "Via at %.6f, %.6f\n", COORD_TO_MM(pin->X), COORD_TO_MM(pin->Y));
+ fprintf(stderr, "Via at %.6f, %.6f\n", PCB_COORD_TO_MM(pin->X), PCB_COORD_TO_MM(pin->Y));
for (layer = 0; layer < max_copper_layer; layer++) {
LayerType *l = &(PCB->Data->Layer[layer]);
- r_search(l->line_tree, &spot, NULL, check_line_callback, l);
+ r_search(l->line_tree, &spot, NULL, check_line_callback, l, NULL);
}
}
@@ -254,17 +257,17 @@
fprintf(stderr,
"Pad %s (%s) at %.6f, %.6f (element %s, %s, %s) \n",
EMPTY(pad->Number), EMPTY(pad->Name),
- COORD_TO_MM((pad->BoundingBox.X1 + pad->BoundingBox.X2) / 2),
- COORD_TO_MM((pad->BoundingBox.Y1 + pad->BoundingBox.Y2) / 2),
+ PCB_COORD_TO_MM((pad->BoundingBox.X1 + pad->BoundingBox.X2) / 2),
+ PCB_COORD_TO_MM((pad->BoundingBox.Y1 + pad->BoundingBox.Y2) / 2),
EMPTY(NAMEONPCB_NAME(element)), EMPTY(VALUE_NAME(element)), EMPTY(DESCRIPTION_NAME(element)));
/* fprintf(stderr, */
/* "Pad %s (%s) at ((%.6f, %.6f), (%.6f, %.6f)) (element %s, %s, %s) \n", */
/* EMPTY (pad->Number), EMPTY (pad->Name), */
- /* COORD_TO_MM(pad->BoundingBox.X1), */
- /* COORD_TO_MM(pad->BoundingBox.Y1), */
- /* COORD_TO_MM(pad->BoundingBox.X2), */
- /* COORD_TO_MM(pad->BoundingBox.Y2), */
+ /* PCB_COORD_TO_MM(pad->BoundingBox.X1), */
+ /* PCB_COORD_TO_MM(pad->BoundingBox.Y1), */
+ /* PCB_COORD_TO_MM(pad->BoundingBox.X2), */
+ /* PCB_COORD_TO_MM(pad->BoundingBox.Y2), */
/* EMPTY (NAMEONPCB_NAME (element)), */
/* EMPTY (VALUE_NAME (element)), */
/* EMPTY (DESCRIPTION_NAME (element))); */
@@ -271,14 +274,12 @@
for (layer = 0; layer < max_copper_layer; layer++) {
LayerType *l = &(PCB->Data->Layer[layer]);
- r_search(l->line_tree, &(pad->BoundingBox), NULL, check_line_callback, l);
+ r_search(l->line_tree, &(pad->BoundingBox), NULL, check_line_callback, l, NULL);
}
}
-static int teardrops(int argc, char **argv, Coord x, Coord y)
+static int teardrops(int argc, const char **argv, Coord x, Coord y)
{
- silk = &PCB->Data->SILKLAYER;
-
new_arcs = 0;
VIA_LOOP(PCB->Data);
@@ -311,9 +312,18 @@
{"Teardrops", NULL, teardrops, NULL, NULL}
};
-REGISTER_ACTIONS(teardrops_action_list)
+char *teardrops_cookie = "teardrops plugin";
-void hid_teardrops_init()
+REGISTER_ACTIONS(teardrops_action_list, teardrops_cookie)
+
+static void hid_teardrops_uninit(void)
{
- register_teardrops_action_list();
+ hid_remove_actions_by_cookie(teardrops_cookie);
}
+
+#include "dolists.h"
+pcb_uninit_t hid_teardrops_init()
+{
+ REGISTER_ACTIONS(teardrops_action_list, teardrops_cookie);
+ return hid_teardrops_uninit;
+}