summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2017-02-28 22:07:32 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2017-02-28 22:07:32 +0000
commitdbe9eae8b96400c233e21d4b47046345ecbea26e (patch)
tree75c36c494ad4dd7131b178fed97d85413d394978 /src
parentmerge minor refactoring (diff)
downloadinkscape-dbe9eae8b96400c233e21d4b47046345ecbea26e.tar.gz
inkscape-dbe9eae8b96400c233e21d4b47046345ecbea26e.zip
Makes selection complexity linear in the number of selected objects instead of quadratic due to too many signals sent
Fixed bugs: - https://launchpad.net/bugs/1666714 (bzr r15556)
Diffstat (limited to 'src')
-rw-r--r--src/object-set.cpp8
-rw-r--r--src/object-set.h6
2 files changed, 9 insertions, 5 deletions
diff --git a/src/object-set.cpp b/src/object-set.cpp
index 65e7d45d6..8fcb4215e 100644
--- a/src/object-set.cpp
+++ b/src/object-set.cpp
@@ -20,7 +20,7 @@
namespace Inkscape {
-bool ObjectSet::add(SPObject* object) {
+bool ObjectSet::add(SPObject* object, bool nosignal) {
g_return_val_if_fail(object != NULL, false);
g_return_val_if_fail(SP_IS_OBJECT(object), false);
@@ -37,7 +37,8 @@ bool ObjectSet::add(SPObject* object) {
_removeDescendantsFromSet(object);
_add(object);
- _emitSignals();
+ if (!nosignal)
+ _emitSignals();
return true;
}
@@ -246,9 +247,10 @@ void ObjectSet::setReprList(std::vector<XML::Node*> const &list) {
for (auto iter = list.rbegin(); iter != list.rend(); ++iter) {
SPObject *obj = document()->getObjectById((*iter)->attribute("id"));
if (obj) {
- add(obj);
+ add(obj, true);
}
}
+ _emitSignals();
if(dynamic_cast<Inkscape::Selection*>(this))
return dynamic_cast<Inkscape::Selection*>(this)->_emitChanged();//
}
diff --git a/src/object-set.h b/src/object-set.h
index 7c224f640..02259824c 100644
--- a/src/object-set.h
+++ b/src/object-set.h
@@ -143,8 +143,9 @@ public:
* Add an SPObject to the set of selected objects.
*
* @param obj the SPObject to add
+ * @param nosignal true if no signals should be sent
*/
- bool add(SPObject* object);
+ bool add(SPObject* object, bool nosignal = false);
/**
* Add an XML node's SPObject to the set of selected objects.
@@ -300,9 +301,10 @@ public:
addList(const std::vector<T*> &objs) {
for (auto obj: objs) {
if (!includes(obj)) {
- add(obj);
+ add(obj, true);
}
}
+ _emitSignals();
}
/** Returns the bounding rectangle of the selection. */