summaryrefslogtreecommitdiffstats
path: root/src/ui/tool/control-point-selection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/tool/control-point-selection.cpp')
-rw-r--r--src/ui/tool/control-point-selection.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp
index 1fb98d78f..308359c33 100644
--- a/src/ui/tool/control-point-selection.cpp
+++ b/src/ui/tool/control-point-selection.cpp
@@ -1,5 +1,6 @@
-/** @file
- * Node selection - implementation
+/**
+ * @file
+ * Node selection - implementation.
*/
/* Authors:
* Krzysztof KosiƄski <tweenk.pl@gmail.com>
@@ -16,13 +17,14 @@
#include "ui/tool/event-utils.h"
#include "ui/tool/selectable-control-point.h"
#include "ui/tool/transform-handle-set.h"
+#include "ui/tool/node.h"
namespace Inkscape {
namespace UI {
/**
* @class ControlPointSelection
- * @brief Group of selected control points.
+ * Group of selected control points.
*
* Some operations can be performed on all selected points regardless of their type, therefore
* this class is also a Manipulator. It handles the transformations of points using
@@ -432,7 +434,7 @@ bool ControlPointSelection::_keyboardMove(GdkEventKey const &event, Geom::Point
delta /= _desktop->current_zoom();
} else {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- double nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000);
+ double nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000, "px");
delta *= nudge;
}
@@ -445,8 +447,10 @@ bool ControlPointSelection::_keyboardMove(GdkEventKey const &event, Geom::Point
return true;
}
-/** @brief Computes the distance to the farthest corner of the bounding box.
- * Used to determine what it means to "rotate by one pixel". */
+/**
+ * Computes the distance to the farthest corner of the bounding box.
+ * Used to determine what it means to "rotate by one pixel".
+ */
double ControlPointSelection::_rotationRadius(Geom::Point const &rc)
{
if (empty()) return 1.0; // some safe value
@@ -459,7 +463,8 @@ double ControlPointSelection::_rotationRadius(Geom::Point const &rc)
return maxlen;
}
-/** Rotates the selected points in the given direction according to the modifier state
+/**
+ * Rotates the selected points in the given direction according to the modifier state
* from the supplied event.
* @param event Key event to take modifier state from
* @param dir Direction of rotation (math convention: 1 = counterclockwise, -1 = clockwise)
@@ -533,7 +538,7 @@ bool ControlPointSelection::_keyboardScale(GdkEventKey const &event, int dir)
length_change = 1.0 / _desktop->current_zoom() * dir;
} else {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- length_change = prefs->getDoubleLimited("/options/defaultscale/value", 2, 1, 1000);
+ length_change = prefs->getDoubleLimited("/options/defaultscale/value", 2, 1, 1000, "px");
length_change *= dir;
}
double scale = (maxext + length_change) / maxext;
@@ -642,13 +647,24 @@ bool ControlPointSelection::event(GdkEvent *event)
return false;
}
-std::vector<Inkscape::SnapCandidatePoint> ControlPointSelection::getOriginalPoints()
+void ControlPointSelection::getOriginalPoints(std::vector<Inkscape::SnapCandidatePoint> &pts)
{
- std::vector<Inkscape::SnapCandidatePoint> points;
+ pts.clear();
for (iterator i = _points.begin(); i != _points.end(); ++i) {
- points.push_back(Inkscape::SnapCandidatePoint(_original_positions[*i], SNAPSOURCE_NODE_HANDLE));
+ pts.push_back(Inkscape::SnapCandidatePoint(_original_positions[*i], SNAPSOURCE_NODE_HANDLE));
+ }
+}
+
+void ControlPointSelection::getUnselectedPoints(std::vector<Inkscape::SnapCandidatePoint> &pts)
+{
+ pts.clear();
+ ControlPointSelection::Set &nodes = this->allPoints();
+ for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) {
+ if (!(*i)->selected()) {
+ Node *n = static_cast<Node*>(*i);
+ pts.push_back(n->snapCandidatePoint());
+ }
}
- return points;
}
void ControlPointSelection::setOriginalPoints()
@@ -659,7 +675,6 @@ void ControlPointSelection::setOriginalPoints()
}
}
-
} // namespace UI
} // namespace Inkscape