tick_period_(0.0),
tick_prefix_(0),
show_cursors_(false),
- cursors_(*this),
+ cursors_(new CursorPair(*this)),
hover_point_(-1, -1)
{
connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
connect(&session_, SIGNAL(frame_ended()),
this, SLOT(data_updated()));
- connect(cursors_.first().get(), SIGNAL(time_changed()),
+ connect(cursors_->first().get(), SIGNAL(time_changed()),
this, SLOT(marker_time_changed()));
- connect(cursors_.second().get(), SIGNAL(time_changed()),
+ connect(cursors_->second().get(), SIGNAL(time_changed()),
this, SLOT(marker_time_changed()));
connect(header_, SIGNAL(signals_moved()),
return viewport_;
}
+vector< shared_ptr<TimeItem> > View::time_items() const
+{
+ vector< shared_ptr<TimeItem> > items;
+ items.push_back(cursors_);
+ items.push_back(cursors_->first());
+ items.push_back(cursors_->second());
+ return items;
+}
+
double View::scale() const
{
return scale_;
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);
+ cursors_->first()->set_time(offset_ + time_width * 0.4);
+ cursors_->second()->set_time(offset_ + time_width * 0.6);
cursorheader_->update();
viewport_->update();
}
-CursorPair& View::cursors()
-{
- return cursors_;
-}
-
-const CursorPair& View::cursors() const
+std::shared_ptr<CursorPair> View::cursors() const
{
return cursors_;
}
// Set the vertical scrollbar
verticalScrollBar()->setPageStep(areaSize.height());
+ verticalScrollBar()->setSingleStep(areaSize.height() / 8);
const pair<int, int> extents = v_extents();
- const int extra_scroll_height = (extents.second - extents.first) / 4;
- verticalScrollBar()->setRange(extents.first - extra_scroll_height,
- extents.first + extra_scroll_height);
+ verticalScrollBar()->setRange(extents.first - (areaSize.height() / 2),
+ extents.second - (areaSize.height() / 2));
}
void View::update_layout()
update_scroll();
}
-void View::paint_label(QPainter &p, int right, bool hover)
+void View::paint_label(QPainter &p, const QRect &rect, bool hover)
{
(void)p;
- (void)right;
+ (void)rect;
(void)hover;
}
-QRectF View::label_rect(int right)
+QRectF View::label_rect(const QRectF &rect)
{
- (void)right;
+ (void)rect;
return QRectF();
}
update_layout();
}
-void View::appearance_changed(bool label, bool content)
+void View::row_item_appearance_changed(bool label, bool content)
{
if (label)
header_->update();
void View::extents_changed(bool horz, bool vert)
{
sticky_events_ |=
- (horz ? SelectableItemHExtentsChanged : 0) |
- (vert ? SelectableItemVExtentsChanged : 0);
+ (horz ? RowItemHExtentsChanged : 0) |
+ (vert ? RowItemVExtentsChanged : 0);
lazy_event_handler_.start();
}
void View::process_sticky_events()
{
- if (sticky_events_ & SelectableItemHExtentsChanged)
+ if (sticky_events_ & RowItemHExtentsChanged)
update_layout();
- if (sticky_events_ & SelectableItemVExtentsChanged)
+ if (sticky_events_ & RowItemVExtentsChanged)
restack_all_row_items();
// Clear the sticky events