summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-08-12 21:37:42 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-08-12 21:37:42 +0000
commit78d439326a4dd26599853295e62b9f63136fc2f3 (patch)
treefc5159d3cbd5ae8e3564c961c8c3f2cc18e96e0f /src/live_effects
parentUpdate to experimental r13465 (diff)
parentupdating pot files (diff)
downloadinkscape-78d439326a4dd26599853295e62b9f63136fc2f3.tar.gz
inkscape-78d439326a4dd26599853295e62b9f63136fc2f3.zip
Update to experimental r13479
(bzr r13090.1.103)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/lpe-simplify.cpp56
-rw-r--r--src/live_effects/parameter/filletchamferpointarray.cpp82
2 files changed, 75 insertions, 63 deletions
diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp
index 1a02375cd..a817f30f1 100644
--- a/src/live_effects/lpe-simplify.cpp
+++ b/src/live_effects/lpe-simplify.cpp
@@ -202,33 +202,27 @@ LPESimplify::generateHelperPath(Geom::PathVector result)
if(nodes){
drawNode(curve_it1->initialPoint());
}
- while (curve_it2 != curve_endit) {
- cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
- if (cubic) {
- if(handles){
- drawHandle((*cubic)[1]);
- drawHandle((*cubic)[2]);
- drawHandleLine((*cubic)[0],(*cubic)[1]);
- drawHandleLine((*cubic)[2],(*cubic)[3]);
+ while (curve_it1 != curve_endit) {
+ cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
+ if (cubic) {
+ if(handles) {
+ if(!are_near((*cubic)[0],(*cubic)[1])){
+ drawHandle((*cubic)[1]);
+ drawHandleLine((*cubic)[0],(*cubic)[1]);
+ }
+ if(!are_near((*cubic)[3],(*cubic)[2])){
+ drawHandle((*cubic)[2]);
+ drawHandleLine((*cubic)[3],(*cubic)[2]);
+ }
+ }
+ }
+ if(nodes) {
+ drawNode(curve_it1->finalPoint());
+ }
+ ++curve_it1;
+ if(curve_it2 != curve_endit){
+ ++curve_it2;
}
- }
- if(nodes){
- drawNode(curve_it1->finalPoint());
- }
- ++curve_it1;
- ++curve_it2;
- }
- cubic = dynamic_cast<Geom::CubicBezier const *>(&*curve_it1);
- if (cubic) {
- if(handles){
- drawHandle((*cubic)[1]);
- drawHandle((*cubic)[2]);
- drawHandleLine((*cubic)[0],(*cubic)[1]);
- drawHandleLine((*cubic)[2],(*cubic)[3]);
- }
- }
- if(nodes){
- drawNode(curve_it1->finalPoint());
}
}
}
@@ -238,13 +232,12 @@ LPESimplify::drawNode(Geom::Point p)
{
double r = helper_size/0.67;
char const * svgd;
- svgd = "M 0.999993,0.5 C 1.000065,0.7757576 0.7761859,1 0.4999926,1 0.2237994,1 -7.933901e-5,0.7757576 -7.339015e-6,0.5 -7.933901e-5,0.2242424 0.2237994,0 0.4999926,0 0.7761859,0 1.000065,0.2242424 0.999993,0.5 Z m -0.058561,0 C 0.9414949,0.74327 0.7438375,0.9416286 0.4999928,0.9416286 0.2561481,0.9416286 0.0584908,0.74327 0.0585543,0.5 0.0584908,0.25673 0.2561481,0.0583714 0.4999928,0.0583714 0.7438375,0.0583714 0.9414949,0.25673 0.9414313,0.5 Z m -0.3828447,0 c 8.5e-6,0.030303 -0.026228,0.060606 -0.058593,0.060606 -0.032366,0 -0.058603,-0.030303 -0.058593,-0.060606 -8.5e-6,-0.030303 0.026227,-0.060606 0.058593,-0.060606 0.032366,0 0.058603,0.030303 0.058593,0.060606 z";
+ svgd = "M 0.55,0.5 A 0.05,0.05 0 0 1 0.5,0.55 0.05,0.05 0 0 1 0.45,0.5 0.05,0.05 0 0 1 0.5,0.45 0.05,0.05 0 0 1 0.55,0.5 Z M 0,0 1,0 1,1 0,1 Z";
Geom::PathVector pathv = sp_svg_read_pathv(svgd);
pathv *= Geom::Affine(r,0,0,r,0,0);
pathv += p - Geom::Point(0.5*r,0.5*r);
hp.push_back(pathv[0]);
hp.push_back(pathv[1]);
- hp.push_back(pathv[2]);
}
void
@@ -252,7 +245,7 @@ LPESimplify::drawHandle(Geom::Point p)
{
double r = helper_size/0.67;
char const * svgd;
- svgd = "M 0.6999623,0.35 C 0.7000128,0.5430303 0.5433044,0.7 0.3499775,0.7 0.1566506,0.7 -5.778776e-5,0.5430303 -7.344202e-6,0.35 -5.778776e-5,0.1569697 0.1566506,0 0.3499775,0 0.5433044,0 0.7000128,0.1569697 0.6999623,0.35 Z";
+ svgd = "M 0.7,0.35 A 0.35,0.35 0 0 1 0.35,0.7 0.35,0.35 0 0 1 0,0.35 0.35,0.35 0 0 1 0.35,0 0.35,0.35 0 0 1 0.7,0.35 Z";
Geom::PathVector pathv = sp_svg_read_pathv(svgd);
pathv *= Geom::Affine(r,0,0,r,0,0);
pathv += p - Geom::Point(0.35*r,0.35*r);
@@ -265,6 +258,11 @@ LPESimplify::drawHandleLine(Geom::Point p,Geom::Point p2)
{
Geom::Path path;
path.start( p );
+ double diameter = helper_size/0.67;
+ if(helper_size > 0.0 && Geom::distance(p,p2) > (diameter * 0.35)){
+ Geom::Ray ray2(p, p2);
+ p2 = p2 - Geom::Point::polar(ray2.angle(),(diameter * 0.35));
+ }
path.appendNew<Geom::LineSegment>( p2 );
hp.push_back(path);
}
diff --git a/src/live_effects/parameter/filletchamferpointarray.cpp b/src/live_effects/parameter/filletchamferpointarray.cpp
index 33096819c..47cdd27cc 100644
--- a/src/live_effects/parameter/filletchamferpointarray.cpp
+++ b/src/live_effects/parameter/filletchamferpointarray.cpp
@@ -333,10 +333,10 @@ void FilletChamferPointArrayParam::recalculate_knots(
result.push_back(Point(xPos, 0));
}
++curve_it1;
- ++curve_it2;
if (curve_it2 != curve_endit) {
- counter++;
+ ++curve_it2;
}
+ counter++;
counterCurves++;
}
}
@@ -553,31 +553,40 @@ Point FilletChamferPointArrayParamKnotHolderEntity::knot_get() const
void FilletChamferPointArrayParamKnotHolderEntity::knot_click(guint state)
{
if (state & GDK_CONTROL_MASK) {
- using namespace Geom;
- double type = _pparam->_vector.at(_index)[Y] + 1;
- if (type > 4) {
- type = 1;
- }
- _pparam->_vector.at(_index) = Point(_pparam->_vector.at(_index)[X], type);
- _pparam->param_set_and_write_new_value(_pparam->_vector);
- sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
- const gchar *tip;
- if (type == 3) {
- tip = _("<b>Chamfer</b>: <b>Ctrl+click</b> toogle type, "
- "<b>Shift+click</b> open dialog");
- } else if (type == 2) {
- tip = _("<b>Inverse Fillet</b>: <b>Ctrl+click</b> toogle type, "
- "<b>Shift+click</b> open dialog");
- } else if (type == 1) {
- tip = _("<b>Fillet</b>: <b>Ctrl+click</b> toogle type, "
- "<b>Shift+click</b> open dialog");
- } else {
- tip = _("<b>Double Chamfer</b>: <b>Ctrl+click</b> toogle type, "
- "<b>Shift+click</b> open dialog");
+ if (state & GDK_MOD1_MASK) {
+ _pparam->_vector.at(_index) = Point(_index, _pparam->_vector.at(_index)[Y]);
+ _pparam->param_set_and_write_new_value(_pparam->_vector);
+ sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
+ }else{
+ using namespace Geom;
+ double type = _pparam->_vector.at(_index)[Y] + 1;
+ if (type > 4) {
+ type = 1;
+ }
+ _pparam->_vector.at(_index) = Point(_pparam->_vector.at(_index)[X], type);
+ _pparam->param_set_and_write_new_value(_pparam->_vector);
+ sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false);
+ const gchar *tip;
+ if (type == 3) {
+ tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
+ } else if (type == 2) {
+ tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toogle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
+ } else if (type == 1) {
+ tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toogle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
+ } else {
+ tip = _("<b>Double Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
+ }
+ this->knot->tip = g_strdup(tip);
+ this->knot->show();
}
- this->knot->tip = g_strdup(tip);
- this->knot->show();
- //}
} else if ((state & GDK_MOD1_MASK) || (state & GDK_SHIFT_MASK)) {
Geom::Point offset = Geom::Point(_pparam->_vector.at(_index).x(),
_pparam->_vector.at(_index).y());
@@ -620,18 +629,23 @@ void FilletChamferPointArrayParam::addKnotHolderEntities(KnotHolder *knotholder,
}
const gchar *tip;
if (_vector[i][Y] == 3) {
- tip = _("<b>Chamfer</b>: <b>Ctrl+click</b> toogle type, "
- "<b>Shift+click</b> open dialog");
+ tip = _("<b>Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
} else if (_vector[i][Y] == 2) {
- tip = _("<b>Inverse Fillet</b>: <b>Ctrl+click</b> toogle type, "
- "<b>Shift+click</b> open dialog");
+ tip = _("<b>Inverse Fillet</b>: <b>Ctrl+Click</b> toogle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
} else if (_vector[i][Y] == 1) {
- tip = _("<b>Fillet</b>: <b>Ctrl+click</b> toogle type, "
- "<b>Shift+click</b> open dialog");
+ tip = _("<b>Fillet</b>: <b>Ctrl+Click</b> toogle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
} else {
- tip = _("<b>Double Chamfer</b>: <b>Ctrl+click</b> toogle type, "
- "<b>Shift+click</b> open dialog");
+ tip = _("<b>Double Chamfer</b>: <b>Ctrl+Click</b> toogle type, "
+ "<b>Shift+Click</b> open dialog, "
+ "<b>Ctrl+Alt+Click</b> reset");
}
+
FilletChamferPointArrayParamKnotHolderEntity *e =
new FilletChamferPointArrayParamKnotHolderEntity(this, i);
e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, _(tip),