Browse Source

Clean up sequence widget 'clone' functions.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
77621d9d77
8 changed files with 17 additions and 36 deletions
  1. +1
    -5
      Timeline/Annotation_Point.H
  2. +1
    -5
      Timeline/Annotation_Region.H
  3. +1
    -7
      Timeline/Audio_Region.C
  4. +1
    -1
      Timeline/Audio_Region.H
  5. +1
    -6
      Timeline/Control_Point.H
  6. +8
    -1
      Timeline/Sequence_Widget.H
  7. +3
    -7
      Timeline/Tempo_Point.H
  8. +1
    -4
      Timeline/Time_Point.H

+ 1
- 5
Timeline/Annotation_Point.H 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();


+ 1
- 5
Timeline/Annotation_Region.H 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 );
}

};

+ 1
- 7
Timeline/Audio_Region.C 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;


+ 1
- 1
Timeline/Audio_Region.H 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 ( )
{


+ 1
- 6
Timeline/Control_Point.H 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 );


+ 8
- 1
Timeline/Sequence_Widget.H 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
{


+ 3
- 7
Timeline/Tempo_Point.H 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; }


+ 1
- 4
Timeline/Time_Point.H 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; }


Loading…
Cancel
Save