Browse Source

Add next/prev widget bindings for sequences.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
5fb04e863b
2 changed files with 45 additions and 1 deletions
  1. +42
    -1
      Timeline/Sequence.C
  2. +3
    -0
      Timeline/Sequence.H

+ 42
- 1
Timeline/Sequence.C View File

@@ -298,8 +298,38 @@ Sequence::snap ( Sequence_Widget *r )
r->start( f ); r->start( f );
} }


/** return the location of the next widget from frame /from/ */
nframes_t
Sequence::next ( nframes_t from ) const
{
for ( list <Sequence_Widget*>::const_iterator i = _widgets.begin(); i != _widgets.end(); i++ )
if ( (*i)->start() > from )
return (*i)->start();

if ( _widgets.size() )
return _widgets.back()->start();
else
return 0;
}

/** return the location of the next widget from frame /from/ */
nframes_t
Sequence::prev ( nframes_t from ) const
{
for ( list <Sequence_Widget*>::const_reverse_iterator i = _widgets.rbegin(); i != _widgets.rend(); i++ )
if ( (*i)->start() < from )
return (*i)->start();

if ( _widgets.size() )
return _widgets.front()->start();
else
return 0;
}

#include "FL/event_name.H" #include "FL/event_name.H"


#include "Transport.H" // for locate()

int int
Sequence::handle ( int m ) Sequence::handle ( int m )
{ {
@@ -310,9 +340,20 @@ Sequence::handle ( int m )
switch ( m ) switch ( m )
{ {
case FL_KEYBOARD: case FL_KEYBOARD:
if ( Fl::test_shortcut( FL_CTRL + FL_Right ) )
{
transport->locate( next( transport->frame ) );
return 1;
}
else if ( Fl::test_shortcut( FL_CTRL + FL_Left ) )
{
transport->locate( prev( transport->frame ) );
return 1;
}
else
/* this is a hack to override FLTK's use of arrow keys for /* this is a hack to override FLTK's use of arrow keys for
* focus navigation */ * focus navigation */
return timeline->handle_scroll( m );
return timeline->handle_scroll( m );
case FL_NO_EVENT: case FL_NO_EVENT:
/* garbage from overlay window */ /* garbage from overlay window */
return 0; return 0;


+ 3
- 0
Timeline/Sequence.H View File

@@ -93,6 +93,9 @@ public:


void sort ( void ); void sort ( void );


nframes_t next ( nframes_t from ) const;
nframes_t prev ( nframes_t from ) const;

Track *track ( void ) const { return _track; } Track *track ( void ) const { return _track; }
void track ( Track *t ) { _track = t; } void track ( Track *t ) { _track = t; }




Loading…
Cancel
Save