Code

trivial: live_effects/**: svn propset svn:eol-style native *.h *.cpp.
[inkscape.git] / src / live_effects / parameter / random.h
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 #include "ui/widget/registry.h"
18 #include "ui/widget/registered-widget.h"
20 namespace Inkscape {
22 namespace LivePathEffect {
24 class RandomParam : public Parameter {
25 public:
26     RandomParam(  const Glib::ustring& label,
27                 const Glib::ustring& tip,
28                 const Glib::ustring& key, 
29                 Inkscape::UI::Widget::Registry* wr,
30                 Effect* effect,
31                 gdouble default_value = 1.0,
32                 long default_seed = 0);
33     virtual ~RandomParam();
35     virtual bool param_readSVGValue(const gchar * strvalue);
36     virtual gchar * param_writeSVGValue() const;
37     virtual void param_set_default();
39     virtual Gtk::Widget * param_getWidget();
41     void param_set_value(gdouble val, long newseed);
42     void param_make_integer(bool yes = true);
43     void param_set_range(gdouble min, gdouble max);
45     void resetRandomizer();
47     operator gdouble();
48     inline gdouble get_value()
49         { return value; } ;
51 protected:
52     long startseed;
53     long seed;
54     long defseed;
56     gdouble value;
57     gdouble min;
58     gdouble max;
59     bool integer;
60     gdouble defvalue;
62     Inkscape::UI::Widget::RegisteredRandom * regrandom;
64 private:
65     long setup_seed(long);
66     gdouble rand();
68     RandomParam(const RandomParam&);
69     RandomParam& operator=(const RandomParam&);
70 };
72 } //namespace LivePathEffect
74 } //namespace Inkscape
76 #endif