summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-06-14 18:23:57 +0000
committerDavid Robillard <d@drobilla.net>2006-06-14 18:23:57 +0000
commit5a7beed295e6c8cee627774b9ca4d2e0eff510c1 (patch)
treedf080d187fc75292a163d5ab7331b15027e81154 /src
parent52f5c887cf8d4149278d137684f8f1ee31231d65 (diff)
downloadingen-5a7beed295e6c8cee627774b9ca4d2e0eff510c1.tar.gz
ingen-5a7beed295e6c8cee627774b9ca4d2e0eff510c1.tar.bz2
ingen-5a7beed295e6c8cee627774b9ca4d2e0eff510c1.zip
Removed unused cruft from GTK client
git-svn-id: http://svn.drobilla.net/lad/grauph@37 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/PatchModel.cpp8
-rw-r--r--src/libs/client/PatchModel.h27
-rw-r--r--src/libs/client/Store.cpp13
-rw-r--r--src/libs/engine/ObjectSender.cpp6
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.cpp6
-rw-r--r--src/progs/demolition/DemolitionModel.cpp2
-rw-r--r--src/progs/gtk/App.cpp5
-rw-r--r--src/progs/gtk/App.h4
-rw-r--r--src/progs/gtk/ControlGroups.cpp1
-rw-r--r--src/progs/gtk/ControlInterface.cpp310
-rw-r--r--src/progs/gtk/ControlInterface.h129
-rw-r--r--src/progs/gtk/Controller.cpp4
-rw-r--r--src/progs/gtk/Controller.h2
-rw-r--r--src/progs/gtk/GtkClientInterface.cpp81
-rw-r--r--src/progs/gtk/GtkClientInterface.h156
-rw-r--r--src/progs/gtk/LoadPluginWindow.cpp2
-rw-r--r--src/progs/gtk/Makefile.am6
-rw-r--r--src/progs/gtk/NewSubpatchWindow.cpp2
-rw-r--r--src/progs/gtk/PatchController.cpp4
-rw-r--r--src/progs/gtk/main.cpp7
-rw-r--r--src/progs/gtk/singletons.cpp2
21 files changed, 46 insertions, 731 deletions
diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp
index 551b3d4c..7d786301 100644
--- a/src/libs/client/PatchModel.cpp
+++ b/src/libs/client/PatchModel.cpp
@@ -49,12 +49,12 @@ PatchModel::set_path(const Path& new_path)
}
-NodeModel*
+CountedPtr<NodeModel>
PatchModel::get_node(const string& name)
{
assert(name.find("/") == string::npos);
NodeModelMap::iterator i = m_nodes.find(name);
- return ((i != m_nodes.end()) ? (*i).second.get() : NULL);
+ return ((i != m_nodes.end()) ? (*i).second : CountedPtr<NodeModel>(NULL));
}
@@ -173,9 +173,9 @@ PatchModel::add_connection(CountedPtr<ConnectionModel> cm)
return;
}
- NodeModel* src_node = get_node(cm->src_port_path().parent().name());
+ NodeModel* src_node = get_node(cm->src_port_path().parent().name()).get();
PortModel* src_port = (src_node == NULL) ? NULL : src_node->get_port(cm->src_port_path().name()).get();
- NodeModel* dst_node = get_node(cm->dst_port_path().parent().name());
+ NodeModel* dst_node = get_node(cm->dst_port_path().parent().name()).get();
PortModel* dst_port = (dst_node == NULL) ? NULL : dst_node->get_port(cm->dst_port_path().name()).get();
assert(src_port != NULL);
diff --git a/src/libs/client/PatchModel.h b/src/libs/client/PatchModel.h
index 6b3b212f..c099d768 100644
--- a/src/libs/client/PatchModel.h
+++ b/src/libs/client/PatchModel.h
@@ -44,20 +44,21 @@ public:
m_poly(poly)
{}
- const NodeModelMap& nodes() const { return m_nodes; }
+ const NodeModelMap& nodes() const { return m_nodes; }
const list<CountedPtr<ConnectionModel> >& connections() const { return m_connections; }
virtual void set_path(const Path& path);
- NodeModel* get_node(const string& node_name);
- void add_node(CountedPtr<NodeModel> nm);
- void remove_node(const string& name);
+ CountedPtr<NodeModel> get_node(const string& node_name);
+ void add_node(CountedPtr<NodeModel> nm);
+ void remove_node(const string& name);
- void rename_node(const Path& old_path, const Path& new_path);
- void rename_node_port(const Path& old_path, const Path& new_path);
+ void rename_node(const Path& old_path, const Path& new_path);
+ void rename_node_port(const Path& old_path, const Path& new_path);
+
CountedPtr<ConnectionModel> get_connection(const string& src_port_path, const string& dst_port_path);
- void add_connection(CountedPtr<ConnectionModel> cm);
- void remove_connection(const string& src_port_path, const string& dst_port_path);
+ void add_connection(CountedPtr<ConnectionModel> cm);
+ void remove_connection(const string& src_port_path, const string& dst_port_path);
virtual void clear();
@@ -80,11 +81,11 @@ private:
PatchModel(const PatchModel& copy);
PatchModel& operator=(const PatchModel& copy);
- NodeModelMap m_nodes;
- list<CountedPtr<ConnectionModel> > m_connections;
- string m_filename;
- bool m_enabled;
- size_t m_poly;
+ NodeModelMap m_nodes;
+ list<CountedPtr<ConnectionModel> > m_connections;
+ string m_filename;
+ bool m_enabled;
+ size_t m_poly;
};
typedef map<string, PatchModel*> PatchModelMap;
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index d1555f4d..ef70dc28 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -209,6 +209,17 @@ Store::new_patch_event(const string& path, uint32_t poly)
if (m_objects.find(path) == m_objects.end()) {
PatchModel* const p = new PatchModel(path, poly);
add_object(p);
+
+ std::map<string, CountedPtr<ObjectModel> >::iterator pi = m_objects.find(p->path().parent());
+ if (pi != m_objects.end()) {
+ CountedPtr<PatchModel> parent = (*pi).second;
+ if (parent) {
+ p->set_parent(parent);
+ parent->add_node(p);
+ } else {
+ cerr << "ERROR: new patch with no parent" << endl;
+ }
+ }
}
}
@@ -217,8 +228,6 @@ void
Store::new_node_event(const string& plugin_type, const string& plugin_uri, const string& node_path, bool is_polyphonic, uint32_t num_ports)
{
// FIXME: What to do with a conflict?
- // FIXME: resolve plugin here
-
if (m_objects.find(node_path) == m_objects.end()) {
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index 9d3e535d..441cb2d9 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -90,8 +90,12 @@ ObjectSender::send_node(ClientInterface* client, const Node* node)
&& node->poly() == node->parent_patch()->internal_poly()
? 1 : 0);
- assert(node->plugin()->uri().length() > 0);
assert(node->path().length() > 0);
+ if (node->plugin()->uri().length() == 0) {
+ cerr << "Node " << node->path() << " plugin has no URI! Not sending." << endl;
+ return;
+ }
+
client->bundle_begin();
diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp
index 17367dd4..4c4e19a7 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.cpp
+++ b/src/libs/engine/events/DisconnectNodeEvent.cpp
@@ -127,11 +127,13 @@ void
DisconnectNodeEvent::post_process()
{
if (m_succeeded) {
- m_responder->respond_ok();
+ if (m_responder)
+ m_responder->respond_ok();
for (List<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
(*i)->post_process();
} else {
- m_responder->respond_error("Unable to disconnect all ports.");
+ if (m_responder)
+ m_responder->respond_error("Unable to disconnect all ports.");
}
}
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<PatchModel*>::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 <libgnomecanvasmm.h>
#include <time.h>
#include <sys/time.h>
-#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<PatchWindow*> 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 <cmath>
#include <iostream>
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 <cassert>
-
-#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<string, const PluginModel*>::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 <cassert>
-#include "ModelClientInterface.h"
-#include <sigc++/sigc++.h>
-#include <string>
-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<void> bundle_begin_slot;
- sigc::slot<void> bundle_end_slot;
- sigc::slot<void, uint32_t> num_plugins_slot;
- sigc::slot<void, string> error_slot;
- sigc::slot<void, PluginModel*> new_plugin_slot;
- sigc::slot<void, PatchModel*> new_patch_slot;
- sigc::slot<void, NodeModel*> new_node_slot;
- sigc::slot<void, PortModel*> new_port_slot;
- sigc::slot<void, string> patch_enabled_slot;
- sigc::slot<void, string> patch_disabled_slot;
- sigc::slot<void, string> patch_cleared_slot;
- sigc::slot<void, string> object_destroyed_slot;
- sigc::slot<void, string, string> object_renamed_slot;
- sigc::slot<void, ConnectionModel*> connection_slot;
- sigc::slot<void, string, string> disconnection_slot;
- sigc::slot<void, string, string, string> metadata_update_slot;
- sigc::slot<void, string, float> control_change_slot;
- sigc::slot<void, string, uint32_t, uint32_t, const string&> program_add_slot;
- sigc::slot<void, string, uint32_t, uint32_t> 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 <cstdio>
-#include <string>
-#include <sys/time.h>
-#include <time.h>
-#include <gtkmm.h>
-#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 <cassert>
-#include <string>
-#include <queue>
-#include <iostream>
-#include <sigc++/sigc++.h>
-#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<void> 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<GtkClientInterface> instance()
- { assert(_instance); return _instance; }
-
-private:
-
- static CountedPtr<GtkClientInterface> _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<Closure> _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<NodeModel> 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<NodeModel> 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<PortModel> 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<Om::Shared::ClientInterface> 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> GtkClientInterface::_instance = 0;
}