diff options
author | David Robillard <d@drobilla.net> | 2011-05-24 23:48:12 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-05-24 23:48:12 +0000 |
commit | 1b29d7799c32b7be8bc563d2b21349115be04e6e (patch) | |
tree | 3687992f99d42755d172ec0f6a590bdee22204ae /src/client | |
parent | acaab5ca7ce6869b8192de4f98c9f075fd17690e (diff) | |
download | ingen-1b29d7799c32b7be8bc563d2b21349115be04e6e.tar.gz ingen-1b29d7799c32b7be8bc563d2b21349115be04e6e.tar.bz2 ingen-1b29d7799c32b7be8bc563d2b21349115be04e6e.zip |
Move appropriate client headers to public include directory.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3319 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/ClientStore.cpp | 17 | ||||
-rw-r--r-- | src/client/ClientStore.hpp | 142 | ||||
-rw-r--r-- | src/client/ConnectionModel.hpp | 69 | ||||
-rw-r--r-- | src/client/NodeModel.cpp | 2 | ||||
-rw-r--r-- | src/client/NodeModel.hpp | 112 | ||||
-rw-r--r-- | src/client/ObjectModel.cpp | 2 | ||||
-rw-r--r-- | src/client/ObjectModel.hpp | 101 | ||||
-rw-r--r-- | src/client/PatchModel.cpp | 10 | ||||
-rw-r--r-- | src/client/PatchModel.hpp | 96 | ||||
-rw-r--r-- | src/client/PluginModel.cpp | 7 | ||||
-rw-r--r-- | src/client/PluginModel.hpp | 112 | ||||
-rw-r--r-- | src/client/PluginUI.cpp | 6 | ||||
-rw-r--r-- | src/client/PluginUI.hpp | 78 | ||||
-rw-r--r-- | src/client/PortModel.cpp | 4 | ||||
-rw-r--r-- | src/client/PortModel.hpp | 119 | ||||
-rw-r--r-- | src/client/SigClientInterface.hpp | 125 | ||||
-rw-r--r-- | src/client/ThreadedSigClientInterface.cpp | 2 | ||||
-rw-r--r-- | src/client/ThreadedSigClientInterface.hpp | 151 | ||||
-rw-r--r-- | src/client/signal.hpp | 32 | ||||
-rw-r--r-- | src/client/wscript | 2 |
20 files changed, 27 insertions, 1162 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 681893bb..2d7f0a4b 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -20,15 +20,14 @@ #include "shared/LV2URIMap.hpp" -#include "ClientStore.hpp" -#include "ConnectionModel.hpp" -#include "NodeModel.hpp" -#include "ObjectModel.hpp" -#include "PatchModel.hpp" -#include "PatchModel.hpp" -#include "PluginModel.hpp" -#include "PortModel.hpp" -#include "SigClientInterface.hpp" +#include "ingen/client/ClientStore.hpp" +#include "ingen/client/ConnectionModel.hpp" +#include "ingen/client/NodeModel.hpp" +#include "ingen/client/ObjectModel.hpp" +#include "ingen/client/PatchModel.hpp" +#include "ingen/client/PluginModel.hpp" +#include "ingen/client/PortModel.hpp" +#include "ingen/client/SigClientInterface.hpp" #define LOG(s) s << "[ClientStore] " diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp deleted file mode 100644 index 011bb38c..00000000 --- a/src/client/ClientStore.hpp +++ /dev/null @@ -1,142 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_CLIENTSTORE_HPP -#define INGEN_CLIENT_CLIENTSTORE_HPP - -#include <cassert> -#include <list> -#include <string> - -#include "raul/SharedPtr.hpp" - -#include "ingen/ServerInterface.hpp" -#include "raul/Path.hpp" -#include "raul/PathTable.hpp" -#include "raul/TableImpl.hpp" -#include "shared/Store.hpp" -#include "client/signal.hpp" - -namespace Raul { class Atom; } - -namespace Ingen { - -class GraphObject; - -namespace Client { - -class NodeModel; -class ObjectModel; -class PatchModel; -class PluginModel; -class PortModel; -class SigClientInterface; - -/** Automatically manages models of objects in the engine. - * - * \ingroup IngenClient - */ -class ClientStore : public Shared::Store - , public CommonInterface - , public INGEN_TRACKABLE { -public: - ClientStore( - SharedPtr<Shared::LV2URIMap> uris, - SharedPtr<ServerInterface> engine=SharedPtr<ServerInterface>(), - SharedPtr<SigClientInterface> emitter=SharedPtr<SigClientInterface>()); - - SharedPtr<const ObjectModel> object(const Raul::Path& path) const; - SharedPtr<const PluginModel> plugin(const Raul::URI& uri) const; - SharedPtr<const Resource> resource(const Raul::URI& uri) const; - - void clear(); - - typedef Raul::Table<Raul::URI, SharedPtr<PluginModel> > Plugins; - SharedPtr<const Plugins> plugins() const { return _plugins; } - SharedPtr<Plugins> plugins() { return _plugins; } - void set_plugins(SharedPtr<Plugins> p) { _plugins = p; } - - Shared::LV2URIMap& uris() { return *_uris.get(); } - - // CommonInterface - bool new_object(const GraphObject* object); - - void put(const Raul::URI& uri, - const Resource::Properties& properties, - Resource::Graph ctx=Resource::DEFAULT); - - void delta(const Raul::URI& uri, - const Resource::Properties& remove, - const Resource::Properties& add); - - void move(const Raul::Path& old_path, - const Raul::Path& new_path); - - void set_property(const Raul::URI& subject_path, - const Raul::URI& predicate, - const Raul::Atom& value); - - void connect(const Raul::Path& src_port_path, - const Raul::Path& dst_port_path); - - void disconnect(const Raul::URI& src, - const Raul::URI& dst); - - void disconnect_all(const Raul::Path& parent_patch_path, - const Raul::Path& path); - - void del(const Raul::URI& uri); - - INGEN_SIGNAL(new_object, void, SharedPtr<ObjectModel>); - INGEN_SIGNAL(new_plugin, void, SharedPtr<PluginModel>); - -private: - void add(GraphObject* o) { throw; } - - SharedPtr<ObjectModel> _object(const Raul::Path& path); - SharedPtr<PluginModel> _plugin(const Raul::URI& uri); - SharedPtr<Resource> _resource(const Raul::URI& uri); - - void add_object(SharedPtr<ObjectModel> object); - SharedPtr<ObjectModel> remove_object(const Raul::Path& path); - - void add_plugin(SharedPtr<PluginModel> plugin); - - SharedPtr<PatchModel> connection_patch(const Raul::Path& src_port_path, - const Raul::Path& dst_port_path); - - void bundle_begin() {} - void bundle_end() {} - - // Slots for SigClientInterface signals - void object_moved(const Raul::Path& old_path, const Raul::Path& new_path); - void activity(const Raul::Path& path); - - bool attempt_connection(const Raul::Path& src_port_path, - const Raul::Path& dst_port_path); - - SharedPtr<Shared::LV2URIMap> _uris; - SharedPtr<ServerInterface> _engine; - SharedPtr<SigClientInterface> _emitter; - - SharedPtr<Plugins> _plugins; ///< Map, keyed by plugin URI -}; - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_CLIENTSTORE_HPP diff --git a/src/client/ConnectionModel.hpp b/src/client/ConnectionModel.hpp deleted file mode 100644 index 9a51d309..00000000 --- a/src/client/ConnectionModel.hpp +++ /dev/null @@ -1,69 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_CONNECTIONMODEL_HPP -#define INGEN_CLIENT_CONNECTIONMODEL_HPP - -#include <cassert> - -#include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" - -#include "ingen/Connection.hpp" - -#include "client/PortModel.hpp" - -namespace Ingen { -namespace Client { - -class ClientStore; - -/** Class to represent a port->port connections in the engine. - * - * \ingroup IngenClient - */ -class ConnectionModel : public Connection -{ -public: - SharedPtr<PortModel> src_port() const { return _src_port; } - SharedPtr<PortModel> dst_port() const { return _dst_port; } - - const Raul::Path& src_port_path() const { return _src_port->path(); } - const Raul::Path& dst_port_path() const { return _dst_port->path(); } - -private: - friend class ClientStore; - - ConnectionModel(SharedPtr<PortModel> src, SharedPtr<PortModel> dst) - : _src_port(src) - , _dst_port(dst) - { - assert(_src_port); - assert(_dst_port); - assert(_src_port->parent()); - assert(_dst_port->parent()); - assert(_src_port->path() != _dst_port->path()); - } - - const SharedPtr<PortModel> _src_port; - const SharedPtr<PortModel> _dst_port; -}; - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_CONNECTIONMODEL_HPP diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index 8adbfe90..ff9a92cd 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -21,7 +21,7 @@ #include "ingen/Port.hpp" #include "shared/World.hpp" #include "shared/LV2URIMap.hpp" -#include "NodeModel.hpp" +#include "ingen/client/NodeModel.hpp" using namespace std; using namespace Raul; diff --git a/src/client/NodeModel.hpp b/src/client/NodeModel.hpp deleted file mode 100644 index e57d02d6..00000000 --- a/src/client/NodeModel.hpp +++ /dev/null @@ -1,112 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_NODEMODEL_HPP -#define INGEN_CLIENT_NODEMODEL_HPP - -#include <cstdlib> -#include <string> -#include <vector> -#include "raul/SharedPtr.hpp" -#include "ingen/Node.hpp" -#include "ingen/Port.hpp" -#include "ObjectModel.hpp" -#include "PortModel.hpp" -#include "PluginModel.hpp" - -namespace Raul { class Path; } - -namespace Ingen { - -namespace Shared { class LV2URIMap; } - -namespace Client { - -class PluginModel; -class ClientStore; - -/** Node model class, used by the client to store engine's state. - * - * \ingroup IngenClient - */ -class NodeModel : public ObjectModel, - virtual public Ingen::Node -{ -public: - NodeModel(const NodeModel& copy); - virtual ~NodeModel(); - - typedef std::vector< SharedPtr<const PortModel> > Ports; - - SharedPtr<const PortModel> get_port(const Raul::Symbol& symbol) const; - - Port* port(uint32_t index) const; - - const Raul::URI& plugin_uri() const { return _plugin_uri; } - const Plugin* plugin() const { return _plugin.get(); } - Plugin* plugin() { return _plugin.get(); } - SharedPtr<PluginModel> plugin_model() const { return _plugin; } - uint32_t num_ports() const { return _ports.size(); } - const Ports& ports() const { return _ports; } - - void default_port_value_range(SharedPtr<const PortModel> port, - float& min, float& max) const; - void port_value_range(SharedPtr<const PortModel> port, - float& min, float& max) const; - - std::string port_label(SharedPtr<const PortModel> port) const; - - // Signals - INGEN_SIGNAL(new_port, void, SharedPtr<const PortModel>); - INGEN_SIGNAL(removed_port, void, SharedPtr<const PortModel>); - -protected: - friend class ClientStore; - - NodeModel(Shared::LV2URIMap& uris, - const Raul::URI& plugin_uri, - const Raul::Path& path); - NodeModel(Shared::LV2URIMap& uris, - SharedPtr<PluginModel> plugin, - const Raul::Path& path); - NodeModel(const Raul::Path& path); - - void add_child(SharedPtr<ObjectModel> c); - bool remove_child(SharedPtr<ObjectModel> c); - void add_port(SharedPtr<PortModel> pm); - void remove_port(SharedPtr<PortModel> pm); - void remove_port(const Raul::Path& port_path); - void add_program(int bank, int program, const std::string& name); - void remove_program(int bank, int program); - void set(SharedPtr<ObjectModel> model); - - virtual void clear(); - - Ports _ports; ///< Vector of ports (not a Table to preserve order) - Raul::URI _plugin_uri; ///< Plugin URI (if PluginModel is unknown) - SharedPtr<PluginModel> _plugin; ///< The plugin this node is an instance of - -private: - mutable uint32_t _num_values; ///< Size of _min_values and _max_values - mutable float* _min_values; ///< Port min values (cached for LV2) - mutable float* _max_values; ///< Port max values (cached for LV2) -}; - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_NODEMODEL_HPP diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 2478e786..69b40154 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -18,7 +18,7 @@ #include "raul/TableImpl.hpp" #include "ingen/GraphObject.hpp" #include "shared/LV2URIMap.hpp" -#include "ObjectModel.hpp" +#include "ingen/client/ObjectModel.hpp" using namespace std; using namespace Raul; diff --git a/src/client/ObjectModel.hpp b/src/client/ObjectModel.hpp deleted file mode 100644 index 18f013fa..00000000 --- a/src/client/ObjectModel.hpp +++ /dev/null @@ -1,101 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_OBJECTMODEL_HPP -#define INGEN_CLIENT_OBJECTMODEL_HPP - -#include <algorithm> -#include <cassert> -#include <cstdlib> - -#include "raul/Path.hpp" -#include "raul/SharedPtr.hpp" -#include "raul/URI.hpp" - -#include "client/signal.hpp" -#include "ingen/GraphObject.hpp" -#include "shared/ResourceImpl.hpp" - -namespace Ingen { - -namespace Shared { class LV2URIMap; } - -namespace Client { - -class ClientStore; - -/** Base class for all GraphObject models (NodeModel, PatchModel, PortModel). - * - * There are no non-const public methods intentionally, models are not allowed - * to be manipulated directly by anything (but the Store) because of the - * asynchronous nature of engine control. To change something, use the - * controller (which the model probably shouldn't have a reference to but oh - * well, it reduces Collection Hell) and wait for the result (as a signal - * from this Model). - * - * \ingroup IngenClient - */ -class ObjectModel : virtual public GraphObject - , public Ingen::Shared::ResourceImpl -{ -public: - virtual ~ObjectModel(); - - const Raul::Atom& get_property(const Raul::URI& key) const; - - Raul::Atom& set_property(const Raul::URI& key, const Raul::Atom& value); - void add_property(const Raul::URI& key, const Raul::Atom& value); - - const Raul::Path& path() const { return _path; } - const Raul::Symbol& symbol() const { return _symbol; } - SharedPtr<ObjectModel> parent() const { return _parent; } - bool polyphonic() const; - - GraphObject* graph_parent() const { return _parent.get(); } - - // Signals - INGEN_SIGNAL(new_child, void, SharedPtr<ObjectModel>); - INGEN_SIGNAL(removed_child, void, SharedPtr<ObjectModel>); - INGEN_SIGNAL(property, void, const Raul::URI&, const Raul::Atom&); - INGEN_SIGNAL(destroyed, void); - INGEN_SIGNAL(moved, void); - -protected: - friend class ClientStore; - - ObjectModel(Shared::LV2URIMap& uris, const Raul::Path& path); - ObjectModel(const ObjectModel& copy); - - virtual void set_path(const Raul::Path& p); - virtual void set_parent(SharedPtr<ObjectModel> p); - virtual void add_child(SharedPtr<ObjectModel> c) {} - virtual bool remove_child(SharedPtr<ObjectModel> c) { return true; } - - virtual void set(SharedPtr<ObjectModel> model); - - ResourceImpl _meta; - SharedPtr<ObjectModel> _parent; - -private: - Raul::Path _path; - Raul::Symbol _symbol; -}; - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_OBJECTMODEL_HPP diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp index 5dcf4ab0..1e02e747 100644 --- a/src/client/PatchModel.cpp +++ b/src/client/PatchModel.cpp @@ -17,11 +17,13 @@ #include <cassert> #include "raul/log.hpp" + #include "shared/LV2URIMap.hpp" -#include "PatchModel.hpp" -#include "NodeModel.hpp" -#include "ConnectionModel.hpp" -#include "ClientStore.hpp" + +#include "ingen/client/PatchModel.hpp" +#include "ingen/client/NodeModel.hpp" +#include "ingen/client/ConnectionModel.hpp" +#include "ingen/client/ClientStore.hpp" using namespace std; using namespace Raul; diff --git a/src/client/PatchModel.hpp b/src/client/PatchModel.hpp deleted file mode 100644 index 1b9e4a48..00000000 --- a/src/client/PatchModel.hpp +++ /dev/null @@ -1,96 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_PATCHMODEL_HPP -#define INGEN_CLIENT_PATCHMODEL_HPP - -#include "raul/SharedPtr.hpp" - -#include "ingen/Patch.hpp" -#include "NodeModel.hpp" - -namespace Ingen { - -class Port; - -namespace Client { - -class ClientStore; -class ConnectionModel; - -/** Client's model of a patch. - * - * \ingroup IngenClient - */ -class PatchModel : public NodeModel, public Ingen::Patch -{ -public: - /* WARNING: Copy constructor creates a shallow copy WRT connections */ - - const Connections& connections() const { return *_connections.get(); } - - SharedPtr<ConnectionModel> get_connection(const Ingen::Port* src_port, - const Ingen::Port* dst_port); - - bool enabled() const; - bool polyphonic() const; - uint32_t internal_poly() const; - - /** "editable" = arranging,connecting,adding,deleting,etc - * not editable (control mode) you can just change controllers (performing) - */ - bool get_editable() const { return _editable; } - void set_editable(bool e) const { - if (_editable != e) { - _editable = e; - const_cast<PatchModel*>(this)->signal_editable().emit(e); - } - } - - // Signals - INGEN_SIGNAL(new_node, void, SharedPtr<NodeModel>); - INGEN_SIGNAL(removed_node, void, SharedPtr<NodeModel>); - INGEN_SIGNAL(new_connection, void, SharedPtr<ConnectionModel>); - INGEN_SIGNAL(removed_connection, void, SharedPtr<ConnectionModel>); - INGEN_SIGNAL(editable, void, bool); - -private: - friend class ClientStore; - - PatchModel(Shared::LV2URIMap& uris, const Raul::Path& patch_path) - : NodeModel(uris, "http://drobilla.net/ns/ingen#Patch", patch_path) - , _connections(new Connections()) - , _editable(true) - { - } - - void clear(); - void add_child(SharedPtr<ObjectModel> c); - bool remove_child(SharedPtr<ObjectModel> c); - - void add_connection(SharedPtr<ConnectionModel> cm); - void remove_connection(const Ingen::Port* src_port, - const Ingen::Port* dst_port); - - SharedPtr<Connections> _connections; - mutable bool _editable; -}; - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_PATCHMODEL_HPP diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 59f68caa..c9395ccd 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -22,11 +22,12 @@ #include "raul/Atom.hpp" #include "raul/Path.hpp" -#include "PatchModel.hpp" -#include "PluginModel.hpp" -#include "PluginUI.hpp" #include "shared/LV2URIMap.hpp" +#include "ingen/client/PatchModel.hpp" +#include "ingen/client/PluginModel.hpp" +#include "ingen/client/PluginUI.hpp" + using namespace std; using namespace Raul; diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp deleted file mode 100644 index c76960fe..00000000 --- a/src/client/PluginModel.hpp +++ /dev/null @@ -1,112 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_PLUGINMODEL_HPP -#define INGEN_CLIENT_PLUGINMODEL_HPP - -#include "lilv/lilv.h" -#include "raul/SharedPtr.hpp" -#include "raul/Symbol.hpp" -#include "sord/sordmm.hpp" - -#include "ingen/ServerInterface.hpp" -#include "ingen/Plugin.hpp" -#include "shared/World.hpp" -#include "shared/ResourceImpl.hpp" -#include "client/signal.hpp" - -namespace Ingen { - -namespace Shared { class LV2URIMap; } - -namespace Client { - -class PatchModel; -class NodeModel; -class PluginUI; - -/** Model for a plugin available for loading. - * - * \ingroup IngenClient - */ -class PluginModel : public Ingen::Plugin - , public Ingen::Shared::ResourceImpl -{ -public: - PluginModel( - Shared::LV2URIMap& uris, - const Raul::URI& uri, - const Raul::URI& type_uri, - const Ingen::Resource::Properties& properties); - - Type type() const { return _type; } - - virtual const Raul::Atom& get_property(const Raul::URI& key) const; - - Raul::Symbol default_node_symbol() const; - std::string human_name() const; - std::string port_human_name(uint32_t index) const; - - static LilvWorld* lilv_world() { return _lilv_world; } - const LilvPlugin* lilv_plugin() const { return _lilv_plugin; } - - const LilvPort* lilv_port(uint32_t index) const; - - static void set_lilv_world(LilvWorld* world); - - bool has_ui() const; - - SharedPtr<PluginUI> ui(Ingen::Shared::World* world, - SharedPtr<const NodeModel> node) const; - - const std::string& icon_path() const; - static std::string get_lv2_icon_path(const LilvPlugin* plugin); - - std::string documentation() const; - std::string port_documentation(uint32_t index) const; - - static void set_rdf_world(Sord::World& world) { - _rdf_world = &world; - } - - static Sord::World* rdf_world() { return _rdf_world; } - - // Signals - INGEN_SIGNAL(changed, void); - INGEN_SIGNAL(property, void, const Raul::URI&, const Raul::Atom&); - -protected: - friend class ClientStore; - void set(SharedPtr<PluginModel> p); - -private: - Type _type; - - static LilvWorld* _lilv_world; - static const LilvPlugins* _lilv_plugins; - - const LilvPlugin* _lilv_plugin; - mutable std::string _icon_path; - - static Sord::World* _rdf_world; -}; - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_PLUGINMODEL_HPP - diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 466ee320..cfcad147 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -24,9 +24,9 @@ #include "shared/LV2Atom.hpp" #include "shared/LV2URIMap.hpp" -#include "NodeModel.hpp" -#include "PluginUI.hpp" -#include "PortModel.hpp" +#include "ingen/client/NodeModel.hpp" +#include "ingen/client/PluginUI.hpp" +#include "ingen/client/PortModel.hpp" using namespace std; using namespace Raul; diff --git a/src/client/PluginUI.hpp b/src/client/PluginUI.hpp deleted file mode 100644 index b93f4f3a..00000000 --- a/src/client/PluginUI.hpp +++ /dev/null @@ -1,78 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_PLUGINUI_HPP -#define INGEN_CLIENT_PLUGINUI_HPP - -#include "raul/SharedPtr.hpp" - -#include "lilv/lilv.h" - -#include "suil/suil.h" - -#include "LV2Features.hpp" - -namespace Ingen { - -class ServerInterface; - -namespace Shared { class World; } - -namespace Client { - -class NodeModel; - -/** Model for a plugin available for loading. - * - * \ingroup IngenClient - */ -class PluginUI { -public: - ~PluginUI(); - - static SharedPtr<PluginUI> create(Ingen::Shared::World* world, - SharedPtr<const NodeModel> node, - const LilvPlugin* plugin); - - SuilWidget get_widget(); - - void port_event(uint32_t port_index, - uint32_t buffer_size, - uint32_t format, - const void* buffer); - - Ingen::Shared::World* world() const { return _world; } - SharedPtr<const NodeModel> node() const { return _node; } - -private: - PluginUI(Ingen::Shared::World* world, - SharedPtr<const NodeModel> node); - - Ingen::Shared::World* _world; - SharedPtr<const NodeModel> _node; - SuilInstance* _instance; - - static SuilHost* ui_host; - - SharedPtr<Shared::LV2Features::FeatureArray> _features; -}; - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_PLUGINUI_HPP - diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp index f6edba20..50731ef0 100644 --- a/src/client/PortModel.cpp +++ b/src/client/PortModel.cpp @@ -16,8 +16,8 @@ */ #include "shared/LV2URIMap.hpp" -#include "PortModel.hpp" -#include "NodeModel.hpp" +#include "ingen/client/PortModel.hpp" +#include "ingen/client/NodeModel.hpp" namespace Ingen { namespace Client { diff --git a/src/client/PortModel.hpp b/src/client/PortModel.hpp deleted file mode 100644 index fd4a679e..00000000 --- a/src/client/PortModel.hpp +++ /dev/null @@ -1,119 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_PORTMODEL_HPP -#define INGEN_CLIENT_PORTMODEL_HPP - -#include <cstdlib> -#include <string> -#include "raul/log.hpp" -#include "raul/SharedPtr.hpp" -#include "ingen/Port.hpp" -#include "ObjectModel.hpp" - -namespace Raul { class Path; } - -namespace Ingen { -namespace Client { - -/** Model of a port. - * - * \ingroup IngenClient - */ -class PortModel : public ObjectModel, public Ingen::Port -{ -public: - enum Direction { INPUT, OUTPUT }; - - const PortTypes& types() const { return _types; } - - bool supports(const Raul::URI& value_type) const; - - inline uint32_t index() const { return _index; } - inline const Raul::Atom& value() const { return _current_val; } - inline bool connected() const { return (_connections > 0); } - inline bool is_input() const { return (_direction == INPUT); } - inline bool is_output() const { return (_direction == OUTPUT); } - - bool port_property(const std::string& uri) const; - - bool is_numeric() const { return is_a(PortType::CONTROL); } - bool is_logarithmic() const { return port_property("http://drobilla.net/ns/ingen#logarithmic"); } - bool is_integer() const { return port_property("http://lv2plug.in/ns/lv2core#integer"); } - bool is_toggle() const { return port_property("http://lv2plug.in/ns/lv2core#toggled"); } - - bool has_context(const Raul::URI& context) const; - - - inline bool operator==(const PortModel& pm) const { return (path() == pm.path()); } - - Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value); - - inline void value(const Raul::Atom& val) { - if (val != _current_val) { - _current_val = val; - _signal_value_changed.emit(val); - } - } - - inline void value(uint32_t voice, const Raul::Atom& val) { - // FIXME: implement properly - _signal_voice_changed.emit(voice, val); - } - - // Signals - INGEN_SIGNAL(value_changed, void, const Raul::Atom&); - INGEN_SIGNAL(voice_changed, void, uint32_t, const Raul::Atom&); - INGEN_SIGNAL(activity, void); - INGEN_SIGNAL(connection, void, SharedPtr<PortModel>); - INGEN_SIGNAL(disconnection, void, SharedPtr<PortModel>); - -private: - friend class ClientStore; - - PortModel(Shared::LV2URIMap& uris, - const Raul::Path& path, uint32_t index, PortType type, Direction dir) - : ObjectModel(uris, path) - , _index(index) - , _direction(dir) - , _current_val(0.0f) - , _connections(0) - { - _types.insert(type); - if (type == PortType::UNKNOWN) - Raul::warn << "[PortModel] Unknown port type" << std::endl; - } - - void add_child(SharedPtr<ObjectModel> c) { throw; } - bool remove_child(SharedPtr<ObjectModel> c) { throw; } - - void connected_to(SharedPtr<PortModel> p) { ++_connections; _signal_connection.emit(p); } - void disconnected_from(SharedPtr<PortModel> p) { --_connections; _signal_disconnection.emit(p); } - - void set(SharedPtr<ObjectModel> model); - - uint32_t _index; - std::set<PortType> _types; - Direction _direction; - Raul::Atom _current_val; - size_t _connections; -}; - -} // namespace Client -} // namespace Ingen - -#endif // INGEN_CLIENT_PORTMODEL_HPP diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp deleted file mode 100644 index 116ec0dc..00000000 --- a/src/client/SigClientInterface.hpp +++ /dev/null @@ -1,125 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_SIGCLIENTINTERFACE_HPP -#define INGEN_CLIENT_SIGCLIENTINTERFACE_HPP - -#include <stdint.h> - -#include "raul/Path.hpp" - -#include "client/signal.hpp" -#include "ingen/ClientInterface.hpp" - -namespace Ingen { -namespace Client { - -/** A LibSigC++ signal emitting interface for clients to use. - * - * This simply emits a signal for every event that comes from the engine. - * For a higher level model based view of the engine, use ClientStore. - * - * The signals here match the calls to ClientInterface exactly. See the - * documentation for ClientInterface for meanings of signal parameters. - */ -class SigClientInterface : public Ingen::ClientInterface, - public INGEN_TRACKABLE -{ -public: - SigClientInterface() {} - - Raul::URI uri() const { return "http://drobilla.net/ns/ingen#internal"; } - - INGEN_SIGNAL(response_ok, void, int32_t) - INGEN_SIGNAL(response_error, void, int32_t, std::string) - INGEN_SIGNAL(bundle_begin, void) - INGEN_SIGNAL(bundle_end, void) - INGEN_SIGNAL(error, void, std::string) - INGEN_SIGNAL(new_patch, void, Raul::Path, uint32_t) - INGEN_SIGNAL(new_port, void, Raul::Path, Raul::URI, uint32_t, bool) - INGEN_SIGNAL(put, void, Raul::URI, Resource::Properties, Resource::Graph) - INGEN_SIGNAL(delta, void, Raul::URI, Resource::Properties, Resource::Properties) - INGEN_SIGNAL(object_moved, void, Raul::Path, Raul::Path) - INGEN_SIGNAL(object_deleted, void, Raul::URI) - INGEN_SIGNAL(connection, void, Raul::Path, Raul::Path) - INGEN_SIGNAL(disconnection, void, Raul::URI, Raul::URI) - INGEN_SIGNAL(disconnect_all, void, Raul::Path, Raul::Path) - INGEN_SIGNAL(variable_change, void, Raul::URI, Raul::URI, Raul::Atom) - INGEN_SIGNAL(property_change, void, Raul::URI, Raul::URI, Raul::Atom) - INGEN_SIGNAL(port_value, void, Raul::Path, Raul::Atom) - INGEN_SIGNAL(activity, void, Raul::Path) - - /** Fire pending signals. Only does anything on derived classes (that may queue) */ - virtual bool emit_signals() { return false; } - -protected: - - // ClientInterface hooks that fire the above signals - -#define EMIT(name, ...) { _signal_ ## name (__VA_ARGS__); } - - void bundle_begin() - { EMIT(bundle_begin); } - - void bundle_end() - { EMIT(bundle_end); } - - void response_ok(int32_t id) - { EMIT(response_ok, id); } - - void response_error(int32_t id, const std::string& msg) - { EMIT(response_error, id, msg); } - - void error(const std::string& msg) - { EMIT(error, msg); } - - void put(const Raul::URI& uri, - const Resource::Properties& properties, - Resource::Graph ctx=Resource::DEFAULT) - { EMIT(put, uri, properties, ctx); } - - void delta(const Raul::URI& uri, - const Resource::Properties& remove, - const Resource::Properties& add) - { EMIT(delta, uri, remove, add); } - - void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) - { EMIT(connection, src_port_path, dst_port_path); } - - void del(const Raul::URI& uri) - { EMIT(object_deleted, uri); } - - void move(const Raul::Path& old_path, const Raul::Path& new_path) - { EMIT(object_moved, old_path, new_path); } - - void disconnect(const Raul::URI& src, const Raul::URI& dst) - { EMIT(disconnection, src, dst); } - - void disconnect_all(const Raul::Path& parent_patch_path, const Raul::Path& path) - { EMIT(disconnect_all, parent_patch_path, path); } - - void set_property(const Raul::URI& subject, const Raul::URI& key, const Raul::Atom& value) - { EMIT(property_change, subject, key, value); } - - void activity(const Raul::Path& port_path) - { EMIT(activity, port_path); } -}; - -} // namespace Client -} // namespace Ingen - -#endif diff --git a/src/client/ThreadedSigClientInterface.cpp b/src/client/ThreadedSigClientInterface.cpp index 5a0fe93d..fa452902 100644 --- a/src/client/ThreadedSigClientInterface.cpp +++ b/src/client/ThreadedSigClientInterface.cpp @@ -19,7 +19,7 @@ #include "ingen/Patch.hpp" #include "ingen/Plugin.hpp" #include "ingen/Port.hpp" -#include "ThreadedSigClientInterface.hpp" +#include "ingen/client/ThreadedSigClientInterface.hpp" using namespace std; using namespace Raul; diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp deleted file mode 100644 index 373fb14d..00000000 --- a/src/client/ThreadedSigClientInterface.hpp +++ /dev/null @@ -1,151 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_THREADEDSIGCLIENTINTERFACE_HPP -#define INGEN_CLIENT_THREADEDSIGCLIENTINTERFACE_HPP - -#include <inttypes.h> -#include <string> -#include <sigc++/sigc++.h> -#include <glibmm/thread.h> -#include "raul/Atom.hpp" -#include "ingen/ClientInterface.hpp" -#include "SigClientInterface.hpp" -#include "raul/SRSWQueue.hpp" - -/** Returns nothing and takes no parameters (because they have all been bound) */ -typedef sigc::slot<void> Closure; - -namespace Ingen { - -class ServerInterface; - -namespace Client { - -/** A LibSigC++ signal emitting interface for clients to use. - * - * This emits signals (possibly) in a different thread than the ClientInterface - * functions are called. It must be explicitly driven with the emit_signals() - * function, which fires all enqueued signals up until the present. You can - * use this in a GTK idle callback for receiving thread safe engine signals. - */ -class ThreadedSigClientInterface : public SigClientInterface -{ -public: - ThreadedSigClientInterface(uint32_t queue_size) - : _sigs(queue_size) - , response_ok_slot(_signal_response_ok.make_slot()) - , response_error_slot(_signal_response_error.make_slot()) - , error_slot(_signal_error.make_slot()) - , new_port_slot(_signal_new_port.make_slot()) - , put_slot(_signal_put.make_slot()) - , connection_slot(_signal_connection.make_slot()) - , object_deleted_slot(_signal_object_deleted.make_slot()) - , object_moved_slot(_signal_object_moved.make_slot()) - , disconnection_slot(_signal_disconnection.make_slot()) - , disconnect_all_slot(_signal_disconnect_all.make_slot()) - , variable_change_slot(_signal_variable_change.make_slot()) - , property_change_slot(_signal_property_change.make_slot()) - , port_value_slot(_signal_port_value.make_slot()) - , activity_slot(_signal_activity.make_slot()) - {} - - virtual Raul::URI uri() const { return "http://drobilla.net/ns/ingen#internal"; } - - void bundle_begin() - { push_sig(bundle_begin_slot); } - - void bundle_end() - { push_sig(bundle_end_slot); } - - void response_ok(int32_t id) - { push_sig(sigc::bind(response_ok_slot, id)); } - - void response_error(int32_t id, const std::string& msg) - { push_sig(sigc::bind(response_error_slot, id, msg)); } - - void error(const std::string& msg) - { push_sig(sigc::bind(error_slot, msg)); } - - void put(const Raul::URI& path, - const Resource::Properties& properties, - Resource::Graph ctx=Resource::DEFAULT) - { push_sig(sigc::bind(put_slot, path, properties, ctx)); } - - void delta(const Raul::URI& path, - const Resource::Properties& remove, - const Resource::Properties& add) - { push_sig(sigc::bind(delta_slot, path, remove, add)); } - - void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) - { push_sig(sigc::bind(connection_slot, src_port_path, dst_port_path)); } - - void del(const Raul::URI& uri) - { push_sig(sigc::bind(object_deleted_slot, uri)); } - - void move(const Raul::Path& old_path, const Raul::Path& new_path) - { push_sig(sigc::bind(object_moved_slot, old_path, new_path)); } - - void disconnect(const Raul::URI& src, const Raul::URI& dst) - { push_sig(sigc::bind(disconnection_slot, src, dst)); } - - void disconnect_all(const Raul::Path& parent_patch_path, const Raul::Path& path) - { push_sig(sigc::bind(disconnect_all_slot, parent_patch_path, path)); } - - void set_property(const Raul::URI& subject, const Raul::URI& key, const Raul::Atom& value) - { push_sig(sigc::bind(property_change_slot, subject, key, value)); } - - void activity(const Raul::Path& port_path) - { push_sig(sigc::bind(activity_slot, port_path)); } - - /** Process all queued events - Called from GTK thread to emit signals. */ - bool emit_signals(); - -private: - void push_sig(Closure ev); - - Glib::Mutex _mutex; - Glib::Cond _cond; - - Raul::SRSWQueue<Closure> _sigs; - - sigc::slot<void> bundle_begin_slot; - sigc::slot<void> bundle_end_slot; - sigc::slot<void, int32_t> response_ok_slot; - sigc::slot<void, int32_t, std::string> response_error_slot; - sigc::slot<void, std::string> error_slot; - sigc::slot<void, Raul::URI, Raul::URI, Raul::Symbol> new_plugin_slot; - sigc::slot<void, Raul::Path, Raul::URI, uint32_t, bool> new_port_slot; - sigc::slot<void, Raul::URI, Resource::Properties, - Resource::Graph> put_slot; - sigc::slot<void, Raul::URI, Resource::Properties, - Resource::Properties> delta_slot; - sigc::slot<void, Raul::Path, Raul::Path> connection_slot; - sigc::slot<void, Raul::URI> object_deleted_slot; - sigc::slot<void, Raul::Path, Raul::Path> object_moved_slot; - sigc::slot<void, Raul::URI, Raul::URI> disconnection_slot; - sigc::slot<void, Raul::Path, Raul::Path> disconnect_all_slot; - sigc::slot<void, Raul::URI, Raul::URI, Raul::Atom> variable_change_slot; - sigc::slot<void, Raul::URI, Raul::URI, Raul::Atom> property_change_slot; - sigc::slot<void, Raul::Path, Raul::Atom> port_value_slot; - sigc::slot<void, Raul::Path> activity_slot; -}; - -} // namespace Client -} // namespace Ingen - -#endif diff --git a/src/client/signal.hpp b/src/client/signal.hpp deleted file mode 100644 index f40c6a57..00000000 --- a/src/client/signal.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/* This file is part of Ingen. - * Copyright 2007-2011 David Robillard <http://drobilla.net> - * - * Ingen 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. - * - * Ingen 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., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef INGEN_CLIENT_SIGNAL_HPP -#define INGEN_CLIENT_SIGNAL_HPP - -#include <sigc++/sigc++.h> - -#define INGEN_SIGNAL(name, ...) \ -protected: \ -sigc::signal<__VA_ARGS__> _signal_##name; \ -public: \ -sigc::signal<__VA_ARGS__> signal_##name() const { return _signal_##name; } \ -sigc::signal<__VA_ARGS__>& signal_##name() { return _signal_##name; } - -#define INGEN_TRACKABLE sigc::trackable - -#endif // INGEN_CLIENT_SIGNAL_HPP diff --git a/src/client/wscript b/src/client/wscript index 99b1c1b6..9da924ec 100644 --- a/src/client/wscript +++ b/src/client/wscript @@ -31,7 +31,7 @@ def build(bld): ''' obj.includes = ['.', '..', '../..', '../../include'] - obj.export_includes = ['.'] + obj.export_includes = ['../../include'] obj.name = 'libingen_client' obj.target = 'ingen_client' obj.install_path = '${LIBDIR}' |