From 8972817a8a905efb38f409caa28161b80ea9c228 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Fri, 29 Feb 2008 23:42:03 -0600 Subject: [PATCH] Add option to disable drawing of measure lines. --- Timeline.C | 13 ++++++++++--- Timeline.H | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Timeline.C b/Timeline.C index 2b79676..bac73fe 100644 --- a/Timeline.C +++ b/Timeline.C @@ -71,6 +71,8 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Overlay_Wi box( FL_FLAT_BOX ); xoffset = 0; + _enable_measure_lines = true; + X = Y = 0; { Scalebar *o = new Scalebar( X, Y + H - 18, W - 18, 18 ); @@ -223,17 +225,21 @@ Timeline::nearest_line ( int ix ) return -1; } -/* draw appropriate measure lines inside the given bounding box */ +/** draw appropriate measure lines inside the given bounding box */ +/* FIXME: this function *really* needs to be optimized. Currently it + searched both the time and tempo lists once for every horiontal + pixel and performs a number of calculations--this is slow. */ void Timeline::draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color ) { + if ( ! _enable_measure_lines ) + return; + fl_line_style( FL_DASH, 2 ); Fl_Color beat = fl_color_average( FL_BLACK, color, 0.65f ); Fl_Color bar = fl_color_average( FL_RED, color, 0.65f ); -// int measure = ts_to_x( sample_rate * 60 / beats_per_minute() ); - int measure; for ( int x = X; x < X + W; ++x ) @@ -267,6 +273,7 @@ Timeline::draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color ) } fl_line_style( FL_SOLID, 0 ); + } diff --git a/Timeline.H b/Timeline.H index 071bcfd..7c23633 100644 --- a/Timeline.H +++ b/Timeline.H @@ -57,6 +57,8 @@ struct Timeline : public Fl_Overlay_Window int _old_xposition; int _old_yposition; + bool _enable_measure_lines; + enum snap_flags_e { SNAP_TO_REGION, SNAP_TO_BAR,