From c464c73ab9b49c655382bd7e4d515b9207c636e0 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Tue, 29 Apr 2008 15:47:03 -0500 Subject: [PATCH] Improve the way sequence widgets are selected. --- Timeline/Timeline.C | 2 +- Timeline/Track.C | 24 ++++++++++++++++++++++++ Timeline/Track.H | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index 443b618..ee6843d 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -751,7 +751,7 @@ Timeline::select( const Rectangle &r ) Track *t = (Track*)tracks->child( i ); if ( ! ( t->y() > Y + r.h || t->y() + t->h() < Y ) ) - t->track()->select_range( r.x, r.w ); + t->select( r.x, r.y, r.w, r.h, true, true ); } } diff --git a/Timeline/Track.C b/Timeline/Track.C index a3c51b3..4c0e70b 100644 --- a/Timeline/Track.C +++ b/Timeline/Track.C @@ -365,6 +365,30 @@ Track::add ( Control_Sequence *t ) resize(); } +/** add all widget on this track falling within the given rectangle to + the selection. */ +void +Track::select ( int X, int Y, int W, int H, + bool include_control, bool merge_control ) +{ + + Sequence *t = track(); + + if ( ! ( t->y() > Y + H || t->y() + t->h() < Y ) ) + t->select_range( X, W ); + else + include_control = true; + + if ( include_control ) + for ( int i = control->children(); i--; ) + { + Control_Sequence *c = (Control_Sequence*)control->child( i ); + + if ( merge_control || + ( c->y() >= Y && c->y() + c->h() <= Y + H ) ) + c->select_range( X, W ); + } +} void Track::draw ( void ) diff --git a/Timeline/Track.H b/Timeline/Track.H index da76c25..6ac2fc3 100644 --- a/Timeline/Track.H +++ b/Timeline/Track.H @@ -190,6 +190,8 @@ public: void remove ( Sequence *t ); void remove ( Control_Sequence *t ); + void select ( int X, int Y, int W, int H, bool include_control, bool merge_control ); + int size ( void ) const { return _size; } void resize ( void );