- int h = 0;
- const vector< shared_ptr<Signal> > sigs(
- _view.session().get_signals());
- BOOST_FOREACH(const shared_ptr<Signal> s, sigs) {
- assert(s);
- h = max(s->get_v_offset() + View::SignalHeight, h);
+ vector< shared_ptr<ViewItem> > items(view_.begin(), view_.end());
+ const vector< shared_ptr<TimeItem> > time_items(view_.time_items());
+ copy(time_items.begin(), time_items.end(), back_inserter(items));
+ return items;
+}
+
+bool Viewport::touch_event(QTouchEvent *event)
+{
+ QList<QTouchEvent::TouchPoint> touchPoints = event->touchPoints();
+
+ if (touchPoints.count() != 2) {
+ pinch_zoom_active_ = false;
+ return false;
+ }
+
+ const QTouchEvent::TouchPoint &touchPoint0 = touchPoints.first();
+ const QTouchEvent::TouchPoint &touchPoint1 = touchPoints.last();
+
+ if (!pinch_zoom_active_ ||
+ (event->touchPointStates() & Qt::TouchPointPressed)) {
+ pinch_offset0_ = view_.offset() + view_.scale() * touchPoint0.pos().x();
+ pinch_offset1_ = view_.offset() + view_.scale() * touchPoint1.pos().x();
+ pinch_zoom_active_ = true;