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

gEDA-bug: [Bug 700841] Re: gschem: during selection invisible attributes extend component bounding box



This patch is looking good, but still needs a bit of work - review as
follows:

Patch needs to be split into three pieces:

1. Recursion in o_bounds_invalidate()

@@ -559,6 +559,7 @@ double o_shortest_distance_full (OBJECT *object, int x, int y, int force_solid)
  *  invalidated and in need of an update. They will be recalculated
  *  next time the OBJECT's bounds are requested (e.g. via
  *  world_get_single_object_bounds() ).
+ *  Also recursively mark the bounds of the parent objects as invalid.
  *
  *  \param [in] toplevel
  *  \param [in] obj

This comment is misleading, the function does not "Also" does this.. it
is an important part of the function's primary result. Let the comment
read:

 *  Recursively marks the cached bounds of the given OBJECT and its parents
 *  as having been invalidated and in need of an update. They will be recalculated
 *  next time the OBJECT's bounds are requested (e.g. via world_get_single_object_bounds() ).
 
(Fixup line-wrapping as necessary)

@@ -567,7 +568,15 @@ double o_shortest_distance_full (OBJECT *object, int x, int y, int force_solid)
  */
 void o_bounds_invalidate(TOPLEVEL *toplevel, OBJECT *obj)
 {
+  OBJECT *it = NULL;
   obj->w_bounds_valid = FALSE;
+  for (it = obj->parent; it != NULL; it = it->parent) {
+    if (it->w_bounds_valid == FALSE) {
+      break;
+    } else {
+      it->w_bounds_valid = FALSE;
+    }
+  }
 }

More succinctly written:


 void o_bounds_invalidate(TOPLEVEL *toplevel, OBJECT *obj)
 {
  do {
    obj->w_bounds_valid = FALSE;
  } while ((obj = obj->parent) != NULL);
}

I realise there is a slight difference between yours and mine (yours
stops at a parent with already invalid bounds), but the difference
doesn't matter at all here. (Please use mine ;))

-- 
You received this bug notification because you are a member of gEDA Bug
Team, which is subscribed to gEDA.
https://bugs.launchpad.net/bugs/700841

Title:
  gschem: during selection invisible attributes extend component bounding box 

Status in GPL Electronic Design Automation tools:
  New

Bug description:
  Intermittently gschem gets into a state when promotable (visible) attributes within a component extend component's bounding box used for selection calculations.
In such cases component might not be selected even if selection rectangle encloses component's graphics and pins.
It is also possible to select the component by clicking on an empy space far away from it - because in the symbol file a visible attribute is located at that offset.

It is expected that components can be always selected by drawing a selection rectangle that encloses all graphical elements and pins.

When the bug occurs, toggling "show/hide invisible text" restores correct behavior.




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