www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2013/04/13/12:00:12

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
Date: Sat, 13 Apr 2013 17:58:57 +0200 (CEST)
From: Roland Lutz <rlutz AT hedmen DOT org>
To: geda-user AT delorie DOT com
Subject: [geda-user] Implicit bounding box dependency
Message-ID: <alpine.DEB.2.02.1304131745510.5528@home.local>
User-Agent: Alpine 2.02 (DEB 1266 2009-07-14)
MIME-Version: 1.0
Reply-To: geda-user AT delorie DOT com

In the libgeda API, objects like nets, components etc. are not associated 
to a TOPLEVEL context (e.g. a gschem instance).  So, in theory, the same 
objects could be shared between multiple contexts.

However, the bounding box stored with an object depends on the TOPLEVEL 
context passed to o_*_recalc.  Calling world_get_single_object_bounds with 
another TOPLEVEL object returns the stored bounding box which may not be 
valid for that context.

So there is an implicit dependency which makes sharing objects between 
contexts with different font metrics impossible.

To resolve this, I replaced the boolean flag w_bounds_valid in the OBJECT 
structure with a pointer w_bounds_valid_for to the actual TOPLEVEL context 
for which the bounding box was calculated.  Any function accessing the 
bounding box of an object must use world_get_single_object_bounds which 
checks if this matches the requested TOPLEVEL context, and if not, 
recalculates the bounding box.

The following changes since commit 1814f28ac246582fc5f41dc969f5006fcf87683d:

   gaf: Use g_setenv() instead of setenv(). (2013-02-23 18:51:45 +0000)

are available in the git repository at:

   git AT github DOT com:rlutz/geda-gaf.git bounds-valid-for

for you to fetch changes up to b13b5d3fba493e4512d081b8903831a54b243e36:

   libgeda: Remove recalc functions (2013-04-13 16:36:00 +0200)

----------------------------------------------------------------
Roland Lutz (8):
       libgeda: Use bounding box accessor in o_pin_update_whichend
       Pass TOPLEVEL object to shortest_distance functions
       libgeda: Use bounding box accessor in shortest_distance functions
       gschem: Use bounding box accessor
       gschem: Just invalidate bounds of moved complex object
       Replace flag w_bounds_valid with TOPLEVEL reference
       Don't recalculate bounding box on object updates
       libgeda: Remove recalc functions

  gschem/src/o_find.c                 |   10 +-
  gschem/src/o_misc.c                 |    2 +-
  gschem/src/o_move.c                 |   14 +--
  gschem/src/o_net.c                  |   14 +--
  gschem/src/o_select.c               |   13 ++-
  libgeda/include/libgeda/prototype.h |    4 +-
  libgeda/include/libgeda/struct.h    |    2 +-
  libgeda/include/prototype_priv.h    |   30 ++----
  libgeda/src/a_basic.c               |    2 +-
  libgeda/src/o_arc_basic.c           |   44 ++------
  libgeda/src/o_basic.c               |  102 ++----------------
  libgeda/src/o_box_basic.c           |   46 ++------
  libgeda/src/o_bus_basic.c           |   34 +-----
  libgeda/src/o_circle_basic.c        |   49 ++-------
  libgeda/src/o_complex_basic.c       |  197 +++++++++++++++++++++++------------
  libgeda/src/o_line_basic.c          |   42 ++------
  libgeda/src/o_net_basic.c           |   38 +------
  libgeda/src/o_path_basic.c          |   43 ++------
  libgeda/src/o_picture.c             |   45 ++------
  libgeda/src/o_pin_basic.c           |   37 +------
  libgeda/src/o_text_basic.c          |   45 +++-----
  libgeda/src/s_basic.c               |    2 +-
  libgeda/src/scheme_complex.c        |    4 +-
  libgeda/src/scheme_object.c         |   13 ++-
  24 files changed, 270 insertions(+), 562 deletions(-)

Roland

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019