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

gEDA-cvs: gaf.git: branch: master updated (1.5.2-20090328-11-g963ac33)



The branch, master has been updated
       via  963ac330d97e843f6ec4580b64d9b36c51807783 (commit)
       via  57fc7016a727134bb3a0655db817a980c24838d4 (commit)
       via  bad2b34e1695f4ef74db35dabc7b39ea2ebc71bf (commit)
       via  419a531753294ee9ab039272d2ed147adf2b262e (commit)
       via  39ef03ab5490e7187d251109137ed0c9a1263ecc (commit)
       via  1937476f6a6d68d41ab8e59940c843be7746a207 (commit)
      from  124db2417dbfc6a44c8d1d01213c4c3e7609d93e (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 +-
 gschem/src/o_attrib.c               |   25 ++----
 libgeda/include/libgeda/prototype.h |    5 +-
 libgeda/src/o_attrib.c              |  157 +++++++----------------------------
 libgeda/src/s_basic.c               |    4 +-
 5 files changed, 43 insertions(+), 152 deletions(-)


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

commit 963ac330d97e843f6ec4580b64d9b36c51807783
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Rename o_attrib_free_all() to o_attrib_detach_all()
    
    This name better reflects the function's action.
    
    Add some notes to the doxygen comments about this function. Specifically,
    it must be called with some (OBJECT *)->attribs pointer, since the
    attributes which are detached would otherwise not be removed from the
    (OBJECT *)->attribs GList.

:100644 100644 0d37f22... f35497f... M	gschem/src/i_callbacks.c
:100644 100644 8a34af2... 8dfdcbf... M	libgeda/include/libgeda/prototype.h
:100644 100644 91d9102... 8d9afba... M	libgeda/src/o_attrib.c
:100644 100644 a33bfe8... a53e816... M	libgeda/src/s_basic.c

commit 57fc7016a727134bb3a0655db817a980c24838d4
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    libgeda: Remove the short function o_attrib_free(), inlining its code
    
    The only caller is o_attrib_free_all(), put the code there. Since it
    is no longer part of the public API, the NULL check can be removed.
    
    Also tidy up o_attrib_free_all() somewhat.

:100644 100644 2ca250e... 8a34af2... M	libgeda/include/libgeda/prototype.h
:100644 100644 8c9fa50... 91d9102... M	libgeda/src/o_attrib.c

commit bad2b34e1695f4ef74db35dabc7b39ea2ebc71bf
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    libgeda: Tidy up o_attrib_set_color() and use it to reduce code duplication
    
    Also make the function static, since it isn't used outside of o_attrib.c

:100644 100644 f0cb0b5... 2ca250e... M	libgeda/include/libgeda/prototype.h
:100644 100644 c7dd7b1... 8c9fa50... M	libgeda/src/o_attrib.c

commit 419a531753294ee9ab039272d2ed147adf2b262e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    libgeda: Remove o_attrib_search() function
    
    This function only had one caller, which has been modified.
    
    When attaching an attribute, we check if it is already attached.
    Previously this code used o_attrib_search() to check by object
    SID. Instead, we now just look for the OBJECT* pointer in the
    attribs list using g_list_find.

:100644 100644 ab6711a... f0cb0b5... M	libgeda/include/libgeda/prototype.h
:100644 100644 575c20b... c7dd7b1... M	libgeda/src/o_attrib.c

commit 39ef03ab5490e7187d251109137ed0c9a1263ecc
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Tidy up function o_attrib_add_selected

:100644 100644 6484499... 64f45dd... M	gschem/src/o_attrib.c

commit 1937476f6a6d68d41ab8e59940c843be7746a207
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Remove obsolete comment from o_attrib.c

:100644 100644 20a7da1... 0d37f22... M	gschem/src/i_callbacks.c

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

commit 963ac330d97e843f6ec4580b64d9b36c51807783
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Rename o_attrib_free_all() to o_attrib_detach_all()
    
    This name better reflects the function's action.
    
    Add some notes to the doxygen comments about this function. Specifically,
    it must be called with some (OBJECT *)->attribs pointer, since the
    attributes which are detached would otherwise not be removed from the
    (OBJECT *)->attribs GList.

diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 0d37f22..f35497f 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -3143,8 +3143,7 @@ DEFINE_I_CALLBACK(attributes_detach)
     o_current = (OBJECT *) s_current->data;
     if (o_current) {
       if (o_current->attribs) {
-        o_attrib_free_all(w_current->toplevel,
-                          o_current->attribs);
+        o_attrib_detach_all (w_current->toplevel, o_current->attribs);
         o_current->attribs = NULL;
         w_current->toplevel->page_current->CHANGED=1;
       }
diff --git a/libgeda/include/libgeda/prototype.h b/libgeda/include/libgeda/prototype.h
index 8a34af2..8dfdcbf 100644
--- a/libgeda/include/libgeda/prototype.h
+++ b/libgeda/include/libgeda/prototype.h
@@ -97,7 +97,7 @@ void o_attrib_add(TOPLEVEL *toplevel, OBJECT *object, OBJECT *item);
 gboolean o_attrib_is_attached (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object);
 void o_attrib_attach(TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object, int set_color);
 void o_attrib_attach_list(TOPLEVEL *toplevel, GList *attr_list, OBJECT *object, int set_color);
-void o_attrib_free_all(TOPLEVEL *toplevel, GList *list);
+void o_attrib_detach_all(TOPLEVEL *toplevel, GList *list);
 void o_attrib_print(GList *attributes);
 void o_attrib_remove(GList **list, OBJECT *remove);
 gboolean o_attrib_get_name_value (const gchar *string, gchar **name_ptr, gchar **value_ptr);
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index 91d9102..8d9afba 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -183,15 +183,20 @@ void o_attrib_attach_list (TOPLEVEL *toplevel,
 }
 
 
-/*! \brief Free all attribute items in a list.
+/*! \brief Detach all attribute items in a list.
  *  \par Function Description
- *  Free all attribute items in a list.
+ *  Detach all attribute items in a list.
+ *
+ *  \note The passed GList is freed by this function
+ *        The attributes being detached are _not_ removed
+ *        from any other GList, so it only makes sense to
+ *        call this function with some (OBJECT *)->attribs.
  *
  *  \param [in]     toplevel  The TOPLEVEL object.
  *  \param [in,out] list       The list to free.
  *
  */
-void o_attrib_free_all(TOPLEVEL *toplevel, GList *list)
+void o_attrib_detach_all(TOPLEVEL *toplevel, GList *list)
 {
   OBJECT *a_current;
   GList *a_iter;
diff --git a/libgeda/src/s_basic.c b/libgeda/src/s_basic.c
index a33bfe8..a53e816 100644
--- a/libgeda/src/s_basic.c
+++ b/libgeda/src/s_basic.c
@@ -312,9 +312,7 @@ s_delete_object(TOPLEVEL *toplevel, OBJECT *o_current)
       o_current->complex = NULL;
     }
 
-    if (o_current->attribs) {
-      o_attrib_free_all(toplevel, o_current->attribs);
-    }
+    o_attrib_detach_all (toplevel, o_current->attribs);
     o_current->attribs = NULL;
 
     g_free(o_current);	/* assuming it is not null */

commit 57fc7016a727134bb3a0655db817a980c24838d4
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    libgeda: Remove the short function o_attrib_free(), inlining its code
    
    The only caller is o_attrib_free_all(), put the code there. Since it
    is no longer part of the public API, the NULL check can be removed.
    
    Also tidy up o_attrib_free_all() somewhat.

diff --git a/libgeda/include/libgeda/prototype.h b/libgeda/include/libgeda/prototype.h
index 2ca250e..8a34af2 100644
--- a/libgeda/include/libgeda/prototype.h
+++ b/libgeda/include/libgeda/prototype.h
@@ -94,7 +94,6 @@ void o_arc_mirror_world(TOPLEVEL *toplevel, int world_centerx, int world_centery
 
 /* o_attrib.c */
 void o_attrib_add(TOPLEVEL *toplevel, OBJECT *object, OBJECT *item);
-void o_attrib_free(TOPLEVEL *toplevel, OBJECT *current);
 gboolean o_attrib_is_attached (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object);
 void o_attrib_attach(TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object, int set_color);
 void o_attrib_attach_list(TOPLEVEL *toplevel, GList *attr_list, OBJECT *object, int set_color);
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index 8c9fa50..91d9102 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -97,26 +97,6 @@ void o_attrib_add(TOPLEVEL *toplevel, OBJECT *object, OBJECT *item)
   object->attribs = g_list_append (object->attribs, item);
 }
 
-/*! \brief Free single item in attribute list.
- *  \par Function Description
- *  Free single item in attribute list.
- *
- *  \param [in] toplevel  The TOPLEVEL object.
- *  \param [in] current   OBJECT pointer to remove attribute-ness from.
- *
- *  \note
- *  this routine is only called from free_all
- */
-void o_attrib_free(TOPLEVEL *toplevel, OBJECT *current)
-{
-  if (current == NULL)
-    return;
-
-  /* \todo this makes me nervous... very nervous */
-  current->attached_to=NULL;
-  o_attrib_set_color (toplevel, current, DETACHED_ATTRIBUTE_COLOR);
-}
-
 
 /*! \brief Check whether a attrib is attached to another object
  *  \par Function Description
@@ -216,12 +196,12 @@ void o_attrib_free_all(TOPLEVEL *toplevel, GList *list)
   OBJECT *a_current;
   GList *a_iter;
 
-  a_iter = list;
-
-  while (a_iter != NULL) {
+  for (a_iter = list; a_iter != NULL;
+       a_iter = g_list_next (a_iter)) {
     a_current = a_iter->data;
-    o_attrib_free(toplevel, a_current);
-    a_iter = g_list_next (a_iter);
+
+    a_current->attached_to = NULL;
+    o_attrib_set_color (toplevel, a_current, DETACHED_ATTRIBUTE_COLOR);
   }
   g_list_free (list);
 }

commit bad2b34e1695f4ef74db35dabc7b39ea2ebc71bf
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    libgeda: Tidy up o_attrib_set_color() and use it to reduce code duplication
    
    Also make the function static, since it isn't used outside of o_attrib.c

diff --git a/libgeda/include/libgeda/prototype.h b/libgeda/include/libgeda/prototype.h
index f0cb0b5..2ca250e 100644
--- a/libgeda/include/libgeda/prototype.h
+++ b/libgeda/include/libgeda/prototype.h
@@ -102,7 +102,6 @@ void o_attrib_free_all(TOPLEVEL *toplevel, GList *list);
 void o_attrib_print(GList *attributes);
 void o_attrib_remove(GList **list, OBJECT *remove);
 gboolean o_attrib_get_name_value (const gchar *string, gchar **name_ptr, gchar **value_ptr);
-void o_attrib_set_color(TOPLEVEL *toplevel, GList *attributes);
 char *o_attrib_search_name(const GList *list, char *name, int counter);
 OBJECT *o_attrib_search_string_list(GList *list, char *string);
 char *o_attrib_search_string_partial(OBJECT *object, char *search_for, int counter);
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index c7dd7b1..8c9fa50 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -58,6 +58,29 @@
 #define DELIMITERS ",; "
 
 
+/*! \brief Set attribute color
+ *  \par Function Description
+ *  This function sets an attribute object to the given color.
+ *
+ *  \param [in]     toplevel  The TOPLEVEL object.
+ *  \param [in,out] attrib    The attribute OBJECT to set the colors of.
+ *  \param [in]     color     The color to set.
+ *
+ */
+static void o_attrib_set_color(TOPLEVEL *toplevel, OBJECT *attrib, int color)
+{
+  g_return_if_fail (attrib->type == OBJ_TEXT);
+
+  if (attrib->saved_color == -1) {
+    o_complex_set_color (attrib->text->prim_objs, color);
+    attrib->color = color;
+  } else {
+    o_complex_set_saved_color_only (attrib->text->prim_objs, color);
+    attrib->saved_color = color;
+  }
+}
+
+
 /*! \brief Add an attribute to an existing attribute list.
  *  \par Function Description
  *  Add an attribute to an existing attribute list.
@@ -91,25 +114,7 @@ void o_attrib_free(TOPLEVEL *toplevel, OBJECT *current)
 
   /* \todo this makes me nervous... very nervous */
   current->attached_to=NULL;
-  current->color = DETACHED_ATTRIBUTE_COLOR;
-
-  if (current->type == OBJ_TEXT) {
-    o_complex_set_color(current->text->prim_objs,
-                        current->color);
-  } else {
-    printf("Tried to set the color on a complex!\nlibgeda/src/o_attrib_free 1\n");
-  }
-
-  /* \todo not sure on this */
-  if (current->saved_color != -1) {
-    if (current->type == OBJ_TEXT) {
-      o_complex_set_saved_color_only (current->text->prim_objs,
-                                      DETACHED_ATTRIBUTE_COLOR);
-    } else {
-      printf("Tried to set the color on a complex!\nlibgeda/src/o_attrib_free 2\n");
-    }
-    current->saved_color = DETACHED_ATTRIBUTE_COLOR;
-  }
+  o_attrib_set_color (toplevel, current, DETACHED_ATTRIBUTE_COLOR);
 }
 
 
@@ -170,15 +175,8 @@ void o_attrib_attach (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object,
 
   o_attrib_add (toplevel, object, attrib);
 
-  if (set_color) {
-    if (attrib->saved_color == -1) {
-      attrib->color = ATTRIBUTE_COLOR;
-      o_complex_set_color (attrib->text->prim_objs, attrib->color);
-    } else {
-      attrib->saved_color = ATTRIBUTE_COLOR;
-      o_complex_set_saved_color_only (attrib->text->prim_objs, attrib->saved_color);
-    }
-  }
+  if (set_color)
+    o_attrib_set_color (toplevel, attrib, ATTRIBUTE_COLOR);
 
   /* can't do this here since just selecting something */
   /* will cause this to be set */
@@ -440,52 +438,6 @@ o_attrib_get_name_value (const gchar *string, gchar **name_ptr, gchar **value_pt
 }
 
 
-/*! \brief Set attribute color
- *  \par Function Description
- *  This function sets all attribute objects to the right
- *  color (attribute_color).
- *
- *  \param [in]     toplevel   The TOPLEVEL object.
- *  \param [in,out] attributes  OBJECT list to set colors on.
- *
- */
-void o_attrib_set_color(TOPLEVEL *toplevel, GList *attributes)
-{
-  OBJECT *a_current;
-  GList *a_iter;
-
-  a_iter = attributes;
-
-  while (a_iter != NULL) {
-    a_current = a_iter->data;
-
-    if (a_current->type == OBJ_TEXT &&
-        a_current->text->prim_objs) {
-
-      /* I'm not terribly happy with this */
-
-      if (a_current->saved_color != -1) {
-
-        /* if the object is selected, make */
-        /* sure it it say selected */
-        o_complex_set_color(a_current->text->prim_objs, SELECT_COLOR);
-        a_current->color = SELECT_COLOR;
-
-        o_complex_set_saved_color_only (a_current->text->prim_objs,
-                                        ATTRIBUTE_COLOR);
-        a_current->saved_color = ATTRIBUTE_COLOR;
-
-      } else {
-        o_complex_set_color (a_current->text->prim_objs,
-                             ATTRIBUTE_COLOR);
-        a_current->color = ATTRIBUTE_COLOR;
-      }
-    }
-
-    a_iter = g_list_next (a_iter);
-  }
-}
-
 /*! \brief Search for attibute by name.
  *  \par Function Description
  *  Search for attribute by name.

commit 419a531753294ee9ab039272d2ed147adf2b262e
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    libgeda: Remove o_attrib_search() function
    
    This function only had one caller, which has been modified.
    
    When attaching an attribute, we check if it is already attached.
    Previously this code used o_attrib_search() to check by object
    SID. Instead, we now just look for the OBJECT* pointer in the
    attribs list using g_list_find.

diff --git a/libgeda/include/libgeda/prototype.h b/libgeda/include/libgeda/prototype.h
index ab6711a..f0cb0b5 100644
--- a/libgeda/include/libgeda/prototype.h
+++ b/libgeda/include/libgeda/prototype.h
@@ -93,7 +93,6 @@ void o_arc_rotate_world(TOPLEVEL *toplevel, int world_centerx, int world_centery
 void o_arc_mirror_world(TOPLEVEL *toplevel, int world_centerx, int world_centery, OBJECT *object);
 
 /* o_attrib.c */
-OBJECT *o_attrib_search(GList *list, OBJECT *item);
 void o_attrib_add(TOPLEVEL *toplevel, OBJECT *object, OBJECT *item);
 void o_attrib_free(TOPLEVEL *toplevel, OBJECT *current);
 gboolean o_attrib_is_attached (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object);
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index 575c20b..c7dd7b1 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -57,36 +57,6 @@
 /*! Basic string splitting delimiters */
 #define DELIMITERS ",; "
 
-/*! \brief Search for an item in an attribute list.
- *  \par Function Description
- *  Search for an item in an attribute list.
- *
- *  \param [in] list  list to be searched.
- *  \param [in] item  item to be found.
- *  \return the object item if it is found, NULL otherwise
- */
-OBJECT *o_attrib_search(GList *list, OBJECT *item)
-{
-  GList *a_iter;
-  OBJECT *a_current;
-
-  if (item == NULL) {
-    return(NULL);
-  }
-
-  a_iter = list;
-
-  while(a_iter != NULL) {
-    a_current = a_iter->data;
-    if (item->sid == a_current->sid) {
-      return(a_current);
-    }
-
-    a_iter = g_list_next (a_iter);
-  }
-
-  return(NULL);
-}
 
 /*! \brief Add an attribute to an existing attribute list.
  *  \par Function Description
@@ -182,7 +152,7 @@ void o_attrib_attach (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object,
   g_return_if_fail (object != NULL);
 
   /* is the object already part of the list ? */
-  if (o_attrib_search (object->attribs, attrib)) {
+  if (g_list_find (object->attribs, attrib)) {
     g_warning ("Attribute [%s] already attached\n", attrib->text->string);
     return;
   }

commit 39ef03ab5490e7187d251109137ed0c9a1263ecc
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Tidy up function o_attrib_add_selected

diff --git a/gschem/src/o_attrib.c b/gschem/src/o_attrib.c
index 6484499..64f45dd 100644
--- a/gschem/src/o_attrib.c
+++ b/gschem/src/o_attrib.c
@@ -57,25 +57,16 @@ void o_attrib_add_selected(GSCHEM_TOPLEVEL *w_current, SELECTION *selection,
 
   g_assert( selection != NULL );
 
-  /* deal with attributes here? */
-  if (selected->attribs != NULL) {
-    /* first node is head */
-    a_iter = selected->attribs;
-
-    while (a_iter != NULL) {
-      a_current = a_iter->data;
-
-      /* make sure object isn't selected already */
-      if (a_current->saved_color == -1) {
-        o_selection_add(selection, a_current);
-        o_invalidate (w_current, a_current);
-      }
-
-      a_iter = g_list_next (a_iter);
+  for (a_iter = selected->attribs; a_iter != NULL;
+       a_iter = g_list_next (a_iter)) {
+    a_current = a_iter->data;
+
+    /* make sure object isn't selected already */
+    if (a_current->saved_color == -1) {
+      o_selection_add(selection, a_current);
+      o_invalidate (w_current, a_current);
     }
   }
-
-  return;
 }
 
 /*! \brief Change visibility status of attribute object.

commit 1937476f6a6d68d41ab8e59940c843be7746a207
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Remove obsolete comment from o_attrib.c

diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 20a7da1..0d37f22 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -3138,7 +3138,6 @@ DEFINE_I_CALLBACK(attributes_detach)
   i_update_middle_button(w_current, i_callback_attributes_detach,
                          _("Detach"));
 
-  /* skip over head */
   s_current = geda_list_get_glist( w_current->toplevel->page_current->selection_list );
   while (s_current != NULL) {
     o_current = (OBJECT *) s_current->data;




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