From f8d5a6b3b63559f6098a1606684628ba60db4f48 Mon Sep 17 00:00:00 2001 From: nick_m Date: Wed, 19 Oct 2016 05:10:15 +1100 Subject: Tempo line tweaks. - ensure lines don't get too dense in the all bars case. - never draw tick divisions in the all bar case. --- gtk2_ardour/tempo_lines.cc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'gtk2_ardour/tempo_lines.cc') diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc index 508ae84ed9..09c2df1ce9 100644 --- a/gtk2_ardour/tempo_lines.cc +++ b/gtk2_ardour/tempo_lines.cc @@ -105,18 +105,29 @@ TempoLines::draw (std::vector& grid, uint32_t bars = 0; uint32_t color; + bool all_bars = false; /* get the first bar spacing */ i = grid.end(); i--; bars = (*i).bar - (*grid.begin()).bar; + int32_t bar_mod = 4; + if (bars < distance (grid.begin(), grid.end()) - 1) { /* grid contains beats and bars */ beats = distance (grid.begin(), grid.end()) - bars; } else { /* grid contains only bars */ beats = distance (grid.begin(), grid.end()); + + if (i != grid.begin()) { + const int32_t last_bar = (*i).bar; + i--; + bar_mod = (last_bar - (*i).bar) * 4; + } + + all_bars = true; } double canvas_width_used = 1.0; @@ -139,7 +150,7 @@ TempoLines::draw (std::vector& grid, } lines.clear (); - if (beat_density <= 0.12 && grid.begin() != grid.end() && grid.begin()->frame > 0) { + if (beat_density <= 0.12 && grid.begin() != grid.end() && grid.begin()->frame > 0 && !all_bars) { /* draw subdivisions of the beat before the first visible beat line XX this shouldn't happen now */ std::vector vec; vec.push_back (*i); @@ -149,6 +160,11 @@ TempoLines::draw (std::vector& grid, for (i = grid.begin(); i != grid.end(); ++i) { if ((*i).is_bar()) { + /* keep all_bar beat density down */ + if (all_bars && beat_density > 0.3 && ((*i).bar % bar_mod) != 1) { + continue; + } + color = UIConfiguration::instance().color ("measure line bar"); } else { if (beat_density > 0.3) { @@ -161,7 +177,7 @@ TempoLines::draw (std::vector& grid, lines.add (xpos, 1.0, color); - if (beat_density <= 0.12) { + if (beat_density <= 0.12 && !all_bars) { /* draw subdivisions of this beat */ std::vector vec; vec.push_back (*i); -- cgit v1.2.3