X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fview.cpp;h=d117489577bc02e99edb171906e965eaeeaa15b3;hp=35195b58dc150c8743f5d623e7495ccb1ecd5412;hb=9f46d9058be2cc2b11ccecb0ba4c4f61d55bec1a;hpb=a472a884a9d2d17eb31a8a02322608fe7d71e8a3 diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 35195b58..d1174895 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -92,7 +92,9 @@ View::View(SigSession &session, QWidget *parent) : connect(&_session, SIGNAL(signals_changed()), this, SLOT(signals_changed())); - connect(&_session, SIGNAL(data_updated()), + connect(&_session, SIGNAL(data_received()), + this, SLOT(data_updated())); + connect(&_session, SIGNAL(frame_ended()), this, SLOT(data_updated())); connect(_cursors.first().get(), SIGNAL(time_changed()), @@ -120,6 +122,10 @@ View::View(SigSession &session, QWidget *parent) : _viewport->installEventFilter(this); _ruler->installEventFilter(this); _header->installEventFilter(this); + + // Trigger the initial event manually. The default device has signals + // which were created before this object came into being + signals_changed(); } SigSession& View::session() @@ -154,9 +160,7 @@ void View::zoom(double steps) void View::zoom(double steps, int offset) { - const double new_scale = max(min(_scale * pow(3.0/2.0, -steps), - MaxScale), MinScale); - set_zoom(new_scale, offset); + set_zoom(_scale * pow(3.0/2.0, -steps), offset); } void View::zoom_fit() @@ -171,7 +175,8 @@ void View::zoom_fit() if (w <= 0) return; - set_scale_offset(delta / w, extents.first); + const double scale = max(min(delta / w, MaxScale), MinScale); + set_scale_offset(scale, extents.first); } void View::zoom_one_to_one() @@ -182,11 +187,7 @@ void View::zoom_one_to_one() session().get_signals()); // Make a set of all the visible data objects - set< shared_ptr > visible_data; - BOOST_FOREACH(const shared_ptr sig, sigs) - if (sig->enabled()) - visible_data.insert(sig->data()); - + set< shared_ptr > visible_data = get_visible_data(); if (visible_data.empty()) return;