Browse Source

Actiavte compaction menu option.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
2e7fab494a
5 changed files with 50 additions and 8 deletions
  1. +19
    -1
      Timeline/Loggable.C
  2. +1
    -0
      Timeline/Loggable.H
  3. +12
    -2
      Timeline/TLE.fl
  4. +9
    -2
      Timeline/Timeline.C
  5. +9
    -3
      Timeline/Track.H

+ 19
- 1
Timeline/Loggable.C View File

@@ -333,7 +333,7 @@ Loggable::snapshot( const char *file )
{ {
FILE *ofp = _fp; FILE *ofp = _fp;


if ( ! ( _fp = fopen( file, "a" ) ) )
if ( ! ( _fp = fopen( file, "w" ) ) )
{ {
_fp = ofp; _fp = ofp;
return false; return false;
@@ -352,6 +352,24 @@ Loggable::snapshot( const char *file )
return true; 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 void
Loggable::log ( const char *fmt, ... ) Loggable::log ( const char *fmt, ... )
{ {


+ 1
- 0
Timeline/Loggable.H View File

@@ -95,6 +95,7 @@ public:
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 bool snapshot( const char *file ); static bool snapshot( const char *file );
static void compact( void );


static static
void void


+ 12
- 2
Timeline/TLE.fl View File

@@ -10,6 +10,8 @@ decl {\#include "Engine.H"} {}


decl {\#include "Transport.H"} {} decl {\#include "Transport.H"} {}


decl {\#include "Loggable.H"} {}

decl {\#include "Clock.H"} {public decl {\#include "Clock.H"} {public
} }


@@ -17,6 +19,8 @@ decl {\#include "Waveform.H" // for options} {}


decl {\#include "Control_Sequence.H" // for options} {} decl {\#include "Control_Sequence.H" // for options} {}


decl {\#include <FL/fl_ask.H>} {}

decl {\#include <FL/Fl.H>} {} decl {\#include <FL/Fl.H>} {}


class TLE {open class TLE {open
@@ -44,7 +48,7 @@ Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );} {}
} { } {
Fl_Window main_window { Fl_Window main_window {
label {Non-DAW - Timeline} open 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 Fl_Group {} {open
xywh {0 0 1024 25} xywh {0 0 1024 25}
@@ -66,6 +70,12 @@ Fl::add_timeout( STATUS_UPDATE_FREQ, update_cb, this );} {}
} }
MenuItem {} { MenuItem {} {
label {&Compact} 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} xywh {20 20 40 25}
} }
Submenu {} { Submenu {} {
@@ -253,7 +263,7 @@ timeline->redraw();}
} }
} }
Submenu {} { Submenu {} {
label {C&olors} open selected
label {C&olors} open
xywh {0 0 74 25} xywh {0 0 74 25}
} { } {
MenuItem {} { MenuItem {} {


+ 9
- 2
Timeline/Timeline.C View File

@@ -766,11 +766,11 @@ Timeline::handle ( int m )


Track *t = new Track( name ); Track *t = new Track( name );


add_track( t );

Sequence *o = new Audio_Sequence( t ); Sequence *o = new Audio_Sequence( t );
new Control_Sequence( t ); new Control_Sequence( t );


add_track( t );

t->track( o ); t->track( o );


/* t->add( new Control_Sequence( t ); */ /* t->add( new Control_Sequence( t ); */
@@ -966,12 +966,16 @@ Timeline::total_input_buffer_percent ( void )
} }
} }


if ( ! cnt )
return 0;

return r / cnt; return r / cnt;
} }


int int
Timeline::total_output_buffer_percent ( void ) Timeline::total_output_buffer_percent ( void )
{ {

int r = 0; int r = 0;


int cnt = 0; int cnt = 0;
@@ -987,5 +991,8 @@ Timeline::total_output_buffer_percent ( void )
} }
} }


if ( ! cnt )
return 0;

return r / cnt; return r / cnt;
} }

+ 9
- 3
Timeline/Track.H View File

@@ -143,9 +143,15 @@ public:
{ {
Sequence *t = (Sequence*)Loggable::find( i ); Sequence *t = (Sequence*)Loggable::find( i );


assert( t );

track( 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 );
}
} }
} }
} }


Loading…
Cancel
Save