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 bool param_readSVGValue(const gchar * strvalue);
33 virtual gchar * param_getSVGValue() const;
34 virtual void param_set_default();
36 virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
38 void param_set_value(gdouble val, long newseed);
39 void param_make_integer(bool yes = true);
40 void param_set_range(gdouble min, gdouble max);
42 void resetRandomizer();
44 operator gdouble();
45 inline gdouble get_value()
46 { return value; } ;
48 protected:
49 long startseed;
50 long seed;
51 long defseed;
53 gdouble value;
54 gdouble min;
55 gdouble max;
56 bool integer;
57 gdouble defvalue;
59 private:
60 long setup_seed(long);
61 gdouble rand();
63 RandomParam(const RandomParam&);
64 RandomParam& operator=(const RandomParam&);
65 };
67 } //namespace LivePathEffect
69 } //namespace Inkscape
71 #endif