Clean up sequence widget 'clone' functions.

pull/3/head
Jonathan Moore Liles 2008-05-07 18:09:52 -05:00
parent 9df497a50a
commit 77621d9d77
8 changed files with 17 additions and 36 deletions

View File

@ -64,6 +64,7 @@ public:
/* for loggable */
LOG_CREATE_FUNC( Annotation_Point );
SEQUENCE_WIDGET_CLONE_FUNC( Annotation_Point );
Annotation_Point ( Sequence *sequence, nframes_t when, const char *name )
{
@ -82,11 +83,6 @@ public:
_label = strdup( rhs._label );
}
Sequence_Widget *clone ( const Sequence_Widget *r )
{
return new Annotation_Point( *(Annotation_Point*)r );
}
~Annotation_Point ( )
{
log_destroy();

View File

@ -53,6 +53,7 @@ public:
/* for loggable */
LOG_CREATE_FUNC( Annotation_Region );
SEQUENCE_WIDGET_CLONE_FUNC( Annotation_Region );
Annotation_Region ( Sequence *track, nframes_t when, const char *name );
Annotation_Region ( const Annotation_Region &rhs );
@ -62,9 +63,4 @@ public:
void draw ( void );
int handle ( int m );
Sequence_Widget *clone ( const Sequence_Widget *r )
{
return new Annotation_Region( *(Annotation_Region*)r );
}
};

View File

@ -140,12 +140,6 @@ Audio_Region::Audio_Region ( const Audio_Region & rhs )
log_create();
}
Sequence_Widget *
Audio_Region::clone ( const Sequence_Widget *r )
{
return new Audio_Region( *(Audio_Region*)r );
}
/* */
Audio_Region::Audio_Region ( Audio_File *c )
{
@ -383,7 +377,7 @@ Audio_Region::handle ( int m )
int d = (ox + X) - x();
long td = timeline->x_to_ts( d );
if ( td > 0 && os < td )
if ( td > 0 && os < (nframes_t)td )
_r->offset = 0;
else
_r->offset = os - td;

View File

@ -127,7 +127,7 @@ public:
LOG_CREATE_FUNC( Audio_Region );
Sequence_Widget *clone ( const Sequence_Widget *r );
SEQUENCE_WIDGET_CLONE_FUNC( Audio_Region );
~Audio_Region ( )
{

View File

@ -41,12 +41,7 @@ public:
/* for loggable */
LOG_CREATE_FUNC( Control_Point );
Sequence_Widget *clone ( const Sequence_Widget *r )
{
return new Control_Point( *(Control_Point*)r );
}
SEQUENCE_WIDGET_CLONE_FUNC( Control_Point );
Control_Point ( Sequence *t, nframes_t when, float y );
Control_Point ( const Control_Point &rhs );

View File

@ -128,7 +128,14 @@ public:
/* *this = rhs; */
/* } */
virtual Sequence_Widget *clone ( const Sequence_Widget *r ) = 0;
#define SEQUENCE_WIDGET_CLONE_FUNC(class) \
virtual Sequence_Widget *clone ( void ) const \
{ \
return new class ( *this ); \
} \
\
// virtual Sequence_Widget *clone ( const Sequence_Widget *r ) = 0;
virtual Sequence_Widget *clone ( void ) const = 0;
bool selected ( void ) const
{

View File

@ -46,9 +46,10 @@ protected:
public:
static bool edit ( float *tempo );
LOG_CREATE_FUNC( Tempo_Point );
SEQUENCE_WIDGET_CLONE_FUNC( Tempo_Point );
static bool edit ( float *tempo );
Tempo_Point ( nframes_t when, float bpm );
@ -60,11 +61,6 @@ public:
_tempo = rhs._tempo;
}
Sequence_Widget *clone ( const Sequence_Widget *r )
{
return new Tempo_Point( *(Tempo_Point*)r );
}
float tempo ( void ) const
{ return _tempo; }

View File

@ -69,6 +69,7 @@ protected:
public:
LOG_CREATE_FUNC( Time_Point );
SEQUENCE_WIDGET_CLONE_FUNC( Time_Point );
Time_Point ( nframes_t when, int bpb, int note );
Time_Point ( const Time_Point &rhs );
@ -78,10 +79,6 @@ public:
log_destroy();
}
Sequence_Widget *clone ( const Sequence_Widget *r )
{
return new Time_Point( *(Time_Point*)r );
}
void time ( int bpb, int note ) { _time.beats_per_bar = bpb; _time.beat_type = note; }
time_sig time ( void ) const { return _time; }