From 6cc35b45eab6422a6b6f67d621aa259a0a73786f Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Mon, 12 Jul 2010 22:06:46 +0530 Subject: SPObject c++ification finalized along with the beginning of XML Privatisation tweaks (bzr r9546.1.6) --- src/box3d-side.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/box3d-side.cpp') diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index 69bae53d9..be6d47db7 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -99,7 +99,7 @@ box3d_side_build (SPObject * object, SPDocument * document, Inkscape::XML::Node if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); - sp_object_read_attr(object, "inkscape:box3dsidetype"); + object->readAttr( "inkscape:box3dsidetype"); } static Inkscape::XML::Node * @@ -185,6 +185,14 @@ box3d_side_update (SPObject *object, SPCtx *ctx, guint flags) if (((SPObjectClass *) parent_class)->update) ((SPObjectClass *) parent_class)->update (object, ctx, flags); } +/* + * Function which return the type attribute for Box3D. + * Acts as a replacement for directly accessing the XML Tree directly. + */ +long long int Box3DSide::getFaceId() +{ + return this->getIntAttribute("inkscape:box3dsidetype", -1); +} void box3d_side_position_set (Box3DSide *side) { -- cgit v1.2.3 From cde0571b44ec5b108907bda85971c49f3ceb1de8 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Wed, 14 Jul 2010 23:40:35 +0530 Subject: SPShape c++ified to the extent it was possible and more changes done for XML privatisation. Major changes yet to come. (bzr r9546.1.7) --- src/box3d-side.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/box3d-side.cpp') diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index be6d47db7..9059e9705 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -117,7 +117,7 @@ box3d_side_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: sp_repr_set_int(repr, "inkscape:box3dsidetype", side->dir1 ^ side->dir2 ^ side->front_or_rear); } - sp_shape_set_shape ((SPShape *) object); + ((SPShape *) object)->setShape (); /* Duplicate the path */ SPCurve const *curve = ((SPShape *) object)->curve; @@ -179,7 +179,7 @@ box3d_side_update (SPObject *object, SPCtx *ctx, guint flags) if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { - sp_shape_set_shape ((SPShape *) object); + ((SPShape *) object)->setShape (); } if (((SPObjectClass *) parent_class)->update) @@ -251,19 +251,24 @@ box3d_side_set_shape (SPShape *shape) /* Reset the shape'scurve to the "original_curve" * This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/ - sp_shape_set_curve_insync (shape, c, TRUE); + shape->setCurveInsync( c, TRUE); if (sp_lpe_item_has_path_effect(SP_LPE_ITEM(shape)) && sp_lpe_item_path_effects_enabled(SP_LPE_ITEM(shape))) { SPCurve *c_lpe = c->copy(); bool success = sp_lpe_item_perform_path_effect(SP_LPE_ITEM (shape), c_lpe); if (success) { - sp_shape_set_curve_insync (shape, c_lpe, TRUE); + shape->setCurveInsync( c_lpe, TRUE); } c_lpe->unref(); } c->unref(); } -void +/* removed to be merged into box3d-context function sp_box3d_drag + * so as to remove the faulty mehcanism of accessing a parent's/base + * level class members from a derived subclass. + */ + +/*void box3d_side_apply_style (Box3DSide *side) { Inkscape::XML::Node *repr_face = SP_OBJECT_REPR(SP_OBJECT(side)); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -276,15 +281,15 @@ box3d_side_apply_style (Box3DSide *side) { SPDesktop *desktop = inkscape_active_desktop(); bool use_current = prefs->getBool("/tools/shapes/3dbox/usecurrent", false); if (use_current && !cur_style.empty()) { - /* use last used style */ + // use last used style repr_face->setAttribute("style", cur_style.data()); } else { - /* use default style */ + // use default style GString *pstring = g_string_new(""); g_string_printf (pstring, "/tools/shapes/3dbox/%s", box3d_side_axes_string(side)); sp_desktop_apply_style_tool (desktop, repr_face, pstring->str, false); } -} +}*/ gchar * box3d_side_axes_string(Box3DSide *side) -- cgit v1.2.3 From 150ac8ed3274e060e3349b5c0901ec8c7c7e3d4e Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Sat, 17 Jul 2010 12:48:31 +0530 Subject: More in XML privatisation with new create3DBox function and other supplements to efficiently hide information. (bzr r9546.1.8) --- src/box3d-side.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/box3d-side.cpp') diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index 9059e9705..d6f1f6b42 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -185,6 +185,18 @@ box3d_side_update (SPObject *object, SPCtx *ctx, guint flags) if (((SPObjectClass *) parent_class)->update) ((SPObjectClass *) parent_class)->update (object, ctx, flags); } + +/* Create a new Box3DSide and append it to the parent box */ +Box3DSide * Box3DSide::createBox3DSide(SPBox3D *box) +{ + Box3DSide *box3d_side = 0; + Inkscape::XML::Document *xml_doc = box->document->rdoc; + Inkscape::XML::Node *repr_side = xml_doc->createElement("svg:path"); + repr_side->setAttribute("sodipodi:type", "inkscape:box3dside"); + box3d_side = (Box3DSide *)box->appendChildRepr(repr_side); + return box3d_side; +} + /* * Function which return the type attribute for Box3D. * Acts as a replacement for directly accessing the XML Tree directly. -- cgit v1.2.3 From 88fc01afa8ea80d5105961d9103cc8f33582e7fb Mon Sep 17 00:00:00 2001 From: Abhishek Sharma public Date: Tue, 20 Jul 2010 16:14:23 +0530 Subject: More on c++ification and some XML privatisation (bzr r9546.1.10) --- src/box3d-side.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/box3d-side.cpp') diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index d6f1f6b42..6838008bb 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -346,8 +346,10 @@ box3d_side_convert_to_path(Box3DSide *side) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc); Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); - repr->setAttribute("d", SP_OBJECT_REPR(side)->attribute("d")); - repr->setAttribute("style", SP_OBJECT_REPR(side)->attribute("style")); + //repr->setAttribute("d", SP_OBJECT_REPR(side)->attribute("d")); + repr->setAttribute("d", side->getAttribute("d")); + //repr->setAttribute("style", SP_OBJECT_REPR(side)->attribute("style")); + repr->setAttribute("style", side->getAttribute("style")); return repr; } -- cgit v1.2.3