diff options
author | David Robillard <d@drobilla.net> | 2017-12-25 15:26:48 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-12-25 16:26:13 -0500 |
commit | 15b3b0e9f8823752f80c7e597a70749813e61c79 (patch) | |
tree | 3f324c6e2a455be8b929456dadbf06520889d435 /src/gui | |
parent | d6a9571641bcb34acb3521feb08eea33195fd9ca (diff) | |
download | ingen-15b3b0e9f8823752f80c7e597a70749813e61c79.tar.gz ingen-15b3b0e9f8823752f80c7e597a70749813e61c79.tar.bz2 ingen-15b3b0e9f8823752f80c7e597a70749813e61c79.zip |
Always use braces
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/App.cpp | 15 | ||||
-rw-r--r-- | src/gui/BreadCrumbs.cpp | 37 | ||||
-rw-r--r-- | src/gui/ConnectWindow.cpp | 23 | ||||
-rw-r--r-- | src/gui/GraphBox.cpp | 52 | ||||
-rw-r--r-- | src/gui/GraphCanvas.cpp | 26 | ||||
-rw-r--r-- | src/gui/GraphPortModule.cpp | 3 | ||||
-rw-r--r-- | src/gui/GraphTreeWindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/GraphView.cpp | 6 | ||||
-rw-r--r-- | src/gui/GraphWindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/LoadGraphWindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.cpp | 23 | ||||
-rw-r--r-- | src/gui/NodeMenu.cpp | 16 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 18 | ||||
-rw-r--r-- | src/gui/ObjectMenu.cpp | 6 | ||||
-rw-r--r-- | src/gui/PluginMenu.cpp | 3 | ||||
-rw-r--r-- | src/gui/Port.cpp | 3 | ||||
-rw-r--r-- | src/gui/PortMenu.cpp | 6 | ||||
-rw-r--r-- | src/gui/ThreadedLoader.cpp | 5 | ||||
-rw-r--r-- | src/gui/WidgetFactory.cpp | 6 | ||||
-rw-r--r-- | src/gui/WindowFactory.cpp | 48 |
20 files changed, 212 insertions, 111 deletions
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); } |