projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Viewport: Allow horizontal scrolling via mouse wheel tilting
[pulseview.git]
/
pv
/
view
/
ruler.cpp
diff --git
a/pv/view/ruler.cpp
b/pv/view/ruler.cpp
index bbafdb0f22cdce854fb52322a7a666b82bdac039..c043aacf2b160d926a557915e2bafe95c397329a 100644
(file)
--- a/
pv/view/ruler.cpp
+++ b/
pv/view/ruler.cpp
@@
-76,7
+76,7
@@
void Ruler::paintEvent(QPaintEvent *event)
do
{
tick_period = order_decimal * ScaleUnits[unit++];
do
{
tick_period = order_decimal * ScaleUnits[unit++];
- } while(tick_period < min_period && unit < countof(ScaleUnits));
+ } while
(tick_period < min_period && unit < countof(ScaleUnits));
const unsigned int prefix = (order - FirstSIPrefixPower) / 3;
assert(prefix >= 0);
const unsigned int prefix = (order - FirstSIPrefixPower) / 3;
assert(prefix >= 0);
@@
-99,15
+99,15
@@
void Ruler::paintEvent(QPaintEvent *event)
int division = (int)round(first_minor_division -
first_major_division * MinorTickSubdivision);
int division = (int)round(first_minor_division -
first_major_division * MinorTickSubdivision);
- while(1)
+ while
(1)
{
const double t = t0 + division * minor_tick_period;
const double x = (t - _view.offset()) / _view.scale();
{
const double t = t0 + division * minor_tick_period;
const double x = (t - _view.offset()) / _view.scale();
- if(x >= width())
+ if
(x >= width())
break;
break;
- if(division % MinorTickSubdivision == 0)
+ if
(division % MinorTickSubdivision == 0)
{
// Draw a major tick
QString s;
{
// Draw a major tick
QString s;
@@
-139,7
+139,7
@@
void Ruler::paintEvent(QPaintEvent *event)
void Ruler::mouseMoveEvent(QMouseEvent *e)
{
void Ruler::mouseMoveEvent(QMouseEvent *e)
{
- if(!_grabbed_marker)
+ if
(!_grabbed_marker)
return;
_grabbed_marker->set_time(_view.offset() +
return;
_grabbed_marker->set_time(_view.offset() +
@@
-148,16
+148,16
@@
void Ruler::mouseMoveEvent(QMouseEvent *e)
void Ruler::mousePressEvent(QMouseEvent *e)
{
void Ruler::mousePressEvent(QMouseEvent *e)
{
- if(e->buttons() & Qt::LeftButton) {
+ if
(e->buttons() & Qt::LeftButton) {
_grabbed_marker = NULL;
_grabbed_marker = NULL;
- if(_view.cursors_shown()) {
+ if
(_view.cursors_shown()) {
std::pair<Cursor, Cursor> &cursors =
_view.cursors();
std::pair<Cursor, Cursor> &cursors =
_view.cursors();
- if(cursors.first.get_label_rect(
+ if
(cursors.first.get_label_rect(
rect()).contains(e->pos()))
_grabbed_marker = &cursors.first;
rect()).contains(e->pos()))
_grabbed_marker = &cursors.first;
- else if(cursors.second.get_label_rect(
+ else if
(cursors.second.get_label_rect(
rect()).contains(e->pos()))
_grabbed_marker = &cursors.second;
}
rect()).contains(e->pos()))
_grabbed_marker = &cursors.second;
}
@@
-171,7
+171,7
@@
void Ruler::mouseReleaseEvent(QMouseEvent *)
void Ruler::draw_cursors(QPainter &p)
{
void Ruler::draw_cursors(QPainter &p)
{
- if(!_view.cursors_shown())
+ if
(!_view.cursors_shown())
return;
const QRect r = rect();
return;
const QRect r = rect();
@@
-183,7
+183,8
@@
void Ruler::draw_cursors(QPainter &p)
void Ruler::draw_hover_mark(QPainter &p)
{
const int x = _view.hover_point().x();
void Ruler::draw_hover_mark(QPainter &p)
{
const int x = _view.hover_point().x();
- if(x == -1 || _grabbed_marker)
+
+ if (x == -1 || _grabbed_marker)
return;
p.setPen(QPen(Qt::NoPen));
return;
p.setPen(QPen(Qt::NoPen));