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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-130-g3ac41f0)



The branch, master has been updated
       via  3ac41f06858892ececf94264b0f6b6cacfd168a5 (commit)
       via  a19feb2bf0e13ad3d030dfbb126a2b0558db6add (commit)
       via  4ad986d333e12980f92325d1a66884bc5b5388fe (commit)
      from  1fa51c0ccf1cf09ba184493e9b9aa7670f0752a3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/src/i_callbacks.c         |    4 +-
 libgeda/include/prototype_priv.h |    3 ++
 libgeda/include/struct.h         |    1 +
 libgeda/src/o_arc_basic.c        |    2 +-
 libgeda/src/o_basic.c            |   16 +++++++++++++
 libgeda/src/o_box_basic.c        |    2 +-
 libgeda/src/o_bus_basic.c        |    3 +-
 libgeda/src/o_circle_basic.c     |    2 +-
 libgeda/src/o_complex_basic.c    |   29 ++++++++++++-----------
 libgeda/src/o_line_basic.c       |    2 +-
 libgeda/src/o_net_basic.c        |    3 +-
 libgeda/src/o_picture.c          |    2 +-
 libgeda/src/o_pin_basic.c        |    2 +-
 libgeda/src/o_text_basic.c       |   46 ++++++++-----------------------------
 libgeda/src/s_basic.c            |    1 +
 15 files changed, 56 insertions(+), 62 deletions(-)


=================
 Commit Messages
=================

commit 3ac41f06858892ececf94264b0f6b6cacfd168a5
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Sat Aug 16 22:28:52 2008 +0100

    libgeda: Add bounds validity flag.
    
    Adds a flag to OBJECT marking whether they are valid (i.e. whether
    they've been updated since the last operation which modified it). Each
    of the per-type recalc functions is updated to set the flag, although
    nothing clears it yet (this will be in a later patch).
    
    When world_get_single_object_bounds() is called, it checks the flag,
    and if not set it calls the appropriate recalc function. If the flag
    is -still- not set, it fails.

:100644 100644 9e1de65... 21975c4... M	libgeda/include/prototype_priv.h
:100644 100644 d8abe96... 822a3c0... M	libgeda/include/struct.h
:100644 100644 fb34f8f... 9eafe18... M	libgeda/src/o_arc_basic.c
:100644 100644 f0d7fa5... 28ddd54... M	libgeda/src/o_basic.c
:100644 100644 b61fa8c... ae9ab95... M	libgeda/src/o_box_basic.c
:100644 100644 3b2cfca... b322d20... M	libgeda/src/o_bus_basic.c
:100644 100644 7a6f31e... e10c3b4... M	libgeda/src/o_circle_basic.c
:100644 100644 bf4bdab... 3456b39... M	libgeda/src/o_complex_basic.c
:100644 100644 c97bf3b... 0b05015... M	libgeda/src/o_line_basic.c
:100644 100644 3cb9038... a59b7de... M	libgeda/src/o_net_basic.c
:100644 100644 4ce683c... 6f889cf... M	libgeda/src/o_picture.c
:100644 100644 65b47ea... 78846ab... M	libgeda/src/o_pin_basic.c
:100644 100644 488e064... 3f25423... M	libgeda/src/o_text_basic.c
:100644 100644 258d0d9... 8ce1fd5... M	libgeda/src/s_basic.c

commit a19feb2bf0e13ad3d030dfbb126a2b0558db6add
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Sat Aug 16 22:28:52 2008 +0100

    Bring back default Postscript filename.
    
    The print dialog has recently stopped providing a default filename for
    the Postscript output, due to a regression introduced in
    a3513b7e6dc7bf6c36d95d4da86082beeb79831d.

:100644 100644 25431f6... f5f5f22... M	gschem/src/i_callbacks.c

commit 4ad986d333e12980f92325d1a66884bc5b5388fe
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Sat Aug 16 22:28:52 2008 +0100

    libgeda: Use g_return_val_if_fail in text accessors.
    
    Almost as good, and improves readability.

:100644 100644 677b5cd... 488e064... M	libgeda/src/o_text_basic.c

=========
 Changes
=========

commit 3ac41f06858892ececf94264b0f6b6cacfd168a5
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Sat Aug 16 22:28:52 2008 +0100

    libgeda: Add bounds validity flag.
    
    Adds a flag to OBJECT marking whether they are valid (i.e. whether
    they've been updated since the last operation which modified it). Each
    of the per-type recalc functions is updated to set the flag, although
    nothing clears it yet (this will be in a later patch).
    
    When world_get_single_object_bounds() is called, it checks the flag,
    and if not set it calls the appropriate recalc function. If the flag
    is -still- not set, it fails.

diff --git a/libgeda/include/prototype_priv.h b/libgeda/include/prototype_priv.h
index 9e1de65..21975c4 100644
--- a/libgeda/include/prototype_priv.h
+++ b/libgeda/include/prototype_priv.h
@@ -74,6 +74,9 @@ OBJECT *o_read_attribs(TOPLEVEL *toplevel,
 		       unsigned int fileformat_ver);
 gchar *o_save_attribs(GList *attribs);
 
+/* o_basic.c */
+void o_bounds_invalidate(TOPLEVEL *toplevel, OBJECT *object);
+
 /* o_box_basic.c */
 OBJECT *o_box_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
 char *o_box_save(OBJECT *object);
diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index d8abe96..822a3c0 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -195,6 +195,7 @@ struct st_object {
   int w_left;				/* in world coords */
   int w_right;
   int w_bottom;
+  gboolean w_bounds_valid;
 
   COMPLEX *complex;
   LINE *line; 
diff --git a/libgeda/src/o_arc_basic.c b/libgeda/src/o_arc_basic.c
index fb34f8f..9eafe18 100644
--- a/libgeda/src/o_arc_basic.c
+++ b/libgeda/src/o_arc_basic.c
@@ -517,7 +517,7 @@ void o_arc_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
   o_current->w_top    = top;
   o_current->w_right  = right;
   o_current->w_bottom = bottom;
-
+  o_current->w_bounds_valid = TRUE;
 }
 
 
diff --git a/libgeda/src/o_basic.c b/libgeda/src/o_basic.c
index f0d7fa5..28ddd54 100644
--- a/libgeda/src/o_basic.c
+++ b/libgeda/src/o_basic.c
@@ -435,3 +435,19 @@ gdouble o_shortest_distance(OBJECT *object, gint x, gint y)
   return shortest_distance;
 }
 
+/*! \brief Mark an OBJECT's cached bounds as invalid
+ *  \par Function Description
+ *  Marks the cached bounds of the given OBJECT 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() ).
+ *
+ *  \param [in] toplevel
+ *  \param [in] obj
+ *
+ *  \todo Turn this into a macro?
+ */
+void o_bounds_invalidate(TOPLEVEL *toplevel, OBJECT *obj)
+{
+  obj->w_bounds_valid = FALSE;
+}
diff --git a/libgeda/src/o_box_basic.c b/libgeda/src/o_box_basic.c
index b61fa8c..ae9ab95 100644
--- a/libgeda/src/o_box_basic.c
+++ b/libgeda/src/o_box_basic.c
@@ -615,7 +615,7 @@ void o_box_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
   o_current->w_top    = top;
   o_current->w_right  = right;
   o_current->w_bottom = bottom;
-  
+  o_current->w_bounds_valid = TRUE;
 }
 
 /*! \brief Get BOX bounding rectangle in WORLD coordinates.
diff --git a/libgeda/src/o_bus_basic.c b/libgeda/src/o_bus_basic.c
index 3b2cfca..b322d20 100644
--- a/libgeda/src/o_bus_basic.c
+++ b/libgeda/src/o_bus_basic.c
@@ -107,8 +107,7 @@ void o_bus_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
   o_current->w_top = top;
   o_current->w_right = right;
   o_current->w_bottom = bottom;
-
-
+  o_current->w_bounds_valid = TRUE;
 }
 
 /* \brief
diff --git a/libgeda/src/o_circle_basic.c b/libgeda/src/o_circle_basic.c
index 7a6f31e..e10c3b4 100644
--- a/libgeda/src/o_circle_basic.c
+++ b/libgeda/src/o_circle_basic.c
@@ -515,7 +515,7 @@ void o_circle_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
   o_current->w_top    = top;
   o_current->w_right  = right;
   o_current->w_bottom = bottom;
-
+  o_current->w_bounds_valid = TRUE;
 }
 
 /*! \brief Get circle bounding rectangle in WORLD coordinates.
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index bf4bdab..3456b39 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -54,6 +54,14 @@ int world_get_single_object_bounds(TOPLEVEL *toplevel, OBJECT *o_current,
 {
   if (o_current != NULL) {
     switch(o_current->type) {
+      case(OBJ_TEXT):
+        /* only do bounding boxes for visible or doing show_hidden_text*/
+        /* you might lose some attrs though */
+        if (! (o_current->visibility == VISIBLE ||
+               toplevel->show_hidden_text )) {
+          return 0;
+        }
+        /* This case falls through intentionally */
       case(OBJ_LINE):
       case(OBJ_NET):
       case(OBJ_BUS):
@@ -64,25 +72,18 @@ int world_get_single_object_bounds(TOPLEVEL *toplevel, OBJECT *o_current,
       case(OBJ_ARC):
       case(OBJ_COMPLEX):
       case(OBJ_PLACEHOLDER):
+        if (!o_current->w_bounds_valid) {
+          o_recalc_single_object (toplevel, o_current);
+          if (!o_current->w_bounds_valid) {
+            return 0;
+          }
+        }
         *rleft = o_current->w_left;
         *rtop = o_current->w_top;
         *rright = o_current->w_right;
         *rbottom = o_current->w_bottom;
         return 1;
 
-      case(OBJ_TEXT):
-        /* only do bounding boxes for visible or doing show_hidden_text*/
-        /* you might lose some attrs though */
-        if ( o_current->visibility == VISIBLE ||
-             toplevel->show_hidden_text ) {
-          *rleft = o_current->w_left;
-          *rtop = o_current->w_top;
-          *rright = o_current->w_right;
-          *rbottom = o_current->w_bottom;
-          return 1;
-        }
-        break;
-
       default:
         break;
     }
@@ -664,7 +665,7 @@ void o_complex_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
   o_current->w_top = top;
   o_current->w_right = right;
   o_current->w_bottom = bottom;
-
+  o_current->w_bounds_valid = TRUE;
 }
 
 /*! \brief
diff --git a/libgeda/src/o_line_basic.c b/libgeda/src/o_line_basic.c
index c97bf3b..0b05015 100644
--- a/libgeda/src/o_line_basic.c
+++ b/libgeda/src/o_line_basic.c
@@ -496,7 +496,7 @@ void o_line_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
   o_current->w_top    = top;
   o_current->w_right  = right;
   o_current->w_bottom = bottom;
-  
+  o_current->w_bounds_valid = TRUE;
 }
 
 /*! \brief Get line bounding rectangle in WORLD coordinates.
diff --git a/libgeda/src/o_net_basic.c b/libgeda/src/o_net_basic.c
index 3cb9038..a59b7de 100644
--- a/libgeda/src/o_net_basic.c
+++ b/libgeda/src/o_net_basic.c
@@ -120,8 +120,7 @@ void o_net_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
   o_current->w_top = top;
   o_current->w_right = right;
   o_current->w_bottom = bottom;
-
-
+  o_current->w_bounds_valid = TRUE;
 }
 
 /*! \todo Finish function documentation!!!
diff --git a/libgeda/src/o_picture.c b/libgeda/src/o_picture.c
index 4ce683c..6f889cf 100644
--- a/libgeda/src/o_picture.c
+++ b/libgeda/src/o_picture.c
@@ -399,7 +399,7 @@ void o_picture_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
   o_current->w_top    = top;
   o_current->w_right  = right;
   o_current->w_bottom = bottom;
-  
+  o_current->w_bounds_valid = TRUE;
 }
 
 /*! \brief Get picture bounding rectangle in WORLD coordinates.
diff --git a/libgeda/src/o_pin_basic.c b/libgeda/src/o_pin_basic.c
index 65b47ea..78846ab 100644
--- a/libgeda/src/o_pin_basic.c
+++ b/libgeda/src/o_pin_basic.c
@@ -101,7 +101,7 @@ void o_pin_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
   o_current->w_top = top;
   o_current->w_right = right;
   o_current->w_bottom = bottom;
-
+  o_current->w_bounds_valid = TRUE;
 }
 
 /*! \todo Finish function documentation!!!
diff --git a/libgeda/src/o_text_basic.c b/libgeda/src/o_text_basic.c
index 488e064..3f25423 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -1016,6 +1016,7 @@ void o_text_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
   o_current->w_top = top;
   o_current->w_right = right;
   o_current->w_bottom = bottom;
+  o_current->w_bounds_valid = TRUE;
 }
 
 /*! \todo Finish function documentation!!!
diff --git a/libgeda/src/s_basic.c b/libgeda/src/s_basic.c
index 258d0d9..8ce1fd5 100644
--- a/libgeda/src/s_basic.c
+++ b/libgeda/src/s_basic.c
@@ -127,6 +127,7 @@ OBJECT *s_basic_init_object(OBJECT *new_node, int type, char const *name)
   new_node->w_left = 0;
   new_node->w_right = 0;
   new_node->w_bottom = 0;
+  new_node->w_bounds_valid = FALSE;
 
   /* Setup line/circle structs */
   new_node->line = NULL;

commit a19feb2bf0e13ad3d030dfbb126a2b0558db6add
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Sat Aug 16 22:28:52 2008 +0100

    Bring back default Postscript filename.
    
    The print dialog has recently stopped providing a default filename for
    the Postscript output, due to a regression introduced in
    a3513b7e6dc7bf6c36d95d4da86082beeb79831d.

diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 25431f6..f5f5f22 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -74,9 +74,9 @@ static char *fnameext_remove(const char *fname)
   char *fname_new = NULL;
 
   if(*p == '\0') {
-    fname_new = g_strdup (p);
+    fname_new = g_strdup (fname);
   } else {
-    fname_new = g_strndup (fname_new, p - fname);
+    fname_new = g_strndup (fname, p - fname);
   }
   return fname_new;
 }

commit 4ad986d333e12980f92325d1a66884bc5b5388fe
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Sat Aug 16 22:28:52 2008 +0100

    libgeda: Use g_return_val_if_fail in text accessors.
    
    Almost as good, and improves readability.

diff --git a/libgeda/src/o_text_basic.c b/libgeda/src/o_text_basic.c
index 677b5cd..488e064 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -1870,26 +1870,11 @@ gdouble o_text_shortest_distance(TEXT *text, gint x, gint y)
 void o_text_set_string (TOPLEVEL *toplevel, OBJECT *obj,
                         const gchar *new_string)
 {
-  if (toplevel == NULL) {
-    g_critical ("o_text_set_string: Received NULL TOPLEVEL structure.");
-    return;
-  }
-  if (obj == NULL) {
-    g_critical ("o_text_set_string: Received NULL OBJECT structure.");
-    return;
-  }
-  if (obj->type != OBJ_TEXT) {
-    g_critical ("o_text_set_string: OBJECT type not OBJ_TEXT.");
-    return;
-  }
-  if (obj->text == NULL) {
-    g_critical ("o_text_set_string: Text object without TEXT structure.");
-    return;
-  }
-  if (new_string == NULL) {
-    g_critical ("o_text_set_string: New string was NULL.");
-    return;
-  }
+  g_return_if_fail (toplevel == NULL);
+  g_return_if_fail (obj == NULL);
+  g_return_if_fail (obj->type != OBJ_TEXT);
+  g_return_if_fail (obj->text == NULL);
+  g_return_if_fail (new_string == NULL);
 
   g_free (obj->text->string);
   obj->text->string = g_strdup (new_string);
@@ -1908,22 +1893,10 @@ void o_text_set_string (TOPLEVEL *toplevel, OBJECT *obj,
  */
 const gchar *o_text_get_string (TOPLEVEL *toplevel, OBJECT *obj)
 {
-  if (toplevel == NULL) {
-    g_critical ("o_text_get_string: Received NULL TOPLEVEL structure.");
-    return NULL;
-  }
-  if (obj == NULL) {
-    g_critical ("o_text_get_string: Received NULL OBJECT structure.");
-    return NULL;
-  }
-  if (obj->type != OBJ_TEXT) {
-    g_critical ("o_text_get_string: OBJECT type not OBJ_TEXT.");
-    return NULL;
-  }
-  if (obj->text == NULL) {
-    g_critical ("o_text_get_string: Text object without TEXT structure.");
-    return NULL;
-  }
+  g_return_val_if_fail (toplevel == NULL, NULL);
+  g_return_val_if_fail (obj == NULL, NULL);
+  g_return_val_if_fail (obj->type != OBJ_TEXT, NULL);
+  g_return_val_if_fail (obj->text == NULL, NULL);
 
   return obj->text->string;
 }




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