From 03aa3b084fe3d97f62b67867085c04a23402397e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 22 Jun 2006 08:03:12 +0000 Subject: More port controls fixes/cleanups git-svn-id: http://svn.drobilla.net/lad/ingen@78 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/ingenuity/ControlPanel.cpp | 10 ++++++---- src/progs/ingenuity/ControlPanel.h | 13 +++++++------ src/progs/ingenuity/PortController.cpp | 31 ++++++++++++------------------- src/progs/ingenuity/PortController.h | 10 ++++------ 4 files changed, 29 insertions(+), 35 deletions(-) (limited to 'src/progs/ingenuity') 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 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 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 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 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 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 }; -- cgit v1.2.1