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

gEDA-cvs: gaf.git: branch: master updated (1.5.2-20090328-94-gb166d05)



The branch, master has been updated
       via  b166d053e62c01b3b6413e0c6df275a432ba9792 (commit)
      from  edf9fad0a84807199acba250e8ec6461fafd89cf (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/x_dialog.c               |    2 +-
 libgeda/include/libgeda/prototype.h |    4 +-
 libgeda/src/o_attrib.c              |   22 +--------
 libgeda/src/o_basic.c               |   24 ++++++++++
 libgeda/src/o_complex_basic.c       |   86 -----------------------------------
 libgeda/src/o_list.c                |   18 +++++++
 libgeda/src/o_text_basic.c          |    2 +-
 7 files changed, 48 insertions(+), 110 deletions(-)


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

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

    Add new functions o_set_color() and o_glist_set_color()
    
    Replaces the inaccurately named o_complex_set_color() and
    o_complex_set_color_single().
    
    Also replaces o_attrib_set_color(), which was static to
    libgeda/src/o_attrib.c

:100644 100644 54ce953... 0c3fb4c... M	gschem/src/x_dialog.c
:100644 100644 c72abf5... 77d608f... M	libgeda/include/libgeda/prototype.h
:100644 100644 ce563cb... a550126... M	libgeda/src/o_attrib.c
:100644 100644 859b73f... e594750... M	libgeda/src/o_basic.c
:100644 100644 c75310d... 23f9f7b... M	libgeda/src/o_complex_basic.c
:100644 100644 ac91886... b4bc97a... M	libgeda/src/o_list.c
:100644 100644 4439dd4... c5fbeea... M	libgeda/src/o_text_basic.c

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

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

    Add new functions o_set_color() and o_glist_set_color()
    
    Replaces the inaccurately named o_complex_set_color() and
    o_complex_set_color_single().
    
    Also replaces o_attrib_set_color(), which was static to
    libgeda/src/o_attrib.c

diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 54ce953..0c3fb4c 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -2573,7 +2573,7 @@ void color_edit_dialog_apply(GtkWidget *w, GSCHEM_TOPLEVEL *w_current)
       exit(-1);
     }
 
-    o_complex_set_color_single (object, w_current->edit_color);
+    o_set_color (w_current->toplevel, object, w_current->edit_color);
     w_current->toplevel->page_current->CHANGED = 1;
 
     s_current = g_list_next(s_current);
diff --git a/libgeda/include/libgeda/prototype.h b/libgeda/include/libgeda/prototype.h
index c72abf5..77d608f 100644
--- a/libgeda/include/libgeda/prototype.h
+++ b/libgeda/include/libgeda/prototype.h
@@ -125,6 +125,7 @@ void o_translate_world (TOPLEVEL *toplevel, gint dx, gint dy, OBJECT *object);
 void o_rotate_world(TOPLEVEL *toplevel, int world_centerx, int world_centery, int angle, OBJECT *object);
 void o_mirror_world(TOPLEVEL *toplevel, int world_centerx, int world_centery, OBJECT *object);
 double o_shortest_distance(OBJECT *object, int x, int y);
+void o_set_color(TOPLEVEL *toplevel, OBJECT *object, int color);
 
 /* o_box_basic.c */
 OBJECT *o_box_new(TOPLEVEL *toplevel, char type, int color, int x1, int y1, int x2, int y2);
@@ -170,8 +171,6 @@ void o_complex_set_filename(TOPLEVEL *toplevel, const char *basename);
 void o_complex_translate_world(TOPLEVEL *toplevel, int dx, int dy, OBJECT *object);
 OBJECT *o_complex_copy(TOPLEVEL *toplevel, OBJECT *o_current);
 OBJECT *o_complex_copy_embedded(TOPLEVEL *toplevel, OBJECT *o_current);
-void o_complex_set_color(GList *prim_objs, int color);
-void o_complex_set_color_single(OBJECT *o_current, int color);
 void o_complex_rotate_world(TOPLEVEL *toplevel, int world_centerx, int world_centery, int angle, OBJECT *object);
 void o_complex_mirror_world(TOPLEVEL *toplevel, int world_centerx, int world_centery, OBJECT *object);
 OBJECT *o_complex_find_pin_by_attribute(OBJECT *object, char *name, char *wanted_value);
@@ -197,6 +196,7 @@ GList *o_glist_copy_all(TOPLEVEL *toplevel, const GList *src_list, GList *dest_l
 void o_glist_translate_world(TOPLEVEL *toplevel, int dx, int dy, const GList *list);
 void o_glist_rotate_world(TOPLEVEL *toplevel, int x, int y, int angle, const GList *list);
 void o_glist_mirror_world(TOPLEVEL *toplevel, int x, int y, const GList *list);
+void o_glist_set_color(TOPLEVEL *toplevel, const GList *list, int color);
 
 /* o_net_basic.c */
 OBJECT *o_net_new(TOPLEVEL *toplevel, char type, int color, int x1, int y1, int x2, int y2);
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index ce563cb..a550126 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -58,24 +58,6 @@
 #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);
-
-  o_complex_set_color (attrib->text->prim_objs, color);
-  attrib->color = color;
-}
-
-
 /*! \brief Add an attribute to an existing attribute list.
  *  \par Function Description
  *  Add an attribute to an existing attribute list.
@@ -151,7 +133,7 @@ void o_attrib_attach (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object,
   o_attrib_add (toplevel, object, attrib);
 
   if (set_color)
-    o_attrib_set_color (toplevel, attrib, ATTRIBUTE_COLOR);
+    o_set_color (toplevel, attrib, ATTRIBUTE_COLOR);
 
   /* can't do this here since just selecting something */
   /* will cause this to be set */
@@ -195,7 +177,7 @@ void o_attrib_detach_all(TOPLEVEL *toplevel, OBJECT *object)
     a_current = a_iter->data;
 
     a_current->attached_to = NULL;
-    o_attrib_set_color (toplevel, a_current, DETACHED_ATTRIBUTE_COLOR);
+    o_set_color (toplevel, a_current, DETACHED_ATTRIBUTE_COLOR);
   }
 
   g_list_free (object->attribs);
diff --git a/libgeda/src/o_basic.c b/libgeda/src/o_basic.c
index 859b73f..e594750 100644
--- a/libgeda/src/o_basic.c
+++ b/libgeda/src/o_basic.c
@@ -562,3 +562,27 @@ void o_bounds_invalidate(TOPLEVEL *toplevel, OBJECT *obj)
 {
   obj->w_bounds_valid = FALSE;
 }
+
+
+/*! \brief Change the color of an object
+ *
+ *  \par Function Description
+ *  This function changes the color of an object.
+ *
+ *  \param [in] toplevel  The TOPLEVEL structure.
+ *  \param [in] object    The OBJECT to change color.
+ *  \param [in] color     The new color.
+ */
+void o_set_color (TOPLEVEL *toplevel, OBJECT *object, int color)
+{
+  g_return_if_fail (object != NULL);
+
+  object->color = color;
+
+  if (object->type == OBJ_TEXT)
+    o_glist_set_color (toplevel, object->text->prim_objs, color);
+
+  if (object->type == OBJ_COMPLEX ||
+      object->type == OBJ_PLACEHOLDER)
+    o_glist_set_color (toplevel, object->complex->prim_objs, color);
+}
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index c75310d..23f9f7b 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -853,92 +853,6 @@ OBJECT *o_complex_copy_embedded(TOPLEVEL *toplevel, OBJECT *o_current)
   return new_obj;
 }
 
-/*! \brief Change the color of a object list
- *  \par Function Description
- *  This function changes the the color of a object list
- *
- *  \param [in] prim_objs  The head object
- *  \param [in] color      The new color
- *
- *  \note This function is mainly used to change the color of text objects
- */
-void o_complex_set_color (GList *prim_objs, int color)
-{
-  OBJECT *o_current=NULL;
-  GList *iter;
-
-  iter = prim_objs;
-
-  while (iter != NULL) {
-    o_current = (OBJECT *)iter->data;
-    switch(o_current->type) {
-      case(OBJ_LINE):
-      case(OBJ_NET):
-      case(OBJ_BUS):
-      case(OBJ_BOX):
-      case(OBJ_PICTURE):
-      case(OBJ_CIRCLE):
-      case(OBJ_PATH):
-      case(OBJ_PIN):
-      case(OBJ_ARC):
-        o_current->color = color;
-        break;
-
-      case(OBJ_TEXT):
-        o_current->color = color;
-        o_complex_set_color(o_current->text->prim_objs, color);
-        break;
-
-      case(OBJ_COMPLEX):
-      case(OBJ_PLACEHOLDER):
-        o_current->color = color;
-        o_complex_set_color(o_current->complex->prim_objs, color);
-        break;
-
-    }
-    iter = g_list_next (iter);
-  }
-}
-
-/*! \brief Change the color of a complex object
- *  \par Function Description
- *  This function changes the color of a complex object \a o_current.
- *
- *  \param [in] o_current  The OBJECT to change
- *  \param [in] color      The new color
- */
-void o_complex_set_color_single(OBJECT *o_current, int color)
-{
-  g_return_if_fail(o_current != NULL);
-
-  switch(o_current->type) {
-    case(OBJ_LINE):
-    case(OBJ_NET):
-    case(OBJ_BUS):
-    case(OBJ_BOX):
-    case(OBJ_PICTURE):
-    case(OBJ_CIRCLE):
-    case(OBJ_PATH):
-    case(OBJ_PIN):
-    case(OBJ_ARC):
-    o_current->color = color;
-    break;
-
-    case(OBJ_TEXT):
-    o_current->color = color;
-    o_complex_set_color(o_current->text->prim_objs, color);
-    break;
-
-    case(OBJ_COMPLEX):
-    case(OBJ_PLACEHOLDER):
-    o_current->color = color;
-    o_complex_set_color(o_current->complex->prim_objs, 
-                        color);
-    break;
-
-  }
-}
-
 
 /*! \todo Finish function documentation!!!
  *  \brief
diff --git a/libgeda/src/o_list.c b/libgeda/src/o_list.c
index ac91886..b4bc97a 100644
--- a/libgeda/src/o_list.c
+++ b/libgeda/src/o_list.c
@@ -287,3 +287,21 @@ void o_glist_mirror_world (TOPLEVEL *toplevel, int x, int y, const GList *list)
     iter = g_list_next (iter);
   }
 }
+
+
+/*! \brief Change the color of a list of objects
+ *
+ *  \par Function Description
+ *  This function changes the the new color of a list of objects
+ *
+ *  \param [in] toplevel  The TOPLEVEL structure.
+ *  \param [in] list      The list of OBJECTs to change color.
+ *  \param [in] color     The new color.
+ */
+void o_glist_set_color (TOPLEVEL *toplevel, const GList *list, int color)
+{
+  const GList *iter;
+
+  for (iter = list; iter != NULL; iter = g_list_next (iter))
+    o_set_color (toplevel, iter->data, color);
+}
diff --git a/libgeda/src/o_text_basic.c b/libgeda/src/o_text_basic.c
index 4439dd4..c5fbeea 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -798,7 +798,7 @@ GList *o_text_create_string (TOPLEVEL *toplevel, char *string, int size,
                                           o_font_set->font_prim_objs,
                                           NULL, NORMAL_FLAG);
 
-        o_complex_set_color(start_of_char, color);
+        o_glist_set_color (toplevel, start_of_char, color);
         o_scale(toplevel, start_of_char, size/2, size/2);
 
         /* Rotate and translate the character to its world position */




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