+void
+Editor::toggle_marker_lock_style ()
+{
+ MeterMarker* mm;
+ TempoMarker* tm;
+ 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();
+
+ const Meter meter (msp->divisions_per_bar(), msp->note_divisor());
+ const Timecode::BBT_Time bbt (msp->bbt());
+ const PositionLockStyle pls = (msp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
+
+ _session->tempo_map().replace_meter (*msp, meter, bbt, msp->frame(), pls);
+
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
+ commit_reversible_command ();
+ } else if (tm) {
+ TempoSection* tsp = &tm->tempo();
+
+ const double pulse = tsp->pulse();
+ const framepos_t frame = tsp->frame();
+ const PositionLockStyle pls = (tsp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
+ const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type(), tsp->end_note_types_per_minute());
+
+ begin_reversible_command (_("change tempo lock style"));
+ XMLNode &before = _session->tempo_map().get_state();
+
+ _session->tempo_map().replace_tempo (*tsp, tempo, pulse, frame, pls);
+
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
+ commit_reversible_command ();
+ }
+}
+/* actally just resets the ts to constant using initial tempo */
+void
+Editor::toggle_tempo_type ()
+{
+ TempoMarker* tm;
+ MeterMarker* mm;
+ dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
+
+ if (tm) {
+ TempoSection* tsp = &tm->tempo();
+
+ const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type());
+ const double pulse = tsp->pulse();
+ const framepos_t frame = tsp->frame();
+ const PositionLockStyle pls = tsp->position_lock_style();
+
+ begin_reversible_command (_("set tempo to constant"));
+ XMLNode &before = _session->tempo_map().get_state();
+
+ _session->tempo_map().replace_tempo (*tsp, tempo, pulse, frame, pls);
+
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
+ commit_reversible_command ();
+ }
+}
+/* clamped locks the previous section end tempo to the start tempo */
+void
+Editor::toggle_tempo_clamped ()
+{
+ TempoMarker* tm;
+ MeterMarker* mm;
+ dynamic_cast_marker_object (marker_menu_item->get_data ("marker"), &mm, &tm);
+
+ if (tm) {
+ begin_reversible_command (_("Clamp Tempo"));
+ XMLNode &before = _session->tempo_map().get_state();
+
+ TempoSection* tsp = &tm->tempo();
+ TempoSection* prev = _session->tempo_map().previous_tempo_section (tsp);
+
+ if (prev) {
+ /* set to the end tempo of the previous section */
+ Tempo new_tempo (prev->end_note_types_per_minute(), prev->note_type(), tsp->end_note_types_per_minute());
+ _session->tempo_map().gui_change_tempo (tsp, new_tempo);
+ }
+
+ tsp->set_clamped (!tsp->clamped());
+
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
+ commit_reversible_command ();
+ }
+}
+
+void
+Editor::continue_previous_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* prev_ts = tmap.previous_tempo_section (&tm->tempo());
+ if (prev_ts) {
+ const Tempo tempo (prev_ts->end_note_types_per_minute(), tsp->note_type(), tsp->end_note_types_per_minute());
+ const double pulse = tsp->pulse();
+ const framepos_t frame = tsp->frame();
+ const PositionLockStyle pls = tsp->position_lock_style();
+
+ begin_reversible_command (_("continue previous tempo"));
+ XMLNode &before = _session->tempo_map().get_state();
+
+ tmap.replace_tempo (*tsp, tempo, pulse, frame, pls);
+
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
+ commit_reversible_command ();
+ }
+ }
+}
+
+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 framepos_t frame = tsp->frame();
+ 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, frame, pls);
+
+ XMLNode &after = _session->tempo_map().get_state();
+ _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
+ commit_reversible_command ();
+ }
+ }
+}
+