summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-21 19:46:07 +0000
committerDavid Robillard <d@drobilla.net>2007-10-21 19:46:07 +0000
commit5ae4d4d5e805e828b51b98767ac51da24c3b21f1 (patch)
tree6f84f0ffff4e7b65cd144e9c3134f66ab6515bd7 /src
parent608aeac60ef43243b85c0dcc5894ccc79f35fba5 (diff)
downloadingen-5ae4d4d5e805e828b51b98767ac51da24c3b21f1.tar.gz
ingen-5ae4d4d5e805e828b51b98767ac51da24c3b21f1.tar.bz2
ingen-5ae4d4d5e805e828b51b98767ac51da24c3b21f1.zip
Fix various client-side variable state problems.
Fix port ranges. Close ticket 102. git-svn-id: http://svn.drobilla.net/lad/ingen@895 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/NodeModel.cpp2
-rw-r--r--src/libs/client/ObjectModel.hpp2
-rw-r--r--src/libs/gui/ControlGroups.cpp12
-rw-r--r--src/libs/gui/ControlGroups.hpp2
-rw-r--r--src/libs/gui/Port.cpp5
-rw-r--r--src/libs/gui/UploadPatchWindow.cpp4
6 files changed, 21 insertions, 6 deletions
diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp
index b429d356..fff01aee 100644
--- a/src/libs/client/NodeModel.cpp
+++ b/src/libs/client/NodeModel.cpp
@@ -176,6 +176,8 @@ NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max)
min = min_atom.get_float();
if (max_atom.type() == Atom::FLOAT)
max = max_atom.get_float();
+
+ cerr << port->path() << " VALUE RANGE: " << min << ", " << max << endl;
}
diff --git a/src/libs/client/ObjectModel.hpp b/src/libs/client/ObjectModel.hpp
index 586ef8b3..55a5e6e1 100644
--- a/src/libs/client/ObjectModel.hpp
+++ b/src/libs/client/ObjectModel.hpp
@@ -61,7 +61,7 @@ public:
const Atom& get_variable(const string& key) const;
void set_variable(const string& key, const Atom& value)
- { _variables.insert(make_pair(key, value)); signal_variable.emit(key, value); }
+ { _variables[key] = value; signal_variable.emit(key, value); }
const Variables& variables() const { return _variables; }
const Path path() const { return _path; }
diff --git a/src/libs/gui/ControlGroups.cpp b/src/libs/gui/ControlGroups.cpp
index b7828a48..236f782e 100644
--- a/src/libs/gui/ControlGroups.cpp
+++ b/src/libs/gui/ControlGroups.cpp
@@ -127,6 +127,8 @@ SliderControlGroup::init(ControlPanel* panel, SharedPtr<PortModel> pm)
} else {
_slider->set_increments(0, 0);
}
+
+ pm->signal_variable.connect(sigc::mem_fun(this, &SliderControlGroup::port_variable_change));
_slider->set_range(std::min(min, pm->value()), std::max(max, pm->value()));
//_value_spinner->set_range(min, max);
@@ -184,6 +186,16 @@ SliderControlGroup::set_value(float val)
_enable_signal = true;
}
+
+void
+SliderControlGroup::port_variable_change(const string& key, const Atom& value)
+{
+ if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT)
+ set_range(value.get_float(), _slider->get_adjustment()->get_upper());
+ else if ( (key == "ingen:maximum") && value.type() == Atom::FLOAT)
+ set_range(_slider->get_adjustment()->get_lower(), value.get_float());
+}
+
void
SliderControlGroup::set_range(float min, float max)
diff --git a/src/libs/gui/ControlGroups.hpp b/src/libs/gui/ControlGroups.hpp
index 15e5a6ea..89f26a6b 100644
--- a/src/libs/gui/ControlGroups.hpp
+++ b/src/libs/gui/ControlGroups.hpp
@@ -82,6 +82,8 @@ private:
void set_value(float value);
void set_range(float min, float max);
+
+ void port_variable_change(const string& key, const Raul::Atom& value);
void update_range();
void update_value_from_slider();
diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp
index 04d45f1d..97a06bcd 100644
--- a/src/libs/gui/Port.cpp
+++ b/src/libs/gui/Port.cpp
@@ -122,11 +122,10 @@ Port::set_control(float value, bool signal)
void
Port::variable_change(const string& key, const Atom& value)
{
- if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT) {
+ if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT)
set_control_min(value.get_float());
- } else if ( (key == "ingen:maximum") && value.type() == Atom::FLOAT) {
+ else if ( (key == "ingen:maximum") && value.type() == Atom::FLOAT)
set_control_max(value.get_float());
- }
}
diff --git a/src/libs/gui/UploadPatchWindow.cpp b/src/libs/gui/UploadPatchWindow.cpp
index c64bac50..d404cbcb 100644
--- a/src/libs/gui/UploadPatchWindow.cpp
+++ b/src/libs/gui/UploadPatchWindow.cpp
@@ -238,8 +238,8 @@ UploadPatchWindow::upload_clicked()
Glib::ustring short_name = _short_name_entry->get_text();
GraphObject::Variables extra_rdf;
- extra_rdf.insert(make_pair("lv2:symbol", Atom(symbol)));
- extra_rdf.insert(make_pair("doap:name", Atom(short_name)));
+ extra_rdf["lv2:symbol"] = Atom(symbol);
+ extra_rdf["doap:name"] = Atom(short_name);
_response = 0;
_progress_pct = 0;