summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-08-18 01:22:18 -0400
committerDavid Robillard <d@drobilla.net>2022-08-18 01:22:18 -0400
commit3af246bb3291d8568f6d110884fa55ee5fd20221 (patch)
tree434ac316050356e4db379ba8305b75285b17bbba /src/gui
parent44381dbda9dbf8d20894789fe8e3ea941b70a1d0 (diff)
downloadingen-3af246bb3291d8568f6d110884fa55ee5fd20221.tar.gz
ingen-3af246bb3291d8568f6d110884fa55ee5fd20221.tar.bz2
ingen-3af246bb3291d8568f6d110884fa55ee5fd20221.zip
Avoid "else" after "return", "break", and "continue"
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/.clang-tidy1
-rw-r--r--src/gui/App.cpp4
-rw-r--r--src/gui/BreadCrumbs.cpp8
-rw-r--r--src/gui/ConnectWindow.cpp16
-rw-r--r--src/gui/GraphCanvas.cpp16
-rw-r--r--src/gui/GraphTreeWindow.cpp4
-rw-r--r--src/gui/LoadGraphWindow.cpp4
-rw-r--r--src/gui/LoadPluginWindow.cpp4
-rw-r--r--src/gui/NodeModule.cpp12
-rw-r--r--src/gui/Port.cpp8
-rw-r--r--src/gui/PropertiesWindow.cpp35
-rw-r--r--src/gui/Style.cpp21
-rw-r--r--src/gui/WidgetFactory.cpp4
-rw-r--r--src/gui/WindowFactory.cpp4
14 files changed, 90 insertions, 51 deletions
diff --git a/src/gui/.clang-tidy b/src/gui/.clang-tidy
index 065c97b1..7f978910 100644
--- a/src/gui/.clang-tidy
+++ b/src/gui/.clang-tidy
@@ -1,7 +1,6 @@
Checks: >
*,
-*-avoid-c-arrays,
- -*-else-after-return,
-*-magic-numbers,
-*-named-parameter,
-*-narrowing-conversions,
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index 20d8898f..ff9636b9 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -317,7 +317,9 @@ App::property_change(const URI& subject,
{
if (subject != URI("ingen:/engine")) {
return;
- } else if (key == uris().param_sampleRate && value.type() == forge().Int) {
+ }
+
+ if (key == uris().param_sampleRate && value.type() == forge().Int) {
_sample_rate = value.get<int32_t>();
} else if (key == uris().bufsz_maxBlockLength && value.type() == forge().Int) {
_block_length = value.get<int32_t>();
diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp
index 0cd2c5ad..041c3f51 100644
--- a/src/gui/BreadCrumbs.cpp
+++ b/src/gui/BreadCrumbs.cpp
@@ -104,9 +104,9 @@ BreadCrumbs::build(const raul::Path& path,
but->show();
if (suffix.find('/') == string::npos) {
break;
- } else {
- suffix = suffix.substr(suffix.find('/') + 1);
}
+
+ suffix = suffix.substr(suffix.find('/') + 1);
}
for (const auto& b : _breadcrumbs) {
@@ -148,9 +148,9 @@ BreadCrumbs::build(const raul::Path& path,
but->show();
if (suffix.find('/') == string::npos) {
break;
- } else {
- suffix = suffix.substr(suffix.find('/')+1);
}
+
+ suffix = suffix.substr(suffix.find('/')+1);
}
}
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index a5e6fbd4..20e7d33e 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -215,10 +215,10 @@ ConnectWindow::connect(bool existing)
if (_app->client()) {
error("Already connected");
return;
- } else if (_attached) {
- _attached = false;
}
+ _attached = false;
+
set_connecting_widget_states();
_connect_stage = 0;
@@ -265,10 +265,14 @@ ConnectWindow::connect(bool existing)
if (!world.load_module("server")) {
error("Failed to load server module");
return;
- } else if (!world.load_module("jack")) {
+ }
+
+ if (!world.load_module("jack")) {
error("Failed to load jack module");
return;
- } else if (!world.engine()->activate()) {
+ }
+
+ if (!world.engine()->activate()) {
error("Failed to activate engine");
return;
}
@@ -556,9 +560,9 @@ ConnectWindow::gtk_callback()
_progress_label->set_text(std::string("Disconnected"));
}
return false;
- } else {
- return true;
}
+
+ return true;
}
void
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp
index 636a3d9f..5cd209de 100644
--- a/src/gui/GraphCanvas.cpp
+++ b/src/gui/GraphCanvas.cpp
@@ -436,14 +436,14 @@ GraphCanvas::get_port_view(const std::shared_ptr<PortModel>& port)
return ppm
? *ppm->begin()
: dynamic_cast<Ganv::Port*>(module);
- } else {
- module = dynamic_cast<NodeModule*>(_views[port->parent()]);
- if (module) {
- for (auto* p : *module) {
- auto* pv = dynamic_cast<gui::Port*>(p);
- if (pv && pv->model() == port) {
- return pv;
- }
+ }
+
+ module = dynamic_cast<NodeModule*>(_views[port->parent()]);
+ if (module) {
+ for (auto* p : *module) {
+ auto* pv = dynamic_cast<gui::Port*>(p);
+ if (pv && pv->model() == port) {
+ return pv;
}
}
}
diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp
index 7a787cb3..41ee92de 100644
--- a/src/gui/GraphTreeWindow.cpp
+++ b/src/gui/GraphTreeWindow.cpp
@@ -161,7 +161,9 @@ GraphTreeWindow::find_graph(Gtk::TreeModel::Children root,
std::shared_ptr<GraphModel> pm = (*c)[_graph_tree_columns.graph_model_col];
if (graph == pm) {
return c;
- } else if (!(*c)->children().empty()) {
+ }
+
+ if (!(*c)->children().empty()) {
auto ret = find_graph(c->children(), graph);
if (ret != c->children().end()) {
return ret;
diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp
index 7a80a2bf..b44a1fe7 100644
--- a/src/gui/LoadGraphWindow.cpp
+++ b/src/gui/LoadGraphWindow.cpp
@@ -251,9 +251,9 @@ LoadGraphWindow::avoid_symbol_clash(const raul::Symbol& symbol)
std::stringstream ss;
ss << symbol << "_" << offset;
return raul::Symbol(ss.str());
- } else {
- return symbol;
}
+
+ return symbol;
}
void
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index e147fdf2..c858efa1 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -515,9 +515,9 @@ LoadPluginWindow::on_key_press_event(GdkEventKey* event)
if (event->keyval == GDK_w && event->state & GDK_CONTROL_MASK) {
hide();
return true;
- } else {
- return Gtk::Window::on_key_press_event(event);
}
+
+ return Gtk::Window::on_key_press_event(event);
}
void
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index c80947cb..6905318a 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -408,9 +408,9 @@ NodeModule::popup_gui()
_gui_window->present();
return true;
- } else {
- app().log().warn("No LV2 GUI for %1%\n", _block->path());
}
+
+ app().log().warn("No LV2 GUI for %1%\n", _block->path());
}
return false;
@@ -449,9 +449,13 @@ NodeModule::on_event(GdkEvent* ev)
{
if (ev->type == GDK_BUTTON_PRESS && ev->button.button == 3) {
return show_menu(&ev->button);
- } else if (ev->type == GDK_2BUTTON_PRESS) {
+ }
+
+ if (ev->type == GDK_2BUTTON_PRESS) {
return on_double_click(&ev->button);
- } else if (ev->type == GDK_ENTER_NOTIFY) {
+ }
+
+ if (ev->type == GDK_ENTER_NOTIFY) {
GraphBox* const box = app().window_factory()->graph_box(
std::dynamic_pointer_cast<const GraphModel>(_block->parent()));
if (box) {
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 87cb3ef1..52f10edf 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -357,7 +357,9 @@ Port::on_event(GdkEvent* ev)
Gtk::Menu* menu = build_enum_menu();
menu->popup(ev->button.button, ev->button.time);
return true;
- } else if (model()->is_uri()) {
+ }
+
+ if (model()->is_uri()) {
Gtk::Menu* menu = build_uri_menu();
if (menu) {
menu->popup(ev->button.button, ev->button.time);
@@ -385,9 +387,9 @@ peak_color(float peak)
if (peak < 1.0f) {
return rgba_interpolate(min, max, peak);
- } else {
- return rgba_interpolate(peak_min, peak_max, fminf(peak, 2.0f) - 1.0f);
}
+
+ return rgba_interpolate(peak_min, peak_max, fminf(peak, 2.0f) - 1.0f);
}
void
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 3390c53e..15f1818e 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -184,16 +184,24 @@ PropertiesWindow::datatype_supported(const rdfs::URISet& types,
if (types.find(_app->uris().atom_Int) != types.end()) {
*widget_type = _app->uris().atom_Int;
return true;
- } else if (types.find(_app->uris().atom_Float) != types.end()) {
+ }
+
+ if (types.find(_app->uris().atom_Float) != types.end()) {
*widget_type = _app->uris().atom_Float;
return true;
- } else if (types.find(_app->uris().atom_Bool) != types.end()) {
+ }
+
+ if (types.find(_app->uris().atom_Bool) != types.end()) {
*widget_type = _app->uris().atom_Bool;
return true;
- } else if (types.find(_app->uris().atom_String) != types.end()) {
+ }
+
+ if (types.find(_app->uris().atom_String) != types.end()) {
*widget_type = _app->uris().atom_String;
return true;
- } else if (types.find(_app->uris().atom_URID) != types.end()) {
+ }
+
+ if (types.find(_app->uris().atom_URID) != types.end()) {
*widget_type = _app->uris().atom_URID;
return true;
}
@@ -332,7 +340,9 @@ PropertiesWindow::create_value_widget(const URI& key,
widget->signal_value_changed().connect(
sigc::bind(sigc::mem_fun(this, &PropertiesWindow::on_change), key));
return widget;
- } else if (type == _app->uris().atom_Float) {
+ }
+
+ if (type == _app->uris().atom_Float) {
Gtk::SpinButton* widget = manage(new Gtk::SpinButton(0.0, 4));
widget->property_numeric() = true;
widget->set_snap_to_ticks(false);
@@ -344,7 +354,9 @@ PropertiesWindow::create_value_widget(const URI& key,
widget->signal_value_changed().connect(
sigc::bind(sigc::mem_fun(this, &PropertiesWindow::on_change), key));
return widget;
- } else if (type == _app->uris().atom_Bool) {
+ }
+
+ if (type == _app->uris().atom_Bool) {
Gtk::CheckButton* widget = manage(new Gtk::CheckButton());
if (value.is_valid()) {
widget->set_active(value.get<int32_t>());
@@ -352,7 +364,9 @@ PropertiesWindow::create_value_widget(const URI& key,
widget->signal_toggled().connect(
sigc::bind(sigc::mem_fun(this, &PropertiesWindow::on_change), key));
return widget;
- } else if (type == _app->uris().atom_String) {
+ }
+
+ if (type == _app->uris().atom_String) {
Gtk::Entry* widget = manage(new Gtk::Entry());
if (value.is_valid()) {
widget->set_text(value.ptr<char>());
@@ -360,7 +374,9 @@ PropertiesWindow::create_value_widget(const URI& key,
widget->signal_changed().connect(
sigc::bind(sigc::mem_fun(this, &PropertiesWindow::on_change), key));
return widget;
- } else if (type == _app->uris().atom_URID) {
+ }
+
+ if (type == _app->uris().atom_URID) {
const char* str = (value.is_valid()
? world.uri_map().unmap_uri(value.get<int32_t>())
: "");
@@ -486,9 +502,8 @@ PropertiesWindow::get_value(LV2_URID type, Gtk::Widget* value_widget)
auto* uri_entry = dynamic_cast<URIEntry*>(value_widget);
if (uri_entry && URI::is_valid(uri_entry->get_text())) {
return _app->forge().make_urid(URI(uri_entry->get_text()));
- } else {
- _app->log().error("Invalid URI <%1%>\n", uri_entry->get_text());
}
+ _app->log().error("Invalid URI <%1%>\n", uri_entry->get_text());
} else if (type == forge.String) {
auto* entry = dynamic_cast<Gtk::Entry*>(value_widget);
if (entry) {
diff --git a/src/gui/Style.cpp b/src/gui/Style.cpp
index 7b9e4dc7..bce98648 100644
--- a/src/gui/Style.cpp
+++ b/src/gui/Style.cpp
@@ -69,17 +69,28 @@ uint32_t
Style::get_port_color(const client::PortModel* p)
{
const URIs& uris = _app.uris();
+
if (p->is_a(uris.lv2_AudioPort)) {
return _audio_port_color;
- } else if (p->is_a(uris.lv2_ControlPort)) {
+ }
+
+ if (p->is_a(uris.lv2_ControlPort)) {
return _control_port_color;
- } else if (p->is_a(uris.lv2_CVPort)) {
+ }
+
+ if (p->is_a(uris.lv2_CVPort)) {
return _cv_port_color;
- } else if (p->supports(uris.atom_String)) {
+ }
+
+ if (p->supports(uris.atom_String)) {
return _string_port_color;
- } else if (_app.can_control(p)) {
+ }
+
+ if (_app.can_control(p)) {
return _control_port_color;
- } else if (p->is_a(uris.atom_AtomPort)) {
+ }
+
+ if (p->is_a(uris.atom_AtomPort)) {
return _event_port_color;
}
diff --git a/src/gui/WidgetFactory.cpp b/src/gui/WidgetFactory.cpp
index 2bd7b5fd..597e0924 100644
--- a/src/gui/WidgetFactory.cpp
+++ b/src/gui/WidgetFactory.cpp
@@ -72,9 +72,9 @@ WidgetFactory::create(const std::string& toplevel_widget)
if (toplevel_widget.empty()) {
return Gtk::Builder::create_from_file(ui_filename);
- } else {
- return Gtk::Builder::create_from_file(ui_filename, toplevel_widget.c_str());
}
+
+ return Gtk::Builder::create_from_file(ui_filename, toplevel_widget.c_str());
}
} // namespace gui
diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp
index 973a236b..8928b664 100644
--- a/src/gui/WindowFactory.cpp
+++ b/src/gui/WindowFactory.cpp
@@ -109,9 +109,9 @@ WindowFactory::graph_box(const std::shared_ptr<const GraphModel>& graph)
GraphWindow* window = graph_window(graph);
if (window) {
return window->box();
- } else {
- return _main_box;
}
+
+ return _main_box;
}
GraphWindow*