From ccdd99afcec1118c3a3080e6d109ebae55665336 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 10 Nov 2009 17:34:33 +0000 Subject: 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 --- gtk2_ardour/redirect_box.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'gtk2_ardour') 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) 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; } -- cgit v1.2.3