diff options
author | David Robillard <d@drobilla.net> | 2007-10-07 19:00:30 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-10-07 19:00:30 +0000 |
commit | 2cb36f0265a391388b6edf988d919911b79aca4d (patch) | |
tree | 7b796835325e84e152365104b4c23bf4109f2293 /src | |
parent | 299f075679fc7ea6a67001c2cc0442511e167cbc (diff) | |
download | ingen-2cb36f0265a391388b6edf988d919911b79aca4d.tar.gz ingen-2cb36f0265a391388b6edf988d919911b79aca4d.tar.bz2 ingen-2cb36f0265a391388b6edf988d919911b79aca4d.zip |
Begin using shared virtual Node interface client side.
git-svn-id: http://svn.drobilla.net/lad/ingen@836 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
29 files changed, 146 insertions, 131 deletions
diff --git a/src/common/interface/GraphObject.hpp b/src/common/interface/GraphObject.hpp index 65ffef88..7ea566f6 100644 --- a/src/common/interface/GraphObject.hpp +++ b/src/common/interface/GraphObject.hpp @@ -40,7 +40,7 @@ public: typedef std::map<std::string, Raul::Atom> MetadataMap; virtual const Raul::Path path() const = 0; - virtual const std::string& name() const = 0; + virtual const std::string name() const = 0; virtual const MetadataMap& metadata() const = 0; virtual bool polyphonic() const = 0; }; diff --git a/src/libs/client/ConnectionModel.cpp b/src/libs/client/ConnectionModel.cpp index a40da9e4..d35457d1 100644 --- a/src/libs/client/ConnectionModel.cpp +++ b/src/libs/client/ConnectionModel.cpp @@ -51,7 +51,7 @@ ConnectionModel::ConnectionModel(SharedPtr<PortModel> src, SharedPtr<PortModel> } -const Path& +const Path ConnectionModel::src_port_path() const { if (!_src_port) @@ -61,7 +61,7 @@ ConnectionModel::src_port_path() const } -const Path& +const Path ConnectionModel::dst_port_path() const { if (!_dst_port) diff --git a/src/libs/client/ConnectionModel.hpp b/src/libs/client/ConnectionModel.hpp index 304db2b7..1a73b123 100644 --- a/src/libs/client/ConnectionModel.hpp +++ b/src/libs/client/ConnectionModel.hpp @@ -47,8 +47,8 @@ public: SharedPtr<PortModel> src_port() const { return _src_port; } SharedPtr<PortModel> dst_port() const { return _dst_port; } - const Path& src_port_path() const; - const Path& dst_port_path() const; + const Path src_port_path() const; + const Path dst_port_path() const; private: friend class Store; diff --git a/src/libs/client/DeprecatedLoader.cpp b/src/libs/client/DeprecatedLoader.cpp index ce536b4f..96305884 100644 --- a/src/libs/client/DeprecatedLoader.cpp +++ b/src/libs/client/DeprecatedLoader.cpp @@ -80,7 +80,7 @@ DeprecatedLoader::translate_load_path(const string& path) * Adds a namespace prefix for known keys, and ignores the rest. */ void -DeprecatedLoader::add_metadata(MetadataMap& data, string old_key, string value) +DeprecatedLoader::add_metadata(GraphObject::MetadataMap& data, string old_key, string value) { string key = ""; if (old_key == "module-x") @@ -132,11 +132,11 @@ DeprecatedLoader::add_metadata(MetadataMap& data, string old_key, string value) * Returns the path of the newly created patch. */ string -DeprecatedLoader::load_patch(const Glib::ustring& filename, - boost::optional<Path> parent_path, - string name, - MetadataMap initial_data, - bool existing) +DeprecatedLoader::load_patch(const Glib::ustring& filename, + boost::optional<Path> parent_path, + string name, + GraphObject::MetadataMap initial_data, + bool existing) { cerr << "[DeprecatedLoader] Loading patch " << filename << "" << endl; @@ -147,7 +147,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, size_t poly = 0; /* Use parameter overridden polyphony, if given */ - Raul::Table<string, Atom>::iterator poly_param = initial_data.find("ingen:polyphony"); + GraphObject::MetadataMap::iterator poly_param = initial_data.find("ingen:polyphony"); if (poly_param != initial_data.end() && poly_param->second.type() == Atom::INT) poly = poly_param->second; @@ -217,7 +217,7 @@ DeprecatedLoader::load_patch(const Glib::ustring& filename, // Create it, if we're not merging if (!existing) { _engine->create_patch(path, poly); - for (MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) + for (GraphObject::MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) _engine->set_metadata(path, i->first, i->second); } @@ -301,7 +301,7 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr string library_name; // deprecated string plugin_label; // deprecated - MetadataMap initial_data; + GraphObject::MetadataMap initial_data; while (cur != NULL) { key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); @@ -462,7 +462,7 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr path = new_path; - for (MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) + for (GraphObject::MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) _engine->set_metadata(path, i->first, i->second); return SharedPtr<NodeModel>(); @@ -486,7 +486,7 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr else _engine->create_node(path, plugin_type, library_name, plugin_label, polyphonic); - for (MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) + for (GraphObject::MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) _engine->set_metadata(path, i->first, i->second); return true; @@ -495,7 +495,7 @@ DeprecatedLoader::load_node(const Path& parent, xmlDocPtr doc, const xmlNodePtr // Not deprecated } else { _engine->create_node(path, plugin_uri, polyphonic); - for (MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) + for (GraphObject::MetadataMap::const_iterator i = initial_data.begin(); i != initial_data.end(); ++i) _engine->set_metadata(path, i->first, i->second); return true; } @@ -514,7 +514,7 @@ DeprecatedLoader::load_subpatch(const Path& parent, xmlDocPtr doc, const xmlNode string filename = ""; size_t poly = 0; - MetadataMap initial_data; + GraphObject::MetadataMap initial_data; while (cur != NULL) { key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); diff --git a/src/libs/client/DeprecatedLoader.hpp b/src/libs/client/DeprecatedLoader.hpp index 413c46b5..19dbf5cb 100644 --- a/src/libs/client/DeprecatedLoader.hpp +++ b/src/libs/client/DeprecatedLoader.hpp @@ -28,10 +28,12 @@ #include <raul/SharedPtr.hpp> #include <raul/Path.hpp> #include "interface/EngineInterface.hpp" +#include "interface/GraphObject.hpp" #include "ObjectModel.hpp" using std::string; using Ingen::Shared::EngineInterface; +using Ingen::Shared::GraphObject; namespace Ingen { namespace Client { @@ -60,14 +62,14 @@ public: string find_file(const string& filename, const string& additional_path = ""); - string load_patch(const Glib::ustring& filename, - boost::optional<Path> parent_path, - string name, - MetadataMap initial_data, - bool existing = false); + string load_patch(const Glib::ustring& filename, + boost::optional<Path> parent_path, + string name, + GraphObject::MetadataMap initial_data, + bool existing = false); private: - void add_metadata(MetadataMap& data, string key, string value); + void add_metadata(GraphObject::MetadataMap& data, string key, string value); string nameify_if_invalid(const string& name); string translate_load_path(const string& path); diff --git a/src/libs/client/NodeModel.hpp b/src/libs/client/NodeModel.hpp index fb88e2f0..080d8f4c 100644 --- a/src/libs/client/NodeModel.hpp +++ b/src/libs/client/NodeModel.hpp @@ -23,10 +23,11 @@ #include <string> #include <sigc++/sigc++.h> #include <raul/Table.hpp> -#include "ObjectModel.hpp" -#include "PortModel.hpp" #include <raul/Path.hpp> #include <raul/SharedPtr.hpp> +#include "interface/Node.hpp" +#include "ObjectModel.hpp" +#include "PortModel.hpp" #include "PluginModel.hpp" using std::string; @@ -43,7 +44,7 @@ class Store; * * \ingroup IngenClient */ -class NodeModel : public ObjectModel +class NodeModel : public ObjectModel, virtual public Ingen::Shared::Node { public: virtual ~NodeModel(); @@ -52,10 +53,10 @@ public: const Table<int,Table<int,string> >& get_programs() const { return _banks; } - const string& plugin_uri() const { return _plugin_uri; } - SharedPtr<PluginModel> plugin() const { return _plugin; } - int num_ports() const { return _ports.size(); } - const PortModelList& ports() const { return _ports; } + const string& plugin_uri() const { return _plugin_uri; } + SharedPtr<PluginModel> plugin() const { return _plugin; } + uint32_t num_ports() const { return _ports.size(); } + const PortModelList& ports() const { return _ports; } void port_value_range(SharedPtr<PortModel> port, float& min, float& max); diff --git a/src/libs/client/ObjectModel.hpp b/src/libs/client/ObjectModel.hpp index a9aff7d8..9ac3e686 100644 --- a/src/libs/client/ObjectModel.hpp +++ b/src/libs/client/ObjectModel.hpp @@ -29,16 +29,15 @@ #include <raul/Path.hpp> #include <raul/SharedPtr.hpp> #include <raul/Table.hpp> +#include "interface/GraphObject.hpp" -using std::string; using std::find; +using std::string; using Raul::Atom; using Raul::Path; namespace Ingen { namespace Client { -typedef Raul::Table<string, Atom> MetadataMap; - /** Base class for all GraphObject models (NodeModel, PatchModel, PortModel). * @@ -51,7 +50,7 @@ typedef Raul::Table<string, Atom> MetadataMap; * * \ingroup IngenClient */ -class ObjectModel : boost::noncopyable +class ObjectModel : virtual public Ingen::Shared::GraphObject, public boost::noncopyable { public: virtual ~ObjectModel(); @@ -64,7 +63,8 @@ public: const MetadataMap& metadata() const { return _metadata; } const Children& children() const { return _children; } - inline const Path& path() const { return _path; } + const Path path() const { return _path; } + const string name() const { return _path.name(); } SharedPtr<ObjectModel> parent() const { return _parent; } bool polyphonic() const { return _polyphonic; } diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp index aaf9c955..e1b3805d 100644 --- a/src/libs/client/Serializer.cpp +++ b/src/libs/client/Serializer.cpp @@ -46,6 +46,7 @@ using namespace std; using namespace Raul; using namespace Raul::RDF; +using namespace Ingen::Shared; namespace Ingen { namespace Client { @@ -133,7 +134,7 @@ Serializer::finish() /** Convert a path to an RDF blank node ID for serializing. */ -Node +RDF::Node Serializer::path_to_node_id(const Path& path) { assert(_model); @@ -144,7 +145,7 @@ Serializer::path_to_node_id(const Path& path) ret[i] = '_'; } - return Node(Node::BLANK, ret); + return RDF::Node(Node::BLANK, ret); */ NodeMap::iterator i = _node_map.find(path); @@ -153,7 +154,7 @@ Serializer::path_to_node_id(const Path& path) assert(i->second.get_node()); return i->second; } else { - Node id = _world.blank_id(); + RDF::Node id = _world.blank_id(); assert(id); _node_map[path] = id; return id; @@ -241,14 +242,14 @@ Serializer::serialize(SharedPtr<ObjectModel> object) throw (std::logic_error) } -Node +RDF::Node Serializer::patch_path_to_rdf_id(const Path& path) { if (path == _root_object->path()) { - return Node(_model->world(), Node::RESOURCE, _base_uri); + return RDF::Node(_model->world(), RDF::Node::RESOURCE, _base_uri); } else { assert(path.length() > _root_object->path().length()); - return Node(_model->world(), Node::RESOURCE, + return RDF::Node(_model->world(), RDF::Node::RESOURCE, _base_uri + string("#") + path.substr(_root_object->path().length())); } } @@ -259,12 +260,12 @@ Serializer::serialize_patch(SharedPtr<PatchModel> patch) { assert(_model); - const Node patch_id = patch_path_to_rdf_id(patch->path()); + const RDF::Node patch_id = patch_path_to_rdf_id(patch->path()); _model->add_statement( patch_id, "rdf:type", - Node(_model->world(), Node::RESOURCE, "http://drobilla.net/ns/ingen#Patch")); + RDF::Node(_model->world(), RDF::Node::RESOURCE, "http://drobilla.net/ns/ingen#Patch")); if (patch->path().name().length() > 0) { _model->add_statement( @@ -282,7 +283,8 @@ Serializer::serialize_patch(SharedPtr<PatchModel> patch) "ingen:enabled", Atom(patch->enabled())); - for (MetadataMap::const_iterator m = patch->metadata().begin(); m != patch->metadata().end(); ++m) { + for (GraphObject::MetadataMap::const_iterator m = patch->metadata().begin(); + m != patch->metadata().end(); ++m) { if (m->first.find(":") != string::npos) { _model->add_statement( patch_id, @@ -298,14 +300,14 @@ Serializer::serialize_patch(SharedPtr<PatchModel> patch) _model->add_statement(patch_id, "ingen:node", patch_path_to_rdf_id(patch->path())); serialize_patch(patch); } else if (node) { - const Node node_id = path_to_node_id(n->second->path()); + const RDF::Node node_id = path_to_node_id(n->second->path()); _model->add_statement(patch_id, "ingen:node", node_id); serialize_node(node, node_id); } } for (PortModelList::const_iterator p = patch->ports().begin(); p != patch->ports().end(); ++p) { - const Node port_id = path_to_node_id((*p)->path()); + const RDF::Node port_id = path_to_node_id((*p)->path()); _model->add_statement(patch_id, "ingen:port", port_id); serialize_port(*p, port_id); } @@ -321,24 +323,25 @@ Serializer::serialize_plugin(SharedPtr<PluginModel> plugin) { assert(_model); - const Node plugin_id = Node(_model->world(), Node::RESOURCE, plugin->uri()); + const RDF::Node plugin_id = RDF::Node(_model->world(), RDF::Node::RESOURCE, plugin->uri()); _model->add_statement( plugin_id, "rdf:type", - Node(_model->world(), Node::RESOURCE, plugin->type_uri())); + RDF::Node(_model->world(), RDF::Node::RESOURCE, plugin->type_uri())); } void -Serializer::serialize_node(SharedPtr<NodeModel> node, const Node& node_id) +Serializer::serialize_node(SharedPtr<NodeModel> node, const RDF::Node& node_id) { - const Node plugin_id = Node(_model->world(), Node::RESOURCE, node->plugin()->uri()); + const RDF::Node plugin_id + = RDF::Node(_model->world(), RDF::Node::RESOURCE, node->plugin()->uri()); _model->add_statement( node_id, "rdf:type", - Node(_model->world(), Node::RESOURCE, "ingen:Node")); + RDF::Node(_model->world(), RDF::Node::RESOURCE, "ingen:Node")); _model->add_statement( node_id, @@ -363,12 +366,13 @@ Serializer::serialize_node(SharedPtr<NodeModel> node, const Node& node_id) Atom(node->path().name()));*/ for (PortModelList::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) { - const Node port_id = path_to_node_id((*p)->path()); + const RDF::Node port_id = path_to_node_id((*p)->path()); serialize_port(*p, port_id); _model->add_statement(node_id, "ingen:port", port_id); } - for (MetadataMap::const_iterator m = node->metadata().begin(); m != node->metadata().end(); ++m) { + for (GraphObject::MetadataMap::const_iterator m = node->metadata().begin(); + m != node->metadata().end(); ++m) { if (m->first.find(":") != string::npos) { _model->add_statement( node_id, @@ -383,14 +387,14 @@ Serializer::serialize_node(SharedPtr<NodeModel> node, const Node& node_id) * Audio output ports with no metadata will not be written, for example. */ void -Serializer::serialize_port(SharedPtr<PortModel> port, const Node& port_id) +Serializer::serialize_port(SharedPtr<PortModel> port, const RDF::Node& port_id) { if (port->is_input()) _model->add_statement(port_id, "rdf:type", - Node(_model->world(), Node::RESOURCE, "ingen:InputPort")); + RDF::Node(_model->world(), RDF::Node::RESOURCE, "ingen:InputPort")); else _model->add_statement(port_id, "rdf:type", - Node(_model->world(), Node::RESOURCE, "ingen:OutputPort")); + RDF::Node(_model->world(), RDF::Node::RESOURCE, "ingen:OutputPort")); _model->add_statement(port_id, "ingen:name", Atom(port->path().name().c_str())); @@ -400,7 +404,8 @@ Serializer::serialize_port(SharedPtr<PortModel> port, const Node& port_id) _model->add_statement(port_id, "ingen:value", Atom(port->value())); if (port->metadata().size() > 0) { - for (MetadataMap::const_iterator m = port->metadata().begin(); m != port->metadata().end(); ++m) { + for (GraphObject::MetadataMap::const_iterator m = port->metadata().begin(); + m != port->metadata().end(); ++m) { if (m->first.find(":") != string::npos) { _model->add_statement( port_id, @@ -418,8 +423,8 @@ Serializer::serialize_connection(SharedPtr<ConnectionModel> connection) throw (s if (!_model) throw std::logic_error("serialize_connection called without serialization in progress"); - const Node src_node = path_to_node_id(connection->src_port_path()); - const Node dst_node = path_to_node_id(connection->dst_port_path()); + const RDF::Node src_node = path_to_node_id(connection->src_port_path()); + const RDF::Node dst_node = path_to_node_id(connection->dst_port_path()); _model->add_statement(dst_node, "ingen:connectedTo", src_node); } diff --git a/src/libs/engine/GraphObjectImpl.hpp b/src/libs/engine/GraphObjectImpl.hpp index 74d24763..ccfc0319 100644 --- a/src/libs/engine/GraphObjectImpl.hpp +++ b/src/libs/engine/GraphObjectImpl.hpp @@ -56,7 +56,7 @@ public: virtual void set_polyphonic(Raul::Maid& maid, bool p) { _polyphonic = p; } inline GraphObjectImpl* parent() const { return _parent; } - const string& name() const { return _name; } + const string name() const { return _name; } virtual void process(ProcessContext& context) = 0; diff --git a/src/libs/gui/LoadPatchWindow.cpp b/src/libs/gui/LoadPatchWindow.cpp index 593f2b6d..672ff940 100644 --- a/src/libs/gui/LoadPatchWindow.cpp +++ b/src/libs/gui/LoadPatchWindow.cpp @@ -68,7 +68,7 @@ LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gno void -LoadPatchWindow::present(SharedPtr<PatchModel> patch, MetadataMap data) +LoadPatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data) { set_patch(patch); _initial_data = data; diff --git a/src/libs/gui/LoadPatchWindow.hpp b/src/libs/gui/LoadPatchWindow.hpp index 3524ce16..9a4cf210 100644 --- a/src/libs/gui/LoadPatchWindow.hpp +++ b/src/libs/gui/LoadPatchWindow.hpp @@ -21,10 +21,11 @@ #include <libglademm/xml.h> #include <gtkmm.h> #include <raul/SharedPtr.hpp> +#include "interface/GraphObject.hpp" #include "client/PluginModel.hpp" #include "client/PatchModel.hpp" using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; +using namespace Ingen::Shared; namespace Ingen { namespace GUI { @@ -50,7 +51,7 @@ public: void set_replace() { _replace = true; } void set_merge() { _replace = false; } - void present(SharedPtr<PatchModel> patch, MetadataMap data); + void present(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data); protected: void on_show(); @@ -61,7 +62,7 @@ private: void ok_clicked(); void cancel_clicked(); - MetadataMap _initial_data; + GraphObject::MetadataMap _initial_data; SharedPtr<PatchModel> _patch; bool _replace; diff --git a/src/libs/gui/LoadPluginWindow.cpp b/src/libs/gui/LoadPluginWindow.cpp index a8a0d188..9aaed171 100644 --- a/src/libs/gui/LoadPluginWindow.cpp +++ b/src/libs/gui/LoadPluginWindow.cpp @@ -109,7 +109,7 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<G void -LoadPluginWindow::present(SharedPtr<PatchModel> patch, MetadataMap data) +LoadPluginWindow::present(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data) { set_patch(patch); _initial_data = data; @@ -343,7 +343,7 @@ LoadPluginWindow::add_clicked() } else { Path path = _patch->path().base() + Path::nameify(name); App::instance().engine()->create_node(path, plugin->uri(), polyphonic); - for (MetadataMap::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) + for (GraphObject::MetadataMap::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) App::instance().engine()->set_metadata(path, i->first, i->second); ++_plugin_name_offset; _node_name_entry->set_text(generate_module_name(_plugin_name_offset)); diff --git a/src/libs/gui/LoadPluginWindow.hpp b/src/libs/gui/LoadPluginWindow.hpp index f1ba6383..c0b668ba 100644 --- a/src/libs/gui/LoadPluginWindow.hpp +++ b/src/libs/gui/LoadPluginWindow.hpp @@ -15,7 +15,6 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - #ifndef LOADPLUGINWINDOW_H #define LOADPLUGINWINDOW_H @@ -24,11 +23,12 @@ #include <gtkmm.h> #include <raul/SharedPtr.hpp> #include <raul/Table.hpp> +#include "interface/GraphObject.hpp" #include "client/PatchModel.hpp" #include "client/PluginModel.hpp" using Ingen::Client::PluginModel; using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; +using namespace Ingen::Shared; namespace Ingen { namespace GUI { @@ -96,7 +96,7 @@ public: void add_plugin(SharedPtr<PluginModel> plugin); bool has_shown() const { return _has_shown; } - void present(SharedPtr<PatchModel> patch, MetadataMap data); + void present(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data); protected: void on_show(); @@ -117,7 +117,7 @@ private: void plugin_selection_changed(); string generate_module_name(int offset = 0); - MetadataMap _initial_data; + GraphObject::MetadataMap _initial_data; SharedPtr<PatchModel> _patch; diff --git a/src/libs/gui/LoadRemotePatchWindow.cpp b/src/libs/gui/LoadRemotePatchWindow.cpp index c2d40c5e..20c1533c 100644 --- a/src/libs/gui/LoadRemotePatchWindow.cpp +++ b/src/libs/gui/LoadRemotePatchWindow.cpp @@ -59,7 +59,7 @@ LoadRemotePatchWindow::LoadRemotePatchWindow(BaseObjectType* cobject, const Glib void -LoadRemotePatchWindow::present(SharedPtr<PatchModel> patch, MetadataMap data) +LoadRemotePatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data) { _liststore->clear(); diff --git a/src/libs/gui/LoadRemotePatchWindow.hpp b/src/libs/gui/LoadRemotePatchWindow.hpp index 2afef975..59b037d2 100644 --- a/src/libs/gui/LoadRemotePatchWindow.hpp +++ b/src/libs/gui/LoadRemotePatchWindow.hpp @@ -21,10 +21,11 @@ #include <libglademm/xml.h> #include <gtkmm.h> #include <raul/SharedPtr.hpp> +#include "interface/GraphObject.hpp" #include "client/PatchModel.hpp" #include "client/PluginModel.hpp" +using namespace Ingen::Shared; using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; namespace Ingen { namespace GUI { @@ -62,7 +63,7 @@ public: void set_replace() { _replace = true; } void set_merge() { _replace = false; } - void present(SharedPtr<PatchModel> patch, MetadataMap data); + void present(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data); private: void patch_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); @@ -71,7 +72,7 @@ private: void open_clicked(); void cancel_clicked(); - MetadataMap _initial_data; + GraphObject::MetadataMap _initial_data; SharedPtr<PatchModel> _patch; bool _replace; diff --git a/src/libs/gui/LoadSubpatchWindow.cpp b/src/libs/gui/LoadSubpatchWindow.cpp index 42058578..e230720a 100644 --- a/src/libs/gui/LoadSubpatchWindow.cpp +++ b/src/libs/gui/LoadSubpatchWindow.cpp @@ -71,7 +71,7 @@ LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefP void -LoadSubpatchWindow::present(SharedPtr<PatchModel> patch, MetadataMap data) +LoadSubpatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data) { set_patch(patch); _initial_data = data; diff --git a/src/libs/gui/LoadSubpatchWindow.hpp b/src/libs/gui/LoadSubpatchWindow.hpp index 01047a3e..89600895 100644 --- a/src/libs/gui/LoadSubpatchWindow.hpp +++ b/src/libs/gui/LoadSubpatchWindow.hpp @@ -23,8 +23,9 @@ #include <raul/SharedPtr.hpp> #include "client/PatchModel.hpp" #include "client/PluginModel.hpp" +#include "interface/GraphObject.hpp" +using namespace Ingen::Shared; using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; namespace Ingen { namespace GUI { @@ -43,7 +44,7 @@ public: void set_patch(SharedPtr<PatchModel> patch); - void present(SharedPtr<PatchModel> patch, MetadataMap data); + void present(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data); protected: void on_show(); @@ -57,7 +58,7 @@ private: void ok_clicked(); void cancel_clicked(); - MetadataMap _initial_data; + GraphObject::MetadataMap _initial_data; SharedPtr<PatchModel> _patch; diff --git a/src/libs/gui/NewSubpatchWindow.cpp b/src/libs/gui/NewSubpatchWindow.cpp index 103e9a54..d327d257 100644 --- a/src/libs/gui/NewSubpatchWindow.cpp +++ b/src/libs/gui/NewSubpatchWindow.cpp @@ -43,7 +43,7 @@ NewSubpatchWindow::NewSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr } void -NewSubpatchWindow::present(SharedPtr<PatchModel> patch, MetadataMap data) +NewSubpatchWindow::present(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data) { set_patch(patch); _initial_data = data; @@ -91,7 +91,7 @@ NewSubpatchWindow::ok_clicked() const uint32_t poly = _poly_spinbutton->get_value_as_int(); App::instance().engine()->create_patch(path, poly); - for (MetadataMap::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) + for (GraphObject::MetadataMap::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) App::instance().engine()->set_metadata(path, i->first, i->second); App::instance().engine()->enable_patch(path); diff --git a/src/libs/gui/NewSubpatchWindow.hpp b/src/libs/gui/NewSubpatchWindow.hpp index d6ce65d7..d8fbde88 100644 --- a/src/libs/gui/NewSubpatchWindow.hpp +++ b/src/libs/gui/NewSubpatchWindow.hpp @@ -21,10 +21,11 @@ #include <libglademm/xml.h> #include <gtkmm.h> #include <raul/SharedPtr.hpp> +#include "interface/GraphObject.hpp" #include "client/PatchModel.hpp" #include "client/PluginModel.hpp" +using namespace Ingen::Shared; using Ingen::Client::PatchModel; -using Ingen::Client::MetadataMap; namespace Ingen { namespace GUI { @@ -43,15 +44,15 @@ public: void set_patch(SharedPtr<PatchModel> patch); - void present(SharedPtr<PatchModel> patch, MetadataMap data); + void present(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data); private: void name_changed(); void ok_clicked(); void cancel_clicked(); - MetadataMap _initial_data; - SharedPtr<PatchModel> _patch; + GraphObject::MetadataMap _initial_data; + SharedPtr<PatchModel> _patch; Gtk::Entry* _name_entry; Gtk::Label* _message_label; diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp index b4b005d6..d7cf0154 100644 --- a/src/libs/gui/NodeModule.cpp +++ b/src/libs/gui/NodeModule.cpp @@ -92,7 +92,7 @@ NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> n else ret = boost::shared_ptr<NodeModule>(new NodeModule(canvas, node)); - for (MetadataMap::const_iterator m = node->metadata().begin(); m != node->metadata().end(); ++m) + for (GraphObject::MetadataMap::const_iterator m = node->metadata().begin(); m != node->metadata().end(); ++m) ret->set_metadata(m->first, m->second); for (PortModelList::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) { diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index ee3c326e..236ed0d3 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -506,7 +506,7 @@ PatchCanvas::menu_add_control(ControlType type) { // FIXME: bundleify - MetadataMap data = get_initial_data(); + GraphObject::MetadataMap data = get_initial_data(); float x = data["ingenuity:canvas-x"].get_float(); float y = data["ingenuity:canvas-y"].get_float(); @@ -522,8 +522,8 @@ PatchCanvas::menu_add_port(const string& name, const string& type, bool is_outpu // FIXME: bundleify const Path& path = _patch->path().base() + generate_port_name(name); App::instance().engine()->create_port(path, type, is_output); - MetadataMap data = get_initial_data(); - for (MetadataMap::const_iterator i = data.begin(); i != data.end(); ++i) + GraphObject::MetadataMap data = get_initial_data(); + for (GraphObject::MetadataMap::const_iterator i = data.begin(); i != data.end(); ++i) App::instance().engine()->set_metadata(path, i->first, i->second); } @@ -534,8 +534,8 @@ PatchCanvas::load_plugin(SharedPtr<PluginModel> plugin) const Path& path = _patch->path().base() + plugin->default_node_name(_patch); // FIXME: polyphony? App::instance().engine()->create_node(path, plugin->uri(), false); - MetadataMap data = get_initial_data(); - for (MetadataMap::const_iterator i = data.begin(); i != data.end(); ++i) + GraphObject::MetadataMap data = get_initial_data(); + for (GraphObject::MetadataMap::const_iterator i = data.begin(); i != data.end(); ++i) App::instance().engine()->set_metadata(path, i->first, i->second); } @@ -553,10 +553,10 @@ PatchCanvas::get_new_module_location(double& x, double& y) } -MetadataMap +GraphObject::MetadataMap PatchCanvas::get_initial_data() { - MetadataMap result; + GraphObject::MetadataMap result; result["ingenuity:canvas-x"] = Atom((float)_last_click_x); result["ingenuity:canvas-y"] = Atom((float)_last_click_y); diff --git a/src/libs/gui/PatchCanvas.hpp b/src/libs/gui/PatchCanvas.hpp index 3878bd69..95b7fc70 100644 --- a/src/libs/gui/PatchCanvas.hpp +++ b/src/libs/gui/PatchCanvas.hpp @@ -29,17 +29,18 @@ #include <raul/Path.hpp> #include "client/ConnectionModel.hpp" #include "client/PatchModel.hpp" +#include "interface/GraphObject.hpp" #include "NodeModule.hpp" -using std::string; using namespace FlowCanvas; +using namespace Ingen::Shared; +using std::string; using FlowCanvas::Port; using Ingen::Client::ConnectionModel; using Ingen::Client::PatchModel; using Ingen::Client::NodeModel; using Ingen::Client::PortModel; -using Ingen::Client::MetadataMap; namespace Ingen { namespace GUI { @@ -99,7 +100,7 @@ private: SLV2PluginClass plugin_class, SLV2PluginClasses classes); #endif - MetadataMap get_initial_data(); + GraphObject::MetadataMap get_initial_data(); bool canvas_event(GdkEvent* event); diff --git a/src/libs/gui/PatchPortModule.cpp b/src/libs/gui/PatchPortModule.cpp index f686079d..2c5581f8 100644 --- a/src/libs/gui/PatchPortModule.cpp +++ b/src/libs/gui/PatchPortModule.cpp @@ -76,7 +76,7 @@ PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortMod ret->set_menu(ret->_patch_port->menu()); - for (MetadataMap::const_iterator m = port->metadata().begin(); m != port->metadata().end(); ++m) + for (GraphObject::MetadataMap::const_iterator m = port->metadata().begin(); m != port->metadata().end(); ++m) ret->metadata_update(m->first, m->second); ret->resize(); diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp index 568806a8..a1c28acf 100644 --- a/src/libs/gui/ThreadedLoader.cpp +++ b/src/libs/gui/ThreadedLoader.cpp @@ -72,12 +72,12 @@ ThreadedLoader::_whipped() } void -ThreadedLoader::load_patch(bool merge, - const string& data_base_uri, - const Path& data_path, - MetadataMap engine_data, - optional<Path> engine_parent, - optional<const string&> engine_name) +ThreadedLoader::load_patch(bool merge, + const string& data_base_uri, + const Path& data_path, + GraphObject::MetadataMap engine_data, + optional<Path> engine_parent, + optional<const string&> engine_name) { _mutex.lock(); diff --git a/src/libs/gui/ThreadedLoader.hpp b/src/libs/gui/ThreadedLoader.hpp index 68045598..08b24faa 100644 --- a/src/libs/gui/ThreadedLoader.hpp +++ b/src/libs/gui/ThreadedLoader.hpp @@ -61,12 +61,12 @@ public: // FIXME: there's a pattern here.... // (same core interface as Loader/Serializer) - void load_patch(bool merge, - const string& data_base_uri, - const Path& data_path, - MetadataMap engine_data, - optional<Path> engine_parent, - optional<const string&> engine_name = optional<const string&>()); + void load_patch(bool merge, + const string& data_base_uri, + const Path& data_path, + GraphObject::MetadataMap engine_data, + optional<Path> engine_parent, + optional<const string&> engine_name = optional<const string&>()); void save_patch(SharedPtr<PatchModel> model, const string& filename); diff --git a/src/libs/gui/WindowFactory.cpp b/src/libs/gui/WindowFactory.cpp index caa02390..6e7e2c8b 100644 --- a/src/libs/gui/WindowFactory.cpp +++ b/src/libs/gui/WindowFactory.cpp @@ -253,7 +253,7 @@ WindowFactory::remove_control_window(NodeControlWindow* win, GdkEventAny* ignore void -WindowFactory::present_load_plugin(SharedPtr<PatchModel> patch, MetadataMap data) +WindowFactory::present_load_plugin(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data) { PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -265,7 +265,7 @@ WindowFactory::present_load_plugin(SharedPtr<PatchModel> patch, MetadataMap data void -WindowFactory::present_load_patch(SharedPtr<PatchModel> patch, MetadataMap data) +WindowFactory::present_load_patch(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data) { PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -279,7 +279,7 @@ WindowFactory::present_load_patch(SharedPtr<PatchModel> patch, MetadataMap data) void -WindowFactory::present_load_remote_patch(SharedPtr<PatchModel> patch, MetadataMap data) +WindowFactory::present_load_remote_patch(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data) { PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -305,9 +305,8 @@ WindowFactory::present_upload_patch(SharedPtr<PatchModel> patch) #endif } - void -WindowFactory::present_new_subpatch(SharedPtr<PatchModel> patch, MetadataMap data) +WindowFactory::present_new_subpatch(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data) { PatchWindowMap::iterator w = _patch_windows.find(patch->path()); @@ -319,7 +318,7 @@ WindowFactory::present_new_subpatch(SharedPtr<PatchModel> patch, MetadataMap dat void -WindowFactory::present_load_subpatch(SharedPtr<PatchModel> patch, MetadataMap data) +WindowFactory::present_load_subpatch(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data) { PatchWindowMap::iterator w = _patch_windows.find(patch->path()); diff --git a/src/libs/gui/WindowFactory.hpp b/src/libs/gui/WindowFactory.hpp index 91fb27ab..d9418496 100644 --- a/src/libs/gui/WindowFactory.hpp +++ b/src/libs/gui/WindowFactory.hpp @@ -21,10 +21,12 @@ #include <map> #include <gtkmm.h> #include <raul/SharedPtr.hpp> +#include "interface/GraphObject.hpp" #include "client/PatchModel.hpp" #include "PatchView.hpp" using Ingen::Client::PatchModel; +using namespace Ingen::Shared; namespace Ingen { namespace GUI { @@ -62,12 +64,12 @@ public: void present_controls(SharedPtr<NodeModel> node); - void present_load_plugin(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap()); - void present_load_patch(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap()); - void present_load_remote_patch(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap()); + void present_load_plugin(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data=GraphObject::MetadataMap()); + void present_load_patch(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data=GraphObject::MetadataMap()); + void present_load_remote_patch(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data=GraphObject::MetadataMap()); void present_upload_patch(SharedPtr<PatchModel> patch); - void present_new_subpatch(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap()); - void present_load_subpatch(SharedPtr<PatchModel> patch, MetadataMap data = MetadataMap()); + void present_new_subpatch(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data=GraphObject::MetadataMap()); + void present_load_subpatch(SharedPtr<PatchModel> patch, GraphObject::MetadataMap data=GraphObject::MetadataMap()); void present_rename(SharedPtr<ObjectModel> object); void present_properties(SharedPtr<ObjectModel> object); diff --git a/src/libs/serialisation/Loader.cpp b/src/libs/serialisation/Loader.cpp index a911eb72..45d66740 100644 --- a/src/libs/serialisation/Loader.cpp +++ b/src/libs/serialisation/Loader.cpp @@ -41,12 +41,12 @@ namespace Serialisation { */ bool Loader::load(SharedPtr<EngineInterface> engine, - Raul::RDF::World* rdf_world, - const Glib::ustring& document_uri, - boost::optional<Path> parent, - string patch_name, - Glib::ustring patch_uri, - Raul::Table<string, Atom> data) + Raul::RDF::World* rdf_world, + const Glib::ustring& document_uri, + boost::optional<Path> parent, + string patch_name, + Glib::ustring patch_uri, + GraphObject::MetadataMap data) { setlocale(LC_NUMERIC, "C"); @@ -67,7 +67,7 @@ Loader::load(SharedPtr<EngineInterface> engine, size_t patch_poly = 1; /* Use parameter overridden polyphony, if given */ - Raul::Table<string, Atom>::iterator poly_param = data.find("ingen:polyphony"); + GraphObject::MetadataMap::iterator poly_param = data.find("ingen:polyphony"); if (poly_param != data.end() && poly_param->second.type() == Atom::INT) { patch_poly = poly_param->second.get_int32(); @@ -358,7 +358,7 @@ Loader::load(SharedPtr<EngineInterface> engine, // Set passed metadata last to override any loaded values - for (Metadata::const_iterator i = data.begin(); i != data.end(); ++i) + for (GraphObject::MetadataMap::const_iterator i = data.begin(); i != data.end(); ++i) engine->set_metadata(patch_path, i->first, i->second); diff --git a/src/libs/serialisation/Loader.hpp b/src/libs/serialisation/Loader.hpp index 87465880..158831cb 100644 --- a/src/libs/serialisation/Loader.hpp +++ b/src/libs/serialisation/Loader.hpp @@ -25,10 +25,13 @@ #include <raul/Path.hpp> #include <raul/Atom.hpp> #include <raul/Table.hpp> +#include "interface/GraphObject.hpp" namespace Raul { class Atom; namespace RDF { class World; } } namespace Ingen { namespace Shared { class EngineInterface; } } +using namespace Ingen::Shared; + namespace Ingen { namespace Serialisation { @@ -37,8 +40,6 @@ class Loader { public: virtual ~Loader() {} - typedef Raul::Table<std::string, Raul::Atom> Metadata; - virtual bool load(SharedPtr<Ingen::Shared::EngineInterface> engine, Raul::RDF::World* world, @@ -46,7 +47,7 @@ public: boost::optional<Raul::Path> parent, std::string patch_name, Glib::ustring patch_uri = "", - Metadata data = Metadata()); + GraphObject::MetadataMap data = GraphObject::MetadataMap()); }; |