diff options
| author | Liam P. White <inkscapebrony@gmail.com> | 2014-10-29 22:40:05 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebrony@gmail.com> | 2014-10-29 22:40:05 +0000 |
| commit | e9943b70c7bf507b9639ecb0a421bcee7ce93e33 (patch) | |
| tree | 2d2fe7ee7a566e1ef1a5dcde18296d9f21188f35 /src/live_effects/parameter/parameter.cpp | |
| parent | i18n. Fixing untranslated strings. (diff) | |
| parent | Merge with trunk r13640 (diff) | |
| download | inkscape-e9943b70c7bf507b9639ecb0a421bcee7ce93e33.tar.gz inkscape-e9943b70c7bf507b9639ecb0a421bcee7ce93e33.zip | |
Merge experimental
(bzr r13641)
Diffstat (limited to 'src/live_effects/parameter/parameter.cpp')
| -rw-r--r-- | src/live_effects/parameter/parameter.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index ad2960cd9..7a2fd9769 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -42,6 +42,13 @@ Parameter::param_write_to_repr(const char * svgd) param_effect->getRepr()->setAttribute(param_key.c_str(), svgd); } +// In gtk2, this wasn't an issue; we could toss around +// G_MAXDOUBLE and not worry about size allocations. But +// in gtk3, it is an issue: it allocates widget size for the maxmium +// value you pass to it, leading to some insane lengths. +// If you need this to be more, please be conservative about it. +const double SCALARPARAM_G_MAXDOUBLE = 10000000000; + void Parameter::write_to_SVG(void) { gchar * str = param_getSVGValue(); @@ -57,8 +64,8 @@ ScalarParam::ScalarParam( const Glib::ustring& label, const Glib::ustring& tip, Effect* effect, gdouble default_value) : Parameter(label, tip, key, wr, effect), value(default_value), - min(-G_MAXDOUBLE), - max(G_MAXDOUBLE), + min(-SCALARPARAM_G_MAXDOUBLE), + max(SCALARPARAM_G_MAXDOUBLE), integer(false), defvalue(default_value), digits(2), @@ -114,8 +121,22 @@ ScalarParam::param_set_value(gdouble val) void ScalarParam::param_set_range(gdouble min, gdouble max) { - this->min = min; - this->max = max; + // if you look at client code, you'll see that many effects + // has a tendency to set an upper range of Geom::infinity(). + // Once again, in gtk2, this is not a problem. But in gtk3, + // widgets get allocated the amount of size they ask for, + // leading to excessively long widgets. + + if (min >= -SCALARPARAM_G_MAXDOUBLE) { + this->min = min; + } else { + this->min = -SCALARPARAM_G_MAXDOUBLE; + } + if (max <= SCALARPARAM_G_MAXDOUBLE) { + this->max = max; + } else { + this->max = SCALARPARAM_G_MAXDOUBLE; + } param_set_value(value); // reset value to see whether it is in ranges } |
