summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-01 15:20:45 +0200
committerDavid Robillard <d@drobilla.net>2020-08-02 01:48:48 +0200
commit4ef41be9596cf997cd80175cfc7de2074a182d0d (patch)
tree33388d991953b7d1fae5a953e0fa08b545e99a41 /src/gui
parentdbb38be5ccda387ef458583b5a85c03b59a5e05c (diff)
downloadingen-4ef41be9596cf997cd80175cfc7de2074a182d0d.tar.gz
ingen-4ef41be9596cf997cd80175cfc7de2074a182d0d.tar.bz2
ingen-4ef41be9596cf997cd80175cfc7de2074a182d0d.zip
Use auto with casts and allocations to remove redundancy
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/GraphBox.cpp8
-rw-r--r--src/gui/GraphCanvas.cpp26
-rw-r--r--src/gui/GraphPortModule.cpp4
-rw-r--r--src/gui/GraphTreeWindow.cpp2
4 files changed, 20 insertions, 20 deletions
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index 7856932d..e457dfd8 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -426,7 +426,7 @@ GraphBox::show_status(const ObjectModel* model)
show_port_status(port, port->value());
} else if ((block = dynamic_cast<const BlockModel*>(model))) {
- const PluginModel* plugin = dynamic_cast<const PluginModel*>(block->plugin());
+ const auto* plugin = dynamic_cast<const PluginModel*>(block->plugin());
if (plugin) {
msg << fmt(" (%1%)", plugin->human_name());
}
@@ -442,7 +442,7 @@ GraphBox::show_port_status(const PortModel* port, const Atom& value)
const BlockModel* parent = dynamic_cast<const BlockModel*>(port->parent().get());
if (parent) {
- const PluginModel* plugin = dynamic_cast<const PluginModel*>(parent->plugin());
+ const auto* plugin = dynamic_cast<const PluginModel*>(parent->plugin());
if (plugin) {
const std::string& human_name = plugin->port_human_name(port->index());
if (!human_name.empty()) {
@@ -681,8 +681,8 @@ GraphBox::event_export_image()
}
}
- Gtk::CheckButton* bg_but = new Gtk::CheckButton("Draw _Background", true);
- Gtk::Alignment* extra = new Gtk::Alignment(1.0, 0.5, 0.0, 0.0);
+ auto* bg_but = new Gtk::CheckButton("Draw _Background", true);
+ auto* extra = new Gtk::Alignment(1.0, 0.5, 0.0, 0.0);
bg_but->set_active(true);
extra->add(*Gtk::manage(bg_but));
extra->show_all();
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp
index bb60caa5..969c3849 100644
--- a/src/gui/GraphCanvas.cpp
+++ b/src/gui/GraphCanvas.cpp
@@ -265,12 +265,12 @@ show_module_human_names(GanvNode* node, void* data)
bool b = *static_cast<bool*>(data);
if (GANV_IS_MODULE(node)) {
Ganv::Module* module = Glib::wrap(GANV_MODULE(node));
- NodeModule* nmod = dynamic_cast<NodeModule*>(module);
+ auto* nmod = dynamic_cast<NodeModule*>(module);
if (nmod) {
nmod->show_human_names(b);
}
- GraphPortModule* pmod = dynamic_cast<GraphPortModule*>(module);
+ auto* pmod = dynamic_cast<GraphPortModule*>(module);
if (pmod) {
pmod->show_human_names(b);
}
@@ -292,7 +292,7 @@ ensure_port_labels(GanvNode* node, void* data)
if (GANV_IS_MODULE(node)) {
Ganv::Module* module = Glib::wrap(GANV_MODULE(node));
for (Ganv::Port* p : *module) {
- ingen::gui::Port* port = dynamic_cast<ingen::gui::Port*>(p);
+ auto* port = dynamic_cast<ingen::gui::Port*>(p);
if (port) {
port->ensure_label();
}
@@ -393,7 +393,7 @@ GraphCanvas::get_port_view(const SPtr<PortModel>& port)
// Port on this graph
if (module) {
- GraphPortModule* ppm = dynamic_cast<GraphPortModule*>(module);
+ auto* ppm = dynamic_cast<GraphPortModule*>(module);
return ppm
? *ppm->begin()
: dynamic_cast<Ganv::Port*>(module);
@@ -401,7 +401,7 @@ GraphCanvas::get_port_view(const SPtr<PortModel>& port)
module = dynamic_cast<NodeModule*>(_views[port->parent()]);
if (module) {
for (auto* p : *module) {
- gui::Port* pv = dynamic_cast<gui::Port*>(p);
+ auto* pv = dynamic_cast<gui::Port*>(p);
if (pv && pv->model() == port) {
return pv;
}
@@ -437,7 +437,7 @@ GraphCanvas::disconnection(const SPtr<const ArcModel>& arc)
if (tail && head) {
remove_edge_between(tail, head);
if (arc->head()->is_a(_app.uris().lv2_AudioPort)) {
- gui::Port* const h = dynamic_cast<gui::Port*>(head);
+ auto* const h = dynamic_cast<gui::Port*>(head);
if (h) {
h->activity(_app.forge().make(0.0f)); // Reset peaks
}
@@ -572,12 +572,12 @@ destroy_node(GanvNode* node, void* data)
App* app = static_cast<App*>(data);
Ganv::Module* module = Glib::wrap(GANV_MODULE(node));
- NodeModule* node_module = dynamic_cast<NodeModule*>(module);
+ auto* node_module = dynamic_cast<NodeModule*>(module);
if (node_module) {
app->interface()->del(node_module->block()->uri());
} else {
- GraphPortModule* port_module = dynamic_cast<GraphPortModule*>(module);
+ auto* port_module = dynamic_cast<GraphPortModule*>(module);
if (port_module &&
strcmp(port_module->port()->path().symbol(), "control") &&
strcmp(port_module->port()->path().symbol(), "notify")) {
@@ -612,18 +612,18 @@ GraphCanvas::destroy_selection()
static void
serialise_node(GanvNode* node, void* data)
{
- Serialiser* serialiser = static_cast<Serialiser*>(data);
+ auto* serialiser = static_cast<Serialiser*>(data);
if (!GANV_IS_MODULE(node)) {
return;
}
Ganv::Module* module = Glib::wrap(GANV_MODULE(node));
- NodeModule* node_module = dynamic_cast<NodeModule*>(module);
+ auto* node_module = dynamic_cast<NodeModule*>(module);
if (node_module) {
serialiser->serialise(node_module->block());
} else {
- GraphPortModule* port_module = dynamic_cast<GraphPortModule*>(module);
+ auto* port_module = dynamic_cast<GraphPortModule*>(module);
if (port_module) {
serialiser->serialise(port_module->port());
}
@@ -633,12 +633,12 @@ serialise_node(GanvNode* node, void* data)
static void
serialise_arc(GanvEdge* arc, void* data)
{
- Serialiser* serialiser = static_cast<Serialiser*>(data);
+ auto* serialiser = static_cast<Serialiser*>(data);
if (!GANV_IS_EDGE(arc)) {
return;
}
- gui::Arc* garc = dynamic_cast<gui::Arc*>(Glib::wrap(GANV_EDGE(arc)));
+ auto* garc = dynamic_cast<gui::Arc*>(Glib::wrap(GANV_EDGE(arc)));
if (garc) {
serialiser->serialise_arc(Sord::Node(), garc->model());
}
diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp
index a80afe57..27babbfd 100644
--- a/src/gui/GraphPortModule.cpp
+++ b/src/gui/GraphPortModule.cpp
@@ -65,8 +65,8 @@ GraphPortModule::GraphPortModule(GraphCanvas& canvas,
GraphPortModule*
GraphPortModule::create(GraphCanvas& canvas, const SPtr<const PortModel>& model)
{
- GraphPortModule* ret = new GraphPortModule(canvas, model);
- Port* port = Port::create(canvas.app(), *ret, model, true);
+ auto* ret = new GraphPortModule(canvas, model);
+ Port* port = Port::create(canvas.app(), *ret, model, true);
ret->set_port(port);
if (model->is_numeric()) {
diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp
index dd80c906..f3d77c76 100644
--- a/src/gui/GraphTreeWindow.cpp
+++ b/src/gui/GraphTreeWindow.cpp
@@ -50,7 +50,7 @@ GraphTreeWindow::GraphTreeWindow(BaseObjectType* cobject,
_graphs_treeview->append_column(*name_col);
_graphs_treeview->append_column(*enabled_col);
- Gtk::CellRendererToggle* enabled_renderer = dynamic_cast<Gtk::CellRendererToggle*>(
+ auto* enabled_renderer = dynamic_cast<Gtk::CellRendererToggle*>(
_graphs_treeview->get_column_cell_renderer(1));
enabled_renderer->property_activatable() = true;