From 9b1e8259bee97ed1d2e38b9bde9f6b2e3dbb1227 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Thu, 21 Feb 2008 01:38:31 -0600 Subject: [PATCH] Permit region selection. --- Region.C | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Region.C b/Region.C index c802147..5ff3427 100644 --- a/Region.C +++ b/Region.C @@ -38,6 +38,8 @@ extern Timeline timeline; Fl_Boxtype Region::_box = FL_PLASTIC_UP_BOX; +Fl_Color Region::_selection_color = FL_MAGENTA; + void Region::init ( void ) { @@ -167,7 +169,8 @@ Region::handle ( int m ) if ( Fl::event_button() == 2 ) { - normalize(); + // normalize(); + _selected = ! _selected; _track->redraw(); } @@ -255,7 +258,12 @@ Region::draw_box( int X, int Y, int W, int H ) /* dirty hack to keep the box from flipping to vertical at small sizes */ fl_push_clip( x(), Y, w(), H ); - fl_draw_box( box(), x() - 10, Y, w() + 50, H, _box_color ); + + if ( _selected ) + fl_draw_box( FL_DOWN_BOX, x() - 10, Y, w() + 50, H, _selection_color ); + else + fl_draw_box( box(), x() - 10, Y, w() + 50, H, _box_color ); + fl_pop_clip(); } @@ -310,6 +318,16 @@ Region::draw ( int X, int Y, int W, int H ) draw_label( _clip->name(), (Fl_Align)(FL_ALIGN_LEFT | FL_ALIGN_BOTTOM /*| FL_ALIGN_CLIP*/ | FL_ALIGN_INSIDE) ); + +/* if ( _selected ) */ +/* { */ +/* fl_color( selection_color() ); */ + +/* fl_line_style( FL_SOLID, 4 ); */ +/* fl_rect( x(), y(), w(), h() ); */ +/* fl_line_style( FL_SOLID, 0 ); */ +/* } */ + fl_pop_clip(); }