From 16dfb95617834abd717821d5f5c59c9573d89fd4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 25 Jul 2023 14:54:53 -0600 Subject: [PATCH] tempo/meter edits: no position fields if marker is part of a BBT marker --- gtk2_ardour/editor_tempodisplay.cc | 14 ++++++++++++++ gtk2_ardour/tempo_dialog.cc | 14 +++++++++----- gtk2_ardour/tempo_dialog.h | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 16024b9713..1a66417d8e 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -608,6 +608,20 @@ Editor::edit_meter_section (Temporal::MeterPoint& section) Temporal::Beats new_pos; + MusicTimePoint* mtp; + + if ((mtp = dynamic_cast (§ion))) { + + /* 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 (); diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index c890d09ced..bf5413586c 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -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 (_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 (§ion), 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 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); diff --git a/gtk2_ardour/tempo_dialog.h b/gtk2_ardour/tempo_dialog.h index cfb7876331..9a0dbb784e 100644 --- a/gtk2_ardour/tempo_dialog.h +++ b/gtk2_ardour/tempo_dialog.h @@ -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* );