tempo/meter edits: no position fields if marker is part of a BBT marker

This commit is contained in:
Paul Davis 2023-07-25 14:54:53 -06:00
parent f9e1357fed
commit 16dfb95617
3 changed files with 24 additions and 6 deletions

View File

@ -608,6 +608,20 @@ Editor::edit_meter_section (Temporal::MeterPoint& section)
Temporal::Beats new_pos;
MusicTimePoint* mtp;
if ((mtp = dynamic_cast<Temporal::MusicTimePoint*> (&section))) {
/* ignore positional changes, that must be done via the MTP */
const Temporal::MeterPoint mp (meter, *mtp);
MusicTimePoint replacement (*mtp);
*((Temporal::MeterPoint*)&replacement) = mp;
TempoMapChange tmc (*this, _("edit BBT meter"));
tmc.map().replace_bartime (replacement);
return;
}
if (!mpp) {
/* first meter, cannot move */
new_pos = section.beats ();

View File

@ -213,7 +213,9 @@ TempoDialog::init (const Temporal::BBT_Time& when, double bpm, double end_bpm, d
snprintf (buf, sizeof (buf), "%" PRIu32, when.beats);
when_beat_entry.set_text (buf);
if (!initial) {
/* no position edit fields for initial tempo or BBT markers */
if (!initial && !(_section && dynamic_cast<MusicTimePoint*> (_section))) {
when_bar_entry.set_width_chars(4);
when_beat_entry.set_width_chars (4);
when_bar_entry.set_alignment (1.0);
@ -622,17 +624,17 @@ MeterDialog::MeterDialog (TempoMap::SharedPtr const & map, timepos_t const & pos
Temporal::BBT_Argument when (map->round_to_bar (map->bbt_at (pos)));
Meter const & meter (map->meter_at (when));
init (when, meter.divisions_per_bar(), meter.note_value(), false, pos.time_domain());
init (when, meter.divisions_per_bar(), meter.note_value(), false, false, pos.time_domain());
}
MeterDialog::MeterDialog (Temporal::MeterPoint& section, const string&)
: ArdourDialog (_("Edit Time Signature"))
{
init (section.bbt(), section.divisions_per_bar(), section.note_value(), section.map().is_initial(section), Temporal::BeatTime);
init (section.bbt(), section.divisions_per_bar(), section.note_value(), section.map().is_initial(section), dynamic_cast<MusicTimePoint*> (&section), Temporal::BeatTime);
}
void
MeterDialog::init (const Temporal::BBT_Time& when, double bpb, double divisor, bool initial, TimeDomain style)
MeterDialog::init (const Temporal::BBT_Time& when, double bpb, double divisor, bool initial, bool music_time_point, TimeDomain style)
{
char buf[64];
vector<string> strings;
@ -708,7 +710,9 @@ MeterDialog::init (const Temporal::BBT_Time& when, double bpb, double divisor, b
when_bar_entry.set_text (buf);
when_bar_entry.set_alignment (1.0);
if (!initial) {
/* no position edit fields for initial tempo or BBT markers */
if (!initial && !music_time_point) {
Label* when_label = manage (new Label(_("Time Signature begins at bar:"), ALIGN_START, ALIGN_CENTER));
table->attach (*when_label, 0, 1, 2, 3, FILL | EXPAND, FILL | EXPAND);

View File

@ -157,7 +157,7 @@ public:
bool get_bbt_time (Temporal::BBT_Time&);
private:
void init (const Temporal::BBT_Time&, double, double, bool, Temporal::TimeDomain style);
void init (const Temporal::BBT_Time&, double, double, bool, bool, Temporal::TimeDomain style);
bool is_user_input_valid() const;
bool entry_key_press (GdkEventKey* );
bool entry_key_release (GdkEventKey* );