From 5a7beed295e6c8cee627774b9ca4d2e0eff510c1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 14 Jun 2006 18:23:57 +0000 Subject: Removed unused cruft from GTK client git-svn-id: http://svn.drobilla.net/lad/grauph@37 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/demolition/DemolitionModel.cpp | 2 +- src/progs/gtk/App.cpp | 5 +- src/progs/gtk/App.h | 4 - src/progs/gtk/ControlGroups.cpp | 1 - src/progs/gtk/ControlInterface.cpp | 310 ------------------------------- src/progs/gtk/ControlInterface.h | 129 ------------- src/progs/gtk/Controller.cpp | 4 +- src/progs/gtk/Controller.h | 2 - src/progs/gtk/GtkClientInterface.cpp | 81 -------- src/progs/gtk/GtkClientInterface.h | 156 ---------------- src/progs/gtk/LoadPluginWindow.cpp | 2 +- src/progs/gtk/Makefile.am | 6 - src/progs/gtk/NewSubpatchWindow.cpp | 2 +- src/progs/gtk/PatchController.cpp | 4 +- src/progs/gtk/main.cpp | 7 +- src/progs/gtk/singletons.cpp | 2 - 16 files changed, 8 insertions(+), 709 deletions(-) delete mode 100644 src/progs/gtk/ControlInterface.cpp delete mode 100644 src/progs/gtk/ControlInterface.h delete mode 100644 src/progs/gtk/GtkClientInterface.cpp delete mode 100644 src/progs/gtk/GtkClientInterface.h (limited to 'src/progs') diff --git a/src/progs/demolition/DemolitionModel.cpp b/src/progs/demolition/DemolitionModel.cpp index b4faa533..056c18e4 100644 --- a/src/progs/demolition/DemolitionModel.cpp +++ b/src/progs/demolition/DemolitionModel.cpp @@ -161,7 +161,7 @@ DemolitionModel::node(const Path& path) NodeModel* ret = NULL; for (vector::iterator i = m_patches.begin(); i != m_patches.end(); ++i) { - ret = (*i)->get_node(path.name()); + ret = (*i)->get_node(path.name()).get(); if (ret != NULL) break; } diff --git a/src/progs/gtk/App.cpp b/src/progs/gtk/App.cpp index 6b71b4ec..4c42ff90 100644 --- a/src/progs/gtk/App.cpp +++ b/src/progs/gtk/App.cpp @@ -22,7 +22,6 @@ #include #include #include -#include "ControlInterface.h" #include "PatchView.h" #include "OmModule.h" #include "ControlPanel.h" @@ -57,8 +56,7 @@ namespace OmGtk { class OmPort; App::App() -: m_control_interface(new ControlInterface(this)), - m_configuration(new Configuration()), +: m_configuration(new Configuration()), m_about_dialog(NULL), m_enable_signal(true) { @@ -80,7 +78,6 @@ App::App() App::~App() { - delete m_control_interface; } diff --git a/src/progs/gtk/App.h b/src/progs/gtk/App.h index 1ba18962..dc5e3904 100644 --- a/src/progs/gtk/App.h +++ b/src/progs/gtk/App.h @@ -50,7 +50,6 @@ class OmPort; class OmFlowCanvas; class PatchTreeView; class PatchTreeWindow; -class ControlInterface; class ConnectWindow; class Configuration; @@ -84,8 +83,6 @@ public: PatchTreeWindow* patch_tree() const { return m_patch_tree_window; } Configuration* configuration() const { return m_configuration; } - ControlInterface* control_interface() { return m_control_interface; } - static void instantiate() { if (!_instance) _instance = new App(); } static inline App& instance() { assert(_instance); return *_instance; } @@ -96,7 +93,6 @@ protected: //bool connect_callback(); //bool idle_callback(); - ControlInterface* m_control_interface; Configuration* m_configuration; list m_windows; diff --git a/src/progs/gtk/ControlGroups.cpp b/src/progs/gtk/ControlGroups.cpp index b15d4d5a..b5834f3c 100644 --- a/src/progs/gtk/ControlGroups.cpp +++ b/src/progs/gtk/ControlGroups.cpp @@ -18,7 +18,6 @@ #include "ControlPanel.h" #include "PortModel.h" #include "Controller.h" -//#include "GtkClientInterface.h" #include #include using std::cerr; using std::cout; using std::endl; diff --git a/src/progs/gtk/ControlInterface.cpp b/src/progs/gtk/ControlInterface.cpp deleted file mode 100644 index 2b22eee1..00000000 --- a/src/progs/gtk/ControlInterface.cpp +++ /dev/null @@ -1,310 +0,0 @@ -/* This file is part of Om. Copyright (C) 2006 Dave Robillard. - * - * Om is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Om is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "ControlInterface.h" -#include "App.h" - -#include "PluginModel.h" -#include "PatchModel.h" -#include "NodeModel.h" -#include "PortModel.h" -#include "ConnectionModel.h" - -#include "PatchController.h" -#include "PortController.h" -#include "PatchTreeWindow.h" -#include "Store.h" - -namespace OmGtk -{ - - -void -ControlInterface::error(const string& msg) -{ - _app->error_message(msg); -} - - -void -ControlInterface::new_plugin_model(PluginModel* pm) -{ - cerr << "NEW PLUGIN\n"; - //Store::instance().add_plugin(pm); -} - - -void -ControlInterface::new_patch_model(PatchModel* const pm) -{ - assert(pm); - - //cout << "[ControlInterface] New patch." << endl; - - if (Store::instance().patch(pm->path())) { - delete pm; - } else { - - // See if we cached this patch model to store its location (to avoid the - // module "jumping") and filename (which isn't sent to engine) - /*PatchModel* pm = _controller->yank_added_patch(pm->path()); - if (pm != NULL) { - assert(pm->path() == pm->path()); - // FIXME: ew - if (pm->parent() != NULL) - pm->set_parent(NULL); - const PluginModel* plugin = pm->plugin(); - *pm = *pm; - pm->plugin(plugin); - }*/ - - assert(!pm->parent()); - PatchController* patch = new PatchController(pm); - //Store::instance().add_object(patch); - //_app->patch_tree()->add_patch(patch); - - if (pm->path() == "/") - patch->show_patch_window(); - - //_app->add_patch(pm, show); - } -} - - -void -ControlInterface::new_node_model(NodeModel* const nm) -{ - assert(nm); - - cerr << "[ControlInterface] FIXME: New node: " << nm->name() << endl; -#if 0 - PatchController* const pc = Store::instance().patch(nm->path().parent()); - - if (pc != NULL) { - /* FIXME: this is crazy slow, and slows down patch loading too much. Define some - * kind of unified string to describe all plugins (ie ladspa:amp.so:amp_gaia) and - * just store that in node models, and look it up when needed */ - - /* Bit of a hack, throw away the placeholder PluginModel in the NodeModel - * and set it to the nice complete one we have stored */ - - for (map::const_iterator i = Store::instance().plugins().begin(); - i != Store::instance().plugins().end(); ++i) { - if ((*i).second->uri() == nm->plugin()->uri()) { - // FIXME: EVIL - delete (PluginModel*)(nm->plugin()); - nm->plugin((*i).second); - break; - } - } - - pc->add_node(nm); - - } else { - cerr << "[NewNode] Can not find parent of " << nm->path() - << ". Module will not appear." << endl; - } - #endif -} - - -void -ControlInterface::new_port_model(PortModel* const pm) -{ - assert(pm); - - cout << "[ControlInterface] FIXME: New port." << endl; -/* - NodeController* node = Store::instance().node(pm->path().parent()); - if (node != NULL) - node->add_port(pm); - else - cerr << "[NewPort] Could not find parent for " - << pm->path() << endl; - */ -} - - -void -ControlInterface::patch_enabled(const string& path) -{ - //cout << "[ControlInterface] Patch enabled." << endl; -/* - PatchController* patch = Store::instance().patch(path); - if (patch != NULL) - patch->enable(); - else - cerr << "[PatchEnabled] Cannot find patch " << path << endl; - */ -} - - -void -ControlInterface::patch_disabled(const string& path) -{ - //cout << "[ControlInterface] Patch disabled." << endl; -/* - PatchController* patch = Store::instance().patch(path); - if (patch != NULL) - patch->disable(); - else - cerr << "[PatchDisabled] Cannot find patch " << path << endl; - */ -} - - -void -ControlInterface::patch_cleared(const string& path) -{ - //cout << "[ControlInterface] Patch cleared." << endl; -/* - PatchController* patch = Store::instance().patch(path); - if (patch != NULL) - patch->clear(); - else - cerr << "[PatchCleared] Cannot find patch " << path << endl; - */ -} - - -void -ControlInterface::object_destroyed(const string& path) -{ - //cout << "[ControlInterface] Destroying." << endl; -/* - GtkObjectController* object = Store::instance().object(path); - if (object != NULL) { - object->destroy(); - delete object; - } else { - cerr << "[Destroy] Cannot find object " << path << endl; - } - */ -} - - -void -ControlInterface::object_renamed(const string& old_path, const string& new_path) -{ - //cout << "[ControlInterface] Renaming." << endl; -/* - GtkObjectController* object = Store::instance().object(old_path); - if (object != NULL) - object->set_path(new_path); - else - cerr << "[ObjectRenamed] Can not find object " << old_path - << " to rename." << endl; - */ -} - - -void -ControlInterface::connection_model(ConnectionModel* connection) -{ - assert(connection); - - //cout << "[ControlInterface] Connection" << endl; -/* - assert(connection->src_port_path().parent().parent() - == connection->dst_port_path().parent().parent()); - - PatchController* pc = Store::instance().patch(connection->patch_path()); - - if (pc != NULL) - pc->connection(connection); - else - cerr << "[Connection] Can not find patch " << connection->patch_path() - << ". Connection will not be made." << endl; - */ -} - - -void -ControlInterface::disconnection(const string& src_port_path, const string& dst_port_path) -{ - //cerr << "[ControlInterface] Disconnection." << endl; -/* string patch_path = src_port_path; - patch_path = patch_path.substr(0, patch_path.find_last_of("/")); - patch_path = patch_path.substr(0, patch_path.find_last_of("/")); - - if (patch_path == "") - patch_path = "/"; - - PatchController* pc = Store::instance().patch(patch_path); - - if (pc != NULL) - pc->disconnection(src_port_path, dst_port_path); - else - cerr << "[Disconnection] Can not find window for patch " << patch_path - << ". Connection will not be removed." << endl; - */ -} - - -void -ControlInterface::metadata_update(const string& path, const string& key, const string& value) -{ /* - //cerr << "[ControlInterface] Metadata." << endl; - GtkObjectController* object = Store::instance().object(path); - if (object != NULL) - object->metadata_update(key, value); - else - cerr << "[MetadataUpdate] Could not find object " << path << endl; -*/ } - - -void -ControlInterface::control_change(const string& port_path, float value) -{ /* - //cerr << "[ControlInterface] Control change." << endl; - - PortController* port = Store::instance().port(port_path); - if (port != NULL) - port->control_change(value); - else - cerr << "[ControlChange] Can not find port " << port_path << endl; -*/ } - - -void -ControlInterface::program_add(const string& path, uint32_t bank, uint32_t program, const string& name) -{ /* - NodeController* node = Store::instance().node(path); - if (node != NULL) { - node->program_add(bank, program, name); - return; - } else { - cerr << "[ProgramAdd] Can not find node " << path << endl; - } -*/ } - - -void -ControlInterface::program_remove(const string& path, uint32_t bank, uint32_t program) -{ /* - NodeController* node = Store::instance().node(path); - if (node != NULL) { - node->program_remove(bank, program); - return; - } else { - cerr << "[ProgramRemove] Can not find node " << path << endl; - } -*/ } - - -} // namespace OmGtk diff --git a/src/progs/gtk/ControlInterface.h b/src/progs/gtk/ControlInterface.h deleted file mode 100644 index 8cba6a79..00000000 --- a/src/progs/gtk/ControlInterface.h +++ /dev/null @@ -1,129 +0,0 @@ -/* This file is part of Om. Copyright(C) 2006 Dave Robillard. - * - * Om is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or(at your option) any later - * version. - * - * Om is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef CONTROLINTERFACE_H -#define CONTROLINTERFACE_H - -#include -#include "ModelClientInterface.h" -#include -#include -using std::string; - -namespace LibOmClient -{ -class PluginModel; -class PatchModel; -class NodeModel; -class PortModel; -class ConnectionModel; -} -using namespace LibOmClient; - -namespace OmGtk -{ - -class App; - - -/** Provides the public interface for controlling OmGtk(via engine events). - * - * All control of OmGtk from the engine happens through this interface. - * - * All of these functions must be called in the GTK thread. This is a unified - * interface for controlling OmGtk(eg from the engine) but it doesn't take - * care of any threading issues. - * - * \ingroup OmGtk - */ -class ControlInterface : public sigc::trackable//, public ModelClientInterface -{ -public: - - ControlInterface(App* app) - : error_slot(sigc::mem_fun(this, &ControlInterface::error)) - , new_plugin_slot(sigc::mem_fun(this, &ControlInterface::new_plugin_model)) - , new_patch_slot(sigc::mem_fun(this, &ControlInterface::new_patch_model)) - , new_node_slot(sigc::mem_fun(this, &ControlInterface::new_node_model)) - , new_port_slot(sigc::mem_fun(this, &ControlInterface::new_port_model)) - , patch_enabled_slot(sigc::mem_fun(this, &ControlInterface::patch_enabled)) - , patch_disabled_slot(sigc::mem_fun(this, &ControlInterface::patch_disabled)) - , patch_cleared_slot(sigc::mem_fun(this, &ControlInterface::patch_cleared)) - , object_destroyed_slot(sigc::mem_fun(this, &ControlInterface::object_destroyed)) - , object_renamed_slot(sigc::mem_fun(this, &ControlInterface::object_renamed)) - , connection_slot(sigc::mem_fun(this, &ControlInterface::connection_model)) - , disconnection_slot(sigc::mem_fun(this, &ControlInterface::disconnection)) - , metadata_update_slot(sigc::mem_fun(this, &ControlInterface::metadata_update)) - , control_change_slot(sigc::mem_fun(this, &ControlInterface::control_change)) - , program_add_slot(sigc::mem_fun(this, &ControlInterface::program_add)) - , program_remove_slot(sigc::mem_fun(this, &ControlInterface::program_remove)) - , _app(app) - { - assert(_app); - } - - virtual ~ControlInterface() {} - - sigc::slot bundle_begin_slot; - sigc::slot bundle_end_slot; - sigc::slot num_plugins_slot; - sigc::slot error_slot; - sigc::slot new_plugin_slot; - sigc::slot new_patch_slot; - sigc::slot new_node_slot; - sigc::slot new_port_slot; - sigc::slot patch_enabled_slot; - sigc::slot patch_disabled_slot; - sigc::slot patch_cleared_slot; - sigc::slot object_destroyed_slot; - sigc::slot object_renamed_slot; - sigc::slot connection_slot; - sigc::slot disconnection_slot; - sigc::slot metadata_update_slot; - sigc::slot control_change_slot; - sigc::slot program_add_slot; - sigc::slot program_remove_slot; - -private: - - void bundle_begin(); - void bundle_end(); - void num_plugins(uint32_t); - void error(const string&); - void new_plugin_model(PluginModel*); - void new_patch_model(PatchModel*); - void new_node_model(NodeModel*); - void new_port_model(PortModel*); - void patch_enabled(const string&); - void patch_disabled(const string&); - void patch_cleared(const string&); - void object_destroyed(const string&); - void object_renamed(const string&, const string&); - void connection_model(ConnectionModel*); - void disconnection(const string&, const string&); - void metadata_update(const string&, const string&, const string&); - void control_change(const string&, float); - void program_add(const string&, uint32_t, uint32_t, const string&); - void program_remove(const string&, uint32_t, uint32_t); - - App* _app; -}; - - -} // namespace OmGtk - -#endif // CONTROLINTERFACE_H - diff --git a/src/progs/gtk/Controller.cpp b/src/progs/gtk/Controller.cpp index 9a85914b..9bf9aca5 100644 --- a/src/progs/gtk/Controller.cpp +++ b/src/progs/gtk/Controller.cpp @@ -16,10 +16,8 @@ #include "PatchModel.h" #include "PatchController.h" -#include "ControlInterface.h" #include "OSCModelEngineInterface.h" #include "OSCListener.h" -//#include "GtkClientInterface.h" #include "PatchLibrarian.h" #include "Controller.h" #include "Loader.h" @@ -90,7 +88,7 @@ Controller::create_patch_from_model(const PatchModel* pm) //int id = get_next_request_id(); //set_wait_response_id(id); - create_patch_from_model(pm); + OSCModelEngineInterface::create_patch_from_model(pm); if (pm->parent()) { // wait_for_response(); char temp_buf[16]; diff --git a/src/progs/gtk/Controller.h b/src/progs/gtk/Controller.h index fd516992..0f1e3249 100644 --- a/src/progs/gtk/Controller.h +++ b/src/progs/gtk/Controller.h @@ -36,7 +36,6 @@ using namespace LibOmClient; namespace OmGtk { class PatchController; -//class GtkClientInterface; class Loader; @@ -79,7 +78,6 @@ public: void push_added_patch(PatchModel* pm) { m_added_patches.push_back(pm); } PatchModel* yank_added_patch(const string& path); */ - //GtkClientInterface* client_hooks() { return (GtkClientInterface*)m_client_hooks; } static void instantiate(const string& engine_url) { if (!_instance) _instance = new Controller(engine_url); } diff --git a/src/progs/gtk/GtkClientInterface.cpp b/src/progs/gtk/GtkClientInterface.cpp deleted file mode 100644 index 7bda1e9e..00000000 --- a/src/progs/gtk/GtkClientInterface.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* This file is part of Om. Copyright (C) 2006 Dave Robillard. - * - * Om is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Om is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "GtkClientInterface.h" -#include -#include -#include -#include -#include -#include "ControlInterface.h" - -namespace OmGtk { - - -GtkClientInterface::GtkClientInterface(ControlInterface* interface, int client_port) -: OSCListener(client_port) -, ModelClientInterface() -, _interface(interface) -, _num_plugins(0) -, _events(4096) -{ -} - - -/** Push an event (from the engine, ie 'new patch') on to the queue. - */ -void -GtkClientInterface::push_event(Closure ev) -{ - bool success = false; - bool first = true; - - // (Very) slow busy-wait if the queue is full - // FIXME: Make this wait on a signal from process_events iff this happens - while (!success) { - success = _events.push(ev); - if (!success) { - if (first) { - cerr << "[GtkClientInterface] WARNING: (Client) event queue full. Waiting to try again..." << endl; - first = false; - } - usleep(200000); // 100 milliseconds (2* rate process_events is called) - } - } -} - - -/** Process all queued events that came from the OSC thread. - * - * This function is to be called from the Gtk thread only. - */ -bool -GtkClientInterface::process_events() -{ - // Process a maximum of queue-size events, to prevent locking the GTK - // thread indefinitely while processing continually arriving events - size_t num_processed = 0; - while (!_events.is_empty() && num_processed++ < _events.capacity()/2) { - Closure& ev = _events.pop(); - ev(); - ev.disconnect(); - } - - return true; -} - - -} // namespace OmGtk diff --git a/src/progs/gtk/GtkClientInterface.h b/src/progs/gtk/GtkClientInterface.h deleted file mode 100644 index 7214ef19..00000000 --- a/src/progs/gtk/GtkClientInterface.h +++ /dev/null @@ -1,156 +0,0 @@ -/* This file is part of Om. Copyright (C) 2006 Dave Robillard. - * - * Om is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Om is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef GTKCLIENTHOOKS_H -#define GTKCLIENTHOOKS_H - -#include -#include -#include -#include -#include -#include "ControlInterface.h" -#include "OSCListener.h" -#include "util/Queue.h" -#include "util/CountedPtr.h" -#include "ModelClientInterface.h" -#include "SigClientInterface.h" -using std::string; -using std::cerr; using std::endl; - -namespace LibOmClient { class PluginModel; } -using namespace LibOmClient; - -namespace OmGtk { - -/** Returns nothing and takes no parameters (because they have been bound) */ -typedef sigc::slot Closure; - -#if 0 -/** ModelClientInterface implementation for the Gtk client. - * - * This is a threadsafe interface to OmGtk. It provides the same interface as - * @ref ControlInterface, except all public functions may be called in a thread - * other than the GTK thread (a closure will be created and pushed through a - * queue for the GTK thread to execute). - * - * It is also a ModelClientInterface, which is how it is driven by the engine. - * This is redundant, "ControlInterface" needs to go away. A model database - * that wraps a ClientInterface and emits sigc signals when things change would - * be a much better way of doing this. - * - * \ingroup OmGtk - */ -class GtkClientInterface : public OSCListener, public ModelClientInterface -{ -public: - GtkClientInterface(ControlInterface* interface, int client_port); - - void set_ignore_port(const string& path) { _ignore_port_path = path; } - void clear_ignore_port() { _ignore_port_path = ""; } - - // FIXME: ugly accessor - size_t num_plugins() const { return _num_plugins; } - - // OSC thread functions (deferred calls) - - void bundle_begin() {} - void bundle_end() {} - - void num_plugins(size_t num) { _num_plugins = num; } - - void error(const string& msg) - { push_event(sigc::bind(_interface->error_slot, msg)); } - - void new_plugin_model(PluginModel* const pm) - { push_event(sigc::bind(_interface->new_plugin_slot, pm)); } - - void new_patch_model(PatchModel* const pm) - { push_event(sigc::bind(_interface->new_patch_slot, pm)); } - - void new_node_model(NodeModel* const nm) - { assert(nm); push_event(sigc::bind(_interface->new_node_slot, nm)); } - - void new_port_model(PortModel* const pm) - { push_event(sigc::bind(_interface->new_port_slot, pm)); } - - void connection_model(ConnectionModel* const cm) - { push_event(sigc::bind(_interface->connection_slot, cm)); } - - void object_destroyed(const string& path) - { push_event(sigc::bind(_interface->object_destroyed_slot, path)); } - - void patch_enabled(const string& path) - { push_event(sigc::bind(_interface->patch_enabled_slot, path)); } - - void patch_disabled(const string& path) - { push_event(sigc::bind(_interface->patch_disabled_slot, path)); } - - void patch_cleared(const string& path) - { push_event(sigc::bind(_interface->patch_cleared_slot, path)); } - - void object_renamed(const string& old_path, const string& new_path) - { push_event(sigc::bind(_interface->object_renamed_slot, old_path, new_path)); } - - void disconnection(const string& src_port_path, const string& dst_port_path) - { push_event(sigc::bind(_interface->disconnection_slot, src_port_path, dst_port_path)); } - - void metadata_update(const string& path, const string& key, const string& value) - { push_event(sigc::bind(_interface->metadata_update_slot, path, key, value)); } - - void control_change(const string& port_path, float value) - { push_event(sigc::bind(_interface->control_change_slot, port_path, value)); } - - void program_add(const string& path, uint32_t bank, uint32_t program, const string& name) - { push_event(sigc::bind(_interface->program_add_slot, path, bank, program, name)); } - - void program_remove(const string& path, uint32_t bank, uint32_t program) - { push_event(sigc::bind(_interface->program_remove_slot, path, bank, program)); } - - /** Process all queued events - MUST be called from Gtk thread. - * Registered as a GTK idle handler by App. */ - bool process_events(); - - static void instantiate(ControlInterface* interface, int client_port) - { if (!_instance) _instance = new GtkClientInterface(interface, client_port); } - - inline static CountedPtr instance() - { assert(_instance); return _instance; } - -private: - - static CountedPtr _instance; - - /** Provides the functions/slots the closures will actually call in the GTK thread */ - ControlInterface* _interface; - - size_t _num_plugins; - - void push_event(Closure ev); - - /** Set if a port slider is grabbed and is being dragged. - * If a control event comes in for a port with this path, we'll just - * ignore it outright. (Just an optimization over doing all the searching - * for the port slider just to ignore the event) */ - string _ignore_port_path; - - Queue _events; -}; -#endif - -} // namespace OmGtk - -#endif // GTKCLIENTHOOKS_H diff --git a/src/progs/gtk/LoadPluginWindow.cpp b/src/progs/gtk/LoadPluginWindow.cpp index bd11320a..a1eba51c 100644 --- a/src/progs/gtk/LoadPluginWindow.cpp +++ b/src/progs/gtk/LoadPluginWindow.cpp @@ -251,7 +251,7 @@ LoadPluginWindow::generate_module_name(int offset) name += "_"; name += num_buf; } - if (m_patch_controller->patch_model()->get_node(name) == NULL) + if (!m_patch_controller->patch_model()->get_node(name)) break; else name = ""; diff --git a/src/progs/gtk/Makefile.am b/src/progs/gtk/Makefile.am index c9320bcc..16c99949 100644 --- a/src/progs/gtk/Makefile.am +++ b/src/progs/gtk/Makefile.am @@ -45,8 +45,6 @@ om_gtk_SOURCES = \ MessagesWindow.cpp \ LoadSubpatchWindow.h \ LoadSubpatchWindow.cpp \ - ControlInterface.h \ - ControlInterface.cpp \ NodeControlWindow.h \ NodeControlWindow.cpp \ ControlPanel.h \ @@ -85,10 +83,6 @@ om_gtk_SOURCES = \ PatchTreeWindow.h \ PatchTreeWindow.cpp -#GtkClientInterface.h -#GtkClientInterface.cpp - - if WITH_LASH om_gtk_SOURCES += LashController.h LashController.cpp endif diff --git a/src/progs/gtk/NewSubpatchWindow.cpp b/src/progs/gtk/NewSubpatchWindow.cpp index dc4e47b4..6f64d9e8 100644 --- a/src/progs/gtk/NewSubpatchWindow.cpp +++ b/src/progs/gtk/NewSubpatchWindow.cpp @@ -63,7 +63,7 @@ NewSubpatchWindow::name_changed() if (name.find("/") != string::npos) { m_message_label->set_text("Name may not contain '/'"); m_ok_button->property_sensitive() = false; - } else if (m_patch_controller->patch_model()->get_node(name) != NULL) { + } else if (m_patch_controller->patch_model()->get_node(name)) { m_message_label->set_text("An object already exists with that name."); m_ok_button->property_sensitive() = false; } else if (name.length() == 0) { diff --git a/src/progs/gtk/PatchController.cpp b/src/progs/gtk/PatchController.cpp index 10f2f639..cbc8f626 100644 --- a/src/progs/gtk/PatchController.cpp +++ b/src/progs/gtk/PatchController.cpp @@ -431,7 +431,7 @@ PatchController::add_node(CountedPtr nm) // FIXME: Should PatchController really be responsible for creating these? NodeController* nc = NULL; - if (nm->plugin()->type() == PluginModel::DSSI) + if (nm->plugin() && nm->plugin()->type() == PluginModel::DSSI) nc = new DSSIController(nm); else nc = new NodeController(nm); @@ -439,7 +439,7 @@ PatchController::add_node(CountedPtr nm) assert(nc != NULL); assert(nm->controller() == nc); - // Check if this is a bridge node + // Check if this is a bridge node - FIXME: remove this CountedPtr pm = patch_model()->get_port(nm->path().name()); if (pm) { cerr << "Bridge node." << endl; diff --git a/src/progs/gtk/main.cpp b/src/progs/gtk/main.cpp index 702d52f9..a5f41e90 100644 --- a/src/progs/gtk/main.cpp +++ b/src/progs/gtk/main.cpp @@ -21,11 +21,11 @@ #include "Store.h" #include "Controller.h" #include "Configuration.h" -#include "GtkClientInterface.h" #ifdef HAVE_LASH #include "LashController.h" #endif #include "ThreadedSigClientInterface.h" +#include "OSCListener.h" using Om::Shared::ClientInterface; using namespace OmGtk; @@ -70,15 +70,10 @@ main(int argc, char** argv) OSCSigEmitter* emitter = new OSCSigEmitter(1024, 16181); - //CountedPtr emitter(new OSCSigEmitter(1024, 16181)); - /* Instantiate all singletons */ App::instantiate(); Store::instantiate(*(SigClientInterface*)emitter); - ControlInterface* gtk_interface = App::instance().control_interface(); - assert(gtk_interface); - //GtkClientInterface::instantiate(App::instance().control_interface(), client_port); Controller::instantiate(engine_url); /* Load settings */ diff --git a/src/progs/gtk/singletons.cpp b/src/progs/gtk/singletons.cpp index 75b441e9..b5544af3 100644 --- a/src/progs/gtk/singletons.cpp +++ b/src/progs/gtk/singletons.cpp @@ -17,13 +17,11 @@ #include "App.h" #include "Store.h" #include "Controller.h" -//#include "GtkClientInterface.h" namespace OmGtk { App* App::_instance = 0; Store* Store::_instance = 0; Controller* Controller::_instance = 0; - //CountedPtr GtkClientInterface::_instance = 0; } -- cgit v1.2.1