Clean up sequence widget copy constructors.

pull/3/head
Jonathan Moore Liles 2008-05-07 19:04:47 -05:00
parent 7f25ebe855
commit edb9be37ab
15 changed files with 59 additions and 25 deletions

View File

@ -6,7 +6,7 @@ FLTK_LIBS := `fltk-config --ldflags`
JACK_LIBS := `pkg-config --libs jack`
SNDFILE_LIBS := `pkg-config --libs sndfile`
CXXFLAGS := -DVERSION=\"$(VERSION)\" -ggdb -Wall -O0 -fno-rtti -fno-exceptions
CXXFLAGS := -DVERSION=\"$(VERSION)\" -ggdb -Wextra -Wno-missing-field-initializers -O0 -fno-rtti -fno-exceptions
all: makedepend FL Timeline Mixer

View File

@ -77,10 +77,9 @@ public:
log_create();
}
Annotation_Point ( const Annotation_Point &rhs )
Annotation_Point ( const Annotation_Point &rhs ) : Sequence_Point( rhs )
{
_r->start = rhs._r->start;
_label = strdup( rhs._label );
log_create();
}
~Annotation_Point ( )

View File

@ -62,12 +62,11 @@ Annotation_Region::Annotation_Region ( Sequence *sequence, nframes_t when, const
log_create();
}
Annotation_Region::Annotation_Region ( const Annotation_Region &rhs )
Annotation_Region::Annotation_Region ( const Annotation_Region &rhs ) : Sequence_Region( rhs )
{
_r->start = rhs._r->start;
_r->length = rhs._r->length;
_label = strdup( rhs._label );
log_create();
}

View File

@ -49,6 +49,8 @@ protected:
_label = NULL;
}
Annotation_Region ( const Annotation_Region &rhs );
public:
/* for loggable */
@ -56,7 +58,6 @@ public:
SEQUENCE_WIDGET_CLONE_FUNC( Annotation_Region );
Annotation_Region ( Sequence *track, nframes_t when, const char *name );
Annotation_Region ( const Annotation_Region &rhs );
virtual ~Annotation_Region ( );
void draw_box ( void );

View File

@ -127,9 +127,9 @@ Audio_Region::init ( void )
}
/* copy constructor */
Audio_Region::Audio_Region ( const Audio_Region & rhs )
Audio_Region::Audio_Region ( const Audio_Region & rhs ) : Sequence_Region( rhs )
{
*((Sequence_Region*)this) = (Sequence_Region &)rhs;
// *((Sequence_Region*)this) = (Sequence_Region &)rhs;
_clip = rhs._clip;
_scale = rhs._scale;

View File

@ -29,10 +29,11 @@ Control_Point::Control_Point ( Sequence *t, nframes_t when, float y )
log_create();
}
Control_Point::Control_Point ( const Control_Point &rhs )
Control_Point::Control_Point ( const Control_Point &rhs ) : Sequence_Point( rhs )
{
_r->start = rhs._r->start;
_y = rhs._y;
log_create();
}
void

View File

@ -36,6 +36,8 @@ protected:
virtual void get ( Log_Entry &e ) const;
virtual void set ( Log_Entry &e );
Control_Point ( const Control_Point &rhs );
public:
@ -44,7 +46,6 @@ public:
SEQUENCE_WIDGET_CLONE_FUNC( Control_Point );
Control_Point ( Sequence *t, nframes_t when, float y );
Control_Point ( const Control_Point &rhs );
~Control_Point ( )
{

View File

@ -223,6 +223,13 @@ protected:
void log_create ( void ) const;
void log_destroy ( void ) const;
/* leaf subclasses *must* call log_create() at the end of their copy contructors */
Loggable ( const Loggable &rhs )
{
/* FIXME: get a real id here!!! */
_id = 0;
}
public:
// virtual const char *class_name ( void ) const = 0;

View File

@ -28,8 +28,6 @@ Sequence_Point::get ( Log_Entry &e ) const
void
Sequence_Point::set ( Log_Entry &e )
{
Sequence_Widget::set( e );
for ( int i = 0; i < e.size(); ++i )
{
const char *s, *v;
@ -42,6 +40,8 @@ Sequence_Point::set ( Log_Entry &e )
}
}
Sequence_Widget::set( e );
}
static void

View File

@ -31,6 +31,12 @@ protected:
void get ( Log_Entry &e ) const;
void set ( Log_Entry &e );
Sequence_Point ( const Sequence_Point &rhs ) : Sequence_Widget( rhs )
{
if ( _label )
_label = strdup( rhs._label );
}
public:
const char *name ( void ) const { return _label; }

View File

@ -43,6 +43,11 @@ protected:
}
Sequence_Region ( const Sequence_Region &rhs ) : Sequence_Widget( rhs )
{
}
public:
LOG_NAME_FUNC( Region );

View File

@ -64,8 +64,6 @@ class Sequence_Widget : public Loggable
static Fl_Color _selection_color;
/* can't have this */
Sequence_Widget ( const Sequence_Widget &rhs );
protected:
@ -82,6 +80,20 @@ protected:
virtual void get ( Log_Entry &e ) const;
virtual void set ( Log_Entry &e );
/* careful with this, it doesn't journal */
Sequence_Widget ( const Sequence_Widget &rhs ) : Loggable( rhs )
{
_drag = NULL;
_sequence = rhs._sequence;
_range = rhs._range;
_r = &_range;
_color = rhs._color;
_box_color = rhs._box_color;
};
public:
Sequence_Widget ( )

View File

@ -25,8 +25,9 @@
void
Tempo_Point::get ( Log_Entry &e ) const
{
Sequence_Point::get( e );
// Sequence_Point::get( e );
e.add( ":start", start() );
e.add( ":tempo", _tempo );
}

View File

@ -55,10 +55,11 @@ public:
~Tempo_Point ( );
Tempo_Point ( const Tempo_Point &rhs )
Tempo_Point ( const Tempo_Point &rhs ) : Sequence_Point( rhs )
{
_r->offset = rhs._r->offset;
_tempo = rhs._tempo;
log_create();
}

View File

@ -24,9 +24,9 @@
void
Time_Point::get ( Log_Entry &e ) const
{
// Sequence_Point::get( e );
Sequence_Point::get( e );
e.add( ":start", start() );
e.add( ":beats_per_bar", _time.beats_per_bar );
e.add( ":beat_type", _time.beat_type );
}
@ -74,8 +74,9 @@ Time_Point::Time_Point ( nframes_t when, int bpb, int note ) : _time( bpb, note
log_create();
}
Time_Point::Time_Point ( const Time_Point &rhs )
Time_Point::Time_Point ( const Time_Point &rhs ) : Sequence_Point( rhs )
{
_r->offset = rhs._r->offset;
_time = rhs._time;
log_create();
}