diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/BlockModel.cpp | 31 | ||||
-rw-r--r-- | src/client/ClientStore.cpp | 9 |
2 files changed, 34 insertions, 6 deletions
diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp index e3f7d22f..95092701 100644 --- a/src/client/BlockModel.cpp +++ b/src/client/BlockModel.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard <http://drobilla.net/> + Copyright 2007-2016 David Robillard <http://drobilla.net/> Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -18,9 +18,10 @@ #include <cmath> #include <string> -#include "ingen/client/BlockModel.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/client/BlockModel.hpp" +#include "ingen/client/ParameterModel.hpp" namespace Ingen { namespace Client { @@ -106,8 +107,16 @@ BlockModel::add_child(SPtr<ObjectModel> c) //ObjectModel::add_child(c); SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(c); - assert(pm); - add_port(pm); + if (pm) { + add_port(pm); + return; + } + + SPtr<ParameterModel> am = dynamic_ptr_cast<ParameterModel>(c); + if (am) { + add_parameter(am); + return; + } } bool @@ -140,6 +149,20 @@ BlockModel::add_port(SPtr<PortModel> pm) _signal_new_port.emit(pm); } +void +BlockModel::add_parameter(SPtr<ParameterModel> pm) +{ + assert(pm); + assert(pm->path().is_child_of(path())); + assert(pm->parent().get() == this); + + // Store should have handled this by merging the two + assert(find(_parameters.begin(), _parameters.end(), pm) == _parameters.end()); + + _parameters.push_back(pm); + _signal_new_parameter.emit(pm); +} + SPtr<const PortModel> BlockModel::get_port(const Raul::Symbol& symbol) const { diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index e99f9c73..3755772c 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -20,6 +20,7 @@ #include "ingen/client/ClientStore.hpp" #include "ingen/client/GraphModel.hpp" #include "ingen/client/ObjectModel.hpp" +#include "ingen/client/ParameterModel.hpp" #include "ingen/client/PluginModel.hpp" #include "ingen/client/PortModel.hpp" #include "ingen/client/SigClientInterface.hpp" @@ -243,9 +244,9 @@ ClientStore::put(const Raul::URI& uri, { typedef Resource::Properties::const_iterator Iterator; - bool is_graph, is_block, is_port, is_output; + bool is_graph, is_block, is_port, is_parameter, is_output; Resource::type(uris(), properties, - is_graph, is_block, is_port, is_output); + is_graph, is_block, is_port, is_parameter, is_output); // Check for specially handled types const Iterator t = properties.find(_uris.rdf_type); @@ -337,6 +338,10 @@ ClientStore::put(const Raul::URI& uri, SPtr<PortModel> p(new PortModel(uris(), path, index, pdir)); p->set_properties(properties); add_object(p); + } else if (is_parameter) { + SPtr<ObjectModel> p(new ParameterModel(uris(), path)); + p->set_properties(properties); + add_object(p); } else { _log.warn(fmt("Ignoring %1% of unknown type\n") % path.c_str()); } |