diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 806ec3cd1c..f23f6b22f4 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -4330,13 +4330,13 @@ Editor::clear_playlists (TimeAxisView* v) void Editor::mapped_use_new_playlist (RouteTimeAxisView& atv, uint32_t sz, vector > const & playlists) { - atv.use_new_playlist (sz > 1 ? false : true, playlists); + atv.use_new_playlist (sz > 1 ? false : true, playlists, false); } void Editor::mapped_use_copy_playlist (RouteTimeAxisView& atv, uint32_t sz, vector > const & playlists) { - atv.use_copy_playlist (sz > 1 ? false : true, playlists); + atv.use_new_playlist (sz > 1 ? false : true, playlists, true); } void diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 7bb41cf8ec..24ed6bd556 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1182,62 +1182,7 @@ RouteTimeAxisView::resolve_new_group_playlist_name(std::string &basename, vector } void -RouteTimeAxisView::use_copy_playlist (bool prompt, vector > const & playlists_before_op) -{ - string name; - - boost::shared_ptr tr = track (); - if (!tr || tr->destructive()) { - return; - } - - boost::shared_ptr pl = tr->playlist(); - if (!pl) { - return; - } - - name = pl->name(); - - if (route_group() && route_group()->is_active() && route_group()->enabled_property (ARDOUR::Properties::group_select.property_id)) { - name = resolve_new_group_playlist_name(name, playlists_before_op); - } - - while (_session->playlists->by_name(name)) { - name = Playlist::bump_name (name, *_session); - } - - // TODO: The prompter "new" button should be de-activated if the user - // specifies a playlist name which already exists in the session. - - if (prompt) { - - ArdourPrompter prompter (true); - - prompter.set_title (_("New Copy Playlist")); - prompter.set_prompt (_("Name for new playlist:")); - prompter.set_initial_text (name); - prompter.add_button (Gtk::Stock::NEW, Gtk::RESPONSE_ACCEPT); - prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, true); - prompter.show_all (); - - switch (prompter.run ()) { - case Gtk::RESPONSE_ACCEPT: - prompter.get_result (name); - break; - - default: - return; - } - } - - if (name.length()) { - tr->use_copy_playlist (); - tr->playlist()->set_name (name); - } -} - -void -RouteTimeAxisView::use_new_playlist (bool prompt, vector > const & playlists_before_op) +RouteTimeAxisView::use_new_playlist (bool prompt, vector > const & playlists_before_op, bool copy) { string name; @@ -1261,29 +1206,47 @@ RouteTimeAxisView::use_new_playlist (bool prompt, vectorplaylists->by_name (name)) { + MessageDialog msg (_("Given playlist name is not unique.")); + msg.run (); + prompter.set_initial_text (Playlist::bump_name (name, *_session)); + } else { + break; + } + } } } if (name.length()) { - tr->use_new_playlist (); + if (copy) { + tr->use_new_playlist (); + } else { + tr->use_copy_playlist (); + } tr->playlist()->set_name (name); } } diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index 825a286360..1a26868b47 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -115,8 +115,7 @@ public: void fade_range (TimeSelection&); /* The editor calls these when mapping an operation across multiple tracks */ - void use_new_playlist (bool prompt, std::vector > const &); - void use_copy_playlist (bool prompt, std::vector > const &); + void use_new_playlist (bool prompt, std::vector > const &, bool copy); void clear_playlist (); /* group playlist name resolving */