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/seltrans.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/seltrans.cpp') diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 05f47d4ab..89799246c 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -265,7 +265,7 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s SPItem *it = (SPItem *)sp_object_ref(SP_OBJECT(l->data), NULL); _items.push_back(it); _items_const.push_back(it); - _items_affines.push_back(sp_item_i2d_affine(it)); + _items_affines.push_back(it->i2d_affine()); _items_centers.push_back(it->getCenter()); // for content-dragging, we need to remember original centers } @@ -333,7 +333,7 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s // More than 50 items will produce at least 200 bbox points, which might make Inkscape crawl // (see the comment a few lines above). In that case we will use the bbox of the selection as a whole for (unsigned i = 0; i < _items.size(); i++) { - getBBoxPoints(sp_item_bbox_desktop(_items[i], _snap_bbox_type), &_bbox_points_for_translating, false, true, emp, mp); + getBBoxPoints(_items[i]->getBboxDesktop(_snap_bbox_type), &_bbox_points_for_translating, false, true, emp, mp); } } else { _bbox_points_for_translating = _bbox_points; // use the bbox points of the selection as a whole @@ -444,7 +444,7 @@ void Inkscape::SelTrans::transform(Geom::Matrix const &rel_affine, Geom::Point c for (unsigned i = 0; i < _items.size(); i++) { SPItem &item = *_items[i]; Geom::Matrix const &prev_transform = _items_affines[i]; - sp_item_set_i2d_affine(&item, prev_transform * affine); + item.set_i2d_affine(prev_transform * affine); } } else { if (_bbox) { @@ -599,15 +599,15 @@ void Inkscape::SelTrans::stamp() Geom::Matrix const *new_affine; if (_show == SHOW_OUTLINE) { - Geom::Matrix const i2d(sp_item_i2d_affine(original_item)); + Geom::Matrix const i2d(original_item->i2d_affine()); Geom::Matrix const i2dnew( i2d * _current_relative_affine ); - sp_item_set_i2d_affine(copy_item, i2dnew); + copy_item->set_i2d_affine(i2dnew); new_affine = ©_item->transform; } else { new_affine = &original_item->transform; } - sp_item_write_transform(copy_item, copy_repr, *new_affine); + copy_item->doWriteTransform(copy_repr, *new_affine); if ( copy_item->isCenterSet() && _center ) { copy_item->setCenter(*_center * _current_relative_affine); -- 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/seltrans.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/seltrans.cpp') diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 89799246c..627620a60 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -520,16 +520,16 @@ void Inkscape::SelTrans::ungrab() _items_centers.clear(); if (_current_relative_affine.isTranslation()) { - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Move")); } else if (_current_relative_affine.without_translation().isScale()) { - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Scale")); } else if (_current_relative_affine.without_translation().isRotation()) { - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Rotate")); } else { - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Skew")); } @@ -541,7 +541,7 @@ void Inkscape::SelTrans::ungrab() SPItem *it = (SPItem*)SP_OBJECT(l->data); SP_OBJECT(it)->updateRepr(); } - sp_document_done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Set center")); } @@ -616,7 +616,7 @@ void Inkscape::SelTrans::stamp() Inkscape::GC::release(copy_repr); l = l->next; } - sp_document_done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done(sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Stamp")); } @@ -805,7 +805,7 @@ void Inkscape::SelTrans::handleClick(SPKnot */*knot*/, guint state, SPSelTransHa _center_is_set = false; // center has changed _updateHandles(); } - sp_document_done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, + SPDocumentUndo::done (sp_desktop_document(_desktop), SP_VERB_CONTEXT_SELECT, _("Reset center")); } break; -- cgit v1.2.3