summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-22 08:03:12 +0000
committerDavid Robillard <d@drobilla.net>2006-06-22 08:03:12 +0000
commit03aa3b084fe3d97f62b67867085c04a23402397e (patch)
treee310d4e54c41c0f2d0a9aac1722d93fb01c6e2fd /src
parentc3dc3ff5a5465ed59b0a8b36eb234130dbf0a9d6 (diff)
downloadingen-03aa3b084fe3d97f62b67867085c04a23402397e.tar.gz
ingen-03aa3b084fe3d97f62b67867085c04a23402397e.tar.bz2
ingen-03aa3b084fe3d97f62b67867085c04a23402397e.zip
More port controls fixes/cleanups
git-svn-id: http://svn.drobilla.net/lad/ingen@78 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/PortModel.h6
-rw-r--r--src/libs/client/Store.cpp12
-rw-r--r--src/libs/client/Store.h1
-rw-r--r--src/progs/ingenuity/ControlPanel.cpp10
-rw-r--r--src/progs/ingenuity/ControlPanel.h13
-rw-r--r--src/progs/ingenuity/PortController.cpp31
-rw-r--r--src/progs/ingenuity/PortController.h10
7 files changed, 47 insertions, 36 deletions
diff --git a/src/libs/client/PortModel.h b/src/libs/client/PortModel.h
index 7743eed3..2ec6139e 100644
--- a/src/libs/client/PortModel.h
+++ b/src/libs/client/PortModel.h
@@ -20,6 +20,7 @@
#include <cstdlib>
#include <string>
#include <list>
+#include <sigc++/sigc++.h>
#include "ObjectModel.h"
#include "util/CountedPtr.h"
using std::string; using std::list;
@@ -77,7 +78,7 @@ public:
inline float user_max() const { return m_user_max; }
inline void user_max(float f) { m_user_max = f; }
inline float value() const { return m_current_val; }
- inline void value(float f) { m_current_val = f; }
+ inline void value(float f) { m_current_val = f; control_change_sig.emit(f); }
inline bool connected() { return m_connected; }
inline void connected(bool b) { m_connected = b; }
inline Type type() { return m_type; }
@@ -94,6 +95,9 @@ public:
inline bool operator==(const PortModel& pm)
{ return (m_path == pm.m_path); }
+ // Signals
+ sigc::signal<void, float> control_change_sig; ///< "Control" ports only
+
private:
// Prevent copies (undefined)
PortModel(const PortModel& copy);
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index ee621ad0..6a91feeb 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -36,6 +36,7 @@ Store::Store(SigClientInterface& emitter)
emitter.connection_sig.connect(sigc::mem_fun(this, &Store::connection_event));
emitter.disconnection_sig.connect(sigc::mem_fun(this, &Store::disconnection_event));
emitter.metadata_update_sig.connect(sigc::mem_fun(this, &Store::metadata_update_event));
+ emitter.control_change_sig.connect(sigc::mem_fun(this, &Store::control_change_event));
}
@@ -311,6 +312,17 @@ Store::metadata_update_event(const string& subject_path, const string& predicate
void
+Store::control_change_event(const string& port_path, float value)
+{
+ CountedPtr<PortModel> port = object(port_path);
+ if (port)
+ port->value(value);
+ else
+ cerr << "ERROR: metadata for nonexistant object." << endl;
+}
+
+
+void
Store::connection_event(const Path& src_port_path, const Path& dst_port_path)
{
// ConnectionModel has the clever patch-path-figuring-out stuff in it, so
diff --git a/src/libs/client/Store.h b/src/libs/client/Store.h
index 2dc94f2d..bed36cd9 100644
--- a/src/libs/client/Store.h
+++ b/src/libs/client/Store.h
@@ -73,6 +73,7 @@ private:
void new_node_event(const string& plugin_type, const string& plugin_uri, const string& node_path, bool is_polyphonic, uint32_t num_ports);
void new_port_event(const string& path, const string& data_type, bool is_output);
void metadata_update_event(const string& subject_path, const string& predicate, const string& value);
+ void control_change_event(const string& port_path, float value);
void connection_event(const Path& src_port_path, const Path& dst_port_path);
void disconnection_event(const Path& src_port_path, const Path& dst_port_path);
diff --git a/src/progs/ingenuity/ControlPanel.cpp b/src/progs/ingenuity/ControlPanel.cpp
index a42e1121..ee511e36 100644
--- a/src/progs/ingenuity/ControlPanel.cpp
+++ b/src/progs/ingenuity/ControlPanel.cpp
@@ -98,7 +98,7 @@ ControlPanel::add_port(PortController* port)
{
assert(port);
assert(port->model());
- assert(port->control_panel() == NULL);
+ //assert(port->control_panel() == NULL);
const CountedPtr<PortModel> pm = port->port_model();
@@ -117,6 +117,8 @@ ControlPanel::add_port(PortController* port)
else
cg = new SliderControlGroup(this, pm, separator);
+ // FIXME: ControlGroup constructor should do this
+ pm->control_change_sig.connect(sigc::mem_fun(cg, &ControlGroup::set_value));
m_controls.push_back(cg);
m_control_box->pack_start(*cg, false, false, 0);
@@ -126,7 +128,7 @@ ControlPanel::add_port(PortController* port)
cg->enable();
}
- port->set_control_panel(this);
+ //port->set_control_panel(this);
Gtk::Requisition controls_size;
m_control_box->size_request(controls_size);
@@ -230,7 +232,7 @@ ControlPanel::value_changed(const Path& port_path, float val)
}
}
-
+/*
void
ControlPanel::set_range_min(const Path& port_path, float val)
{
@@ -259,7 +261,7 @@ ControlPanel::set_range_max(const Path& port_path, float val)
if (found == false)
cerr << "[ControlPanel::set_range_max] Unable to find control " << port_path << endl;
}
-
+*/
void
ControlPanel::all_voices_selected()
diff --git a/src/progs/ingenuity/ControlPanel.h b/src/progs/ingenuity/ControlPanel.h
index bae13c6c..77628156 100644
--- a/src/progs/ingenuity/ControlPanel.h
+++ b/src/progs/ingenuity/ControlPanel.h
@@ -71,19 +71,19 @@ public:
size_t num_controls() const { return m_controls.size(); }
pair<int,int> ideal_size() const { return m_ideal_size; }
- // Callback for ControlGroup
+ // Callback for ControlGroup (FIXME: ugly)
void value_changed(const Path& port_path, float val);
- inline void set_control(const Path& port_path, float value);
- void set_range_min(const Path& port_path, float value);
- void set_range_max(const Path& port_path, float value);
+ //inline void set_control(const Path& port_path, float value);
+ //void set_range_min(const Path& port_path, float value);
+ //void set_range_max(const Path& port_path, float value);
private:
void all_voices_selected();
void specific_voice_selected();
void voice_selected();
- bool m_callback_enabled;
+ bool m_callback_enabled;
pair<int,int> m_ideal_size;
@@ -101,6 +101,7 @@ private:
* Profiling has shown this is performance critical. Needs to be made
* faster.
*/
+/*
inline void
ControlPanel::set_control(const Path& port_path, const float val)
{
@@ -122,7 +123,7 @@ ControlPanel::set_control(const Path& port_path, const float val)
cerr << "[ControlPanel::set_control] Unable to find control " << port_path << endl;
m_callback_enabled = true;
}
-
+*/
} // namespace OmGtk
diff --git a/src/progs/ingenuity/PortController.cpp b/src/progs/ingenuity/PortController.cpp
index 941e9a72..1646f5b2 100644
--- a/src/progs/ingenuity/PortController.cpp
+++ b/src/progs/ingenuity/PortController.cpp
@@ -28,8 +28,8 @@ namespace OmGtk {
PortController::PortController(CountedPtr<PortModel> model)
: GtkObjectController(model),
m_module(NULL),
- m_port(NULL),
- m_control_panel(NULL)
+ m_port(NULL)
+ //m_control_panel(NULL)
{
assert(model);
assert(model->parent());
@@ -60,8 +60,8 @@ PortController::destroy()
NodeController* parent = (NodeController*)m_model->parent()->controller();
assert(parent != NULL);
- if (m_control_panel != NULL)
- m_control_panel->remove_port(path());
+ //if (m_control_panel != NULL)
+ // m_control_panel->remove_port(path());
parent->remove_port(path(), false);
}
@@ -91,6 +91,8 @@ PortController::metadata_update(const string& key, const string& value)
//cerr << path() << ": " << key << " = " << value << endl;
+/* Panel now listens to model signals..
+
if (key == "user-min") {
port_model()->user_min(atof(value.c_str()));
if (m_control_panel != NULL)
@@ -100,6 +102,8 @@ PortController::metadata_update(const string& key, const string& value)
if (m_control_panel != NULL)
m_control_panel->set_range_max(m_model->path(), atof(value.c_str()));
}
+*/
+ cerr << "FIXME: PortController::metadata_update" << endl;
if (m_module != NULL) {
if (key == "module-x") {
@@ -117,30 +121,19 @@ PortController::metadata_update(const string& key, const string& value)
}
-void
-PortController::control_change(float value)
-{
- // FIXME: double lookups
-
- port_model()->value(value);
-
- if (m_control_panel != NULL)
- m_control_panel->set_control(port_model()->path(), value);
-}
-
-
/** "Register" a control panel that is monitoring this port.
*
* The OmPort will handle notifying the ControlPanel when state
* changes occur, etc.
*/
+/*
void
PortController::set_control_panel(ControlPanel* cp)
{
assert(m_control_panel == NULL);
m_control_panel = cp;
}
-
+*/
void
PortController::set_path(const Path& new_path)
@@ -149,8 +142,8 @@ PortController::set_path(const Path& new_path)
if (m_port != NULL)
m_port->set_name(new_path.name());
- if (m_control_panel != NULL)
- m_control_panel->rename_port(m_model->path(), new_path);
+ //if (m_control_panel != NULL)
+ // m_control_panel->rename_port(m_model->path(), new_path);
m_model->set_path(new_path);
}
diff --git a/src/progs/ingenuity/PortController.h b/src/progs/ingenuity/PortController.h
index beffe875..2b7728be 100644
--- a/src/progs/ingenuity/PortController.h
+++ b/src/progs/ingenuity/PortController.h
@@ -35,7 +35,7 @@ namespace OmGtk {
class Controller;
class OmPort;
class OmPatchPort;
-class ControlPanel;
+//class ControlPanel;
class OmModule;
class OmPortModule;
class OmFlowCanvas;
@@ -64,10 +64,8 @@ public:
void create_port(OmModule* module);
void set_path(const Path& new_path);
- void control_change(float value);
-
- ControlPanel* control_panel() const { return m_control_panel; }
- void set_control_panel(ControlPanel* cp);
+ //ControlPanel* control_panel() const { return m_control_panel; }
+ //void set_control_panel(ControlPanel* cp);
CountedPtr<PortModel> port_model() const { return m_model; }
@@ -75,7 +73,7 @@ private:
OmPatchPort* m_patch_port; ///< Port on m_module
OmPortModule* m_module; ///< Port pseudo-module (for patch ports only)
OmPort* m_port; ///< Port on some other canvas module
- ControlPanel* m_control_panel; ///< Control panel that contains this port
+ //ControlPanel* m_control_panel; ///< Control panel that contains this port
};