diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-12-04 23:09:17 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-12-04 23:09:17 +0000 |
| commit | 5104d5c1cd675e8e81d0b241e81a331d65056b49 (patch) | |
| tree | f51f16cb474784f0fd7a3a59301a90dfc01ec554 /src/ui/tools/freehand-base.cpp | |
| parent | Add controls for rx/ry to arc toolbar (diff) | |
| download | inkscape-5104d5c1cd675e8e81d0b241e81a331d65056b49.tar.gz inkscape-5104d5c1cd675e8e81d0b241e81a331d65056b49.zip | |
Add fix to problem switching pen tool modes
Add fix to bspline when two cusp nodes arround a powered node
Diffstat (limited to 'src/ui/tools/freehand-base.cpp')
| -rw-r--r-- | src/ui/tools/freehand-base.cpp | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/src/ui/tools/freehand-base.cpp b/src/ui/tools/freehand-base.cpp index 064a83a5a..49b8436de 100644 --- a/src/ui/tools/freehand-base.cpp +++ b/src/ui/tools/freehand-base.cpp @@ -85,7 +85,7 @@ FreehandBase::FreehandBase(gchar const *const *cursor_shape) , green_anchor(NULL) , green_closed(false) , white_item(NULL) - , overwrite_curve(NULL) + , sa_overwrited(NULL) , sa(NULL) , ea(NULL) , waiting_LPE_type(Inkscape::LivePathEffect::INVALID_LPE) @@ -144,7 +144,7 @@ void FreehandBase::setup() { this->green_closed = FALSE; // Create start anchor alternative curve - this->overwrite_curve = new SPCurve(); + this->sa_overwrited = new SPCurve(); this->attach = TRUE; spdc_attach_selection(this, this->selection); @@ -599,6 +599,9 @@ static void spdc_selection_modified(Inkscape::Selection *sel, guint /*flags*/, F static void spdc_attach_selection(FreehandBase *dc, Inkscape::Selection */*sel*/) { + if (SP_IS_PENCIL_CONTEXT(dc) && dc->sa && dc->input_has_pressure) { + return; + } // We reset white and forget white/start/end anchors spdc_reset_white(dc); dc->sa = NULL; @@ -744,38 +747,21 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) { // We hit bot start and end of single curve, closing paths dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Closing path.")); - if (dc->sa->start && !(dc->sa->curve->is_closed()) ) { - c = reverse_then_unref(c); - } - if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - dc->overwrite_curve->append_continuous(c, 0.0625); - c->unref(); - dc->overwrite_curve->closepath_current(); - if(dc->sa){ - dc->white_curves.erase(std::find(dc->white_curves.begin(),dc->white_curves.end(), dc->sa->curve)); - dc->white_curves.push_back(dc->overwrite_curve); - } - }else{ - dc->sa->curve->append_continuous(c, 0.0625); - c->unref(); - dc->sa->curve->closepath_current(); + dc->sa_overwrited->append_continuous(c, 0.0625); + c->unref(); + dc->sa_overwrited->closepath_current(); + if(dc->sa){ + dc->white_curves.erase(std::find(dc->white_curves.begin(),dc->white_curves.end(), dc->sa->curve)); + dc->white_curves.push_back(dc->sa_overwrited); } + spdc_flush_white(dc, NULL); return; } - // Step C - test start if (dc->sa) { - SPCurve *s = dc->sa->curve; - dc->white_curves.erase(std::find(dc->white_curves.begin(),dc->white_curves.end(), s)); - if(prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 1 || - prefs->getInt(tool_name(dc) + "/freehand-mode", 0) == 2){ - s = dc->overwrite_curve; - } - if (dc->sa->start) { - s = reverse_then_unref(s); - } + dc->white_curves.erase(std::find(dc->white_curves.begin(),dc->white_curves.end(), dc->sa->curve)); + SPCurve *s = dc->sa_overwrited; s->append_continuous(c, 0.0625); c->unref(); c = s; @@ -807,7 +793,6 @@ void spdc_concat_colors_and_flush(FreehandBase *dc, gboolean forceclosed) c->append_continuous(e, 0.0625); e->unref(); } - if (forceclosed) { dc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Path is closed.")); @@ -882,8 +867,17 @@ static void spdc_flush_white(FreehandBase *dc, SPCurve *gc) if(previous_shape_type == BEND_CLIPBOARD){ repr->parent()->removeChild(repr); } + } else if (SP_IS_PENCIL_CONTEXT(dc)) { + if (dc->input_has_pressure) { + spdc_check_for_and_apply_waiting_LPE(dc, dc->white_item, c, false); +// Inkscape::Preferences *prefs = Inkscape::Preferences::get(); +// shapeType shape = (shapeType)prefs->getInt(tool_name(dc) + "/shape", 0); +// if (shape == NONE) { +// std::vector<Geom::Point> points; +// spdc_apply_powerstroke_shape(points, dc, dc->white_item); +// } + } } - DocumentUndo::done(doc, SP_IS_PEN_CONTEXT(dc)? SP_VERB_CONTEXT_PEN : SP_VERB_CONTEXT_PENCIL, _("Draw path")); @@ -952,7 +946,11 @@ static void spdc_free_colors(FreehandBase *dc) if (dc->blue_curve) { dc->blue_curve = dc->blue_curve->unref(); } - + + // Overwrite start anchor curve + if (dc->sa_overwrited) { + dc->sa_overwrited = dc->sa_overwrited->unref(); + } // Green for (auto i : dc->green_bpaths) sp_canvas_item_destroy(i); |
