From 1636c1dd1651780d01759676b194312529f211f7 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Sat, 25 Jun 2016 22:24:26 +0200 Subject: Moved next functions, added namespace, renamed range functions (bzr r14954.1.10) --- src/selection.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src/selection.cpp') diff --git a/src/selection.cpp b/src/selection.cpp index 32e27f2d4..94b64a7bc 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -130,25 +130,13 @@ void Selection::setReprList(std::vector const &list) { _emitChanged(); } -std::vector Selection::reprList() { - std::vector list = itemList(); - std::vector result; - std::transform(list.begin(), list.end(), std::back_inserter(result), [](SPItem* item) { return item->getRepr(); }); - return result; -} - -Inkscape::XML::Node *Selection::singleRepr() { - SPObject *obj = single(); - return obj ? obj->getRepr() : nullptr; -} - std::vector Selection::getSnapPoints(SnapPreferences const *snapprefs) const { std::vector p; if (snapprefs != NULL){ SnapPreferences snapprefs_dummy = *snapprefs; // create a local copy of the snapping prefs snapprefs_dummy.setTargetSnappable(Inkscape::SNAPTARGET_ROTATION_CENTER, false); // locally disable snapping to the item center - std::vector const items = const_cast(this)->itemList(); + std::vector const items = const_cast(this)->items(); for ( std::vector::const_iterator iter=items.begin();iter!=items.end(); ++iter) { SPItem *this_item = *iter; this_item->getSnappoints(p, &snapprefs_dummy); @@ -174,7 +162,7 @@ SPObject *Selection::_objectForXMLNode(Inkscape::XML::Node *repr) const { } size_t Selection::numberOfLayers() { - std::vector const items = const_cast(this)->itemList(); + std::vector const items = const_cast(this)->items(); std::set layers; for ( std::vector::const_iterator iter=items.begin();iter!=items.end(); ++iter) { SPObject *layer = _layers->layerForObject(*iter); @@ -185,7 +173,7 @@ size_t Selection::numberOfLayers() { } size_t Selection::numberOfParents() { - std::vector const items = const_cast(this)->itemList(); + std::vector const items = const_cast(this)->items(); std::set parents; for ( std::vector::const_iterator iter=items.begin();iter!=items.end(); ++iter) { SPObject *parent = (*iter)->parent; -- cgit v1.2.3 From 3c593bb8da3357514ff5b4f3154d08c4508ad47e Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 20 Jul 2016 11:01:17 +0200 Subject: Changed arguments and names of selection chemistry functions (bzr r14954.1.22) --- src/selection.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/selection.cpp') diff --git a/src/selection.cpp b/src/selection.cpp index 09eaf6c0e..bdd4f0dc7 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -27,15 +27,16 @@ #include "sp-shape.h" #include "sp-path.h" +#include "desktop.h" #include "document.h" #define SP_SELECTION_UPDATE_PRIORITY (G_PRIORITY_HIGH_IDLE + 1) namespace Inkscape { -Selection::Selection(LayerModel *layers, SPDesktop *desktop) : +Selection::Selection(LayerModel *layers, SPDesktop *desktop): + ObjectSet(desktop), _layers(layers), - _desktop(desktop), _selection_context(NULL), _flags(0), _idle(0) -- cgit v1.2.3 From 532f77b14a76fc04e6bdeca3625f9a55b5f11bdf Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 25 Oct 2016 00:58:43 +0200 Subject: CPPification: almost all sp_object_set_whatever and sp_selection_whatever global functions are now methods of ObjectSet*, with these additional benefits: - They can now act on any SelectionSet, not just the current selection; - Whenever possible, they don't need a desktop anymore and can run if called from GUI. I hope I did not break too many things in the process. *: So instead of callink sp_selection_move(desktop,x,y), you call myobjectset->move(x,y) (bzr r15189) --- src/selection.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/selection.cpp') diff --git a/src/selection.cpp b/src/selection.cpp index bdd4f0dc7..3e56e47fd 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -119,15 +119,7 @@ void Selection::set(SPObject *object, bool persist_selection_context) { } void Selection::setReprList(std::vector const &list) { - clear(); - - for (std::vector::const_reverse_iterator iter = list.rbegin(); iter != list.rend(); ++iter) { - SPObject *obj = _objectForXMLNode(*iter); - if (obj) { - add(obj); - } - } - + ObjectSet::setReprList(list); _emitChanged(); } -- cgit v1.2.3 From d37444eade200b5e527a89164a39bc2894addf6f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Tue, 25 Oct 2016 12:03:33 +0200 Subject: Fix signals (bzr r15191) --- src/selection.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/selection.cpp') diff --git a/src/selection.cpp b/src/selection.cpp index 3e56e47fd..65e0e1e97 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -113,16 +113,6 @@ SPObject *Selection::activeContext() { return _layers->currentLayer(); } -void Selection::set(SPObject *object, bool persist_selection_context) { - ObjectSet::set(object); - _emitChanged(persist_selection_context); -} - -void Selection::setReprList(std::vector const &list) { - ObjectSet::setReprList(list); - _emitChanged(); -} - std::vector Selection::getSnapPoints(SnapPreferences const *snapprefs) const { std::vector p; -- cgit v1.2.3