summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-27 04:07:06 +0000
committerDavid Robillard <d@drobilla.net>2007-07-27 04:07:06 +0000
commit25b610f12b8e46b48e8eda252d029da211ec6ad5 (patch)
tree520d802b199131b3376e6cae42c856efb6493fe7 /src
parent972a3e8476687951e8af4e9c1d4f25014dab1b82 (diff)
downloadingen-25b610f12b8e46b48e8eda252d029da211ec6ad5.tar.gz
ingen-25b610f12b8e46b48e8eda252d029da211ec6ad5.tar.bz2
ingen-25b610f12b8e46b48e8eda252d029da211ec6ad5.zip
Control port slider functionality (when not in edit more, or holding down control).
Known issue: Control modifier toggling currently only works when pointer on canvas (not a module or port). git-svn-id: http://svn.drobilla.net/lad/ingen@644 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/gui/Port.cpp22
-rw-r--r--src/libs/gui/Port.hpp2
2 files changed, 24 insertions, 0 deletions
diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp
index cd13d89d..aa63af14 100644
--- a/src/libs/gui/Port.cpp
+++ b/src/libs/gui/Port.cpp
@@ -66,5 +66,27 @@ Port::renamed()
}
+void
+Port::set_control(float value)
+{
+ if (_port_model->is_control()) {
+ float min = 0.0f;
+ float max = 1.0f;
+
+ const Atom& min_atom = _port_model->get_metadata("ingen:minimum");
+ const Atom& max_atom = _port_model->get_metadata("ingen:maximum");
+ if (min_atom.type() == Atom::FLOAT && max_atom.type() == Atom::FLOAT) {
+ min = min_atom.get_float();
+ max = max_atom.get_float();
+ }
+
+ App::instance().engine()->set_port_value(_port_model->path(),
+ min + (value * (max-min)));
+
+ FlowCanvas::Port::set_control(value);
+ }
+}
+
+
} // namespace GUI
} // namespace Ingen
diff --git a/src/libs/gui/Port.hpp b/src/libs/gui/Port.hpp
index b381c44b..d91c963a 100644
--- a/src/libs/gui/Port.hpp
+++ b/src/libs/gui/Port.hpp
@@ -43,6 +43,8 @@ public:
SharedPtr<PortModel> model() const { return _port_model; }
+ virtual void set_control(float value);
+
private:
void on_menu_destroy();