X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fplaylist_selector.cc;h=cc92d5d2befa267141e460f84f52deb38da70708;hb=8e1de17319efb316f6eebdbe1b25dd777a4d3e0e;hp=c8a9255c62a256ad48446eebada848e7f7a5f049;hpb=061a85191c301ac18f2e8ca59d43127a4499ba96;p=ardour.git diff --git a/gtk2_ardour/playlist_selector.cc b/gtk2_ardour/playlist_selector.cc index c8a9255c62..cc92d5d2be 100644 --- a/gtk2_ardour/playlist_selector.cc +++ b/gtk2_ardour/playlist_selector.cc @@ -20,12 +20,10 @@ #include -#include "ardour/session_playlist.h" -#include "ardour/audio_diskstream.h" -#include "ardour/playlist.h" #include "ardour/audio_track.h" #include "ardour/audioplaylist.h" -#include "ardour/configuration.h" +#include "ardour/playlist.h" +#include "ardour/session_playlist.h" #include @@ -33,7 +31,7 @@ #include "route_ui.h" #include "gui_thread.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace Gtk; @@ -42,18 +40,15 @@ using namespace ARDOUR; using namespace PBD; PlaylistSelector::PlaylistSelector () - : ArdourDialog ("playlist selector") + : ArdourDialog (_("Playlists")) { rui = 0; - set_position (WIN_POS_MOUSE); set_name ("PlaylistSelectorWindow"); set_modal(true); add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK); set_size_request (300, 200); - set_title (_("Playlists")); - model = TreeStore::create (columns); tree.set_model (model); tree.append_column (_("Playlists grouped by track"), columns.text); @@ -66,7 +61,7 @@ PlaylistSelector::PlaylistSelector () get_vbox()->pack_start (scroller); - Button* b = add_button (_("close"), RESPONSE_CANCEL); + Button* b = add_button (_("Close"), RESPONSE_CANCEL); b->signal_clicked().connect (sigc::mem_fun(*this, &PlaylistSelector::close_button_click)); } @@ -124,6 +119,14 @@ PlaylistSelector::show_for (RouteUI* ruix) boost::shared_ptr tr = boost::dynamic_pointer_cast (_session->route_by_id (x->first)); + /* legacy sessions stored the diskstream ID as the original + * playlist owner. so try there instead. + */ + + if (tr == 0) { + tr = _session->track_by_diskstream_id (x->first); + } + if (tr == 0) { continue; } @@ -139,7 +142,8 @@ PlaylistSelector::show_for (RouteUI* ruix) } TreeModel::Row row; - TreeModel::Row* selected_row = 0; + TreeModel::Row selected_row; + bool have_selected = false; TreePath this_path; if (tr == this_track) { @@ -167,12 +171,13 @@ PlaylistSelector::show_for (RouteUI* ruix) child_row[columns.playlist] = *p; if (*p == this_track->playlist()) { - selected_row = &child_row; + selected_row = child_row; + have_selected = true; } } - if (selected_row != 0) { - tree.get_selection()->select (*selected_row); + if (have_selected) { + tree.get_selection()->select (selected_row); } } @@ -181,7 +186,8 @@ PlaylistSelector::show_for (RouteUI* ruix) _session->playlists->unassigned (unassigned); TreeModel::Row row; - TreeModel::Row* selected_row = 0; + TreeModel::Row selected_row; + bool have_selected = false; TreePath this_path; row = *(model->append (others.children())); @@ -197,11 +203,12 @@ PlaylistSelector::show_for (RouteUI* ruix) child_row[columns.playlist] = *p; if (*p == this_track->playlist()) { - selected_row = &child_row; + selected_row = child_row; + have_selected = true; } - if (selected_row != 0) { - tree.get_selection()->select (*selected_row); + if (have_selected) { + tree.get_selection()->select (selected_row); } } @@ -224,8 +231,8 @@ PlaylistSelector::add_playlist_to_map (boost::shared_ptr pl) TrackPlaylistMap::iterator x; - if ((x = trpl_map.find (apl->get_orig_diskstream_id())) == trpl_map.end()) { - x = trpl_map.insert (trpl_map.end(), make_pair (apl->get_orig_diskstream_id(), new list >)); + if ((x = trpl_map.find (apl->get_orig_track_id())) == trpl_map.end()) { + x = trpl_map.insert (trpl_map.end(), make_pair (apl->get_orig_track_id(), new list >)); } x->second->push_back (pl);