diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-07-26 02:07:59 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-07-26 02:07:59 +0000 |
commit | df78f284ee2707154cd56b2b25340f2fe8a8b6d2 (patch) | |
tree | ba23556f15cfecc1b358f4f1df611989c609bc62 /gtk2_ardour | |
parent | fd384bf48e71b65ccd3858d10cc390c4128c469c (diff) |
fix up colons in track names before they are used for JACK port names; catch most (not all) attempted renames and ask the user about colons
git-svn-id: svn://localhost/ardour2/branches/3.0@9928 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/route_time_axis.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.cc | 45 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.h | 1 |
3 files changed, 45 insertions, 8 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 85601362c8..3836f4cf6c 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -195,7 +195,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt) rec_enable_button->set_sensitive (_session->writable()); } - + controls_hbox.pack_start(gm.get_level_meter(), false, false); _route->meter_change.connect (*this, invalidator (*this), bind (&RouteTimeAxisView::meter_changed, this), gui_context()); _route->input()->changed.connect (*this, invalidator (*this), ui_bind (&RouteTimeAxisView::io_changed, this, _1, _2), gui_context()); @@ -1322,7 +1322,10 @@ RouteTimeAxisView::name_entry_changed () PROGRAM_NAME)); name_entry.set_text (_route->name()); } else { - _route->set_name (x); + + if (RouteUI::verify_new_route_name (x)) { + _route->set_name (x); + } } } diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 8d4ed07398..d78102322b 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -1349,11 +1349,32 @@ RouteUI::idle_remove_this_route (RouteUI *rui) return false; } +bool +RouteUI::verify_new_route_name (const std::string& name) +{ + if (name.find (':')) { + MessageDialog colon_msg (_("The use of colons (':') is discouraged in track and bus names.\nDo you insist on using this?")); + colon_msg.add_button (Stock::CANCEL, RESPONSE_CANCEL); + switch (colon_msg.run()) { + case Gtk::RESPONSE_ACCEPT: + return true; + break; + default: + return false; + break; + } + } + + return true; +} + void RouteUI::route_rename () { ArdourPrompter name_prompter (true); string result; + bool done = false; + if (is_track()) { name_prompter.set_title (_("Rename Track")); } else { @@ -1365,13 +1386,25 @@ RouteUI::route_rename () name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false); name_prompter.show_all (); - switch (name_prompter.run ()) { - case Gtk::RESPONSE_ACCEPT: - name_prompter.get_result (result); - if (result.length()) { - _route->set_name (result); + while (!done) { + switch (name_prompter.run ()) { + case Gtk::RESPONSE_ACCEPT: + name_prompter.get_result (result); + name_prompter.hide (); + if (result.length()) { + if (verify_new_route_name (result)) { + _route->set_name (result); + done = true; + } else { + /* back to name prompter */ + } + + } else { + /* nothing entered, just get out of here */ + done = true; + } + break; } - break; } return; diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 9990fd14d0..9649d74634 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -220,6 +220,7 @@ class RouteUI : public virtual AxisView virtual void stop_step_editing() {} void set_invert_sensitive (bool); + bool verify_new_route_name (const std::string& name); private: void check_rec_enable_sensitivity (); |