diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 7a299651b0..1ae481a335 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -164,7 +164,7 @@ Editor::reassociate_bartime_marker (TempoMap::SharedPtr const & tmap, TempoMap:: void Editor::make_bbt_marker (MusicTimePoint const * mtp, Marks::iterator before) { - bbt_marks.insert (before, new BBTMarker (*this, *bbt_ruler, "meter marker", *mtp)); + bbt_marks.insert (before, new BBTMarker (*this, *bbt_ruler, "meter marker", *mtp, *tempo_group, *mapping_group, *meter_group)); } void diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index fdadb39927..20843bd1b2 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -857,9 +857,13 @@ MeterMarker::point() const /***********************************************************************/ -BBTMarker::BBTMarker (PublicEditor& editor, ArdourCanvas::Item& parent, std::string const& color_name, Temporal::MusicTimePoint const & p) +BBTMarker::BBTMarker (PublicEditor& editor, ArdourCanvas::Item& parent, std::string const& color_name, Temporal::MusicTimePoint const & p, + ArdourCanvas::Item& tempo_parent, + ArdourCanvas::Item& mapping_parent, + ArdourCanvas::Item& meter_parent) : MetricMarker (editor, parent, color_name, p.name(), BBTPosition, p.time(), false) , _point (&p) + , tempo_marker (new TempoMarker (editor, tempo_parent, mapping_parent, X_("tempo marker"), "", p, p.sample (TEMPORAL_SAMPLE_RATE), UIConfiguration::instance().color (X_("tempo curve")))) { std::stringstream full_tooltip; @@ -870,6 +874,14 @@ BBTMarker::BBTMarker (PublicEditor& editor, ArdourCanvas::Item& parent, std::str set_name (name(), full_tooltip.str()); group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_bbt_marker_event), group, this)); + + char buf[64]; + + snprintf (buf, sizeof(buf), "%d/%d", p.divisions_per_bar(), p.note_value ()); + meter_marker = new MeterMarker (editor, meter_parent, "meter marker", buf, p); + + tempo_marker->the_item().set_ignore_events (true); + meter_marker->the_item().set_ignore_events (true); } BBTMarker::~BBTMarker () @@ -880,6 +892,9 @@ void BBTMarker::update () { set_position (_point->time()); + + tempo_marker->update (); + meter_marker->update (); } void @@ -893,3 +908,11 @@ BBTMarker::point() const { return *_point; } + +void +BBTMarker::set_position (Temporal::timepos_t const & pos) +{ + ArdourMarker::set_position (pos); + tempo_marker->set_position (pos); + meter_marker->set_position (pos); +} diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h index 21a991cd92..882e61fdf1 100644 --- a/gtk2_ardour/marker.h +++ b/gtk2_ardour/marker.h @@ -91,7 +91,7 @@ public: void set_show_line (bool); void set_line_height (double); - void set_position (Temporal::timepos_t const &); + virtual void set_position (Temporal::timepos_t const &); void set_name (const std::string&, const std::string & tooltip = std::string()); void set_color (std::string const& color_name); void set_points_color (std::string const& color_name); @@ -230,17 +230,23 @@ class MeterMarker : public MetricMarker class BBTMarker : public MetricMarker { public: - BBTMarker (PublicEditor& editor, ArdourCanvas::Item &, std::string const& color_name, Temporal::MusicTimePoint const &); + BBTMarker (PublicEditor& editor, ArdourCanvas::Item &, std::string const& color_name, Temporal::MusicTimePoint const &, + ArdourCanvas::Item & tempo_parent, + ArdourCanvas::Item & mapping_parent, + ArdourCanvas::Item & meter_parent); ~BBTMarker (); void reset_point (Temporal::MusicTimePoint const &); void update (); + void set_position (Temporal::timepos_t const &); Temporal::MusicTimePoint const & mt_point() const { return *_point; } Temporal::Point const & point() const; private: Temporal::MusicTimePoint const * _point; + TempoMarker* tempo_marker; + MeterMarker* meter_marker; }; #endif /* __gtk_ardour_marker_h__ */