From f8ab34b9140e2392341b0273b69547aa293f0c54 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Thu, 28 Feb 2008 21:14:21 -0600 Subject: [PATCH] Fix measure line drawing/snap messed up by addition of track headers. --- Timeline.C | 12 ++++++------ main.C | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Timeline.C b/Timeline.C index f1f998e..ea76311 100644 --- a/Timeline.C +++ b/Timeline.C @@ -147,12 +147,12 @@ Timeline::Timeline ( int X, int Y, int W, int H, const char* L ) : Fl_Group( X, { Fl_Pack *o = new Fl_Pack( X, rulers->y() + rulers->h(), W - vscroll->w(), 5000 ); o->type( Fl_Pack::VERTICAL ); - o->spacing( 10 ); + o->spacing( 5 ); Track *l = NULL; for ( int i = 16; i--; ) { - Track_Header *t = new Track_Header( 0, 0, 800, 100 ); + Track_Header *t = new Track_Header( 0, 0, W, 75 ); Track *o = new Audio_Track( 0, 0, 1, 100 ); o->prev( l ); if ( l ) @@ -206,7 +206,7 @@ Timeline::nearest_line ( int ix ) { for ( int x = ix - 10; x < ix + 10; ++x ) { - const int measure = ts_to_x( (double)(sample_rate * 60) / beats_per_minute( x_to_ts( x ) + xoffset )); + const int measure = ts_to_x( (double)(sample_rate * 60) / beats_per_minute( x_to_ts( x - Track_Header::width() ) + xoffset )); // const int abs_x = ts_to_x( xoffset ) + x; @@ -232,13 +232,13 @@ Timeline::draw_measure_lines ( int X, int Y, int W, int H, Fl_Color color ) for ( int x = X; x < X + W; ++x ) { - measure = ts_to_x( (double)(sample_rate * 60) / beats_per_minute( x_to_ts( x ) + xoffset )); + measure = ts_to_x( (double)(sample_rate * 60) / beats_per_minute( x_to_ts( x - Track_Header::width() ) + xoffset )); - const int abs_x = ts_to_x( xoffset ) + x; + const int abs_x = ts_to_x( xoffset ) + x - Track_Header::width(); if ( 0 == abs_x % measure ) { - int bpb = beats_per_bar( x_to_ts( x ) + xoffset ); + int bpb = beats_per_bar( x_to_ts( x -Track_Header::width() ) + xoffset ); if ( 0 == (abs_x / measure) % bpb ) { diff --git a/main.C b/main.C index ad27b89..318ac8e 100644 --- a/main.C +++ b/main.C @@ -66,7 +66,7 @@ void cb_undo ( Fl_Widget *w, void *v ) int main ( int argc, char **argv ) { - Fl_Window *main_window = new Fl_Window( 0, 0, 800, 600 ); + Fl_Window *main_window = new Fl_Window( 0, 0, 1024, 768 ); Fl::get_system_colors(); Fl::scheme( "plastic" ); @@ -77,7 +77,7 @@ main ( int argc, char **argv ) Loggable::register_create( "Time_Point", &Time_Point::create ); - timeline = new Timeline( 0, 24, 800, 600 - 24, "Timeline" ); + timeline = new Timeline( 0, 24, main_window->w(), main_window->h() - 24, "Timeline" ); // Region *wave = new Region( Clip::from_file( "streambass8.wav" ) );