diff options
Diffstat (limited to 'gtk2_ardour/processor_box.cc')
-rw-r--r-- | gtk2_ardour/processor_box.cc | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index add816e40f..42711b4936 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -1242,11 +1242,27 @@ ProcessorBox::rename_processor (boost::shared_ptr<Processor> processor) case Gtk::RESPONSE_ACCEPT: name_prompter.get_result (result); if (result.length()) { - if (_session->route_by_name (result)) { - ARDOUR_UI::instance()->popup_error (_("A track already exists with that name.")); - return; - } - processor->set_name (result); + + int tries = 0; + string test = result; + + while (tries < 100) { + if (_session->io_name_is_legal (test)) { + result = test; + break; + } + tries++; + + test = string_compose ("%1-%2", result, tries); + } + + if (tries < 100) { + processor->set_name (result); + } else { + /* unlikely! */ + ARDOUR_UI::instance()->popup_error + (string_compose (_("At least 100 IO objects exist with a name like %1 - name not changed"), result)); + } } break; } |