Make deletion of container widgets undoable!

This commit is contained in:
Jonathan Moore Liles 2008-06-05 23:14:00 -05:00
parent 0eeb63749f
commit aa0f65af21
6 changed files with 43 additions and 10 deletions

View File

@ -83,9 +83,15 @@ public:
~Annotation_Sequence ( ) ~Annotation_Sequence ( )
{ {
Loggable::block_start();
clear();
log_destroy(); log_destroy();
track()->remove( this ); track()->remove( this );
Loggable::block_end();
} }
int handle ( int m ) int handle ( int m )

View File

@ -49,9 +49,15 @@ Audio_Sequence::Audio_Sequence ( Track *track ) : Sequence( track )
Audio_Sequence::~Audio_Sequence ( ) Audio_Sequence::~Audio_Sequence ( )
{ {
Loggable::block_start();
clear();
log_destroy(); log_destroy();
track()->remove( this ); track()->remove( this );
Loggable::block_end();
} }

View File

@ -52,6 +52,11 @@ Control_Sequence::Control_Sequence ( Track *track ) : Sequence( 0 )
Control_Sequence::~Control_Sequence ( ) Control_Sequence::~Control_Sequence ( )
{ {
Loggable::block_start();
clear();
log_destroy(); log_destroy();
engine->lock(); engine->lock();
@ -65,6 +70,8 @@ Control_Sequence::~Control_Sequence ( )
delete _output; delete _output;
_output = NULL; _output = NULL;
Loggable::block_end();
} }
void void

View File

@ -61,14 +61,9 @@ Sequence::init ( void )
// clear_visible_focus(); // clear_visible_focus();
} }
Sequence::~Sequence ( ) void
Sequence::clear ( void )
{ {
DMESSAGE( "destroying sequence" );
if ( _name )
free( _name );
for ( std::list <Sequence_Widget*>::iterator i = _widgets.begin(); for ( std::list <Sequence_Widget*>::iterator i = _widgets.begin();
i != _widgets.end(); ++i ) i != _widgets.end(); ++i )
{ {
@ -82,6 +77,17 @@ Sequence::~Sequence ( )
_widgets.clear(); _widgets.clear();
} }
Sequence::~Sequence ( )
{
DMESSAGE( "destroying sequence" );
if ( _name )
free( _name );
if ( _widgets.size() )
FATAL( "programming error: leaf destructor must call Sequence::clear()!" );
}
nframes_t nframes_t
Sequence::x_to_offset ( int X ) Sequence::x_to_offset ( int X )
{ {

View File

@ -92,6 +92,7 @@ public:
} }
void sort ( void ); void sort ( void );
void clear ( void );
nframes_t next ( nframes_t from ) const; nframes_t next ( nframes_t from ) const;
nframes_t prev ( nframes_t from ) const; nframes_t prev ( nframes_t from ) const;

View File

@ -247,6 +247,14 @@ Track::Track ( const char *L, int channels ) :
Track::~Track ( ) Track::~Track ( )
{ {
Loggable::block_start();
takes = NULL;
control = NULL;
annotation = NULL;
Fl_Group::clear();
log_destroy(); log_destroy();
timeline->remove_track( this ); timeline->remove_track( this );
@ -256,12 +264,11 @@ Track::~Track ( )
configure_outputs( 0 ); configure_outputs( 0 );
_sequence = NULL; _sequence = NULL;
takes = NULL;
control = NULL;
annotation = NULL;
if ( _name ) if ( _name )
free( _name ); free( _name );
Loggable::block_end();
} }