+ const vector< shared_ptr<Trace> > traces(_view.get_traces());
+
+ if (event->button() & Qt::LeftButton) {
+ _mouse_down_point = event->pos();
+
+ // Save the offsets of any signals which will be dragged
+ BOOST_FOREACH(const shared_ptr<Trace> t, traces)
+ if (t->selected())
+ _drag_traces.push_back(
+ make_pair(t, t->get_v_offset()));
+ }
+
+ // Select the signal if it has been clicked
+ const shared_ptr<Trace> mouse_over_trace =
+ get_mouse_over_trace(event->pos());
+ if (mouse_over_trace) {
+ if (mouse_over_trace->selected())
+ mouse_over_trace->select(false);
+ else {
+ mouse_over_trace->select(true);
+
+ if (~QApplication::keyboardModifiers() &
+ Qt::ControlModifier)
+ _drag_traces.clear();
+
+ // Add the signal to the drag list
+ if (event->button() & Qt::LeftButton)
+ _drag_traces.push_back(
+ make_pair(mouse_over_trace,
+ mouse_over_trace->get_v_offset()));
+ }
+ }
+
+ if (~QApplication::keyboardModifiers() & Qt::ControlModifier) {
+ // Unselect all other signals because the Ctrl is not
+ // pressed
+ BOOST_FOREACH(const shared_ptr<Trace> t, traces)
+ if (t != mouse_over_trace)
+ t->select(false);
+ }
+
+ selection_changed();