[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-27-g0029ee5)
The branch, master has been updated
via 0029ee5696a4f8c0fd2a0edb64c0096792e24912 (commit)
from 19f1f215bfa62f164a8bbc4bdf6f7afd042a6107 (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
=========
gattrib/src/s_object.c | 2 +-
gschem/src/i_callbacks.c | 5 ++-
gschem/src/o_attrib.c | 2 +-
gschem/src/o_slot.c | 4 +-
libgeda/include/prototype.h | 4 +-
libgeda/src/o_attrib.c | 50 ++++++++++++----------------------------
libgeda/src/o_complex_basic.c | 2 +-
libgeda/src/o_list.c | 2 +-
8 files changed, 26 insertions(+), 45 deletions(-)
=================
Commit Messages
=================
commit 0029ee5696a4f8c0fd2a0edb64c0096792e24912
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Tue Dec 23 03:46:50 2008 +0000
Fix attribute colours for embedded objects [#2157598]
Add an argument, "set_color" to o_attrib_attach[_list]() to specify
whether the colour of the attribute should be reset to the default
attribute colour when performing the attachment.
We set this to true when promoting toplevel unattached attributes
inside a symbol onto the schematic page, when the user explicitly
attaches an attribute inside gschem. It is FALSE in other cases.
In cases where we're creating new attributes, such as o_slot_end(),
we specify the attribute colour we want to o_text_new().
Remove colour setting from o_attrib_add(), since there is no point
having this code in two places. o_attrib_add() just deals with the
datastructures now.
:100644 100644 39c8207... b73a5c5... M gattrib/src/s_object.c
:100644 100644 161db0b... e3023c4... M gschem/src/i_callbacks.c
:100644 100644 e86a167... 254a4e9... M gschem/src/o_attrib.c
:100644 100644 df0db19... 761b111... M gschem/src/o_slot.c
:100644 100644 27fed4a... c665356... M libgeda/include/prototype.h
:100644 100644 d57e1fd... 0e026cb... M libgeda/src/o_attrib.c
:100644 100644 82a319c... 98ab771... M libgeda/src/o_complex_basic.c
:100644 100644 7d4434a... 1dc2048... M libgeda/src/o_list.c
=========
Changes
=========
commit 0029ee5696a4f8c0fd2a0edb64c0096792e24912
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Tue Dec 23 03:46:50 2008 +0000
Fix attribute colours for embedded objects [#2157598]
Add an argument, "set_color" to o_attrib_attach[_list]() to specify
whether the colour of the attribute should be reset to the default
attribute colour when performing the attachment.
We set this to true when promoting toplevel unattached attributes
inside a symbol onto the schematic page, when the user explicitly
attaches an attribute inside gschem. It is FALSE in other cases.
In cases where we're creating new attributes, such as o_slot_end(),
we specify the attribute colour we want to o_text_new().
Remove colour setting from o_attrib_add(), since there is no point
having this code in two places. o_attrib_add() just deals with the
datastructures now.
diff --git a/gattrib/src/s_object.c b/gattrib/src/s_object.c
index 39c8207..b73a5c5 100644
--- a/gattrib/src/s_object.c
+++ b/gattrib/src/s_object.c
@@ -320,7 +320,7 @@ OBJECT *s_object_attrib_add_attrib_in_object(TOPLEVEL * pr_current, char *text_s
/* now attach the attribute to the object (if o_current is not NULL) */
/* remember that o_current contains the object to get the attribute */
if (o_current) {
- o_attrib_attach (pr_current, new_obj, o_current);
+ o_attrib_attach (pr_current, new_obj, o_current, FALSE);
}
o_selection_add (pr_current->page_current->selection_list, new_obj);
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 161db0b..e3023c4 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -3013,8 +3013,9 @@ DEFINE_I_CALLBACK(attributes_attach)
/* skip over first object */
s_current = g_list_next(s_current);
while (s_current != NULL) {
- if (s_current->data) {
- o_attrib_attach(w_current->toplevel, s_current->data, first_object);
+ OBJECT *object = s_current->data;
+ if (object != NULL) {
+ o_attrib_attach (w_current->toplevel, object, first_object, TRUE);
w_current->toplevel->page_current->CHANGED=1;
}
s_current = g_list_next(s_current);
diff --git a/gschem/src/o_attrib.c b/gschem/src/o_attrib.c
index e86a167..254a4e9 100644
--- a/gschem/src/o_attrib.c
+++ b/gschem/src/o_attrib.c
@@ -246,7 +246,7 @@ OBJECT *o_attrib_add_attrib(GSCHEM_TOPLEVEL *w_current,
/* now attach the attribute to the object (if o_current is not NULL) */
/* remember that o_current contains the object to get the attribute */
if (o_current) {
- o_attrib_attach (toplevel, new_obj, o_current);
+ o_attrib_attach (toplevel, new_obj, o_current, FALSE);
}
o_selection_add (toplevel->page_current->selection_list, new_obj);
diff --git a/gschem/src/o_slot.c b/gschem/src/o_slot.c
index df0db19..761b111 100644
--- a/gschem/src/o_slot.c
+++ b/gschem/src/o_slot.c
@@ -175,14 +175,14 @@ void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string, int len)
} else {
/* here you need to do the add the slot
attribute since it doesn't exist */
- new_obj = o_text_new(toplevel, OBJ_TEXT, w_current->text_color,
+ new_obj = o_text_new(toplevel, OBJ_TEXT, toplevel->attribute_color,
object->complex->x, object->complex->y,
LOWER_LEFT, 0, /* zero is angle */
string, 10, INVISIBLE, SHOW_NAME_VALUE);
s_page_append (toplevel->page_current, new_obj);
/* manually attach attribute */
- o_attrib_attach (toplevel, new_obj, object);
+ o_attrib_attach (toplevel, new_obj, object, FALSE);
slot_text_object = new_obj;
}
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 27fed4a..c665356 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -110,8 +110,8 @@ 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 *attrib, OBJECT *object);
-void o_attrib_attach_list(TOPLEVEL *toplevel, GList *attr_list, 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_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 d57e1fd..0e026cb 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -99,21 +99,8 @@ OBJECT *o_attrib_search(GList *list, OBJECT *item)
*/
void o_attrib_add(TOPLEVEL *toplevel, OBJECT *object, OBJECT *item)
{
- /* Show that that item is an attribute */
- item->color = toplevel->attribute_color;
-
- if (item->type == OBJ_TEXT) {
- o_complex_set_color(item->text->prim_objs,
- item->color);
- } else if (item->type == OBJ_COMPLEX ||
- item->type == OBJ_PLACEHOLDER) {
- o_complex_set_color(item->complex->prim_objs,
- item->color);
- }
-
/* Add link from item to attrib listing */
item->attached_to = object;
-
object->attribs = g_list_append (object->attribs, item);
}
@@ -162,8 +149,10 @@ void o_attrib_free(TOPLEVEL *toplevel, OBJECT *current)
* \param [in] toplevel The TOPLEVEL object.
* \param [in] attrib The attribute to be added.
* \param [out] object The object where you want to add item as an attribute.
+ * \param [in] set_color Whether or not we should set the new attribute's color.
*/
-void o_attrib_attach (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object)
+void o_attrib_attach (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object,
+ int set_color)
{
g_return_if_fail (attrib != NULL);
g_return_if_fail (object != NULL);
@@ -187,12 +176,14 @@ void o_attrib_attach (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object)
o_attrib_add (toplevel, object, attrib);
- attrib->color = toplevel->attribute_color;
- o_complex_set_color(attrib->text->prim_objs, attrib->color);
-
- if (attrib->saved_color != -1) {
- o_complex_set_saved_color_only (attrib->text->prim_objs, attrib->color);
- attrib->saved_color = attrib->color;
+ if (set_color) {
+ if (attrib->saved_color == -1) {
+ attrib->color = toplevel->attribute_color;
+ o_complex_set_color (attrib->text->prim_objs, attrib->color);
+ } else {
+ attrib->saved_color = toplevel->attribute_color;
+ o_complex_set_saved_color_only (attrib->text->prim_objs, attrib->saved_color);
+ }
}
/* can't do this here since just selecting something */
@@ -208,14 +199,15 @@ void o_attrib_attach (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object)
* \param [in] toplevel The TOPLEVEL object.
* \param [in] attr_list The list of attributes to be added.
* \param [out] object The object where you want to add item as an attribute.
+ * \param [in] set_color Whether or not we should set the new attribute's color.
*/
void o_attrib_attach_list (TOPLEVEL *toplevel,
- GList *attr_list, OBJECT *object)
+ GList *attr_list, OBJECT *object, int set_color)
{
GList *iter;
for (iter = attr_list; iter != NULL; iter = g_list_next (iter))
- o_attrib_attach (toplevel, iter->data, object);
+ o_attrib_attach (toplevel, iter->data, object, set_color);
}
@@ -308,7 +300,6 @@ GList *o_read_attribs (TOPLEVEL *toplevel,
char *line = NULL;
char objtype;
int ATTACH=FALSE;
- int saved_color = -1;
object_list = g_list_reverse (list);
@@ -373,7 +364,6 @@ GList *o_read_attribs (TOPLEVEL *toplevel,
line = g_strdup (line);
new_obj = o_text_read (toplevel, line, tb, release_ver, fileformat_ver);
g_free (line);
- saved_color = new_obj->color;
object_list = g_list_prepend (object_list, new_obj);
ATTACH=TRUE;
@@ -387,17 +377,7 @@ GList *o_read_attribs (TOPLEVEL *toplevel,
}
if (ATTACH) {
- o_attrib_attach (toplevel, new_obj, object_to_get_attribs);
- /* check color to set it to the right value */
- if (new_obj->color != saved_color) {
- new_obj->color = saved_color;
-
- if (new_obj->type == OBJ_TEXT) {
- o_complex_set_color (new_obj->text->prim_objs, new_obj->color);
- } else {
- printf("Tried to set the color on a complex in libgeda/src/o_read_attribs\n");
- }
- }
+ o_attrib_attach (toplevel, new_obj, object_to_get_attribs, FALSE);
ATTACH=FALSE;
} else {
fprintf(stderr, "Tried to attach a non-text item as an attribute\n");
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index 82a319c..98ab771 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -343,7 +343,7 @@ void o_complex_promote_attribs (TOPLEVEL *toplevel, OBJECT *object,
promoted = o_complex_get_promotable (toplevel, object, TRUE);
/* Attach promoted attributes to the original complex object */
- o_attrib_attach_list (toplevel, promoted, object);
+ o_attrib_attach_list (toplevel, promoted, object, TRUE);
/* Insert the promoted attributes before the tail of the object list */
last = g_list_last (*obj_list);
diff --git a/libgeda/src/o_list.c b/libgeda/src/o_list.c
index 7d4434a..1dc2048 100644
--- a/libgeda/src/o_list.c
+++ b/libgeda/src/o_list.c
@@ -206,7 +206,7 @@ GList *o_glist_copy_all (TOPLEVEL *toplevel,
if (src_object->attached_to != NULL &&
src_object->attached_to->copied_to != NULL) {
o_attrib_attach(toplevel, dst_object,
- src_object->attached_to->copied_to);
+ src_object->attached_to->copied_to, FALSE);
}
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs