diff --git a/src/selection.cpp b/src/selection.cpp
index 2b143dd5a3f379c707be65604113fd2c2d84ed92..d3b667a128a0e76cdd5650ed276898bc41af71ba 100644 (file)
--- a/src/selection.cpp
+++ b/src/selection.cpp
#include "sp-shape.h"
#include "sp-path.h"
#include "sp-item-group.h"
+#include "box3d.h"
#include <sigc++/functors/mem_fun.h>
/* Handler for selected objects "modified" signal */
-void Selection::_schedule_modified(SPObject *obj, guint flags) {
+void Selection::_schedule_modified(SPObject */*obj*/, guint flags) {
if (!this->_idle) {
/* Request handling to be run in _idle loop */
this->_idle = g_idle_add_full(SP_SELECTION_UPDATE_PRIORITY, GSourceFunc(&Selection::_emit_modified), this, NULL);
_objs = g_slist_prepend(_objs, obj);
+ if (SP_IS_BOX3D(obj)) {
+ // keep track of selected boxes for transformations
+ box3d_add_to_selection(SP_BOX3D(obj));
+ }
+
_release_connections[obj] = obj->connectRelease(sigc::mem_fun(*this, (void (Selection::*)(SPObject *))&Selection::remove));
_modified_connections[obj] = obj->connectModified(sigc::mem_fun(*this, &Selection::_schedule_modified));
}
_release_connections[obj].disconnect();
_release_connections.erase(obj);
+ if (SP_IS_BOX3D(obj)) {
+ // keep track of selected boxes for transformations
+ box3d_remove_from_selection(SP_BOX3D(obj));
+ }
+
_objs = g_slist_remove(_objs, obj);
}
/**
* Compute the list of points in the selection that are to be considered for snapping.
- * This includes all special points of each item in the selection, except path nodes
*/
-std::vector<NR::Point> Selection::getSnapPoints() const {
+std::vector<NR::Point> Selection::getSnapPoints(bool includeItemCenter) const {
GSList const *items = const_cast<Selection *>(this)->itemList();
std::vector<NR::Point> p;
for (GSList const *iter = items; iter != NULL; iter = iter->next) {
- // getSnapPoints() is only being used in the selector tool, which should
- // not snap path nodes. Only the node tool should snap those.
SPItem *this_item = SP_ITEM(iter->data);
- if (!SP_IS_PATH(this_item)) {
- // Only snap if we don't have a path at hand
- // (Same check occurs in sp-item-group)
- sp_item_snappoints(this_item, SnapPointsIter(p));
- }
+ sp_item_snappoints(this_item, false, SnapPointsIter(p));
//Include the transformation origin for snapping
//For a group only the group's origin is considered
- p.push_back(this_item->getCenter());
+ if (includeItemCenter) {
+ p.push_back(this_item->getCenter());
+ }
}
return p;
std::vector<NR::Point> p;
for (GSList const *iter = items; iter != NULL; iter = iter->next) {
- sp_item_snappoints(SP_ITEM(iter->data), SnapPointsIter(p));
+ sp_item_snappoints(SP_ITEM(iter->data), false, SnapPointsIter(p));
}
std::vector<NR::Point> pHull;