improve behavior when editing BBT markers
setting the name should now work reliably, in particular
This commit is contained in:
@@ -37,12 +37,13 @@ BBTMarkerDialog::BBTMarkerDialog (timepos_t const & pos, BBT_Time const& bbt)
|
||||
, bar_label (_("Bar"))
|
||||
, beat_label (_("Beat"))
|
||||
, name_label (_("Name"))
|
||||
, name_changed (false)
|
||||
|
||||
{
|
||||
init (true);
|
||||
}
|
||||
|
||||
BBTMarkerDialog::BBTMarkerDialog (MusicTimePoint& p)
|
||||
BBTMarkerDialog::BBTMarkerDialog (MusicTimePoint const & p)
|
||||
: ArdourDialog (_("Edit Music Time"))
|
||||
, _point (&p)
|
||||
, _position (timepos_t::from_superclock (p.sclock()))
|
||||
@@ -50,6 +51,7 @@ BBTMarkerDialog::BBTMarkerDialog (MusicTimePoint& p)
|
||||
, bar_label (_("Bar"))
|
||||
, beat_label (_("Beat"))
|
||||
, name_label (_("Name"))
|
||||
, name_changed (false)
|
||||
{
|
||||
init (false);
|
||||
}
|
||||
@@ -81,6 +83,7 @@ BBTMarkerDialog::init (bool add)
|
||||
}
|
||||
|
||||
name_entry.signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &BBTMarkerDialog::response), Gtk::RESPONSE_OK));
|
||||
name_entry.signal_changed().connect ([&]() { name_changed = true; });
|
||||
|
||||
get_vbox()->pack_start (name_box);
|
||||
get_vbox()->pack_start (bbt_box);
|
||||
|
||||
@@ -33,15 +33,16 @@ class BBTMarkerDialog : public ArdourDialog
|
||||
{
|
||||
public:
|
||||
BBTMarkerDialog (Temporal::timepos_t const &, Temporal::BBT_Time const&);
|
||||
BBTMarkerDialog (Temporal::MusicTimePoint&);
|
||||
BBTMarkerDialog (Temporal::MusicTimePoint const &);
|
||||
|
||||
Temporal::timepos_t position() const;
|
||||
Temporal::BBT_Time bbt_value () const;
|
||||
std::string name() const;
|
||||
bool name_edited() const { return name_changed; }
|
||||
|
||||
private:
|
||||
void init (bool add);
|
||||
Temporal::MusicTimePoint* _point;
|
||||
Temporal::MusicTimePoint const * _point;
|
||||
Temporal::timepos_t _position;
|
||||
Temporal::BBT_Time _bbt;
|
||||
|
||||
@@ -54,5 +55,6 @@ private:
|
||||
Gtk::HBox name_box;
|
||||
Gtk::Entry name_entry;
|
||||
Gtk::Label name_label;
|
||||
bool name_changed;
|
||||
};
|
||||
|
||||
|
||||
@@ -469,7 +469,7 @@ public:
|
||||
void mouse_add_bbt_marker_event (Temporal::timepos_t where);
|
||||
void add_bbt_marker_at_playhead_cursor ();
|
||||
|
||||
void edit_bbt (Temporal::MusicTimePoint&);
|
||||
void edit_bbt (BBTMarker&);
|
||||
|
||||
bool should_ripple () const;
|
||||
bool should_ripple_all () const; /* RippleAll will ripple all similar regions and the timeline markers */
|
||||
|
||||
@@ -3438,7 +3438,7 @@ BBTMarkerDrag::finished (GdkEvent* event, bool movement_occurred)
|
||||
_editor.abort_tempo_map_edit ();
|
||||
|
||||
if (was_double_click ()) {
|
||||
_editor.edit_bbt (point);
|
||||
_editor.edit_bbt (*_marker);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -1680,7 +1680,7 @@ Editor::marker_menu_edit ()
|
||||
} else if (tm) {
|
||||
edit_tempo_section (const_cast<Temporal::TempoPoint&>(tm->tempo()));
|
||||
} else if (bm) {
|
||||
edit_bbt (const_cast<Temporal::MusicTimePoint&>(bm->mt_point()));
|
||||
edit_bbt (*bm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -636,8 +636,9 @@ Editor::edit_meter_section (Temporal::MeterPoint& section)
|
||||
}
|
||||
|
||||
void
|
||||
Editor::edit_bbt (MusicTimePoint& point)
|
||||
Editor::edit_bbt (BBTMarker& bm)
|
||||
{
|
||||
MusicTimePoint const & point (bm.mt_point());
|
||||
BBTMarkerDialog dialog (point);
|
||||
|
||||
switch (dialog.run ()) {
|
||||
@@ -648,16 +649,24 @@ Editor::edit_bbt (MusicTimePoint& point)
|
||||
return;
|
||||
}
|
||||
|
||||
if (dialog.bbt_value() == point.bbt()) {
|
||||
/* just a name change, no need to modify the map */
|
||||
point.set_name (dialog.name());
|
||||
/* XXX need to update marker label */
|
||||
return;
|
||||
}
|
||||
BBT_Time bbt (dialog.bbt_value());
|
||||
Temporal::timepos_t pos (dialog.position());
|
||||
std::string name (dialog.name());
|
||||
|
||||
TempoMapChange tmc (*this, _("edit tempo"));
|
||||
tmc.map().remove_bartime (point);
|
||||
tmc.map().set_bartime (dialog.bbt_value(), dialog.position(), dialog.name());
|
||||
if (bbt != point.bbt() ||
|
||||
pos.superclocks() != point.sclock() ||
|
||||
name != point.name()) {
|
||||
TempoMapChange tmc (*this, _("edit tempo"));
|
||||
tmc.map().remove_bartime (point);
|
||||
tmc.map().set_bartime (bbt, pos, name);
|
||||
|
||||
/* XXX this ought to be set via MVC-style design, but currently
|
||||
* there is no signal to notify anyone that the
|
||||
* MusicTimePoint's name has been changed.
|
||||
*/
|
||||
|
||||
bm.set_name (name);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -745,7 +754,7 @@ Editor::edit_meter_marker (MeterMarker& mm)
|
||||
void
|
||||
Editor::edit_bbt_marker (BBTMarker& bm)
|
||||
{
|
||||
edit_bbt (const_cast<Temporal::MusicTimePoint&>(bm.mt_point()));
|
||||
edit_bbt (bm);
|
||||
}
|
||||
|
||||
gint
|
||||
|
||||
Reference in New Issue
Block a user