From e41c94656fb27c5ef5fab93026e51ca8d4706a93 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Sat, 15 Sep 2007 21:45:42 +0000 Subject: [PATCH] add verticalpattern checkbox to path-along-path and some parameters that are not yet used. fix ScalarParam bug --- src/live_effects/lpe-skeletalstrokes.cpp | 14 +++++++++++--- src/live_effects/lpe-skeletalstrokes.h | 4 ++++ src/live_effects/parameter/parameter.cpp | 9 +++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/live_effects/lpe-skeletalstrokes.cpp b/src/live_effects/lpe-skeletalstrokes.cpp index e1c54b4cf..31d4cfc2f 100644 --- a/src/live_effects/lpe-skeletalstrokes.cpp +++ b/src/live_effects/lpe-skeletalstrokes.cpp @@ -62,12 +62,20 @@ LPESkeletalStrokes::LPESkeletalStrokes(LivePathEffectObject *lpeobject) : pattern(_("Pattern source"), _("Path to put along the skeleton path"), "pattern", &wr, this, "M0,0 L1,0"), copytype(_("Pattern copies"), _("How many pattern copies to place along the skeleton path"), "copytype", SkelCopyTypeConverter, &wr, this, SSCT_SINGLE_STRETCHED), prop_scale(_("Width"), _("Width of the pattern"), "prop_scale", &wr, this, 1), - scale_y_rel(_("Width in units of length"), _("Scale the width of the pattern in units of its length"), "scale_y_rel", &wr, this, false) + scale_y_rel(_("Width in units of length"), _("Scale the width of the pattern in units of its length"), "scale_y_rel", &wr, this, false), + spacing(_("Spacing"), _("Space between copies of the pattern"), "spacing", &wr, this, 0), + normal_offset(_("Normal offset"), "", "normal_offset", &wr, this, 0), + tang_offset(_("Tangential offset"), "", "tang_offset", &wr, this, 0), + vertical_pattern(_("Pattern is vertical"), "", "vertical_pattern", &wr, this, false) { registerParameter( dynamic_cast(&pattern) ); registerParameter( dynamic_cast(©type) ); registerParameter( dynamic_cast(&prop_scale) ); registerParameter( dynamic_cast(&scale_y_rel) ); +// registerParameter( dynamic_cast(&spacing) ); +// registerParameter( dynamic_cast(&normal_offset) ); +// registerParameter( dynamic_cast(&tang_offset) ); + registerParameter( dynamic_cast(&vertical_pattern) ); prop_scale.param_set_digits(3); prop_scale.param_set_increments(0.01, 0.10); @@ -94,8 +102,8 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise > & pwd2_in n = force_continuity(remove_short_cuts(n,.1)); D2 > patternd2 = make_cuts_independant(pattern); - Piecewise x=Piecewise(patternd2[0]); - Piecewise y=Piecewise(patternd2[1]); + Piecewise x = vertical_pattern.get_value() ? Piecewise(patternd2[1]) : Piecewise(patternd2[0]); + Piecewise y = vertical_pattern.get_value() ? Piecewise(patternd2[0]) : Piecewise(patternd2[1]); Interval pattBnds = bounds_exact(x); x -= pattBnds.min(); Interval pattBndsY = bounds_exact(y); diff --git a/src/live_effects/lpe-skeletalstrokes.h b/src/live_effects/lpe-skeletalstrokes.h index 1bd286680..919f09b8e 100644 --- a/src/live_effects/lpe-skeletalstrokes.h +++ b/src/live_effects/lpe-skeletalstrokes.h @@ -37,6 +37,10 @@ private: EnumParam copytype; ScalarParam prop_scale; BoolParam scale_y_rel; + ScalarParam spacing; + ScalarParam normal_offset; + ScalarParam tang_offset; + BoolParam vertical_pattern; void on_pattern_pasted(); diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index bb7ea4c9e..faed7c389 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -120,9 +120,12 @@ void ScalarParam::param_make_integer(bool yes) { integer = yes; + digits = 0; + inc_step = 1; + inc_page = 10; if (rsu) { - rsu->getS()->setDigits(0); - rsu->getS()->setIncrements(1, 10); + rsu->getS()->setDigits(digits); + rsu->getS()->setIncrements(inc_step, inc_page); } } @@ -133,8 +136,6 @@ ScalarParam::param_getWidget() rsu = new Inkscape::UI::Widget::RegisteredScalar(); rsu->init(param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc()); rsu->setValue(value); - if (integer) - param_make_integer(); rsu->getS()->setDigits(digits); rsu->getS()->setIncrements(inc_step, inc_page); -- 2.30.2