From 8867de5daf309e4cdd3fce177b408618490be4f3 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Tue, 29 Jun 2010 23:35:42 +0530 Subject: This is the first c++ification commit from me. It handles sp-line, sp-polyline, sp-item and marks the onset of document c++ification as well. Users can check performace increase with [/usr/bin/time -v inkscape_binary_with_commandline_options]. (bzr r9546.1.1) --- src/live_effects/lpe-mirror_symmetry.cpp | 2 +- src/live_effects/lpegroupbbox.cpp | 2 +- src/live_effects/parameter/path-reference.h | 1 + src/live_effects/parameter/path.cpp | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp index a3a0faf37..dabeb5682 100644 --- a/src/live_effects/lpe-mirror_symmetry.cpp +++ b/src/live_effects/lpe-mirror_symmetry.cpp @@ -46,7 +46,7 @@ LPEMirrorSymmetry::doOnApply (SPLPEItem *lpeitem) using namespace Geom; SPItem *item = SP_ITEM(lpeitem); - Geom::Matrix t = sp_item_i2d_affine(item); + Geom::Matrix t = item->i2d_affine(); Geom::Rect bbox = *item->getBounds(t); // fixme: what happens if getBounds does not return a valid rect? Point A(bbox.left(), bbox.bottom()); diff --git a/src/live_effects/lpegroupbbox.cpp b/src/live_effects/lpegroupbbox.cpp index 3820b5ba7..6eac43c43 100644 --- a/src/live_effects/lpegroupbbox.cpp +++ b/src/live_effects/lpegroupbbox.cpp @@ -31,7 +31,7 @@ GroupBBoxEffect::original_bbox(SPLPEItem *lpeitem, bool absolute) Geom::Matrix transform; if (absolute) { - transform = sp_item_i2doc_affine(item); + transform = item->i2doc_affine(); } else { transform = Geom::identity(); diff --git a/src/live_effects/parameter/path-reference.h b/src/live_effects/parameter/path-reference.h index 67508e531..53b9ade04 100644 --- a/src/live_effects/parameter/path-reference.h +++ b/src/live_effects/parameter/path-reference.h @@ -10,6 +10,7 @@ */ #include +#include "sp-item.h" #include #include diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index d8d5b0a7c..e662f7d95 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -209,7 +209,7 @@ PathParam::param_editOncanvas(SPItem *item, SPDesktop * dt) ShapeRecord r; r.role = SHAPE_ROLE_LPE_PARAM; - r.edit_transform = sp_item_i2d_affine(item); // TODO is it right? + r.edit_transform = item->i2d_affine(); // TODO is it right? if (!href) { r.item = reinterpret_cast(param_effect->getLPEObj()); r.lpe_key = param_key; -- cgit v1.2.3 From d25a9a072143eafa4a9823b84e977c4b85d45efe Mon Sep 17 00:00:00 2001 From: Abhishek Sharma Public Date: Fri, 2 Jul 2010 18:05:42 +0530 Subject: New Class SPDocumentUndo created which takes care of c++fying some non SPDocument based methods (bzr r9546.1.3) --- src/live_effects/lpe-knot.cpp | 2 +- src/live_effects/parameter/path.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index b8e9b8cf9..a2476a098 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -636,7 +636,7 @@ KnotHolderEntityCrossingSwitcher::knot_click(guint state) //std::cout<<"crossing set to"<crossing_points[s].sign<<".\n"; } lpe->crossing_points_vector.param_set_and_write_new_value(lpe->crossing_points.to_vector()); - sp_document_done(lpe->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, /// @todo Is this the right verb? + SPDocumentUndo::done(lpe->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, /// @todo Is this the right verb? _("Change knot crossing")); // FIXME: this should not directly ask for updating the item. It should write to SVG, which triggers updating. diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index e662f7d95..af4f84f59 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -414,7 +414,7 @@ PathParam::on_paste_button_click() Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); Glib::ustring svgd = cm->getPathParameter(SP_ACTIVE_DESKTOP); paste_param_path(svgd.data()); - sp_document_done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + SPDocumentUndo::done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Paste path parameter")); } @@ -446,7 +446,7 @@ PathParam::on_link_button_click() // check if linking to object to which LPE is applied (maybe delegated to PathReference param_write_to_repr(pathid.c_str()); - sp_document_done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, + SPDocumentUndo::done(param_effect->getSPDoc(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Link path parameter to path")); } } -- cgit v1.2.3 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/live_effects/lpeobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index aa916318d..a77b9817a 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -104,7 +104,7 @@ LivePathEffectObject::livepatheffect_build(SPObject *object, SPDocument *documen if (((SPObjectClass *) livepatheffect_parent_class)->build) (* ((SPObjectClass *) livepatheffect_parent_class)->build)(object, document, repr); - sp_object_read_attr(object, "effect"); + object->readAttr( "effect"); if (repr) { repr->addListener (&livepatheffect_repr_events, object); -- 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/live_effects/effect.cpp | 2 +- src/live_effects/lpe-knot.cpp | 2 +- src/live_effects/parameter/path.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 6266fade0..2cc26e4e1 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -518,7 +518,7 @@ Effect::getHelperPaths(SPLPEItem *lpeitem) // rather than copying PathVectors all over the place if (show_orig_path) { // add original path to helperpaths - SPCurve* curve = sp_shape_get_curve (SP_SHAPE(lpeitem)); + SPCurve* curve = SP_SHAPE(lpeitem)->getCurve (); hp_vec.push_back(curve->get_pathvector()); } diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index a2476a098..d43213fe9 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -498,7 +498,7 @@ void collectPathsAndWidths (SPLPEItem const *lpeitem, std::vector &p if (SP_IS_PATH(lpeitem)) { c = sp_path_get_curve_for_edit(SP_PATH(lpeitem)); } else { - c = sp_shape_get_curve(SP_SHAPE(lpeitem)); + c = SP_SHAPE(lpeitem)->getCurve(); } if (c) { Geom::PathVector subpaths = c->get_pathvector(); diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index af4f84f59..bdbe126e2 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -366,7 +366,7 @@ PathParam::linked_modified(SPObject *linked_obj, guint /*flags*/) { SPCurve *curve = NULL; if (SP_IS_SHAPE(linked_obj)) { - curve = sp_shape_get_curve(SP_SHAPE(linked_obj)); + curve = SP_SHAPE(linked_obj)->getCurve(); } if (SP_IS_TEXT(linked_obj)) { curve = SP_TEXT(linked_obj)->getNormalizedBpath(); -- cgit v1.2.3