Use 1|1|0 for new BBT markers, always use dialog for new markers

Amend b972301a3b
This commit is contained in:
Robin Gareus 2022-12-05 19:15:53 +01:00
parent c505024a4b
commit 8a7684bd2f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 11 additions and 16 deletions

View File

@ -29,10 +29,11 @@ using namespace ARDOUR;
using namespace PBD;
using namespace Temporal;
BBTMarkerDialog::BBTMarkerDialog (timepos_t const & pos)
BBTMarkerDialog::BBTMarkerDialog (timepos_t const & pos, BBT_Time const& bbt)
: ArdourDialog (_("New Music Time"))
, _point (0)
, _position (pos)
, _bbt (bbt)
, entry_label (_("BBT"))
, name_label (_("Name"))
@ -44,6 +45,7 @@ BBTMarkerDialog::BBTMarkerDialog (MusicTimePoint& p)
: ArdourDialog (_("Edit Music Time"))
, _point (&p)
, _position (timepos_t::from_superclock (p.sclock()))
, _bbt (TempoMap::use()->bbt_at (_position).round_to_beat ())
, entry_label (_("BBT"))
, name_label (_("Name"))
{
@ -53,10 +55,8 @@ BBTMarkerDialog::BBTMarkerDialog (MusicTimePoint& p)
void
BBTMarkerDialog::init (bool add)
{
BBT_Time bbt = TempoMap::use()->bbt_at (_position).round_to_beat ();
bar_entry.set_range (1, 9999);
beat_entry.set_range (1, 9999);
beat_entry.set_range (1, 9999); // XXX (1, time-signature denominator at _position) ?!
bar_entry.set_digits (0);
beat_entry.set_digits (0);
@ -64,8 +64,8 @@ BBTMarkerDialog::init (bool add)
bbt_box.pack_start (bar_entry);
bbt_box.pack_start (beat_entry);
bar_entry.set_value (bbt.bars);
beat_entry.set_value (bbt.beats);
bar_entry.set_value (_bbt.bars);
beat_entry.set_value (_bbt.beats);
name_box.pack_start (name_label);
name_box.pack_start (name_entry);

View File

@ -33,7 +33,7 @@
class BBTMarkerDialog : public ArdourDialog
{
public:
BBTMarkerDialog (Temporal::timepos_t const &);
BBTMarkerDialog (Temporal::timepos_t const &, Temporal::BBT_Time const&);
BBTMarkerDialog (Temporal::MusicTimePoint&);
Temporal::timepos_t position() const;
@ -43,7 +43,8 @@ public:
private:
void init (bool add);
Temporal::MusicTimePoint* _point;
Temporal::timepos_t _position;
Temporal::timepos_t _position;
Temporal::BBT_Time _bbt;
Gtk::HBox bbt_box;
Gtk::SpinButton bar_entry;

View File

@ -535,13 +535,7 @@ Editor::add_bbt_marker_at_playhead_cursor ()
return;
}
timepos_t pos (_session->transport_sample ());
BBT_Time bbt = Temporal::TempoMap::use()->bbt_at (pos);
std::string name = _("Playhead");
TempoMapChange tmc (*this, _("add BBT marker"));
tmc.map().set_bartime (bbt, pos, name);
mouse_add_bbt_marker_event (timepos_t (_session->transport_sample ()));
}
void
@ -553,7 +547,7 @@ Editor::mouse_add_bbt_marker_event (timepos_t pos)
/* position markers must always be positioned using audio time */
BBTMarkerDialog marker_dialog (timepos_t (pos.samples()));
BBTMarkerDialog marker_dialog (timepos_t (pos.samples()), BBT_Time ());
/* run this modally since we are finishing a drag and the drag object
* will be destroyed when we return from here