fix up memento command use for tempo map undo/redo

This commit is contained in:
Paul Davis 2020-11-27 15:44:34 -07:00
parent ed016dd4e6
commit 90553b315f
4 changed files with 13 additions and 26 deletions

View File

@ -3494,8 +3494,7 @@ MeterMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
TempoMap::SharedPtr map (TempoMap::use());
XMLNode &after = map->get_state();
#warning NUTEMPO memento command issue
//_editor->session()->add_command(new MementoCommand<TempoMap>(map, before_state, &after));
_editor->session()->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), before_state, &after));
_editor->commit_reversible_command ();
// delete the dummy marker we used for visual representation while moving.

View File

@ -1506,8 +1506,7 @@ Editor::toggle_tempo_type ()
tmap->set_ramped (tempo, !tempo.ramped());
XMLNode &after = tmap->get_state();
#warning NUTEMPO map object may change
//_session->add_command(new MementoCommand<Temporal::TempoMap>(_session->tempo_map(), &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command ();
}
}
@ -1529,8 +1528,7 @@ Editor::toggle_tempo_clamped ()
if (tempo.set_clamped (!tempo.clamped())) {
XMLNode &after = tmap->get_state();
#warning NUTEMPO paul knows the drill by now
//_session->add_command(new MementoCommand<Temporal::TempoMap>(_session->tempo_map(), &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command ();
} else {
abort_reversible_command ();
@ -1555,8 +1553,7 @@ Editor::ramp_to_next_tempo ()
Temporal::TempoPoint & tempo (tm->tempo());
if (tmap->set_ramped (tempo, !tempo.ramped())) {
XMLNode &after = tmap->get_state();
#warning NUTEMPO see previous warning
// _session->add_command(new MementoCommand<Temporal::TempoMap>(_session->tempo_map(), &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command ();
} else {
abort_reversible_command ();

View File

@ -7165,8 +7165,7 @@ Editor::define_one_bar (timepos_t const & start, timepos_t const & end)
XMLNode& after (tmap->get_state());
#warning NUTEMPO memento command tempo map issues
// _session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command ();
}
@ -8105,8 +8104,7 @@ Editor::insert_time (
XMLNode& before (tmap->get_state());
tmap->insert_time (pos, samples);
XMLNode& after (tmap->get_state());
#warning NUTEMPO memento command tempo map issues
// _session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
}
if (in_command) {
@ -8286,8 +8284,7 @@ Editor::remove_time (timepos_t const & pos, timecnt_t const & duration, InsertTi
in_command = true;
}
XMLNode& after (tmap->get_state());
#warning NUTEMPO memento command tempo map issue
//_session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
}
}

View File

@ -428,8 +428,7 @@ Editor::mouse_add_new_tempo_event (timepos_t pos)
map->set_tempo (map->tempo_at (pos), timepos_t (qn));
XMLNode &after = map->get_state();
#warning NUTEMPO uh-oh ... how to do this when the object may just go away
//_session->add_command(new MementoCommand<TempoMap>(map, &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command ();
}
@ -474,8 +473,7 @@ Editor::mouse_add_new_meter_event (timepos_t pos)
map->set_meter (Meter (bpb, note_type), requested);
}
#warning NUTEMPO uh-oh ... how to do this when the object may just go away
// _session->add_command(new MementoCommand<TempoMap>(map, &before, &map.get_state()));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command ();
#endif
//map.dump (cerr);
@ -531,8 +529,7 @@ Editor::edit_meter_section (Temporal::MeterPoint& section)
tmap->set_meter (meter, when);
XMLNode &after = tmap->get_state();
#warning NUTEMPO uh-oh ... how to do this when the object may just go away
// _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command ();
}
@ -565,8 +562,7 @@ Editor::edit_tempo_section (TempoPoint& section)
tmap->set_tempo (tempo, when);
XMLNode &after = tmap->get_state();
#warning NUTEMPO uh-oh ... how to do this when the object may just go away
// _session->add_command (new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command ();
}
@ -590,8 +586,7 @@ Editor::real_remove_tempo_marker (TempoPoint *section)
XMLNode &before = tmap->get_state();
tmap->remove_tempo (*section);
XMLNode &after = tmap->get_state();
#warning NUTEMPO uh-oh ... how to do this when the object may just go away
// _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command ();
return FALSE;
@ -626,8 +621,7 @@ Editor::real_remove_meter_marker (Temporal::MeterPoint *section)
XMLNode &before = tmap->get_state();
tmap->remove_meter (*section);
XMLNode &after = tmap->get_state();
#warning NUTEMPO uh-oh ... how to do this when the object may just go away
//_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command ();
return FALSE;