diff options
author | Carl Hetherington <carl@carlh.net> | 2012-03-22 16:41:23 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-03-22 16:41:23 +0000 |
commit | 3120bae8b41f3eecad25534ab6953e1b123ab9de (patch) | |
tree | 83542178768a7ca38427e2751a5a933102957537 /gtk2_ardour/editor_drag.cc | |
parent | f9de5f6436486bd7fea3d7dfacc43c04af7dc85f (diff) |
Don't leave internal edit mode when clicking on an automation region view (#4747).
git-svn-id: svn://localhost/ardour2/branches/3.0@11749 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 3d05fc296e..04c6494d9d 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -4076,26 +4076,43 @@ NoteDrag::aborted (bool) /* XXX: TODO */ } -AutomationRangeDrag::AutomationRangeDrag (Editor* editor, ArdourCanvas::Item* item, list<AudioRange> const & r) - : Drag (editor, item) +/** Make an AutomationRangeDrag for lines in an AutomationTimeAxisView */ +AutomationRangeDrag::AutomationRangeDrag (Editor* editor, AutomationTimeAxisView* atv, list<AudioRange> const & r) + : Drag (editor, atv->base_item ()) , _ranges (r) , _nothing_to_drag (false) { DEBUG_TRACE (DEBUG::Drags, "New AutomationRangeDrag\n"); - _atav = reinterpret_cast<AutomationTimeAxisView*> (_item->get_data ("trackview")); - assert (_atav); + setup (atv->lines ()); +} + +/** Make an AutomationRangeDrag for region gain lines */ +AutomationRangeDrag::AutomationRangeDrag (Editor* editor, AudioRegionView* rv, list<AudioRange> const & r) + : Drag (editor, rv->get_canvas_group ()) + , _ranges (r) + , _nothing_to_drag (false) +{ + DEBUG_TRACE (DEBUG::Drags, "New AutomationRangeDrag\n"); - /* get all lines in the automation view */ - list<boost::shared_ptr<AutomationLine> > lines = _atav->lines (); + list<boost::shared_ptr<AutomationLine> > lines; + lines.push_back (rv->get_gain_line ()); + setup (lines); +} - /* find those that overlap the ranges being dragged */ - list<boost::shared_ptr<AutomationLine> >::iterator i = lines.begin (); +/** @param lines AutomationLines to drag. + * @param offset Offset from the session start to the points in the AutomationLines. + */ +void +AutomationRangeDrag::setup (list<boost::shared_ptr<AutomationLine> > const & lines) +{ + /* find the lines that overlap the ranges being dragged */ + list<boost::shared_ptr<AutomationLine> >::const_iterator i = lines.begin (); while (i != lines.end ()) { - list<boost::shared_ptr<AutomationLine> >::iterator j = i; + list<boost::shared_ptr<AutomationLine> >::const_iterator j = i; ++j; - pair<framepos_t, framepos_t> const r = (*i)->get_point_x_range (); + pair<framepos_t, framepos_t> r = (*i)->get_point_x_range (); /* check this range against all the AudioRanges that we are using */ list<AudioRange>::const_iterator k = _ranges.begin (); |