projects
/
pulseview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
fdf5ff0
)
Improved propagation of drag event so that the scroll bars can be updated
author
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sat, 17 Nov 2012 12:48:27 +0000
(12:48 +0000)
committer
Joel Holdsworth
<joel@airwebreathe.org.uk>
Sun, 18 Nov 2012 13:18:53 +0000
(13:18 +0000)
pv/view/header.cpp
patch
|
blob
|
history
pv/view/header.h
patch
|
blob
|
history
pv/view/view.cpp
patch
|
blob
|
history
pv/view/view.h
patch
|
blob
|
history
pv/view/viewport.cpp
patch
|
blob
|
history
pv/view/viewport.h
patch
|
blob
|
history
diff --git
a/pv/view/header.cpp
b/pv/view/header.cpp
index a141b6164754f79760fc27c291d0054b48245da6..e167bffc5c8e38535e82d94692bf96a8193de8f2 100644
(file)
--- a/
pv/view/header.cpp
+++ b/
pv/view/header.cpp
@@
-54,6
+54,9
@@
Header::Header(View &parent) :
this, SLOT(on_action_set_name_triggered()));
connect(_action_set_colour, SIGNAL(triggered()),
this, SLOT(on_action_set_colour_triggered()));
this, SLOT(on_action_set_name_triggered()));
connect(_action_set_colour, SIGNAL(triggered()),
this, SLOT(on_action_set_colour_triggered()));
+
+ connect(&_view, SIGNAL(signals_moved()),
+ this, SLOT(on_signals_moved()));
}
boost::shared_ptr<pv::view::Signal> Header::get_mouse_over_signal(
}
boost::shared_ptr<pv::view::Signal> Header::get_mouse_over_signal(
@@
-113,14
+116,6
@@
void Header::mousePressEvent(QMouseEvent *event)
const vector< shared_ptr<Signal> > &sigs =
_view.session().get_signals();
const vector< shared_ptr<Signal> > &sigs =
_view.session().get_signals();
- if(~QApplication::keyboardModifiers() & Qt::ControlModifier) {
- // Unselect all other signals because the Ctrl is not
- // pressed
- _drag_sigs.clear();
- BOOST_FOREACH(const shared_ptr<Signal> s, sigs)
- s->select(false);
- }
-
if(event->button() & Qt::LeftButton) {
_mouse_down_point = event->pos();
if(event->button() & Qt::LeftButton) {
_mouse_down_point = event->pos();
@@
-140,13
+135,26
@@
void Header::mousePressEvent(QMouseEvent *event)
else {
mouse_over_signal->select(true);
else {
mouse_over_signal->select(true);
+ if(~QApplication::keyboardModifiers() &
+ Qt::ControlModifier)
+ _drag_sigs.clear();
+
// Add the signal to the drag list
// Add the signal to the drag list
- _drag_sigs.push_back(
- make_pair(mouse_over_signal,
+ if(event->button() & Qt::LeftButton)
+ _drag_sigs.push_back(
+ make_pair(mouse_over_signal,
mouse_over_signal->get_v_offset()));
}
}
mouse_over_signal->get_v_offset()));
}
}
+ if(~QApplication::keyboardModifiers() & Qt::ControlModifier) {
+ // Unselect all other signals because the Ctrl is not
+ // pressed
+ BOOST_FOREACH(const shared_ptr<Signal> s, sigs)
+ if(s != mouse_over_signal)
+ s->select(false);
+ }
+
update();
}
update();
}
@@
-238,5
+246,11
@@
void Header::on_action_set_colour_triggered()
context_signal->set_colour(new_colour);
}
context_signal->set_colour(new_colour);
}
+void Header::on_signals_moved()
+{
+ update();
+}
+
+
} // namespace view
} // namespace pv
} // namespace view
} // namespace pv
diff --git
a/pv/view/header.h
b/pv/view/header.h
index 35f16de1b36eb7bab29f69ca1cea801b0f7320bc..8e180b8a086cfb6a4e02179726b5ad665089b806 100644
(file)
--- a/
pv/view/header.h
+++ b/
pv/view/header.h
@@
-65,6
+65,8
@@
private slots:
void on_action_set_colour_triggered();
void on_action_set_colour_triggered();
+ void on_signals_moved();
+
signals:
void signals_moved();
signals:
void signals_moved();
diff --git
a/pv/view/view.cpp
b/pv/view/view.cpp
index 0a31e808f20d9e78603994584677631ff1b94c13..e3210fa39f3b9ac9d7bffc20797dd689bf27ce1d 100644
(file)
--- a/
pv/view/view.cpp
+++ b/
pv/view/view.cpp
@@
-87,7
+87,7
@@
View::View(SigSession &session, QWidget *parent) :
this, SLOT(marker_time_changed()));
connect(_header, SIGNAL(signals_moved()),
this, SLOT(marker_time_changed()));
connect(_header, SIGNAL(signals_moved()),
- this, SLOT(signals_moved()));
+ this, SLOT(
on_
signals_moved()));
setViewportMargins(LabelMarginWidth, RulerHeight, 0, 0);
setViewport(_viewport);
setViewportMargins(LabelMarginWidth, RulerHeight, 0, 0);
setViewport(_viewport);
@@
-317,10
+317,10
@@
void View::marker_time_changed()
_viewport->update();
}
_viewport->update();
}
-void View::signals_moved()
+void View::
on_
signals_moved()
{
{
-
_header->update
();
-
_viewport->update
();
+
update_scroll
();
+
signals_moved
();
}
} // namespace view
}
} // namespace view
diff --git
a/pv/view/view.h
b/pv/view/view.h
index fb52f530fcb1dccae46ac2bdc773875f7adb7d4e..6d7ac36dfb49265ea9c6fe92e0d1a6fc33133ace 100644
(file)
--- a/
pv/view/view.h
+++ b/
pv/view/view.h
@@
-107,6
+107,8
@@
public:
signals:
void hover_point_changed();
signals:
void hover_point_changed();
+ void signals_moved();
+
private:
void get_scroll_layout(double &length, double &offset) const;
private:
void get_scroll_layout(double &length, double &offset) const;
@@
-130,7
+132,7
@@
private slots:
void marker_time_changed();
void marker_time_changed();
- void signals_moved();
+ void
on_
signals_moved();
private:
SigSession &_session;
private:
SigSession &_session;
diff --git
a/pv/view/viewport.cpp
b/pv/view/viewport.cpp
index 7d844d27bccadd71a287f5aeb784f9d5f1ad5f85..96111875570ee7e53bf0e9773285686acb01e8a8 100644
(file)
--- a/
pv/view/viewport.cpp
+++ b/
pv/view/viewport.cpp
@@
-41,18
+41,21
@@
Viewport::Viewport(View &parent) :
setMouseTracking(true);
setAutoFillBackground(true);
setBackgroundRole(QPalette::Base);
setMouseTracking(true);
setAutoFillBackground(true);
setBackgroundRole(QPalette::Base);
+
+ connect(&_view, SIGNAL(signals_moved()),
+ this, SLOT(on_signals_moved()));
}
int Viewport::get_total_height() const
{
}
int Viewport::get_total_height() const
{
- int h
eight
= 0;
+ int h = 0;
BOOST_FOREACH(const shared_ptr<Signal> s,
_view.session().get_signals()) {
assert(s);
BOOST_FOREACH(const shared_ptr<Signal> s,
_view.session().get_signals()) {
assert(s);
- h
eight += View::SignalHeight
;
+ h
= max(s->get_v_offset() + View::SignalHeight, h)
;
}
}
- return h
eight
;
+ return h;
}
void Viewport::paintEvent(QPaintEvent *event)
}
void Viewport::paintEvent(QPaintEvent *event)
@@
-142,5
+145,10
@@
void Viewport::draw_cursors_foreground(QPainter &p)
cursors.second.paint(p, r);
}
cursors.second.paint(p, r);
}
+void Viewport::on_signals_moved()
+{
+ update();
+}
+
} // namespace view
} // namespace pv
} // namespace view
} // namespace pv
diff --git
a/pv/view/viewport.h
b/pv/view/viewport.h
index 49b97e3b0d71de953db0b76e70dc9b68e0b7f55a..7d32c4334ff57c24f03474f9b3fe6455039d0eec 100644
(file)
--- a/
pv/view/viewport.h
+++ b/
pv/view/viewport.h
@@
-56,6
+56,9
@@
private:
void draw_cursors_foreground(QPainter &p);
void draw_cursors_foreground(QPainter &p);
+private slots:
+ void on_signals_moved();
+
private:
View &_view;
private:
View &_view;