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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-154-g4c335d8)



The branch, master has been updated
       via  4c335d84aed6c972899de27c7d9d4249aec6761d (commit)
       via  a767fbe5a20ef936f98dc91deeb8349e37bb5b94 (commit)
       via  50396f1fecc6f26fc9b8b62fd8e8abef88e4fdee (commit)
      from  c95bd0a1f21be899510e07af28d0190fc09dc469 (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
=========

 libgeda/include/prototype.h   |    2 +-
 libgeda/src/i_vars.c          |    2 +-
 libgeda/src/o_complex_basic.c |   70 +++++++---------------------------------
 libgeda/src/o_list.c          |   26 +++++++++++++++
 4 files changed, 41 insertions(+), 59 deletions(-)


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

commit 4c335d84aed6c972899de27c7d9d4249aec6761d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 22:27:29 2008 +0100

    libgeda: Tidy implementation of o_complex_is_eligible_attribute()
    
    Don't pass promote_invisible as an argument, it can be retrieved from
    the TOPLEVEL * passed instead. Since we have one caller, remove the
    public prototype and make the function static in o_complex_basic.c

:100644 100644 9b8e181... 160d3e1... M	libgeda/include/prototype.h
:100644 100644 8b6ff99... fb62c76... M	libgeda/src/o_complex_basic.c

commit a767fbe5a20ef936f98dc91deeb8349e37bb5b94
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 22:27:29 2008 +0100

    libgeda: Add convenience function o_glist_relink_objects()
    
    This function is used to walk a GList of OBJECTs and ensure that their
    next / prev pointers chain up to the same objects as in the GList.
    
    Make use of this function to make o_complex_add() more readable.

:100644 100644 32799ce... 9b8e181... M	libgeda/include/prototype.h
:100644 100644 5c4ee03... 8b6ff99... M	libgeda/src/o_complex_basic.c
:100644 100644 5a1fb36... 343b535... M	libgeda/src/o_list.c

commit 50396f1fecc6f26fc9b8b62fd8e8abef88e4fdee
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 22:27:29 2008 +0100

    libgeda: Change "C" attribute promotion defaults to match shipped config

:100644 100644 5a15aaa... 2a4274c... M	libgeda/src/i_vars.c

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

commit 4c335d84aed6c972899de27c7d9d4249aec6761d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 22:27:29 2008 +0100

    libgeda: Tidy implementation of o_complex_is_eligible_attribute()
    
    Don't pass promote_invisible as an argument, it can be retrieved from
    the TOPLEVEL * passed instead. Since we have one caller, remove the
    public prototype and make the function static in o_complex_basic.c

diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 9b8e181..160d3e1 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -178,7 +178,6 @@ int world_get_object_glist_bounds(TOPLEVEL *toplevel, GList *o_list,
 			     int *left, int *top, 
 			     int *right, int *bottom);
 OBJECT *add_head(void);
-int o_complex_is_eligible_attribute(TOPLEVEL *toplevel, OBJECT *object, int promote_invisible);
 int o_complex_is_embedded(OBJECT *o_current);
 OBJECT *o_complex_add(TOPLEVEL *toplevel, OBJECT *object_list,
 		      GList **object_glist, char type, int color, 
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index 8b6ff99..fb62c76 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -227,10 +227,7 @@ OBJECT *add_head()
  *  \par Function Description
  *
  */
-/* The promote_invisible flag is either TRUE or FALSE */
-/* It controls if invisible text is promoted (TRUE) or not (FALSE) */
-int o_complex_is_eligible_attribute (TOPLEVEL *toplevel, OBJECT *object,
-				     int promote_invisible) 
+static int o_complex_is_eligible_attribute (TOPLEVEL *toplevel, OBJECT *object)
 {
   char *name = NULL;
   char *padded_name = NULL;
@@ -239,48 +236,37 @@ int o_complex_is_eligible_attribute (TOPLEVEL *toplevel, OBJECT *object,
   g_return_val_if_fail(object != NULL, FALSE);
 
   if (object->type != OBJ_TEXT || object->attribute || object->attached_to)
-  {
     return FALSE; /* not a text item or is already attached */
-  }
 
   /* Make sure text item is an attribute */
   if (!o_attrib_get_name_value (object->text->string, NULL, NULL))
-  {
     return FALSE;  /* not an attribute */
-  }
 
   /* always promote symversion= attribute, even if it is invisible */
   if (strncmp(object->text->string, "symversion=", 11) == 0)
-  {
     return TRUE;
-  }
 
   /* check list against attributes which can be promoted */
   if (toplevel->always_promote_attributes &&
-      (strlen(toplevel->always_promote_attributes) != 0))
-  {
-    if (o_attrib_get_name_value(object->text->string, &name, NULL))
-    {
+      (strlen(toplevel->always_promote_attributes) != 0)) {
+
+    if (o_attrib_get_name_value(object->text->string, &name, NULL)) {
       padded_name = g_strdup_printf(" %s ", name);
-      if (strstr(toplevel->always_promote_attributes, padded_name))
-      {
-	/* Yes the name of the attribute was in the always promote */
-        /* attributes list */
+      if (strstr(toplevel->always_promote_attributes, padded_name)) {
+        /* Name of the attribute was in the always promote attributes list */
         promotableAttribute = TRUE;
       }
-      
+
       g_free(padded_name);
       g_free(name);
       if (promotableAttribute)
-	return TRUE;
+        return TRUE;
     }
   }
 
   /* object is invisible and we do not want to promote invisible text */
-  if (object->visibility == INVISIBLE && promote_invisible == FALSE)
-  {
+  if (object->visibility == INVISIBLE && toplevel->promote_invisible == FALSE)
     return FALSE; /* attribute not eligible for promotion */
-  }
 
   /* yup, attribute can be promoted */
   return TRUE;
@@ -479,9 +465,7 @@ OBJECT *o_complex_add(TOPLEVEL *toplevel, OBJECT *object_list,
       next=tmp->next;
 
       /* valid floating attrib? */
-      if (o_complex_is_eligible_attribute(toplevel, tmp,
-                                          toplevel->promote_invisible))
-      {
+      if (o_complex_is_eligible_attribute(toplevel, tmp)) {
         /* Is attribute promotion called for? (passed in parameter) */
         if (attribute_promotion)
         {

commit a767fbe5a20ef936f98dc91deeb8349e37bb5b94
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 22:27:29 2008 +0100

    libgeda: Add convenience function o_glist_relink_objects()
    
    This function is used to walk a GList of OBJECTs and ensure that their
    next / prev pointers chain up to the same objects as in the GList.
    
    Make use of this function to make o_complex_add() more readable.

diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 32799ce..9b8e181 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -222,6 +222,7 @@ double o_line_length(OBJECT *object);
 OBJECT *o_list_copy_to(TOPLEVEL *toplevel, OBJECT *list_head, OBJECT *selected, int flag, OBJECT **return_end);
 OBJECT *o_list_copy_all(TOPLEVEL *toplevel, OBJECT *src_list_head, OBJECT *dest_list_head, int flag);
 GList *o_glist_copy_all_to_glist(TOPLEVEL *toplevel, GList *src_list, GList *dest_list, int flag);
+void o_glist_relink_objects (GList *o_glist);
 OBJECT *o_list_search(OBJECT *list, OBJECT *current);
 void o_list_delete(TOPLEVEL *toplevel, OBJECT *list, OBJECT *delete);
 void o_list_delete_rest(TOPLEVEL *toplevel, OBJECT *list);
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index 5c4ee03..8b6ff99 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -324,7 +324,6 @@ OBJECT *o_complex_add(TOPLEVEL *toplevel, OBJECT *object_list,
   int save_adding_sel = 0;
   int loaded_normally = FALSE;
   gboolean use_object_list;
-  GList *glist_ptr;
 
   gchar *buffer;
 
@@ -501,22 +500,8 @@ OBJECT *o_complex_add(TOPLEVEL *toplevel, OBJECT *object_list,
 	  else {
 	    if (object_glist) {
 	      *object_glist = g_list_append (*object_glist, tmp);
-	      
-	      glist_ptr = *object_glist;
-	      while (glist_ptr) {
-		if (g_list_previous(glist_ptr) == NULL) {
-		  ((OBJECT *) glist_ptr->data)->prev = NULL;
-		} else {
-		  ((OBJECT *) glist_ptr->data)->prev = g_list_previous (glist_ptr)->data;
-		}
-		if (g_list_next(glist_ptr) == NULL) {
-		  ((OBJECT *) glist_ptr->data)->next = NULL;
-		} else {
-		  ((OBJECT *) glist_ptr->data)->next = g_list_next (glist_ptr)->data;
-		}
-		glist_ptr = g_list_next (glist_ptr);
-	      }
-	      
+              o_glist_relink_objects (*object_glist);
+
 	      o_attrib_attach (toplevel, ((OBJECT *) g_list_last(*object_glist)->data),
 			       tmp, new_node);
 	    } else {
@@ -548,21 +533,8 @@ OBJECT *o_complex_add(TOPLEVEL *toplevel, OBJECT *object_list,
     new_node->complex->prim_objs = prim_objs;
     if (object_glist) {
       *object_glist = g_list_append (*object_glist, new_node);
+      o_glist_relink_objects (*object_glist);
 
-      glist_ptr = *object_glist;
-      while (glist_ptr) {
-	if (g_list_previous (glist_ptr) == NULL) {
-	  ((OBJECT *) glist_ptr->data)->prev = NULL;
-	} else {
-	  ((OBJECT *) glist_ptr->data)->prev = g_list_previous(glist_ptr)->data;
-	}
-	if (g_list_next (glist_ptr) == NULL) {
-	  ((OBJECT *) glist_ptr->data)->next = NULL;
-	} else {
-	  ((OBJECT *) glist_ptr->data)->next = g_list_next(glist_ptr)->data;
-	}
-	glist_ptr = g_list_next(glist_ptr);
-      }
       object_list = (OBJECT *) (g_list_last(*object_glist)->data);
     } else {
       object_list = new_node;
diff --git a/libgeda/src/o_list.c b/libgeda/src/o_list.c
index 5a1fb36..343b535 100644
--- a/libgeda/src/o_list.c
+++ b/libgeda/src/o_list.c
@@ -337,6 +337,32 @@ GList *o_glist_copy_all_to_glist(TOPLEVEL *toplevel,
   return(dest);
 }
 
+
+/*! \brief Relink OBJECT next and prev pointers to match the passed GList
+ *
+ * \par Function Description
+ * Updates the OBJECT next and prev pointers for OBJECTs in the passed
+ * GList of objects to link in the same order as the passed GList.
+ *
+ * \param [in] o_glist   The GList of OBJECTs.
+ */
+void o_glist_relink_objects (GList *o_glist)
+{
+  GList *iter, *tmp;
+  OBJECT *object;
+
+  for (iter = o_glist; iter != NULL; iter = g_list_next (iter)) {
+    object = iter->data;
+
+    tmp = g_list_previous (iter);
+    object->prev = (tmp == NULL) ? NULL : tmp->data;
+
+    tmp = g_list_next (iter);
+    object->next = (tmp == NULL) ? NULL : tmp->data;
+  }
+}
+
+
 /*! \todo Finish function description!!!
  *  \brief
  *  \par Function Description

commit 50396f1fecc6f26fc9b8b62fd8e8abef88e4fdee
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Aug 24 22:27:29 2008 +0100

    libgeda: Change "C" attribute promotion defaults to match shipped config

diff --git a/libgeda/src/i_vars.c b/libgeda/src/i_vars.c
index 5a15aaa..2a4274c 100644
--- a/libgeda/src/i_vars.c
+++ b/libgeda/src/i_vars.c
@@ -57,7 +57,7 @@ char *default_always_promote_attributes = NULL;
 
 int   default_attribute_promotion = TRUE;
 int   default_promote_invisible = FALSE;
-int   default_keep_invisible = FALSE;
+int   default_keep_invisible = TRUE;
 
 /*! \brief Initialize variables in TOPLEVEL object
  *  \par Function Description




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