/*! \brief Attach existing attribute to an object. * \par Function Description * Attach existing attribute to an object. * * \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, int set_color) { g_return_if_fail (attrib != NULL); g_return_if_fail (object != NULL); /* is the object already part of the list ? */ if (g_list_find (object->attribs, attrib)) { g_warning ("Attribute [%s] already attached\n", attrib->text->string); return; } if (attrib->type != OBJ_TEXT) { g_warning (_("Attempt to attach non text item as an attribute!\n")); return; } if (attrib->attached_to != NULL) { g_warning (_("Attempt to attach attribute [%s] to more than one object\n"), attrib->text->string); return; } o_attrib_add (toplevel, object, attrib); if (set_color) o_set_color (toplevel, attrib, ATTRIBUTE_COLOR); }
/*! \brief Attach existing attribute to an object. * \par Function Description * Attach existing attribute to an object. * * \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, int set_color) { g_return_if_fail (attrib != NULL); g_return_if_fail (object != NULL); /* 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; } if (attrib->type != OBJ_TEXT) { g_warning (_("Attempt to attach non text item as an attribute!\n")); return; } if (attrib->attached_to != NULL) { g_warning (_("Attempt to attach attribute [%s] to more than one object\n"), attrib->text->string); return; } 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); } } /* can't do this here since just selecting something */ /* will cause this to be set */ /* toplevel->page_current->CHANGED=1;*/ }