summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7878f8c)
raw | patch | inline | side by side (parent: 7878f8c)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 14 Sep 2007 22:50:14 +0000 (22:50 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 14 Sep 2007 22:50:14 +0000 (22:50 +0000) |
index 29f9cb7ef99a6cc9d6341cbd1f793793af2c8bd1..0773363dddfe4daa825a83a590cf305efefbc9a8 100644 (file)
#include "xml/node-event-vector.h"\r
#include "sp-object.h"\r
#include "attributes.h"\r
-\r
+#include "message-stack.h"\r
#include "desktop.h"\r
-\r
+#include "inkscape.h"\r
#include "document.h"\r
#include <glibmm/i18n.h>\r
\r
}\r
catch (std::exception e) {\r
g_warning("An exception occurred during execution of an LPE - %s", e.what());\r
- // return here\r
+ SP_ACTIVE_DESKTOP->messageStack()->flash( Inkscape::WARNING_MESSAGE,\r
+ _("An exception occurred during execution of a Path Effect.") );\r
+\r
NArtBpath *path_out;\r
\r
unsigned ret = 0;\r
index 8eb35087e547e6c438361a1294a68a2227a5b307..57ff8a25e51ab2c61013cc1e5ae5628bc18d06d8 100644 (file)
nrofpaths(_("Nr of paths"), _("The number of paths that will be generated."), "count", &wr, this, 5),\r
startpoint_variation(_("Startpoint variation"), _("..."), "startpoint_variation", &wr, this, 0),\r
endpoint_variation(_("Endpoint variation"), _("..."), "endpoint_variation", &wr, this, 0),\r
- prop_scale(_("Scale ratio"), _("Ratio between scaling in the x and y direction of the original path"), "prop_scale", &wr, this, 1),\r
- scale_y(_("Scale stroke y"), _("Scale the height of the stroke path with its length"), "scale_stroke_y", &wr, this, false)\r
+ prop_scale(_("Y scaling"), _("Scaling of the width of the stroke path"), "prop_scale", &wr, this, 1),\r
+ scale_y_rel(_("Scale Y relative to X"), _("Scale the width of the stroke path relative to its length"), "scale_y_rel", &wr, this, false)\r
{\r
registerParameter( dynamic_cast<Parameter *>(&nrofpaths) );\r
registerParameter( dynamic_cast<Parameter *>(&startpoint_variation) );\r
registerParameter( dynamic_cast<Parameter *>(&endpoint_variation) );\r
registerParameter( dynamic_cast<Parameter *>(&strokepath) );\r
registerParameter( dynamic_cast<Parameter *>(&prop_scale) );\r
- registerParameter( dynamic_cast<Parameter *>(&scale_y) );\r
+ registerParameter( dynamic_cast<Parameter *>(&scale_y_rel) );\r
\r
nrofpaths.param_make_integer();\r
nrofpaths.param_set_range(2, NR_HUGE);\r
\r
-// startpoint_variation.param_set_range(-NR_HUGE, 1);\r
-// endpoint_variation.param_set_range(-1, NR_HUGE);\r
+ prop_scale.param_set_digits(3);\r
+ prop_scale.param_set_increments(0.01, 0.10);\r
}\r
\r
LPECurveStitch::~LPECurveStitch()\r
if (endpoint_variation.get_value() != 0)\r
end = end + endpoint_variation * (end - start);\r
\r
+ gdouble scaling_y = 1.0;\r
+ if (scale_y_rel.get_value()) {\r
+ scaling_y = (L2(end-start)/scaling)*prop_scale;\r
+ } else {\r
+ scaling_y = prop_scale;\r
+ }\r
+\r
Matrix transform;\r
transform.setXAxis( (end-start) / scaling );\r
- gdouble scaling_y = scale_y.get_value() ? (L2(end-start)/scaling)*prop_scale : 1.0;\r
transform.setYAxis( rot90(unit_vector(end-start)) * scaling_y);\r
transform.setTranslation( start );\r
Piecewise<D2<SBasis> > pwd2_out = (strokepath-stroke_origin) * transform;\r
index 66bbbc8f0ec4740fa9d601293085e0b8b37bbbea..25ddb7719a9c9ad110c5be5703ec2790060f8793 100644 (file)
RandomParam startpoint_variation;\r
RandomParam endpoint_variation;\r
ScalarParam prop_scale;\r
- BoolParam scale_y;\r
+ BoolParam scale_y_rel;\r
\r
LPECurveStitch(const LPECurveStitch&);\r
LPECurveStitch& operator=(const LPECurveStitch&);\r
index 4152a920ee1838bb6cb58b76ea7ff4e4ccdc1c80..8521a2ceeca5bc871d4a23afc782ac054bf032b2 100644 (file)
#include <libnr/n-art-bpath.h>\r
#include "live_effects/n-art-bpath-2geom.h"\r
#include "svg/svg.h"\r
+#include "ui/widget/scalar.h"\r
\r
#include <2geom/sbasis.h>\r
#include <2geom/sbasis-geometric.h>\r
@@ -58,15 +59,18 @@ static const Util::EnumDataConverter<SkelCopyType> SkelCopyTypeConverter(SkelCop
\r
LPESkeletalStrokes::LPESkeletalStrokes(LivePathEffectObject *lpeobject) :\r
Effect(lpeobject),\r
- pattern(_("Pattern source:"), _("Path to put along the skeleton path"), "pattern", &wr, this, "M0,0 L1,0"),\r
- copytype(_("Pattern copies:"), _("How many pattern copies to place along the skeleton path"), "copytype", SkelCopyTypeConverter, &wr, this, SSCT_SINGLE_STRETCHED),\r
- prop_scale(_("Scale ratio:"), _("Ratio between scaling the length and width of the pattern"), "prop_scale", &wr, this, 1),
- scale_y(_("Scale pattern width"), _("Scale the width of the pattern (perpendicular to skeleton) with its length"), "scale_stroke_y", &wr, this, false)\r
+ pattern(_("Pattern source"), _("Path to put along the skeleton path"), "pattern", &wr, this, "M0,0 L1,0"),\r
+ copytype(_("Pattern copies"), _("How many pattern copies to place along the skeleton path"), "copytype", SkelCopyTypeConverter, &wr, this, SSCT_SINGLE_STRETCHED),\r
+ prop_scale(_("Y scaling"), _("Scaling of the width of the pattern"), "prop_scale", &wr, this, 1),\r
+ scale_y_rel(_("Scale Y relative to X"), _("Scale the width of the pattern relative to its length"), "scale_y_rel", &wr, this, false)\r
{\r
registerParameter( dynamic_cast<Parameter *>(&pattern) );\r
registerParameter( dynamic_cast<Parameter *>(©type) );\r
registerParameter( dynamic_cast<Parameter *>(&prop_scale) );\r
- registerParameter( dynamic_cast<Parameter *>(&scale_y) );\r
+ registerParameter( dynamic_cast<Parameter *>(&scale_y_rel) );\r
+\r
+ prop_scale.param_set_digits(3);\r
+ prop_scale.param_set_increments(0.01, 0.10);\r
}\r
\r
LPESkeletalStrokes::~LPESkeletalStrokes()\r
@@ -126,8 +130,10 @@ LPESkeletalStrokes::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in
if (scaling != 1.0) {\r
x*=scaling;\r
}\r
- if ( scale_y.get_value() && (scaling*prop_scale != 1.0) ) {\r
+ if ( scale_y_rel.get_value() ) {\r
y*=(scaling*prop_scale);\r
+ } else {\r
+ if (prop_scale != 1.0) y *= prop_scale;\r
}\r
\r
double offs = 0;\r
index f92b64454959f12eadebc1bf2e8767c69d84b0ff..1bd28668053876f55989632e11043d178aa805bc 100644 (file)
PathParam pattern;\r
EnumParam<SkelCopyType> copytype;\r
ScalarParam prop_scale;\r
- BoolParam scale_y;\r
+ BoolParam scale_y_rel;\r
\r
void on_pattern_pasted();\r
\r
index 0e9295a20bebb26d15455c302278ce90c6dabb45..bb7ea4c9e7f4dca3cb2b0c47230e4296c18fc066 100644 (file)
max = NR_HUGE;\r
integer = false;\r
rsu = NULL;\r
+ inc_step = 0.1;\r
+ inc_page = 1;\r
+ digits = 2;\r
}\r
\r
ScalarParam::~ScalarParam()\r
rsu->setValue(value);\r
if (integer)\r
param_make_integer();\r
+ rsu->getS()->setDigits(digits);\r
+ rsu->getS()->setIncrements(inc_step, inc_page);\r
\r
rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter"));\r
}\r
return dynamic_cast<Gtk::Widget *> (rsu->getS());\r
}\r
\r
+void\r
+ScalarParam::param_set_digits(unsigned digits)\r
+{\r
+ this->digits = digits;\r
+ if (rsu) {\r
+ rsu->getS()->setDigits(digits);\r
+ }\r
+}\r
+\r
+void\r
+ScalarParam::param_set_increments(double step, double page)\r
+{\r
+ inc_step = step;\r
+ inc_page = page;\r
+ if (rsu) {\r
+ rsu->getS()->setIncrements(inc_step, inc_page);\r
+ }\r
+}\r
+\r
+\r
+\r
\r
} /* namespace LivePathEffect */\r
} /* namespace Inkscape */\r
index e6cabbdd99bf03c989e649bcc6a055707dff2dfd..fb0bb71036067ed6d9450fe4127364a70fa80104 100644 (file)
void param_set_value(gdouble val);\r
void param_make_integer(bool yes = true);\r
void param_set_range(gdouble min, gdouble max);\r
+ void param_set_digits(unsigned digits);\r
+ void param_set_increments(double step, double page);\r
\r
virtual Gtk::Widget * param_getWidget();\r
\r
bool integer;\r
gdouble defvalue;\r
Inkscape::UI::Widget::RegisteredScalar * rsu;\r
+ unsigned digits;\r
+ double inc_step;\r
+ double inc_page;\r
\r
private:\r
ScalarParam(const ScalarParam&);\r