gEDA-dev: Re: PCB: Graphical bugs

ldoolitt at recycle.lbl.gov ldoolitt at recycle.lbl.gov
Thu Jul 13 22:36:26 EDT 2006


DJ -

On Thu, Jul 13, 2006 at 04:33:57PM -0700, ldoolitt at recycle.lbl.gov wrote:
> 
> The right fix might just be a pair of ordering steps
> in hid/gtk/gtkhid-main.c:ghid_draw_rect().
> 
> Maybe we should then drop the redundant min/max computation in
> src/crosshair.c:DrawAttached()?
> 
> If what you say about "know[ledge] about screen layout" is correct,
> does that mean that the other two uses of Settings.ShowSolderSide
> in src/crosshair.c are bugs?  One in particular looks very suspicious.

Patch appended.  Not only does "It Work For Me", but now it stays
consistent with your HID paradigm.

I didn't touch lesstif, which will presumably glitch more often now
that I took the sort out of crosshair.c.  I don't like patching code
unless I will also test it.  So I'll let you plop
   if (x1 > x2) { int xt = x1; x1 = x2; x2 = xt; }
   if (y1 > y2) { int yt = y1; y1 = y2; y2 = yt; }
right before the XDrawRectangle() call in lesstif_draw_rect(),
if it is in fact needed.

    - Larry


--- pcb-cvs/src/crosshair.c	2006-06-09 20:07:38.000000000 -0700
+++ pcb-lrd/src/crosshair.c	2006-07-13 19:24:19.000000000 -0700
@@ -499,10 +499,6 @@
       {
 	TextTypePtr text = (TextTypePtr) Crosshair.AttachedObject.Ptr2;
 	BoxTypePtr box = &text->BoundingBox;
-	int x0, y0;
-
-	x0 = box->X1;
-	y0 = Settings.ShowSolderSide ? box->Y2 : box->Y1;
 	gui->draw_rect (Crosshair.GC,
 			box->X1 + dx,
 			box->Y1 + dy, box->X2 + dx, box->Y2 + dy);
@@ -665,14 +661,10 @@
     {
       LocationType x1, y1, x2, y2;
 
-      x1 =
-	MIN (Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point2.X);
-      y1 =
-	MIN (Crosshair.AttachedBox.Point1.Y, Crosshair.AttachedBox.Point2.Y);
-      x2 =
-	MAX (Crosshair.AttachedBox.Point1.X, Crosshair.AttachedBox.Point2.X);
-      y2 =
-	MAX (Crosshair.AttachedBox.Point1.Y, Crosshair.AttachedBox.Point2.Y);
+      x1 = Crosshair.AttachedBox.Point1.X;
+      y1 = Crosshair.AttachedBox.Point1.Y;
+      x2 = Crosshair.AttachedBox.Point2.X;
+      y2 = Crosshair.AttachedBox.Point2.Y;
       gui->draw_rect (Crosshair.GC, x1, y1, x2, y2);
     }
 }
--- pcb-cvs/src/hid/gtk/gtkhid-main.c	2006-06-09 20:07:43.000000000 -0700
+++ pcb-lrd/src/hid/gtk/gtkhid-main.c	2006-07-13 19:13:51.000000000 -0700
@@ -683,6 +683,9 @@
   x2 = DRAW_X (x2);
   y2 = DRAW_Y (y2);
 
+  if (x1 > x2) { gint xt = x1; x1 = x2; x2 = xt; }
+  if (y1 > y2) { gint yt = y1; y1 = y2; y2 = yt; }
+
   USE_GC (gc);
   gdk_draw_rectangle (gport->drawable, gport->u_gc, FALSE,
 		      x1, y1, x2 - x1 + 1, y2 - y1 + 1);


More information about the geda-dev mailing list