From 47246db7e9d71ba694b719001033fba1766a58c4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 10 Jun 2006 02:43:54 +0000 Subject: More juggling git-svn-id: http://svn.drobilla.net/lad/grauph@16 a436a847-0d15-0410-975c-d299462d15a1 --- src/progs/gtk/ControlInterface.h | 129 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 src/progs/gtk/ControlInterface.h (limited to 'src/progs/gtk/ControlInterface.h') diff --git a/src/progs/gtk/ControlInterface.h b/src/progs/gtk/ControlInterface.h new file mode 100644 index 00000000..8cba6a79 --- /dev/null +++ b/src/progs/gtk/ControlInterface.h @@ -0,0 +1,129 @@ +/* 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 + -- cgit v1.2.1