diff --git a/timeline/src/Annotation_Region.C b/timeline/src/Annotation_Region.C index 7e30b5a..dc1b127 100644 --- a/timeline/src/Annotation_Region.C +++ b/timeline/src/Annotation_Region.C @@ -67,8 +67,6 @@ Annotation_Region::Annotation_Region ( Sequence *sequence, nframes_t when, const Annotation_Region::Annotation_Region ( const Annotation_Region &rhs ) : Sequence_Region( rhs ) { - _label = strdup( rhs._label ); - log_create(); } @@ -76,7 +74,6 @@ Annotation_Region::Annotation_Region ( const Annotation_Region &rhs ) : Sequence Annotation_Region::~Annotation_Region ( ) { log_destroy(); - if ( _label ) free( _label ); } void diff --git a/timeline/src/Sequence_Point.C b/timeline/src/Sequence_Point.C index b461f19..afb8377 100644 --- a/timeline/src/Sequence_Point.C +++ b/timeline/src/Sequence_Point.C @@ -25,23 +25,15 @@ Sequence_Point::Sequence_Point ( const Sequence_Point &rhs ) : Sequence_Widget( rhs ) { - if ( rhs._label ) - _label = strdup( rhs._label ); - else - _label = 0; } Sequence_Point::Sequence_Point ( ) { - _label = NULL; - color( FL_CYAN ); } Sequence_Point::~Sequence_Point ( ) { - if ( _label ) - free( _label ); } diff --git a/timeline/src/Sequence_Point.H b/timeline/src/Sequence_Point.H index 715a0b9..f80a79a 100644 --- a/timeline/src/Sequence_Point.H +++ b/timeline/src/Sequence_Point.H @@ -31,25 +31,15 @@ protected: void get ( Log_Entry &e ) const; void set ( Log_Entry &e ); - virtual void draw_box ( void ); virtual void draw ( void ); Sequence_Point ( const Sequence_Point &rhs ); Sequence_Point ( ); - ~Sequence_Point ( ); + virtual ~Sequence_Point ( ); public: - const char *label ( void ) const { return _label; } - void label ( const char *s ) - { - if ( _label ) - free( _label ); - _label = strdup( s ); - redraw(); - } - Fl_Align align ( void ) const { return FL_ALIGN_RIGHT; } virtual int abs_w ( void ) const { return 8; } diff --git a/timeline/src/Sequence_Widget.C b/timeline/src/Sequence_Widget.C index 87bb4b4..307f3d0 100644 --- a/timeline/src/Sequence_Widget.C +++ b/timeline/src/Sequence_Widget.C @@ -59,6 +59,8 @@ Sequence_Widget::Sequence_Widget ( const Sequence_Widget &rhs ) : Loggable( rhs if ( rhs._label ) _label = strdup( rhs._label ); + else + _label = 0; _sequence = rhs._sequence; diff --git a/timeline/src/Tempo_Point.H b/timeline/src/Tempo_Point.H index f3e4396..f935c1a 100644 --- a/timeline/src/Tempo_Point.H +++ b/timeline/src/Tempo_Point.H @@ -32,10 +32,11 @@ class Tempo_Point : public Sequence_Point void _make_label ( void ) { - if ( ! _label ) - _label = (char*)malloc( 40 ); + char l[10]; - snprintf( _label, 40, "%.1f", _tempo ); + snprintf( l, sizeof(l), "%.1f", _tempo ); + + label( l ); } protected: @@ -59,7 +60,7 @@ public: Tempo_Point ( nframes_t when, float bpm ); - ~Tempo_Point ( ); + virtual ~Tempo_Point ( ); Tempo_Point ( const Tempo_Point &rhs ) : Sequence_Point( rhs ) { diff --git a/timeline/src/Time_Point.H b/timeline/src/Time_Point.H index 5d51337..412024c 100644 --- a/timeline/src/Time_Point.H +++ b/timeline/src/Time_Point.H @@ -44,10 +44,11 @@ class Time_Point : public Sequence_Point void _make_label ( void ) { - if ( ! _label ) - _label = (char*)malloc( 40 ); + char l[10]; + + snprintf( l, sizeof(l), "%d/%d", _time.beats_per_bar, _time.beat_type ); - snprintf( _label, 40, "%d/%d", _time.beats_per_bar, _time.beat_type ); + label( l ); }