diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-02-25 21:53:04 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-02-25 21:53:04 -0500 |
commit | aff595c739b825a5f7d4302a48e6597eb30fef5f (patch) | |
tree | bb6e7e2e8aeaa6b4017a5decca7f1e666c02252a | |
parent | 0cbf8f7deaae4623675453e1d5b1c6806808c9d2 (diff) |
add ::covered_by_y_range() to TimeAxisView
-rw-r--r-- | gtk2_ardour/time_axis_view.cc | 28 | ||||
-rw-r--r-- | gtk2_ardour/time_axis_view.h | 3 |
2 files changed, 28 insertions, 3 deletions
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index 6efea93fc8..036323627c 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -1177,7 +1177,7 @@ TimeAxisView::color_handler () * and is in stacked or expanded * region display mode, otherwise 0. */ std::pair<TimeAxisView*, double> -TimeAxisView::covers_y_position (double y) +TimeAxisView::covers_y_position (double y) const { if (hidden()) { return std::make_pair ((TimeAxisView *) 0, 0); @@ -1212,7 +1212,7 @@ TimeAxisView::covers_y_position (double y) break; } - return std::make_pair (this, l); + return std::make_pair (const_cast<TimeAxisView*>(this), l); } for (Children::const_iterator i = children.begin(); i != children.end(); ++i) { @@ -1226,6 +1226,30 @@ TimeAxisView::covers_y_position (double y) return std::make_pair ((TimeAxisView *) 0, 0); } +bool +TimeAxisView::covered_by_y_range (double y0, double y1) const +{ + if (hidden()) { + return false; + } + + /* if either the top or bottom of the axisview is in the vertical + * range, we cover it. + */ + + if ((y0 < _y_position && y1 < _y_position) || + (y0 >= _y_position + height && y1 >= _y_position + height)) { + return false; + } + + for (Children::const_iterator i = children.begin(); i != children.end(); ++i) { + if ((*i)->covered_by_y_range (y0, y1)) { + return true; + } + } + + return true; +} uint32_t TimeAxisView::preset_height (Height h) diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index a22ba94439..38626a080d 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -144,7 +144,8 @@ class TimeAxisView : public virtual AxisView virtual void reset_visual_state (); - std::pair<TimeAxisView*, double> covers_y_position (double); + std::pair<TimeAxisView*, double> covers_y_position (double) const; + bool covered_by_y_range (double y0, double y1) const; virtual void step_height (bool); |