diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2016-10-25 10:03:33 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2016-10-25 10:03:33 +0000 |
| commit | d37444eade200b5e527a89164a39bc2894addf6f (patch) | |
| tree | ca6325f3f2dee50786503cbb3dc0ef623fb89d81 | |
| parent | Fix test (diff) | |
| download | inkscape-d37444eade200b5e527a89164a39bc2894addf6f.tar.gz inkscape-d37444eade200b5e527a89164a39bc2894addf6f.zip | |
Fix signals
(bzr r15191)
| -rw-r--r-- | src/object-set.cpp | 22 | ||||
| -rw-r--r-- | src/object-set.h | 14 | ||||
| -rw-r--r-- | src/selection.cpp | 10 | ||||
| -rw-r--r-- | src/selection.h | 16 |
4 files changed, 23 insertions, 39 deletions
diff --git a/src/object-set.cpp b/src/object-set.cpp index 92bcf6b07..fd0b908d1 100644 --- a/src/object-set.cpp +++ b/src/object-set.cpp @@ -232,13 +232,29 @@ Inkscape::XML::Node *ObjectSet::singleRepr() { return obj ? obj->getRepr() : nullptr; } -void ObjectSet::set(SPObject *object) { +void ObjectSet::set(SPObject *object, bool persist_selection_context) { _clear(); _add(object); - // can't emit signal here due to boolean argument in Selection -// _emitSignals(); + if(dynamic_cast<Inkscape::Selection*>(this)) + return dynamic_cast<Inkscape::Selection*>(this)->_emitChanged(persist_selection_context); +} + +void ObjectSet::setReprList(std::vector<XML::Node*> const &list) { + if(!document()) + return; + clear(); + for (auto iter = list.rbegin(); iter != list.rend(); ++iter) { + SPObject *obj = document()->getObjectById((*iter)->attribute("id")); + if (obj) { + add(obj); + } + } + if(dynamic_cast<Inkscape::Selection*>(this)) + return dynamic_cast<Inkscape::Selection*>(this)->_emitChanged();// } + + Geom::OptRect ObjectSet::bounds(SPItem::BBoxType type) const { return (type == SPItem::GEOMETRIC_BBOX) ? diff --git a/src/object-set.h b/src/object-set.h index dc0602e06..8fa20e454 100644 --- a/src/object-set.h +++ b/src/object-set.h @@ -165,7 +165,7 @@ public: * * @param obj the object to select */ - void set(SPObject *object); + void set(SPObject *object, bool persist_selection_context = false); void set(XML::Node *repr) { if(document() && repr) set(document()->getObjectById(repr->attribute("id"))); @@ -264,17 +264,7 @@ public: * * @param list the repr list to add */ - void setReprList(std::vector<XML::Node*> const &list) { - if(!document()) - return; - clear(); - for (auto iter = list.rbegin(); iter != list.rend(); ++iter) { - SPObject *obj = document()->getObjectById((*iter)->attribute("id")); - if (obj) { - add(obj); - } - } - } + void setReprList(std::vector<XML::Node*> const &list); /** * Adds the specified objects to selection, without deselecting first. 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<XML::Node*> const &list) { - ObjectSet::setReprList(list); - _emitChanged(); -} - std::vector<Inkscape::SnapCandidatePoint> Selection::getSnapPoints(SnapPreferences const *snapprefs) const { std::vector<Inkscape::SnapCandidatePoint> p; diff --git a/src/selection.h b/src/selection.h index cf00ba1f4..54826970f 100644 --- a/src/selection.h +++ b/src/selection.h @@ -59,6 +59,7 @@ class Selection : public Inkscape::GC::Managed<>, public Inkscape::GC::Anchored, public ObjectSet { +friend class ObjectSet; public: /** * Constructs an selection object, bound to a particular @@ -98,12 +99,7 @@ public: add(_objectForXMLNode(repr)); } - /** - * Set the selection to a single specific object. - * - * @param obj the object to select - */ - void set(SPObject *obj, bool persist_selection_context = false); + using ObjectSet::set; /** * Set the selection to an XML node's SPObject. @@ -127,14 +123,6 @@ public: remove(_objectForXMLNode(repr)); } - /** - * Clears the selection and selects the specified objects. - * - * @param repr a list of xml nodes for the items to select - */ - void setReprList(std::vector<XML::Node*> const &reprs); - - using ObjectSet::includes; /** |
