+void
+Meterbridge::on_scroll()
+{
+ if (!scroller.get_hscrollbar()) return;
+
+ Adjustment* adj = scroller.get_hscrollbar()->get_adjustment();
+ int leftend = adj->get_value();
+ int rightend = scroller.get_width() + leftend;
+
+ int mm_left = _mm_left;
+ int mm_right = _mm_right;
+ ARDOUR::MeterType mt_left = _mt_left;
+ ARDOUR::MeterType mt_right = _mt_right;
+
+ for (unsigned int i = 0; i < _metrics.size(); ++i) {
+ int sx, dx = 0, dy = 0;
+ int mm = _metrics[i]->get_metric_mode();
+ sx = (mm & 2) ? _metrics[i]->get_width() : 0;
+
+ _metrics[i]->translate_coordinates(meterarea, sx, 0, dx, dy);
+
+ if (dx < leftend && !(mm&2)) {
+ mm_left = mm;
+ mt_left = _metrics[i]->meter_type();
+ }
+ if (dx > rightend && (mm&2)) {
+ mm_right = mm;
+ mt_right = _metrics[i]->meter_type();
+ break;
+ }
+ }
+ metrics_left.set_metric_mode(mm_left, mt_left);
+ metrics_right.set_metric_mode(mm_right, mt_right);
+}
+
+struct PresentationInfoRouteSorter
+{
+ bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
+ if (a->is_master() || a->is_monitor()) {
+ /* "a" is a special route (master, monitor, etc), and comes
+ * last in the mixer ordering
+ */
+ return false;
+ } else if (b->is_master() || b->is_monitor()) {
+ /* everything comes before b */
+ return true;
+ }
+ return a->presentation_info().order() < b->presentation_info().order();
+ }
+};
+