+list<weak_ptr<SelectableItem> > View::selected_items() const
+{
+ list<weak_ptr<SelectableItem> > items;
+
+ // List the selected signals
+ const vector< shared_ptr<Signal> > sigs(_session.get_signals());
+ BOOST_FOREACH (shared_ptr<Signal> s, sigs) {
+ assert(s);
+ if (s->selected())
+ items.push_back(s);
+ }
+
+ // List the selected cursors
+ if (_cursors.first()->selected())
+ items.push_back(_cursors.first());
+ if (_cursors.second()->selected())
+ items.push_back(_cursors.second());
+
+ return items;
+}
+
+bool View::cursors_shown() const
+{
+ return _show_cursors;
+}
+
+void View::show_cursors(bool show)
+{
+ _show_cursors = show;
+ _ruler->update();
+ _viewport->update();
+}
+
+void View::centre_cursors()
+{
+ const double time_width = _scale * _viewport->width();
+ _cursors.first()->set_time(_offset + time_width * 0.4);
+ _cursors.second()->set_time(_offset + time_width * 0.6);
+ _ruler->update();
+ _viewport->update();
+}
+
+CursorPair& View::cursors()
+{
+ return _cursors;
+}
+
+const CursorPair& View::cursors() const
+{
+ return _cursors;
+}
+
+const QPoint& View::hover_point() const
+{
+ return _hover_point;
+}
+
+void View::normalize_layout()
+{
+ const vector< shared_ptr<Signal> > sigs(_session.get_signals());
+
+ int v_min = INT_MAX;
+ BOOST_FOREACH(const shared_ptr<Signal> s, sigs)
+ v_min = min(s->get_v_offset(), v_min);
+
+ const int delta = -min(v_min, 0);
+ BOOST_FOREACH(shared_ptr<Signal> s, sigs)
+ s->set_v_offset(s->get_v_offset() + delta);
+
+ verticalScrollBar()->setSliderPosition(_v_offset + delta);
+ v_scroll_value_changed(verticalScrollBar()->sliderPosition());
+}
+
+void View::get_scroll_layout(double &length, double &offset) const
+{
+ const shared_ptr<data::SignalData> sig_data = _session.get_data();
+ if (!sig_data)
+ return;
+
+ length = _data_length / (sig_data->get_samplerate() * _scale);
+ offset = _offset / _scale;
+}
+