summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ClashAvoider.cpp14
-rw-r--r--src/Configuration.cpp5
-rw-r--r--src/Parser.cpp9
-rw-r--r--src/Resource.cpp6
-rw-r--r--src/Serialiser.cpp15
-rw-r--r--src/client/BlockModel.cpp21
-rw-r--r--src/client/ClientStore.cpp21
-rw-r--r--src/client/GraphModel.cpp5
-rw-r--r--src/client/ObjectModel.cpp3
-rw-r--r--src/client/PluginModel.cpp19
-rw-r--r--src/gui/App.cpp15
-rw-r--r--src/gui/BreadCrumbs.cpp37
-rw-r--r--src/gui/ConnectWindow.cpp23
-rw-r--r--src/gui/GraphBox.cpp52
-rw-r--r--src/gui/GraphCanvas.cpp26
-rw-r--r--src/gui/GraphPortModule.cpp3
-rw-r--r--src/gui/GraphTreeWindow.cpp12
-rw-r--r--src/gui/GraphView.cpp6
-rw-r--r--src/gui/GraphWindow.cpp3
-rw-r--r--src/gui/LoadGraphWindow.cpp12
-rw-r--r--src/gui/LoadPluginWindow.cpp23
-rw-r--r--src/gui/NodeMenu.cpp16
-rw-r--r--src/gui/NodeModule.cpp18
-rw-r--r--src/gui/ObjectMenu.cpp6
-rw-r--r--src/gui/PluginMenu.cpp3
-rw-r--r--src/gui/Port.cpp3
-rw-r--r--src/gui/PortMenu.cpp6
-rw-r--r--src/gui/ThreadedLoader.cpp5
-rw-r--r--src/gui/WidgetFactory.cpp6
-rw-r--r--src/gui/WindowFactory.cpp48
-rw-r--r--src/ingen/ingen.cpp3
-rw-r--r--src/server/BlockFactory.cpp3
-rw-r--r--src/server/BlockImpl.cpp18
-rw-r--r--src/server/ControlBindings.cpp3
-rw-r--r--src/server/GraphImpl.cpp3
-rw-r--r--src/server/InputPort.cpp3
-rw-r--r--src/server/JackDriver.cpp6
-rw-r--r--src/server/LV2Block.cpp18
-rw-r--r--src/server/LV2Plugin.cpp8
-rw-r--r--src/server/PortImpl.cpp9
-rw-r--r--src/server/events/Delta.cpp3
-rw-r--r--src/server/events/DisconnectAll.cpp3
-rw-r--r--src/server/internals/Controller.cpp3
-rw-r--r--src/server/internals/Note.cpp15
44 files changed, 354 insertions, 185 deletions
diff --git a/src/ClashAvoider.cpp b/src/ClashAvoider.cpp
index d74915fa..429b582b 100644
--- a/src/ClashAvoider.cpp
+++ b/src/ClashAvoider.cpp
@@ -95,19 +95,22 @@ ClashAvoider::map_path(const Raul::Path& in)
} else {
string parent_str = in.parent().base();
parent_str = parent_str.substr(0, parent_str.find_last_of("/"));
- if (parent_str.empty())
+ if (parent_str.empty()) {
parent_str = "/";
+ }
}
- if (offset == 0)
+ if (offset == 0) {
offset = 2;
+ }
std::stringstream ss;
ss << base_path << "_" << offset;
if (!exists(Raul::Path(ss.str()))) {
std::string name = base_path.symbol();
- if (name == "")
+ if (name == "") {
name = "_";
+ }
Raul::Symbol sym(name);
string str = ss.str();
InsertRecord i = _symbol_map.insert(
@@ -116,10 +119,11 @@ ClashAvoider::map_path(const Raul::Path& in)
_offsets.insert(make_pair(base_path, offset));
return i.first->second;
} else {
- if (o != _offsets.end())
+ if (o != _offsets.end()) {
offset = ++o->second;
- else
+ } else {
++offset;
+ }
}
}
}
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index 30b536bf..3e7b13ba 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -120,10 +120,11 @@ Configuration::print_usage(const std::string& program, std::ostream& os)
for (const auto& o : _options) {
const Option& option = o.second;
os << " ";
- if (option.letter != '\0')
+ if (option.letter != '\0') {
os << "-" << option.letter << ", ";
- else
+ } else {
os << " ";
+ }
os.width(_max_name_length + 11);
os << std::left;
os << (std::string("--") + o.first + variable_string(option.type));
diff --git a/src/Parser.cpp b/src/Parser.cpp
index 68cd774f..2115ab74 100644
--- a/src/Parser.cpp
+++ b/src/Parser.cpp
@@ -545,8 +545,9 @@ parse_properties(Ingen::World* world,
target->put(uri, properties, ctx);
// Set passed properties last to override any loaded values
- if (data)
+ if (data) {
target->put(uri, data.get(), ctx);
+ }
return true;
}
@@ -700,10 +701,12 @@ Parser::parse_file(Ingen::World* world,
serd_env_free(env);
world->log().info(fmt("Loading %1% from %2%\n") % uri % file_path);
- if (parent)
+ if (parent) {
world->log().info(fmt("Parent: %1%\n") % parent->c_str());
- if (symbol)
+ }
+ if (symbol) {
world->log().info(fmt("Symbol: %1%\n") % symbol->c_str());
+ }
Sord::Node subject(*world->rdf_world(), Sord::Node::URI, uri);
boost::optional<Raul::Path> parsed_path
diff --git a/src/Resource.cpp b/src/Resource.cpp
index eab9f0d8..79d7701b 100644
--- a/src/Resource.cpp
+++ b/src/Resource.cpp
@@ -211,15 +211,17 @@ Resource::set_properties(const Properties& props)
void
Resource::add_properties(const Properties& props)
{
- for (const auto& p : props)
+ for (const auto& p : props) {
add_property(p.first, p.second, p.second.context());
+ }
}
void
Resource::remove_properties(const Properties& props)
{
- for (const auto& p : props)
+ for (const auto& p : props) {
remove_property(p.first, p.second);
+ }
}
Properties
diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp
index 069fc867..537e7091 100644
--- a/src/Serialiser.cpp
+++ b/src/Serialiser.cpp
@@ -200,8 +200,9 @@ Serialiser::Impl::write_bundle(SPtr<const Node> graph,
_world.log().info(fmt("Writing bundle %1%\n") % path);
- if (path.back() != '/')
+ if (path.back() != '/') {
path.append("/");
+ }
g_mkdir_with_parents(path.c_str(), 0744);
@@ -301,8 +302,9 @@ Serialiser::Impl::path_rdf_node(const Raul::Path& path)
void
Serialiser::serialise(SPtr<const Node> object) throw (std::logic_error)
{
- if (!me->_model)
+ if (!me->_model) {
throw std::logic_error("serialise called without serialisation in progress");
+ }
if (object->graph_type() == Node::GraphType::GRAPH) {
me->serialise_graph(object, me->path_rdf_node(object->path()));
@@ -357,8 +359,9 @@ Serialiser::Impl::serialise_graph(SPtr<const Node> graph,
const Store::const_range kids = _world.store()->children_range(graph);
for (Store::const_iterator n = kids.first; n != kids.second; ++n) {
- if (n->first.parent() != graph->path())
+ if (n->first.parent() != graph->path()) {
continue;
+ }
if (n->second->graph_type() == Node::GraphType::GRAPH) {
SPtr<Node> subgraph = n->second;
@@ -412,9 +415,10 @@ Serialiser::Impl::serialise_graph(SPtr<const Node> graph,
const Sord::Node port_id = path_rdf_node(p->path());
// Ensure lv2:name always exists so Graph is a valid LV2 plugin
- if (p->properties().find(uris.lv2_name) == p->properties().end())
+ if (p->properties().find(uris.lv2_name) == p->properties().end()) {
p->set_property(uris.lv2_name,
_world.forge().alloc(p->symbol().c_str()));
+ }
_model->add_statement(graph_id,
Sord::URI(world, LV2_CORE__port),
@@ -522,9 +526,10 @@ Serialiser::Impl::serialise_arc(const Sord::Node& parent,
SPtr<const Arc> arc)
throw (std::logic_error)
{
- if (!_model)
+ if (!_model) {
throw std::logic_error(
"serialise_arc called without serialisation in progress");
+ }
Sord::World& world = _model->world();
const URIs& uris = _world.uris();
diff --git a/src/client/BlockModel.cpp b/src/client/BlockModel.cpp
index a5f2eef0..95819c1e 100644
--- a/src/client/BlockModel.cpp
+++ b/src/client/BlockModel.cpp
@@ -143,9 +143,11 @@ BlockModel::add_port(SPtr<PortModel> pm)
SPtr<const PortModel>
BlockModel::get_port(const Raul::Symbol& symbol) const
{
- for (auto p : _ports)
- if (p->symbol() == symbol)
+ for (auto p : _ports) {
+ if (p->symbol() == symbol) {
return p;
+ }
+ }
return SPtr<PortModel>();
}
@@ -183,10 +185,12 @@ BlockModel::default_port_value_range(SPtr<const PortModel> port,
_min_values, _max_values, nullptr);
}
- if (!std::isnan(_min_values[port->index()]))
+ if (!std::isnan(_min_values[port->index()])) {
min = _min_values[port->index()];
- if (!std::isnan(_max_values[port->index()]))
+ }
+ if (!std::isnan(_max_values[port->index()])) {
max = _max_values[port->index()];
+ }
}
if (port->port_property(_uris.lv2_sampleRate)) {
@@ -208,13 +212,16 @@ BlockModel::port_value_range(SPtr<const PortModel> port,
// Possibly overriden
const Atom& min_atom = port->get_property(_uris.lv2_minimum);
const Atom& max_atom = port->get_property(_uris.lv2_maximum);
- if (min_atom.type() == _uris.forge.Float)
+ if (min_atom.type() == _uris.forge.Float) {
min = min_atom.get<float>();
- if (max_atom.type() == _uris.forge.Float)
+ }
+ if (max_atom.type() == _uris.forge.Float) {
max = max_atom.get<float>();
+ }
- if (max <= min)
+ if (max <= min) {
max = min + 1.0;
+ }
if (port->port_property(_uris.lv2_sampleRate)) {
min *= srate;
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index c5749388..e91277d9 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -80,8 +80,9 @@ ClientStore::add_object(SPtr<ObjectModel> object)
}
}
- for (auto p : object->properties())
+ for (auto p : object->properties()) {
object->signal_property().emit(p.first, p.second);
+ }
}
SPtr<ObjectModel>
@@ -400,21 +401,26 @@ ClientStore::connection_graph(const Raul::Path& tail_path,
{
SPtr<GraphModel> graph;
- if (tail_path.parent() == head_path.parent())
+ if (tail_path.parent() == head_path.parent()) {
graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent()));
+ }
- if (!graph && tail_path.parent() == head_path.parent().parent())
+ if (!graph && tail_path.parent() == head_path.parent().parent()) {
graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent()));
+ }
- if (!graph && tail_path.parent().parent() == head_path.parent())
+ if (!graph && tail_path.parent().parent() == head_path.parent()) {
graph = dynamic_ptr_cast<GraphModel>(_object(head_path.parent()));
+ }
- if (!graph)
+ if (!graph) {
graph = dynamic_ptr_cast<GraphModel>(_object(tail_path.parent().parent()));
+ }
- if (!graph)
+ if (!graph) {
_log.error(fmt("Unable to find graph for arc %1% => %2%\n")
% tail_path % head_path);
+ }
return graph;
}
@@ -450,8 +456,9 @@ ClientStore::operator()(const Disconnect& msg)
SPtr<PortModel> tail = dynamic_ptr_cast<PortModel>(_object(msg.tail));
SPtr<PortModel> head = dynamic_ptr_cast<PortModel>(_object(msg.head));
SPtr<GraphModel> graph = connection_graph(msg.tail, msg.head);
- if (graph)
+ if (graph) {
graph->remove_arc(tail.get(), head.get());
+ }
}
void
diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp
index d02a3736..e9fce5c4 100644
--- a/src/client/GraphModel.cpp
+++ b/src/client/GraphModel.cpp
@@ -100,10 +100,11 @@ SPtr<ArcModel>
GraphModel::get_arc(const Node* tail, const Node* head)
{
Arcs::iterator i = _arcs.find(make_pair(tail, head));
- if (i != _arcs.end())
+ if (i != _arcs.end()) {
return dynamic_ptr_cast<ArcModel>(i->second);
- else
+ } else {
return SPtr<ArcModel>();
+ }
}
/** Add a connection to this graph.
diff --git a/src/client/ObjectModel.cpp b/src/client/ObjectModel.cpp
index 9c46f55f..5aee03ce 100644
--- a/src/client/ObjectModel.cpp
+++ b/src/client/ObjectModel.cpp
@@ -78,8 +78,9 @@ void
ObjectModel::set(SPtr<ObjectModel> o)
{
assert(_path == o->path());
- if (o->_parent)
+ if (o->_parent) {
_parent = o->_parent;
+ }
for (auto v : o->properties()) {
Resource::set_property(v.first, v.second);
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 91bda703..42422b12 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -97,8 +97,9 @@ PluginModel::get_property(const Raul::URI& key) const
{
static const Atom nil;
const Atom& val = Resource::get_property(key);
- if (val.is_valid())
+ if (val.is_valid()) {
return val;
+ }
// No lv2:symbol from data or engine, invent one
if (key == _uris.lv2_symbol) {
@@ -143,8 +144,9 @@ PluginModel::get_property(const Raul::URI& key) const
}
lilv_nodes_free(values);
- if (ret)
+ if (ret) {
return *ret;
+ }
}
return nil;
@@ -155,8 +157,9 @@ PluginModel::set(SPtr<PluginModel> p)
{
_type = p->_type;
- if (p->_lilv_plugin)
+ if (p->_lilv_plugin) {
_lilv_plugin = p->_lilv_plugin;
+ }
for (auto v : p->properties()) {
Resource::set_property(v.first, v.second);
@@ -177,20 +180,22 @@ Raul::Symbol
PluginModel::default_block_symbol() const
{
const Atom& name_atom = get_property(_uris.lv2_symbol);
- if (name_atom.is_valid() && name_atom.type() == _uris.forge.String)
+ if (name_atom.is_valid() && name_atom.type() == _uris.forge.String) {
return Raul::Symbol::symbolify(name_atom.ptr<char>());
- else
+ } else {
return Raul::Symbol("_");
+ }
}
string
PluginModel::human_name() const
{
const Atom& name_atom = get_property(_uris.doap_name);
- if (name_atom.type() == _uris.forge.String)
+ if (name_atom.type() == _uris.forge.String) {
return name_atom.ptr<char>();
- else
+ } else {
return default_block_symbol().c_str();
+ }
}
string
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index f67e4104..d9e8680c 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -149,9 +149,11 @@ App::run()
// Run main iterations here until we're attached to the engine. Otherwise
// with 'ingen -egl' we'd get a bunch of notifications about load
// immediately before even knowing about the root graph or plugins)
- while (!_connect_window->attached())
- if (_main->iteration())
+ while (!_connect_window->attached()) {
+ if (_main->iteration()) {
break;
+ }
+ }
_main->run();
}
@@ -351,8 +353,9 @@ void
App::port_activity(Port* port)
{
std::pair<ActivityPorts::iterator, bool> inserted = _activity_ports.insert(make_pair(port, false));
- if (inserted.second)
+ if (inserted.second) {
inserted.first->second = false;
+ }
port->set_highlighted(true);
}
@@ -361,8 +364,9 @@ void
App::activity_port_destroyed(Port* port)
{
ActivityPorts::iterator i = _activity_ports.find(port);
- if (i != _activity_ports.end())
+ if (i != _activity_ports.end()) {
_activity_ports.erase(i);
+ }
return;
}
@@ -402,8 +406,9 @@ App::register_callbacks()
bool
App::gtk_main_iteration()
{
- if (!_client)
+ if (!_client) {
return false;
+ }
if (_messages_window) {
_messages_window->flush();
diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp
index 0be15fa6..96fc2bdb 100644
--- a/src/gui/BreadCrumbs.cpp
+++ b/src/gui/BreadCrumbs.cpp
@@ -44,9 +44,11 @@ BreadCrumbs::BreadCrumbs(App& app)
SPtr<GraphView>
BreadCrumbs::view(const Raul::Path& path)
{
- for (const auto& b : _breadcrumbs)
- if (b->path() == path)
+ for (const auto& b : _breadcrumbs) {
+ if (b->path() == path) {
return b->view();
+ }
+ }
return SPtr<GraphView>();
}
@@ -67,8 +69,9 @@ BreadCrumbs::build(Raul::Path path, SPtr<GraphView> view)
for (const auto& b : _breadcrumbs) {
if (b->path() == path) {
b->set_active(true);
- if (!b->view())
+ if (!b->view()) {
b->set_view(view);
+ }
// views are expensive, having two around for the same graph is a bug
assert(b->view() == view);
@@ -86,22 +89,25 @@ BreadCrumbs::build(Raul::Path path, SPtr<GraphView> view)
string suffix = path.substr(_full_path.length());
while (suffix.length() > 0) {
- if (suffix[0] == '/')
+ if (suffix[0] == '/') {
suffix = suffix.substr(1);
+ }
const string name = suffix.substr(0, suffix.find("/"));
_full_path = _full_path.child(Raul::Symbol(name));
BreadCrumb* but = create_crumb(_full_path, view);
pack_start(*but, false, false, 1);
_breadcrumbs.push_back(but);
but->show();
- if (suffix.find("/") == string::npos)
+ if (suffix.find("/") == string::npos) {
break;
- else
+ } else {
suffix = suffix.substr(suffix.find("/")+1);
+ }
}
- for (const auto& b : _breadcrumbs)
+ for (const auto& b : _breadcrumbs) {
b->set_active(false);
+ }
_breadcrumbs.back()->set_active(true);
} else {
@@ -112,8 +118,9 @@ BreadCrumbs::build(Raul::Path path, SPtr<GraphView> view)
_active_path = path;
// Empty existing breadcrumbs
- for (const auto& b : _breadcrumbs)
+ for (const auto& b : _breadcrumbs) {
remove(*b);
+ }
_breadcrumbs.clear();
// Add root
@@ -125,8 +132,9 @@ BreadCrumbs::build(Raul::Path path, SPtr<GraphView> view)
Raul::Path working_path("/");
string suffix = path.substr(1);
while (suffix.length() > 0) {
- if (suffix[0] == '/')
+ if (suffix[0] == '/') {
suffix = suffix.substr(1);
+ }
const string name = suffix.substr(0, suffix.find("/"));
working_path = working_path.child(Raul::Symbol(name));
BreadCrumb* but = create_crumb(working_path, view);
@@ -134,10 +142,11 @@ BreadCrumbs::build(Raul::Path path, SPtr<GraphView> view)
_breadcrumbs.push_back(but);
but->set_active(working_path == _active_path);
but->show();
- if (suffix.find("/") == string::npos)
+ if (suffix.find("/") == string::npos) {
break;
- else
+ } else {
suffix = suffix.substr(suffix.find("/")+1);
+ }
}
}
@@ -174,8 +183,9 @@ BreadCrumbs::breadcrumb_clicked(BreadCrumb* crumb)
crumb->set_active(true);
} else {
signal_graph_selected.emit(crumb->path(), crumb->view());
- if (crumb->path() != _active_path)
+ if (crumb->path() != _active_path) {
crumb->set_active(false);
+ }
}
_enable_signal = true;
}
@@ -209,8 +219,9 @@ void
BreadCrumbs::object_moved(const Raul::Path& old_path, const Raul::Path& new_path)
{
for (const auto& b : _breadcrumbs) {
- if (b->path() == old_path)
+ if (b->path() == old_path) {
b->set_path(new_path);
+ }
}
}
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index c4081c97..a2d674b8 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -133,8 +133,9 @@ ConnectWindow::set_connected_to(SPtr<Ingen::Interface> engine)
{
_app->world()->set_interface(engine);
- if (!_widgets_loaded)
+ if (!_widgets_loaded) {
return;
+ }
if (engine) {
_icon->set(Gtk::Stock::CONNECT, Gtk::ICON_SIZE_LARGE_TOOLBAR);
@@ -162,10 +163,11 @@ ConnectWindow::set_connected_to(SPtr<Ingen::Interface> engine)
_activate_button->set_sensitive(false);
_deactivate_button->set_sensitive(false);
- if (_mode == Mode::CONNECT_REMOTE)
+ if (_mode == Mode::CONNECT_REMOTE) {
_url_entry->set_sensitive(true);
- else if (_mode == Mode::LAUNCH_REMOTE)
+ } else if (_mode == Mode::LAUNCH_REMOTE) {
_port_spinbutton->set_sensitive(true);
+ }
_progress_label->set_text(string("Disconnected"));
}
@@ -174,8 +176,9 @@ ConnectWindow::set_connected_to(SPtr<Ingen::Interface> engine)
void
ConnectWindow::set_connecting_widget_states()
{
- if (!_widgets_loaded)
+ if (!_widgets_loaded) {
return;
+ }
_connect_button->set_sensitive(false);
_disconnect_button->set_label("gtk-cancel");
@@ -289,8 +292,9 @@ ConnectWindow::disconnect()
_app->detach();
set_connected_to(SPtr<Ingen::Interface>());
- if (!_widgets_loaded)
+ if (!_widgets_loaded) {
return;
+ }
_activate_button->set_sensitive(false);
_deactivate_button->set_sensitive(false);
@@ -392,15 +396,17 @@ void
ConnectWindow::on_hide()
{
Gtk::Dialog::on_hide();
- if (_app->window_factory()->num_open_graph_windows() == 0)
+ if (_app->window_factory()->num_open_graph_windows() == 0) {
quit();
+ }
}
void
ConnectWindow::quit_clicked()
{
- if (_app->quit(this))
+ if (_app->quit(this)) {
_quit_flag = true;
+ }
}
void
@@ -451,8 +457,9 @@ ConnectWindow::gtk_callback()
{
/* If I call this a "state machine" it's not ugly code any more */
- if (_quit_flag)
+ if (_quit_flag) {
return false; // deregister this callback
+ }
// Timing stuff for repeated attach attempts
timeval now;
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index 1b6e7967..5504b964 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -271,8 +271,9 @@ void
GraphBox::set_graph(SPtr<const GraphModel> graph,
SPtr<GraphView> view)
{
- if (!graph || graph == _graph)
+ if (!graph || graph == _graph) {
return;
+ }
_enable_signal = false;
@@ -287,11 +288,13 @@ GraphBox::set_graph(SPtr<const GraphModel> graph,
_graph = graph;
_view = view;
- if (!_view)
+ if (!_view) {
_view = _breadcrumbs->view(graph->path());
+ }
- if (!_view)
+ if (!_view) {
_view = GraphView::create(*_app, graph);
+ }
assert(_view);
@@ -304,14 +307,16 @@ GraphBox::set_graph(SPtr<const GraphModel> graph,
}
// Add view to our alignment
- if (_view->get_parent())
+ if (_view->get_parent()) {
_view->get_parent()->remove(*_view.get());
+ }
_alignment->remove();
_alignment->add(*_view.get());
- if (_breadcrumbs->get_parent())
+ if (_breadcrumbs->get_parent()) {
_breadcrumbs->get_parent()->remove(*_breadcrumbs);
+ }
_view->breadcrumb_container()->remove();
_view->breadcrumb_container()->add(*_breadcrumbs);
@@ -361,8 +366,9 @@ GraphBox::graph_port_added(SPtr<const PortModel> port)
void
GraphBox::graph_port_removed(SPtr<const PortModel> port)
{
- if (!(port->is_input() && _app->can_control(port.get())))
+ if (!(port->is_input() && _app->can_control(port.get()))) {
return;
+ }
for (const auto& p : _graph->ports()) {
if (p->is_input() && _app->can_control(p.get())) {
@@ -421,8 +427,9 @@ GraphBox::show_status(const ObjectModel* model)
} else if ((block = dynamic_cast<const BlockModel*>(model))) {
const PluginModel* plugin = dynamic_cast<const PluginModel*>(block->plugin());
- if (plugin)
+ if (plugin) {
msg << ((boost::format(" (%1%)") % plugin->human_name()).str());
+ }
_status_bar->push(msg.str(), STATUS_CONTEXT_HOVER);
}
}
@@ -438,8 +445,9 @@ GraphBox::show_port_status(const PortModel* port, const Atom& value)
const PluginModel* plugin = dynamic_cast<const PluginModel*>(parent->plugin());
if (plugin) {
const std::string& human_name = plugin->port_human_name(port->index());
- if (!human_name.empty())
+ if (!human_name.empty()) {
msg << " (" << human_name << ")";
+ }
}
}
@@ -467,8 +475,9 @@ GraphBox::object_left(const ObjectModel* model)
void
GraphBox::event_show_engine()
{
- if (_graph)
+ if (_graph) {
_app->connect_window()->show();
+ }
}
void
@@ -568,13 +577,15 @@ GraphBox::event_save_as()
// Set current folder to most sensible default
const Atom& document = _graph->get_property(uris.ingen_file);
const Atom& dir = _app->world()->conf().option("graph-directory");
- if (document.type() == uris.forge.URI)
+ if (document.type() == uris.forge.URI) {
dialog.set_uri(document.ptr<char>());
- else if (dir.is_valid())
+ } else if (dir.is_valid()) {
dialog.set_current_folder(dir.ptr<char>());
+ }
- if (dialog.run() != Gtk::RESPONSE_OK)
+ if (dialog.run() != Gtk::RESPONSE_OK) {
break;
+ }
std::string filename = dialog.get_filename();
std::string basename = Glib::path_get_basename(filename);
@@ -701,8 +712,9 @@ GraphBox::event_export_image()
void
GraphBox::event_copy()
{
- if (_view)
+ if (_view) {
_view->canvas()->copy_selection();
+ }
}
void
@@ -720,22 +732,25 @@ GraphBox::event_undo()
void
GraphBox::event_paste()
{
- if (_view)
+ if (_view) {
_view->canvas()->paste();
+ }
}
void
GraphBox::event_delete()
{
- if (_view)
+ if (_view) {
_view->canvas()->destroy_selection();
+ }
}
void
GraphBox::event_select_all()
{
- if (_view)
+ if (_view) {
_view->canvas()->select_all();
+ }
}
void
@@ -850,10 +865,11 @@ GraphBox::event_doc_pane_toggled()
void
GraphBox::event_status_bar_toggled()
{
- if (_menu_show_status_bar->get_active())
+ if (_menu_show_status_bar->get_active()) {
_status_bar->show();
- else
+ } else {
_status_bar->hide();
+ }
}
void
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp
index 8becdb48..ebb357cf 100644
--- a/src/gui/GraphCanvas.cpp
+++ b/src/gui/GraphCanvas.cpp
@@ -181,13 +181,15 @@ GraphCanvas::show_menu(bool position, unsigned button, uint32_t time)
{
_app.request_plugins_if_necessary();
- if (!_internal_menu || _menu_dirty)
+ if (!_internal_menu || _menu_dirty) {
build_menus();
+ }
- if (position)
+ if (position) {
_menu->popup(sigc::mem_fun(this, &GraphCanvas::auto_menu_position), button, time);
- else
+ } else {
_menu->popup(button, time);
+ }
}
void
@@ -240,8 +242,9 @@ GraphCanvas::build()
// Create modules for blocks
for (Store::const_iterator i = kids.first; i != kids.second; ++i) {
SPtr<BlockModel> block = dynamic_ptr_cast<BlockModel>(i->second);
- if (block && block->parent() == _graph)
+ if (block && block->parent() == _graph) {
add_block(block);
+ }
}
// Create pseudo modules for ports (ports on this canvas, not on our module)
@@ -262,12 +265,14 @@ show_module_human_names(GanvNode* node, void* data)
if (GANV_IS_MODULE(node)) {
Ganv::Module* module = Glib::wrap(GANV_MODULE(node));
NodeModule* nmod = dynamic_cast<NodeModule*>(module);
- if (nmod)
+ if (nmod) {
nmod->show_human_names(b);
+ }
GraphPortModule* pmod = dynamic_cast<GraphPortModule*>(module);
- if (pmod)
+ if (pmod) {
pmod->show_human_names(b);
+ }
}
}
@@ -396,8 +401,9 @@ GraphCanvas::get_port_view(SPtr<PortModel> port)
if (module) {
for (const auto& p : *module) {
GUI::Port* pv = dynamic_cast<GUI::Port*>(p);
- if (pv && pv->model() == port)
+ if (pv && pv->model() == port) {
return pv;
+ }
}
}
}
@@ -776,8 +782,9 @@ GraphCanvas::generate_port_name(
snprintf(num_buf, sizeof(num_buf), "%u", i);
symbol = sym_base + "_";
symbol += num_buf;
- if (!_graph->get_port(Raul::Symbol::symbolify(symbol)))
+ if (!_graph->get_port(Raul::Symbol::symbolify(symbol))) {
break;
+ }
}
assert(Raul::Path::is_valid(string("/") + symbol));
@@ -816,8 +823,9 @@ void
GraphCanvas::load_plugin(WPtr<PluginModel> weak_plugin)
{
SPtr<PluginModel> plugin = weak_plugin.lock();
- if (!plugin)
+ if (!plugin) {
return;
+ }
Raul::Symbol symbol = plugin->default_block_symbol();
unsigned offset = _app.store()->child_name_offset(_graph->path(), symbol);
diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp
index ab375da8..f0c2ce11 100644
--- a/src/gui/GraphPortModule.cpp
+++ b/src/gui/GraphPortModule.cpp
@@ -76,8 +76,9 @@ GraphPortModule::create(GraphCanvas& canvas,
port->show_control();
}
- for (const auto& p : model->properties())
+ for (const auto& p : model->properties()) {
ret->property_changed(p.first, p.second);
+ }
return ret;
}
diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp
index bba2a735..df47fabf 100644
--- a/src/gui/GraphTreeWindow.cpp
+++ b/src/gui/GraphTreeWindow.cpp
@@ -78,8 +78,9 @@ void
GraphTreeWindow::new_object(SPtr<ObjectModel> object)
{
SPtr<GraphModel> graph = dynamic_ptr_cast<GraphModel>(object);
- if (graph)
+ if (graph) {
add_graph(graph);
+ }
}
void
@@ -127,8 +128,9 @@ void
GraphTreeWindow::remove_graph(SPtr<GraphModel> pm)
{
Gtk::TreeModel::iterator i = find_graph(_graph_treestore->children(), pm);
- if (i != _graph_treestore->children().end())
+ if (i != _graph_treestore->children().end()) {
_graph_treestore->erase(i);
+ }
}
Gtk::TreeModel::iterator
@@ -141,8 +143,9 @@ GraphTreeWindow::find_graph(Gtk::TreeModel::Children root,
return c;
} else if ((*c)->children().size() > 0) {
Gtk::TreeModel::iterator ret = find_graph(c->children(), graph);
- if (ret != c->children().end())
+ if (ret != c->children().end()) {
return ret;
+ }
}
}
return root.end();
@@ -184,10 +187,11 @@ GraphTreeWindow::event_graph_enabled_toggled(const Glib::ustring& path_str)
SPtr<GraphModel> pm = row[_graph_tree_columns.graph_model_col];
assert(pm);
- if (_enable_signal)
+ if (_enable_signal) {
_app->set_property(pm->uri(),
_app->uris().ingen_enabled,
_app->forge().make((bool)!pm->enabled()));
+ }
}
void
diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp
index 29a89b16..bbe28a0f 100644
--- a/src/gui/GraphView.cpp
+++ b/src/gui/GraphView.cpp
@@ -84,8 +84,9 @@ GraphView::set_graph(SPtr<const GraphModel> graph)
_poly_spin->set_increments(1, 4);
_poly_spin->set_value(graph->internal_poly());
- for (const auto& p : graph->properties())
+ for (const auto& p : graph->properties()) {
property_changed(p.first, p.second);
+ }
// Connect model signals to track state
graph->signal_property().connect(
@@ -115,8 +116,9 @@ GraphView::create(App& app, SPtr<const GraphModel> graph)
void
GraphView::process_toggled()
{
- if (!_enable_signal)
+ if (!_enable_signal) {
return;
+ }
_app->set_property(_graph->uri(),
_app->uris().ingen_enabled,
diff --git a/src/gui/GraphWindow.cpp b/src/gui/GraphWindow.cpp
index 257db8cf..b5a89c79 100644
--- a/src/gui/GraphWindow.cpp
+++ b/src/gui/GraphWindow.cpp
@@ -57,8 +57,9 @@ GraphWindow::init_window(App& app)
void
GraphWindow::on_show()
{
- if (_position_stored)
+ if (_position_stored) {
move(_x, _y);
+ }
Gtk::Window::on_show();
diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp
index 6fbda227..b858023d 100644
--- a/src/gui/LoadGraphWindow.cpp
+++ b/src/gui/LoadGraphWindow.cpp
@@ -157,13 +157,15 @@ LoadGraphWindow::ok_clicked()
const URIs& uris = _app->uris();
- if (_poly_voices_radio->get_active())
+ if (_poly_voices_radio->get_active()) {
_initial_data.insert(
make_pair(uris.ingen_polyphony,
_app->forge().make(_poly_spinbutton->get_value_as_int())));
+ }
- if (get_uri() == "")
+ if (get_uri() == "") {
return;
+ }
if (_import) {
// If unset load_graph will load value
@@ -187,8 +189,9 @@ LoadGraphWindow::ok_clicked()
y = _app->forge().make(y.get<float>() + 20.0f);
Raul::Symbol symbol(symbol_from_filename(u));
- if (uri_list.size() == 1 && _symbol_entry->get_text() != "")
+ if (uri_list.size() == 1 && _symbol_entry->get_text() != "") {
symbol = Raul::Symbol::symbolify(_symbol_entry->get_text());
+ }
symbol = avoid_symbol_clash(symbol);
@@ -238,8 +241,9 @@ LoadGraphWindow::avoid_symbol_clash(const Raul::Symbol& symbol)
void
LoadGraphWindow::selection_changed()
{
- if (_import)
+ if (_import) {
return;
+ }
if (get_filenames().size() != 1) {
_symbol_entry->set_text("");
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index dc743573..c386b970 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -72,8 +72,9 @@ LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject,
_plugins_treeview->get_column(2)->set_sort_column(_plugins_columns._col_project);
_plugins_treeview->get_column(2)->set_sort_column(_plugins_columns._col_author);
_plugins_treeview->get_column(3)->set_sort_column(_plugins_columns._col_uri);
- for (int i = 0; i < 5; ++i)
+ for (int i = 0; i < 5; ++i) {
_plugins_treeview->get_column(i)->set_resizable(true);
+ }
// Set up the search criteria combobox
_criteria_liststore = Gtk::ListStore::create(_criteria_columns);
@@ -221,10 +222,11 @@ LoadPluginWindow::set_plugins(SPtr<const ClientStore::Plugins> plugins)
void
LoadPluginWindow::new_plugin(SPtr<const PluginModel> pm)
{
- if (is_visible())
+ if (is_visible()) {
add_plugin(pm);
- else
+ } else {
_refresh_list = true;
+ }
}
static std::string
@@ -273,8 +275,9 @@ LoadPluginWindow::set_row(Gtk::TreeModel::Row& row,
{
const URIs& uris = _app->uris();
const Atom& name = plugin->get_property(uris.doap_name);
- if (name.is_valid() && name.type() == uris.forge.String)
+ if (name.is_valid() && name.type() == uris.forge.String) {
row[_plugins_columns._col_name] = name.ptr<char>();
+ }
if (uris.lv2_Plugin == plugin->type()) {
row[_plugins_columns._col_type] = lilv_node_as_string(
@@ -366,8 +369,9 @@ LoadPluginWindow::generate_module_name(SPtr<const PluginModel> plugin,
{
std::stringstream ss;
ss << plugin->default_block_symbol();
- if (offset != 0)
+ if (offset != 0) {
ss << "_" << offset;
+ }
return ss.str();
}
@@ -380,8 +384,9 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
bool polyphonic = _polyphonic_checkbutton->get_active();
string name = _name_entry->get_text();
- if (name.empty())
+ if (name.empty()) {
name = generate_module_name(plugin, _name_offset);
+ }
if (name.empty() || !Raul::Symbol::is_valid(name)) {
Gtk::MessageDialog dialog(
@@ -446,8 +451,9 @@ LoadPluginWindow::filter_changed()
switch (criteria) {
case CriteriaColumns::Criteria::NAME:
- if (name.is_valid() && name.type() == uris.forge.String)
+ if (name.is_valid() && name.type() == uris.forge.String) {
field = name.ptr<char>();
+ }
break;
case CriteriaColumns::Criteria::TYPE:
if (plugin->lilv_plugin()) {
@@ -502,8 +508,9 @@ LoadPluginWindow::plugin_property_changed(const Raul::URI& plugin,
const URIs& uris = _app->uris();
if (predicate == uris.doap_name) {
Rows::const_iterator i = _rows.find(plugin);
- if (i != _rows.end() && value.type() == uris.forge.String)
+ if (i != _rows.end() && value.type() == uris.forge.String) {
(*i->second)[_plugins_columns._col_name] = value.ptr<char>();
+ }
}
}
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index 2a9217ab..4c716fde 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -116,16 +116,18 @@ NodeMenu::init(App& app, SPtr<const Client::BlockModel> block)
presets_menu_item->set_submenu(*_presets_menu);
}
- if (has_control_inputs())
+ if (has_control_inputs()) {
_randomize_menuitem->show();
- else
+ } else {
_randomize_menuitem->hide();
+ }
if (plugin && (plugin->uri() == "http://drobilla.net/ns/ingen-internals#Controller"
- || plugin->uri() == "http://drobilla.net/ns/ingen-internals#Trigger"))
+ || plugin->uri() == "http://drobilla.net/ns/ingen-internals#Trigger")) {
_learn_menuitem->show();
- else
+ } else {
_learn_menuitem->hide();
+ }
if (!_popup_gui_menuitem->is_visible() &&
!_embed_gui_menuitem->is_visible() &&
@@ -240,9 +242,11 @@ NodeMenu::on_preset_activated(const std::string& uri)
bool
NodeMenu::has_control_inputs()
{
- for (const auto& p : block()->ports())
- if (p->is_input() && p->is_numeric())
+ for (const auto& p : block()->ports()) {
+ if (p->is_input() && p->is_numeric()) {
return true;
+ }
+ }
return false;
}
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index d3256178..6bc9cfcb 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -145,16 +145,19 @@ NodeModule::create(GraphCanvas& canvas,
? new SubgraphModule(canvas, graph)
: new NodeModule(canvas, block);
- for (const auto& p : block->properties())
+ for (const auto& p : block->properties()) {
ret->property_changed(p.first, p.second);
+ }
- for (const auto& p : block->ports())
+ for (const auto& p : block->ports()) {
ret->new_port_view(p);
+ }
ret->set_stacked(block->polyphonic());
- if (human)
+ if (human) {
ret->show_human_names(human); // FIXME: double port iteration
+ }
return ret;
}
@@ -186,8 +189,9 @@ NodeModule::show_human_names(bool b)
} else {
Glib::ustring hn = block()->plugin_model()->port_human_name(
port->model()->index());
- if (!hn.empty())
+ if (!hn.empty()) {
label = hn;
+ }
}
}
(*i)->set_label(label.c_str());
@@ -232,8 +236,9 @@ NodeModule::port_value_changed(uint32_t index, const Atom& value)
void
NodeModule::plugin_changed()
{
- for (iterator p = begin(); p != end(); ++p)
+ for (iterator p = begin(); p != end(); ++p) {
dynamic_cast<Ingen::GUI::Port*>(*p)->update_metadata();
+ }
}
void
@@ -317,8 +322,9 @@ NodeModule::port(SPtr<const PortModel> model)
{
for (iterator p = begin(); p != end(); ++p) {
Port* const port = dynamic_cast<Port*>(*p);
- if (port->model() == model)
+ if (port->model() == model) {
return port;
+ }
}
return nullptr;
}
diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp
index 9c24ebd7..c8ef9460 100644
--- a/src/gui/ObjectMenu.cpp
+++ b/src/gui/ObjectMenu.cpp
@@ -111,11 +111,12 @@ ObjectMenu::on_menu_unlearn()
void
ObjectMenu::on_menu_polyphonic()
{
- if (_enable_signal)
+ if (_enable_signal) {
_app->set_property(
_object->uri(),
_app->uris().ingen_polyphonic,
_app->forge().make(bool(_polyphonic_menuitem->get_active())));
+ }
}
void
@@ -123,8 +124,9 @@ ObjectMenu::property_changed(const Raul::URI& predicate, const Atom& value)
{
const URIs& uris = _app->uris();
_enable_signal = false;
- if (predicate == uris.ingen_polyphonic && value.type() == uris.forge.Bool)
+ if (predicate == uris.ingen_polyphonic && value.type() == uris.forge.Bool) {
_polyphonic_menuitem->set_active(value.get<int32_t>());
+ }
_enable_signal = true;
}
diff --git a/src/gui/PluginMenu.cpp b/src/gui/PluginMenu.cpp
index 0b353b44..08102221 100644
--- a/src/gui/PluginMenu.cpp
+++ b/src/gui/PluginMenu.cpp
@@ -101,8 +101,9 @@ PluginMenu::build_plugin_class_menu(Gtk::Menu* menu,
const std::pair<LV2Children::const_iterator, LV2Children::const_iterator> kids
= children.equal_range(class_uri_str);
- if (kids.first == children.end())
+ if (kids.first == children.end()) {
return 0;
+ }
// Add submenus
ancestors.insert(class_uri_str);
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 28c3c6af..ebeb5e83 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -126,8 +126,9 @@ Port::port_label(App& app, SPtr<const PortModel> pm)
} else {
const SPtr<const BlockModel> parent(
dynamic_ptr_cast<const BlockModel>(pm->parent()));
- if (parent && parent->plugin_model())
+ if (parent && parent->plugin_model()) {
label = parent->plugin_model()->port_human_name(pm->index());
+ }
}
} else {
label = pm->path().symbol();
diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp
index 63bd046c..4cff55f7 100644
--- a/src/gui/PortMenu.cpp
+++ b/src/gui/PortMenu.cpp
@@ -109,8 +109,9 @@ PortMenu::on_menu_set_min()
const URIs& uris = _app->uris();
SPtr<const PortModel> model = dynamic_ptr_cast<const PortModel>(_object);
const Atom& value = model->get_property(uris.ingen_value);
- if (value.is_valid())
+ if (value.is_valid()) {
_app->set_property(_object->uri(), uris.lv2_minimum, value);
+ }
}
void
@@ -119,8 +120,9 @@ PortMenu::on_menu_set_max()
const URIs& uris = _app->uris();
SPtr<const PortModel> model = dynamic_ptr_cast<const PortModel>(_object);
const Atom& value = model->get_property(uris.ingen_value);
- if (value.is_valid())
+ if (value.is_valid()) {
_app->set_property(_object->uri(), uris.lv2_maximum, value);
+ }
}
void
diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp
index 7f8131ec..367f7978 100644
--- a/src/gui/ThreadedLoader.cpp
+++ b/src/gui/ThreadedLoader.cpp
@@ -79,10 +79,11 @@ ThreadedLoader::load_graph(bool merge,
Glib::ustring engine_base = "";
if (engine_parent) {
- if (merge)
+ if (merge) {
engine_base = engine_parent.get();
- else
+ } else {
engine_base = engine_parent.get().base();
+ }
}
_events.push_back(
diff --git a/src/gui/WidgetFactory.cpp b/src/gui/WidgetFactory.cpp
index d77bc7d7..71db9ff4 100644
--- a/src/gui/WidgetFactory.cpp
+++ b/src/gui/WidgetFactory.cpp
@@ -43,8 +43,9 @@ WidgetFactory::find_ui_file()
{
// Try file in bundle (directory where executable resides)
ui_filename = Ingen::bundle_file_path("ingen_gui.ui");
- if (is_readable(ui_filename))
+ if (is_readable(ui_filename)) {
return;
+ }
// Try ENGINE_UI_PATH from the environment
const char* const env_path = getenv("INGEN_UI_PATH");
@@ -55,8 +56,9 @@ WidgetFactory::find_ui_file()
// Try the default system installed path
ui_filename = Ingen::data_file_path("ingen_gui.ui");
- if (is_readable(ui_filename))
+ if (is_readable(ui_filename)) {
return;
+ }
throw std::runtime_error((fmt("Unable to find ingen_gui.ui in %1%\n")
% INGEN_DATA_DIR).str());
diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp
index 3e3ba199..0fe7a544 100644
--- a/src/gui/WindowFactory.cpp
+++ b/src/gui/WindowFactory.cpp
@@ -67,15 +67,17 @@ WindowFactory::WindowFactory(App& app)
WindowFactory::~WindowFactory()
{
- for (const auto& w : _graph_windows)
+ for (const auto& w : _graph_windows) {
delete w.second;
+ }
}
void
WindowFactory::clear()
{
- for (const auto& w : _graph_windows)
+ for (const auto& w : _graph_windows) {
delete w.second;
+ }
_graph_windows.clear();
}
@@ -86,9 +88,11 @@ size_t
WindowFactory::num_open_graph_windows()
{
size_t ret = 0;
- for (const auto& w : _graph_windows)
- if (w.second->is_visible())
+ for (const auto& w : _graph_windows) {
+ if (w.second->is_visible()) {
++ret;
+ }
+ }
return ret;
}
@@ -107,8 +111,9 @@ WindowFactory::graph_box(SPtr<const GraphModel> graph)
GraphWindow*
WindowFactory::graph_window(SPtr<const GraphModel> graph)
{
- if (!graph)
+ if (!graph) {
return nullptr;
+ }
GraphWindowMap::iterator w = _graph_windows.find(graph->path());
@@ -118,8 +123,9 @@ WindowFactory::graph_window(SPtr<const GraphModel> graph)
GraphWindow*
WindowFactory::parent_graph_window(SPtr<const BlockModel> block)
{
- if (!block)
+ if (!block) {
return nullptr;
+ }
return graph_window(dynamic_ptr_cast<GraphModel>(block->parent()));
}
@@ -184,8 +190,9 @@ WindowFactory::new_graph_window(SPtr<const GraphModel> graph,
bool
WindowFactory::remove_graph_window(GraphWindow* win, GdkEventAny* ignored)
{
- if (_graph_windows.size() <= 1)
+ if (_graph_windows.size() <= 1) {
return !_app.quit(win);
+ }
GraphWindowMap::iterator w = _graph_windows.find(win->graph()->path());
@@ -205,8 +212,9 @@ WindowFactory::present_load_plugin(SPtr<const GraphModel> graph,
GraphWindowMap::iterator w = _graph_windows.find(graph->path());
- if (w != _graph_windows.end())
+ if (w != _graph_windows.end()) {
_load_plugin_win->set_transient_for(*w->second);
+ }
_load_plugin_win->set_modal(false);
_load_plugin_win->set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
@@ -226,8 +234,9 @@ WindowFactory::present_load_graph(SPtr<const GraphModel> graph,
{
GraphWindowMap::iterator w = _graph_windows.find(graph->path());
- if (w != _graph_windows.end())
+ if (w != _graph_windows.end()) {
_load_graph_win->set_transient_for(*w->second);
+ }
_load_graph_win->present(graph, true, data);
}
@@ -238,8 +247,9 @@ WindowFactory::present_load_subgraph(SPtr<const GraphModel> graph,
{
GraphWindowMap::iterator w = _graph_windows.find(graph->path());
- if (w != _graph_windows.end())
+ if (w != _graph_windows.end()) {
_load_graph_win->set_transient_for(*w->second);
+ }
_load_graph_win->present(graph, false, data);
}
@@ -250,8 +260,9 @@ WindowFactory::present_new_subgraph(SPtr<const GraphModel> graph,
{
GraphWindowMap::iterator w = _graph_windows.find(graph->path());
- if (w != _graph_windows.end())
+ if (w != _graph_windows.end()) {
_new_subgraph_win->set_transient_for(*w->second);
+ }
_new_subgraph_win->present(graph, data);
}
@@ -260,11 +271,13 @@ void
WindowFactory::present_rename(SPtr<const ObjectModel> object)
{
GraphWindowMap::iterator w = _graph_windows.find(object->path());
- if (w == _graph_windows.end())
+ if (w == _graph_windows.end()) {
w = _graph_windows.find(object->path().parent());
+ }
- if (w != _graph_windows.end())
+ if (w != _graph_windows.end()) {
_rename_win->set_transient_for(*w->second);
+ }
_rename_win->present(object);
}
@@ -273,13 +286,16 @@ void
WindowFactory::present_properties(SPtr<const ObjectModel> object)
{
GraphWindowMap::iterator w = _graph_windows.find(object->path());
- if (w == _graph_windows.end())
+ if (w == _graph_windows.end()) {
w = _graph_windows.find(object->path().parent());
- if (w == _graph_windows.end())
+ }
+ if (w == _graph_windows.end()) {
w = _graph_windows.find(object->path().parent().parent());
+ }
- if (w != _graph_windows.end())
+ if (w != _graph_windows.end()) {
_properties_win->set_transient_for(*w->second);
+ }
_properties_win->present(object);
}
diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp
index 0e147642..b775d415 100644
--- a/src/ingen/ingen.cpp
+++ b/src/ingen/ingen.cpp
@@ -249,8 +249,9 @@ main(int argc, char** argv)
this_thread::sleep_for(chrono::milliseconds(500));
// Shut down
- if (world->engine())
+ if (world->engine()) {
world->engine()->deactivate();
+ }
// Save configuration to restore preferences on next run
const std::string path = conf.save(
diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp
index 3314eb46..62912a21 100644
--- a/src/server/BlockFactory.cpp
+++ b/src/server/BlockFactory.cpp
@@ -48,8 +48,9 @@ BlockFactory::BlockFactory(Ingen::World* world)
BlockFactory::~BlockFactory()
{
- for (auto& p : _plugins)
+ for (auto& p : _plugins) {
delete p.second;
+ }
_plugins.clear();
}
diff --git a/src/server/BlockImpl.cpp b/src/server/BlockImpl.cpp
index 36bf3e30..96ae0795 100644
--- a/src/server/BlockImpl.cpp
+++ b/src/server/BlockImpl.cpp
@@ -106,12 +106,15 @@ BlockImpl::prepare_poly(BufferFactory& bufs, uint32_t poly)
{
ThreadManager::assert_thread(THREAD_PRE_PROCESS);
- if (!_polyphonic)
+ if (!_polyphonic) {
poly = 1;
+ }
- if (_ports)
- for (uint32_t i = 0; i < _ports->size(); ++i)
+ if (_ports) {
+ for (uint32_t i = 0; i < _ports->size(); ++i) {
_ports->at(i)->prepare_poly(bufs, poly);
+ }
+ }
return true;
}
@@ -119,14 +122,17 @@ BlockImpl::prepare_poly(BufferFactory& bufs, uint32_t poly)
bool
BlockImpl::apply_poly(RunContext& context, uint32_t poly)
{
- if (!_polyphonic)
+ if (!_polyphonic) {
poly = 1;
+ }
_polyphony = poly;
- if (_ports)
- for (uint32_t i = 0; i < num_ports(); ++i)
+ if (_ports) {
+ for (uint32_t i = 0; i < num_ports(); ++i) {
_ports->at(i)->apply_poly(context, poly);
+ }
+ }
return true;
}
diff --git a/src/server/ControlBindings.cpp b/src/server/ControlBindings.cpp
index 5f97452a..454d2be1 100644
--- a/src/server/ControlBindings.cpp
+++ b/src/server/ControlBindings.cpp
@@ -252,8 +252,9 @@ ControlBindings::port_value_to_control(RunContext& context,
Type type,
const Atom& value_atom) const
{
- if (value_atom.type() != port->bufs().forge().Float)
+ if (value_atom.type() != port->bufs().forge().Float) {
return 0;
+ }
float min, max;
get_range(context, port, &min, &max);
diff --git a/src/server/GraphImpl.cpp b/src/server/GraphImpl.cpp
index 389fd182..bf1c99bf 100644
--- a/src/server/GraphImpl.cpp
+++ b/src/server/GraphImpl.cpp
@@ -221,8 +221,9 @@ GraphImpl::pre_process(RunContext& context)
void
GraphImpl::process(RunContext& context)
{
- if (!_process)
+ if (!_process) {
return;
+ }
pre_process(context);
run(context);
diff --git a/src/server/InputPort.cpp b/src/server/InputPort.cpp
index cfc43526..2baa8ff7 100644
--- a/src/server/InputPort.cpp
+++ b/src/server/InputPort.cpp
@@ -58,8 +58,9 @@ bool
InputPort::apply_poly(RunContext& context, uint32_t poly)
{
bool ret = PortImpl::apply_poly(context, poly);
- if (!ret)
+ if (!ret) {
poly = 1;
+ }
assert(_voices->size() >= poly);
diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp
index 0255c422..a4ae8e7b 100644
--- a/src/server/JackDriver.cpp
+++ b/src/server/JackDriver.cpp
@@ -108,8 +108,9 @@ JackDriver::attach(const std::string& server_name,
// Either server name not specified, or supplied server name does not exist
// Connect to default server
if (!_client) {
- if ((_client = jack_client_open(client_name.c_str(), JackNullOption, nullptr)))
+ if ((_client = jack_client_open(client_name.c_str(), JackNullOption, nullptr))) {
_engine.log().info("Connected to default Jack server\n");
+ }
}
// Still failed
@@ -150,9 +151,10 @@ JackDriver::activate()
return false;
}
- if (!_client)
+ if (!_client) {
attach(world->conf().option("jack-server").ptr<char>(),
world->conf().option("jack-name").ptr<char>(), nullptr);
+ }
if (!_client) {
return false;
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index 91490e69..05b76737 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -163,13 +163,15 @@ LV2Block::make_instance(URIs& uris,
bool
LV2Block::prepare_poly(BufferFactory& bufs, uint32_t poly)
{
- if (!_polyphonic)
+ if (!_polyphonic) {
poly = 1;
+ }
BlockImpl::prepare_poly(bufs, poly);
- if (_polyphony == poly)
+ if (_polyphony == poly) {
return true;
+ }
const SampleRate rate = bufs.engine().sample_rate();
assert(!_prepared_instances);
@@ -195,8 +197,9 @@ LV2Block::prepare_poly(BufferFactory& bufs, uint32_t poly)
bool
LV2Block::apply_poly(RunContext& context, uint32_t poly)
{
- if (!_polyphonic)
+ if (!_polyphonic) {
poly = 1;
+ }
if (_prepared_instances) {
_instances = std::move(_prepared_instances);
@@ -528,8 +531,9 @@ LV2Block::activate(BufferFactory& bufs)
{
BlockImpl::activate(bufs);
- for (uint32_t i = 0; i < _polyphony; ++i)
+ for (uint32_t i = 0; i < _polyphony; ++i) {
lilv_instance_activate(instance(i));
+ }
}
void
@@ -537,8 +541,9 @@ LV2Block::deactivate()
{
BlockImpl::deactivate();
- for (uint32_t i = 0; i < _polyphony; ++i)
+ for (uint32_t i = 0; i < _polyphony; ++i) {
lilv_instance_deactivate(instance(i));
+ }
}
LV2_Worker_Status
@@ -572,8 +577,9 @@ LV2Block::work(uint32_t size, const void* data)
void
LV2Block::run(RunContext& context)
{
- for (uint32_t i = 0; i < _polyphony; ++i)
+ for (uint32_t i = 0; i < _polyphony; ++i) {
lilv_instance_run(instance(i), context.nframes());
+ }
}
void
diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp
index cd29c0b1..4a4fd674 100644
--- a/src/server/LV2Plugin.cpp
+++ b/src/server/LV2Plugin.cpp
@@ -69,17 +69,19 @@ const Raul::Symbol
LV2Plugin::symbol() const
{
string working = uri();
- if (working.back() == '/')
+ if (working.back() == '/') {
working = working.substr(0, working.length() - 1);
+ }
while (working.length() > 0) {
size_t last_slash = working.find_last_of("/");
const string symbol = working.substr(last_slash+1);
if ( (symbol[0] >= 'a' && symbol[0] <= 'z')
- || (symbol[0] >= 'A' && symbol[0] <= 'Z') )
+ || (symbol[0] >= 'A' && symbol[0] <= 'Z') ) {
return Raul::Symbol::symbolify(symbol);
- else
+ } else {
working = working.substr(0, last_slash);
+ }
}
return Raul::Symbol("lv2_symbol");
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index a3abe825..e8486645 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -380,8 +380,9 @@ PortImpl::set_buffer_size(RunContext& context, BufferFactory& bufs, size_t size)
{
_buffer_size = size;
- for (uint32_t v = 0; v < _poly; ++v)
+ for (uint32_t v = 0; v < _poly; ++v) {
_voices->at(v).buffer->resize(size);
+ }
connect_buffers();
}
@@ -397,8 +398,9 @@ PortImpl::connect_buffers(SampleCount offset)
void
PortImpl::recycle_buffers()
{
- for (uint32_t v = 0; v < _poly; ++v)
+ for (uint32_t v = 0; v < _poly; ++v) {
_voices->at(v).buffer = nullptr;
+ }
}
void
@@ -548,8 +550,9 @@ PortImpl::pre_process(RunContext& context)
clear_buffers(context);
}
- for (uint32_t v = 0; v < _poly; ++v)
+ for (uint32_t v = 0; v < _poly; ++v) {
_voices->at(v).buffer->prepare_output_write(context);
+ }
}
void
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index e5ff8325..e120e610 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -102,8 +102,9 @@ Delta::Delta(Engine& engine,
Delta::~Delta()
{
- for (auto& s : _set_events)
+ for (auto& s : _set_events) {
delete s;
+ }
delete _create_event;
}
diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp
index 6d018c81..11311d12 100644
--- a/src/server/events/DisconnectAll.cpp
+++ b/src/server/events/DisconnectAll.cpp
@@ -66,8 +66,9 @@ DisconnectAll::DisconnectAll(Engine& engine,
DisconnectAll::~DisconnectAll()
{
- for (auto& i : _impls)
+ for (auto& i : _impls) {
delete i;
+ }
}
bool
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index 0366cbf0..36c735ce 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -157,8 +157,9 @@ ControllerNode::control(RunContext& context, uint8_t control_num, uint8_t val, F
if (log_port_val > 0.0f) {
// haaaaack, stupid negatives and logarithms
Sample log_offset = 0;
- if (min_port_val < 0)
+ if (min_port_val < 0) {
log_offset = fabs(min_port_val);
+ }
const Sample min = log(min_port_val + 1 + log_offset);
const Sample max = log(max_port_val + 1 + log_offset);
scaled_value = expf(nval * (max - min) + min) - 1 - log_offset;
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index 9b157d54..dc282417 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -130,13 +130,15 @@ NoteNode::NoteNode(InternalPlugin* plugin,
bool
NoteNode::prepare_poly(BufferFactory& bufs, uint32_t poly)
{
- if (!_polyphonic)
+ if (!_polyphonic) {
return true;
+ }
BlockImpl::prepare_poly(bufs, poly);
- if (_prepared_voices && poly <= _prepared_voices->size())
+ if (_prepared_voices && poly <= _prepared_voices->size()) {
return true;
+ }
_prepared_voices = bufs.maid().make_managed<Voices>(
poly, *_voices, Voice());
@@ -147,8 +149,9 @@ NoteNode::prepare_poly(BufferFactory& bufs, uint32_t poly)
bool
NoteNode::apply_poly(RunContext& context, uint32_t poly)
{
- if (!BlockImpl::apply_poly(context, poly))
+ if (!BlockImpl::apply_poly(context, poly)) {
return false;
+ }
if (_prepared_voices) {
assert(_polyphony <= _prepared_voices->size());
@@ -383,9 +386,11 @@ NoteNode::sustain_off(RunContext& context, FrameTime time)
_sustain = false;
- for (uint32_t i=0; i < _polyphony; ++i)
- if ((*_voices)[i].state == Voice::State::HOLDING)
+ for (uint32_t i=0; i < _polyphony; ++i) {
+ if ((*_voices)[i].state == Voice::State::HOLDING) {
free_voice(context, i, time);
+ }
+ }
}
void