Playlist UI tweaks: Add pgroup_id field to playlists, to associate playlists created in the same operation (libardour)

This commit is contained in:
Ben Loftis 2021-05-30 07:09:38 -05:00
parent 32bf85502f
commit 28aa22e11a
4 changed files with 33 additions and 0 deletions

View file

@ -110,6 +110,9 @@ public:
bool set_name (const std::string& str);
void set_region_ownership ();
std::string pgroup_id() { return _pgroup_id; }
void set_pgroup_id(std::string pgid) { _pgroup_id = pgid; }
virtual void clear (bool with_signals = true);
virtual void dump () const;
@ -461,6 +464,8 @@ private:
samplepos_t _end_space; //this is used when we are pasting a range with extra space at the end
bool _playlist_shift_active;
std::string _pgroup_id; /*when we make multiple playlists in one action, they will share the same pgroup_id */
};
} /* namespace ARDOUR */

View file

@ -50,6 +50,7 @@ class LIBARDOUR_API SessionPlaylists : public PBD::ScopedConnectionList
public:
~SessionPlaylists ();
boost::shared_ptr<Playlist> for_pgroup (std::string name, const PBD::ID& for_track);
boost::shared_ptr<Playlist> by_name (std::string name);
boost::shared_ptr<Playlist> by_id (const PBD::ID&);
uint32_t source_use_count (boost::shared_ptr<const Source> src) const;

View file

@ -2331,6 +2331,8 @@ Playlist::set_state (const XMLNode& node, int version)
node.get_property (X_("orig-track-id"), _orig_track_id);
node.get_property (X_("frozen"), _frozen);
node.get_property (X_("pgroup-id"), _pgroup_id);
node.get_property (X_("combine-ops"), _combine_ops);
string shared_ids;
@ -2421,6 +2423,7 @@ Playlist::state (bool full_state)
node->set_property (X_("name"), name ());
node->set_property (X_("type"), _type);
node->set_property (X_("orig-track-id"), _orig_track_id);
node->set_property (X_("pgroup-id"), _pgroup_id);
string shared_ids;
list<PBD::ID>::const_iterator it = _shared_with_ids.begin ();

View file

@ -186,6 +186,30 @@ SessionPlaylists::n_playlists () const
return playlists.size();
}
boost::shared_ptr<Playlist>
SessionPlaylists::for_pgroup (string pgroup_id, const PBD::ID& id)
{
Glib::Threads::Mutex::Lock lm (lock);
for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
if ((*i)->pgroup_id() == pgroup_id) {
if ((*i)->get_orig_track_id() == id) {
return* i;
}
}
}
for (List::iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) {
if ((*i)->pgroup_id() == pgroup_id) {
if ((*i)->get_orig_track_id() == id) {
return* i;
}
}
}
return boost::shared_ptr<Playlist>();
}
boost::shared_ptr<Playlist>
SessionPlaylists::by_name (string name)
{