diff options
author | David Robillard <d@drobilla.net> | 2012-04-28 04:58:37 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-04-28 04:58:37 +0000 |
commit | 50f5747f3877d124014ce6eaba307a6bffddc1c2 (patch) | |
tree | f73fcd06503a38504f3d700653111f836e5a1f63 /src/client | |
parent | d87914716181bd86a3a68b22d3d0a12902860be0 (diff) | |
download | ingen-50f5747f3877d124014ce6eaba307a6bffddc1c2.tar.gz ingen-50f5747f3877d124014ce6eaba307a6bffddc1c2.tar.bz2 ingen-50f5747f3877d124014ce6eaba307a6bffddc1c2.zip |
Tidy.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4300 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/ClientStore.cpp | 45 | ||||
-rw-r--r-- | src/client/NodeModel.cpp | 27 | ||||
-rw-r--r-- | src/client/PatchModel.cpp | 6 | ||||
-rw-r--r-- | src/client/PluginModel.cpp | 28 | ||||
-rw-r--r-- | src/client/PluginUI.cpp | 15 |
5 files changed, 73 insertions, 48 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index d56c781d..7f2a534f 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -226,7 +226,8 @@ ClientStore::del(const URI& uri) const Raul::Path path(uri.str()); SharedPtr<ObjectModel> removed = remove_object(path); removed.reset(); - LOG(debug) << "Removed object " << path << ", count: " << removed.use_count(); + LOG(debug) << "Removed object " << path + << ", count: " << removed.use_count(); } void @@ -237,7 +238,8 @@ ClientStore::move(const Path& old_path_str, const Path& new_path_str) iterator parent = find(old_path); if (parent == end()) { - LOG(Raul::error) << "Failed to find object " << old_path << " to move." << endl; + LOG(Raul::error) << "Failed to find object " << old_path + << " to move." << endl; return; } @@ -257,9 +259,11 @@ ClientStore::move(const Path& old_path_str, const Path& new_path_str) if (child_old_path == old_path) child_new_path = new_path; else - child_new_path = new_path.base() + child_old_path.substr(old_path.length()+1); + child_new_path = new_path.base() + + child_old_path.substr(old_path.length() + 1); - LOG(info) << "Renamed " << child_old_path << " -> " << child_new_path << endl; + LOG(info) << "Renamed " << child_old_path + << " -> " << child_new_path << endl; PtrCast<ObjectModel>(i->second)->set_path(child_new_path); i->first = child_new_path; } @@ -294,7 +298,8 @@ ClientStore::put(const URI& uri, if (plugin_type == Plugin::Patch) { is_patch = true; } else if (plugin_type != Plugin::NIL) { - SharedPtr<PluginModel> p(new PluginModel(uris(), uri, type_uri, properties)); + SharedPtr<PluginModel> p( + new PluginModel(uris(), uri, type_uri, properties)); add_plugin(p); return; } @@ -326,7 +331,8 @@ ClientStore::put(const URI& uri, SharedPtr<PluginModel> plug; if (p->second.is_valid() && p->second.type() == _uris->forge.URI) { if (!(plug = _plugin(p->second.get_uri()))) { - LOG(warn) << "Unable to find plugin " << p->second.get_uri() << endl; + LOG(warn) << "Unable to find plugin " + << p->second.get_uri() << endl; plug = SharedPtr<PluginModel>( new PluginModel(uris(), p->second.get_uri(), @@ -342,7 +348,9 @@ ClientStore::put(const URI& uri, LOG(warn) << "Node " << path << " has no plugin" << endl; } } else if (is_port) { - PortModel::Direction pdir = is_output ? PortModel::OUTPUT : PortModel::INPUT; + PortModel::Direction pdir = (is_output) + ? PortModel::OUTPUT + : PortModel::INPUT; const Iterator i = properties.find(_uris->lv2_index); if (i != properties.end() && i->second.type() == _uris->forge.Int) { const uint32_t index = i->second.get_int32(); @@ -368,10 +376,12 @@ ClientStore::delta(const URI& uri, #ifdef INGEN_CLIENT_STORE_DUMP LOG(info) << "DELTA " << uri << " {" << endl; for (iterator i = remove.begin(); i != remove.end(); ++i) - LOG(info) << " - " << i->first << " = " << _uris->forge.str(i->second) + LOG(info) << " - " << i->first + << " = " << _uris->forge.str(i->second) << " :: " << i->second.type() << endl; for (iterator i = add.begin(); i != add.end(); ++i) - LOG(info) << " + " << i->first << " = " << _uris->forge.str(i->second) + LOG(info) << " + " << i->first + << " = " << _uris->forge.str(i->second) << " :: " << i->second.type() << endl; LOG(info) << "}" << endl; #endif @@ -393,7 +403,9 @@ ClientStore::delta(const URI& uri, } void -ClientStore::set_property(const URI& subject_uri, const URI& predicate, const Atom& value) +ClientStore::set_property(const URI& subject_uri, + const URI& predicate, + const Atom& value) { if (subject_uri == _uris->ingen_engine) { LOG(info) << "Engine property " << predicate @@ -445,8 +457,8 @@ ClientStore::attempt_connection(const Path& tail_path, SharedPtr<PortModel> head = PtrCast<PortModel>(_object(head_path)); if (tail && head) { - SharedPtr<PatchModel> patch = connection_patch(tail_path, head_path); - SharedPtr<EdgeModel> cm(new EdgeModel(tail, head)); + SharedPtr<PatchModel> patch = connection_patch(tail_path, head_path); + SharedPtr<EdgeModel> cm(new EdgeModel(tail, head)); tail->connected_to(head); head->connected_to(tail); @@ -470,7 +482,8 @@ ClientStore::disconnect(const Path& src, const Path& dst) { if (!Path::is_path(src) && !Path::is_path(dst)) { - std::cerr << "Bad disconnect notification " << src << " => " << dst << std::endl; + std::cerr << "Bad disconnect notification " << src + << " => " << dst << std::endl; return; } @@ -492,15 +505,15 @@ ClientStore::disconnect(const Path& src, } void -ClientStore::disconnect_all(const Raul::Path& parent_patch_path, +ClientStore::disconnect_all(const Raul::Path& parent_patch, const Raul::Path& path) { - SharedPtr<PatchModel> patch = PtrCast<PatchModel>(_object(parent_patch_path)); + SharedPtr<PatchModel> patch = PtrCast<PatchModel>(_object(parent_patch)); SharedPtr<ObjectModel> object = _object(path); if (!patch || !object) { std::cerr << "Bad disconnect all notification " << path - << " in " << parent_patch_path << std::endl; + << " in " << parent_patch << std::endl; return; } diff --git a/src/client/NodeModel.cpp b/src/client/NodeModel.cpp index d1d1108d..cab4dafa 100644 --- a/src/client/NodeModel.cpp +++ b/src/client/NodeModel.cpp @@ -160,12 +160,15 @@ Ingen::Port* NodeModel::port(uint32_t index) const { assert(index < num_ports()); - return const_cast<Ingen::Port*>(dynamic_cast<const Ingen::Port*>(_ports[index].get())); + return const_cast<Ingen::Port*>( + dynamic_cast<const Ingen::Port*>(_ports[index].get())); } void NodeModel::default_port_value_range(SharedPtr<const PortModel> port, - float& min, float& max, uint32_t srate) const + float& min, + float& max, + uint32_t srate) const { // Default control values min = 0.0; @@ -227,18 +230,18 @@ NodeModel::port_label(SharedPtr<const PortModel> port) const } if (_plugin && _plugin->type() == PluginModel::LV2) { - LilvWorld* c_world = _plugin->lilv_world(); - const LilvPlugin* c_plugin = _plugin->lilv_plugin(); - LilvNode* c_sym = lilv_new_string(c_world, port->symbol().c_str()); - const LilvPort* c_port = lilv_plugin_get_port_by_symbol(c_plugin, c_sym); - if (c_port) { - LilvNode* c_name = lilv_port_get_name(c_plugin, c_port); - if (c_name && lilv_node_is_string(c_name)) { - std::string ret(lilv_node_as_string(c_name)); - lilv_node_free(c_name); + LilvWorld* w = _plugin->lilv_world(); + const LilvPlugin* plug = _plugin->lilv_plugin(); + LilvNode* sym = lilv_new_string(w, port->symbol().c_str()); + const LilvPort* lport = lilv_plugin_get_port_by_symbol(plug, sym); + if (lport) { + LilvNode* lname = lilv_port_get_name(plug, lport); + if (lname && lilv_node_is_string(lname)) { + std::string ret(lilv_node_as_string(lname)); + lilv_node_free(lname); return ret; } - lilv_node_free(c_name); + lilv_node_free(lname); } } diff --git a/src/client/PatchModel.cpp b/src/client/PatchModel.cpp index ec949429..2513ca70 100644 --- a/src/client/PatchModel.cpp +++ b/src/client/PatchModel.cpp @@ -55,7 +55,8 @@ PatchModel::remove_child(SharedPtr<ObjectModel> o) // Remove any connections which referred to this object, // since they can't possibly exist anymore - for (Connections::iterator j = _connections->begin(); j != _connections->end(); ) { + for (Connections::iterator j = _connections->begin(); + j != _connections->end();) { Connections::iterator next = j; ++next; @@ -133,7 +134,8 @@ PatchModel::add_connection(SharedPtr<EdgeModel> cm) assert(cm->tail() == existing->tail()); assert(cm->head() == existing->head()); } else { - _connections->insert(make_pair(make_pair(cm->tail().get(), cm->head().get()), cm)); + _connections->insert(make_pair(make_pair(cm->tail().get(), + cm->head().get()), cm)); _signal_new_connection.emit(cm); } } diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 6a5912a8..9c5bd2bb 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -92,7 +92,8 @@ PluginModel::get_property(const URI& key) const if (isalpha(uri.str()[last_delim + 1])) symbol = uri.str().substr(last_delim + 1); else - symbol = uri.str().substr(first_delim + 1, last_delim - first_delim - 1); + symbol = uri.str().substr(first_delim + 1, + last_delim - first_delim - 1); } set_property(LV2_CORE__symbol, _uris.forge.alloc(symbol)); return get_property(key); @@ -106,19 +107,20 @@ PluginModel::get_property(const URI& key) const LILV_FOREACH(nodes, i, values) { const LilvNode* val = lilv_nodes_get(values, i); if (lilv_node_is_uri(val)) { - ret = set_property(key, _uris.forge.alloc_uri(lilv_node_as_uri(val))); + ret = set_property( + key, _uris.forge.alloc_uri(lilv_node_as_uri(val))); break; } else if (lilv_node_is_string(val)) { - ret = set_property(key, - _uris.forge.alloc(lilv_node_as_string(val))); + ret = set_property( + key, _uris.forge.alloc(lilv_node_as_string(val))); break; } else if (lilv_node_is_float(val)) { - ret = set_property(key, - _uris.forge.make(lilv_node_as_float(val))); + ret = set_property( + key, _uris.forge.make(lilv_node_as_float(val))); break; } else if (lilv_node_is_int(val)) { - ret = set_property(key, - _uris.forge.make(lilv_node_as_int(val))); + ret = set_property( + key, _uris.forge.make(lilv_node_as_int(val))); break; } } @@ -140,7 +142,9 @@ PluginModel::set(SharedPtr<PluginModel> p) if (p->_lilv_plugin) _lilv_plugin = p->_lilv_plugin; - for (Properties::const_iterator v = p->properties().begin(); v != p->properties().end(); ++v) { + for (Properties::const_iterator v = p->properties().begin(); + v != p->properties().end(); + ++v) { ResourceImpl::set_property(v->first, v->second); _signal_property.emit(v->first, v->second); } @@ -169,11 +173,11 @@ PluginModel::human_name() const } string -PluginModel::port_human_name(uint32_t index) const +PluginModel::port_human_name(uint32_t i) const { if (_lilv_plugin) { - const LilvPort* port = lilv_plugin_get_port_by_index(_lilv_plugin, index); - LilvNode* name = lilv_port_get_name(_lilv_plugin, port); + const LilvPort* port = lilv_plugin_get_port_by_index(_lilv_plugin, i); + LilvNode* name = lilv_port_get_name(_lilv_plugin, port); const string ret(lilv_node_as_string(name)); lilv_node_free(name); return ret; diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index a58bdabe..dee00fea 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -67,7 +67,9 @@ lv2_ui_write(SuilController controller, LV2_Atom* atom = (LV2_Atom*)buffer; Raul::Atom val = ui->world()->forge().alloc( atom->size, atom->type, LV2_ATOM_BODY(atom)); - ui->world()->engine()->set_property(port->path(), uris.ingen_value, val); + ui->world()->engine()->set_property(port->path(), + uris.ingen_value, + val); } else { warn << "Unknown value format " << format @@ -170,13 +172,14 @@ PluginUI::port_event(uint32_t port_index, bool PluginUI::is_resizable() const { + LilvWorld* w = _world->lilv_world(); const LilvNode* s = _ui_node; - LilvNode* p = lilv_new_uri(_world->lilv_world(), LV2_CORE__optionalFeature); - LilvNode* fs = lilv_new_uri(_world->lilv_world(), LV2_UI__fixedSize); - LilvNode* nrs = lilv_new_uri(_world->lilv_world(), LV2_UI__noUserResize); + LilvNode* p = lilv_new_uri(w, LV2_CORE__optionalFeature); + LilvNode* fs = lilv_new_uri(w, LV2_UI__fixedSize); + LilvNode* nrs = lilv_new_uri(w, LV2_UI__noUserResize); - LilvNodes* fs_matches = lilv_world_find_nodes(_world->lilv_world(), s, p, fs); - LilvNodes* nrs_matches = lilv_world_find_nodes(_world->lilv_world(), s, p, nrs); + LilvNodes* fs_matches = lilv_world_find_nodes(w, s, p, fs); + LilvNodes* nrs_matches = lilv_world_find_nodes(w, s, p, nrs); lilv_nodes_free(nrs_matches); lilv_nodes_free(fs_matches); |