diff options
Diffstat (limited to 'src')
-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 |
5 files changed, 24 insertions, 9 deletions
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); |