1 #ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_RANDOM_H
2 #define INKSCAPE_LIVEPATHEFFECT_PARAMETER_RANDOM_H
4 /*
5 * Inkscape::LivePathEffectParameters
6 *
7 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
12 #include "live_effects/parameter/parameter.h"
13 #include <glibmm/ustring.h>
14 #include <2geom/point.h>
15 #include <2geom/path.h>
17 namespace Inkscape {
19 namespace LivePathEffect {
21 class RandomParam : public Parameter {
22 public:
23 RandomParam( const Glib::ustring& label,
24 const Glib::ustring& tip,
25 const Glib::ustring& key,
26 Inkscape::UI::Widget::Registry* wr,
27 Effect* effect,
28 gdouble default_value = 1.0,
29 long default_seed = 0);
30 virtual ~RandomParam();
32 virtual ParamType paramType() { return RANDOM_PARAM; }
34 virtual bool param_readSVGValue(const gchar * strvalue);
35 virtual gchar * param_writeSVGValue() const;
36 virtual void param_set_default();
38 virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
40 void param_set_value(gdouble val, long newseed);
41 void param_make_integer(bool yes = true);
42 void param_set_range(gdouble min, gdouble max);
44 void resetRandomizer();
46 operator gdouble();
47 inline gdouble get_value()
48 { return value; } ;
50 protected:
51 long startseed;
52 long seed;
53 long defseed;
55 gdouble value;
56 gdouble min;
57 gdouble max;
58 bool integer;
59 gdouble defvalue;
61 private:
62 long setup_seed(long);
63 gdouble rand();
65 RandomParam(const RandomParam&);
66 RandomParam& operator=(const RandomParam&);
67 };
69 } //namespace LivePathEffect
71 } //namespace Inkscape
73 #endif