1
#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_H
2
#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_H
5
* Inkscape::LivePathEffectParameters
7
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
9
* Released under GNU GPL, read the file 'COPYING' for more information
12
#include <glibmm/ustring.h>
13
#include <2geom/forward.h>
14
#include <2geom/pathvector.h>
38
namespace LivePathEffect {
44
Parameter( const Glib::ustring& label,
45
const Glib::ustring& tip,
46
const Glib::ustring& key,
47
Inkscape::UI::Widget::Registry* wr,
49
virtual ~Parameter() {};
51
virtual bool param_readSVGValue(const gchar * strvalue) = 0; // returns true if new value is valid / accepted.
52
virtual gchar * param_getSVGValue() const = 0;
53
void write_to_SVG() { param_write_to_repr(param_getSVGValue()); }
55
virtual void param_set_default() = 0;
57
// This creates a new widget (newed with Gtk::manage(new ...);)
58
virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips) = 0;
60
virtual Glib::ustring * param_getTooltip() { return ¶m_tooltip; };
62
// overload these for your particular parameter to make it provide knotholder handles or canvas helperpaths
63
virtual bool providesKnotHolderEntities() { return false; }
64
virtual void addKnotHolderEntities(KnotHolder */*knotholder*/, SPDesktop */*desktop*/, SPItem */*item*/) {};
65
virtual void addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector<Geom::PathVector> &/*hp_vec*/) {};
67
virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {};
68
virtual void param_setup_nodepath(Inkscape::NodePath::Path */*np*/) {};
70
virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/) {};
72
Glib::ustring param_key;
73
Inkscape::UI::Widget::Registry * param_wr;
74
Glib::ustring param_label;
76
bool oncanvas_editable;
77
bool widget_is_visible;
80
Glib::ustring param_tooltip;
84
void param_write_to_repr(const char * svgd);
87
Parameter(const Parameter&);
88
Parameter& operator=(const Parameter&);
92
class ScalarParam : public Parameter {
94
ScalarParam( const Glib::ustring& label,
95
const Glib::ustring& tip,
96
const Glib::ustring& key,
97
Inkscape::UI::Widget::Registry* wr,
99
gdouble default_value = 1.0);
100
virtual ~ScalarParam();
102
virtual bool param_readSVGValue(const gchar * strvalue);
103
virtual gchar * param_getSVGValue() const;
105
virtual void param_set_default();
106
void param_set_value(gdouble val);
107
void param_make_integer(bool yes = true);
108
void param_set_range(gdouble min, gdouble max);
109
void param_set_digits(unsigned digits);
110
void param_set_increments(double step, double page);
112
virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
114
inline operator gdouble()
128
ScalarParam(const ScalarParam&);
129
ScalarParam& operator=(const ScalarParam&);
132
} //namespace LivePathEffect
134
} //namespace Inkscape
141
c-file-style:"stroustrup"
142
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
147
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :