using boost::shared_mutex;
using pv::data::SignalData;
+using pv::data::Snapshot;
using pv::util::format_time;
using std::back_inserter;
double samplerate = 0.0;
for (const shared_ptr<SignalData> d : visible_data) {
assert(d);
- samplerate = max(samplerate, d->samplerate());
+ const vector< shared_ptr<Snapshot> > snapshots =
+ d->snapshots();
+ for (const shared_ptr<Snapshot> &s : snapshots)
+ samplerate = max(samplerate, s->samplerate());
}
if (samplerate == 0.0)
pair<double, double> View::get_time_extents() const
{
- const set< shared_ptr<SignalData> > visible_data = get_visible_data();
- if (visible_data.empty())
- return make_pair(0.0, 0.0);
-
double left_time = DBL_MAX, right_time = DBL_MIN;
+ const set< shared_ptr<SignalData> > visible_data = get_visible_data();
for (const shared_ptr<SignalData> d : visible_data)
{
- const double start_time = d->get_start_time();
- double samplerate = d->samplerate();
- samplerate = (samplerate <= 0.0) ? 1.0 : samplerate;
-
- left_time = min(left_time, start_time);
- right_time = max(right_time, start_time +
- d->get_max_sample_count() / samplerate);
+ const vector< shared_ptr<Snapshot> > snapshots =
+ d->snapshots();
+ for (const shared_ptr<Snapshot> &s : snapshots) {
+ double samplerate = s->samplerate();
+ samplerate = (samplerate <= 0.0) ? 1.0 : samplerate;
+
+ const double start_time = s->start_time();
+ left_time = min(left_time, start_time);
+ right_time = max(right_time, start_time +
+ d->get_max_sample_count() / samplerate);
+ }
}
+ if (left_time == DBL_MAX && right_time == DBL_MIN)
+ return make_pair(0.0, 0.0);
+
assert(left_time < right_time);
return make_pair(left_time, right_time);
}
get_scroll_layout(length, offset);
length = max(length - areaSize.width(), 0.0);
+ int major_tick_distance = tick_period_ / scale_;
+
horizontalScrollBar()->setPageStep(areaSize.width() / 2);
+ horizontalScrollBar()->setSingleStep(major_tick_distance);
updating_scroll_ = true;