mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
improve cursor/channel/trigger move operation, support both press-drag and hit-move-release mode
This commit is contained in:
parent
22f5a7bee8
commit
5c832a8dc8
@ -943,9 +943,36 @@ void DsoSignal::paint_fore(QPainter &p, int left, int right)
|
||||
};
|
||||
|
||||
p.setPen(Qt::transparent);
|
||||
p.setBrush(hover ? _colour.dark() : _colour);
|
||||
p.setBrush(_colour);
|
||||
p.drawPolygon(points, countof(points));
|
||||
|
||||
p.setPen(Qt::white);
|
||||
const QPointF arrow_points[] = {
|
||||
QPoint(label_rect.left(), label_rect.center().y()),
|
||||
QPoint(label_rect.left(), label_rect.center().y()-1),
|
||||
QPoint(label_rect.left(), label_rect.center().y()+1),
|
||||
QPoint(label_rect.left(), label_rect.center().y()-2),
|
||||
QPoint(label_rect.left(), label_rect.center().y()+2),
|
||||
QPoint(label_rect.left(), label_rect.center().y()-3),
|
||||
QPoint(label_rect.left(), label_rect.center().y()+3),
|
||||
QPoint(label_rect.left(), label_rect.center().y()-4),
|
||||
QPoint(label_rect.left(), label_rect.center().y()+4),
|
||||
QPoint(label_rect.left()-1, label_rect.center().y()-3),
|
||||
QPoint(label_rect.left()-1, label_rect.center().y()+3),
|
||||
QPoint(label_rect.left()+1, label_rect.center().y()-3),
|
||||
QPoint(label_rect.left()+1, label_rect.center().y()+3),
|
||||
QPoint(label_rect.left()-1, label_rect.center().y()-2),
|
||||
QPoint(label_rect.left()-1, label_rect.center().y()+2),
|
||||
QPoint(label_rect.left()+1, label_rect.center().y()-2),
|
||||
QPoint(label_rect.left()+1, label_rect.center().y()+2),
|
||||
QPoint(label_rect.left()-2, label_rect.center().y()-2),
|
||||
QPoint(label_rect.left()-2, label_rect.center().y()+2),
|
||||
QPoint(label_rect.left()+2, label_rect.center().y()-2),
|
||||
QPoint(label_rect.left()+2, label_rect.center().y()+2),
|
||||
};
|
||||
if (hover || selected())
|
||||
p.drawPoints(arrow_points, countof(arrow_points));
|
||||
|
||||
// paint the trig voltage
|
||||
int trigp = get_trig_vpos();
|
||||
float t_vol = (_zero_vrate - get_trig_vrate()) * _vDial->get_value() * _vDial->get_factor() * DS_CONF_DSO_VDIVS;
|
||||
@ -957,8 +984,10 @@ void DsoSignal::paint_fore(QPainter &p, int left, int right)
|
||||
p.drawText(t_vol_rect, Qt::AlignRight | Qt::AlignVCenter, t_vol_s);
|
||||
|
||||
// paint the _trig_vpos line
|
||||
p.setPen(QPen(_colour, 1, Qt::DotLine));
|
||||
p.drawLine(left, trigp, right - p.boundingRect(t_vol_rect, Qt::AlignLeft, t_vol_s).width(), trigp);
|
||||
if (_view->get_dso_trig_moved()) {
|
||||
p.setPen(QPen(_colour, 1, Qt::DotLine));
|
||||
p.drawLine(left, trigp, right - p.boundingRect(t_vol_rect, Qt::AlignLeft, t_vol_s).width(), trigp);
|
||||
}
|
||||
|
||||
// Paint the text
|
||||
p.setPen(Qt::white);
|
||||
|
@ -183,21 +183,11 @@ void Header::mousePressEvent(QMouseEvent *event)
|
||||
} else if (action == Trace::NAME && mTrace) {
|
||||
_nameFlag = true;
|
||||
} else if (action == Trace::LABEL && mTrace) {
|
||||
if (mTrace->selected())
|
||||
mTrace->select(false);
|
||||
else {
|
||||
if (mTrace->get_type() != SR_CHANNEL_DSO)
|
||||
mTrace->select(true);
|
||||
|
||||
if (~QApplication::keyboardModifiers() &
|
||||
Qt::ControlModifier)
|
||||
_drag_traces.clear();
|
||||
|
||||
// Add the Trace to the drag list
|
||||
if (event->button() & Qt::LeftButton) {
|
||||
_drag_traces.push_back(make_pair(mTrace, mTrace->get_zero_vpos()));
|
||||
}
|
||||
}
|
||||
mTrace->select(true);
|
||||
if (~QApplication::keyboardModifiers() &
|
||||
Qt::ControlModifier)
|
||||
_drag_traces.clear();
|
||||
_drag_traces.push_back(make_pair(mTrace, mTrace->get_zero_vpos()));
|
||||
mTrace->set_old_v_offset(mTrace->get_v_offset());
|
||||
}
|
||||
|
||||
@ -236,13 +226,20 @@ void Header::mouseReleaseEvent(QMouseEvent *event)
|
||||
}
|
||||
if (_moveFlag) {
|
||||
//move(event);
|
||||
_drag_traces.clear();
|
||||
_view.signals_changed();
|
||||
_view.set_all_update(true);
|
||||
|
||||
const vector< boost::shared_ptr<Trace> > traces(
|
||||
_view.get_traces(ALL_VIEW));
|
||||
BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces)
|
||||
t->select(false);
|
||||
}
|
||||
|
||||
_colorFlag = false;
|
||||
_nameFlag = false;
|
||||
_moveFlag = false;
|
||||
_drag_traces.clear();
|
||||
|
||||
_view.normalize_layout();
|
||||
}
|
||||
|
||||
@ -299,21 +296,21 @@ void Header::mouseMoveEvent(QMouseEvent *event)
|
||||
if (sig) {
|
||||
int y = (*i).second + delta;
|
||||
if (sig->get_type() != SR_CHANNEL_DSO) {
|
||||
const int y_snap =
|
||||
((y + View::SignalSnapGridSize / 2) /
|
||||
View::SignalSnapGridSize) *
|
||||
View::SignalSnapGridSize;
|
||||
if (y_snap != sig->get_v_offset()) {
|
||||
_moveFlag = true;
|
||||
sig->set_v_offset(y_snap);
|
||||
if (~QApplication::keyboardModifiers() & Qt::ControlModifier) {
|
||||
const int y_snap =
|
||||
((y + View::SignalSnapGridSize / 2) /
|
||||
View::SignalSnapGridSize) *
|
||||
View::SignalSnapGridSize;
|
||||
if (y_snap != sig->get_v_offset()) {
|
||||
_moveFlag = true;
|
||||
sig->set_v_offset(y_snap);
|
||||
}
|
||||
}
|
||||
// Ensure the Trace is selected
|
||||
sig->select(true);
|
||||
} else {
|
||||
boost::shared_ptr<DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<DsoSignal>(sig)) {
|
||||
dsoSig->set_zero_vpos(y);
|
||||
dsoSig->select(false);
|
||||
_moveFlag = true;
|
||||
traces_moved();
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,9 @@ Ruler::Ruler(View &parent) :
|
||||
_cursor_sel_visible(false),
|
||||
_cursor_go_visible(false),
|
||||
_cursor_sel_x(-1),
|
||||
_grabbed_marker(NULL)
|
||||
_grabbed_marker(NULL),
|
||||
_hitCursor(false),
|
||||
_curs_moved(false)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
|
||||
@ -208,6 +210,7 @@ void Ruler::mouseMoveEvent(QMouseEvent *e)
|
||||
_grabbed_marker->set_index((_view.offset() + _view.hover_point().x()) *
|
||||
_view.scale() * _view.session().cur_samplerate());
|
||||
_view.cursor_moving();
|
||||
_curs_moved = true;
|
||||
}
|
||||
|
||||
update();
|
||||
@ -221,48 +224,42 @@ void Ruler::leaveEvent(QEvent *)
|
||||
update();
|
||||
}
|
||||
|
||||
void Ruler::mousePressEvent(QMouseEvent *e)
|
||||
void Ruler::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
(void)e;
|
||||
if (event->button() & Qt::LeftButton) {
|
||||
bool visible;
|
||||
if (!_cursor_sel_visible & !_view.get_cursorList().empty()) {
|
||||
_view.show_cursors(true);
|
||||
list<Cursor*>::iterator i = _view.get_cursorList().begin();
|
||||
while (i != _view.get_cursorList().end()) {
|
||||
const QRect cursor_rect((*i)->get_label_rect(rect(), visible));
|
||||
if ((*i)->get_close_rect(cursor_rect).contains(event->pos())) {
|
||||
_view.del_cursor(*i);
|
||||
if (_view.get_cursorList().empty()) {
|
||||
_cursor_sel_visible = false;
|
||||
_view.show_cursors(false);
|
||||
}
|
||||
_hitCursor = true;
|
||||
break;
|
||||
}
|
||||
if (cursor_rect.contains(event->pos())) {
|
||||
set_grabbed_cursor(*i);
|
||||
_cursor_sel_visible = false;
|
||||
_cursor_go_visible = false;
|
||||
_hitCursor = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Ruler::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
bool addCursor = false;
|
||||
bool visible;
|
||||
if (event->button() & Qt::LeftButton) {
|
||||
bool hitCursor = false;
|
||||
if (!_cursor_sel_visible & !_view.get_cursorList().empty()) {
|
||||
_view.show_cursors(true);
|
||||
if (_grabbed_marker) {
|
||||
rel_grabbed_cursor();
|
||||
hitCursor = true;
|
||||
_view.cursor_moved();
|
||||
} else {
|
||||
list<Cursor*>::iterator i = _view.get_cursorList().begin();
|
||||
while (i != _view.get_cursorList().end()) {
|
||||
const QRect cursor_rect((*i)->get_label_rect(rect(), visible));
|
||||
if ((*i)->get_close_rect(cursor_rect).contains(event->pos())) {
|
||||
_view.del_cursor(*i);
|
||||
if (_view.get_cursorList().empty()) {
|
||||
_cursor_sel_visible = false;
|
||||
_view.show_cursors(false);
|
||||
}
|
||||
hitCursor = true;
|
||||
break;
|
||||
}
|
||||
if (cursor_rect.contains(event->pos())) {
|
||||
set_grabbed_cursor(*i);
|
||||
_cursor_sel_visible = false;
|
||||
_cursor_go_visible = false;
|
||||
hitCursor = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hitCursor && !_grabbed_marker) {
|
||||
if (!_hitCursor && !_grabbed_marker) {
|
||||
if (!_cursor_go_visible) {
|
||||
if (!_cursor_sel_visible) {
|
||||
_cursor_sel_x = event->pos().x();
|
||||
@ -293,6 +290,13 @@ void Ruler::mouseReleaseEvent(QMouseEvent *event)
|
||||
_cursor_go_visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (_curs_moved && _grabbed_marker) {
|
||||
rel_grabbed_cursor();
|
||||
_hitCursor = false;
|
||||
_curs_moved = false;
|
||||
_view.cursor_moved();
|
||||
}
|
||||
}
|
||||
|
||||
if (event->button() & Qt::RightButton) {
|
||||
|
@ -81,7 +81,7 @@ private:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void leaveEvent(QEvent *);
|
||||
|
||||
@ -114,6 +114,8 @@ private:
|
||||
double _min_period;
|
||||
|
||||
unsigned int _cur_prefix;
|
||||
bool _hitCursor;
|
||||
bool _curs_moved;
|
||||
};
|
||||
|
||||
} // namespace view
|
||||
|
@ -285,14 +285,41 @@ void Trace::paint_label(QPainter &p, int right, const QPoint pt)
|
||||
|
||||
p.setPen(Qt::transparent);
|
||||
if (_type == SR_CHANNEL_DSO || _type == SR_CHANNEL_FFT) {
|
||||
p.setBrush((label_rect.contains(pt) || selected()) ? _colour.darker() : _colour);
|
||||
p.setBrush(_colour);
|
||||
p.drawPolygon(points, countof(points));
|
||||
} else {
|
||||
QColor color = PROBE_COLORS[*_index_list.begin() % countof(PROBE_COLORS)];
|
||||
p.setBrush((label_rect.contains(pt) || selected()) ? color.lighter() : color);
|
||||
p.setBrush(color);
|
||||
p.drawPolygon(points, countof(points));
|
||||
}
|
||||
|
||||
p.setPen(Qt::white);
|
||||
const QPointF arrow_points[] = {
|
||||
QPoint(label_rect.right(), label_rect.center().y()),
|
||||
QPoint(label_rect.right(), label_rect.center().y()-1),
|
||||
QPoint(label_rect.right(), label_rect.center().y()+1),
|
||||
QPoint(label_rect.right(), label_rect.center().y()-2),
|
||||
QPoint(label_rect.right(), label_rect.center().y()+2),
|
||||
QPoint(label_rect.right(), label_rect.center().y()-3),
|
||||
QPoint(label_rect.right(), label_rect.center().y()+3),
|
||||
QPoint(label_rect.right(), label_rect.center().y()-4),
|
||||
QPoint(label_rect.right(), label_rect.center().y()+4),
|
||||
QPoint(label_rect.right()-1, label_rect.center().y()-3),
|
||||
QPoint(label_rect.right()-1, label_rect.center().y()+3),
|
||||
QPoint(label_rect.right()+1, label_rect.center().y()-3),
|
||||
QPoint(label_rect.right()+1, label_rect.center().y()+3),
|
||||
QPoint(label_rect.right()-1, label_rect.center().y()-2),
|
||||
QPoint(label_rect.right()-1, label_rect.center().y()+2),
|
||||
QPoint(label_rect.right()+1, label_rect.center().y()-2),
|
||||
QPoint(label_rect.right()+1, label_rect.center().y()+2),
|
||||
QPoint(label_rect.right()-2, label_rect.center().y()-2),
|
||||
QPoint(label_rect.right()-2, label_rect.center().y()+2),
|
||||
QPoint(label_rect.right()+2, label_rect.center().y()-2),
|
||||
QPoint(label_rect.right()+2, label_rect.center().y()+2),
|
||||
};
|
||||
if (label_rect.contains(pt) || selected())
|
||||
p.drawPoints(arrow_points, countof(arrow_points));
|
||||
|
||||
// Paint the text
|
||||
p.setPen(Qt::white);
|
||||
if (_type == SR_CHANNEL_GROUP)
|
||||
|
@ -1166,5 +1166,10 @@ void View::set_capture_status()
|
||||
}
|
||||
}
|
||||
|
||||
bool View::get_dso_trig_moved() const
|
||||
{
|
||||
return _time_viewport->get_dso_trig_moved();
|
||||
}
|
||||
|
||||
} // namespace view
|
||||
} // namespace pv
|
||||
|
@ -195,6 +195,8 @@ public:
|
||||
bool get_capture_status(bool &triggered, int &progress);
|
||||
void set_capture_status();
|
||||
|
||||
bool get_dso_trig_moved() const;
|
||||
|
||||
signals:
|
||||
void hover_point_changed();
|
||||
|
||||
|
@ -68,7 +68,9 @@ Viewport::Viewport(View &parent, View_type type) :
|
||||
_hover_hit(false),
|
||||
_dso_xm_valid(false),
|
||||
_dso_ym_valid(false),
|
||||
_waiting_trig(0)
|
||||
_waiting_trig(0),
|
||||
_dso_trig_moved(false),
|
||||
_curs_moved(false)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
setAutoFillBackground(true);
|
||||
@ -386,18 +388,6 @@ void Viewport::paintProgress(QPainter &p)
|
||||
}
|
||||
|
||||
} else {
|
||||
if (_view.session().get_error() == SigSession::No_err) {
|
||||
GVariant *gvar = _view.session().get_device()->get_config(NULL, NULL, SR_CONF_HW_STATUS);
|
||||
if (gvar != NULL) {
|
||||
uint8_t hw_info = g_variant_get_byte(gvar);
|
||||
g_variant_unref(gvar);
|
||||
if (hw_info & 0x10) {
|
||||
_view.session().set_error(SigSession::Data_overflow);
|
||||
_view.session().session_error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int progress100 = ceil(progress / -3.6 / 16);
|
||||
p.setPen(Trace::dsGreen);
|
||||
QFont font=p.font();
|
||||
@ -459,6 +449,54 @@ void Viewport::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_action_type == NO_ACTION &&
|
||||
event->button() == Qt::LeftButton &&
|
||||
_view.session().get_device()->dev_inst()->mode == DSO) {
|
||||
const vector< boost::shared_ptr<Signal> > sigs(_view.session().get_signals());
|
||||
BOOST_FOREACH(const boost::shared_ptr<Signal> s, sigs) {
|
||||
assert(s);
|
||||
if (!s->enabled())
|
||||
continue;
|
||||
boost::shared_ptr<DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<DsoSignal>(s)) {
|
||||
if (dsoSig->get_trig_rect(0, _view.get_view_width()).contains(_mouse_point)) {
|
||||
_drag_sig = s;
|
||||
_action_type = DSO_TRIG_MOVE;
|
||||
dsoSig->select(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_action_type == NO_ACTION &&
|
||||
event->button() == Qt::LeftButton) {
|
||||
uint64_t sample_rate = _view.session().cur_samplerate();
|
||||
const double samples_per_pixel = sample_rate * _view.scale();
|
||||
if (_view.search_cursor_shown()) {
|
||||
const int64_t searchX = _view.get_search_cursor()->index()/samples_per_pixel - _view.offset();
|
||||
if (_view.get_search_cursor()->grabbed()) {
|
||||
_view.get_ruler()->rel_grabbed_cursor();
|
||||
} else if (qAbs(searchX - event->pos().x()) <= HitCursorMargin) {
|
||||
_view.get_ruler()->set_grabbed_cursor(_view.get_search_cursor());
|
||||
_action_type = CURS_MOVE;
|
||||
}
|
||||
}
|
||||
if (_view.cursors_shown()) {
|
||||
list<Cursor*>::iterator i = _view.get_cursorList().begin();
|
||||
while (i != _view.get_cursorList().end()) {
|
||||
const int64_t cursorX = (*i)->index()/samples_per_pixel - _view.offset();
|
||||
if ((*i)->grabbed()) {
|
||||
_view.get_ruler()->rel_grabbed_cursor();
|
||||
} else if (qAbs(cursorX - event->pos().x()) <= HitCursorMargin) {
|
||||
_view.get_ruler()->set_grabbed_cursor(*i);
|
||||
_action_type = CURS_MOVE;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Viewport::mouseMoveEvent(QMouseEvent *event)
|
||||
@ -468,8 +506,10 @@ void Viewport::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
if (event->buttons() & Qt::LeftButton) {
|
||||
if (_type == TIME_VIEW) {
|
||||
_view.set_scale_offset(_view.scale(),
|
||||
_mouse_down_offset + (_mouse_down_point - event->pos()).x());
|
||||
if (_action_type == NO_ACTION) {
|
||||
_view.set_scale_offset(_view.scale(),
|
||||
_mouse_down_offset + (_mouse_down_point - event->pos()).x());
|
||||
}
|
||||
_drag_strength = (_mouse_down_point - event->pos()).x();
|
||||
} else if (_type == FFT_VIEW) {
|
||||
BOOST_FOREACH(const boost::shared_ptr<view::MathTrace> t, _view.session().get_math_signals()) {
|
||||
@ -484,15 +524,17 @@ void Viewport::mouseMoveEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
if (_type == TIME_VIEW) {
|
||||
if (!(event->buttons() || Qt::NoButton)) {
|
||||
if ((event->buttons() & Qt::LeftButton) ||
|
||||
!(event->buttons() || Qt::NoButton)) {
|
||||
if (_action_type == DSO_TRIG_MOVE) {
|
||||
if (_drag_sig) {
|
||||
boost::shared_ptr<view::DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(_drag_sig))
|
||||
if (dsoSig = dynamic_pointer_cast<view::DsoSignal>(_drag_sig)) {
|
||||
dsoSig->set_trig_vpos(event->pos().y(), true);
|
||||
_dso_trig_moved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_action_type == CURS_MOVE) {
|
||||
uint64_t sample_rate = _view.session().cur_samplerate();
|
||||
TimeMarker* grabbed_marker = _view.get_ruler()->get_grabbed_cursor();
|
||||
@ -541,9 +583,11 @@ void Viewport::mouseMoveEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
_view.cursor_moving();
|
||||
_curs_moved = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!(event->buttons() || Qt::NoButton)) {
|
||||
if (_action_type == DSO_XM_STEP1 || _action_type == DSO_XM_STEP2) {
|
||||
BOOST_FOREACH(const boost::shared_ptr<Signal> s, _view.session().get_signals()) {
|
||||
assert(s);
|
||||
@ -578,31 +622,6 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event)
|
||||
const double samples_per_pixel = _view.session().cur_samplerate() * _view.scale();
|
||||
if ((_action_type == NO_ACTION) &&
|
||||
(event->button() == Qt::LeftButton)) {
|
||||
// priority 0
|
||||
if (_action_type == NO_ACTION && _view.search_cursor_shown()) {
|
||||
const int64_t searchX = _view.get_search_cursor()->index()/samples_per_pixel - _view.offset();
|
||||
if (_view.get_search_cursor()->grabbed()) {
|
||||
_view.get_ruler()->rel_grabbed_cursor();
|
||||
} else if (qAbs(searchX - event->pos().x()) <= HitCursorMargin) {
|
||||
_view.get_ruler()->set_grabbed_cursor(_view.get_search_cursor());
|
||||
_action_type = CURS_MOVE;
|
||||
}
|
||||
}
|
||||
if (_action_type == NO_ACTION && _view.cursors_shown()) {
|
||||
list<Cursor*>::iterator i = _view.get_cursorList().begin();
|
||||
while (i != _view.get_cursorList().end()) {
|
||||
const int64_t cursorX = (*i)->index()/samples_per_pixel - _view.offset();
|
||||
if ((*i)->grabbed()) {
|
||||
_view.get_ruler()->rel_grabbed_cursor();
|
||||
} else if (qAbs(cursorX - event->pos().x()) <= HitCursorMargin) {
|
||||
_view.get_ruler()->set_grabbed_cursor(*i);
|
||||
_action_type = CURS_MOVE;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (_view.session().get_device()->dev_inst()->mode == LOGIC &&
|
||||
_view.session().get_capture_state() == SigSession::Stopped) {
|
||||
// priority 1
|
||||
@ -645,24 +664,6 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event)
|
||||
_dso_ym_index = _hover_index;
|
||||
_dso_ym_start = event->pos().y();
|
||||
}
|
||||
|
||||
// priority 1
|
||||
if (_action_type == NO_ACTION) {
|
||||
const vector< boost::shared_ptr<Signal> > sigs(_view.session().get_signals());
|
||||
BOOST_FOREACH(const boost::shared_ptr<Signal> s, sigs) {
|
||||
assert(s);
|
||||
if (!s->enabled())
|
||||
continue;
|
||||
boost::shared_ptr<DsoSignal> dsoSig;
|
||||
if (dsoSig = dynamic_pointer_cast<DsoSignal>(s)) {
|
||||
if (dsoSig->get_trig_rect(0, _view.get_view_width()).contains(_mouse_point)) {
|
||||
_drag_sig = s;
|
||||
_action_type = DSO_TRIG_MOVE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (_action_type == DSO_YM) {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
@ -673,9 +674,15 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event)
|
||||
_dso_ym_valid = false;
|
||||
}
|
||||
} else if (_action_type == DSO_TRIG_MOVE) {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
if (_dso_trig_moved && event->button() == Qt::LeftButton) {
|
||||
_drag_sig.reset();
|
||||
_action_type = NO_ACTION;
|
||||
_dso_trig_moved = false;
|
||||
|
||||
const vector< boost::shared_ptr<Trace> > traces(
|
||||
_view.get_traces(ALL_VIEW));
|
||||
BOOST_FOREACH(const boost::shared_ptr<Trace> t, traces)
|
||||
t->select(false);
|
||||
}
|
||||
} else if (_action_type == DSO_XM_STEP0) {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
@ -721,19 +728,12 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event)
|
||||
measure_updated();
|
||||
}
|
||||
} else if (_action_type == CURS_MOVE) {
|
||||
_action_type = NO_ACTION;
|
||||
_view.get_ruler()->rel_grabbed_cursor();
|
||||
|
||||
// if (_view.cursors_shown()) {
|
||||
// list<Cursor*>::iterator i = _view.get_cursorList().begin();
|
||||
// while (i != _view.get_cursorList().end()) {
|
||||
// if ((*i)->grabbed()) {
|
||||
// _view.get_ruler()->rel_grabbed_cursor();
|
||||
// }
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
_view.cursor_moved();
|
||||
if (_curs_moved && event->button() == Qt::LeftButton) {
|
||||
_action_type = NO_ACTION;
|
||||
_view.get_ruler()->rel_grabbed_cursor();
|
||||
_view.cursor_moved();
|
||||
_curs_moved = false;
|
||||
}
|
||||
} else if (_action_type == LOGIC_EDGE) {
|
||||
_action_type = NO_ACTION;
|
||||
_edge_rising = 0;
|
||||
@ -753,6 +753,10 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event)
|
||||
abs(strength) > DragTimerInterval) {
|
||||
_drag_strength = strength * 5;
|
||||
_drag_timer.start(DragTimerInterval);
|
||||
} else {
|
||||
_drag_strength = 0;
|
||||
_drag_timer.stop();
|
||||
_action_type = NO_ACTION;
|
||||
}
|
||||
}
|
||||
} else if (_action_type == LOGIC_ZOOM) {
|
||||
@ -1369,6 +1373,10 @@ void Viewport::unshow_wait_trigger()
|
||||
update();
|
||||
}
|
||||
|
||||
bool Viewport::get_dso_trig_moved() const
|
||||
{
|
||||
return _dso_trig_moved;
|
||||
}
|
||||
|
||||
} // namespace view
|
||||
} // namespace pv
|
||||
|
@ -101,6 +101,8 @@ public:
|
||||
|
||||
void set_need_update(bool update);
|
||||
|
||||
bool get_dso_trig_moved() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
@ -195,6 +197,8 @@ private:
|
||||
int _dso_ym_end;
|
||||
|
||||
int _waiting_trig;
|
||||
bool _dso_trig_moved;
|
||||
bool _curs_moved;
|
||||
};
|
||||
|
||||
} // namespace view
|
||||
|
Loading…
x
Reference in New Issue
Block a user