diff options
-rw-r--r-- | include/ingen/Resource.hpp | 3 | ||||
-rw-r--r-- | include/ingen/client/ObjectModel.hpp | 3 | ||||
-rw-r--r-- | include/ingen/client/PortModel.hpp | 4 | ||||
-rw-r--r-- | src/client/ObjectModel.cpp | 5 | ||||
-rw-r--r-- | src/client/PortModel.cpp | 5 | ||||
-rw-r--r-- | src/gui/PatchWindow.cpp | 4 | ||||
-rw-r--r-- | src/shared/ResourceImpl.cpp | 16 | ||||
-rw-r--r-- | src/shared/ResourceImpl.hpp | 3 |
8 files changed, 31 insertions, 12 deletions
diff --git a/include/ingen/Resource.hpp b/include/ingen/Resource.hpp index 6404213c..605aa97d 100644 --- a/include/ingen/Resource.hpp +++ b/include/ingen/Resource.hpp @@ -117,7 +117,8 @@ public: virtual Properties& properties() = 0; virtual const Raul::Atom& get_property(const Raul::URI& uri) const = 0; virtual Raul::Atom& set_property(const Raul::URI& uri, - const Raul::Atom& value) = 0; + const Raul::Atom& value, + Graph ctx=DEFAULT) = 0; virtual void add_property(const Raul::URI& uri, const Raul::Atom& value) = 0; virtual bool has_property(const Raul::URI& uri, diff --git a/include/ingen/client/ObjectModel.hpp b/include/ingen/client/ObjectModel.hpp index 7a975637..d3959f4f 100644 --- a/include/ingen/client/ObjectModel.hpp +++ b/include/ingen/client/ObjectModel.hpp @@ -57,7 +57,8 @@ public: const Raul::Atom& get_property(const Raul::URI& key) const; - Raul::Atom& set_property(const Raul::URI& key, const Raul::Atom& value); + Raul::Atom& set_property(const Raul::URI& key, const Raul::Atom& value, + Resource::Graph ctx); void add_property(const Raul::URI& key, const Raul::Atom& value); const Raul::Path& path() const { return _path; } diff --git a/include/ingen/client/PortModel.hpp b/include/ingen/client/PortModel.hpp index f3e8f319..0786e7fc 100644 --- a/include/ingen/client/PortModel.hpp +++ b/include/ingen/client/PortModel.hpp @@ -63,7 +63,9 @@ public: inline bool operator==(const PortModel& pm) const { return (path() == pm.path()); } - Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value); + Raul::Atom& set_property(const Raul::URI& uri, + const Raul::Atom& value, + Resource::Graph ctx); inline void value(const Raul::Atom& val) { if (val != _current_val) { diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp index 03b21247..a0235bb6 100644 --- a/src/client/ObjectModel.cpp +++ b/src/client/ObjectModel.cpp @@ -48,9 +48,10 @@ ObjectModel::~ObjectModel() } Raul::Atom& -ObjectModel::set_property(const Raul::URI& key, const Raul::Atom& value) +ObjectModel::set_property(const Raul::URI& key, const Raul::Atom& value, + Resource::Graph ctx) { - Raul::Atom& my_value = ResourceImpl::set_property(key, value); + Raul::Atom& my_value = ResourceImpl::set_property(key, value, ctx); _signal_property.emit(key, my_value); return my_value; } diff --git a/src/client/PortModel.cpp b/src/client/PortModel.cpp index be6d74a5..fe85e108 100644 --- a/src/client/PortModel.cpp +++ b/src/client/PortModel.cpp @@ -24,9 +24,10 @@ namespace Client { Raul::Atom& PortModel::set_property(const Raul::URI& uri, - const Raul::Atom& value) + const Raul::Atom& value, + Resource::Graph ctx) { - Raul::Atom& ret = ObjectModel::set_property(uri, value); + Raul::Atom& ret = ObjectModel::set_property(uri, value, ctx); if (uri == _uris.ingen_value) this->value(value); return ret; diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index 5c045612..1d20c732 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -350,6 +350,7 @@ PatchWindow::object_entered(const ObjectModel* model) void PatchWindow::object_left(const ObjectModel* model) { + _status_bar->pop(STATUS_CONTEXT_PATCH); _status_bar->pop(STATUS_CONTEXT_HOVER); } @@ -497,7 +498,8 @@ more files and/or directories, recursively. Existing files will be overwritten. if (confirm) { const Glib::ustring uri = Glib::filename_to_uri(filename); App::instance().loader()->save_patch(_patch, uri); - //_patch->set_property(uris.ingen_document, Atom(Atom::URI, uri.c_str())); + const_cast<PatchModel*>(_patch.get())->set_property( + uris.ingen_document, Atom(Atom::URI, uri.c_str()), Resource::EXTERNAL); _status_bar->push( (boost::format("Saved %1% to %2%") % _patch->path().chop_scheme() % filename).str(), diff --git a/src/shared/ResourceImpl.cpp b/src/shared/ResourceImpl.cpp index d315b8f0..14227ccf 100644 --- a/src/shared/ResourceImpl.cpp +++ b/src/shared/ResourceImpl.cpp @@ -40,10 +40,20 @@ ResourceImpl::add_property(const Raul::URI& uri, const Raul::Atom& value) } Raul::Atom& -ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value) +ResourceImpl::set_property(const Raul::URI& uri, const Raul::Atom& value, + Resource::Graph ctx) { - _properties.erase(uri); - return _properties.insert(make_pair(uri, value))->second; + // Erase existing property in this context + for (Properties::iterator i = _properties.find(uri); + (i != _properties.end()) && (i->first == uri); + ++i) { + if (i->second.context() == ctx && i->second == value) { + _properties.erase(i); + } + } + + // Insert new property + return _properties.insert(make_pair(uri, Property(value, ctx)))->second; } void diff --git a/src/shared/ResourceImpl.hpp b/src/shared/ResourceImpl.hpp index 47d6f31d..6afc567d 100644 --- a/src/shared/ResourceImpl.hpp +++ b/src/shared/ResourceImpl.hpp @@ -46,7 +46,8 @@ public: Properties properties(Resource::Graph ctx) const; const Raul::Atom& get_property(const Raul::URI& uri) const; - Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value); + Raul::Atom& set_property(const Raul::URI& uri, const Raul::Atom& value, + Resource::Graph ctx=Resource::DEFAULT); void remove_property(const Raul::URI& uri, const Raul::Atom& value); bool has_property(const Raul::URI& uri, const Raul::Atom& value) const; void add_property(const Raul::URI& uri, const Raul::Atom& value); |