Add remove-selected binding. Work on transactions.

This commit is contained in:
Jonathan Moore Liles 2008-03-03 12:59:05 -06:00
parent e2c6442dee
commit 5048f70e50
6 changed files with 44 additions and 0 deletions

View File

@ -35,5 +35,6 @@ public:
int handle ( int m );
void dump ( void );
void remove_selected ( void );
};

View File

@ -412,6 +412,23 @@ Timeline::handle ( int m )
switch ( m )
{
case FL_KEYBOARD:
{
switch ( Fl::event_key() )
{
case FL_Delete:
{
for ( int i = tracks->children(); i--; )
{
Track_Header *t = (Track_Header*)tracks->child( i );
t->track()->remove_selected();
}
return 1;
}
}
}
/* case FL_MOUSEWHEEL: */
/* { */

19
Track.C
View File

@ -82,6 +82,25 @@ Track::remove ( Track_Widget *r )
}
void
Track::remove_selected ( void )
{
Loggable::block_start();
for ( list <Track_Widget *>::iterator r = _widgets.begin(); r != _widgets.end(); )
if ( (*r)->selected() )
{
Track_Widget *t = *r;
_widgets.erase( r++ );
delete t;
}
else
++r;
Loggable::block_end();
}
Track_Widget *
Track::event_widget ( void )
{

View File

@ -112,6 +112,8 @@ public:
void remove ( Track_Widget *r );
void add ( Track_Widget *r );
void remove_selected ( void );
const list <Track_Widget *> widgets ( void ) const { return _widgets; }
void queue_delete ( Track_Widget *r )

View File

@ -48,6 +48,8 @@ private:
int _size;
enum { AUDIO } _type;
public:
Fl_Input * name_field;
@ -198,6 +200,7 @@ public:
static int width();
void track( Track * t );
Track * track ( void ) { return _track; }
int handle ( int m )
{

View File

@ -59,6 +59,8 @@ public:
_track->remove( this );
}
bool selected ( void ) { return _selected; }
Fl_Group * parent ( void ) const { return _track; }
int scroll_x ( void ) const { return timeline->ts_to_x( timeline->xoffset ); }