diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-07-03 09:40:29 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-07-03 09:40:29 +0000 |
| commit | 4526ca6134cb3f32b6eb66dfd1cf0a4b5eb5636a (patch) | |
| tree | a2061c6006dae2536440b2f897ee079b930db5e6 /src/draw-context.cpp | |
| parent | First shot at a dropdown selector for various shapes in pen/pencil tool, alon... (diff) | |
| download | inkscape-4526ca6134cb3f32b6eb66dfd1cf0a4b5eb5636a.tar.gz inkscape-4526ca6134cb3f32b6eb66dfd1cf0a4b5eb5636a.zip | |
When drawing with activated shape in pencil/pen tool, apply the original stroke color as fill and unset stroke
(bzr r6128)
Diffstat (limited to 'src/draw-context.cpp')
| -rw-r--r-- | src/draw-context.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/draw-context.cpp b/src/draw-context.cpp index d54ccc778..92bba8104 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -42,6 +42,7 @@ #include "sp-path.h" #include "sp-namedview.h" #include "live_effects/lpe-patternalongpath.h" +#include "style.h" static void sp_draw_context_class_init(SPDrawContextClass *klass); static void sp_draw_context_init(SPDrawContext *dc); @@ -271,6 +272,11 @@ spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item) if (item) { int shape = prefs_get_int_attribute("tools.freehand", "shape", 0); + bool shape_applied = false; + SPCSSAttr *css_item = sp_css_attr_from_object (SP_OBJECT(item), SP_STYLE_FLAG_ALWAYS); + const char *cfill = sp_repr_css_property(css_item, "fill", "none"); + const char *cstroke = sp_repr_css_property(css_item, "stroke", "none"); + switch (shape) { case 0: break; @@ -279,7 +285,8 @@ spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item) Effect::createAndApply(PATTERN_ALONG_PATH, dc->desktop->doc(), item); Effect* lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item)); static_cast<LPEPatternAlongPath*>(lpe)->pattern.on_paste_button_click(); - return; + + shape_applied = true; } case 2: { @@ -292,11 +299,21 @@ spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item) c->closepath(); spdc_paste_curve_as_param_path(c, dc, item); c->unref(); - return; + + shape_applied = true; } default: break; } + if (shape_applied) { + // apply original stroke color as fill and unset stroke; then return + SPCSSAttr *css = sp_repr_css_attr_new(); + sp_repr_css_set_property (css, "fill", cstroke); + sp_repr_css_set_property (css, "stroke", "none"); + sp_desktop_apply_css_recursive(SP_OBJECT(item), css, true); + sp_repr_css_attr_unref(css); + return; + } if (prefs_get_int_attribute("tools.freehand", "spiro-spline-mode", 0)) { Effect::createAndApply(SPIRO, dc->desktop->doc(), item); |
