1
#ifndef INKSCAPE_LIVEPATHEFFECT_PARAMETER_ARRAY_H
2
#define INKSCAPE_LIVEPATHEFFECT_PARAMETER_ARRAY_H
5
* Inkscape::LivePathEffectParameters
7
* Copyright (C) Johan Engelen 2008 <j.b.c.engelen@utwente.nl>
9
* Released under GNU GPL, read the file 'COPYING' for more information
14
#include <glib/gtypes.h>
16
#include <gtkmm/tooltips.h>
18
#include "live_effects/parameter/parameter.h"
21
#include "svg/stringstream.h"
25
namespace LivePathEffect {
27
template <typename StorageType>
28
class ArrayParam : public Parameter {
30
ArrayParam( const Glib::ustring& label,
31
const Glib::ustring& tip,
32
const Glib::ustring& key,
33
Inkscape::UI::Widget::Registry* wr,
36
: Parameter(label, tip, key, wr, effect), _vector(n)
41
virtual ~ArrayParam() {
45
std::vector<StorageType> const & data() const {
49
virtual Gtk::Widget * param_newWidget(Gtk::Tooltips * /*tooltips*/) {
53
virtual bool param_readSVGValue(const gchar * strvalue) {
55
gchar ** strarray = g_strsplit(strvalue, "|", 0);
56
gchar ** iter = strarray;
57
while (*iter != NULL) {
58
_vector.push_back( readsvg(*iter) );
61
g_strfreev (strarray);
65
virtual gchar * param_getSVGValue() const {
66
Inkscape::SVGOStringStream os;
67
writesvg(os, _vector);
68
gchar * str = g_strdup(os.str().c_str());
72
void param_setValue(std::vector<StorageType> const &new_vector) {
76
void param_set_default() {
77
param_setValue( std::vector<StorageType>() );
80
void param_set_and_write_new_value(std::vector<StorageType> const &new_vector) {
81
Inkscape::SVGOStringStream os;
82
writesvg(os, new_vector);
83
gchar * str = g_strdup(os.str().c_str());
84
param_write_to_repr(str);
89
ArrayParam(const ArrayParam&);
90
ArrayParam& operator=(const ArrayParam&);
92
std::vector<StorageType> _vector;
94
void writesvg(SVGOStringStream &str, std::vector<StorageType> const &vector) const {
95
for (unsigned int i = 0; i < vector.size(); ++i) {
97
// separate items with pipe symbol
104
StorageType readsvg(const gchar * str);
108
} //namespace LivePathEffect
110
} //namespace Inkscape
117
c-file-style:"stroustrup"
118
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
123
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :