diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/client/OSCClientReceiver.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/GraphObjectImpl.hpp | 3 | ||||
-rw-r--r-- | src/libs/engine/OSCEngineReceiver.cpp | 2 | ||||
-rw-r--r-- | src/libs/engine/ObjectSender.cpp | 12 | ||||
-rw-r--r-- | src/libs/engine/QueuedEngineInterface.cpp | 4 | ||||
-rw-r--r-- | src/libs/engine/events/SetMetadataEvent.cpp | 30 | ||||
-rw-r--r-- | src/libs/engine/events/SetMetadataEvent.hpp | 8 | ||||
-rw-r--r-- | src/libs/gui/NodeModule.cpp | 20 | ||||
-rw-r--r-- | src/libs/gui/NodeModule.hpp | 1 | ||||
-rw-r--r-- | src/libs/serialisation/Parser.cpp | 3 | ||||
-rw-r--r-- | src/libs/serialisation/Parser.hpp | 2 |
11 files changed, 68 insertions, 19 deletions
diff --git a/src/libs/client/OSCClientReceiver.cpp b/src/libs/client/OSCClientReceiver.cpp index 5f12cd6e..53314676 100644 --- a/src/libs/client/OSCClientReceiver.cpp +++ b/src/libs/client/OSCClientReceiver.cpp @@ -34,7 +34,7 @@ OSCClientReceiver::OSCClientReceiver(int listen_port) : _listen_port(listen_port) , _st(NULL) { - start(false); // true = dump, false = shutup + start(true); // true = dump, false = shutup } diff --git a/src/libs/engine/GraphObjectImpl.hpp b/src/libs/engine/GraphObjectImpl.hpp index bee10c98..9b1f675d 100644 --- a/src/libs/engine/GraphObjectImpl.hpp +++ b/src/libs/engine/GraphObjectImpl.hpp @@ -72,6 +72,9 @@ public: void set_variable(const std::string& key, const Atom& value) { _variables[key] = value; } + + void set_property(const std::string& key, const Atom& value) + { _properties[key] = value; } const Atom& get_variable(const std::string& key) { static Atom null_atom; diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp index b9e2a70d..1078a86a 100644 --- a/src/libs/engine/OSCEngineReceiver.cpp +++ b/src/libs/engine/OSCEngineReceiver.cpp @@ -70,7 +70,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t } // For debugging, print all incoming OSC messages - //lo_server_add_method(_server, NULL, NULL, generic_cb, NULL); + lo_server_add_method(_server, NULL, NULL, generic_cb, NULL); // Set response address for this message. // It's important this is first and returns nonzero. diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 3a716a28..bcab46a8 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -97,11 +97,16 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu client->new_node(node->path(), node->plugin()->uri()); client->set_property(node->path(), "ingen:polyphonic", node->polyphonic()); - // Send variable + // Send variables const GraphObjectImpl::Variables& data = node->variables(); for (GraphObjectImpl::Variables::const_iterator j = data.begin(); j != data.end(); ++j) client->set_variable(node->path(), (*j).first, (*j).second); + // Send properties + const GraphObjectImpl::Properties& prop = node->properties(); + for (GraphObjectImpl::Properties::const_iterator j = prop.begin(); j != prop.end(); ++j) + client->set_property(node->path(), (*j).first, (*j).second); + client->bundle_end(); if (recursive) { @@ -127,6 +132,11 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port) for (GraphObjectImpl::Variables::const_iterator j = data.begin(); j != data.end(); ++j) client->set_variable(port->path(), (*j).first, (*j).second); + // Send properties + const GraphObjectImpl::Properties& prop = port->properties(); + for (GraphObjectImpl::Properties::const_iterator j = prop.begin(); j != prop.end(); ++j) + client->set_property(port->path(), (*j).first, (*j).second); + // Send control value if (port->type() == DataType::CONTROL) { const Sample value = dynamic_cast<const AudioBuffer*>(port->buffer(0))->value_at(0); diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp index 3e45734a..b07d3a02 100644 --- a/src/libs/engine/QueuedEngineInterface.cpp +++ b/src/libs/engine/QueuedEngineInterface.cpp @@ -304,7 +304,7 @@ QueuedEngineInterface::set_variable(const string& path, const string& predicate, const Atom& value) { - push_queued(new SetMetadataEvent(_engine, _responder, now(), path, predicate, value)); + push_queued(new SetMetadataEvent(_engine, _responder, now(), false, path, predicate, value)); } @@ -329,6 +329,8 @@ QueuedEngineInterface::set_property(const string& path, push_queued(new SetPolyphonyEvent(_engine, _responder, now(), this, path, value.get_int32())); return; } + } else { + push_queued(new SetMetadataEvent(_engine, _responder, now(), true, path, predicate, value)); } cerr << "WARNING: Unknown property (or bad type) \"" << predicate << "\"" << endl; diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp index 3e41a510..b4ee00ff 100644 --- a/src/libs/engine/events/SetMetadataEvent.cpp +++ b/src/libs/engine/events/SetMetadataEvent.cpp @@ -28,12 +28,20 @@ using std::string; namespace Ingen { -SetMetadataEvent::SetMetadataEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& path, const string& key, const Atom& value) -: QueuedEvent(engine, responder, timestamp), - _path(path), - _key(key), - _value(value), - _object(NULL) +SetMetadataEvent::SetMetadataEvent( + Engine& engine, + SharedPtr<Responder> responder, + SampleCount timestamp, + bool property, + const string& path, + const string& key, + const Atom& value) + : QueuedEvent(engine, responder, timestamp) + , _property(property) + , _path(path) + , _key(key) + , _value(value) + , _object(NULL) { } @@ -47,7 +55,10 @@ SetMetadataEvent::pre_process() return; } - _object->set_variable(_key, _value); + if (_property) + _object->set_property(_key, _value); + else + _object->set_variable(_key, _value); QueuedEvent::pre_process(); } @@ -70,7 +81,10 @@ SetMetadataEvent::post_process() _responder->respond_error(msg); } else { _responder->respond_ok(); - _engine.broadcaster()->send_variable_change(_path, _key, _value); + if (_property) + _engine.broadcaster()->send_property_change(_path, _key, _value); + else + _engine.broadcaster()->send_variable_change(_path, _key, _value); } } diff --git a/src/libs/engine/events/SetMetadataEvent.hpp b/src/libs/engine/events/SetMetadataEvent.hpp index 457d3052..9707ce56 100644 --- a/src/libs/engine/events/SetMetadataEvent.hpp +++ b/src/libs/engine/events/SetMetadataEvent.hpp @@ -39,6 +39,7 @@ public: SetMetadataEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, + bool property, const string& path, const string& key, const Raul::Atom& value); @@ -48,9 +49,10 @@ public: void post_process(); private: - string _path; - string _key; - Raul::Atom _value; + bool _property; + string _path; + string _key; + Raul::Atom _value; GraphObjectImpl* _object; }; diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp index 7ac86e40..c38a898b 100644 --- a/src/libs/gui/NodeModule.cpp +++ b/src/libs/gui/NodeModule.cpp @@ -315,8 +315,26 @@ NodeModule::set_variable(const string& key, const Atom& value) void NodeModule::set_property(const string& key, const Atom& value) { - if (key == "ingen:polyphonic" && value.type() == Atom::BOOL) + if (key == "ingen:polyphonic" && value.type() == Atom::BOOL) { set_stacked_border(value.get_bool()); + } else if (key == "ingen:selected" && value.type() == Atom::BOOL) { + if (value.get_bool() != selected()) { + if (value.get_bool()) + _canvas.lock()->select_item(shared_from_this()); + else + _canvas.lock()->unselect_item(shared_from_this()); + } + } +} + + +void +NodeModule::set_selected(bool b) +{ + if (b != selected()) { + Module::set_selected(b); + App::instance().engine()->set_property(_node->path(), "ingen:selected", b); + } } diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp index 3bf2d3eb..2b592446 100644 --- a/src/libs/gui/NodeModule.hpp +++ b/src/libs/gui/NodeModule.hpp @@ -70,6 +70,7 @@ protected: void embed_gui(bool embed); bool popup_gui(); void on_gui_window_close(); + void set_selected(bool b); void rename(); void set_variable(const std::string& key, const Atom& value); diff --git a/src/libs/serialisation/Parser.cpp b/src/libs/serialisation/Parser.cpp index dfa8f622..36086ea1 100644 --- a/src/libs/serialisation/Parser.cpp +++ b/src/libs/serialisation/Parser.cpp @@ -134,7 +134,6 @@ Parser::parse( for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { const Redland::Node subject = (object_uri ? subject_uri : (*i)["subject"]); - cout << "SUBJECT FROM RDF: " << subject.to_string() << endl; const Redland::Node rdf_class = (*i)["class"]; cout << subject.to_c_string() << " :: " << rdf_class.to_c_string() << endl; if (rdf_class == patch_class || rdf_class == node_class || rdf_class == port_class) { @@ -420,7 +419,7 @@ Parser::parse_node( Ingen::Shared::CommonInterface* target, Redland::Model& model, const Glib::ustring& base_uri, - Glib::ustring subject, + const Glib::ustring& subject, Raul::Path path, boost::optional<GraphObject::Variables> data=boost::optional<GraphObject::Variables>()) { diff --git a/src/libs/serialisation/Parser.hpp b/src/libs/serialisation/Parser.hpp index 45891084..948a6248 100644 --- a/src/libs/serialisation/Parser.hpp +++ b/src/libs/serialisation/Parser.hpp @@ -95,7 +95,7 @@ private: Ingen::Shared::CommonInterface* target, Redland::Model& model, const Glib::ustring& base_uri, - Glib::ustring subject, + const Glib::ustring& subject, Raul::Path path, boost::optional<GraphObject::Variables> data); |