#include <limits.h>
#include <math.h>
-#include <boost/foreach.hpp>
-
#include <QEvent>
#include <QMouseEvent>
#include <QScrollBar>
#include "pv/data/logic.h"
#include "pv/data/logicsnapshot.h"
-using boost::shared_ptr;
-using boost::weak_ptr;
using pv::data::SignalData;
using std::deque;
using std::list;
using std::min;
using std::pair;
using std::set;
+using std::shared_ptr;
using std::vector;
+using std::weak_ptr;
namespace pv {
namespace view {
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()),
_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()
session().get_signals());
// Make a set of all the visible data objects
- set< shared_ptr<SignalData> > visible_data;
- BOOST_FOREACH(const shared_ptr<Signal> sig, sigs)
- if (sig->enabled())
- visible_data.insert(sig->data());
-
+ set< shared_ptr<SignalData> > visible_data = get_visible_data();
if (visible_data.empty())
return;
double samplerate = 0.0;
- BOOST_FOREACH(const shared_ptr<SignalData> d, visible_data) {
+ for (const shared_ptr<SignalData> d : visible_data) {
assert(d);
samplerate = max(samplerate, d->samplerate());
}
vector< shared_ptr<Trace> > traces(sigs.size());
#endif
- vector< shared_ptr<Trace> >::iterator i = traces.begin();
+ auto i = traces.begin();
i = copy(sigs.begin(), sigs.end(), i);
#ifdef ENABLE_DECODE
i = copy(decode_sigs.begin(), decode_sigs.end(), i);
// List the selected signals
const vector< shared_ptr<Trace> > traces(get_traces());
- BOOST_FOREACH (shared_ptr<Trace> t, traces) {
+ for (shared_ptr<Trace> t : traces) {
assert(t);
if (t->selected())
items.push_back(t);
// Make a set of all the visible data objects
set< shared_ptr<SignalData> > visible_data;
- BOOST_FOREACH(const shared_ptr<Signal> sig, sigs)
+ for (const shared_ptr<Signal> sig : sigs)
if (sig->enabled())
visible_data.insert(sig->data());
return make_pair(0.0, 0.0);
double left_time = DBL_MAX, right_time = DBL_MIN;
- BOOST_FOREACH(const shared_ptr<SignalData> d, visible_data)
+ for (const shared_ptr<SignalData> d : visible_data)
{
const double start_time = d->get_start_time();
double samplerate = d->samplerate();
const vector< shared_ptr<Trace> > traces(get_traces());
int v_min = INT_MAX;
- BOOST_FOREACH(const shared_ptr<Trace> t, traces)
+ for (const shared_ptr<Trace> t : traces)
v_min = min(t->get_v_offset(), v_min);
const int delta = -min(v_min, 0);
- BOOST_FOREACH(shared_ptr<Trace> t, traces)
+ for (shared_ptr<Trace> t : traces)
t->set_v_offset(t->get_v_offset() + delta);
verticalScrollBar()->setSliderPosition(_v_offset + delta);
{
int offset = SignalMargin + SignalHeight;
const vector< shared_ptr<Trace> > traces(get_traces());
- BOOST_FOREACH(shared_ptr<Trace> t, traces) {
+ for (shared_ptr<Trace> t : traces) {
t->set_view(this);
t->set_v_offset(offset);
offset += SignalHeight + 2 * SignalMargin;