public int processEvent(MiEvent event) {
    if ((isEnabled())
        && (event.getType() != MiEvent.Mi_TIMER_TICK_EVENT)
        && (event.getType() != MiEvent.Mi_IDLE_EVENT)) {
      tmpPoint.copy(event.worldPt);
      MiPageManager pageManager = event.editor.getPageManager();
      String unitsName = "";
      if (pageManager != null) {
        pageManager.transformWorldPointToUnitsPoint(tmpPoint);
        unitsName = pageManager.getUnits().getAbbreviation();
      }

      if (tmpPoint.x != lastX) {
        lastX = tmpPoint.x;
        xPos.setValue("X: " + Utility.toShortString(tmpPoint.x) + " " + unitsName);
      }
      if (tmpPoint.y != lastY) {
        lastY = tmpPoint.y;
        yPos.setValue("Y: " + Utility.toShortString(tmpPoint.y) + " " + unitsName);
      }
    }
    return (Mi_PROPOGATE_EVENT);
  }
Пример #2
0
  public int processEvent(MiEvent event) {
    if ((event.type == Mi_WINDOW_EXIT_EVENT) || (event.type == Mi_MOUSE_EXIT_EVENT)) {
      setVisible(false);
      visible = false;
    } else if ((event.type != Mi_IDLE_EVENT) && (event.type != Mi_TIMER_TICK_EVENT)) {
      if (!cursorIsAttached) {
        event.editor.appendAttachment(cursor);
        cursorIsAttached = true;
      }

      boolean makeVisible = true;
      if (showOnlyDuringTheseEventStates != null) {
        for (int i = 0; i < showOnlyDuringTheseEventStates.size(); ++i) {
          makeVisible = false;
          MiEvent validEvent = (MiEvent) showOnlyDuringTheseEventStates.get(i);
          if (((validEvent.getModifiers() == event.getModifiers())
                  || (validEvent.getModifiers() == Mi_ANY_MODIFIERS_HELD_DOWN))
              && (validEvent.getMouseButtonState() == event.getMouseButtonState())) {
            makeVisible = true;
            break;
          }
        }
      }
      if (hideDuringTheseEventStates != null) {
        for (int i = 0; i < hideDuringTheseEventStates.size(); ++i) {
          MiEvent validEvent = (MiEvent) hideDuringTheseEventStates.get(i);
          if (((validEvent.getModifiers() == event.getModifiers())
                  || (validEvent.getModifiers() == Mi_ANY_MODIFIERS_HELD_DOWN))
              && (validEvent.getMouseButtonState() == event.getMouseButtonState())) {
            makeVisible = false;
            break;
          }
        }
      }

      if (makeVisible) {
        event.editor.getWorldBounds(editorWorld);
        if ((!event.worldPt.equals(cursorPt)) || (!editorWorld.equals(cursorWorldBounds))) {
          cursorPt.copy(event.worldPt);
          cursorWorldBounds.copy(editorWorld);
          setCursor(cursorPt, cursorWorldBounds);
          if (!visible) {
            setVisible(true);
            visible = true;
          }
        }
      } else {
        setVisible(false);
        visible = false;
      }
    }
    return (Mi_PROPOGATE_EVENT);
  }