[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-156-g24ca3cf)
The branch, master has been updated
via 24ca3cf1c066ae4b21d4834ae0d0210fb7a78f91 (commit)
from e9a15f504113e61933fc8ffadc4941b976dabfbb (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/o_attrib.c | 88 +++++++++++++++++-------------------------
2 files changed, 37 insertions(+), 53 deletions(-)
=================
Commit Messages
=================
commit 24ca3cf1c066ae4b21d4834ae0d0210fb7a78f91
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Mon Aug 25 02:02:30 2008 +0100
libgeda: Tidy implementation of o_attrib_attach()
Various cleanup and restructuring of the code. Should be identical
in functionality, but with an extra g_critical warning instead of
a silent return in the case attrib is not found in parent_list.
Changed printf to the console for g_warning or g_critical messages.
Some of these cases where we can't attach an attribute probably ought
to be caught in gschem, in which case we could make these warnings a
higher severity, such as g_critical.
:100644 100644 160d3e1... 14c037f... M libgeda/include/prototype.h
:100644 100644 c9aec34... 9fdb669... M libgeda/src/o_attrib.c
=========
Changes
=========
commit 24ca3cf1c066ae4b21d4834ae0d0210fb7a78f91
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Mon Aug 25 02:02:30 2008 +0100
libgeda: Tidy implementation of o_attrib_attach()
Various cleanup and restructuring of the code. Should be identical
in functionality, but with an extra g_critical warning instead of
a silent return in the case attrib is not found in parent_list.
Changed printf to the console for g_warning or g_critical messages.
Some of these cases where we can't attach an attribute probably ought
to be caught in gschem, in which case we could make these warnings a
higher severity, such as g_critical.
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 160d3e1..14c037f 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -100,7 +100,7 @@ void o_arc_mirror_world(TOPLEVEL *toplevel, int world_centerx, int world_centery
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);
-void o_attrib_attach(TOPLEVEL *toplevel, OBJECT *parent_list, OBJECT *text_object, OBJECT *object);
+void o_attrib_attach(TOPLEVEL *toplevel, OBJECT *parent_list, OBJECT *attrib, OBJECT *object);
void o_attrib_free_all(TOPLEVEL *toplevel, GList *list);
void o_attrib_print(GList *attributes);
void o_attrib_remove(GList **list, OBJECT *remove);
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index c9aec34..9fdb669 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -154,9 +154,9 @@ void o_attrib_free(TOPLEVEL *toplevel, OBJECT *current)
* \par Function Description
* Attach existing attribute to an object.
*
- * \param [in] toplevel The TOPLEVEL object.
+ * \param [in] toplevel The TOPLEVEL object.
* \param [in] parent_list List where actual attribute objects live.
- * \param [in] text_object The attribute to be added.
+ * \param [in] attrib The attribute to be added.
* \param [out] object The object where you want to add item as an attribute.
*
* \par IMPORTANT:
@@ -165,69 +165,53 @@ void o_attrib_free(TOPLEVEL *toplevel, OBJECT *current)
* \note
* typically parent_list is object_parent (object_head), but it is
* overridden in o_complex_add so that it points to head node of the complex
- *
*/
-void o_attrib_attach(TOPLEVEL *toplevel, OBJECT *parent_list,
- OBJECT *text_object, OBJECT *object)
+void o_attrib_attach (TOPLEVEL *toplevel, OBJECT *parent_list,
+ OBJECT *attrib, OBJECT *object)
{
- OBJECT *o_current = NULL;
-
- OBJECT *found = NULL;
- OBJECT *found2 = NULL; /* object in main list */
+ OBJECT *found = NULL; /* object in main list */
- o_current = text_object;
+ g_return_if_fail (attrib != NULL);
+ g_return_if_fail (object != NULL);
- if (object == NULL) {
- printf("ah.. object was not found in the parent list!\n");
+ /* is the object already part of the list ? */
+ if (o_attrib_search (object->attribs, attrib)) {
+ g_warning ("Attribute [%s] already attached\n", attrib->text->string);
return;
}
- /* is the object already part of the list ? */
- found = o_attrib_search(object->attribs, o_current);
- if (!found) { /* no it's not, add it to the list */
-
- found2 = (OBJECT *) o_list_search(parent_list, o_current);
+ found = (OBJECT *) o_list_search(parent_list, attrib);
- /* check to see if found2 is not null hack */
- if (found2) {
- if (found2->type == OBJ_TEXT) {
+ /* check to see if found is not null hack */
+ if (!found) {
+ g_critical ("o_attrib_attach(): attrib was not found in parent_list\n");
+ return;
+ }
- if (found2->attached_to) {
- fprintf(stderr, "You cannot attach this attribute [%s] to more than one object\n", found2->text->string);
- } else {
+ if (found->type != OBJ_TEXT) {
+ g_warning (_("Attempt to attach non text item as an attribute!\n"));
+ return;
+ }
+
+ if (found->attached_to != NULL) {
+ g_warning (_("Attempt to attach attribute [%s] to more than one object\n"),
+ found->text->string);
+ return;
+ }
- o_attrib_add(toplevel,
- object,
- found2);
+ o_attrib_add (toplevel, object, found);
- o_current->color = toplevel->
- attribute_color;
+ attrib->color = toplevel->attribute_color;
+ o_complex_set_color(attrib->text->prim_objs, attrib->color);
- o_complex_set_color(
- o_current->text->prim_objs,
- o_current->color);
-
- if (o_current->saved_color != -1) {
- o_complex_set_saved_color_only(
- o_current->text->prim_objs,
- o_current->color);
- o_current->saved_color =
- o_current->color;
- }
- /* can't do this here since just selecting something */
- /* will cause this to be set */
- /* toplevel->page_current->CHANGED=1;*/
- }
- } else {
- fprintf(stderr, "You cannot attach non text items as attributes!\n");
- }
- }
- } else {
- if (o_current->text->string) {
- printf("Attribute [%s] already attached\n",
- o_current->text->string);
- }
+ if (attrib->saved_color != -1) {
+ o_complex_set_saved_color_only (attrib->text->prim_objs, attrib->color);
+ attrib->saved_color = attrib->color;
}
+
+ /* can't do this here since just selecting something */
+ /* will cause this to be set */
+ /* toplevel->page_current->CHANGED=1;*/
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs