From: johnce Date: Wed, 5 Aug 2009 19:46:20 +0000 (+0000) Subject: Inkscape::XML::Document -> Inkscape::XML::DocumentTree (more refactoring ...) X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=81fda2bcd41eca6d9837530b350da8f803d02d60;p=inkscape.git Inkscape::XML::Document -> Inkscape::XML::DocumentTree (more refactoring ...) --- diff --git a/src/box3d.cpp b/src/box3d.cpp index 9ec0625aa..0caf7b1ef 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -43,11 +43,11 @@ static void box3d_class_init(SPBox3DClass *klass); static void box3d_init(SPBox3D *box3d); -static void box3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr); +static void box3d_build(SPObject *object, Inkscape::XML::Document *document, Inkscape::XML::Node *repr); static void box3d_release(SPObject *object); static void box3d_set(SPObject *object, unsigned int key, const gchar *value); static void box3d_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::DocumentTree *doc, Inkscape::XML::Node *repr, guint flags); static gchar *box3d_description(SPItem *item); static Geom::Matrix box3d_set_transform(SPItem *item, Geom::Matrix const &xform); @@ -110,7 +110,7 @@ box3d_init(SPBox3D *box) } static void -box3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) +box3d_build(SPObject *object, Inkscape::XML::Document *document, Inkscape::XML::Node *repr) { if (((SPObjectClass *) (parent_class))->build) { ((SPObjectClass *) (parent_class))->build(object, document, repr); @@ -126,7 +126,7 @@ box3d_build(SPObject *object, Document *document, Inkscape::XML::Node *repr) // TODO: Create/link to the correct perspective - Document *doc = SP_OBJECT_DOCUMENT(box); + Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(box); if (!doc) { g_print ("No document for the box!!!!\n"); return; @@ -256,7 +256,7 @@ box3d_update(SPObject *object, SPCtx *ctx, guint flags) } -static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::DocumentTree *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPBox3D *box = SP_BOX3D(object); @@ -272,13 +272,13 @@ static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Documen repr->setAttribute("inkscape:perspectiveID", box->persp_href); } else { /* box is not yet linked to a perspective; use the document's current perspective */ - Document *doc = SP_OBJECT_DOCUMENT(object); + Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(object); if (box->persp_ref->getURI()) { gchar *uri_string = box->persp_ref->getURI()->toString(); repr->setAttribute("inkscape:perspectiveID", uri_string); g_free(uri_string); } else { - Inkscape::XML::Node *persp_repr = SP_OBJECT_REPR(doc->current_persp3d); + Inkscape::XML::Node *persp_repr = SP_OBJECT_REPR(doc->current_persp3d);//NOTE1 const gchar *persp_id = persp_repr->attribute("id"); gchar *href = g_strdup_printf("#%s", persp_id); repr->setAttribute("inkscape:perspectiveID", href); @@ -1378,7 +1378,7 @@ box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp, the original box and deletes the latter */ SPGroup * box3d_convert_to_group(SPBox3D *box) { - Document *doc = SP_OBJECT_DOCUMENT(box); + Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(box); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); // remember position of the box diff --git a/src/forward.h b/src/forward.h index 852934e96..4ac08c126 100644 --- a/src/forward.h +++ b/src/forward.h @@ -20,6 +20,10 @@ namespace Inkscape { struct Application; struct ApplicationClass; +namespace XML { +class Document; +class DocumentTree; +} } /* Editing window */ @@ -43,7 +47,6 @@ GType sp_event_context_get_type (); /* Document tree */ -class Document; class SPDocumentClass; #define SP_TYPE_DOCUMENT (sp_document_get_type ()) diff --git a/src/sp-object.h b/src/sp-object.h index 2932da728..9a4f8fd4d 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -149,7 +149,7 @@ struct SPObject : public GObject { SPIXmlSpace xml_space; unsigned int hrefcount; /* number of xlink:href references */ unsigned int _total_hrefcount; /* our hrefcount + total descendants */ - Document *document; /* Document we are part of */ + Inkscape::XML::Document *document; /* Document we are part of */ SPObject *parent; /* Our parent (only one allowed) */ SPObject *children; /* Our children */ SPObject *_last_child; /* Remembered last child */ @@ -501,7 +501,7 @@ private: struct SPObjectClass { GObjectClass parent_class; - void (* build) (SPObject *object, Document *doc, Inkscape::XML::Node *repr); + void (* build) (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr); void (* release) (SPObject *object); /* Virtual handlers of repr signals */ @@ -519,7 +519,7 @@ struct SPObjectClass { /* Modification handler */ void (* modified) (SPObject *object, unsigned int flags); - Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags); + Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::DocumentTree *doc, Inkscape::XML::Node *repr, unsigned int flags); }; @@ -536,7 +536,7 @@ inline SPObject *sp_object_first_child(SPObject *parent) { } SPObject *sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr); -void sp_object_invoke_build(SPObject *object, Document *document, Inkscape::XML::Node *repr, unsigned int cloned); +void sp_object_invoke_build(SPObject *object, Inkscape::XML::Document *document, Inkscape::XML::Node *repr, unsigned int cloned); void sp_object_set(SPObject *object, unsigned int key, gchar const *value); diff --git a/src/verbs.h b/src/verbs.h index 51bf0e34b..de9eae68a 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -437,8 +437,8 @@ public: static void delete_all_view (Inkscape::UI::View::View * view); void delete_view (Inkscape::UI::View::View * view); - void sensitive (Document * in_doc = NULL, bool in_sensitive = true); - void name (Document * in_doc = NULL, Glib::ustring in_name = ""); + void sensitive (Inkscape::XML::DocumentTree * in_doc = NULL, bool in_sensitive = true); + void name (Inkscape::XML::DocumentTree * in_doc = NULL, Glib::ustring in_name = ""); // Yes, multiple public, protected and private sections are bad. We'll clean that up later protected: diff --git a/src/xml/node.h b/src/xml/node.h index abcccdb9a..38f006d5c 100644 --- a/src/xml/node.h +++ b/src/xml/node.h @@ -80,6 +80,8 @@ public: * @{ */ + + /** * @brief Get the type of the node * @return NodeType enumeration member corresponding to the type of the node. diff --git a/src/xml/xml-forward.h b/src/xml/xml-forward.h index 33218c8ae..e3ebad183 100644 --- a/src/xml/xml-forward.h +++ b/src/xml/xml-forward.h @@ -20,7 +20,7 @@ namespace XML { struct AttributeRecord; struct CommentNode; class CompositeNodeObserver; -struct Document; +class Document; class ElementNode; class Event; class EventAdd;