diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-11-10 17:34:33 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-11-10 17:34:33 +0000 |
commit | ccdd99afcec1118c3a3080e6d109ebae55665336 (patch) | |
tree | 270af57263cff23f1b3cecefd529af608ac5ae31 /gtk2_ardour | |
parent | 39a4068e36f632f2ff8abf99881d40e26d7e5183 (diff) |
when renaming redirects, scan all routes AND sends AND port inserts for the name to avoid JACK port duplicate names
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6052 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/redirect_box.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gtk2_ardour/redirect_box.cc b/gtk2_ardour/redirect_box.cc index c309809cef..cb6adb9224 100644 --- a/gtk2_ardour/redirect_box.cc +++ b/gtk2_ardour/redirect_box.cc @@ -925,12 +925,24 @@ RedirectBox::rename_redirect (boost::shared_ptr<Redirect> redirect) 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; + 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) { + redirect->set_name (result, this); + } else { + ARDOUR_UI::instance()->popup_error + (string_compose (_("At least 100 IO objects exist with a name like %1 - name not changed"), result)); } - - redirect->set_name (result, this); } break; } |