projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use typesafe enum classes in pv::util
[pulseview.git]
/
pv
/
view
/
cursorpair.cpp
diff --git
a/pv/view/cursorpair.cpp
b/pv/view/cursorpair.cpp
index d7723752b62e6952467ef5ec5c615df4f049c364..7aa989da469061bf16ad621bfe701f40b7141254 100644
(file)
--- a/
pv/view/cursorpair.cpp
+++ b/
pv/view/cursorpair.cpp
@@
-60,8
+60,8
@@
shared_ptr<Cursor> CursorPair::second() const
return second_;
}
return second_;
}
-void CursorPair::set_time(
double
time) {
- const
double
delta = second_->time() - first_->time();
+void CursorPair::set_time(
const pv::util::Timestamp&
time) {
+ const
pv::util::Timestamp
delta = second_->time() - first_->time();
first_->set_time(time);
second_->set_time(time + delta);
}
first_->set_time(time);
second_->set_time(time + delta);
}
@@
-161,11
+161,11
@@
void CursorPair::paint_back(QPainter &p, const ViewItemPaintParams &pp) {
QString CursorPair::format_string()
{
QString CursorPair::format_string()
{
- const
unsigned int
prefix = view_.tick_prefix();
- const
double
delta = second_->time() - first_->time();
+ const
pv::util::SIPrefix
prefix = view_.tick_prefix();
+ const
pv::util::Timestamp
delta = second_->time() - first_->time();
return QString("%1 / %2").
arg(util::format_time(delta, prefix, view_.time_unit(), 2)).
return QString("%1 / %2").
arg(util::format_time(delta, prefix, view_.time_unit(), 2)).
- arg(util::format_si_value(1
.0 / fabs(delta), "Hz", -1
, 4));
+ arg(util::format_si_value(1
/ fabs(delta), "Hz", pv::util::SIPrefix::unspecified
, 4));
}
void CursorPair::compute_text_size(QPainter &p)
}
void CursorPair::compute_text_size(QPainter &p)
@@
-182,8
+182,8
@@
pair<float, float> CursorPair::get_cursor_offsets() const
assert(second_);
return pair<float, float>(
assert(second_);
return pair<float, float>(
- (
first_->time() - view_.offset()) / view_.scale
(),
- (
second_->time() - view_.offset()) / view_.scale
());
+ (
(first_->time() - view_.offset()) / view_.scale()).convert_to<float>
(),
+ (
(second_->time() - view_.offset()) / view_.scale()).convert_to<float>
());
}
} // namespace view
}
} // namespace view