Add option to insert time on all a track's playlists (#4304).
git-svn-id: svn://localhost/ardour2/branches/3.0@10054 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
e3692bf3da
commit
24a38b8b08
|
@ -1130,7 +1130,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
void fork_region ();
|
||||
|
||||
void do_insert_time ();
|
||||
void insert_time (framepos_t, framecnt_t, Editing::InsertTimeOption, bool, bool, bool, bool, bool);
|
||||
void insert_time (framepos_t, framecnt_t, Editing::InsertTimeOption, bool, bool, bool, bool, bool, bool);
|
||||
|
||||
void tab_to_transient (bool forward);
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "ardour/strip_silence.h"
|
||||
#include "ardour/route_group.h"
|
||||
#include "ardour/operations.h"
|
||||
#include "ardour/session_playlists.h"
|
||||
|
||||
#include "ardour_ui.h"
|
||||
#include "debug.h"
|
||||
|
@ -6177,6 +6178,7 @@ Editor::do_insert_time ()
|
|||
get_preferred_edit_position(),
|
||||
d.distance(),
|
||||
opt,
|
||||
d.all_playlists(),
|
||||
d.move_glued(),
|
||||
d.move_markers(),
|
||||
d.move_glued_markers(),
|
||||
|
@ -6186,8 +6188,10 @@ Editor::do_insert_time ()
|
|||
}
|
||||
|
||||
void
|
||||
Editor::insert_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
|
||||
bool ignore_music_glue, bool markers_too, bool glued_markers_too, bool locked_markers_too, bool tempo_too)
|
||||
Editor::insert_time (
|
||||
framepos_t pos, framecnt_t frames, InsertTimeOption opt,
|
||||
bool all_playlists, bool ignore_music_glue, bool markers_too, bool glued_markers_too, bool locked_markers_too, bool tempo_too
|
||||
)
|
||||
{
|
||||
bool commit = false;
|
||||
|
||||
|
@ -6198,25 +6202,37 @@ Editor::insert_time (framepos_t pos, framecnt_t frames, InsertTimeOption opt,
|
|||
begin_reversible_command (_("insert time"));
|
||||
|
||||
for (TrackSelection::iterator x = selection->tracks.begin(); x != selection->tracks.end(); ++x) {
|
||||
|
||||
/* regions */
|
||||
boost::shared_ptr<Playlist> pl = (*x)->playlist();
|
||||
|
||||
if (pl) {
|
||||
vector<boost::shared_ptr<Playlist> > pl;
|
||||
if (all_playlists) {
|
||||
RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*x);
|
||||
if (rtav) {
|
||||
pl = _session->playlists->playlists_for_track (rtav->track ());
|
||||
}
|
||||
} else {
|
||||
if ((*x)->playlist ()) {
|
||||
pl.push_back ((*x)->playlist ());
|
||||
}
|
||||
}
|
||||
|
||||
pl->clear_changes ();
|
||||
pl->clear_owned_changes ();
|
||||
for (vector<boost::shared_ptr<Playlist> >::iterator i = pl.begin(); i != pl.end(); ++i) {
|
||||
|
||||
(*i)->clear_changes ();
|
||||
(*i)->clear_owned_changes ();
|
||||
|
||||
if (opt == SplitIntersected) {
|
||||
pl->split (pos);
|
||||
(*i)->split (pos);
|
||||
}
|
||||
|
||||
pl->shift (pos, frames, (opt == MoveIntersected), ignore_music_glue);
|
||||
(*i)->shift (pos, frames, (opt == MoveIntersected), ignore_music_glue);
|
||||
|
||||
vector<Command*> cmds;
|
||||
pl->rdiff (cmds);
|
||||
(*i)->rdiff (cmds);
|
||||
_session->add_commands (cmds);
|
||||
|
||||
_session->add_command (new StatefulDiffCommand (pl));
|
||||
_session->add_command (new StatefulDiffCommand (*i));
|
||||
commit = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,6 +62,9 @@ InsertTimeDialog::InsertTimeDialog (PublicEditor& e)
|
|||
|
||||
get_vbox()->pack_start (*table);
|
||||
|
||||
_all_playlists.set_label (_("Insert time on all the track's playlists"));
|
||||
get_vbox()->pack_start (_all_playlists);
|
||||
|
||||
_move_glued.set_label (_("Move glued regions"));
|
||||
get_vbox()->pack_start (_move_glued);
|
||||
_move_markers.set_label (_("Move markers"));
|
||||
|
@ -108,6 +111,12 @@ InsertTimeDialog::intersected_region_action ()
|
|||
return opt;
|
||||
}
|
||||
|
||||
bool
|
||||
InsertTimeDialog::all_playlists () const
|
||||
{
|
||||
return _all_playlists.get_active ();
|
||||
}
|
||||
|
||||
bool
|
||||
InsertTimeDialog::move_glued () const
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
InsertTimeDialog (PublicEditor &);
|
||||
|
||||
Editing::InsertTimeOption intersected_region_action ();
|
||||
bool all_playlists () const;
|
||||
bool move_glued () const;
|
||||
bool move_markers () const;
|
||||
bool move_glued_markers () const;
|
||||
|
@ -40,6 +41,7 @@ private:
|
|||
|
||||
PublicEditor& _editor;
|
||||
Gtk::ComboBoxText _intersected_combo;
|
||||
Gtk::CheckButton _all_playlists;
|
||||
Gtk::CheckButton _move_glued;
|
||||
Gtk::CheckButton _move_markers;
|
||||
Gtk::CheckButton _move_glued_markers;
|
||||
|
|
|
@ -1465,18 +1465,10 @@ RouteTimeAxisView::build_playlist_menu ()
|
|||
playlist_action_menu->set_name ("ArdourContextMenu");
|
||||
playlist_items.clear();
|
||||
|
||||
vector<boost::shared_ptr<Playlist> > playlists, playlists_tr;
|
||||
boost::shared_ptr<Track> tr = track();
|
||||
RadioMenuItem::Group playlist_group;
|
||||
boost::shared_ptr<Track> tr = track ();
|
||||
|
||||
_session->playlists->get (playlists);
|
||||
|
||||
/* find the playlists for this diskstream */
|
||||
for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
|
||||
if (((*i)->get_orig_diskstream_id() == tr->diskstream_id()) || (tr->playlist()->id() == (*i)->id())) {
|
||||
playlists_tr.push_back(*i);
|
||||
}
|
||||
}
|
||||
vector<boost::shared_ptr<Playlist> > playlists_tr = _session->playlists->playlists_for_track (tr);
|
||||
|
||||
/* sort the playlists */
|
||||
PlaylistSorter cmp;
|
||||
|
|
|
@ -42,6 +42,7 @@ class Region;
|
|||
class Source;
|
||||
class Session;
|
||||
class Crossfade;
|
||||
class Track;
|
||||
|
||||
class SessionPlaylists : public PBD::ScopedConnectionList
|
||||
{
|
||||
|
@ -53,11 +54,12 @@ public:
|
|||
uint32_t source_use_count (boost::shared_ptr<const Source> src) const;
|
||||
uint32_t region_use_count (boost::shared_ptr<Region> region) const;
|
||||
template<class T> void foreach (T *obj, void (T::*func)(boost::shared_ptr<Playlist>));
|
||||
void get (std::vector<boost::shared_ptr<Playlist> >&);
|
||||
void get (std::vector<boost::shared_ptr<Playlist> >&) const;
|
||||
void unassigned (std::list<boost::shared_ptr<Playlist> > & list);
|
||||
void destroy_region (boost::shared_ptr<Region>);
|
||||
boost::shared_ptr<Crossfade> find_crossfade (const PBD::ID &);
|
||||
void sync_all_regions_with_regions ();
|
||||
std::vector<boost::shared_ptr<Playlist> > playlists_for_track (boost::shared_ptr<Track>) const;
|
||||
|
||||
private:
|
||||
friend class Session;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "ardour/playlist_factory.h"
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/source.h"
|
||||
#include "ardour/track.h"
|
||||
#include "i18n.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -219,7 +220,7 @@ SessionPlaylists::unassigned (std::list<boost::shared_ptr<Playlist> > & list)
|
|||
}
|
||||
|
||||
void
|
||||
SessionPlaylists::get (vector<boost::shared_ptr<Playlist> >& s)
|
||||
SessionPlaylists::get (vector<boost::shared_ptr<Playlist> >& s) const
|
||||
{
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
|
@ -450,3 +451,21 @@ SessionPlaylists::region_use_count (boost::shared_ptr<Region> region) const
|
|||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/** @return list of Playlists that are associated with a track */
|
||||
vector<boost::shared_ptr<Playlist> >
|
||||
SessionPlaylists::playlists_for_track (boost::shared_ptr<Track> tr) const
|
||||
{
|
||||
vector<boost::shared_ptr<Playlist> > pl;
|
||||
get (pl);
|
||||
|
||||
vector<boost::shared_ptr<Playlist> > pl_tr;
|
||||
|
||||
for (vector<boost::shared_ptr<Playlist> >::iterator i = pl.begin(); i != pl.end(); ++i) {
|
||||
if (((*i)->get_orig_diskstream_id() == tr->diskstream_id()) || (tr->playlist()->id() == (*i)->id())) {
|
||||
pl_tr.push_back (*i);
|
||||
}
|
||||
}
|
||||
|
||||
return pl_tr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue