projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RowItemOwner: Renamed appearance_changed to row_item_appearance_changed
[pulseview.git]
/
pv
/
view
/
view.cpp
diff --git
a/pv/view/view.cpp
b/pv/view/view.cpp
index e0c49c20ad4b2f60b4e9ea1b16c69420318321ba..c53c02e3abd44f8242dc7bd1ceaf3d43a38cf02b 100644
(file)
--- a/
pv/view/view.cpp
+++ b/
pv/view/view.cpp
@@
-50,14
+50,14
@@
#include "pv/session.hpp"
#include "pv/data/logic.hpp"
#include "pv/session.hpp"
#include "pv/data/logic.hpp"
-#include "pv/data/logics
napsho
t.hpp"
+#include "pv/data/logics
egmen
t.hpp"
#include "pv/util.hpp"
using boost::shared_lock;
using boost::shared_mutex;
using pv::data::SignalData;
#include "pv/util.hpp"
using boost::shared_lock;
using boost::shared_mutex;
using pv::data::SignalData;
-using pv::data::S
napsho
t;
+using pv::data::S
egmen
t;
using pv::util::format_time;
using std::back_inserter;
using pv::util::format_time;
using std::back_inserter;
@@
-104,7
+104,7
@@
View::View(Session &session, QWidget *parent) :
tick_period_(0.0),
tick_prefix_(0),
show_cursors_(false),
tick_period_(0.0),
tick_prefix_(0),
show_cursors_(false),
- cursors_(
*this
),
+ cursors_(
new CursorPair(*this)
),
hover_point_(-1, -1)
{
connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
hover_point_(-1, -1)
{
connect(horizontalScrollBar(), SIGNAL(valueChanged(int)),
@@
-121,9
+121,9
@@
View::View(Session &session, QWidget *parent) :
connect(&session_, SIGNAL(frame_ended()),
this, SLOT(data_updated()));
connect(&session_, SIGNAL(frame_ended()),
this, SLOT(data_updated()));
- connect(cursors_
.
first().get(), SIGNAL(time_changed()),
+ connect(cursors_
->
first().get(), SIGNAL(time_changed()),
this, SLOT(marker_time_changed()));
this, SLOT(marker_time_changed()));
- connect(cursors_
.
second().get(), SIGNAL(time_changed()),
+ connect(cursors_
->
second().get(), SIGNAL(time_changed()),
this, SLOT(marker_time_changed()));
connect(header_, SIGNAL(signals_moved()),
this, SLOT(marker_time_changed()));
connect(header_, SIGNAL(signals_moved()),
@@
-195,6
+195,15
@@
const Viewport* View::viewport() const
return viewport_;
}
return viewport_;
}
+vector< shared_ptr<TimeItem> > View::time_items() const
+{
+ vector< shared_ptr<TimeItem> > items;
+ items.push_back(cursors_);
+ items.push_back(cursors_->first());
+ items.push_back(cursors_->second());
+ return items;
+}
+
double View::scale() const
{
return scale_;
double View::scale() const
{
return scale_;
@@
-263,9
+272,9
@@
void View::zoom_one_to_one()
double samplerate = 0.0;
for (const shared_ptr<SignalData> d : visible_data) {
assert(d);
double samplerate = 0.0;
for (const shared_ptr<SignalData> d : visible_data) {
assert(d);
- const vector< shared_ptr<S
napshot> > snapsho
ts =
- d->s
napsho
ts();
- for (const shared_ptr<S
napshot> &s : snapsho
ts)
+ const vector< shared_ptr<S
egment> > segmen
ts =
+ d->s
egmen
ts();
+ for (const shared_ptr<S
egment> &s : segmen
ts)
samplerate = max(samplerate, s->samplerate());
}
samplerate = max(samplerate, s->samplerate());
}
@@
-314,9
+323,9
@@
pair<double, double> View::get_time_extents() const
const set< shared_ptr<SignalData> > visible_data = get_visible_data();
for (const shared_ptr<SignalData> d : visible_data)
{
const set< shared_ptr<SignalData> > visible_data = get_visible_data();
for (const shared_ptr<SignalData> d : visible_data)
{
- const vector< shared_ptr<S
napshot> > snapsho
ts =
- d->s
napsho
ts();
- for (const shared_ptr<S
napshot> &s : snapsho
ts) {
+ const vector< shared_ptr<S
egment> > segmen
ts =
+ d->s
egmen
ts();
+ for (const shared_ptr<S
egment> &s : segmen
ts) {
double samplerate = s->samplerate();
samplerate = (samplerate <= 0.0) ? 1.0 : samplerate;
double samplerate = s->samplerate();
samplerate = (samplerate <= 0.0) ? 1.0 : samplerate;
@@
-349,18
+358,13
@@
void View::show_cursors(bool show)
void View::centre_cursors()
{
const double time_width = scale_ * viewport_->width();
void View::centre_cursors()
{
const double time_width = scale_ * viewport_->width();
- cursors_
.
first()->set_time(offset_ + time_width * 0.4);
- cursors_
.
second()->set_time(offset_ + time_width * 0.6);
+ cursors_
->
first()->set_time(offset_ + time_width * 0.4);
+ cursors_
->
second()->set_time(offset_ + time_width * 0.6);
cursorheader_->update();
viewport_->update();
}
cursorheader_->update();
viewport_->update();
}
-CursorPair& View::cursors()
-{
- return cursors_;
-}
-
-const CursorPair& View::cursors() const
+std::shared_ptr<CursorPair> View::cursors() const
{
return cursors_;
}
{
return cursors_;
}
@@
-479,11
+483,11
@@
void View::update_scroll()
// Set the vertical scrollbar
verticalScrollBar()->setPageStep(areaSize.height());
// Set the vertical scrollbar
verticalScrollBar()->setPageStep(areaSize.height());
+ verticalScrollBar()->setSingleStep(areaSize.height() / 8);
const pair<int, int> extents = v_extents();
const pair<int, int> extents = v_extents();
- const int extra_scroll_height = (extents.second - extents.first) / 4;
- verticalScrollBar()->setRange(extents.first - extra_scroll_height,
- extents.first + extra_scroll_height);
+ verticalScrollBar()->setRange(extents.first - (areaSize.height() / 2),
+ extents.second - (areaSize.height() / 2));
}
void View::update_layout()
}
void View::update_layout()
@@
-502,16
+506,16
@@
void View::update_layout()
update_scroll();
}
update_scroll();
}
-void View::paint_label(QPainter &p,
int righ
t, bool hover)
+void View::paint_label(QPainter &p,
const QRect &rec
t, bool hover)
{
(void)p;
{
(void)p;
- (void)r
igh
t;
+ (void)r
ec
t;
(void)hover;
}
(void)hover;
}
-QRectF View::label_rect(
int righ
t)
+QRectF View::label_rect(
const QRectF &rec
t)
{
{
- (void)r
igh
t;
+ (void)r
ec
t;
return QRectF();
}
return QRectF();
}
@@
-603,7
+607,7
@@
void View::resizeEvent(QResizeEvent*)
update_layout();
}
update_layout();
}
-void View::appearance_changed(bool label, bool content)
+void View::
row_item_
appearance_changed(bool label, bool content)
{
if (label)
header_->update();
{
if (label)
header_->update();
@@
-614,8
+618,8
@@
void View::appearance_changed(bool label, bool content)
void View::extents_changed(bool horz, bool vert)
{
sticky_events_ |=
void View::extents_changed(bool horz, bool vert)
{
sticky_events_ |=
- (horz ?
Selectable
ItemHExtentsChanged : 0) |
- (vert ?
Selectable
ItemVExtentsChanged : 0);
+ (horz ?
Row
ItemHExtentsChanged : 0) |
+ (vert ?
Row
ItemVExtentsChanged : 0);
lazy_event_handler_.start();
}
lazy_event_handler_.start();
}
@@
-738,9
+742,9
@@
void View::on_signals_moved()
void View::process_sticky_events()
{
void View::process_sticky_events()
{
- if (sticky_events_ &
Selectable
ItemHExtentsChanged)
+ if (sticky_events_ &
Row
ItemHExtentsChanged)
update_layout();
update_layout();
- if (sticky_events_ &
Selectable
ItemVExtentsChanged)
+ if (sticky_events_ &
Row
ItemVExtentsChanged)
restack_all_row_items();
// Clear the sticky events
restack_all_row_items();
// Clear the sticky events