~ubuntu-branches/ubuntu/oneiric/inkscape/oneiric-updates

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/live_effects/parameter/parameter.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_H
 
2
#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_H
 
3
 
 
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
 */
 
11
 
 
12
#include <glibmm/ustring.h>
 
13
#include <2geom/forward.h>
 
14
#include <2geom/pathvector.h>
 
15
 
 
16
class KnotHolder;
 
17
class SPLPEItem;
 
18
struct SPDesktop;
 
19
struct SPItem;
 
20
 
 
21
namespace Gtk {
 
22
    class Widget;
 
23
    class Tooltips;
 
24
}
 
25
 
 
26
namespace Inkscape {
 
27
 
 
28
namespace NodePath {
 
29
    class Path ;
 
30
}
 
31
 
 
32
namespace UI {
 
33
namespace Widget {
 
34
    class Registry;
 
35
}
 
36
}
 
37
 
 
38
namespace LivePathEffect {
 
39
 
 
40
class Effect;
 
41
 
 
42
class Parameter {
 
43
public:
 
44
    Parameter(  const Glib::ustring& label,
 
45
                const Glib::ustring& tip,
 
46
                const Glib::ustring& key,
 
47
                Inkscape::UI::Widget::Registry* wr,
 
48
                Effect* effect);
 
49
    virtual ~Parameter() {};
 
50
 
 
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()); }
 
54
 
 
55
    virtual void param_set_default() = 0;
 
56
 
 
57
    // This creates a new widget (newed with Gtk::manage(new ...);)
 
58
    virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips) = 0;
 
59
 
 
60
    virtual Glib::ustring * param_getTooltip() { return &param_tooltip; };
 
61
 
 
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*/) {};
 
66
 
 
67
    virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {};
 
68
    virtual void param_setup_nodepath(Inkscape::NodePath::Path */*np*/) {};
 
69
 
 
70
    virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/) {};
 
71
 
 
72
    Glib::ustring param_key;
 
73
    Inkscape::UI::Widget::Registry * param_wr;
 
74
    Glib::ustring param_label;
 
75
 
 
76
    bool oncanvas_editable;
 
77
    bool widget_is_visible;
 
78
 
 
79
protected:
 
80
    Glib::ustring param_tooltip;
 
81
 
 
82
    Effect* param_effect;
 
83
 
 
84
    void param_write_to_repr(const char * svgd);
 
85
 
 
86
private:
 
87
    Parameter(const Parameter&);
 
88
    Parameter& operator=(const Parameter&);
 
89
};
 
90
 
 
91
 
 
92
class ScalarParam : public Parameter {
 
93
public:
 
94
    ScalarParam(  const Glib::ustring& label,
 
95
                const Glib::ustring& tip,
 
96
                const Glib::ustring& key,
 
97
                Inkscape::UI::Widget::Registry* wr,
 
98
                Effect* effect,
 
99
                gdouble default_value = 1.0);
 
100
    virtual ~ScalarParam();
 
101
 
 
102
    virtual bool param_readSVGValue(const gchar * strvalue);
 
103
    virtual gchar * param_getSVGValue() const;
 
104
 
 
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);
 
111
 
 
112
    virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * tooltips);
 
113
 
 
114
    inline operator gdouble()
 
115
        { return value; };
 
116
 
 
117
protected:
 
118
    gdouble value;
 
119
    gdouble min;
 
120
    gdouble max;
 
121
    bool integer;
 
122
    gdouble defvalue;
 
123
    unsigned digits;
 
124
    double inc_step;
 
125
    double inc_page;
 
126
 
 
127
private:
 
128
    ScalarParam(const ScalarParam&);
 
129
    ScalarParam& operator=(const ScalarParam&);
 
130
};
 
131
 
 
132
} //namespace LivePathEffect
 
133
 
 
134
} //namespace Inkscape
 
135
 
 
136
#endif
 
137
 
 
138
/*
 
139
  Local Variables:
 
140
  mode:c++
 
141
  c-file-style:"stroustrup"
 
142
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
143
  indent-tabs-mode:nil
 
144
  fill-column:99
 
145
  End:
 
146
*/
 
147
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :