summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorroot <root@jtx.marker.es>2013-03-11 23:48:05 +0000
committerroot <root@jtx.marker.es>2013-03-11 23:48:05 +0000
commitb2981a3b8f54bccfa45c76f57b38c9c93808d2fc (patch)
tree59eae63d752f70b5ad26acc2852f82ebbb9f1563 /src/ui
parentMerge from trunk (diff)
downloadinkscape-b2981a3b8f54bccfa45c76f57b38c9c93808d2fc.tar.gz
inkscape-b2981a3b8f54bccfa45c76f57b38c9c93808d2fc.zip
~sub fix, double click to reset default handles and control to 10% step
(bzr r11950.1.51)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/tool/multi-path-manipulator.cpp4
-rw-r--r--src/ui/tool/node.cpp68
-rw-r--r--src/ui/tool/node.h3
3 files changed, 69 insertions, 6 deletions
diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp
index c9e35e5b2..2ef8c1766 100644
--- a/src/ui/tool/multi-path-manipulator.cpp
+++ b/src/ui/tool/multi-path-manipulator.cpp
@@ -296,6 +296,7 @@ void MultiPathManipulator::invertSelectionInSubpaths()
invokeForAll(&PathManipulator::invertSelectionInSubpaths);
}
+
void MultiPathManipulator::setNodeType(NodeType type)
{
if (_selection.empty()) return;
@@ -307,7 +308,7 @@ void MultiPathManipulator::setNodeType(NodeType type)
Node *node = dynamic_cast<Node*>(*i);
if (node) {
retract_handles &= (node->type() == NODE_CUSP);
- node->setType(type);
+ node->setType(type,true);
}
}
@@ -324,6 +325,7 @@ void MultiPathManipulator::setNodeType(NodeType type)
_done(retract_handles ? _("Retract handles") : _("Change node type"));
}
+
void MultiPathManipulator::setSegmentType(SegmentType type)
{
if (_selection.empty()) return;
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index e7d62d619..bee2cc477 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -29,6 +29,9 @@
#include "ui/tool/node.h"
#include "ui/tool/path-manipulator.h"
#include <gdk/gdkkeysyms.h>
+//BSpline
+#include <math.h>
+//BSpline End;
namespace {
@@ -146,10 +149,11 @@ void Handle::move(Geom::Point const &new_pos)
Set &nodes = _parent->_selection.allPoints();
for (Set::iterator i = nodes.begin(); i != nodes.end(); ++i) {
Node *n = static_cast<Node*>(*i);
- _parent->_selection.erase(n);
- }
- //if(!_parent->selected())
- _parent->_selection.insert(_parent);
+ if(n != _parent)
+ _parent->_selection.erase(n);
+ }
+ if(!_parent->selected())
+ _parent->_selection.insert(_parent);
}
//BSpline End
@@ -307,12 +311,33 @@ bool Handle::_eventHandler(SPEventContext *event_context, GdkEvent *event)
break;
default: break;
}
+ //BSpline
+ case GDK_2BUTTON_PRESS:
+ handle_2button_press();
+ break;
+ //BSpline End
default: break;
}
return ControlPoint::_eventHandler(event_context, event);
}
+//BSpline
+void Handle::handle_2button_press(){
+ if(_pm().isBSpline()){
+ Handle *h = NULL;
+ Handle *h2 = NULL;
+ double pos = 0;
+ h = this;
+ setPosition(_pm().BSplineHandleReposition(h,0.3334));
+ pos = _pm().BSplineHandlePosition(h);
+ h2 = this->other();
+ this->other()->setPosition(_pm().BSplineHandleReposition(h2,pos));
+ _pm().update();
+ }
+}
+//BSpline End
+
bool Handle::grabbed(GdkEventMotion *)
{
_saved_other_pos = other()->position();
@@ -360,6 +385,16 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event)
ctrl_constraint = Inkscape::Snapper::SnapConstraint(parent_pos, parent_pos - perp_pos);
}
new_pos = result;
+ //BSpline
+ if(_pm().isBSpline()){
+ Handle *h = NULL;
+ double pos = 0;
+ h = this;
+ setPosition(new_pos);
+ pos = ceilf(_pm().BSplineHandlePosition(h)*10)/10;
+ new_pos=_pm().BSplineHandleReposition(h,pos);
+ }
+ //BSpline End
}
std::vector<Inkscape::SnapCandidatePoint> unselected;
@@ -728,7 +763,7 @@ void Node::updateHandles()
_front._handleControlStyling();
_back._handleControlStyling();
}
-
+
void Node::setType(NodeType type, bool update_handles)
{
@@ -738,6 +773,27 @@ void Node::setType(NodeType type, bool update_handles)
return;
}
+ //BSpline
+ if(_pm().isBSpline()){
+ if (isEndNode()) return;
+ Handle* front = &_front;
+ Handle* back = &_back;
+ double pos = 0.3334;
+ switch (type) {
+ case NODE_CUSP:
+ if(update_handles)
+ pos = 0;
+ else
+ pos = _pm().BSplineHandlePosition(front);;
+ break;
+ default: break;
+ }
+ type = NODE_CUSP;
+ _front.setPosition(_pm().BSplineHandleReposition(front,pos));
+ _back.setPosition(_pm().BSplineHandleReposition(back,pos));
+ }
+ //BSpline End
+
// if update_handles is true, adjust handle positions to match the node type
// handle degenerate handles appropriately
if (update_handles) {
@@ -821,7 +877,9 @@ void Node::setType(NodeType type, bool update_handles)
default: break;
}
}
+
_type = type;
+
_setControlType(nodeTypeToCtrlType(_type));
updateState();
}
diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h
index 591dd8532..e74698b1a 100644
--- a/src/ui/tool/node.h
+++ b/src/ui/tool/node.h
@@ -107,6 +107,9 @@ protected:
Handle(NodeSharedData const &data, Geom::Point const &initial_pos, Node *parent);
virtual bool _eventHandler(SPEventContext *event_context, GdkEvent *event);
+ //Bspline
+ virtual void handle_2button_press();
+ //BSpline End
virtual void dragged(Geom::Point &new_pos, GdkEventMotion *event);
virtual bool grabbed(GdkEventMotion *event);
virtual void ungrabbed(GdkEventButton *event);