Tempo ramps - add undo to right-click lock style & ramp type changes.
This commit is contained in:
parent
eb70cdce1f
commit
4f8fa6787a
@ -1389,19 +1389,29 @@ Editor::toggle_marker_lock_style ()
|
||||
dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
|
||||
|
||||
if (mm) {
|
||||
begin_reversible_command (_("change meter lock style"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
MeterSection* msp = &mm->meter();
|
||||
if (mm->meter().position_lock_style() == AudioTime) {
|
||||
_session->tempo_map().replace_meter (*msp, Meter (msp->divisions_per_bar(), msp->note_divisor()), msp->bbt());
|
||||
} else {
|
||||
_session->tempo_map().replace_meter (*msp, Meter (msp->divisions_per_bar(), msp->note_divisor()), msp->frame());
|
||||
}
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
} else if (tm) {
|
||||
begin_reversible_command (_("change tempo lock style"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
TempoSection* tsp = &tm->tempo();
|
||||
if (tsp->position_lock_style() == AudioTime) {
|
||||
_session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->pulse(), tsp->type());
|
||||
} else {
|
||||
_session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->frame(), tsp->type());
|
||||
}
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1413,10 +1423,15 @@ Editor::toggle_tempo_type ()
|
||||
dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
|
||||
|
||||
if (tm) {
|
||||
begin_reversible_command (_("change tempo type"));
|
||||
XMLNode &before = _session->tempo_map().get_state();
|
||||
TempoSection* tsp = &tm->tempo();
|
||||
_session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type())
|
||||
, (tsp->position_lock_style() == MusicTime) ? tsp->pulse() : tsp->frame()
|
||||
, (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp);
|
||||
XMLNode &after = _session->tempo_map().get_state();
|
||||
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
|
||||
commit_reversible_command ();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user