13
0

use new editor/tempo map editing API for tempo marker drag

This commit is contained in:
Paul Davis 2022-01-15 22:53:58 -07:00
parent 4db7aa6bdc
commit a6727cace5

View File

@ -3580,7 +3580,7 @@ TempoMarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
/* setup thread-local tempo map ptr as a writable copy */ /* setup thread-local tempo map ptr as a writable copy */
TempoMap::fetch_writable (); _editor->begin_tempo_map_edit ();
} }
} }
@ -3682,6 +3682,7 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
timepos_t pos = adjusted_current_time (event); timepos_t pos = adjusted_current_time (event);
std::cerr << " going to move " << &_marker->tempo() << std::endl;
map->move_tempo (_marker->tempo(), pos, false); map->move_tempo (_marker->tempo(), pos, false);
show_verbose_cursor_time (_marker->tempo().time()); show_verbose_cursor_time (_marker->tempo().time());
@ -3710,7 +3711,7 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
* official version * official version
*/ */
TempoMap::abort_update (); _editor->abort_tempo_map_edit ();
if (was_double_click()) { if (was_double_click()) {
_editor->edit_tempo_marker (*_marker); _editor->edit_tempo_marker (*_marker);
@ -3721,9 +3722,7 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
/* push the current state of our writable map copy */ /* push the current state of our writable map copy */
TempoMap::SharedPtr map (TempoMap::use()); _editor->commit_tempo_map_edit ();
TempoMap::update (map);
XMLNode &after = TempoMap::use()->get_state(); XMLNode &after = TempoMap::use()->get_state();
_editor->session()->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), _before_state, &after)); _editor->session()->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), _before_state, &after));
@ -3741,7 +3740,7 @@ TempoMarkerDrag::aborted (bool moved)
* official version * official version
*/ */
TempoMap::abort_update (); _editor->abort_tempo_map_edit ();
// _point->end_float (); // _point->end_float ();
_marker->set_position (timepos_t (_marker->tempo().beats())); _marker->set_position (timepos_t (_marker->tempo().beats()));