From cae2409c94b11d17643f7c19829e2653d759ff8e Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Thu, 13 Dec 2007 09:45:27 +0000 Subject: Fundamentally reworked version of the 3D box tool (among many other things, this fixes bugs #168900 and #168868). See mailing list for details. Sorry for this single large commit but it was unfeasible to keep the history. (bzr r4224) --- src/sp-item-group.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'src/sp-item-group.cpp') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index cabc7b26a..410a7b37e 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -35,6 +35,8 @@ #include "sp-clippath.h" #include "sp-mask.h" #include "sp-path.h" +#include "box3d.h" +#include "box3d-side.h" static void sp_group_class_init (SPGroupClass *klass); static void sp_group_init (SPGroup *group); @@ -326,6 +328,11 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) SPItem *pitem = SP_ITEM (SP_OBJECT_PARENT (gitem)); Inkscape::XML::Node *prepr = SP_OBJECT_REPR (pitem); + /* When ungrouping a 3D box, we must convert the sides to ordinary paths */ + if (SP_IS_BOX3D (gitem)) { + g_print ("============== Ungrouping a 3D box ===============\n"); + } + /* Step 1 - generate lists of children objects */ GSList *items = NULL; GSList *objects = NULL; @@ -335,6 +342,13 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) SPItem *citem = SP_ITEM (child); + if (SP_IS_BOX3D_SIDE(child)) { + Inkscape::XML::Node *repr = SP_OBJECT_REPR(child); + // FIXME: This doesn't remove the attribute "inkscape:box3dsidetype". Why? + repr->setAttribute("inkscape:box3dsidetype", NULL); + repr->setAttribute("sodipodi:type", NULL); + } + /* Merging of style */ // this converts the gradient/pattern fill/stroke, if any, to userSpaceOnUse; we need to do // it here _before_ the new transform is set, so as to use the pre-transform bbox @@ -421,7 +435,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) while (items) { Inkscape::XML::Node *repr = (Inkscape::XML::Node *) items->data; // add item - prepr->appendChild(repr); + prepr->appendChild(repr); // restore position; since the items list was prepended (i.e. reverse), we now add // all children at the same pos, which inverts the order once again repr->setPosition(pos > 0 ? pos : 0); @@ -608,14 +622,50 @@ void CGroup::onUpdate(SPCtx *ctx, unsigned int flags) { while (l) { SPObject *child = SP_OBJECT (l->data); l = g_slist_remove (l, child); + //g_print ("sp-item-group: onUpdate working on child with flags "); if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { + /*** + g_print (" On parent object: "); + if (flags & SP_OBJECT_MODIFIED_FLAG) { + g_print("SP_OBJECT_MODIFIED_FLAG "); + } + if (flags & SP_OBJECT_CHILD_MODIFIED_FLAG) { + g_print("SP_OBJECT_CHILD_MODIFIED_FLAG "); + } + g_print ("\n"); + g_print (" On child object: "); + if (child->uflags & SP_OBJECT_MODIFIED_FLAG) { + g_print("SP_OBJECT_MODIFIED_FLAG "); + } + if (child->uflags & SP_OBJECT_CHILD_MODIFIED_FLAG) { + g_print("SP_OBJECT_CHILD_MODIFIED_FLAG "); + } + ***/ if (SP_IS_ITEM (child)) { SPItem const &chi = *SP_ITEM(child); cctx.i2doc = chi.transform * ictx->i2doc; cctx.i2vp = chi.transform * ictx->i2vp; + /** + g_print ("case 1\n"); + g_print ("\n On parent object: flags=%d ", flags); + g_print ("\n On child object: uflags=%d ", child->uflags); + if (flags & SP_OBJECT_MODIFIED_FLAG) g_print("SP_OBJECT_MODIFIED_FLAG "); + if (flags & SP_OBJECT_CHILD_MODIFIED_FLAG) g_print("SP_OBJECT_CHILD_MODIFIED_FLAG "); + g_print ("\n"); + if (child->uflags & SP_OBJECT_MODIFIED_FLAG) { + g_print("SP_OBJECT_MODIFIED_FLAG "); + } + if (child->uflags & SP_OBJECT_CHILD_MODIFIED_FLAG) { + g_print("SP_OBJECT_CHILD_MODIFIED_FLAG "); + } + g_print ("\n"); + **/ + //g_print ("Caution! The changed code applies! Does this change any behaviour?\n"); child->updateDisplay((SPCtx *)&cctx, flags); + //child->updateDisplay((SPCtx *)&cctx, child->uflags); } else { child->updateDisplay(ctx, flags); + //g_print ("case 2\n"); } } g_object_unref (G_OBJECT (child)); -- cgit v1.2.3