diff options
author | David Robillard <d@drobilla.net> | 2018-01-21 00:41:34 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-01-21 00:41:34 +0100 |
commit | 90fca083052880479ad90d870e556f0648e32106 (patch) | |
tree | d99d4aa6f7f519d59b0d262dbc1f5451afff07d1 /src/gui | |
parent | e84092a7acee6c4d1493cbdd23ec5676b923f44d (diff) | |
download | ingen-90fca083052880479ad90d870e556f0648e32106.tar.gz ingen-90fca083052880479ad90d870e556f0648e32106.tar.bz2 ingen-90fca083052880479ad90d870e556f0648e32106.zip |
Replace insert(make_pair(...)) with emplace
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/GraphBox.cpp | 4 | ||||
-rw-r--r-- | src/gui/GraphCanvas.cpp | 43 | ||||
-rw-r--r-- | src/gui/LoadGraphWindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.cpp | 11 | ||||
-rw-r--r-- | src/gui/NewSubgraphWindow.cpp | 9 | ||||
-rw-r--r-- | src/gui/ObjectMenu.cpp | 5 | ||||
-rw-r--r-- | src/gui/PluginMenu.cpp | 4 | ||||
-rw-r--r-- | src/gui/PropertiesWindow.cpp | 13 | ||||
-rw-r--r-- | src/gui/RDFS.cpp | 4 | ||||
-rw-r--r-- | src/gui/URIEntry.cpp | 4 | ||||
-rw-r--r-- | src/gui/ingen_gui_lv2.cpp | 4 |
11 files changed, 45 insertions, 62 deletions
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 5504b964..def101a7 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -889,8 +889,8 @@ GraphBox::event_sprung_layout_toggled() _view->canvas()->set_sprung_layout(sprung); Properties properties; - properties.insert(make_pair(_app->uris().ingen_sprungLayout, - _app->forge().make(sprung))); + properties.emplace(_app->uris().ingen_sprungLayout, + _app->forge().make(sprung)); _app->interface()->put(_graph->uri(), properties); } diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 3078e347..4c7c34c8 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -338,7 +338,7 @@ GraphCanvas::add_block(SPtr<const BlockModel> bm) } module->show(); - _views.insert(std::make_pair(bm, module)); + _views.emplace(bm, module); if (_pastees.find(bm->path()) != _pastees.end()) { module->set_selected(true); } @@ -363,7 +363,7 @@ void GraphCanvas::add_port(SPtr<const PortModel> pm) { GraphPortModule* view = GraphPortModule::create(*this, pm); - _views.insert(std::make_pair(pm, view)); + _views.emplace(pm, view); view->show(); } @@ -803,19 +803,16 @@ GraphCanvas::menu_add_port(const string& sym_base, const string& name_base, const URIs& uris = _app.uris(); Properties props = get_initial_data(Resource::Graph::INTERNAL); - props.insert(make_pair(uris.rdf_type, _app.forge().make_urid(type))); + props.emplace(uris.rdf_type, _app.forge().make_urid(type)); if (type == uris.atom_AtomPort) { - props.insert(make_pair(uris.atom_bufferType, - Property(uris.atom_Sequence))); - } - props.insert(make_pair(uris.rdf_type, - Property(is_output - ? uris.lv2_OutputPort - : uris.lv2_InputPort))); - props.insert(make_pair(uris.lv2_index, - _app.forge().make(int32_t(_graph->num_ports())))); - props.insert(make_pair(uris.lv2_name, - _app.forge().alloc(name.c_str()))); + props.emplace(uris.atom_bufferType, Property(uris.atom_Sequence)); + } + props.emplace( + uris.rdf_type, + Property(is_output ? uris.lv2_OutputPort : uris.lv2_InputPort)); + props.emplace(uris.lv2_index, + _app.forge().make(int32_t(_graph->num_ports()))); + props.emplace(uris.lv2_name, _app.forge().alloc(name.c_str())); _app.interface()->put(path_to_uri(path), props); } @@ -840,10 +837,8 @@ GraphCanvas::load_plugin(WPtr<PluginModel> weak_plugin) // FIXME: polyphony? Properties props = get_initial_data(); - props.insert(make_pair(uris.rdf_type, - Property(uris.ingen_Block))); - props.insert(make_pair(uris.lv2_prototype, - uris.forge.make_urid(plugin->uri()))); + props.emplace(uris.rdf_type, Property(uris.ingen_Block)); + props.emplace(uris.lv2_prototype, uris.forge.make_urid(plugin->uri())); _app.interface()->put(path_to_uri(path), props); } @@ -864,14 +859,10 @@ GraphCanvas::get_initial_data(Resource::Graph ctx) { Properties result; const URIs& uris = _app.uris(); - result.insert( - make_pair(uris.ingen_canvasX, - Property(_app.forge().make((float)_menu_x), - ctx))); - result.insert( - make_pair(uris.ingen_canvasY, - Property(_app.forge().make((float)_menu_y), - ctx))); + result.emplace(uris.ingen_canvasX, + Property(_app.forge().make((float)_menu_x), ctx)); + result.emplace(uris.ingen_canvasY, + Property(_app.forge().make((float)_menu_y), ctx)); return result; } diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp index 28eb633a..10ddf436 100644 --- a/src/gui/LoadGraphWindow.cpp +++ b/src/gui/LoadGraphWindow.cpp @@ -156,9 +156,9 @@ LoadGraphWindow::ok_clicked() const URIs& uris = _app->uris(); if (_poly_voices_radio->get_active()) { - _initial_data.insert( - make_pair(uris.ingen_polyphony, - _app->forge().make(_poly_spinbutton->get_value_as_int()))); + _initial_data.emplace( + uris.ingen_polyphony, + _app->forge().make(_poly_spinbutton->get_value_as_int())); } if (get_uri() == "") { diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 65f09226..0eb65f8d 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -309,7 +309,7 @@ LoadPluginWindow::add_plugin(SPtr<const PluginModel> plugin) Gtk::TreeModel::iterator iter = _plugins_liststore->append(); Gtk::TreeModel::Row row = *iter; - _rows.insert(make_pair(plugin->uri(), iter)); + _rows.emplace(plugin->uri(), iter); set_row(row, plugin); @@ -398,12 +398,9 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) } else { Raul::Path path = _graph->path().child(Raul::Symbol::symbolify(name)); Properties props = _initial_data; - props.insert(make_pair(uris.rdf_type, - Property(uris.ingen_Block))); - props.insert(make_pair(uris.lv2_prototype, - _app->forge().make_urid(plugin->uri()))); - props.insert(make_pair(uris.ingen_polyphonic, - _app->forge().make(polyphonic))); + props.emplace(uris.rdf_type, Property(uris.ingen_Block)); + props.emplace(uris.lv2_prototype, _app->forge().make_urid(plugin->uri())); + props.emplace(uris.ingen_polyphonic, _app->forge().make(polyphonic)); _app->interface()->put(path_to_uri(path), props); if (_selection->get_selected_rows().size() == 1) { diff --git a/src/gui/NewSubgraphWindow.cpp b/src/gui/NewSubgraphWindow.cpp index 03455adc..f9dc8fc4 100644 --- a/src/gui/NewSubgraphWindow.cpp +++ b/src/gui/NewSubgraphWindow.cpp @@ -94,16 +94,15 @@ NewSubgraphWindow::ok_clicked() // Create graph Properties props; - props.insert(make_pair(_app->uris().rdf_type, Property(_app->uris().ingen_Graph))); - props.insert(make_pair(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly)))); - props.insert(make_pair(_app->uris().ingen_enabled, _app->forge().make(bool(true)))); + props.emplace(_app->uris().rdf_type, Property(_app->uris().ingen_Graph)); + props.emplace(_app->uris().ingen_polyphony, _app->forge().make(int32_t(poly))); + props.emplace(_app->uris().ingen_enabled, _app->forge().make(bool(true))); _app->interface()->put( path_to_uri(path), props, Resource::Graph::INTERNAL); // Set external (block perspective) properties props = _initial_data; - props.insert(make_pair(_app->uris().rdf_type, - Property(_app->uris().ingen_Graph))); + props.emplace(_app->uris().rdf_type, Property(_app->uris().ingen_Graph)); _app->interface()->put( path_to_uri(path), _initial_data, Resource::Graph::EXTERNAL); diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index c8ef9460..c113cac9 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -102,9 +102,8 @@ void ObjectMenu::on_menu_unlearn() { Properties remove; - remove.insert(std::make_pair( - _app->uris().midi_binding, - Property(_app->uris().patch_wildcard))); + remove.emplace(_app->uris().midi_binding, + Property(_app->uris().patch_wildcard)); _app->interface()->delta(_object->uri(), remove, Properties()); } diff --git a/src/gui/PluginMenu.cpp b/src/gui/PluginMenu.cpp index e512d587..fc385773 100644 --- a/src/gui/PluginMenu.cpp +++ b/src/gui/PluginMenu.cpp @@ -48,7 +48,7 @@ PluginMenu::clear() if (!p) { p = lilv_plugin_class_get_uri(lv2_plugin); } - children.insert(std::make_pair(lilv_node_as_string(p), c)); + children.emplace(lilv_node_as_string(p), c); } std::set<const char*> ancestors; @@ -128,7 +128,7 @@ PluginMenu::build_plugin_class_menu(Gtk::Menu* menu, size_t num_child_items = build_plugin_class_menu( submenu, c, classes, children, ancestors); - _class_menus.insert(std::make_pair(sub_uri_str, MenuRecord(menu_item, submenu))); + _class_menus.emplace(sub_uri_str, MenuRecord(menu_item, submenu)); if (num_child_items == 0) { menu_item->hide(); } diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 31e0aff4..db939b73 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -136,7 +136,7 @@ PropertiesWindow::add_property(const Raul::URI& key, const Atom& value) Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); _table->attach(*present, 2, 3, n_rows, n_rows + 1, Gtk::FILL, Gtk::SHRINK); - _records.insert(make_pair(key, Record(value, align, n_rows, present))); + _records.emplace(key, Record(value, align, n_rows, present)); _table->show_all(); lilv_node_free(prop); @@ -230,12 +230,12 @@ PropertiesWindow::set_object(SPtr<const ObjectModel> model) RDFS::datatypes(_app->world(), ranges, false); Raul::URI widget_type("urn:nothing"); if (datatype_supported(ranges, &widget_type)) { - entries.insert(std::make_pair(label, p)); + entries.emplace(label, p); } } else { // Range is presumably a class, show if any instances are known if (class_supported(ranges)) { - entries.insert(std::make_pair(label, p)); + entries.emplace(label, p); } } } @@ -542,8 +542,7 @@ PropertiesWindow::add_clicked() if (value.is_valid()) { // Send property to engine Properties properties; - properties.insert(make_pair(Raul::URI(key_uri.c_str()), - Property(value))); + properties.emplace(Raul::URI(key_uri.c_str()), Property(value)); _app->interface()->put(_model->uri(), properties); } } @@ -565,10 +564,10 @@ PropertiesWindow::apply_clicked() const Record& record = r.second; if (record.present_button->get_active()) { if (!_model->has_property(uri, record.value)) { - add.insert(make_pair(uri, record.value)); + add.emplace(uri, record.value); } } else { - remove.insert(make_pair(uri, record.value)); + remove.emplace(uri, record.value); } } diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp index 1a5e190a..b524aed7 100644 --- a/src/gui/RDFS.cpp +++ b/src/gui/RDFS.cpp @@ -210,9 +210,7 @@ instances(World* world, const URISet& types) continue; } const std::string label = RDFS::label(world, object); - result.insert( - std::make_pair(label, - Raul::URI(lilv_node_as_string(object)))); + result.emplace(label, Raul::URI(lilv_node_as_string(object))); } lilv_node_free(type); } diff --git a/src/gui/URIEntry.cpp b/src/gui/URIEntry.cpp index 30e6edb2..3c236572 100644 --- a/src/gui/URIEntry.cpp +++ b/src/gui/URIEntry.cpp @@ -120,11 +120,11 @@ URIEntry::build_subclass_menu(const LilvNode* klass) std::map<std::string, const LilvNode*> entries; LILV_FOREACH(nodes, s, subclasses) { const LilvNode* node = lilv_nodes_get(subclasses, s); - entries.insert(std::make_pair(RDFS::label(world, node), node)); + entries.emplace(RDFS::label(world, node), node); } LILV_FOREACH(nodes, s, subtypes) { const LilvNode* node = lilv_nodes_get(subtypes, s); - entries.insert(std::make_pair(RDFS::label(world, node), node)); + entries.emplace(RDFS::label(world, node), node); } // Add an item (possibly with a submenu) for each subclass/type diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 01ddc23e..57881741 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -145,8 +145,8 @@ instantiate(const LV2UI_Descriptor* descriptor, // Create empty root graph model Ingen::Properties props; - props.insert(std::make_pair(ui->app->uris().rdf_type, - Ingen::Property(ui->app->uris().ingen_Graph))); + props.emplace(ui->app->uris().rdf_type, + Ingen::Property(ui->app->uris().ingen_Graph)); ui->app->store()->put(Ingen::main_uri(), props); // Create a GraphBox for the root and set as the UI widget |