Exemplo n.º 1
0
  /**
   * Finds the cursor under the given point.
   *
   * @param aPoint the coordinate of the potential cursor, cannot be <code>null</code>.
   * @return the cursor index, or -1 if not found.
   */
  protected final Cursor findCursor(final Point aPoint) {
    final SignalDiagramModel model = getModel();

    final long refIdx = model.locationToTimestamp(aPoint);
    final double snapArea = CURSOR_SENSITIVITY_AREA / model.getZoomFactor();

    for (Cursor cursor : model.getDefinedCursors()) {
      if (cursor.inArea(refIdx, snapArea)) {
        return cursor;
      }
    }

    return null;
  }
Exemplo n.º 2
0
    /** {@inheritDoc} */
    @Override
    public void mouseMoved(final MouseEvent aEvent) {
      final MouseEvent event = convertEvent(aEvent);
      final Point point = event.getPoint();

      final SignalDiagramModel model = getModel();
      if (model.isCursorMode()) {
        final Cursor hoveredCursor = findCursor(point);
        if (hoveredCursor != null) {
          setMouseCursor(aEvent, CURSOR_MOVE_CURSOR);
          aEvent.consume();
        } else {
          setMouseCursor(aEvent, null);
          aEvent.consume();
        }
      }

      setToolTipText(ViewUtils.getToolTipText(getModel(), point));
    }
Exemplo n.º 3
0
 /**
  * Determines what tooltip is to be displayed.
  *
  * @param aPoint a current mouse location, cannot be <code>null</code>.
  * @return a tooltip text, never <code>null</code>.
  */
 public static String getToolTipText(final SignalDiagramModel aModel, final Point aPoint) {
   final boolean hasTimingData = aModel.hasTimingData();
   return formatReference(
       hasTimingData,
       hasTimingData ? aModel.getTimestamp(aPoint.x) : aModel.locationToSampleIndex(aPoint));
 }
Exemplo n.º 4
0
 /**
  * Determines what tooltip is to be displayed.
  *
  * @param aPoint a current mouse location, cannot be <code>null</code>.
  * @return a tooltip text, never <code>null</code>.
  */
 public static String getToolTipText(final SignalDiagramModel aModel, final double aRefTime) {
   return formatReference(aModel.hasTimingData(), aRefTime);
 }