Actiavte compaction menu option.

This commit is contained in:
Jonathan Moore Liles 2008-04-23 17:29:14 -05:00
parent ba07b64e3d
commit 2e7fab494a
5 changed files with 49 additions and 7 deletions

View File

@ -333,7 +333,7 @@ Loggable::snapshot( const char *file )
{
FILE *ofp = _fp;
if ( ! ( _fp = fopen( file, "a" ) ) )
if ( ! ( _fp = fopen( file, "w" ) ) )
{
_fp = ofp;
return false;
@ -352,6 +352,24 @@ Loggable::snapshot( const char *file )
return true;
}
void
Loggable::compact ( void )
{
fclose( _fp );
_fp = NULL;
/* FIXME: don't use name here */
snapshot( "history" );
if ( ! ( _fp = fopen( "history", "a+" ) ) )
{
printf( "Could not open log file for writing!" );
// return false;
}
}
void
Loggable::log ( const char *fmt, ... )
{

View File

@ -95,6 +95,7 @@ public:
static void undo ( void );
static int undo_index ( void ) { return _undo_index; }
static bool snapshot( const char *file );
static void compact( void );
static
void

View File

@ -10,6 +10,8 @@ decl {\#include "Engine.H"} {}
decl {\#include "Transport.H"} {}
decl {\#include "Loggable.H"} {}
decl {\#include "Clock.H"} {public
}
@ -17,6 +19,8 @@ decl {\#include "Waveform.H" // for options} {}
decl {\#include "Control_Sequence.H" // for options} {}
decl {\#include <FL/fl_ask.H>} {}
decl {\#include <FL/Fl.H>} {}
class TLE {open
@ -44,7 +48,7 @@ Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );} {}
} {
Fl_Window main_window {
label {Non-DAW - Timeline} open
xywh {483 100 1024 768} type Double resizable xclass {Non-DAW} visible
xywh {581 446 1024 768} type Double resizable xclass {Non-DAW} visible
} {
Fl_Group {} {open
xywh {0 0 1024 25}
@ -66,6 +70,12 @@ Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );} {}
}
MenuItem {} {
label {&Compact}
callback {int n = fl_choice( "Compacting will replace the session history with a snapshot of the current state.\\n You will not be able to use Undo to go back beyond this point.\\n This operation is irreversible!", NULL, "Abort", "Procede with compaction" );
if ( n != 2 )
return;
Loggable::compact();} selected
xywh {20 20 40 25}
}
Submenu {} {
@ -253,7 +263,7 @@ timeline->redraw();}
}
}
Submenu {} {
label {C&olors} open selected
label {C&olors} open
xywh {0 0 74 25}
} {
MenuItem {} {

View File

@ -766,11 +766,11 @@ Timeline::handle ( int m )
Track *t = new Track( name );
add_track( t );
Sequence *o = new Audio_Sequence( t );
new Control_Sequence( t );
add_track( t );
t->track( o );
/* t->add( new Control_Sequence( t ); */
@ -966,12 +966,16 @@ Timeline::total_input_buffer_percent ( void )
}
}
if ( ! cnt )
return 0;
return r / cnt;
}
int
Timeline::total_output_buffer_percent ( void )
{
int r = 0;
int cnt = 0;
@ -987,5 +991,8 @@ Timeline::total_output_buffer_percent ( void )
}
}
if ( ! cnt )
return 0;
return r / cnt;
}

View File

@ -143,9 +143,15 @@ public:
{
Sequence *t = (Sequence*)Loggable::find( i );
assert( t );
/* FIXME: our track might not have been
* defined yet... what should we do about this
* chicken/egg problem? */
if ( t )
{
// assert( t );
track( t );
track( t );
}
}
}
}