X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Fview.cpp;h=9a46bab8c4c4d41ea9f91e36b05d84c96c05b9c7;hb=d9ea96280ab1128427143660ae375c30b19aa0cb;hp=c6a6afd323dcccac191061bfac65c640bac36c68;hpb=2ad82c2e40b6865481733913a2c32735602f63c4;p=pulseview.git diff --git a/pv/view/view.cpp b/pv/view/view.cpp index c6a6afd3..9a46bab8 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -42,7 +42,7 @@ #include -#include "decodetrace.hpp" +#include "analogsignal.hpp" #include "header.hpp" #include "logicsignal.hpp" #include "ruler.hpp" @@ -58,6 +58,10 @@ #include "pv/data/logicsegment.hpp" #include "pv/util.hpp" +#ifdef ENABLE_DECODE +#include "decodetrace.hpp" +#endif + using boost::shared_lock; using boost::shared_mutex; @@ -437,6 +441,33 @@ void View::enable_sticky_scrolling(bool state) sticky_scrolling_ = state; } +void View::enable_coloured_bg(bool state) +{ + const vector> items( + list_by_type()); + + for (shared_ptr i : items) { + // Can't cast to Trace because it's abstract, so we need to + // check for any derived classes individually + + shared_ptr a = dynamic_pointer_cast(i); + if (a) + a->set_coloured_bg(state); + + shared_ptr l = dynamic_pointer_cast(i); + if (l) + l->set_coloured_bg(state); + +#ifdef ENABLE_DECODE + shared_ptr d = dynamic_pointer_cast(i); + if (d) + d->set_coloured_bg(state); +#endif + } + + viewport_->update(); +} + bool View::cursors_shown() const { return show_cursors_; @@ -520,6 +551,12 @@ void View::restack_all_trace_tree_items() for (auto &o : sorted_owners) o->restack_items(); + // Re-assign background colors + bool next_bgcolour_state = 0; + + for (auto &o : sorted_owners) + next_bgcolour_state = o->reassign_bgcolour_states(next_bgcolour_state); + // Animate the items to their destination for (const auto &i : items) i->animate_to_layout_v_offset(); @@ -789,9 +826,9 @@ bool View::eventFilter(QObject *object, QEvent *event) return QObject::eventFilter(object, event); } -bool View::viewportEvent(QEvent *e) +bool View::viewportEvent(QEvent *event) { - switch (e->type()) { + switch (event->type()) { case QEvent::Paint: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: @@ -803,7 +840,7 @@ bool View::viewportEvent(QEvent *e) case QEvent::TouchEnd: return false; default: - return QAbstractScrollArea::viewportEvent(e); + return QAbstractScrollArea::viewportEvent(event); } }