From eef1492730d7a217a6960a4bd53f866ac111cd19 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 3 Jul 2006 17:46:19 +0000 Subject: [PATCH] Enabled checkbox on patch windows working git-svn-id: http://svn.drobilla.net/lad@79 a436a847-0d15-0410-975c-d299462d15a1 --- ingen/src/libs/client/PatchModel.cpp | 20 +++++++++++++++++++ ingen/src/libs/client/PatchModel.h | 7 +++++-- ingen/src/libs/client/Store.cpp | 20 +++++++++++++++++++ ingen/src/libs/client/Store.h | 2 ++ ingen/src/libs/engine/ObjectSender.cpp | 4 +++- ingen/src/progs/ingenuity/PatchController.cpp | 7 ++++--- ingen/src/progs/ingenuity/PatchController.h | 4 ++-- ingen/src/progs/ingenuity/PatchTreeWindow.cpp | 4 ++-- ingen/src/progs/ingenuity/PatchView.cpp | 16 +++++++++++++-- ingen/src/progs/ingenuity/PatchView.h | 3 ++- 10 files changed, 74 insertions(+), 13 deletions(-) diff --git a/ingen/src/libs/client/PatchModel.cpp b/ingen/src/libs/client/PatchModel.cpp index d61258f3..659fca23 100644 --- a/ingen/src/libs/client/PatchModel.cpp +++ b/ingen/src/libs/client/PatchModel.cpp @@ -223,6 +223,26 @@ PatchModel::remove_connection(const string& src_port_path, const string& dst_por } +void +PatchModel::enable() +{ + if (!m_enabled) { + m_enabled = true; + enabled_sig.emit(); + } +} + + +void +PatchModel::disable() +{ + if (m_enabled) { + m_enabled = false; + disabled_sig.emit(); + } +} + + bool PatchModel::polyphonic() const { diff --git a/ingen/src/libs/client/PatchModel.h b/ingen/src/libs/client/PatchModel.h index f9b5b2e7..a6f786d3 100644 --- a/ingen/src/libs/client/PatchModel.h +++ b/ingen/src/libs/client/PatchModel.h @@ -67,14 +67,17 @@ public: const string& filename() const { return m_filename; } void filename(const string& f) { m_filename = f; } bool enabled() const { return m_enabled; } - void enabled(bool b) { m_enabled = b; } + void enable(); + void disable(); bool polyphonic() const; // Signals sigc::signal > new_node_sig; sigc::signal removed_node_sig; sigc::signal > new_connection_sig; - sigc::signal removed_connection_sig; + sigc::signal removed_connection_sig; + sigc::signal enabled_sig; + sigc::signal disabled_sig; private: // Prevent copies (undefined) diff --git a/ingen/src/libs/client/Store.cpp b/ingen/src/libs/client/Store.cpp index 6a91feeb..5bf8175d 100644 --- a/ingen/src/libs/client/Store.cpp +++ b/ingen/src/libs/client/Store.cpp @@ -33,6 +33,8 @@ Store::Store(SigClientInterface& emitter) emitter.new_patch_sig.connect(sigc::mem_fun(this, &Store::new_patch_event)); emitter.new_node_sig.connect(sigc::mem_fun(this, &Store::new_node_event)); emitter.new_port_sig.connect(sigc::mem_fun(this, &Store::new_port_event)); + emitter.patch_enabled_sig.connect(sigc::mem_fun(this, &Store::patch_enabled_event)); + emitter.patch_disabled_sig.connect(sigc::mem_fun(this, &Store::patch_disabled_event)); 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)); @@ -300,6 +302,24 @@ Store::new_port_event(const string& path, const string& type, bool is_output) } +void +Store::patch_enabled_event(const string& path) +{ + CountedPtr patch = object(path); + if (patch) + patch->enable(); +} + + +void +Store::patch_disabled_event(const string& path) +{ + CountedPtr patch = object(path); + if (patch) + patch->disable(); +} + + void Store::metadata_update_event(const string& subject_path, const string& predicate, const string& value) { diff --git a/ingen/src/libs/client/Store.h b/ingen/src/libs/client/Store.h index bed36cd9..7ee1388d 100644 --- a/ingen/src/libs/client/Store.h +++ b/ingen/src/libs/client/Store.h @@ -72,6 +72,8 @@ private: void new_patch_event(const string& path, uint32_t poly); 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 patch_enabled_event(const string& path); + void patch_disabled_event(const string& path); 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); diff --git a/ingen/src/libs/engine/ObjectSender.cpp b/ingen/src/libs/engine/ObjectSender.cpp index b79a5df0..872c8d92 100644 --- a/ingen/src/libs/engine/ObjectSender.cpp +++ b/ingen/src/libs/engine/ObjectSender.cpp @@ -80,7 +80,9 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch) const map& data = patch->metadata(); for (map::const_iterator j = data.begin(); j != data.end(); ++j) client->metadata_update(patch->path(), (*j).first, (*j).second); - + + if (patch->process()) + client->patch_enabled(patch->path()); } diff --git a/ingen/src/progs/ingenuity/PatchController.cpp b/ingen/src/progs/ingenuity/PatchController.cpp index 44275cd8..93603a12 100644 --- a/ingen/src/progs/ingenuity/PatchController.cpp +++ b/ingen/src/progs/ingenuity/PatchController.cpp @@ -248,7 +248,7 @@ PatchController::set_path(const Path& new_path) parent->patch_model()->rename_node(old_path, new_path); } - +#if 0 void PatchController::enable() { @@ -271,7 +271,7 @@ PatchController::disable() App::instance().patch_tree()->patch_disabled(m_model->path()); } - +#endif void PatchController::create_module(OmFlowCanvas* canvas) @@ -367,7 +367,8 @@ PatchController::create_view() } // Set run checkbox - m_patch_view->enabled(patch_model()->enabled()); + if (patch_model()->enabled()) + m_patch_view->enable(); } diff --git a/ingen/src/progs/ingenuity/PatchController.h b/ingen/src/progs/ingenuity/PatchController.h index 5fcee284..06236721 100644 --- a/ingen/src/progs/ingenuity/PatchController.h +++ b/ingen/src/progs/ingenuity/PatchController.h @@ -99,8 +99,8 @@ public: void set_path(const Path& new_path); - void enable(); - void disable(); + //void enable(); + //void disable(); CountedPtr patch_model() const { return m_patch_model; } diff --git a/ingen/src/progs/ingenuity/PatchTreeWindow.cpp b/ingen/src/progs/ingenuity/PatchTreeWindow.cpp index 1ecab057..0d761ec4 100644 --- a/ingen/src/progs/ingenuity/PatchTreeWindow.cpp +++ b/ingen/src/progs/ingenuity/PatchTreeWindow.cpp @@ -181,12 +181,12 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str) if ( ! pc->patch_model()->enabled()) { if (m_enable_signal) Controller::instance().enable_patch(patch_path); - pc->enable(); + //pc->enable(); row[m_patch_tree_columns.enabled_col] = true; } else { if (m_enable_signal) Controller::instance().disable_patch(patch_path); - pc->disable(); + //pc->disable(); row[m_patch_tree_columns.enabled_col] = false; } } diff --git a/ingen/src/progs/ingenuity/PatchView.cpp b/ingen/src/progs/ingenuity/PatchView.cpp index be9aa1d6..bc1de20f 100644 --- a/ingen/src/progs/ingenuity/PatchView.cpp +++ b/ingen/src/progs/ingenuity/PatchView.cpp @@ -72,6 +72,9 @@ PatchView::patch_controller(PatchController* pc) m_polyphony_label->set_text(txt); //m_description_window->patch_model(pc->model()); + + pc->patch_model()->enabled_sig.connect(sigc::mem_fun(this, &PatchView::enable)); + pc->patch_model()->disabled_sig.connect(sigc::mem_fun(this, &PatchView::disable)); } @@ -108,10 +111,19 @@ PatchView::process_toggled() void -PatchView::enabled(bool e) +PatchView::enable() { m_enable_signal = false; - m_process_checkbutton->set_active(e); + m_process_checkbutton->set_active(true); + m_enable_signal = true; +} + + +void +PatchView::disable() +{ + m_enable_signal = false; + m_process_checkbutton->set_active(false); m_enable_signal = true; } diff --git a/ingen/src/progs/ingenuity/PatchView.h b/ingen/src/progs/ingenuity/PatchView.h index 82aee9c7..975ef75e 100644 --- a/ingen/src/progs/ingenuity/PatchView.h +++ b/ingen/src/progs/ingenuity/PatchView.h @@ -66,7 +66,8 @@ public: void zoom_changed(); void process_toggled(); - void enabled(bool e); + void enable(); + void disable(); private: PatchController* m_patch;