summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorroot <root@jtx.marker.es>2013-04-07 22:50:31 +0000
committerroot <root@jtx.marker.es>2013-04-07 22:50:31 +0000
commit30858428c74d1fa0f119f40b99fa5e51836d8599 (patch)
tree62190b9e91a164a3df6a69817012260e02f96838 /src
parentUpdate to trunk (diff)
downloadinkscape-30858428c74d1fa0f119f40b99fa5e51836d8599.tar.gz
inkscape-30858428c74d1fa0f119f40b99fa5e51836d8599.zip
Change width only for selected nodes by widget
(bzr r11950.1.83)
Diffstat (limited to 'src')
-rw-r--r--src/libavoid/makefile17
-rw-r--r--src/live_effects/lpe-bspline.cpp46
-rw-r--r--src/ui/tool/node.cpp2
-rw-r--r--src/ui/tool/path-manipulator.cpp18
4 files changed, 42 insertions, 41 deletions
diff --git a/src/libavoid/makefile b/src/libavoid/makefile
deleted file mode 100644
index e4f83a52d..000000000
--- a/src/libavoid/makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Convenience stub makefile to call the real Makefile.
-
-
-
-OBJEXT = o
-
-# Explicit so that it's the default rule.
-all:
- cd .. && $(MAKE) libavoid/all
-
-clean %.a %.$(OBJEXT):
- cd .. && $(MAKE) libavoid/$@
-
-.PHONY: all clean
-
-.SUFFIXES:
-.SUFFIXES: .a .$(OBJEXT)
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp
index 389c11a23..e93fd62d2 100644
--- a/src/live_effects/lpe-bspline.cpp
+++ b/src/live_effects/lpe-bspline.cpp
@@ -10,6 +10,7 @@
#include <glibmm/i18n.h>
#include "display/curve.h"
#include <2geom/bezier-curve.h>
+#include <2geom/point.h>
#include "helper/geom-curves.h"
#include "live_effects/lpe-bspline.h"
#include "live_effects/lpeobject.h"
@@ -341,6 +342,10 @@ LPEBSpline::changeWeight(double weightValue)
LPEBSpline::doBSplineFromWidget(curve,weightValue);
gchar *str = sp_svg_write_path(curve->get_pathvector());
path->getRepr()->setAttribute("inkscape:original-d", str);
+ if(INK_IS_NODE_TOOL(desktop->event_context)){
+ InkNodeTool *nt = INK_NODE_TOOL(desktop->event_context);
+ nt->desktop->updateNow();
+ }
g_free(str);
curve->unref();
desktop->clearWaitingCursor();
@@ -350,12 +355,8 @@ LPEBSpline::changeWeight(double weightValue)
bool
LPEBSpline::nodeIsSelected(Geom::Point nodePoint, int index){
- volatile int index2 = index;
- volatile Geom::Point aa = nodePoint;
- volatile std::vector<Geom::Point> x2 = points;
if(points.size() > 0){
- volatile double dist = Geom::distance(points[index], nodePoint);
- if(dist == 0 ){
+ if(Geom::are_near(points[index], nodePoint)){
return true;
}
}
@@ -373,9 +374,12 @@ LPEBSpline::doBSplineFromWidget(SPCurve * curve, double weightValue)
Inkscape::UI::ControlPointSelection::Set &selection = nt->_selected_nodes->allPoints();
points.clear();
for (Inkscape::UI::ControlPointSelection::Set::iterator i = selection.begin(); i != selection.end(); ++i){
- if ((*i)->selected()) {
- Inkscape::UI::Node *n = static_cast<Inkscape::UI::Node*>(*i);
- points.push_back(n->position());
+ if(onlySelected){
+ if ((*i)->selected()) {
+ Inkscape::UI::Node *n = static_cast<Inkscape::UI::Node*>(*i);
+ n->bsplineWeight = weightValue;
+ points.insert(points.begin(),desktop->doc2dt(n->position()));
+ }
}
}
}
@@ -469,31 +473,30 @@ LPEBSpline::doBSplineFromWidget(SPCurve * curve, double weightValue)
if(nodeIsSelected(pointAt0,i)){
pointAt1 = SBasisIn.valueAt(weightValue);
pointAt1 = Geom::Point(pointAt1[X] + 0.0625,pointAt1[Y] + 0.0625);
+ i++;
}else{
pointAt1 = (*cubic)[1];
}
}else{
if(nodeIsSelected(pointAt0,i)){
pointAt1 = in->first_segment()->initialPoint();
+ i++;
}else{
pointAt1 = (*cubic)[1];
}
}
- i++;
if((!ignoreCusp || !Geom::are_near((*cubic)[2],in->first_segment()->finalPoint())) && weightValue !=0){
if(nodeIsSelected(pointAt3,i)){
pointAt2 = SBasisIn.valueAt(1-weightValue);
pointAt2 = Geom::Point(pointAt2[X] + 0.0625,pointAt2[Y] + 0.0625);
}else{
pointAt2 = (*cubic)[2];
- i--;
}
}else{
if(nodeIsSelected(pointAt3,i)){
pointAt2 = in->first_segment()->finalPoint();
}else{
pointAt2 = (*cubic)[2];
- i--;
}
}
}else{
@@ -501,20 +504,22 @@ LPEBSpline::doBSplineFromWidget(SPCurve * curve, double weightValue)
if(nodeIsSelected(pointAt0,i)){
pointAt1 = SBasisIn.valueAt(weightValue);
pointAt1 = Geom::Point(pointAt1[X] + 0.0625,pointAt1[Y] + 0.0625);
+ i++;
}else{
pointAt1 = in->first_segment()->initialPoint();
}
- i++;
if(nodeIsSelected(pointAt3,i)){
pointAt2 = SBasisIn.valueAt(weightValue);
pointAt2 = Geom::Point(pointAt2[X] + 0.0625,pointAt2[Y] + 0.0625);
}else{
pointAt2 = in->first_segment()->finalPoint();
- i--;
}
}else{
pointAt1 = in->first_segment()->initialPoint();
pointAt2 = in->first_segment()->finalPoint();
+ if(nodeIsSelected(pointAt0,i)){
+ i++;
+ }
}
}
}
@@ -560,51 +565,50 @@ LPEBSpline::doBSplineFromWidget(SPCurve * curve, double weightValue)
if(nodeIsSelected(nextPointAt0,i)){
nextPointAt1 = SBasisOut.valueAt(weightValue);
nextPointAt1 = Geom::Point(nextPointAt1[X] + 0.0625,nextPointAt1[Y] + 0.0625);
+ if (path_it->closed()) i++;
}else{
nextPointAt1 = (*cubic)[1];
}
}else{
if(nodeIsSelected(nextPointAt0,i)){
- nextPointAt1 = out->first_segment()->initialPoint();
+ nextPointAt1 = out->first_segment()->initialPoint();
+ if (path_it->closed()) i++;
}else{
nextPointAt1 = (*cubic)[1];
}
}
- i++;
if((!ignoreCusp || !Geom::are_near((*cubic)[2],out->first_segment()->finalPoint())) && weightValue !=0){
if(nodeIsSelected(nextPointAt3,i)){
nextPointAt2 = SBasisOut.valueAt(1-weightValue);
nextPointAt2 = Geom::Point(nextPointAt2[X] + 0.0625,nextPointAt2[Y] + 0.0625);
}else{
nextPointAt2 = (*cubic)[2];
- i--;
- }
+ }
}else{
if(nodeIsSelected(nextPointAt3,i)){
nextPointAt2 = out->first_segment()->finalPoint();
}else{
nextPointAt2 = (*cubic)[2];
- i--;
- }
+ }
}
}else{
if(!ignoreCusp && weightValue !=0){
if(nodeIsSelected(nextPointAt0,i)){
nextPointAt1 = SBasisOut.valueAt(weightValue);
nextPointAt1 = Geom::Point(nextPointAt1[X] + 0.0625,nextPointAt1[Y] + 0.0625);
+ if (path_it->closed()) i++;
}else{
nextPointAt1 = out->first_segment()->initialPoint();
}
- i++;
if(nodeIsSelected(nextPointAt3,i)){
nextPointAt2 = SBasisOut.valueAt(weightValue);
nextPointAt2 = Geom::Point(nextPointAt2[X] + 0.0625,nextPointAt2[Y] + 0.0625);
}else{
nextPointAt2 = out->first_segment()->finalPoint();
- i--;
}
}else{
nextPointAt1 = out->first_segment()->initialPoint();
+ if (path_it->closed()&&nodeIsSelected(nextPointAt0,i)) i++;
nextPointAt2 = out->first_segment()->finalPoint();
}
}
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index 1f609dfa0..8f1c37649 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -577,8 +577,8 @@ Node::Node(NodeSharedData const &data, Geom::Point const &initial_pos) :
_type(NODE_CUSP),
_handles_shown(false)
{
- // NOTE we do not set type here, because the handles are still degenerate
this->bsplineWeight = 0.3334;
+ // NOTE we do not set type here, because the handles are still degenerate
}
Node const *Node::_next() const
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index be5514e1f..6cad60fee 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -1248,8 +1248,22 @@ Geom::Point PathManipulator::BSplineHandleReposition(Handle *h,double pos){
}
void PathManipulator::BSplineNodeHandlesReposition(Node *n){
- n->front()->setPosition(BSplineHandleReposition(n->front(),n->bsplineWeight));
- n->back()->setPosition(BSplineHandleReposition(n->back(),n->bsplineWeight));
+ if(n->selected()){
+ Node * nextNode = n->nodeToward(n->front());
+ Node * prevNode = n->nodeToward(n->back());
+ double prevPos = 0;
+ double nextPos = 0;
+ if(prevNode)
+ prevPos = BSplineHandlePosition(prevNode->front());
+ if(nextNode)
+ nextPos = BSplineHandlePosition(nextNode->back());
+ n->front()->setPosition(BSplineHandleReposition(n->front(),n->bsplineWeight));
+ n->back()->setPosition(BSplineHandleReposition(n->back(),n->bsplineWeight));
+ if(prevNode)
+ prevNode->front()->setPosition(BSplineHandleReposition(prevNode->front(),prevPos));
+ if(nextNode)
+ nextNode->back()->setPosition(BSplineHandleReposition(nextNode->back(),nextPos));
+ }
}
/** Construct the geometric representation of nodes and handles, update the outline