Fix measure line drawing/snap messed up by addition of track headers.
This commit is contained in:
parent
2e8999c103
commit
f8ab34b914
12
Timeline.C
12
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 )
|
||||
{
|
||||
|
|
4
main.C
4
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" ) );
|
||||
|
||||
|
|
Loading…
Reference in New Issue