mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
Playlist UI Tweaks: Fix some bugs related to old playlists without pgroup_ids
This commit is contained in:
parent
3b3473c6eb
commit
ba7237c152
2 changed files with 20 additions and 4 deletions
|
|
@ -2508,11 +2508,10 @@ RouteUI::build_playlist_menu ()
|
||||||
string text = (*i)->name();
|
string text = (*i)->name();
|
||||||
playlist_items.push_back (RadioMenuElem (playlist_group, text));
|
playlist_items.push_back (RadioMenuElem (playlist_group, text));
|
||||||
RadioMenuItem *item = static_cast<RadioMenuItem*>(&playlist_items.back());
|
RadioMenuItem *item = static_cast<RadioMenuItem*>(&playlist_items.back());
|
||||||
item->signal_toggled().connect(sigc::bind (sigc::mem_fun (*this, &RouteUI::use_playlist), item, boost::weak_ptr<Playlist> (*i)));
|
|
||||||
|
|
||||||
if (tr->playlist()->id() == (*i)->id()) {
|
if (tr->playlist()->id() == (*i)->id()) {
|
||||||
item->set_active();
|
item->set_active();
|
||||||
}
|
}
|
||||||
|
item->signal_toggled().connect(sigc::bind (sigc::mem_fun (*this, &RouteUI::use_playlist), item, boost::weak_ptr<Playlist> (*i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
playlist_items.push_back (SeparatorElem());
|
playlist_items.push_back (SeparatorElem());
|
||||||
|
|
@ -2581,6 +2580,13 @@ RouteUI::select_playlist_matching (boost::weak_ptr<Playlist> wpl)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (track()->id() == pl->get_orig_track_id()) {
|
||||||
|
/* this playlist is one of this track's own, no need to match by pgroup-id or name */
|
||||||
|
track()->use_playlist(track()->data_type(), pl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Search for a matching playlist .. either by pgroup_id or name */
|
||||||
std::string pgrp_id = pl->pgroup_id();
|
std::string pgrp_id = pl->pgroup_id();
|
||||||
boost::shared_ptr<Playlist> ipl = session()->playlists()->for_pgroup(pgrp_id, track()->id());
|
boost::shared_ptr<Playlist> ipl = session()->playlists()->for_pgroup(pgrp_id, track()->id());
|
||||||
if (ipl) {
|
if (ipl) {
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,11 @@ SessionPlaylists::n_playlists () const
|
||||||
boost::shared_ptr<Playlist>
|
boost::shared_ptr<Playlist>
|
||||||
SessionPlaylists::for_pgroup (string pgroup_id, const PBD::ID& id)
|
SessionPlaylists::for_pgroup (string pgroup_id, const PBD::ID& id)
|
||||||
{
|
{
|
||||||
|
if(pgroup_id.length()==0) {
|
||||||
|
/*matching empty pgroup-id's would be meaningless*/
|
||||||
|
return boost::shared_ptr<Playlist>();
|
||||||
|
}
|
||||||
|
|
||||||
Glib::Threads::Mutex::Lock lm (lock);
|
Glib::Threads::Mutex::Lock lm (lock);
|
||||||
|
|
||||||
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
|
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
|
||||||
|
|
@ -213,10 +218,15 @@ SessionPlaylists::for_pgroup (string pgroup_id, const PBD::ID& id)
|
||||||
std::vector<boost::shared_ptr<Playlist> >
|
std::vector<boost::shared_ptr<Playlist> >
|
||||||
SessionPlaylists::playlists_for_pgroup (std::string pgroup)
|
SessionPlaylists::playlists_for_pgroup (std::string pgroup)
|
||||||
{
|
{
|
||||||
Glib::Threads::Mutex::Lock lm (lock);
|
|
||||||
|
|
||||||
vector<boost::shared_ptr<Playlist> > pl_tr;
|
vector<boost::shared_ptr<Playlist> > pl_tr;
|
||||||
|
|
||||||
|
if(pgroup.length()==0) {
|
||||||
|
/*matching empty pgroup-id's would be meaningless*/
|
||||||
|
return pl_tr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Glib::Threads::Mutex::Lock lm (lock);
|
||||||
|
|
||||||
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
|
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
|
||||||
if ((*i)->pgroup_id().compare(pgroup)==0) {
|
if ((*i)->pgroup_id().compare(pgroup)==0) {
|
||||||
pl_tr.push_back (*i);
|
pl_tr.push_back (*i);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue