X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fsp-object.h;h=095494a6f67a913ec0a1bb6369d74a036b9653d0;hb=429ce09996dfe0ef44a115a89465c69eb4d376a6;hp=f30654c12ebb214f862aa2f80f9baecf60ba17db;hpb=1d9fba0b575543bc3c0d2e9f15b51e44be93893c;p=inkscape.git diff --git a/src/sp-object.h b/src/sp-object.h index f30654c12..095494a6f 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -53,8 +53,6 @@ #define SP_OBJECT_PREV(o) (sp_object_prev((SPObject *) (o))) #define SP_OBJECT_HREFCOUNT(o) (((SPObject *) (o))->hrefcount) #define SP_OBJECT_STYLE(o) (((SPObject *) (o))->style) -#define SP_OBJECT_TITLE(o) sp_object_title_get((SPObject *) (o)) -#define SP_OBJECT_DESCRIPTION(o) sp_object_description_get((SPObject *) (o)) #include @@ -69,6 +67,7 @@ namespace Inkscape { namespace XML { class Node; +class Document; } } @@ -240,14 +239,14 @@ struct SPObject : public GObject { void setLabel(gchar const *label); /** Retrieves the title of this object */ - gchar const *title() const { return NULL; /* TODO */ } + gchar *title() const; /** Sets the title of this object */ - void setTitle(gchar const *title) { (void)title; /* TODO */ } + bool setTitle(gchar const *title, bool verbatim=false); /** Retrieves the description of this object */ - gchar const *desc() const { return NULL; /* TODO */ } + gchar *desc() const; /** Sets the description of this object */ - void setDesc(gchar const *desc) { (void)desc; /* TODO */ } + bool setDesc(gchar const *desc, bool verbatim=false); /** @brief Set the policy under which this object will be * orphan-collected. @@ -376,7 +375,7 @@ struct SPObject : public GObject { /** @brief Updates the object's repr based on the object's state. * * This method updates the the repr attached to the object to reflect the object's current - * state; see the two-argument version for details. + * state; see the three-argument version for details. * * @param flags object write flags that apply to this update * @@ -404,7 +403,7 @@ struct SPObject : public GObject { * * @return the updated repr */ - Inkscape::XML::Node *updateRepr(Inkscape::XML::Node *repr, unsigned int flags); + Inkscape::XML::Node *updateRepr(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags); /** @brief Queues an deferred update of this object's display. * @@ -488,6 +487,14 @@ struct SPObject : public GObject { CollectionPolicy _collection_policy; gchar *_label; mutable gchar *_default_label; + +private: + // Private member functions used in the definitions of setTitle(), + // setDesc(), title() and desc(). + bool setTitleOrDesc(gchar const *value, gchar const *svg_tagname, bool verbatim); + gchar * getTitleOrDesc(gchar const *svg_tagname) const; + SPObject * findFirstChild(gchar const *tagname) const; + GString * textualContent() const; }; /// The SPObject vtable. @@ -512,7 +519,7 @@ struct SPObjectClass { /* Modification handler */ void (* modified) (SPObject *object, unsigned int flags); - Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::Node *repr, unsigned int flags); + Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags); }; @@ -535,17 +542,6 @@ void sp_object_set(SPObject *object, unsigned int key, gchar const *value); void sp_object_read_attr(SPObject *object, gchar const *key); -/* - * Get and set descriptive parameters. - * - * These are inefficent, so they are not intended to be used interactively. - */ - -gchar const *sp_object_title_get(SPObject *object); -gchar const *sp_object_description_get(SPObject *object); -unsigned int sp_object_title_set(SPObject *object, gchar const *title); -unsigned int sp_object_description_set(SPObject *object, gchar const *desc); - /* Public */ gchar const *sp_object_tagName_get(SPObject const *object, SPException *ex);