[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: Pin-pin rubberbanding



Just though I'd post this.

The implementation is a little kludgy, but it seems to yield the desired
behaviour.


I've been drawing various control block diagrams with gschem recently,
using an arrow symbol with two pins to indicate signal flow. Having to
add nets between everything manually can be a bit of a pain as you
rework and move things in the diagram.

This patch allows you to touch two pins together (placing the component
so the pins connect), then pull them apart to produce nets. It also
works when moving nets attached to pins, so new segments are produced.


-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)
From 9c542c0c3f64bf5de10db32043bda506f4657d67 Mon Sep 17 00:00:00 2001
From: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Sun, 24 May 2009 13:12:06 +0100
Subject: [PATCH] Rubberband pin to pin connections by adding nets

---
 gschem/src/o_move.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/gschem/src/o_move.c b/gschem/src/o_move.c
index 76eca40..6e8fcd2 100644
--- a/gschem/src/o_move.c
+++ b/gschem/src/o_move.c
@@ -502,6 +502,21 @@ void o_move_check_endpoint(GSCHEM_TOPLEVEL *w_current, OBJECT * object)
          c_current->other_whichone == -1))
       continue;
 
+    if (c_current->other_object->type == OBJ_PIN) {
+      OBJECT *new_net;
+      /* other object is a pin, insert a net */
+      new_net = o_net_new (toplevel, OBJ_NET, NET_COLOR,
+                           c_current->x, c_current->y,
+                           c_current->x, c_current->y);
+      s_page_append (toplevel->page_current, new_net);
+      s_tile_add_object (toplevel, new_net);
+      s_conn_update_object (toplevel, new_net);
+      /* This new net object is only picked up for stretching later,
+       * somewhat of a kludge. If the move operation is cancelled, these
+       * new 0 length nets are removed by the "undo" operation invoked.
+       */
+    }
+
     /* Only attempt to stretch nets and buses */
     if (c_current->other_object->type != OBJ_NET &&
         c_current->other_object->type != OBJ_BUS)
-- 
1.6.0.4


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user