@@ -25,23 +25,20 @@ | |||||
#include <FL/Fl_Input.H> | #include <FL/Fl_Input.H> | ||||
class Audio_Sequence : public Sequence | |||||
class Audio_Sequence : public Sequence, public Loggable | |||||
{ | { | ||||
protected: | protected: | ||||
virtual void get ( Log_Entry &e ) const | virtual void get ( Log_Entry &e ) const | ||||
{ | { | ||||
Sequence::get( e ); | |||||
e.add( ":t", _track ); | e.add( ":t", _track ); | ||||
e.add( ":n", name() ); | |||||
} | } | ||||
void | void | ||||
set ( Log_Entry &e ) | set ( Log_Entry &e ) | ||||
{ | { | ||||
Sequence::set( e ); | |||||
for ( int i = 0; i < e.size(); ++i ) | for ( int i = 0; i < e.size(); ++i ) | ||||
{ | { | ||||
const char *s, *v; | const char *s, *v; | ||||
@@ -58,6 +55,8 @@ protected: | |||||
t->track( this ); | t->track( this ); | ||||
} | } | ||||
else if ( ! strcmp( ":n", s ) ) | |||||
name( strdup( v ) ); | |||||
} | } | ||||
} | } | ||||
@@ -62,16 +62,13 @@ Control_Sequence::init ( void ) | |||||
void | void | ||||
Control_Sequence::get ( Log_Entry &e ) const | Control_Sequence::get ( Log_Entry &e ) const | ||||
{ | { | ||||
Sequence::get( e ); | |||||
e.add( ":t", _track ); | e.add( ":t", _track ); | ||||
e.add( ":n", name() ); | |||||
} | } | ||||
void | void | ||||
Control_Sequence::set ( Log_Entry &e ) | Control_Sequence::set ( Log_Entry &e ) | ||||
{ | { | ||||
Sequence::set( e ); | |||||
for ( int i = 0; i < e.size(); ++i ) | for ( int i = 0; i < e.size(); ++i ) | ||||
{ | { | ||||
const char *s, *v; | const char *s, *v; | ||||
@@ -88,6 +85,9 @@ Control_Sequence::set ( Log_Entry &e ) | |||||
t->add( this ); | t->add( this ); | ||||
} | } | ||||
else if ( ! strcmp( ":n", s ) ) | |||||
name( strdup( v ) ); | |||||
} | } | ||||
} | } | ||||
@@ -23,7 +23,7 @@ | |||||
#include "Control_Point.H" | #include "Control_Point.H" | ||||
#include "Port.H" | #include "Port.H" | ||||
class Control_Sequence : public Sequence | |||||
class Control_Sequence : public Sequence, public Loggable | |||||
{ | { | ||||
public: | public: | ||||
@@ -36,6 +36,25 @@ using namespace std; | |||||
#include "debug.h" | #include "debug.h" | ||||
/* welcome to C++ */ | |||||
class Loggable_ID | |||||
{ | |||||
protected: | |||||
int _id; | |||||
public: | |||||
Loggable_ID ( ) : _id( 0 ) { } | |||||
virtual ~Loggable_ID ( ) { } | |||||
int id ( void ) { return _id; } | |||||
virtual const char *class_name ( void ) const = 0; | |||||
}; | |||||
class Log_Entry; | class Log_Entry; | ||||
class Loggable; | class Loggable; | ||||
typedef Loggable *(create_func)(Log_Entry &); | typedef Loggable *(create_func)(Log_Entry &); | ||||
@@ -59,7 +78,7 @@ typedef Loggable *(create_func)(Log_Entry &); | |||||
class Logger; | class Logger; | ||||
class Loggable | |||||
class Loggable : public Loggable_ID | |||||
{ | { | ||||
static FILE *_fp; | static FILE *_fp; | ||||
@@ -75,7 +94,6 @@ class Loggable | |||||
private: | private: | ||||
int _id; | |||||
char **_old_state; | char **_old_state; | ||||
char **_new_state; | char **_new_state; | ||||
@@ -194,9 +212,7 @@ protected: | |||||
public: | public: | ||||
virtual const char *class_name ( void ) const = 0; | |||||
int id ( void ) { return _id; } | |||||
// virtual const char *class_name ( void ) const = 0; | |||||
friend class Logger; | friend class Logger; | ||||
@@ -340,7 +356,7 @@ public: | |||||
ADD( nframes_t, "%lu", (unsigned long)v ); | ADD( nframes_t, "%lu", (unsigned long)v ); | ||||
ADD( unsigned long, "%lu", v ); | ADD( unsigned long, "%lu", v ); | ||||
ADD( const char *, "\"%s\"", v ? v : "" ); | ADD( const char *, "\"%s\"", v ? v : "" ); | ||||
ADD( Loggable *, "0x%X", v ? v->id() : 0 ); | |||||
ADD( Loggable_ID *, "0x%X", v ? v->id() : 0 ); | |||||
ADD( float, "%f", v ); | ADD( float, "%f", v ); | ||||
ADD( double, "%f", v ); | ADD( double, "%f", v ); | ||||
@@ -38,7 +38,7 @@ class Sequence_Widget; | |||||
/* This is the base class for all track types. */ | /* This is the base class for all track types. */ | ||||
class Sequence : public Fl_Widget, public Loggable | |||||
class Sequence : public Fl_Widget, public Loggable_ID | |||||
{ | { | ||||
static queue <Sequence_Widget *> _delete_queue; | static queue <Sequence_Widget *> _delete_queue; | ||||
@@ -53,43 +53,9 @@ protected: | |||||
std::list <Sequence_Widget *> _widgets; | std::list <Sequence_Widget *> _widgets; | ||||
Sequence_Widget *event_widget ( void ); | Sequence_Widget *event_widget ( void ); | ||||
// virtual const char *class_name ( void ) { return "Sequence"; } | |||||
virtual void set ( Log_Entry &e ) | |||||
{ | |||||
for ( int i = 0; i < e.size(); ++i ) | |||||
{ | |||||
const char *s, *v; | |||||
e.get( i, &s, &v ); | |||||
if ( ! strcmp( ":n", s ) ) | |||||
{ | |||||
name( strdup( v ) ); | |||||
} | |||||
} | |||||
} | |||||
virtual void get ( Log_Entry &e ) const | |||||
{ | |||||
e.add( ":n", name() ); | |||||
// e.add( ":t", _track ); | |||||
/* s += sprintf( s, ":items " ); */ | |||||
/* for ( list <Sequence_Widget *>::const_iterator i = _widgets.begin(); i != _widgets.end(); i++ ) */ | |||||
/* { */ | |||||
/* s += sprintf( s, "0x%X", ((Loggable*)(*i))->id() ); */ | |||||
/* list <Sequence_Widget *>::const_iterator e = i; */ | |||||
/* if ( ++e != _widgets.end() ) */ | |||||
/* s += sprintf( s, "," ); */ | |||||
/* } */ | |||||
} | |||||
public: | public: | ||||
/* welcome to C++ */ | |||||
LOG_NAME_FUNC( Sequence ); | LOG_NAME_FUNC( Sequence ); | ||||
Sequence ( int X, int Y, int W, int H, Track *track=0 ); | Sequence ( int X, int Y, int W, int H, Track *track=0 ); | ||||
@@ -331,6 +331,12 @@ Timeline::draw_measure ( nframes_t when, int Y, int W, int H, Fl_Color color, me | |||||
if ( ! draw_with_measure_lines ) | if ( ! draw_with_measure_lines ) | ||||
return; | return; | ||||
if ( ! tempo_track->_widgets.size() || ! time_track->_widgets.size() ) | |||||
{ | |||||
DWARNING( "No tempo/time points" ); | |||||
return; | |||||
} | |||||
fl_line_style( FL_DASH, 0 ); | fl_line_style( FL_DASH, 0 ); | ||||
const Fl_Color beat = fl_color_average( FL_BLACK, color, 0.65f ); | const Fl_Color beat = fl_color_average( FL_BLACK, color, 0.65f ); | ||||
@@ -367,6 +373,7 @@ Timeline::draw_measure ( nframes_t when, int Y, int W, int H, Fl_Color color, me | |||||
break; | break; | ||||
} | } | ||||
--tpi; | --tpi; | ||||
/* start on the next beat */ | /* start on the next beat */ | ||||