mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 05:35:47 +01:00
Try to make new layering stuff play nicely with undo.
git-svn-id: svn://localhost/ardour2/branches/3.0@11097 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
86cb9348e8
commit
f440f91849
5 changed files with 113 additions and 7 deletions
|
|
@ -2133,28 +2133,101 @@ Editor::loop_location (Location& location)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::do_layer_operation (LayerOperation op)
|
||||
{
|
||||
if (selection->regions.empty ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool const multiple = selection->regions.size() > 1;
|
||||
switch (op) {
|
||||
case Raise:
|
||||
if (multiple) {
|
||||
begin_reversible_command (_("raise regions"));
|
||||
} else {
|
||||
begin_reversible_command (_("raise region"));
|
||||
}
|
||||
break;
|
||||
|
||||
case RaiseToTop:
|
||||
if (multiple) {
|
||||
begin_reversible_command (_("raise regions to top"));
|
||||
} else {
|
||||
begin_reversible_command (_("raise region to top"));
|
||||
}
|
||||
break;
|
||||
|
||||
case Lower:
|
||||
if (multiple) {
|
||||
begin_reversible_command (_("lower regions"));
|
||||
} else {
|
||||
begin_reversible_command (_("lower region"));
|
||||
}
|
||||
break;
|
||||
|
||||
case LowerToBottom:
|
||||
if (multiple) {
|
||||
begin_reversible_command (_("lower regions to bottom"));
|
||||
} else {
|
||||
begin_reversible_command (_("lower region"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
set<boost::shared_ptr<Playlist> > playlists = selection->regions.playlists ();
|
||||
for (set<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
|
||||
(*i)->clear_owned_changes ();
|
||||
}
|
||||
|
||||
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
|
||||
boost::shared_ptr<Region> r = (*i)->region ();
|
||||
switch (op) {
|
||||
case Raise:
|
||||
r->raise ();
|
||||
break;
|
||||
case RaiseToTop:
|
||||
r->raise_to_top ();
|
||||
break;
|
||||
case Lower:
|
||||
r->lower ();
|
||||
break;
|
||||
case LowerToBottom:
|
||||
r->lower_to_bottom ();
|
||||
}
|
||||
}
|
||||
|
||||
for (set<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
|
||||
vector<Command*> cmds;
|
||||
(*i)->rdiff (cmds);
|
||||
_session->add_commands (cmds);
|
||||
}
|
||||
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::raise_region ()
|
||||
{
|
||||
selection->foreach_region (&Region::raise);
|
||||
do_layer_operation (Raise);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::raise_region_to_top ()
|
||||
{
|
||||
selection->foreach_region (&Region::raise_to_top);
|
||||
do_layer_operation (RaiseToTop);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::lower_region ()
|
||||
{
|
||||
selection->foreach_region (&Region::lower);
|
||||
do_layer_operation (Lower);
|
||||
}
|
||||
|
||||
void
|
||||
Editor::lower_region_to_bottom ()
|
||||
{
|
||||
selection->foreach_region (&Region::lower_to_bottom);
|
||||
do_layer_operation (LowerToBottom);
|
||||
}
|
||||
|
||||
/** Show the region editor for the selected regions */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue