summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-14 20:44:56 +0100
committerDavid Robillard <d@drobilla.net>2020-12-14 22:04:29 +0100
commit1d3af34bd3ab9b55cdb610922aac39e62fdb13a9 (patch)
treeaaee6d674c3081c933ff33eb6d1269d87208bd49 /src
parentd10796d12fd477215fc024078c0f2d83abc6515e (diff)
downloadingen-1d3af34bd3ab9b55cdb610922aac39e62fdb13a9.tar.gz
ingen-1d3af34bd3ab9b55cdb610922aac39e62fdb13a9.tar.bz2
ingen-1d3af34bd3ab9b55cdb610922aac39e62fdb13a9.zip
Use "auto" to avoid redundancy
Diffstat (limited to 'src')
-rw-r--r--src/gui/NodeMenu.cpp2
-rw-r--r--src/gui/NodeModule.cpp13
-rw-r--r--src/gui/PropertiesWindow.cpp20
-rw-r--r--src/gui/URIEntry.cpp4
-rw-r--r--src/gui/ingen_gui_lv2.cpp8
5 files changed, 25 insertions, 22 deletions
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index 06a65834..944a3810 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -177,7 +177,7 @@ NodeMenu::on_menu_randomize()
float max = 1.0f;
bm->port_value_range(p, min, max, _app->sample_rate());
- const float r = static_cast<float>(g_random_double_range(0.0, 1.0));
+ const auto r = static_cast<float>(g_random_double_range(0.0, 1.0));
const float val = r * (max - min) + min;
_app->set_property(p->uri(),
_app->uris().ingen_value,
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 4eff5210..1b18958f 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -79,7 +79,7 @@ NodeModule::NodeModule(GraphCanvas& canvas,
signal_selected().connect(
sigc::mem_fun(this, &NodeModule::on_selected));
- const PluginModel* plugin = dynamic_cast<const PluginModel*>(block->plugin());
+ const auto* plugin = dynamic_cast<const PluginModel*>(block->plugin());
if (plugin) {
plugin->signal_changed().connect(
sigc::mem_fun(this, &NodeModule::plugin_changed));
@@ -182,7 +182,7 @@ NodeModule::show_human_names(bool b)
}
for (iterator i = begin(); i != end(); ++i) {
- ingen::gui::Port* const port = dynamic_cast<ingen::gui::Port*>(*i);
+ auto* const port = dynamic_cast<ingen::gui::Port*>(*i);
Glib::ustring label(port->model()->symbol().c_str());
if (b) {
const Atom& name_property = port->model()->get_property(uris.lv2_name);
@@ -272,7 +272,7 @@ NodeModule::embed_gui(bool embed)
if (!_plugin_ui->instantiate()) {
app().log().error("Failed to instantiate LV2 UI\n");
} else {
- GtkWidget* c_widget =
+ auto* c_widget =
static_cast<GtkWidget*>(_plugin_ui->get_widget());
_gui_widget = Glib::wrap(c_widget);
@@ -354,7 +354,9 @@ NodeModule::popup_gui()
return true;
}
- const PluginModel* const plugin = dynamic_cast<const PluginModel*>(_block->plugin());
+ const auto* const plugin =
+ dynamic_cast<const PluginModel*>(_block->plugin());
+
assert(plugin);
_plugin_ui = plugin->ui(app().world(), _block);
@@ -368,8 +370,7 @@ NodeModule::popup_gui()
return false;
}
- GtkWidget* c_widget =
- static_cast<GtkWidget*>(_plugin_ui->get_widget());
+ auto* c_widget = static_cast<GtkWidget*>(_plugin_ui->get_widget());
_gui_widget = Glib::wrap(c_widget);
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 36d0cefa..6abd6c06 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -117,10 +117,12 @@ PropertiesWindow::add_property(const URI& key, const Atom& value)
if (name.empty()) {
name = world.rdf_world()->prefixes().qualify(key);
}
- Gtk::Label* label = new Gtk::Label(
- std::string("<a href=\"") + key.string() + "\">" + name + "</a>",
- 1.0,
- 0.5);
+
+ auto* label = new Gtk::Label(std::string("<a href=\"") + key.string() +
+ "\">" + name + "</a>",
+ 1.0,
+ 0.5);
+
label->set_use_markup(true);
_app->set_tooltip(label, prop);
_table->attach(*Gtk::manage(label), 0, 1, n_rows, n_rows + 1,
@@ -438,29 +440,29 @@ PropertiesWindow::get_value(LV2_URID type, Gtk::Widget* value_widget)
Forge& forge = _app->forge();
if (type == forge.Int) {
- Gtk::SpinButton* spin = dynamic_cast<Gtk::SpinButton*>(value_widget);
+ auto* spin = dynamic_cast<Gtk::SpinButton*>(value_widget);
if (spin) {
return _app->forge().make(spin->get_value_as_int());
}
} else if (type == forge.Float) {
- Gtk::SpinButton* spin = dynamic_cast<Gtk::SpinButton*>(value_widget);
+ auto* spin = dynamic_cast<Gtk::SpinButton*>(value_widget);
if (spin) {
return _app->forge().make(static_cast<float>(spin->get_value()));
}
} else if (type == forge.Bool) {
- Gtk::CheckButton* check = dynamic_cast<Gtk::CheckButton*>(value_widget);
+ auto* check = dynamic_cast<Gtk::CheckButton*>(value_widget);
if (check) {
return _app->forge().make(check->get_active());
}
} else if (type == forge.URI || type == forge.URID) {
- URIEntry* uri_entry = dynamic_cast<URIEntry*>(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());
}
} else if (type == forge.String) {
- Gtk::Entry* entry = dynamic_cast<Gtk::Entry*>(value_widget);
+ auto* entry = dynamic_cast<Gtk::Entry*>(value_widget);
if (entry) {
return _app->forge().alloc(entry->get_text());
}
diff --git a/src/gui/URIEntry.cpp b/src/gui/URIEntry.cpp
index 9d5249e8..9de9f7ce 100644
--- a/src/gui/URIEntry.cpp
+++ b/src/gui/URIEntry.cpp
@@ -46,7 +46,7 @@ URIEntry::build_value_menu()
{
World& world = _app->world();
LilvWorld* lworld = world.lilv_world();
- Gtk::Menu* menu = new Gtk::Menu();
+ auto* menu = new Gtk::Menu();
LilvNode* owl_onDatatype = lilv_new_uri(lworld, LILV_NS_OWL "onDatatype");
LilvNode* rdf_type = lilv_new_uri(lworld, LILV_NS_RDF "type");
@@ -110,7 +110,7 @@ URIEntry::build_subclass_menu(const LilvNode* klass)
return nullptr;
}
- Gtk::Menu* menu = new Gtk::Menu();
+ auto* menu = new Gtk::Menu();
// Add "header" item for choosing this class itself
add_leaf_menu_item(menu, klass, rdfs::label(world, klass));
diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp
index 35e74f7d..6d6f9cee 100644
--- a/src/gui/ingen_gui_lv2.cpp
+++ b/src/gui/ingen_gui_lv2.cpp
@@ -108,7 +108,7 @@ instantiate(const LV2UI_Descriptor* descriptor,
{
ingen::set_bundle_path(bundle_path);
- ingen::IngenLV2UI* ui = new ingen::IngenLV2UI();
+ auto* ui = new ingen::IngenLV2UI();
LV2_URID_Map* map = nullptr;
LV2_URID_Unmap* unmap = nullptr;
@@ -177,7 +177,7 @@ instantiate(const LV2UI_Descriptor* descriptor,
static void
cleanup(LV2UI_Handle handle)
{
- ingen::IngenLV2UI* ui = static_cast<ingen::IngenLV2UI*>(handle);
+ auto* ui = static_cast<ingen::IngenLV2UI*>(handle);
delete ui;
}
@@ -188,8 +188,8 @@ port_event(LV2UI_Handle handle,
uint32_t format,
const void* buffer)
{
- ingen::IngenLV2UI* ui = static_cast<ingen::IngenLV2UI*>(handle);
- const LV2_Atom* atom = static_cast<const LV2_Atom*>(buffer);
+ auto* ui = static_cast<ingen::IngenLV2UI*>(handle);
+ const auto* atom = static_cast<const LV2_Atom*>(buffer);
ui->reader->write(atom);
}