summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-bspline.cpp44
-rw-r--r--src/live_effects/lpe-bspline.h3
-rw-r--r--src/ui/tool/node.cpp2
-rw-r--r--src/ui/tool/path-manipulator.cpp2
4 files changed, 29 insertions, 22 deletions
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp
index 0cae1dcb6..08ef7ca1b 100644
--- a/src/live_effects/lpe-bspline.cpp
+++ b/src/live_effects/lpe-bspline.cpp
@@ -18,8 +18,8 @@ namespace LivePathEffect {
const double HANDLE_CUBIC_GAP = 0.001;
const double NO_POWER = 0.0;
-const double DEFAULT_START_POWER = 0.3334;
-const double DEFAULT_END_POWER = 0.6667;
+const double DEFAULT_START_POWER = 0.333334;
+const double DEFAULT_END_POWER = 0.666667;
Geom::PathVector hp;
void sp_bspline_drawHandle(Geom::Point p, double helper_size);
@@ -27,17 +27,19 @@ LPEBSpline::LPEBSpline(LivePathEffectObject *lpeobject)
: Effect(lpeobject),
steps(_("Steps with CTRL:"), _("Change number of steps with CTRL pressed"), "steps", &wr, this, 2),
helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 0),
- ignore_cusp(_("Ignore cusp nodes"), _("Change ignoring cusp nodes"), "ignore_cusp", &wr, this, true),
+ apply_cusp(_("Apply on cusp nodes"), _("Apply on cusp nodes"), "apply_cusp", &wr, this, true),
+ apply_non_cusp(_("Apply on non cusp nodes"), _("Apply on non cusp nodes"), "apply_non_cusp", &wr, this, true),
only_selected(_("Change only selected nodes"), _("Change only selected nodes"), "only_selected", &wr, this, false),
- weight(_("Change weight:"), _("Change weight of the effect"), "weight", &wr, this, DEFAULT_START_POWER)
+ weight(_("Change weight %:"), _("Change weight percent of the effect"), "weight", &wr, this, DEFAULT_START_POWER * 100)
{
registerParameter(&weight);
registerParameter(&steps);
registerParameter(&helper_size);
- registerParameter(&ignore_cusp);
+ registerParameter(&apply_cusp);
+ registerParameter(&apply_non_cusp);
registerParameter(&only_selected);
- weight.param_set_range(NO_POWER, 1);
+ weight.param_set_range(NO_POWER, 100.0);
weight.param_set_increments(0.1, 0.1);
weight.param_set_digits(4);
@@ -111,15 +113,10 @@ Gtk::Widget *LPEBSpline::newWidget()
Gtk::HBox * hbox_weight_steps = dynamic_cast<Gtk::HBox *>(widg);
std::vector< Gtk::Widget* > childList = hbox_weight_steps->get_children();
Gtk::Entry* entry_widget = dynamic_cast<Gtk::Entry *>(childList[1]);
- entry_widget->set_width_chars(6);
+ entry_widget->set_width_chars(9);
}
}
- if (param->param_key == "only_selected") {
- Gtk::CheckButton *widg_registered =
- Gtk::manage(dynamic_cast<Gtk::CheckButton *>(widg));
- widg = dynamic_cast<Gtk::Widget *>(widg_registered);
- }
- if (param->param_key == "ignore_cusp") {
+ if (param->param_key == "only_selected" || param->param_key == "apply_cusp" || param->param_key == "apply_non_cusp") {
Gtk::CheckButton *widg_registered =
Gtk::manage(dynamic_cast<Gtk::CheckButton *>(widg));
widg = dynamic_cast<Gtk::Widget *>(widg_registered);
@@ -161,7 +158,7 @@ void LPEBSpline::changeWeight(double weight_ammount)
SPPath *path = dynamic_cast<SPPath *>(sp_lpe_item);
if(path) {
SPCurve *curve = path->get_curve_for_edit();
- doBSplineFromWidget(curve, weight_ammount);
+ doBSplineFromWidget(curve, weight_ammount/100.0);
gchar *str = sp_svg_write_path(curve->get_pathvector());
path->getRepr()->setAttribute("inkscape:original-d", str);
}
@@ -366,7 +363,10 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weight_ammount)
point_at3 = in->first_segment()->finalPoint();
sbasis_in = in->first_segment()->toSBasis();
if (cubic) {
- if (!ignore_cusp || !Geom::are_near((*cubic)[1], point_at0)) {
+ if ((apply_cusp && apply_non_cusp) ||
+ (apply_cusp && Geom::are_near((*cubic)[1], point_at0)) ||
+ (apply_non_cusp && !Geom::are_near((*cubic)[1], point_at0)))
+ {
if (isNodePointSelected(point_at0) || !only_selected) {
point_at1 = sbasis_in.valueAt(weight_ammount);
if (weight_ammount != NO_POWER) {
@@ -377,9 +377,12 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weight_ammount)
point_at1 = (*cubic)[1];
}
} else {
- point_at1 = in->first_segment()->initialPoint();
+ point_at1 = (*cubic)[1];
}
- if (!ignore_cusp || !Geom::are_near((*cubic)[2], point_at3)) {
+ if ((apply_cusp && apply_non_cusp) ||
+ (apply_cusp && Geom::are_near((*cubic)[2], point_at3)) ||
+ (apply_non_cusp && !Geom::are_near((*cubic)[2], point_at3)))
+ {
if (isNodePointSelected(point_at3) || !only_selected) {
point_at2 = sbasis_in.valueAt(1 - weight_ammount);
if (weight_ammount != NO_POWER) {
@@ -390,10 +393,13 @@ void LPEBSpline::doBSplineFromWidget(SPCurve *curve, double weight_ammount)
point_at2 = (*cubic)[2];
}
} else {
- point_at2 = in->first_segment()->finalPoint();
+ point_at2 = (*cubic)[2];
}
} else {
- if (!ignore_cusp && weight_ammount != NO_POWER) {
+ if ((apply_cusp && apply_non_cusp) ||
+ (apply_cusp && weight_ammount == NO_POWER) ||
+ (apply_non_cusp && weight_ammount != NO_POWER))
+ {
if (isNodePointSelected(point_at0) || !only_selected) {
point_at1 = sbasis_in.valueAt(weight_ammount);
point_at1 =
diff --git a/src/live_effects/lpe-bspline.h b/src/live_effects/lpe-bspline.h
index 033e85cf0..b9cd336a9 100644
--- a/src/live_effects/lpe-bspline.h
+++ b/src/live_effects/lpe-bspline.h
@@ -38,7 +38,8 @@ public:
private:
ScalarParam helper_size;
- BoolParam ignore_cusp;
+ BoolParam apply_cusp;
+ BoolParam apply_non_cusp;
BoolParam only_selected;
ScalarParam weight;
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index 55d801c46..06e49dc7f 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -61,7 +61,7 @@ namespace Inkscape {
namespace UI {
const double NO_POWER = 0.0;
-const double DEFAULT_START_POWER = 0.3334;
+const double DEFAULT_START_POWER = 0.333334;
ControlPoint::ColorSet Node::node_colors = {
{0xbfbfbf00, 0x000000ff}, // normal fill, stroke
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 7b7bc98ee..fb9e2c070 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -58,7 +58,7 @@ enum PathChange {
} // anonymous namespace
const double HANDLE_CUBIC_GAP = 0.001;
const double NO_POWER = 0.0;
-const double DEFAULT_START_POWER = 0.3334;
+const double DEFAULT_START_POWER = 0.333334;
/**