Browse Source

Add support for additional cursors.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
ffd4dc26a8
2 changed files with 41 additions and 8 deletions
  1. +37
    -8
      Timeline/Timeline.C
  2. +4
    -0
      Timeline/Timeline.H

+ 37
- 8
Timeline/Timeline.C View File

@@ -526,26 +526,23 @@ Timeline::draw ( void )
} }


void void
Timeline::draw_playhead ( void )
Timeline::draw_cursor ( nframes_t frame, Fl_Color color )
{ {
int x = ( ts_to_x( transport->frame ) - ts_to_x( xoffset ) ) + tracks->x() + Track::width();
int x = ( ts_to_x( frame ) - ts_to_x( xoffset ) ) + tracks->x() + Track::width();


if ( x < tracks->x() + Track::width() || x > tracks->x() + tracks->w() ) if ( x < tracks->x() + Track::width() || x > tracks->x() + tracks->w() )
return; return;



fl_color( FL_RED );
fl_color( color );


int y = rulers->y() + rulers->h(); int y = rulers->y() + rulers->h();
int h = this->h() - hscroll->h(); int h = this->h() - hscroll->h();


fl_push_clip( Track::width(), y, tracks->w(), h ); fl_push_clip( Track::width(), y, tracks->w(), h );


// fl_rectf( x - 2, y, 5, 2 );

fl_line( x, y, x, h ); fl_line( x, y, x, h );


fl_color( fl_darker( FL_RED ) );
fl_color( fl_darker( color ) );


fl_line( x - 1, y, x - 1, h ); fl_line( x - 1, y, x - 1, h );


@@ -554,7 +551,7 @@ Timeline::draw_playhead ( void )
fl_line( x + 1, y, x + 1, h ); fl_line( x + 1, y, x + 1, h );


/* draw cap */ /* draw cap */
fl_color( FL_RED );
fl_color( color );
fl_begin_polygon(); fl_begin_polygon();


fl_vertex( x - 8, y ); fl_vertex( x - 8, y );
@@ -575,6 +572,16 @@ Timeline::draw_playhead ( void )
fl_end_line(); fl_end_line();


fl_pop_clip(); fl_pop_clip();

}

void
Timeline::draw_playhead ( void )
{
draw_cursor( p1, FL_BLUE );
draw_cursor( p2, FL_GREEN );

draw_cursor( transport->frame, FL_RED );
} }


void void
@@ -713,6 +720,28 @@ Timeline::handle ( int m )


return 1; return 1;
} }
case '[':
{
int X = Fl::event_x() - Track::width();

if ( X > 0 )
{
p1 = xoffset + x_to_ts( X );
}

return 1;
}
case ']':
{
int X = Fl::event_x() - Track::width();

if ( X > 0 )
{
p2 = xoffset + x_to_ts( X );
}

return 1;
}
default: default:
return Fl_Overlay_Window::handle( m ); return Fl_Overlay_Window::handle( m );
} }


+ 4
- 0
Timeline/Timeline.H View File

@@ -111,6 +111,9 @@ class Timeline : public Fl_Overlay_Window, public RWLock
nframes_t _length; nframes_t _length;




nframes_t p1, p2; /* cursors */


public: public:


Tempo_Sequence *tempo_track; Tempo_Sequence *tempo_track;
@@ -141,6 +144,7 @@ public:


void xposition ( int X ); void xposition ( int X );
void yposition ( int Y ); void yposition ( int Y );
void draw_cursor ( nframes_t frame, Fl_Color color );
void draw_playhead ( void ); void draw_playhead ( void );
void redraw_playhead ( void ); void redraw_playhead ( void );
void resize ( int X, int Y, int W, int H ); void resize ( int X, int Y, int W, int H );


Loading…
Cancel
Save