Hi all,

I tried to fix a small drawing error (whichend was missing) in 
o_pin_end() and stumbled over a failing connection check.

to reproduce the bug:
* draw a net
* draw a pin starting at the middle of the net
--> no connection between the net and the pin.

Guessed bug:
The add_pin_hook can add some objects to the object_tail. 
The following connection check fails as it checks a pin attribute, not 
the pin itself.

Possible corrections:
* move the add_pin_hook behind the connection checks
or
* save a object pointer to the pin (that's the way I've done it)


In the patch I've outcommented the drawing code too, o_pin_draw() is 
used for that part now.

If the patch is ok, I'll clean it up and apply it.

regards
Werner 

Index: noweb/o_pin.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_pin.nw,v
retrieving revision 1.10
diff -u -r1.10 o_pin.nw
--- noweb/o_pin.nw	25 Feb 2006 15:00:58 -0000	1.10
+++ noweb/o_pin.nw	15 May 2006 19:29:42 -0000
@@ -265,9 +265,9 @@
   int x1, y1;
   int x2, y2;
   int color;
-  int size;
+//  int size;
   GList *other_objects = NULL;
-  OBJECT *o_current;
+  OBJECT *o_current, *o_current_pin;
 
   if (w_current->inside_action == 0) {
     o_redraw(w_current, w_current->page_current->object_head);
@@ -279,36 +279,36 @@
   } else {
     color = w_current->override_pin_color;
   }
-
-  /* removed 3/15 to see if we can get pins to be ortho only */
-  /* w_current->last_x = fix_x(w_current, x);
-     w_current->last_y = fix_y(w_current, y);*/
-
-  size = SCREENabs(w_current, PIN_WIDTH);
-  if (w_current->pin_style == THICK ) {
-    gdk_gc_set_line_attributes(w_current->xor_gc, size,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-  }
-
-  gdk_gc_set_foreground(w_current->xor_gc, 
-			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->xor_gc, 
-		w_current->start_x, w_current->start_y, 
-		w_current->last_x, w_current->last_y);
-
-  if (w_current->pin_style == THICK ) {
-    gdk_gc_set_line_attributes(w_current->xor_gc, 0,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-
-    gdk_gc_set_line_attributes(w_current->gc, size,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-  }
+//
+//  /* removed 3/15 to see if we can get pins to be ortho only */
+//  /* w_current->last_x = fix_x(w_current, x);
+//     w_current->last_y = fix_y(w_current, y);*/
+//
+//  size = SCREENabs(w_current, PIN_WIDTH);
+//  if (w_current->pin_style == THICK ) {
+//    gdk_gc_set_line_attributes(w_current->xor_gc, size,
+//                               GDK_LINE_SOLID,
+//                               GDK_CAP_NOT_LAST,
+//                               GDK_JOIN_MITER);
+//  }
+//
+//  gdk_gc_set_foreground(w_current->xor_gc, 
+//			x_get_darkcolor(w_current->select_color) );
+//  gdk_draw_line(w_current->window, w_current->xor_gc, 
+//		w_current->start_x, w_current->start_y, 
+//		w_current->last_x, w_current->last_y);
+//
+//  if (w_current->pin_style == THICK ) {
+//    gdk_gc_set_line_attributes(w_current->xor_gc, 0,
+//                               GDK_LINE_SOLID,
+//                               GDK_CAP_NOT_LAST,
+//                               GDK_JOIN_MITER);
+//
+//    gdk_gc_set_line_attributes(w_current->gc, size,
+//                               GDK_LINE_SOLID,
+//                               GDK_CAP_NOT_LAST,
+//                               GDK_JOIN_MITER);
+//  }
 
   /* don't allow zero length pins */
   if ( (w_current->start_x == w_current->last_x) &&
@@ -318,19 +318,19 @@
          w_current->last_x = (-1);
          w_current->last_y = (-1);
          return;
-       }
-
-  gdk_gc_set_foreground(w_current->gc, x_get_color(color));
-  gdk_draw_line(w_current->window, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
-  gdk_draw_line(w_current->backingstore, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
-
-  if (w_current->pin_style == THICK ) {
-    gdk_gc_set_line_attributes(w_current->gc, 0,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
   }
 
+//  gdk_gc_set_foreground(w_current->gc, x_get_color(color));
+//  gdk_draw_line(w_current->window, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+//  gdk_draw_line(w_current->backingstore, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+//
+//  if (w_current->pin_style == THICK ) {
+//    gdk_gc_set_line_attributes(w_current->gc, 0,
+//                               GDK_LINE_SOLID,
+//                               GDK_CAP_NOT_LAST,
+//                               GDK_JOIN_MITER);
+//  }
+
   SCREENtoWORLD(w_current, w_current->start_x,w_current->start_y, &x1, &y1);
   SCREENtoWORLD(w_current, w_current->last_x, w_current->last_y, &x2, &y2);
   x1 = snap_grid(w_current, x1);
@@ -345,7 +345,9 @@
             x1, y1, x2, y2,
             PIN_TYPE_NET, 0);
 
-  o_current = w_current->page_current->object_tail;
+
+  o_current = o_current_pin = w_current->page_current->object_tail;
+
   if (scm_hook_empty_p(add_pin_hook) == SCM_BOOL_F &&
       o_current != NULL) {
     scm_run_hook(add_pin_hook,
@@ -353,13 +355,14 @@
 			  SCM_EOL));
   }
 
-  other_objects = s_conn_return_others(other_objects,
-                                       w_current->page_current->
-                                       object_tail);
+  other_objects = s_conn_return_others(other_objects, o_current_pin);
+  //                                       w_current->page_current->
+  //                                     object_tail);
   o_cue_undraw_list(w_current, other_objects);
   o_cue_draw_list(w_current, other_objects);
   g_list_free(other_objects);
-  o_cue_draw_single(w_current, w_current->page_current->object_tail);
+  o_cue_draw_single(w_current, o_current_pin); //w_current->page_current->object_tail);
+  o_pin_draw(w_current, o_current_pin);
 
   w_current->start_x = (-1);
   w_current->start_y = (-1);

Reply via email to