#include "prompter.h"
#include "editor_drag.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace std;
using namespace ARDOUR;
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());
- }
+
+ 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, 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 Tempo tempo (tsp->note_types_per_minute(), tsp->note_type());
+ const double pulse = tsp->pulse();
+ const framepos_t frame = tsp->frame();
+ const TempoSection::Type type = tsp->type();
+ const PositionLockStyle pls = (tsp->position_lock_style() == AudioTime) ? MusicTime : AudioTime;
+
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());
- }
+
+ _session->tempo_map().replace_tempo (*tsp, tempo, pulse, frame, type, pls);
+
XMLNode &after = _session->tempo_map().get_state();
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));
commit_reversible_command ();
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 TempoSection::Type type = (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp;
+ const PositionLockStyle pls = tsp->position_lock_style();
+
begin_reversible_command (_("change tempo type"));
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->frame(), (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp);
- } else {
- _session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->pulse(), (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp);
- }
+
+ _session->tempo_map().replace_tempo (*tsp, tempo, pulse, frame, type, pls);
XMLNode &after = _session->tempo_map().get_state();
_session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after));