From 8b04d0db6c55e36935690d37defb6f9b68945796 Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 05:40:36 +0000 Subject: SPDocument->Document (bzr r8404) --- src/box3d.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/box3d.cpp') diff --git a/src/box3d.cpp b/src/box3d.cpp index 5cffa66d9..9ec0625aa 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -43,7 +43,7 @@ static void box3d_class_init(SPBox3DClass *klass); static void box3d_init(SPBox3D *box3d); -static void box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); +static void box3d_build(SPObject *object, 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); @@ -110,7 +110,7 @@ box3d_init(SPBox3D *box) } static void -box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) +box3d_build(SPObject *object, 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, SPDocument *document, Inkscape::XML::Node *repr) // TODO: Create/link to the correct perspective - SPDocument *doc = SP_OBJECT_DOCUMENT(box); + Document *doc = SP_OBJECT_DOCUMENT(box); if (!doc) { g_print ("No document for the box!!!!\n"); return; @@ -272,7 +272,7 @@ 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 */ - SPDocument *doc = SP_OBJECT_DOCUMENT(object); + 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); @@ -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) { - SPDocument *doc = SP_OBJECT_DOCUMENT(box); + Document *doc = SP_OBJECT_DOCUMENT(box); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); // remember position of the box -- cgit v1.2.3 From 2553d36fec571b5a5da41ba08fe0f2740be4e451 Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 19:46:20 +0000 Subject: Inkscape::XML::Document -> Inkscape::XML::DocumentTree (more refactoring ...) (bzr r8420) --- src/box3d.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/box3d.cpp') 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 -- cgit v1.2.3 From 51c2905fd3e99955db2d823b79abb763d8097028 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Thu, 6 Aug 2009 14:17:17 +0000 Subject: Revert recent refactoring changes by johnce because they break the build, which cannot be fixed easily. (bzr r8422) --- src/box3d.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/box3d.cpp') diff --git a/src/box3d.cpp b/src/box3d.cpp index 0caf7b1ef..5cffa66d9 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, Inkscape::XML::Document *document, Inkscape::XML::Node *repr); +static void box3d_build(SPObject *object, SPDocument *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::DocumentTree *doc, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *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, Inkscape::XML::Document *document, Inkscape::XML::Node *repr) +box3d_build(SPObject *object, SPDocument *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, Inkscape::XML::Document *document, Inkscape::XML:: // TODO: Create/link to the correct perspective - Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(box); + SPDocument *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::DocumentTree *xml_doc, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *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 */ - Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(object); + SPDocument *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);//NOTE1 + Inkscape::XML::Node *persp_repr = SP_OBJECT_REPR(doc->current_persp3d); 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) { - Inkscape::XML::Document *doc = SP_OBJECT_DOCUMENT(box); + SPDocument *doc = SP_OBJECT_DOCUMENT(box); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); // remember position of the box -- cgit v1.2.3 From 84499792735ed174dfe3dfc60b97915235dea14c Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 14 Sep 2009 03:29:43 +0000 Subject: fix crash when moving a box after copying it to clipboard; this code is still badly broken, we must not use any UI classes such as selection in set_transform, but at least it does not crash now (bzr r8588) --- src/box3d.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/box3d.cpp') diff --git a/src/box3d.cpp b/src/box3d.cpp index 5cffa66d9..93efa5c35 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -335,7 +335,8 @@ box3d_set_transform(SPItem *item, Geom::Matrix const &xform) Persp3D *persp = box3d_get_perspective(box); Persp3D *transf_persp; - if (!persp3d_has_all_boxes_in_selection (persp)) { + if (sp_desktop_document(inkscape_active_desktop()) == SP_OBJECT_DOCUMENT(item) && + !persp3d_has_all_boxes_in_selection (persp)) { std::list selboxes = sp_desktop_selection(inkscape_active_desktop())->box3DList(); /* create a new perspective as a copy of the current one and link the selected boxes to it */ -- cgit v1.2.3