From a61f25dfe9dcf1f29852d917779529d26e762ea5 Mon Sep 17 00:00:00 2001 From: Nick Mainsbridge Date: Wed, 30 Aug 2006 20:48:16 +0000 Subject: ** requires svn jack ** Hardware monitoring should work, some canvas scrolling speed improvement, don't disconcertingly churn the disk if jack auto-start fails, mixer visibility state is saved per session, slow down meters a bit (too much?), zoom cleanups, remove some unused variables, use rwlock for tempo state for no reason other than that it might be useful one day, fix compiler warning. git-svn-id: svn://localhost/ardour2/trunk@873 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_tempodisplay.cc | 50 +++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 20 deletions(-) (limited to 'gtk2_ardour/editor_tempodisplay.cc') diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 5e906cb617..7dfeb7f2ae 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -69,10 +69,14 @@ Editor::remove_metric_marks () void Editor::draw_metric_marks (const Metrics& metrics) { + + const MeterSection *ms; + const TempoSection *ts; + char buf[64]; + + remove_metric_marks (); + for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) { - const MeterSection *ms; - const TempoSection *ts; - char buf[64]; if ((ms = dynamic_cast(*i)) != 0) { snprintf (buf, sizeof(buf), "%g/%g", ms->beats_per_bar(), ms->note_divisor ()); @@ -85,12 +89,13 @@ Editor::draw_metric_marks (const Metrics& metrics) } } + } void Editor::tempo_map_changed (Change ignored) { - ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::tempo_map_changed), ignored)); + ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::tempo_map_changed), ignored)); if (current_bbt_points) { delete current_bbt_points; @@ -108,17 +113,13 @@ Editor::tempo_map_changed (Change ignored) void Editor::redisplay_tempo () -{ - update_tempo_based_rulers (); - - remove_metric_marks (); +{ hide_measures (); if (session && current_bbt_points) { - session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); draw_measures (); + update_tempo_based_rulers (); } - } void @@ -155,8 +156,8 @@ Editor::draw_measures () return; } - TempoMap::BBTPointList::iterator i; - TempoMap::BBTPointList *all_bbt_points; + TempoMap::BBTPointList::iterator i = current_bbt_points->begin(); + TempoMap::BBTPoint& p = (*i); ArdourCanvas::SimpleLine *line; gdouble xpos, last_xpos; uint32_t cnt; @@ -166,8 +167,6 @@ Editor::draw_measures () return; } - all_bbt_points = session->tempo_map().get_points (leftmost_frame, leftmost_frame + current_page_frames()); - cnt = 0; last_xpos = 0; @@ -176,7 +175,7 @@ Editor::draw_measures () gdouble last_beat = DBL_MAX; gdouble beat_spacing = 0; - for (i = all_bbt_points->begin(); i != all_bbt_points->end() && beat_spacing == 0; ++i) { + for (i = current_bbt_points->begin(); i != current_bbt_points->end() && beat_spacing == 0; ++i) { TempoMap::BBTPoint& p = (*i); switch (p.type) { @@ -194,11 +193,11 @@ Editor::draw_measures () double x1, x2, y1, y2; track_canvas.get_scroll_region (x1, y1, x2, y2); - y2 = 1000000000.0f; + //y2 = 1000000000.0f; - for (i = all_bbt_points->begin(); i != all_bbt_points->end(); ++i) { + for (i = current_bbt_points->begin(); i != current_bbt_points->end(); ++i) { - TempoMap::BBTPoint& p = (*i); + p = (*i); switch (p.type) { case TempoMap::Bar: @@ -236,8 +235,6 @@ Editor::draw_measures () } } - delete all_bbt_points; - /* the cursors are always on top of everything */ cursor_group->raise_to_top(); @@ -282,6 +279,8 @@ Editor::mouse_add_new_tempo_event (jack_nframes_t frame) commit_reversible_command (); map.dump (cerr); + + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); } void @@ -322,6 +321,8 @@ Editor::mouse_add_new_meter_event (jack_nframes_t frame) commit_reversible_command (); map.dump (cerr); + + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); } void @@ -372,6 +373,8 @@ Editor::edit_meter_section (MeterSection* section) XMLNode &after = session->tempo_map().get_state(); session->add_command(new MementoCommand(session->tempo_map(), &before, &after)); commit_reversible_command (); + + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); } void @@ -402,6 +405,8 @@ Editor::edit_tempo_section (TempoSection* section) XMLNode &after = session->tempo_map().get_state(); session->add_command (new MementoCommand(session->tempo_map(), &before, &after)); commit_reversible_command (); + + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); } void @@ -452,6 +457,8 @@ Editor::real_remove_tempo_marker (TempoSection *section) session->add_command(new MementoCommand(session->tempo_map(), &before, &after)); commit_reversible_command (); + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); + return FALSE; } @@ -485,5 +492,8 @@ Editor::real_remove_meter_marker (MeterSection *section) XMLNode &after = session->tempo_map().get_state(); session->add_command(new MementoCommand(session->tempo_map(), &before, &after)); commit_reversible_command (); + + session->tempo_map().apply_with_metrics (*this, &Editor::draw_metric_marks); + return FALSE; } -- cgit v1.2.3