X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fview.cpp;h=f7f9834d6695dfc59784753a603e41e6ca0928d1;hb=873cbed09a23679f39e955478d6c70429104ce40;hp=a05ac207beaaf734de8803f015479267ccd6d65d;hpb=e45b13b536666034c9b6fe52a9321d749dae3c02;p=pulseview.git diff --git a/pv/view/view.cpp b/pv/view/view.cpp index a05ac20..f7f9834 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -48,6 +48,7 @@ #include "viewport.hpp" #include "pv/session.hpp" +#include "pv/devices/device.hpp" #include "pv/data/logic.hpp" #include "pv/data/logicsegment.hpp" #include "pv/util.hpp" @@ -90,7 +91,7 @@ View::View(Session &session, QWidget *parent) : viewport_(new Viewport(*this)), ruler_(new Ruler(*this)), header_(new Header(*this)), - scale_(1e-6), + scale_(1e-3), offset_(0), updating_scroll_(false), tick_period_(0.0), @@ -400,12 +401,8 @@ void View::update_viewport() void View::restack_all_row_items() { - // Make a set of owners - unordered_set< RowItemOwner* > owners; - for (const auto &r : *this) - owners.insert(r->owner()); - - // Make a list that is sorted from deepest first + // Make a list of owners that is sorted from deepest first + const auto owners = list_row_item_owners(); vector< RowItemOwner* > sorted_owners(owners.begin(), owners.end()); sort(sorted_owners.begin(), sorted_owners.end(), [](const RowItemOwner* a, const RowItemOwner *b) { @@ -675,8 +672,12 @@ void View::signals_changed() // Populate the traces clear_child_items(); - shared_ptr device = session_.device(); - assert(device); + const auto device = session_.device(); + if (!device) + return; + + shared_ptr sr_dev = device->device(); + assert(sr_dev); // Collect a set of signals unordered_map, shared_ptr > @@ -689,7 +690,7 @@ void View::signals_changed() signal_map[sig->channel()] = sig; // Populate channel groups - for (auto entry : device->channel_groups()) + for (auto entry : sr_dev->channel_groups()) { const shared_ptr &group = entry.second; @@ -710,7 +711,7 @@ void View::signals_changed() shared_ptr logic_trace_group(new TraceGroup()); int child_offset = 0; - if (add_channels_to_owner(device->channels(), + if (add_channels_to_owner(sr_dev->channels(), logic_trace_group.get(), child_offset, signal_map, [](shared_ptr r) -> bool { return dynamic_pointer_cast(r) != nullptr; @@ -722,7 +723,7 @@ void View::signals_changed() } // Add the remaining channels - add_channels_to_owner(device->channels(), this, offset, signal_map); + add_channels_to_owner(sr_dev->channels(), this, offset, signal_map); assert(signal_map.empty()); // Add decode signals