summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/util/CountedPtr.h4
-rw-r--r--src/common/util/RedlandAtom.h47
-rw-r--r--src/libs/client/Makefile.am4
-rw-r--r--src/libs/client/PluginModel.h2
-rw-r--r--src/libs/client/Serializer.cpp205
-rw-r--r--src/libs/client/Serializer.h36
-rw-r--r--src/progs/ingenuity/DSSIModule.cpp2
-rw-r--r--src/progs/ingenuity/DSSIModule.h2
-rw-r--r--src/progs/ingenuity/Loader.cpp14
-rw-r--r--src/progs/ingenuity/Loader.h2
-rw-r--r--src/progs/ingenuity/NodeModule.cpp54
-rw-r--r--src/progs/ingenuity/NodeModule.h28
-rw-r--r--src/progs/ingenuity/PatchCanvas.cpp74
-rw-r--r--src/progs/ingenuity/PatchCanvas.h22
-rw-r--r--src/progs/ingenuity/PatchPortModule.cpp29
-rw-r--r--src/progs/ingenuity/PatchPortModule.h13
-rw-r--r--src/progs/ingenuity/PatchView.cpp10
-rw-r--r--src/progs/ingenuity/PatchView.h10
-rw-r--r--src/progs/ingenuity/Port.cpp2
-rw-r--r--src/progs/ingenuity/Port.h2
-rw-r--r--src/progs/ingenuity/SubpatchModule.cpp2
-rw-r--r--src/progs/ingenuity/SubpatchModule.h2
22 files changed, 329 insertions, 237 deletions
diff --git a/src/common/util/CountedPtr.h b/src/common/util/CountedPtr.h
index 0f00be87..63b2bdf4 100644
--- a/src/common/util/CountedPtr.h
+++ b/src/common/util/CountedPtr.h
@@ -31,7 +31,7 @@ static std::list<void*> counted_ptr_counters;
// Use debug hooks to ensure 2 shared_ptrs never point to the same thing
namespace boost {
- static void sp_scalar_constructor_hook(void* object, unsigned long cnt, void* ptr) {
+ inline void sp_scalar_constructor_hook(void* object, unsigned long cnt, void* ptr) {
assert(std::find(counted_ptr_counters.begin(), counted_ptr_counters.end(),
(void*)object) == counted_ptr_counters.end());
counted_ptr_counters.push_back(object);
@@ -39,7 +39,7 @@ namespace boost {
// << object << ", count = " << cnt << std::endl;
}
- static void sp_scalar_destructor_hook(void* object, unsigned long cnt, void* ptr) {
+ inline void sp_scalar_destructor_hook(void* object, unsigned long cnt, void* ptr) {
counted_ptr_counters.remove(object);
//std::cerr << "Destroying CountedPtr to "
// << object << ", count = " << cnt << std::endl;
diff --git a/src/common/util/RedlandAtom.h b/src/common/util/RedlandAtom.h
index 6b5658cf..df55affb 100644
--- a/src/common/util/RedlandAtom.h
+++ b/src/common/util/RedlandAtom.h
@@ -17,7 +17,8 @@
#ifndef REDLAND_ATOM_H
#define REDLAND_ATOM_H
-#include <redland.h>
+#include <cstring>
+#include <raptor.h>
#include "util/Atom.h"
#define U(x) ((const unsigned char*)(x))
@@ -28,31 +29,46 @@
*/
class RedlandAtom {
public:
- static librdf_node* atom_to_node(librdf_world* world, const Atom& atom) {
- char tmp_buf[32];
+ /** Set this atom's value to the object (value) portion of an RDF triple.
+ *
+ * Caller is responsible for calling free(triple->object).
+ */
+ static void atom_to_triple_object(raptor_statement* triple, const Atom& atom) {
+ static const size_t STR_LENGTH = 32; // FIXME ?
+ char* str = (char*)malloc(sizeof(char) * STR_LENGTH);
switch (atom.type()) {
- //case NIL:
- // (see below)
- //break;
case Atom::INT:
- snprintf(tmp_buf, 32, "%d", atom.get_int32());
- return librdf_new_node_from_typed_literal(world, U(tmp_buf), NULL, librdf_new_uri(world, U("http://www.w3.org/2001/XMLSchema#integer")));
- break;
+ snprintf(str, 32, "%d", atom.get_int32());
+ triple->object = (unsigned char*)str;
+ triple->object_type = RAPTOR_IDENTIFIER_TYPE_LITERAL;
+ triple->object_literal_datatype = raptor_new_uri(
+ U("http://www.w3.org/2001/XMLSchema#integer"));
+ break;
case Atom::FLOAT:
- snprintf(tmp_buf, 32, "%f", atom.get_float());
- return librdf_new_node_from_typed_literal(world, U(tmp_buf), NULL, librdf_new_uri(world, U("http://www.w3.org/2001/XMLSchema#float")));
+ snprintf(str, 32, "%f", atom.get_float());
+ triple->object = (unsigned char*)str;
+ triple->object_type = RAPTOR_IDENTIFIER_TYPE_LITERAL;
+ triple->object_literal_datatype = raptor_new_uri(
+ U("http://www.w3.org/2001/XMLSchema#float"));
break;
case Atom::STRING:
- return librdf_new_node_from_literal(world, U(atom.get_string()), NULL, 0);
+ snprintf(str, 32, "%f", atom.get_float());
+ triple->object = (unsigned char*)str;
+ triple->object_type = RAPTOR_IDENTIFIER_TYPE_LITERAL;
+ break;
case Atom::BLOB:
+ case Atom::NIL:
+ default:
cerr << "WARNING: Unserializable atom!" << endl;
- return NULL;
- default: // This catches Atom::Type::NIL too
- return librdf_new_node(world); // blank node
+ // FIXME: what to do?
+ triple->object = NULL;
+ triple->object_type = RAPTOR_IDENTIFIER_TYPE_UNKNOWN;
+ free(str); // FIXME: ew
}
}
+#if 0
static Atom node_to_atom(librdf_node* node) {
/*switch (type) {
case 'i':
@@ -70,6 +86,7 @@ public:
cerr << "FIXME: node_to_atom\n";
return Atom();
}
+#endif
};
diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am
index 47e675c2..126b07fa 100644
--- a/src/libs/client/Makefile.am
+++ b/src/libs/client/Makefile.am
@@ -3,8 +3,8 @@ AM_CXXFLAGS = -I$(top_srcdir)/src/common
if BUILD_CLIENT_LIB
noinst_LTLIBRARIES = libingenclient.la
-libingenclient_la_CXXFLAGS = -I$(top_srcdir)/src/common -DPKGDATADIR=\"$(pkgdatadir)\" @LXML2_CFLAGS@ @REDLAND_CFLAGS@ @LSIGCPP_CFLAGS@
-libingenclient_la_LIBADD = @LXML2_LIBS@ @LOSC_LIBS@ @REDLAND_LIBS@ @LSIGCPP_LIBS@
+libingenclient_la_CXXFLAGS = -I$(top_srcdir)/src/common -DPKGDATADIR=\"$(pkgdatadir)\" @LXML2_CFLAGS@ @RAPTOR_CFLAGS@ @LSIGCPP_CFLAGS@
+libingenclient_la_LIBADD = @LXML2_LIBS@ @LOSC_LIBS@ @RAPTOR_LIBS@ @LSIGCPP_LIBS@
libingenclient_la_SOURCES = \
ClientInterface.h \
diff --git a/src/libs/client/PluginModel.h b/src/libs/client/PluginModel.h
index 74eee7cb..42548f64 100644
--- a/src/libs/client/PluginModel.h
+++ b/src/libs/client/PluginModel.h
@@ -39,7 +39,7 @@ public:
: m_uri(uri),
m_name(name)
{
- cerr << "FIXME: plugin type" << endl;
+ //cerr << "FIXME: plugin type" << endl;
}
Type type() const { return m_type; }
diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp
index e82389d4..d7c1a153 100644
--- a/src/libs/client/Serializer.cpp
+++ b/src/libs/client/Serializer.cpp
@@ -20,11 +20,12 @@
#include <string>
#include <vector>
#include <utility> // pair, make_pair
+#include <stdexcept>
#include <cassert>
#include <cmath>
#include <cstdlib> // atof
#include <cstring>
-#include <redland.h>
+#include <raptor.h>
#include "Serializer.h"
#include "PatchModel.h"
#include "NodeModel.h"
@@ -47,13 +48,11 @@ namespace Client {
Serializer::Serializer(CountedPtr<ModelEngineInterface> engine)
- : _world(librdf_new_world())
- , _serializer(0)
+ : _serializer(NULL)
+ , _string_output(NULL)
, _patch_search_path(".")
, _engine(engine)
{
- librdf_world_open(_world);
-
//_prefixes["xsd"] = "http://www.w3.org/2001/XMLSchema#";
_prefixes["rdf"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
_prefixes["ingen"] = "http://codeson.net/ns/ingen#";
@@ -63,24 +62,67 @@ Serializer::Serializer(CountedPtr<ModelEngineInterface> engine)
Serializer::~Serializer()
{
-
- librdf_free_world(_world);
}
+/** Begin a serialization to a file.
+ *
+ * This must be called before any serializing methods.
+ */
void
-Serializer::create()
+Serializer::start_to_filename(const string& filename)
{
- _serializer = librdf_new_serializer(_world, "rdfxml-abbrev", NULL, librdf_new_uri(_world, U(NS_INGEN())));
-
+ raptor_init();
+ _serializer = raptor_new_serializer("rdfxml-abbrev");
setup_prefixes();
+ raptor_serialize_start_to_filename(_serializer, filename.c_str());
}
+
+/** Begin a serialization to a string.
+ *
+ * This must be called before any serializing methods.
+ *
+ * The results of the serialization will be returned by the finish() method after
+ * the desired objects have been serialized.
+ */
void
-Serializer::destroy()
+Serializer::start_to_string()
{
- librdf_free_serializer(_serializer);
+ _serializer = raptor_new_serializer("rdfxml-abbrev");
+ setup_prefixes();
+ raptor_serialize_start_to_string(_serializer,
+ NULL /*base_uri*/,
+ (void**)&_string_output,
+ NULL /*size*/);
+}
+
+
+/** Finish a serialization.
+ *
+ * If this was a serialization to a string, the serialization output
+ * will be returned, otherwise the empty string is returned.
+ */
+string
+Serializer::finish() throw(std::logic_error)
+{
+ string ret = "";
+
+ if (!_serializer)
+ throw std::logic_error("finish() called with no serialization in progress");
+
+ raptor_serialize_end(_serializer);
+
+ if (_string_output) {
+ ret = string((char*)_string_output);
+ free(_string_output);
+ _string_output = NULL;
+ }
+
+ raptor_free_serializer(_serializer);
_serializer = NULL;
+
+ return ret;
}
@@ -88,8 +130,8 @@ void
Serializer::setup_prefixes()
{
for (map<string,string>::const_iterator i = _prefixes.begin(); i != _prefixes.end(); ++i) {
- librdf_serializer_set_namespace(_serializer,
- librdf_new_uri(_world, U(i->second.c_str())), i->first.c_str());
+ raptor_serialize_set_namespace(_serializer,
+ raptor_new_uri(U(i->second.c_str())), U(i->first.c_str()));
}
}
@@ -106,11 +148,6 @@ Serializer::expand_uri(const string& uri)
if (uri.substr(0, i->first.length()+1) == i->first + ":")
return i->second + uri.substr(i->first.length()+1);
- /*librdf_uri* redland_uri = librdf_new_uri(_world, U(uri.c_str()));
- string ret = (redland_uri) ? uri : "";
- librdf_free_uri(redland_uri);
- return ret;*/
-
// FIXME: find a correct way to validate a URI
if (uri.find(":") == string::npos && uri.find("/") == string::npos)
return "";
@@ -169,110 +206,97 @@ Serializer::find_file(const string& filename, const string& additional_path)
}
-/** Save a patch from a PatchModel to a filename.
- *
- * The filename passed is the true filename the patch will be saved to (with no prefixing or anything
- * like that), and the patch_model's filename member will be set accordingly.
- *
- * FIXME: make this take a URI. network loading for free.
- *
- * This will break if:
- * - The filename does not have an extension (ie contain a ".")
- * - The patch_model has no (Ingen) path
- */
-void
-Serializer::save_patch(CountedPtr<PatchModel> patch_model, const string& filename, bool recursive)
-{
- librdf_storage* storage = librdf_new_storage(_world, "hashes", NULL, "hash-type='memory'");
-
- librdf_model* model = librdf_new_model(_world, storage, NULL);
- assert(model);
-
- const string uri = string("file://") + filename;
- add_patch_to_rdf(model, patch_model, uri);
-
- create();
-
- //librdf_serializer_serialize_model_to_file_handle(serializer, stdout, NULL, model);
- librdf_serializer_serialize_model_to_file(_serializer,
- filename.c_str(), NULL, model);
-
- destroy();
-
- librdf_storage_close(storage);
- librdf_free_storage(storage);
- librdf_free_model(model);
-}
-
-
void
-Serializer::add_resource_to_rdf(librdf_model* rdf,
+Serializer::add_resource_to_rdf(raptor_serializer* rdf,
const string& subject_uri, const string& predicate_uri, const string& object_uri)
{
-
- librdf_node* subject = librdf_new_node_from_uri_string(_world, U(subject_uri.c_str()));
- add_resource_to_rdf(rdf, subject, predicate_uri, object_uri);
+ raptor_statement triple;
+ triple.subject = (void*)raptor_new_uri((const unsigned char*)subject_uri.c_str());
+ triple.subject_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+ triple.predicate = (void*)raptor_new_uri((const unsigned char*)predicate_uri.c_str());
+ triple.predicate_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+ triple.object = (void*)raptor_new_uri((const unsigned char*)object_uri.c_str());
+ triple.object_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+ raptor_serialize_statement(rdf, &triple);
}
+#if 0
void
-Serializer::add_resource_to_rdf(librdf_model* rdf,
+Serializer::add_resource_to_rdf(raptor_serializer* rdf
librdf_node* subject, const string& predicate_uri, const string& object_uri)
{
+ cerr << "FIXME: serialize blank node\n";
+ /*
+ raptor_statement triple;
+ triple.subject = (void*)raptor_new_uri((const unsigned char*)subject_uri.c_str());
+ triple.subject_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+ triple.predicate = (void*)raptor_new_uri((const unsigned char*)predicate_uri.c_str());
+ triple.predicate_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+ triple.object = (void*)raptor_new_uri((const unsigned char*)object_uri.c_str());
+ triple.object_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+ raptor_serialize_statement(rdf, triple);
librdf_node* predicate = librdf_new_node_from_uri_string(_world, U(predicate_uri.c_str()));
librdf_node* object = librdf_new_node_from_uri_string(_world, U(object_uri.c_str()));
librdf_model_add(rdf, subject, predicate, object);
+ */
}
-
+#endif
void
-Serializer::add_atom_to_rdf(librdf_model* rdf,
+Serializer::add_atom_to_rdf(raptor_serializer* rdf,
const string& subject_uri, const string& predicate_uri, const Atom& atom)
{
- librdf_node* subject = librdf_new_node_from_uri_string(_world, U(subject_uri.c_str()));
- librdf_node* predicate = librdf_new_node_from_uri_string(_world, U(predicate_uri.c_str()));
- librdf_node* object = RedlandAtom::atom_to_node(_world, atom);
+ raptor_statement triple;
+ triple.subject = (void*)raptor_new_uri((const unsigned char*)subject_uri.c_str());
+ triple.subject_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
+ triple.predicate = (void*)raptor_new_uri((const unsigned char*)predicate_uri.c_str());
+ triple.predicate_type = RAPTOR_IDENTIFIER_TYPE_RESOURCE;
- librdf_model_add(rdf, subject, predicate, object);
+ RedlandAtom::atom_to_triple_object(&triple, atom);
+
+ raptor_serialize_statement(rdf, &triple);
}
void
-Serializer::add_patch_to_rdf(librdf_model* rdf,
- CountedPtr<PatchModel> patch, const string& uri_unused)
+Serializer::serialize_patch(CountedPtr<PatchModel> patch) throw (std::logic_error)
{
+ if (!_serializer)
+ throw std::logic_error("serialize_patch called without serialization in progress");
+
const string uri = "#";
- add_resource_to_rdf(rdf,
+ add_resource_to_rdf(_serializer,
uri.c_str(),
NS_RDF("type"),
NS_INGEN("Patch"));
if (patch->path().name().length() > 0) {
- add_atom_to_rdf(rdf,
+ add_atom_to_rdf(_serializer,
uri.c_str(),
NS_INGEN("name"),
Atom(patch->path().name().c_str()));
}
- add_atom_to_rdf(rdf,
+ add_atom_to_rdf(_serializer,
uri.c_str(),
NS_INGEN("polyphony"),
Atom((int)patch->poly()));
for (NodeModelMap::const_iterator n = patch->nodes().begin(); n != patch->nodes().end(); ++n) {
- add_node_to_rdf(rdf, n->second, "#");
- add_resource_to_rdf(rdf, "#", NS_INGEN("node"), uri + n->second->path().name());
+ add_node_to_rdf(_serializer, n->second, "#");
+ add_resource_to_rdf(_serializer, "#", NS_INGEN("node"), uri + n->second->path().name());
}
for (PortModelList::const_iterator p = patch->ports().begin(); p != patch->ports().end(); ++p) {
- add_port_to_rdf(rdf, *p, uri);
- add_resource_to_rdf(rdf, "#", NS_INGEN("port"), uri + (*p)->path().name());
+ add_port_to_rdf(_serializer, *p, uri);
+ add_resource_to_rdf(_serializer, "#", NS_INGEN("port"), uri + (*p)->path().name());
}
for (ConnectionList::const_iterator c = patch->connections().begin(); c != patch->connections().end(); ++c) {
- add_connection_to_rdf(rdf, *c, uri);
+ add_connection_to_rdf(_serializer, *c, uri);
}
//_engine->set_metadata(patch->path(), "uri", uri);
@@ -280,29 +304,29 @@ Serializer::add_patch_to_rdf(librdf_model* rdf,
void
-Serializer::add_node_to_rdf(librdf_model* rdf,
+Serializer::add_node_to_rdf(raptor_serializer* rdf,
CountedPtr<NodeModel> node, const string ns_prefix)
{
const string node_uri = ns_prefix + node->path().name();
- add_resource_to_rdf(rdf,
+ add_resource_to_rdf(_serializer,
node_uri.c_str(),
NS_RDF("type"),
NS_INGEN("Node"));
- /*add_atom_to_rdf(rdf,
+ /*add_atom_to_rdf(_serializer,
node_uri_ref.c_str(),
NS_INGEN("name"),
Atom(node->path().name()));*/
for (PortModelList::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p) {
- add_port_to_rdf(rdf, *p, node_uri + "/");
- add_resource_to_rdf(rdf, node_uri, NS_INGEN("port"), node_uri + "/" + (*p)->path().name());
+ add_port_to_rdf(_serializer, *p, node_uri + "/");
+ add_resource_to_rdf(_serializer, node_uri, NS_INGEN("port"), node_uri + "/" + (*p)->path().name());
}
for (MetadataMap::const_iterator m = node->metadata().begin(); m != node->metadata().end(); ++m) {
if (expand_uri(m->first) != "") {
- add_atom_to_rdf(rdf,
+ add_atom_to_rdf(_serializer,
node_uri.c_str(),
expand_uri(m->first.c_str()).c_str(),
m->second);
@@ -312,19 +336,19 @@ Serializer::add_node_to_rdf(librdf_model* rdf,
void
-Serializer::add_port_to_rdf(librdf_model* rdf,
+Serializer::add_port_to_rdf(raptor_serializer* rdf,
CountedPtr<PortModel> port, const string ns_prefix)
{
const string port_uri_ref = ns_prefix + port->path().name();
- add_resource_to_rdf(rdf,
+ add_resource_to_rdf(_serializer,
port_uri_ref.c_str(),
NS_RDF("type"),
NS_INGEN("Port"));
for (MetadataMap::const_iterator m = port->metadata().begin(); m != port->metadata().end(); ++m) {
if (expand_uri(m->first) != "") {
- add_atom_to_rdf(rdf,
+ add_atom_to_rdf(_serializer,
port_uri_ref.c_str(),
expand_uri(m->first).c_str(),
m->second);
@@ -334,9 +358,11 @@ Serializer::add_port_to_rdf(librdf_model* rdf,
void
-Serializer::add_connection_to_rdf(librdf_model* rdf,
+Serializer::add_connection_to_rdf(raptor_serializer* rdf,
CountedPtr<ConnectionModel> connection, const string ns_prefix)
{
+ cerr << "FIXME: serialize connection\n";
+#if 0
librdf_node* c = librdf_new_node(_world);
const string src_port_rel_path = connection->src_port_path().substr(connection->patch_path().length());
@@ -345,14 +371,15 @@ Serializer::add_connection_to_rdf(librdf_model* rdf,
librdf_statement* s = librdf_new_statement_from_nodes(_world, c,
librdf_new_node_from_uri_string(_world, U(NS_INGEN("source"))),
librdf_new_node_from_uri_string(_world, U((ns_prefix + src_port_rel_path).c_str())));
- librdf_model_add_statement(rdf, s);
+ librdf_model_add_statement(_serializer, s);
librdf_statement* d = librdf_new_statement_from_nodes(_world, c,
librdf_new_node_from_uri_string(_world, U(NS_INGEN("destination"))),
librdf_new_node_from_uri_string(_world, U((ns_prefix + dst_port_rel_path).c_str())));
- librdf_model_add_statement(rdf, d);
+ librdf_model_add_statement(_serializer, d);
- add_resource_to_rdf(rdf, c, NS_RDF("type"), NS_INGEN("Connection"));
+ add_resource_to_rdf(_serializer, c, NS_RDF("type"), NS_INGEN("Connection"));
+#endif
}
diff --git a/src/libs/client/Serializer.h b/src/libs/client/Serializer.h
index b2dbf000..a563dbb8 100644
--- a/src/libs/client/Serializer.h
+++ b/src/libs/client/Serializer.h
@@ -20,7 +20,8 @@
#include <map>
#include <utility>
#include <string>
-#include <redland.h>
+#include <stdexcept>
+#include <raptor.h>
#include <cassert>
#include "util/CountedPtr.h"
#include "util/Path.h"
@@ -60,52 +61,51 @@ public:
string find_file(const string& filename, const string& additional_path = "");
- void save_patch(CountedPtr<PatchModel> patch_model, const string& filename, bool recursive);
-
string load_patch(const string& filename,
const string& parent_path,
const string& name,
size_t poly,
MetadataMap initial_data,
bool existing = false);
+
+ void start_to_filename(const string& filename);
+ void start_to_string();
+
+ void serialize_patch(CountedPtr<PatchModel> patch) throw(std::logic_error);
+
+ string finish() throw(std::logic_error);
private:
// Model -> RDF
- void add_patch_to_rdf(librdf_model* rdf,
- CountedPtr<PatchModel> patch, const string& uri);
-
- void add_node_to_rdf(librdf_model* rdf,
+ void add_node_to_rdf(raptor_serializer* rdf,
CountedPtr<NodeModel> node, const string ns_prefix="");
- void add_port_to_rdf(librdf_model* rdf,
+ void add_port_to_rdf(raptor_serializer* rdf,
CountedPtr<PortModel> port, const string ns_prefix="");
- void add_connection_to_rdf(librdf_model* rdf,
+ void add_connection_to_rdf(raptor_serializer* rdf,
CountedPtr<ConnectionModel> connection, const string port_ns_prefix="");
// Triple -> RDF
- void add_resource_to_rdf(librdf_model* model,
+ void add_resource_to_rdf(raptor_serializer* rdf,
const string& subject_uri, const string& predicate_uri, const string& object_uri);
- void add_resource_to_rdf(librdf_model* model,
- librdf_node* subject, const string& predicate_uri, const string& object_uri);
+ //void add_resource_to_rdf(raptor_serializer* rdf
+ // librdf_node* subject, const string& predicate_uri, const string& object_uri);
- void add_atom_to_rdf(librdf_model* model,
+ void add_atom_to_rdf(raptor_serializer* rdf,
const string& subject_uri, const string& predicate_uri, const Atom& atom);
-
- void create();
- void destroy();
void setup_prefixes();
string expand_uri(const string& uri);
- librdf_world* _world;
- librdf_serializer* _serializer;
+ raptor_serializer* _serializer;
+ unsigned char* _string_output;
string _patch_search_path;
map<string, string> _prefixes;
CountedPtr<ModelEngineInterface> _engine;
diff --git a/src/progs/ingenuity/DSSIModule.cpp b/src/progs/ingenuity/DSSIModule.cpp
index 670c8efb..9506897d 100644
--- a/src/progs/ingenuity/DSSIModule.cpp
+++ b/src/progs/ingenuity/DSSIModule.cpp
@@ -20,7 +20,7 @@
namespace Ingenuity {
-DSSIModule::DSSIModule(PatchCanvas* canvas, CountedPtr<NodeModel> node)
+DSSIModule::DSSIModule(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<NodeModel> node)
: NodeModule(canvas, node)
{
}
diff --git a/src/progs/ingenuity/DSSIModule.h b/src/progs/ingenuity/DSSIModule.h
index e281a2b7..342d5f7b 100644
--- a/src/progs/ingenuity/DSSIModule.h
+++ b/src/progs/ingenuity/DSSIModule.h
@@ -30,7 +30,7 @@ class DSSIController;
class DSSIModule : public Ingenuity::NodeModule
{
public:
- DSSIModule(PatchCanvas* canvas, CountedPtr<NodeModel> node);
+ DSSIModule(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<NodeModel> node);
virtual ~DSSIModule() {}
void on_double_click(GdkEventButton* ev);
diff --git a/src/progs/ingenuity/Loader.cpp b/src/progs/ingenuity/Loader.cpp
index 485e450d..c07d99bf 100644
--- a/src/progs/ingenuity/Loader.cpp
+++ b/src/progs/ingenuity/Loader.cpp
@@ -81,7 +81,7 @@ Loader::save_patch(CountedPtr<PatchModel> model, const string& filename, bool re
_mutex.lock();
_events.push_back(sigc::hide_return(sigc::bind(
- sigc::mem_fun(_serializer, &Serializer::save_patch),
+ sigc::mem_fun(this, &Loader::save_patch_event),
model, filename, recursive)));
_mutex.unlock();
@@ -90,4 +90,16 @@ Loader::save_patch(CountedPtr<PatchModel> model, const string& filename, bool re
}
+void
+Loader::save_patch_event(CountedPtr<PatchModel> model, const string& filename, bool recursive)
+{
+ if (recursive)
+ cerr << "FIXME: Recursive save." << endl;
+
+ _serializer->start_to_filename(filename);
+ _serializer->serialize_patch(model);
+ _serializer->finish();
+}
+
+
} // namespace Ingenuity
diff --git a/src/progs/ingenuity/Loader.h b/src/progs/ingenuity/Loader.h
index 7459378e..3a043c59 100644
--- a/src/progs/ingenuity/Loader.h
+++ b/src/progs/ingenuity/Loader.h
@@ -69,6 +69,8 @@ public:
private:
+ void save_patch_event(CountedPtr<PatchModel> model, const string& filename, bool recursive);
+
/** Returns nothing and takes no parameters (because they have all been bound) */
typedef sigc::slot<void> Closure;
diff --git a/src/progs/ingenuity/NodeModule.cpp b/src/progs/ingenuity/NodeModule.cpp
index 29af857e..6d4e54de 100644
--- a/src/progs/ingenuity/NodeModule.cpp
+++ b/src/progs/ingenuity/NodeModule.cpp
@@ -31,7 +31,7 @@
namespace Ingenuity {
-NodeModule::NodeModule(PatchCanvas* canvas, CountedPtr<NodeModel> node)
+NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<NodeModel> node)
: LibFlowCanvas::Module(canvas, node->path().name()),
m_node(node),
m_menu(node)
@@ -39,55 +39,39 @@ NodeModule::NodeModule(PatchCanvas* canvas, CountedPtr<NodeModel> node)
assert(m_node);
if (node->polyphonic()) {
- border_width(2.0);
+ set_border_width(2.0);
}
- create_all_ports();
- set_all_metadata();
-
- node->new_port_sig.connect(sigc::mem_fun(this, &NodeModule::add_port));
+ node->new_port_sig.connect(sigc::bind(sigc::mem_fun(this, &NodeModule::add_port), true));
node->removed_port_sig.connect(sigc::mem_fun(this, &NodeModule::remove_port));
node->metadata_update_sig.connect(sigc::mem_fun(this, &NodeModule::metadata_update));
}
-void
-NodeModule::create_all_ports()
+boost::shared_ptr<NodeModule>
+NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<NodeModel> node)
{
- for (PortModelList::const_iterator i = m_node->ports().begin();
- i != m_node->ports().end(); ++i) {
- add_port(*i);
- }
-
- resize();
-
- // FIXME
- //if (has_control_inputs())
- // enable_controls_menuitem();
-}
+ boost::shared_ptr<NodeModule> ret = boost::shared_ptr<NodeModule>(
+ new NodeModule(canvas, node));
+ for (MetadataMap::const_iterator m = node->metadata().begin(); m != node->metadata().end(); ++m)
+ ret->metadata_update(m->first, m->second);
-void
-NodeModule::set_all_metadata()
-{
- for (MetadataMap::const_iterator i = m_node->metadata().begin(); i != m_node->metadata().end(); ++i)
- metadata_update(i->first, i->second);
-}
+ for (PortModelList::const_iterator p = node->ports().begin(); p != node->ports().end(); ++p)
+ ret->add_port(*p, false);
+ ret->resize();
-void
-NodeModule::add_port(CountedPtr<PortModel> port)
-{
- manage(new Port(this, port));
- resize();
+ return ret;
}
void
-NodeModule::remove_port(CountedPtr<PortModel> port)
+NodeModule::add_port(CountedPtr<PortModel> port, bool resize_to_fit)
{
- LibFlowCanvas::Port* canvas_port = get_port(port->path().name());
- delete canvas_port;
+ Module::add_port(boost::shared_ptr<Port>(new Port(shared_from_this(), port)));
+ if (resize_to_fit)
+ resize();
}
@@ -101,6 +85,8 @@ NodeModule::show_control_window()
void
NodeModule::store_location()
{
+ cerr << "FIXME: store_location\n";
+#if 0
const float x = static_cast<float>(property_x());
const float y = static_cast<float>(property_y());
@@ -112,7 +98,7 @@ NodeModule::store_location()
App::instance().engine()->set_metadata(m_node->path(), "ingenuity:canvas-x", Atom(x));
App::instance().engine()->set_metadata(m_node->path(), "ingenuity:canvas-y", Atom(y));
}
-
+#endif
}
diff --git a/src/progs/ingenuity/NodeModule.h b/src/progs/ingenuity/NodeModule.h
index 6f7460bf..cbdfc6d2 100644
--- a/src/progs/ingenuity/NodeModule.h
+++ b/src/progs/ingenuity/NodeModule.h
@@ -18,10 +18,12 @@
#define OMMODULE_H
#include <string>
+#include <boost/enable_shared_from_this.hpp>
#include <libgnomecanvasmm.h>
#include <flowcanvas/Module.h>
-#include "NodeMenu.h"
#include "util/CountedPtr.h"
+#include "Port.h"
+#include "NodeMenu.h"
using std::string;
class Atom;
@@ -46,14 +48,16 @@ class Port;
*
* \ingroup Ingenuity
*/
-class NodeModule : public LibFlowCanvas::Module
+class NodeModule : public boost::enable_shared_from_this<NodeModule>, public LibFlowCanvas::Module
{
public:
- NodeModule(PatchCanvas* canvas, CountedPtr<NodeModel> node);
+ static boost::shared_ptr<NodeModule> create (boost::shared_ptr<PatchCanvas> canvas, CountedPtr<NodeModel> node);
+
virtual ~NodeModule() {}
-
- virtual Ingenuity::Port* port(const string& port_name) {
- return (Ingenuity::Port*)Module::get_port(port_name);
+
+ boost::shared_ptr<Port> port(const string& port_name) {
+ return boost::dynamic_pointer_cast<Ingenuity::Port>(
+ Module::get_port(port_name));
}
virtual void store_location();
@@ -65,16 +69,16 @@ public:
CountedPtr<NodeModel> node() const { return m_node; }
protected:
+ NodeModule(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<NodeModel> node);
+
virtual void on_double_click(GdkEventButton* ev) { show_control_window(); }
virtual void on_middle_click(GdkEventButton* ev) { show_control_window(); }
- void set_all_metadata();
void metadata_update(const string& key, const Atom& value);
-
- void create_all_ports();
- void add_port(CountedPtr<PortModel> port);
- void remove_port(CountedPtr<PortModel> port);
-
+
+ void add_port(CountedPtr<PortModel> port, bool resize=true);
+ void remove_port(CountedPtr<PortModel> port) { Module::remove_port(port->path().name()); }
+
CountedPtr<NodeModel> m_node;
NodeMenu m_menu;
};
diff --git a/src/progs/ingenuity/PatchCanvas.cpp b/src/progs/ingenuity/PatchCanvas.cpp
index 707b8856..6d8403eb 100644
--- a/src/progs/ingenuity/PatchCanvas.cpp
+++ b/src/progs/ingenuity/PatchCanvas.cpp
@@ -54,8 +54,6 @@ PatchCanvas::PatchCanvas(CountedPtr<PatchModel> patch, int width, int height)
xml->get_widget("canvas_menu_load_patch", m_menu_load_patch);
xml->get_widget("canvas_menu_new_patch", m_menu_new_patch);
- build_canvas();
-
// Add port menu items
m_menu_add_audio_input->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
@@ -92,7 +90,10 @@ PatchCanvas::PatchCanvas(CountedPtr<PatchModel> patch, int width, int height)
void
-PatchCanvas::build_canvas() {
+PatchCanvas::build()
+{
+ boost::shared_ptr<PatchCanvas> shared_this =
+ boost::dynamic_pointer_cast<PatchCanvas>(shared_from_this());
// Create modules for nodes
for (NodeModelMap::const_iterator i = m_patch->nodes().begin();
@@ -103,7 +104,7 @@ PatchCanvas::build_canvas() {
// Create pseudo modules for ports (ports on this canvas, not on our module)
for (PortModelList::const_iterator i = m_patch->ports().begin();
i != m_patch->ports().end(); ++i) {
- manage(new PatchPortModule(this, *i));
+ add_module(PatchPortModule::create(shared_this, *i));
}
// Create connections
@@ -117,26 +118,31 @@ PatchCanvas::build_canvas() {
void
PatchCanvas::add_node(CountedPtr<NodeModel> nm)
{
+ boost::shared_ptr<PatchCanvas> shared_this =
+ boost::dynamic_pointer_cast<PatchCanvas>(shared_from_this());
+
CountedPtr<PatchModel> pm = PtrCast<PatchModel>(nm);
if (pm)
- manage(new SubpatchModule(this, pm));
+ add_module(SubpatchModule::create(shared_this, pm));
else
- manage(new NodeModule(this, nm));
+ add_module(NodeModule::create(shared_this, nm));
}
void
PatchCanvas::remove_node(CountedPtr<NodeModel> nm)
{
- LibFlowCanvas::Module* module = get_module(nm->path().name());
- delete module;
+ remove_module(nm->path().name()); // should cut all references
}
void
PatchCanvas::add_port(CountedPtr<PortModel> pm)
{
- manage(new PatchPortModule(this, pm));
+ boost::shared_ptr<PatchCanvas> shared_this =
+ boost::dynamic_pointer_cast<PatchCanvas>(shared_from_this());
+
+ add_module(PatchPortModule::create(shared_this, pm));
}
@@ -161,11 +167,13 @@ PatchCanvas::connection(CountedPtr<ConnectionModel> cm)
const string& dst_parent_name =
(dst_parent_path == m_patch->path()) ? "" : dst_parent_path.name();
- LibFlowCanvas::Port* src_port = get_port(src_parent_name, cm->src_port_path().name());
- LibFlowCanvas::Port* dst_port = get_port(dst_parent_name, cm->dst_port_path().name());
- assert(src_port && dst_port);
-
- add_connection(src_port, dst_port);
+ boost::shared_ptr<LibFlowCanvas::Port> src = get_port(src_parent_name, cm->src_port_path().name());
+ boost::shared_ptr<LibFlowCanvas::Port> dst = get_port(dst_parent_name, cm->dst_port_path().name());
+
+ if (src && dst)
+ add_connection(src, dst);
+ else
+ cerr << "[Canvas] ERROR: Unable to find ports to create connection." << endl;
}
@@ -177,8 +185,8 @@ PatchCanvas::disconnection(const Path& src_port_path, const Path& dst_port_path)
const string& dst_node_name = dst_port_path.parent().name();
const string& dst_port_name = dst_port_path.name();
- LibFlowCanvas::Port* src_port = get_port(src_node_name, src_port_name);
- LibFlowCanvas::Port* dst_port = get_port(dst_node_name, dst_port_name);
+ boost::shared_ptr<LibFlowCanvas::Port> src_port = get_port(src_node_name, src_port_name);
+ boost::shared_ptr<LibFlowCanvas::Port> dst_port = get_port(dst_node_name, dst_port_name);
if (src_port && dst_port) {
remove_connection(src_port, dst_port);
@@ -199,14 +207,16 @@ PatchCanvas::disconnection(const Path& src_port_path, const Path& dst_port_path)
void
-PatchCanvas::connect(const LibFlowCanvas::Port* src_port, const LibFlowCanvas::Port* dst_port)
+PatchCanvas::connect(boost::shared_ptr<LibFlowCanvas::Port> src_port, boost::shared_ptr<LibFlowCanvas::Port> dst_port)
{
- assert(src_port != NULL);
- assert(dst_port != NULL);
+ const boost::shared_ptr<Ingenuity::Port> src
+ = boost::dynamic_pointer_cast<Ingenuity::Port>(src_port);
+
+ const boost::shared_ptr<Ingenuity::Port> dst
+ = boost::dynamic_pointer_cast<Ingenuity::Port>(dst_port);
- const Ingenuity::Port* const src = dynamic_cast<const Ingenuity::Port* const>(src_port);
- const Ingenuity::Port* const dst = dynamic_cast<const Ingenuity::Port* const>(dst_port);
- assert(src && dst);
+ if (!src || !dst)
+ return;
// Midi binding/learn shortcut
if (src->model()->type() == PortModel::MIDI &&
@@ -240,13 +250,16 @@ PatchCanvas::connect(const LibFlowCanvas::Port* src_port, const LibFlowCanvas::P
void
-PatchCanvas::disconnect(const LibFlowCanvas::Port* src_port, const LibFlowCanvas::Port* dst_port)
+PatchCanvas::disconnect(boost::shared_ptr<LibFlowCanvas::Port> src_port, boost::shared_ptr<LibFlowCanvas::Port> dst_port)
{
- assert(src_port != NULL);
- assert(dst_port != NULL);
+ const boost::shared_ptr<Ingenuity::Port> src
+ = boost::dynamic_pointer_cast<Ingenuity::Port>(src_port);
+
+ const boost::shared_ptr<Ingenuity::Port> dst
+ = boost::dynamic_pointer_cast<Ingenuity::Port>(dst_port);
- App::instance().engine()->disconnect(((Ingenuity::Port*)src_port)->model()->path(),
- ((Ingenuity::Port*)dst_port)->model()->path());
+ App::instance().engine()->disconnect(src->model()->path(),
+ dst->model()->path());
}
@@ -282,8 +295,11 @@ PatchCanvas::canvas_event(GdkEvent* event)
void
PatchCanvas::destroy_selected()
{
- for (list<Module*>::iterator m = m_selected_modules.begin(); m != m_selected_modules.end(); ++m)
- App::instance().engine()->destroy(((NodeModule*)(*m))->node()->path());
+ for (list<boost::shared_ptr<Module> >::iterator m = m_selected_modules.begin(); m != m_selected_modules.end(); ++m) {
+ boost::shared_ptr<NodeModule> module = boost::dynamic_pointer_cast<NodeModule>(*m);
+ App::instance().engine()->destroy(module->node()->path());
+ }
+
}
diff --git a/src/progs/ingenuity/PatchCanvas.h b/src/progs/ingenuity/PatchCanvas.h
index c6abeeb0..15312367 100644
--- a/src/progs/ingenuity/PatchCanvas.h
+++ b/src/progs/ingenuity/PatchCanvas.h
@@ -18,11 +18,14 @@
#define OMPATCHBAYAREA_H
#include <string>
+#include <boost/shared_ptr.hpp>
#include <flowcanvas/FlowCanvas.h>
+#include <flowcanvas/Module.h>
#include "util/CountedPtr.h"
#include "util/Path.h"
#include "ConnectionModel.h"
#include "PatchModel.h"
+#include "NodeModule.h"
using std::string;
using namespace LibFlowCanvas;
@@ -48,8 +51,14 @@ class PatchCanvas : public LibFlowCanvas::FlowCanvas
public:
PatchCanvas(CountedPtr<PatchModel> patch, int width, int height);
- NodeModule* find_module(const string& name)
- { return (NodeModule*)FlowCanvas::get_module(name); }
+ virtual ~PatchCanvas() {}
+
+ boost::shared_ptr<NodeModule> find_module(const string& name) {
+ return boost::dynamic_pointer_cast<NodeModule>(
+ FlowCanvas::get_module(name));
+ }
+
+ void build();
void add_node(CountedPtr<NodeModel> nm);
void remove_node(CountedPtr<NodeModel> nm);
@@ -74,12 +83,13 @@ private:
MetadataMap get_initial_data();
- void build_canvas();
-
bool canvas_event(GdkEvent* event);
- void connect(const LibFlowCanvas::Port* src_port, const LibFlowCanvas::Port* dst_port);
- void disconnect(const LibFlowCanvas::Port* src_port, const LibFlowCanvas::Port* dst_port);
+ void connect(boost::shared_ptr<LibFlowCanvas::Port> src,
+ boost::shared_ptr<LibFlowCanvas::Port> dst);
+
+ void disconnect(boost::shared_ptr<LibFlowCanvas::Port> src,
+ boost::shared_ptr<LibFlowCanvas::Port> dst);
CountedPtr<PatchModel> m_patch;
diff --git a/src/progs/ingenuity/PatchPortModule.cpp b/src/progs/ingenuity/PatchPortModule.cpp
index 8843882b..2804a6a6 100644
--- a/src/progs/ingenuity/PatchPortModule.cpp
+++ b/src/progs/ingenuity/PatchPortModule.cpp
@@ -29,10 +29,9 @@
namespace Ingenuity {
-PatchPortModule::PatchPortModule(PatchCanvas* canvas, CountedPtr<PortModel> port)
+PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<PortModel> port)
: LibFlowCanvas::Module(canvas, "", 0, 0), // FIXME: coords?
- m_port(port),
- m_patch_port(NULL)
+ m_port(port)
{
/*if (port_model()->polyphonic() && port_model()->parent() != NULL
&& port_model()->parent_patch()->poly() > 1) {
@@ -42,12 +41,9 @@ PatchPortModule::PatchPortModule(PatchCanvas* canvas, CountedPtr<PortModel> port
assert(canvas);
assert(port);
- if (PtrCast<PatchModel>(port->parent())) {
- if (m_patch_port)
- delete m_patch_port;
-
- m_patch_port = new Port(this, port, true);
- }
+ //if (PtrCast<PatchModel>(port->parent())) {
+ // m_patch_port = boost::shared_ptr<Port>(new Port(shared_from_this(), port, true));
+ //}
resize();
@@ -67,6 +63,21 @@ PatchPortModule::PatchPortModule(PatchCanvas* canvas, CountedPtr<PortModel> port
}
+boost::shared_ptr<PatchPortModule>
+PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<PortModel> port)
+{
+ boost::shared_ptr<PatchPortModule> ret = boost::shared_ptr<PatchPortModule>(
+ new PatchPortModule(canvas, port));
+
+ for (MetadataMap::const_iterator m = port->metadata().begin(); m != port->metadata().end(); ++m)
+ ret->metadata_update(m->first, m->second);
+
+ ret->resize();
+
+ return ret;
+}
+
+
void
PatchPortModule::store_location()
{
diff --git a/src/progs/ingenuity/PatchPortModule.h b/src/progs/ingenuity/PatchPortModule.h
index 98bc1b1d..3cf55192 100644
--- a/src/progs/ingenuity/PatchPortModule.h
+++ b/src/progs/ingenuity/PatchPortModule.h
@@ -18,6 +18,7 @@
#define OMPORTMODULE_H
#include <string>
+#include <boost/enable_shared_from_this.hpp>
#include <libgnomecanvasmm.h>
#include <flowcanvas/Module.h>
#include "util/Atom.h"
@@ -43,10 +44,12 @@ class Port;
*
* \ingroup Ingenuity
*/
-class PatchPortModule : public LibFlowCanvas::Module
+class PatchPortModule : public LibFlowCanvas::Module//, public boost::enable_shared_from_this<LibFlowCanvas::Module>
{
public:
- PatchPortModule(PatchCanvas* canvas, CountedPtr<PortModel> port);
+ static boost::shared_ptr<PatchPortModule> create (boost::shared_ptr<PatchCanvas> canvas,
+ CountedPtr<PortModel> port);
+
virtual ~PatchPortModule() {}
virtual void store_location();
@@ -56,13 +59,15 @@ public:
CountedPtr<PortModel> port() const { return m_port; }
protected:
+ PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<PortModel> port);
+
//virtual void on_double_click(GdkEventButton* ev) { show_control_window(); }
//virtual void on_middle_click(GdkEventButton* ev) { show_control_window(); }
void metadata_update(const string& key, const Atom& value);
- CountedPtr<PortModel> m_port;
- Port* m_patch_port; ///< Port on this 'anonymous' module
+ CountedPtr<PortModel> m_port;
+ boost::shared_ptr<Port> m_patch_port; ///< Port on this 'anonymous' module
};
diff --git a/src/progs/ingenuity/PatchView.cpp b/src/progs/ingenuity/PatchView.cpp
index fbebd886..69dcf0b8 100644
--- a/src/progs/ingenuity/PatchView.cpp
+++ b/src/progs/ingenuity/PatchView.cpp
@@ -35,7 +35,6 @@ namespace Ingenuity {
PatchView::PatchView(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml)
: Gtk::Box(cobject),
- _canvas(NULL),
_breadcrumb_container(NULL),
_enable_signal(true)
{
@@ -57,12 +56,15 @@ PatchView::PatchView(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::X
void
PatchView::set_patch(CountedPtr<PatchModel> patch)
{
+ assert(!_canvas); // FIXME: remove
+
cerr << "Creating view for " << patch->path() << endl;
assert(_breadcrumb_container); // ensure created
_patch = patch;
- _canvas = new PatchCanvas(patch, 1600*2, 1200*2);
+ _canvas = CountedPtr<PatchCanvas>(new PatchCanvas(patch, 1600*2, 1200*2));
+ _canvas->build();
_canvas_scrolledwindow->add(*_canvas);
@@ -80,10 +82,10 @@ PatchView::set_patch(CountedPtr<PatchModel> patch)
_refresh_but->signal_clicked().connect(sigc::mem_fun(this, &PatchView::refresh_clicked));
_zoom_normal_but->signal_clicked().connect(sigc::bind(sigc::mem_fun(
- static_cast<FlowCanvas*>(_canvas), &FlowCanvas::set_zoom), 1.0));
+ _canvas.get(), &FlowCanvas::set_zoom), 1.0));
_zoom_full_but->signal_clicked().connect(
- sigc::mem_fun(static_cast<FlowCanvas*>(_canvas), &FlowCanvas::zoom_full));
+ sigc::mem_fun(_canvas.get(), &FlowCanvas::zoom_full));
}
diff --git a/src/progs/ingenuity/PatchView.h b/src/progs/ingenuity/PatchView.h
index a0225bda..0a445baa 100644
--- a/src/progs/ingenuity/PatchView.h
+++ b/src/progs/ingenuity/PatchView.h
@@ -57,9 +57,9 @@ public:
PatchView(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml);
~PatchView();
- PatchCanvas* canvas() const { return _canvas; }
- CountedPtr<PatchModel> patch() const { return _patch; }
- Gtk::Viewport* breadcrumb_container() const { return _breadcrumb_container; }
+ CountedPtr<PatchCanvas> canvas() const { return _canvas; }
+ CountedPtr<PatchModel> patch() const { return _patch; }
+ Gtk::Viewport* breadcrumb_container() const { return _breadcrumb_container; }
static CountedPtr<PatchView> create(CountedPtr<PatchModel> patch);
@@ -75,8 +75,8 @@ private:
void zoom_full();
- CountedPtr<PatchModel> _patch;
- PatchCanvas* _canvas;
+ CountedPtr<PatchModel> _patch;
+ CountedPtr<PatchCanvas> _canvas;
Gtk::ScrolledWindow* _canvas_scrolledwindow;
diff --git a/src/progs/ingenuity/Port.cpp b/src/progs/ingenuity/Port.cpp
index 863e8a1a..560be981 100644
--- a/src/progs/ingenuity/Port.cpp
+++ b/src/progs/ingenuity/Port.cpp
@@ -31,7 +31,7 @@ namespace Ingenuity {
/** @param flip Make an input port appear as an output port, and vice versa.
*/
-Port::Port(LibFlowCanvas::Module* module, CountedPtr<PortModel> pm, bool flip)
+Port::Port(boost::shared_ptr<LibFlowCanvas::Module> module, CountedPtr<PortModel> pm, bool flip)
: LibFlowCanvas::Port(module,
pm->path().name(),
flip ? (!pm->is_input()) : pm->is_input(),
diff --git a/src/progs/ingenuity/Port.h b/src/progs/ingenuity/Port.h
index c2344aef..84e50e7d 100644
--- a/src/progs/ingenuity/Port.h
+++ b/src/progs/ingenuity/Port.h
@@ -35,7 +35,7 @@ namespace Ingenuity {
class Port : public LibFlowCanvas::Port
{
public:
- Port(LibFlowCanvas::Module* module, CountedPtr<PortModel> pm, bool flip = false);
+ Port(boost::shared_ptr<LibFlowCanvas::Module> module, CountedPtr<PortModel> pm, bool flip = false);
virtual ~Port() {}
diff --git a/src/progs/ingenuity/SubpatchModule.cpp b/src/progs/ingenuity/SubpatchModule.cpp
index 585ccee3..566248f9 100644
--- a/src/progs/ingenuity/SubpatchModule.cpp
+++ b/src/progs/ingenuity/SubpatchModule.cpp
@@ -31,7 +31,7 @@ using std::cerr; using std::cout; using std::endl;
namespace Ingenuity {
-SubpatchModule::SubpatchModule(PatchCanvas* canvas, CountedPtr<PatchModel> patch)
+SubpatchModule::SubpatchModule(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<PatchModel> patch)
: NodeModule(canvas, patch),
m_patch(patch)
{
diff --git a/src/progs/ingenuity/SubpatchModule.h b/src/progs/ingenuity/SubpatchModule.h
index 571ae0fd..6d5d3e35 100644
--- a/src/progs/ingenuity/SubpatchModule.h
+++ b/src/progs/ingenuity/SubpatchModule.h
@@ -47,7 +47,7 @@ class NodeControlWindow;
class SubpatchModule : public NodeModule
{
public:
- SubpatchModule(PatchCanvas* canvas, CountedPtr<PatchModel> controller);
+ SubpatchModule(boost::shared_ptr<PatchCanvas> canvas, CountedPtr<PatchModel> controller);
virtual ~SubpatchModule() {}
void on_double_click(GdkEventButton* ev);