mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-12 09:36:33 +01:00
Don't write undo records for automation that moves with regions when nothing changes about the automation.
git-svn-id: svn://localhost/ardour2/branches/3.0@7665 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
cdb3ade9ff
commit
067c4458a0
3 changed files with 35 additions and 20 deletions
|
|
@ -466,9 +466,11 @@ Diskstream::playlist_ranges_moved (list< Evoral::RangeMove<framepos_t> > const &
|
|||
for (uint32_t i = 0; i < p->npanners (); ++i) {
|
||||
boost::shared_ptr<AutomationList> pan_alist = p->streampanner(i).pan_control()->alist();
|
||||
XMLNode & before = pan_alist->get_state ();
|
||||
pan_alist->move_ranges (movements);
|
||||
_session.add_command (new MementoCommand<AutomationList> (
|
||||
*pan_alist.get(), &before, &pan_alist->get_state ()));
|
||||
bool const things_moved = pan_alist->move_ranges (movements);
|
||||
if (things_moved) {
|
||||
_session.add_command (new MementoCommand<AutomationList> (
|
||||
*pan_alist.get(), &before, &pan_alist->get_state ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -485,25 +487,23 @@ Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, list< Evora
|
|||
}
|
||||
|
||||
list< Evoral::RangeMove<double> > movements;
|
||||
for (list< Evoral::RangeMove<framepos_t> >::const_iterator i = movements_frames.begin();
|
||||
i != movements_frames.end(); ++i) {
|
||||
for (list< Evoral::RangeMove<framepos_t> >::const_iterator i = movements_frames.begin(); i != movements_frames.end(); ++i) {
|
||||
movements.push_back(Evoral::RangeMove<double>(i->from, i->length, i->to));
|
||||
}
|
||||
|
||||
set<Evoral::Parameter> const a = processor->what_can_be_automated ();
|
||||
|
||||
cout << "move processor auto for " << processor->name() << "\n";
|
||||
|
||||
for (set<Evoral::Parameter>::iterator i = a.begin (); i != a.end (); ++i) {
|
||||
cout << "moving " << *i << "\n";
|
||||
boost::shared_ptr<AutomationList> al = processor->automation_control(*i)->alist();
|
||||
XMLNode & before = al->get_state ();
|
||||
al->move_ranges (movements);
|
||||
_session.add_command (
|
||||
new MementoCommand<AutomationList> (
|
||||
*al.get(), &before, &al->get_state ()
|
||||
)
|
||||
);
|
||||
bool const things_moved = al->move_ranges (movements);
|
||||
if (things_moved) {
|
||||
_session.add_command (
|
||||
new MementoCommand<AutomationList> (
|
||||
*al.get(), &before, &al->get_state ()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public:
|
|||
void erase_range (double start, double end);
|
||||
void erase (iterator);
|
||||
void erase (iterator, iterator);
|
||||
void move_ranges (std::list< RangeMove<double> > const &);
|
||||
bool move_ranges (std::list< RangeMove<double> > const &);
|
||||
void modify (iterator, double, double);
|
||||
|
||||
boost::shared_ptr<ControlList> cut (double, double);
|
||||
|
|
|
|||
|
|
@ -510,7 +510,9 @@ ControlList::erase_range_internal (double start, double endt, EventList & events
|
|||
cp.when = endt;
|
||||
e = upper_bound (events.begin(), events.end(), &cp, time_comparator);
|
||||
events.erase (s, e);
|
||||
erased = true;
|
||||
if (s != e) {
|
||||
erased = true;
|
||||
}
|
||||
}
|
||||
|
||||
return erased;
|
||||
|
|
@ -1354,8 +1356,10 @@ ControlList::paste (ControlList& alist, double pos, float /*times*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
/** Move automation around according to a list of region movements */
|
||||
void
|
||||
/** Move automation around according to a list of region movements.
|
||||
* @param return true if anything was changed, otherwise false (ie nothing needed changing)
|
||||
*/
|
||||
bool
|
||||
ControlList::move_ranges (const list< RangeMove<double> >& movements)
|
||||
{
|
||||
typedef list< RangeMove<double> > RangeMoveList;
|
||||
|
|
@ -1367,11 +1371,21 @@ ControlList::move_ranges (const list< RangeMove<double> >& movements)
|
|||
EventList old_events = _events;
|
||||
|
||||
/* clear the source and destination ranges in the new list */
|
||||
bool things_erased = false;
|
||||
for (RangeMoveList::const_iterator i = movements.begin (); i != movements.end (); ++i) {
|
||||
|
||||
erase_range_internal (i->from, i->from + i->length, _events);
|
||||
erase_range_internal (i->to, i->to + i->length, _events);
|
||||
if (erase_range_internal (i->from, i->from + i->length, _events)) {
|
||||
things_erased = true;
|
||||
}
|
||||
|
||||
if (erase_range_internal (i->to, i->to + i->length, _events)) {
|
||||
things_erased = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* if nothing was erased, there is nothing to do */
|
||||
if (!things_erased) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* copy the events into the new list */
|
||||
|
|
@ -1399,6 +1413,7 @@ ControlList::move_ranges (const list< RangeMove<double> >& movements)
|
|||
}
|
||||
|
||||
maybe_signal_changed ();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue