Code

LPE: add Paste LPE verb + menu item. add scale ratios to curve stitch and path-along...
[inkscape.git] / src / live_effects / parameter / parameter.h
1 #ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_H\r
2 #define INKSCAPE_LIVEPATHEFFECT_PARAMETER_H\r
3 \r
4 /*\r
5  * Inkscape::LivePathEffectParameters\r
6  *\r
7 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>\r
8  *\r
9  * Released under GNU GPL, read the file 'COPYING' for more information\r
10  */\r
11 \r
12 #include <glibmm/ustring.h>\r
13 #include <2geom/point.h>\r
14 #include <2geom/path.h>\r
15 \r
16 #include "ui/widget/registry.h"\r
17 #include "ui/widget/registered-widget.h"\r
18 \r
19 namespace Gtk {\r
20     class Widget;\r
21 }\r
22 \r
23 namespace Inkscape {\r
24 \r
25 namespace LivePathEffect {\r
26 \r
27 class Effect;\r
28 \r
29 class Parameter {\r
30 public:\r
31     Parameter(  const Glib::ustring& label,\r
32                 const Glib::ustring& tip,\r
33                 const Glib::ustring& key,\r
34                 Inkscape::UI::Widget::Registry* wr,\r
35                 Effect* effect);\r
36     virtual ~Parameter() {};\r
37 \r
38     virtual bool param_readSVGValue(const gchar * strvalue) = 0;   // returns true if new value is valid / accepted.\r
39     virtual gchar * param_writeSVGValue() const = 0;\r
40 \r
41     virtual void param_set_default() = 0;\r
42 \r
43     // This returns pointer to the parameter's widget to be put in the live-effects dialog. Must also create the\r
44     // necessary widget if it does not exist yet.\r
45     virtual Gtk::Widget * param_getWidget() = 0;\r
46     virtual Glib::ustring * param_getTooltip() { return &param_tooltip; };\r
47 \r
48     Glib::ustring param_key;\r
49     Inkscape::UI::Widget::Registry * param_wr;\r
50     Glib::ustring param_label;\r
51 \r
52 protected:\r
53     Glib::ustring param_tooltip;\r
54 \r
55     Effect* param_effect;\r
56 \r
57 private:\r
58     Parameter(const Parameter&);\r
59     Parameter& operator=(const Parameter&);\r
60 };\r
61 \r
62 \r
63 class ScalarParam : public Parameter {\r
64 public:\r
65     ScalarParam(  const Glib::ustring& label,\r
66                 const Glib::ustring& tip,\r
67                 const Glib::ustring& key, \r
68                 Inkscape::UI::Widget::Registry* wr,\r
69                 Effect* effect,\r
70                 gdouble default_value = 1.0);\r
71     virtual ~ScalarParam();\r
72 \r
73     virtual bool param_readSVGValue(const gchar * strvalue);\r
74     virtual gchar * param_writeSVGValue() const;\r
75 \r
76     virtual void param_set_default();\r
77     void param_set_value(gdouble val);\r
78     void param_make_integer(bool yes = true);\r
79     void param_set_range(gdouble min, gdouble max);\r
80 \r
81     virtual Gtk::Widget * param_getWidget();\r
82 \r
83     inline operator gdouble()\r
84         { return value; };\r
85 \r
86 protected:\r
87     gdouble value;\r
88     gdouble min;\r
89     gdouble max;\r
90     bool integer;\r
91     gdouble defvalue;\r
92     Inkscape::UI::Widget::RegisteredScalar * rsu;\r
93 \r
94 private:\r
95     ScalarParam(const ScalarParam&);\r
96     ScalarParam& operator=(const ScalarParam&);\r
97 };\r
98 \r
99 } //namespace LivePathEffect\r
100 \r
101 } //namespace Inkscape\r
102 \r
103 #endif\r