| 638 | } |
| 639 | |
| 640 | void Viewport::mousePressEvent(QMouseEvent *event) |
| 641 | { |
| 642 | assert(event); |
| 643 | |
| 644 | _mouse_down_point = event->pos(); |
| 645 | _mouse_down_offset = _view.offset(); |
| 646 | _drag_strength = 0; |
| 647 | _elapsed_time.restart(); |
| 648 | |
| 649 | if (_action_type == NO_ACTION |
| 650 | && event->button() == Qt::RightButton |
| 651 | && _view.session().is_stopped_status()) |
| 652 | { |
| 653 | if (_view.session().get_device()->get_work_mode() == LOGIC) { |
| 654 | set_action(LOGIC_ZOOM); |
| 655 | } |
| 656 | else if (_view.session().get_device()->get_work_mode() == DSO) { |
| 657 | if (_hover_hit) { |
| 658 | const int64_t index = _view.pixel2index(event->pos().x()); |
| 659 | auto &cursor_list = _view.get_cursorList(); |
| 660 | _view.add_cursor(index); |
| 661 | _view.show_cursors(true); |
| 662 | } |
| 663 | } |
| 664 | } |
| 665 | |
| 666 | if (_action_type == NO_ACTION && |
| 667 | event->button() == Qt::LeftButton && |
| 668 | _view.session().get_device()->get_work_mode() == DSO) { |
| 669 | |
| 670 | for(auto s : _view.session().get_signals()) |
| 671 | { |
| 672 | if (s->signal_type() == SR_CHANNEL_DSO && s->enabled()) { |
| 673 | DsoSignal *dsoSig = (DsoSignal*)s; |
| 674 | if (dsoSig->get_trig_rect(0, _view.get_view_width()).contains(_mouse_point)) { |
| 675 | _drag_sig = s; |
| 676 | set_action(DSO_TRIG_MOVE); |
| 677 | dsoSig->select(true); |
| 678 | break; |
| 679 | } |
| 680 | } |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | if (_action_type == NO_ACTION |
| 685 | && event->button() == Qt::LeftButton) { |
| 686 | if (_action_type == NO_ACTION && _view.search_cursor_shown()) { |
| 687 | const int64_t searchX = _view.index2pixel(_view.get_search_cursor()->index()); |
| 688 | |
| 689 | if (_view.get_search_cursor()->grabbed()) { |
| 690 | _view.get_ruler()->rel_grabbed_cursor(); |
| 691 | } |
| 692 | else if (qAbs(searchX - event->pos().x()) <= HitCursorMargin) { |
| 693 | _view.get_ruler()->set_grabbed_cursor(_view.get_search_cursor()); |
| 694 | set_action(CURS_MOVE); |
| 695 | } |
| 696 | } |
| 697 |
nothing calls this directly
no test coverage detected