diff options
author | Carl Hetherington <carl@carlh.net> | 2009-06-22 15:47:48 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-06-22 15:47:48 +0000 |
commit | 7b010a94aebcbf1261b183853410ebd7f0cadfb9 (patch) | |
tree | 02cbd36d1b445b08d7492daf6d5684d57c64d383 /gtk2_ardour/group_tabs.cc | |
parent | 92f3bc5c4486bd9d26979baf60c742c95faea62e (diff) |
No-op: comments.
git-svn-id: svn://localhost/ardour2/branches/3.0@5245 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/group_tabs.cc')
-rw-r--r-- | gtk2_ardour/group_tabs.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc index 7abd0d8965..6b573034ea 100644 --- a/gtk2_ardour/group_tabs.cc +++ b/gtk2_ardour/group_tabs.cc @@ -78,8 +78,10 @@ GroupTabs::on_button_press_event (GdkEventButton* ev) _drag_from = p < h; if (_drag_from) { + /* limit is the end of the previous tab */ _drag_limit = prev ? prev->to : 0; } else { + /* limit is the start of the next tab */ _drag_limit = next ? next->from : extent (); } @@ -109,13 +111,15 @@ GroupTabs::on_motion_notify_event (GdkEventMotion* ev) if (_drag_from) { double f = _dragging->from + p - _drag_last; - + if (f < _drag_limit) { + /* limit drag in the `too big' direction */ f = _drag_limit; } double const t = _dragging->to - _dragging->last_ui_size; if (f > t) { + /* limit drag in the `too small' direction */ f = t; } @@ -126,11 +130,13 @@ GroupTabs::on_motion_notify_event (GdkEventMotion* ev) double t = _dragging->to + p - _drag_last; if (t > _drag_limit) { + /* limit drag in the `too big' direction */ t = _drag_limit; } double const f = _dragging->from + _dragging->first_ui_size; if (t < f) { + /* limit drag in the `too small' direction */ t = f; } @@ -154,9 +160,11 @@ GroupTabs::on_button_release_event (GdkEventButton* ev) } if (!_drag_moved) { + /* toggle active state */ _dragging->group->set_active (!_dragging->group->is_active (), this); _dragging = 0; } else { + /* finish drag */ _dragging = 0; reflect_tabs (_tabs); set_dirty (); @@ -187,6 +195,13 @@ GroupTabs::render (cairo_t* cr) } +/** Convert a click position to a tab. + * @param c Click position. + * @param prev Filled in with the previous tab to the click, or 0. + * @param next Filled in with the next tab after the click, or 0. + * @return Tab under the click, or 0. + */ + GroupTabs::Tab * GroupTabs::click_to_tab (double c, Tab** prev, Tab** next) { |