Work on making system reset possible.

This commit is contained in:
Jonathan Moore Liles 2008-05-03 17:50:32 -05:00
parent 5f4fd49867
commit af523475c4
5 changed files with 34 additions and 3 deletions

View File

@ -69,6 +69,30 @@ Loggable::open ( const char *filename )
return true; return true;
} }
/** close journal and delete all loggable objects */
bool
Loggable::close ( void )
{
DMESSAGE( "closing journal and destroying all journaled objects" );
fclose( _fp );
_fp = NULL;
for ( int i = _log_id; i--; )
{
Loggable ** l = &_loggables[ i ];
if ( *l )
delete *l;
*l = NULL;
}
return true;
}
/** sigh. parse a string of ":name value :name value" pairs into an /** sigh. parse a string of ":name value :name value" pairs into an
* array of strings, one per pair */ * array of strings, one per pair */
// FIXME: doesn't handle the case of :name ":foo bar", nested quotes // FIXME: doesn't handle the case of :name ":foo bar", nested quotes

View File

@ -100,6 +100,7 @@ private:
public: public:
static bool open ( const char *filename ); static bool open ( const char *filename );
static bool close ( void );
static void undo ( void ); static void undo ( void );
static int undo_index ( void ) { return _undo_index; } static int undo_index ( void ) { return _undo_index; }
static void compact ( void ); static void compact ( void );

View File

@ -126,7 +126,10 @@ free( path );} {}
} { } {
MenuItem {} { MenuItem {} {
label {&New} label {&New}
xywh {0 0 40 25} deactivate callback {Loggable::close();
// timeline->reset();
main_window->redraw();} selected
xywh {0 0 40 25}
} }
MenuItem {} { MenuItem {} {
label {&Open} label {&Open}
@ -536,7 +539,7 @@ delete win;}
class Timeline class Timeline
} }
Fl_Box {} { Fl_Box {} {
label {<session name>} selected label {<session name>}
xywh {450 0 475 22} labeltype SHADOW_LABEL labelfont 2 xywh {450 0 475 22} labeltype SHADOW_LABEL labelfont 2
code0 {o->label( session_display_name );} code0 {o->label( session_display_name );}
} }

View File

@ -239,6 +239,9 @@ Track::Track ( const char *L, int channels ) :
Track::~Track ( ) Track::~Track ( )
{ {
/* FIXME: why is this necessary? */
timeline->remove_track( this );
log_destroy(); log_destroy();
} }

View File

@ -53,7 +53,7 @@ class Track : public Fl_Group, public Loggable
public: public:
Track ( const char *L, int channels=1 ); Track ( const char *L, int channels=1 );
~Track ( ); virtual ~Track ( );
static bool soloing ( void ) { return _soloing; } static bool soloing ( void ) { return _soloing; }