+void
+Editor::ramp_to_next_tempo ()
+{
+ TempoMarker* tm;
+ MeterMarker* mm;
+ dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
+
+ if (tm) {
+ TempoMap& tmap (_session->tempo_map());
+ TempoSection* tsp = &tm->tempo();
+ TempoSection* next_ts = tmap.next_tempo_section (&tm->tempo());
+ if (next_ts) {
+ const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type(), next_ts->note_types_per_minute());
+ const double pulse = tsp->pulse();
+ const samplepos_t sample = tsp->sample();
+ const PositionLockStyle pls = tsp->position_lock_style();
+
+ begin_reversible_command (_("ramp to next tempo"));
+ XMLNode &before = _session->tempo_map().get_state();
+
+ tmap.replace_tempo (*tsp, tempo, pulse, sample, pls);
+
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
+ commit_reversible_command ();
+ }
+ }
+}
+