]> sigrok.org Git - pulseview.git/blobdiff - pv/view/view.cpp
TimeMarker: Replaced time_changed signal with View::time_item_apparance_changed
[pulseview.git] / pv / view / view.cpp
index 3df87e540b986b0e08b1242c9139950f65f12a5b..d58e074a3ef72ec77bc3e75c3487dac627cbb15d 100644 (file)
@@ -121,11 +121,6 @@ View::View(Session &session, QWidget *parent) :
        connect(&session_, SIGNAL(frame_ended()),
                this, SLOT(data_updated()));
 
-       connect(cursors_->first().get(), SIGNAL(time_changed()),
-               this, SLOT(marker_time_changed()));
-       connect(cursors_->second().get(), SIGNAL(time_changed()),
-               this, SLOT(marker_time_changed()));
-
        connect(header_, SIGNAL(signals_moved()),
                this, SLOT(on_signals_moved()));
 
@@ -198,6 +193,7 @@ const Viewport* View::viewport() const
 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;
@@ -482,11 +478,11 @@ void View::update_scroll()
 
        // 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()
@@ -606,7 +602,7 @@ void View::resizeEvent(QResizeEvent*)
        update_layout();
 }
 
-void View::appearance_changed(bool label, bool content)
+void View::row_item_appearance_changed(bool label, bool content)
 {
        if (label)
                header_->update();
@@ -614,11 +610,19 @@ void View::appearance_changed(bool label, bool content)
                viewport_->update();
 }
 
+void View::time_item_appearance_changed(bool label, bool content)
+{
+       if (label)
+               cursorheader_->update();
+       if (content)
+               viewport_->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();
 }
 
@@ -727,12 +731,6 @@ void View::data_updated()
        viewport_->update();
 }
 
-void View::marker_time_changed()
-{
-       cursorheader_->update();
-       viewport_->update();
-}
-
 void View::on_signals_moved()
 {
        update_scroll();
@@ -741,9 +739,9 @@ void View::on_signals_moved()
 
 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