diff options
Diffstat (limited to 'gtk2_ardour/editor_tempodisplay.cc')
-rw-r--r-- | gtk2_ardour/editor_tempodisplay.cc | 57 |
1 files changed, 21 insertions, 36 deletions
diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 488b804d65..b997d3bb5d 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -27,8 +27,6 @@ #include <string> #include <climits> -#include <libgnomecanvasmm.h> - #include "pbd/error.h" #include "pbd/memento_command.h" @@ -40,9 +38,11 @@ #include <gtkmm2ext/doi.h> #include <gtkmm2ext/utils.h> +#include "canvas/canvas.h" +#include "canvas/item.h" + #include "editor.h" #include "marker.h" -#include "simpleline.h" #include "tempo_dialog.h" #include "rgb_macros.h" #include "gui_thread.h" @@ -85,7 +85,7 @@ Editor::draw_metric_marks (const Metrics& metrics) if ((ms = dynamic_cast<const MeterSection*>(*i)) != 0) { snprintf (buf, sizeof(buf), "%g/%g", ms->divisions_per_bar(), ms->note_divisor ()); - metric_marks.push_back (new MeterMarker (*this, *meter_group, ARDOUR_UI::config()->canvasvar_MeterMarker.get(), buf, + metric_marks.push_back (new MeterMarker (*this, *meter_group, ARDOUR_UI::config()->get_canvasvar_MeterMarker(), buf, *(const_cast<MeterSection*>(ms)))); } else if ((ts = dynamic_cast<const TempoSection*>(*i)) != 0) { if (Config->get_allow_non_quarter_pulse()) { @@ -93,7 +93,7 @@ Editor::draw_metric_marks (const Metrics& metrics) } else { snprintf (buf, sizeof (buf), "%.2f", ts->beats_per_minute()); } - metric_marks.push_back (new TempoMarker (*this, *tempo_group, ARDOUR_UI::config()->canvasvar_TempoMarker.get(), buf, + metric_marks.push_back (new TempoMarker (*this, *tempo_group, ARDOUR_UI::config()->get_canvasvar_TempoMarker(), buf, *(const_cast<TempoSection*>(ts)))); } @@ -117,9 +117,9 @@ Editor::tempo_map_changed (const PropertyChange& /*ignored*/) ARDOUR::TempoMap::BBTPointList::const_iterator begin; ARDOUR::TempoMap::BBTPointList::const_iterator end; - compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(), begin, end); + compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), begin, end); _session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); // redraw metric markers - redraw_measures (); + draw_measures (begin, end); update_tempo_based_rulers (begin, end); } @@ -130,22 +130,18 @@ Editor::redisplay_tempo (bool immediate_redraw) return; } - ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin; - ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end; - - compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(), - current_bbt_points_begin, current_bbt_points_end); - if (immediate_redraw) { - redraw_measures (); + ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_begin; + ARDOUR::TempoMap::BBTPointList::const_iterator current_bbt_points_end; + + compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_samples(), + current_bbt_points_begin, current_bbt_points_end); + draw_measures (current_bbt_points_begin, current_bbt_points_end); + update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end); // redraw rulers and measures + } else { -#ifdef GTKOSX - redraw_measures (); -#else - Glib::signal_idle().connect (sigc::mem_fun (*this, &Editor::redraw_measures)); -#endif + Glib::signal_idle().connect (sigc::bind_return (sigc::bind (sigc::mem_fun (*this, &Editor::redisplay_tempo), true), false)); } - update_tempo_based_rulers (current_bbt_points_begin, current_bbt_points_end); // redraw rulers and measures } void @@ -166,20 +162,9 @@ Editor::compute_current_bbt_points (framepos_t leftmost, framepos_t rightmost, void Editor::hide_measures () { - if (tempo_lines) + if (tempo_lines) { tempo_lines->hide(); -} - -bool -Editor::redraw_measures () -{ - ARDOUR::TempoMap::BBTPointList::const_iterator begin; - ARDOUR::TempoMap::BBTPointList::const_iterator end; - - compute_current_bbt_points (leftmost_frame, leftmost_frame + current_page_frames(), begin, end); - draw_measures (begin, end); - - return false; + } } void @@ -191,10 +176,10 @@ Editor::draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin, } if (tempo_lines == 0) { - tempo_lines = new TempoLines(*track_canvas, time_line_group, physical_screen_height(get_window())); + tempo_lines = new TempoLines (*_track_canvas, time_line_group, ArdourCanvas::COORD_MAX); } - - tempo_lines->draw (begin, end, frames_per_unit); + + tempo_lines->draw (begin, end, samples_per_pixel); } void |