From d510b21f7f645cf20c4b14ba6066d7f4c4dd6b2a Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sun, 4 May 2008 21:05:20 -0500 Subject: [PATCH] Allow Annotation_Points and Annotation_Regions to co-exist on the same sequence. --- Timeline/Annotation_Sequence.H | 17 ++++++++++++++++- Timeline/Sequence_Region.C | 4 +--- Timeline/Sequence_Region.H | 8 ++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Timeline/Annotation_Sequence.H b/Timeline/Annotation_Sequence.H index f9cdde1..7f9bc62 100644 --- a/Timeline/Annotation_Sequence.H +++ b/Timeline/Annotation_Sequence.H @@ -21,6 +21,7 @@ #include "Sequence.H" #include "Annotation_Point.H" +#include "Annotation_Region.H" #include "Timeline.H" class Annotation_Sequence : public Sequence, public Loggable @@ -109,11 +110,25 @@ public: add( new Annotation_Point( this, x_to_offset( Fl::event_x() ), "mark" ) ); redraw(); } + if ( Fl::event_button3() && Fl::event_shift() ) + { + Annotation_Region *r = new Annotation_Region( this, x_to_offset( Fl::event_x() ), "mark" ); + + add( r ); + + Sequence_Widget::pushed( r ); + + r->handle( m ); + + redraw(); + + return 1; + + } break; } default: break; - } return 0; diff --git a/Timeline/Sequence_Region.C b/Timeline/Sequence_Region.C index cc9994e..281cac7 100644 --- a/Timeline/Sequence_Region.C +++ b/Timeline/Sequence_Region.C @@ -24,14 +24,12 @@ void Sequence_Region::draw_box ( void ) { - fl_draw_box( box(), x(), y(), w(), h(), color() ); + fl_draw_box( box(), x(), y(), w(), h(), box_color() ); } void Sequence_Region::draw ( void ) { - - } void diff --git a/Timeline/Sequence_Region.H b/Timeline/Sequence_Region.H index bf8cb58..0f61fba 100644 --- a/Timeline/Sequence_Region.H +++ b/Timeline/Sequence_Region.H @@ -39,7 +39,7 @@ protected: void - set ( Log_Entry &e ) + virtual set ( Log_Entry &e ) { for ( int i = 0; i < e.size(); ++i ) { @@ -71,8 +71,8 @@ public: enum trim_e { NO, LEFT, RIGHT }; void trim ( enum trim_e t, int X ); - int handle ( int m ); - void draw_box( void ); - void draw ( void ); + virtual int handle ( int m ); + virtual void draw_box( void ); + virtual void draw ( void ); };