diff options
author | David Robillard <d@drobilla.net> | 2008-08-13 21:38:13 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-08-13 21:38:13 +0000 |
commit | cc67a8d797a1b9ba05440f8abb60815aabe838dd (patch) | |
tree | 03c757b346ec5f5c00de004b497696b2e6715524 /src/libs/gui | |
parent | 3bc15f3e1fef153dd6f1898b981a409876c171ac (diff) | |
download | ingen-cc67a8d797a1b9ba05440f8abb60815aabe838dd.tar.gz ingen-cc67a8d797a1b9ba05440f8abb60815aabe838dd.tar.bz2 ingen-cc67a8d797a1b9ba05440f8abb60815aabe838dd.zip |
Fix new node default naming from both plugin window and patch context menu.
git-svn-id: http://svn.drobilla.net/lad/ingen@1355 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r-- | src/libs/gui/LoadPluginWindow.cpp | 21 | ||||
-rw-r--r-- | src/libs/gui/PatchCanvas.cpp | 10 |
2 files changed, 21 insertions, 10 deletions
diff --git a/src/libs/gui/LoadPluginWindow.cpp b/src/libs/gui/LoadPluginWindow.cpp index 76f5cdd4..fddb1396 100644 --- a/src/libs/gui/LoadPluginWindow.cpp +++ b/src/libs/gui/LoadPluginWindow.cpp @@ -148,7 +148,12 @@ LoadPluginWindow::name_changed() void LoadPluginWindow::set_patch(SharedPtr<PatchModel> patch) { - _patch = patch; + if (_patch) { + _patch = patch; + plugin_selection_changed(); + } else { + _patch = patch; + } /*if (patch->poly() <= 1) _polyphonic_checkbutton->property_sensitive() = false; @@ -272,13 +277,11 @@ LoadPluginWindow::plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeVi void LoadPluginWindow::plugin_selection_changed() { - _plugin_name_offset = 0; - - _node_name_entry->set_text(generate_module_name()); - - //Gtk::TreeModel::iterator iter = _selection->get_selected(); - //Gtk::TreeModel::Row row = *iter; - //const PluginModel* plugin = row.get_value(_plugins_columns._col_plugin_model); + Gtk::TreeModel::iterator iter = _selection->get_selected(); + Gtk::TreeModel::Row row = *iter; + boost::shared_ptr<PluginModel> p = row.get_value(_plugins_columns._col_plugin_model); + _plugin_name_offset = _patch->child_name_offset(p->default_node_name()); + _node_name_entry->set_text(generate_module_name(_plugin_name_offset)); } @@ -299,7 +302,7 @@ LoadPluginWindow::generate_module_name(int offset) Gtk::TreeModel::Row row = *iter; SharedPtr<PluginModel> plugin = row.get_value(_plugins_columns._col_plugin_model); std::stringstream ss; - ss << plugin->default_node_name(_patch); + ss << plugin->default_node_name(); if (offset != 0) ss << "_" << offset + 1; name = ss.str(); diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index 0cd82ecb..48ad1366 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -592,7 +592,15 @@ PatchCanvas::menu_add_port(const string& name, const string& type, bool is_outpu void PatchCanvas::load_plugin(SharedPtr<PluginModel> plugin) { - const Path& path = _patch->path().base() + plugin->default_node_name(_patch); + string name = plugin->default_node_name(); + unsigned offset = _patch->child_name_offset(name); + if (offset != 0) { + std::stringstream ss; + ss << name << "_" << offset; + name = ss.str(); + } + + const Path path = _patch->path().base() + name; // FIXME: polyphony? App::instance().engine()->create_node(path, plugin->uri(), false); GraphObject::Variables data = get_initial_data(); |