[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gEDA: PCB and short segments



When you come off of a package whose pins are not on-grid, there is a small 
jog in the trace as you step back on grid.  If you try to move the line 
including the small segment, the move does the wrong thing.

See the attached image.  The upper line is three segments where the middle 
segment has a small jog.  The middle line shows the rubberbanding during the 
move.  The bottom line shows that the intended move did not happen.

The problem is that the two long segments touch without the small segment that 
is between them.  So the search finds two segments attached to the long 
segment on the right, instead of just the one short segment.

The attached diff to MoveObjectAndRubberband() in move.c does not fix the 
selection process so the rubberbanding still looks wrong, but when you 
release the button the move does the right thing: it moves the long segment 
on the right, it moves the endpoint of the short segment and it leaves the 
long segment on the left alone.

I do not consider diff.txt a patch as much as a workaround.  The real problem 
is in the selection code, but we could not figure out a way to change 
CheckLinePointForRubberbandConnection() or LookupRubberbandLines() in a way 
that would not break other things.

Even this change to move.c has the side effect that if two segments touch 
without sharing an endpoint and without having a small segment between them, 
a move will move one segment and leave the other one behind.

Regards,
Daniel

LinesBugReport.jpg

vien@yankee-linux2:~/CvsLayout> diff -wc pcb-20060422/src/move.c pcb-20060422/src/move.c.change
*** pcb-20060422/src/move.c     2006-06-05 12:14:11.000000000 -0700
--- pcb-20060422/src/move.c.change      2006-06-05 11:32:33.000000000 -0700
***************
*** 781,790 ****
--- 781,829 ----
      {
        /* first clear any marks that we made in the line flags */
        CLEAR_FLAG (RUBBERENDFLAG, ptr->Line);
+
+       LineTypePtr lp = (LineTypePtr)Ptr1;
+
+       switch (Type) {
+       case LINE_TYPE:
+       if ((lp->Point1.X == ptr->Line->Point1.X && lp->Point1.Y == ptr->Line->Point1.Y) ||
+           (lp->Point2.X == ptr->Line->Point1.X && lp->Point2.Y == ptr->Line->Point1.Y)) {
+         AddObjectToMoveUndoList (LINEPOINT_TYPE,
+                              ptr->Layer, ptr->Line, &ptr->Line->Point1, DX,
+                              DY);
+         MoveLinePoint (ptr->Layer, ptr->Line, &ptr->Line->Point1);
+       }
+       if ((lp->Point1.X == ptr->Line->Point2.X && lp->Point1.Y == ptr->Line->Point2.Y) ||
+           (lp->Point2.X == ptr->Line->Point2.X && lp->Point2.Y == ptr->Line->Point2.Y)) {
+         AddObjectToMoveUndoList (LINEPOINT_TYPE,
+                              ptr->Layer, ptr->Line, &ptr->Line->Point2, DX,
+                              DY);
+         MoveLinePoint (ptr->Layer, ptr->Line, &ptr->Line->Point2);
+       }
+       break;
+
+       case LINEPOINT_TYPE:
+       if (lp->Point1.X == ptr->Line->Point1.X && lp->Point1.Y == ptr->Line->Point1.Y) {
+         AddObjectToMoveUndoList (LINEPOINT_TYPE,
+                              ptr->Layer, ptr->Line, &ptr->Line->Point1, DX,
+                              DY);
+         MoveLinePoint (ptr->Layer, ptr->Line, &ptr->Line->Point1);
+       }
+       if (lp->Point1.X == ptr->Line->Point2.X && lp->Point1.Y == ptr->Line->Point2.Y) {
+         AddObjectToMoveUndoList (LINEPOINT_TYPE,
+                              ptr->Layer, ptr->Line, &ptr->Line->Point2, DX,
+                              DY);
+         MoveLinePoint (ptr->Layer, ptr->Line, &ptr->Line->Point2);
+       }
+       break;
+
+       default:
        AddObjectToMoveUndoList (LINEPOINT_TYPE,
                               ptr->Layer, ptr->Line, ptr->MovedPoint, DX,
                               DY);
        MoveLinePoint (ptr->Layer, ptr->Line, ptr->MovedPoint);
+       break;
+       }
        Crosshair.AttachedObject.RubberbandN--;
        ptr++;
      }