summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e7e4121)
raw | patch | inline | side by side (parent: e7e4121)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Mon, 25 Feb 2008 10:11:26 +0000 (10:11 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Mon, 25 Feb 2008 10:11:26 +0000 (10:11 +0000) |
src/box3d.cpp | patch | blob | history | |
src/box3d.h | patch | blob | history | |
src/path-chemistry.cpp | patch | blob | history | |
src/sp-item-group.cpp | patch | blob | history |
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 7f52abd8cbc65f666fc0efe3847897a1746f1f9b..5beee4accab9e3fb439ddb846bdadb88c99ea5fd 100644 (file)
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -1336,8 +1336,7 @@ box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp,
/* Converts the 3D box to an ordinary SPGroup, adds it to the XML tree at the same position as
the original box and deletes the latter */
-// TODO: Copy over all important attributes (see sp_selected_item_to_curved_repr() for an example)
-SPGroup *
+Inkscape::XML::Node *
box3d_convert_to_group(SPBox3D *box) {
SPDocument *doc = SP_OBJECT_DOCUMENT(box);
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
// remember position of the box
int pos = SP_OBJECT_REPR(box)->position();
+ // remember important attributes
+ Inkscape::XML::Node *repr_source = SP_OBJECT_REPR(box);
+ gchar const *id = repr_source->attribute("id");
+ gchar const *style = repr_source->attribute("style");
+ gchar const *mask = repr_source->attribute("mask");
+ gchar const *clip_path = repr_source->attribute("clip-path");
+
// create a new group and add the sides (converted to ordinary paths) as its children
Inkscape::XML::Node *grepr = xml_doc->createElement("svg:g");
repr = box3d_side_convert_to_path(SP_BOX3D_SIDE(child));
grepr->appendChild(repr);
} else {
- g_warning("Non-side item encountered as child of a 3D box.\n");
+ g_warning("Non-side item encountered as child of a 3D box.");
}
}
SPObject *parent = SP_OBJECT_PARENT(box);
SP_OBJECT_REPR(parent)->appendChild(grepr);
grepr->setPosition(pos);
+ grepr->setAttribute("style", style);
+ if (mask)
+ grepr->setAttribute("mask", mask);
+ if (clip_path)
+ grepr->setAttribute("clip-path", clip_path);
SP_OBJECT(box)->deleteObject(true);
- return SP_GROUP(doc->getObjectByRepr(grepr));
+ grepr->setAttribute("id", id);
+
+ return grepr;
}
static inline void
diff --git a/src/box3d.h b/src/box3d.h
index 2fbf224a5ea57e17ba290b0c56488557ff70b328..d9fd540b68d9217087a11b6c89678f44a9032fb6 100644 (file)
--- a/src/box3d.h
+++ b/src/box3d.h
Persp3D *box3d_get_perspective(SPBox3D const *box);
void box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp, bool recompute_corners = false);
-SPGroup *box3d_convert_to_group(SPBox3D *box);
+Inkscape::XML::Node *box3d_convert_to_group(SPBox3D *box);
#endif /* __SP_BOX3D_H__ */
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 254a00e275fa5f0b27f86534ebd31b443794ca02..7466a706626b7e7df57141cfc6f7a0658d2a1ecb 100644 (file)
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
@@ -297,12 +297,13 @@ sp_selected_path_to_curves0(gboolean interactive, guint32 /*text_grouping_policy
if (SP_IS_BOX3D(item)) {
// convert 3D box to ordinary group of paths; replace the old element in 'selected' with the new group
- GSList *sel_it = g_slist_find(selected, item);
- sel_it->data = box3d_convert_to_group(SP_BOX3D(item));
- item = SP_ITEM(sel_it->data);
-
- did = true;
- selected = g_slist_remove (selected, item);
+ Inkscape::XML::Node *repr = box3d_convert_to_group(SP_BOX3D(item));
+
+ if (repr) {
+ to_select = g_slist_prepend (to_select, repr);
+ did = true;
+ selected = g_slist_remove (selected, item);
+ }
continue;
}
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index ac7aee1d4f1ea38f0f176f7a0651faaed1a79155..5ae5713ca429fcac4a87b29ba05b02fc77ca38bf 100644 (file)
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
SPItem *pitem = SP_ITEM (SP_OBJECT_PARENT (gitem));
Inkscape::XML::Node *prepr = SP_OBJECT_REPR (pitem);
- if (SP_IS_BOX3D(gitem)) {
- group = box3d_convert_to_group(SP_BOX3D(gitem));
- gitem = SP_ITEM(group);
- grepr = SP_OBJECT_REPR(gitem);
- }
+ if (SP_IS_BOX3D(gitem)) {
+ grepr = box3d_convert_to_group(SP_BOX3D(gitem));
+ if (grepr) {
+ gitem = SP_ITEM(doc->getObjectByRepr(grepr));
+ group = SP_GROUP(gitem);
+ }
+ }
/* Step 1 - generate lists of children objects */
GSList *items = NULL;