summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4499ff8)
raw | patch | inline | side by side (parent: 4499ff8)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 21 Nov 2007 22:29:18 +0000 (22:29 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 21 Nov 2007 22:29:18 +0000 (22:29 +0000) |
src/live_effects/effect.cpp | patch | blob | history | |
src/live_effects/effect.h | patch | blob | history |
index 9513f37b17bedf3d3b293fadd5c85cf2bee5eaa7..2035d301fb663f341556f879877c5a32d587a6b1 100644 (file)
vbox = NULL;
tooltips = NULL;
lpeobj = lpeobject;
- oncanvasedit_it = param_map.begin();
+ oncanvasedit_it = param_vector.begin();
}
Effect::~Effect()
void
Effect::readallParameters(Inkscape::XML::Node * repr)
{
- param_map_type::iterator it = param_map.begin();
- while (it != param_map.end()) {
- const gchar * key = (*it).first.c_str();
+ std::vector<Parameter *>::iterator it = param_vector.begin();
+ while (it != param_vector.end()) {
+ Parameter * param = *it;
+ const gchar * key = param->param_key.c_str();
const gchar * value = repr->attribute(key);
- if(value) {
- setParameter(key, value);
+ if (value) {
+ bool accepted = param->param_readSVGValue(value);
+ if (!accepted) {
+ g_warning("Effect::readallParameters - '%s' not accepted for %s", value, key);
+ }
+ } else {
+ // set default value
+ param->param_set_default();
}
+
it++;
}
}
void
Effect::setParameter(const gchar * key, const gchar * new_value)
{
- Glib::ustring stringkey(key);
-
- param_map_type::iterator it = param_map.find(stringkey);
- if (it != param_map.end()) {
+ Parameter * param = getParameter(key);
+ if (param) {
if (new_value) {
- bool accepted = it->second->param_readSVGValue(new_value);
+ bool accepted = param->param_readSVGValue(new_value);
if (!accepted) {
g_warning("Effect::setParameter - '%s' not accepted for %s", new_value, key);
}
} else {
// set default value
- it->second->param_set_default();
+ param->param_set_default();
}
}
}
void
Effect::registerParameter(Parameter * param)
{
- param_map[param->param_key] = param; // inserts or updates
+ param_vector.push_back(param);
}
Gtk::Widget *
vbox->set_border_width(5);
- param_map_type::iterator it = param_map.begin();
- while (it != param_map.end()) {
- Parameter * param = it->second;
+ std::vector<Parameter *>::iterator it = param_vector.begin();
+ while (it != param_vector.end()) {
+ Parameter * param = *it;
Gtk::Widget * widg = param->param_getWidget();
Glib::ustring * tip = param->param_getTooltip();
if (widg) {
{
Glib::ustring stringkey(key);
- param_map_type::iterator it = param_map.find(stringkey);
- if (it != param_map.end()) {
- return it->second;
- } else {
- return NULL;
+ std::vector<Parameter *>::iterator it = param_vector.begin();
+ while (it != param_vector.end()) {
+ Parameter * param = *it;
+ if ( param->param_key == key) {
+ return param;
+ }
+
+ it++;
}
+
+ return NULL;
}
Parameter *
Effect::getNextOncanvasEditableParam()
{
oncanvasedit_it++;
- if (oncanvasedit_it == param_map.end()) {
- oncanvasedit_it = param_map.begin();
+ if (oncanvasedit_it == param_vector.end()) {
+ oncanvasedit_it = param_vector.begin();
}
- param_map_type::iterator old_it = oncanvasedit_it;
+ std::vector<Parameter *>::iterator old_it = oncanvasedit_it;
do {
- Parameter * param = oncanvasedit_it->second;
+ Parameter * param = *oncanvasedit_it;
if(param->oncanvas_editable) {
return param;
} else {
oncanvasedit_it++;
- if (oncanvasedit_it == param_map.end()) { // loop round the map
- oncanvasedit_it = param_map.begin();
+ if (oncanvasedit_it == param_vector.end()) { // loop round the map
+ oncanvasedit_it = param_vector.begin();
}
}
} while (oncanvasedit_it != old_it); // iterate until complete loop through map has been made
index f6732f9b2e095e2cf033e75afa730ea5372452cf..f305906939e6b3652d4875f4a1d02bc7013c9fcd 100644 (file)
void registerParameter(Parameter * param);
Parameter * getNextOncanvasEditableParam();
- typedef std::map<Glib::ustring, Parameter *> param_map_type;
- param_map_type param_map;
+ std::vector<Parameter *> param_vector;
+ std::vector<Parameter *>::iterator oncanvasedit_it;
+
Inkscape::UI::Widget::Registry wr;
Gtk::VBox * vbox;
LivePathEffectObject *lpeobj;
- param_map_type::iterator oncanvasedit_it;
-
private:
Effect(const Effect&);
Effect& operator=(const Effect&);