summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_tempodisplay.cc
diff options
context:
space:
mode:
authorNick Mainsbridge <beatroute@iprimus.com.au>2006-09-04 16:04:09 +0000
committerNick Mainsbridge <beatroute@iprimus.com.au>2006-09-04 16:04:09 +0000
commite513d106d7ecf7e629f55c6eb554a2638f9c6443 (patch)
tree7e83ab0e27756e4912ef75ba4ae1f5609ccc5467 /gtk2_ardour/editor_tempodisplay.cc
parentcb17e3cc81c364ed0ea7f4620d745aefe691386a (diff)
lower zoom step slightly, speed up autoscrolling when snapping to sub-beats (esp 32), make grid lines disappear when on coarse zoom, put grid lines in the idle thread (called from the idle thread.. interesting..), make current_bbt_points coarser so the bbt_ruler and grid lines can use it instead of making their own list, clean up bbt ruler.
git-svn-id: svn://localhost/ardour2/trunk@905 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_tempodisplay.cc')
-rw-r--r--gtk2_ardour/editor_tempodisplay.cc65
1 files changed, 53 insertions, 12 deletions
diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc
index 7dfeb7f2ae..e922299992 100644
--- a/gtk2_ardour/editor_tempodisplay.cc
+++ b/gtk2_ardour/editor_tempodisplay.cc
@@ -96,14 +96,47 @@ void
Editor::tempo_map_changed (Change ignored)
{
ENSURE_GUI_THREAD(bind (mem_fun(*this, &Editor::tempo_map_changed), ignored));
-
+
+ BBT_Time previous_beat, next_beat; // the beats previous to the leftmost frame and after the rightmost frame
+
+ session->bbt_time(leftmost_frame, previous_beat);
+
+ previous_beat.ticks = 0;
+ if (previous_beat.beats > 1) {
+ previous_beat.beats -= 1;
+ } else if (previous_beat.bars > 1) {
+ previous_beat.bars--;
+ previous_beat.beats += 1;
+ }
+
+ session->bbt_time(leftmost_frame + current_page_frames(), next_beat);
+
+ if (session->tempo_map().meter_at(leftmost_frame + current_page_frames()).beats_per_bar () > next_beat.beats + 1) {
+ next_beat.beats += 1;
+ next_beat.ticks = 0;
+ } else {
+ next_beat.bars += 1;
+ next_beat.beats = 1;
+ next_beat.ticks = 0;
+ }
+
if (current_bbt_points) {
- delete current_bbt_points;
+ delete current_bbt_points;
current_bbt_points = 0;
}
if (session) {
- current_bbt_points = session->tempo_map().get_points (leftmost_frame, leftmost_frame + current_page_frames());
+ current_bbt_points = session->tempo_map().get_points (session->tempo_map().frame_time (previous_beat), session->tempo_map().frame_time (next_beat));
+
+ /*
+ TempoMap::BBTPointList::iterator i;
+ cerr << "******************" << endl << "current bbt points dump: " << endl;
+ for (i = current_bbt_points->begin(); i != current_bbt_points->end(); i++) {
+ cerr << (*i).bar << " : " << (*i).beat << endl;
+ }
+ cerr << "******************" << endl;
+ */
+
} else {
current_bbt_points = 0;
}
@@ -114,10 +147,11 @@ Editor::tempo_map_changed (Change ignored)
void
Editor::redisplay_tempo ()
{
+
hide_measures ();
if (session && current_bbt_points) {
- draw_measures ();
+ Glib::signal_idle().connect (mem_fun (*this, &Editor::draw_measures));
update_tempo_based_rulers ();
}
}
@@ -149,22 +183,21 @@ Editor::get_time_line ()
return line;
}
-void
+bool
Editor::draw_measures ()
{
if (session == 0 || _show_measures == false) {
- return;
+ return false;
}
- TempoMap::BBTPointList::iterator i = current_bbt_points->begin();
- TempoMap::BBTPoint& p = (*i);
+ TempoMap::BBTPointList::iterator i;
ArdourCanvas::SimpleLine *line;
gdouble xpos, last_xpos;
uint32_t cnt;
uint32_t color;
if (current_bbt_points == 0 || current_bbt_points->empty()) {
- return;
+ return false;
}
cnt = 0;
@@ -176,7 +209,7 @@ Editor::draw_measures ()
gdouble beat_spacing = 0;
for (i = current_bbt_points->begin(); i != current_bbt_points->end() && beat_spacing == 0; ++i) {
- TempoMap::BBTPoint& p = (*i);
+ TempoMap::BBTPoint& p = (*i);
switch (p.type) {
case TempoMap::Bar:
@@ -191,13 +224,20 @@ Editor::draw_measures ()
}
}
+ if (beat_spacing < 12.0) {
+ /*
+ if the lines are too close together,
+ they become useless
+ */
+ return false;
+ }
+
double x1, x2, y1, y2;
track_canvas.get_scroll_region (x1, y1, x2, y2);
- //y2 = 1000000000.0f;
for (i = current_bbt_points->begin(); i != current_bbt_points->end(); ++i) {
- p = (*i);
+ TempoMap::BBTPoint& p = (*i);
switch (p.type) {
case TempoMap::Bar:
@@ -239,6 +279,7 @@ Editor::draw_measures ()
cursor_group->raise_to_top();
time_line_group->lower_to_bottom();
+ return false;
}
void