From 81217a87224872f6f686d0480dd000e74a3686e6 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 18 Jun 2012 21:31:23 -0700 Subject: [PATCH] Timeline: Display selection state of basic sequence points and sequence regions. --- timeline/src/Sequence_Point.C | 14 +++----------- timeline/src/Sequence_Region.C | 13 ++++++++++++- timeline/src/Sequence_Region.H | 2 ++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/timeline/src/Sequence_Point.C b/timeline/src/Sequence_Point.C index 0870ff8..b461f19 100644 --- a/timeline/src/Sequence_Point.C +++ b/timeline/src/Sequence_Point.C @@ -106,27 +106,19 @@ draw_marker ( Fl_Color c ) void Sequence_Point::draw_box ( void ) { -// Sequence_Widget::draw_box(); - const int X = x() - (abs_w() >> 1); -/* // const int Y = y() + Fl::box_dy( box() ); */ const int Y = y(); - /* fl_draw_box( FL_ASYM_BOX, x() - ( abs_w() / 2 ), y(), abs_w(), h(), color() ); */ - - /* fl_color( color() ); */ - fl_push_matrix(); fl_translate( X, Y ); fl_scale( abs_w(), h() ); - draw_marker( color() ); + Fl_Color c = selected() ? selection_color() : color(); + + draw_marker( c ); fl_pop_matrix(); - - /* fl_color( FL_WHITE ); */ - /* fl_line( x(), y(), x(), y() + h() ); */ } void diff --git a/timeline/src/Sequence_Region.C b/timeline/src/Sequence_Region.C index 60636c1..5146423 100644 --- a/timeline/src/Sequence_Region.C +++ b/timeline/src/Sequence_Region.C @@ -247,10 +247,21 @@ Sequence_Region::handle ( int m ) void Sequence_Region::draw_box ( void ) { - fl_draw_box( box(), line_x(), y(), abs_w(), h(), fl_color_add_alpha( box_color(), 127 ) ); + Fl_Color c = selected() ? selection_color() : box_color(); + fl_draw_box( box(), line_x(), y(), abs_w(), h(), fl_color_add_alpha( c, 127 ) ); } void Sequence_Region::draw ( void ) { + } + +void +Sequence_Region::draw_label ( const char *label, Fl_Align align ) +{ + fl_color( FL_WHITE ); + fl_font( FL_HELVETICA_ITALIC, 9 ); + fl_draw( label, x(), y(), abs_w(), h(), align ); +} + diff --git a/timeline/src/Sequence_Region.H b/timeline/src/Sequence_Region.H index c17e240..1c2d818 100644 --- a/timeline/src/Sequence_Region.H +++ b/timeline/src/Sequence_Region.H @@ -37,9 +37,11 @@ protected: Sequence_Region ( const Sequence_Region &rhs ); virtual ~Sequence_Region ( ); + virtual Fl_Align align ( void ) const { return FL_ALIGN_INSIDE | FL_ALIGN_CENTER | FL_ALIGN_WRAP; } virtual int handle ( int m ); virtual void draw_box( void ); virtual void draw ( void ); + virtual void draw_label ( const char *label, Fl_Align align ); public: