summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2017-12-08 19:40:18 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2017-12-08 19:40:18 +0000
commiteb2502c7271cdee9b7b31bd641fa729bad00c38b (patch)
treeaeddb21f34ec2d23367243a56bbf24b291fdf95d /src
parentMege trunk into powerpencilII (diff)
downloadinkscape-eb2502c7271cdee9b7b31bd641fa729bad00c38b.tar.gz
inkscape-eb2502c7271cdee9b7b31bd641fa729bad00c38b.zip
Moving tolerance
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp10
-rw-r--r--src/ui/dialog/inkscape-preferences.h1
-rw-r--r--src/ui/tools/pencil-tool.cpp9
3 files changed, 16 insertions, 4 deletions
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index adeee35fd..74774f8f4 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -213,6 +213,15 @@ void InkscapePreferences::AddPencilPowerStrokePressureStep(DialogPage &p, Glib::
false );
}
+void InkscapePreferences::AddPencilPowerStrokeMinSimplify(DialogPage &p, Glib::ustring const &prefs_path, gint def_value)
+{
+ PrefSpinButton* sb = Gtk::manage( new PrefSpinButton);
+ sb->init ( prefs_path + "/powerstrokemintolerance", 1, 100, 1, 10, def_value, true, false);
+ p.add_line( false, _("Power Stroke base min simplify:"), *sb, _("%"),
+ _("Base simplify for pencil with pressure"),
+ false );
+}
+
static void StyleFromSelectionToTool(Glib::ustring const &prefs_path, StyleSwatch *swatch)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
@@ -433,6 +442,7 @@ void InkscapePreferences::initPageTools()
this->AddBaseSimplifySpinbutton(_page_pencil, "/tools/freehand/pencil", 25.0);
_page_pencil.add_group_header( _("Pressure sensitivity settings"));
this->AddPencilPowerStrokePressureStep(_page_pencil, "/tools/freehand/pencil", 10);
+ this->AddPencilPowerStrokeMinSimplify(_page_pencil, "/tools/freehand/pencil", 40);
_page_pencil.add_group_header( _("Sketch mode"));
_page_pencil.add_line( true, "", _pencil_average_all_sketches, "",
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index 639c3af68..7cfe3695c 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -501,6 +501,7 @@ protected:
static void AddDotSizeSpinbutton(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, double def_value);
static void AddBaseSimplifySpinbutton(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, double def_value);
static void AddPencilPowerStrokePressureStep(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, gint def_value);
+ static void AddPencilPowerStrokeMinSimplify(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, gint def_value);
static void AddNewObjectsStyle(UI::Widget::DialogPage& p, Glib::ustring const &prefs_path, const gchar* banner = NULL);
void on_pagelist_selection_changed();
diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp
index db1b975ef..6dd3126e3 100644
--- a/src/ui/tools/pencil-tool.cpp
+++ b/src/ui/tools/pencil-tool.cpp
@@ -341,7 +341,6 @@ bool PencilTool::_handleMotionNotify(GdkEventMotion const &mevent) {
this->green_anchor = sp_draw_anchor_new(this, this->green_curve, TRUE, this->p[0]);
}
if (anchor) {
- std::cout << "aaaaaaaaaaaaaaaaaaaaaaaaaa" << std::endl;
p = anchor->dp;
}
if ( this->npoints != 0) { // buttonpress may have happened before we entered draw context!
@@ -777,6 +776,7 @@ PencilTool::addPowerStrokePencil(SPCurve * c)
this->points.clear();
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
double tol = prefs->getDoubleLimited("/tools/freehand/pencil/tolerance", 10.0, 1.0, 100.0);
+ double pstol = prefs->getDoubleLimited("/tools/freehand/pencil/powerstrokemintolerance", 45.0, 1.0, 100.0);
double gap_pressure = prefs->getIntLimited("/tools/freehand/pencil/ps-step-pressure",10, 1, 100)/100.0;
double min = prefs->getIntLimited("/tools/freehand/pencil/minpressure", 0, 1, 100) / 100.0;
double max = prefs->getIntLimited("/tools/freehand/pencil/maxpressure", 100, 1, 100) / 100.0;
@@ -801,7 +801,7 @@ PencilTool::addPowerStrokePencil(SPCurve * c)
//Simplify a bit the base curve to avoid artifacts
SPCurve * previous_red = red_curve->copy();
SPCurve * previous_green = green_curve->copy();
- prefs->setDouble("/tools/freehand/pencil/tolerance", 18.0);
+ prefs->setDouble("/tools/freehand/pencil/tolerance", pstol);
std::vector<Geom::Point> stroreps = this->ps;
std::vector<double> strorewps = this->wps;
_interpolate(true);
@@ -945,8 +945,9 @@ void PencilTool::_interpolate(bool realize) {
}
//To avoid artifacts on pressure power
if (input_has_pressure) {
- if (tol < 18.0 * 0.4) {
- tol = 18.0 * 0.4;
+ double pstol = prefs->getDoubleLimited("/tools/freehand/pencil/powerstrokemintolerance", 40);
+ if (tol < pstol * 0.4) {
+ tol = pstol * 0.4;
}
//we dont need a exact calulation set up a high precission
//we remove pointa at start and end nearest to 1/20 of total length