public void mouseReleased(MouseEvent e) {
   logEvent("MouseReleased", e);
   // send event to the pressedNode
   publishMouseEvent(
       e.getX(),
       e.getY(),
       EventBus.getSystem().getPressedNode(),
       org.joshy.gfx.event.MouseEvent.MouseReleased,
       e.getButton(),
       e.isShiftDown(),
       e.isAltDown(),
       e.isControlDown(),
       e.isMetaDown());
   // also send event to the top node under the cursor if it's not the pressedNode
   Node node = findTopNode(e.getX(), e.getY());
   if (node != EventBus.getSystem().getPressedNode()) {
     publishMouseEvent(
         e.getX(),
         e.getY(),
         node,
         org.joshy.gfx.event.MouseEvent.MouseReleased,
         e.getButton(),
         e.isShiftDown(),
         e.isAltDown(),
         e.isControlDown(),
         e.isMetaDown());
   }
   EventBus.getSystem().setPressedNode(null);
 }
 public void mouseMoved(MouseEvent e) {
   logEvent("MouseMoved", e);
   Node node = findTopNode(e.getX(), e.getY());
   if (node != hoverNode) {
     if (hoverNode != null) {
       Point2D point = convertSceneToNode(e.getX(), e.getY(), hoverNode);
       org.joshy.gfx.event.MouseEvent evt =
           new org.joshy.gfx.event.MouseEvent(
               org.joshy.gfx.event.MouseEvent.MouseExited,
               point.getX(),
               point.getY(),
               hoverNode,
               e.getButton(),
               e.isShiftDown(),
               e.isAltDown(),
               e.isControlDown(),
               e.isMetaDown());
       EventBus.getSystem().publish(evt);
     }
     hoverNode = node;
     if (hoverNode != null) {
       Point2D point = convertSceneToNode(e.getX(), e.getY(), hoverNode);
       org.joshy.gfx.event.MouseEvent evt =
           new org.joshy.gfx.event.MouseEvent(
               org.joshy.gfx.event.MouseEvent.MouseEntered,
               point.getX(),
               point.getY(),
               hoverNode,
               e.getButton(),
               e.isShiftDown(),
               e.isAltDown(),
               e.isControlDown(),
               e.isMetaDown());
       EventBus.getSystem().publish(evt);
     }
   }
   Point2D point = convertSceneToNode(e.getX(), e.getY(), node);
   org.joshy.gfx.event.MouseEvent evt =
       new org.joshy.gfx.event.MouseEvent(
           org.joshy.gfx.event.MouseEvent.MouseMoved,
           point.getX(),
           point.getY(),
           node,
           e.getButton(),
           e.isShiftDown(),
           e.isAltDown(),
           e.isControlDown(),
           e.isMetaDown());
   EventBus.getSystem().publish(evt);
 }
 // Handle mouse actions
 public void mousePressed(MouseEvent mouseEvent) {
   if (this.isArmed() && this.isUseRubberBand() && mouseEvent.getButton() == MouseEvent.BUTTON1) {
     if ((mouseEvent.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
       if (!mouseEvent.isControlDown()) {
         this.setActive(true);
         measureTool.addControlPoint();
         if (measureTool.getControlPoints().size() == 1) {
           measureTool.addControlPoint(); // Simulate a second click
         }
         // Set the rubber band target to the last control point or the relevant control for
         // regular shapes.
         if (measureTool.isRegularShape()) {
           String initControl =
               measureTool.getShapeInitialControl(measureTool.getWwd().getCurrentPosition());
           rubberBandTarget = measureTool.getControlPoint(initControl);
         } else {
           rubberBandTarget =
               (MeasureTool.ControlPoint)
                   measureTool.getControlPoints().get(measureTool.getControlPoints().size() - 1);
         }
         measureTool.firePropertyChange(MeasureTool.EVENT_RUBBERBAND_START, null, null);
       }
     }
     mouseEvent.consume();
   } else if (!this.isArmed()
       && mouseEvent.getButton() == MouseEvent.BUTTON1
       && mouseEvent.isAltDown()) {
     if (!this.measureTool.isRegularShape()) {
       this.setMoving(true);
       this.movingTarget = this.lastPickedObject;
     }
     mouseEvent.consume();
   }
 }
 @Override
 public void mousePressed(MouseEvent me) {
   x = me.getX();
   y = me.getY();
   altDown = me.isAltDown() || me.isAltGraphDown();
   undo = (me.getButton() == MouseEvent.BUTTON3) || altDown;
   ctrlDown = me.isControlDown() || me.isMetaDown();
   shiftDown = me.isShiftDown();
   first = true;
   if (!oneShot) {
     if (timer == null) {
       timer =
           new Timer(
               delay,
               e -> {
                 Point worldCoords = view.viewToWorld((int) x, (int) y);
                 tick(worldCoords.x, worldCoords.y, undo, first, 1.0f);
                 view.updateStatusBar(worldCoords.x, worldCoords.y);
                 first = false;
               });
       timer.setInitialDelay(0);
       timer.start();
       //                start = System.currentTimeMillis();
     }
   } else {
     Point worldCoords = view.viewToWorld((int) x, (int) y);
     tick(worldCoords.x, worldCoords.y, undo, true, 1.0f);
     view.updateStatusBar(worldCoords.x, worldCoords.y);
     Dimension dimension = getDimension();
     if (dimension != null) {
       dimension.armSavePoint();
     }
     logOperation(undo ? statisticsKeyUndo : statisticsKey);
   }
 }
Example #5
0
 /**
  * {@inheritDoc}
  *
  * @see swing.gui.AbstractMainPanel#boardClick(java.awt.event.MouseEvent)
  */
 @Override
 protected void boardClick(final MouseEvent mouseEvent) {
   final int idX = ((FieldComponent) mouseEvent.getComponent()).getIdX();
   final int idY = ((FieldComponent) mouseEvent.getComponent()).getIdY();
   if (mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isShiftDown()) {
     // Linke Maustaste + SHIFT = Wert aendern
     if (getFieldComponent(idX, idY).getValue() < getFieldComponent(idX, idY).getMaxValue()) {
       getFieldComponent(idX, idY).setValue(getFieldComponent(idX, idY).getValue() + 1);
     } else {
       getFieldComponent(idX, idY).setValue(0);
     }
   } else if (mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isControlDown()) {
     // Linke Maustaste + STRG = Besitzer aendern
     if (getFieldComponent(idX, idY).getOwnerId() < GameSession.gameOptions.getMaxPlayers() - 1) {
       getFieldComponent(idX, idY).setOwner(getFieldComponent(idX, idY).getOwnerId() + 1);
     } else {
       getFieldComponent(idX, idY).setOwner(-1);
     }
   } else if (mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isAltDown()) {
     // Linke Maustaste + ALT = Reset
     getFieldComponent(idX, idY).setValue(0);
     getFieldComponent(idX, idY).setOwner(-1);
     getFieldComponent(idX, idY).setEnabled(true);
   } else if (mouseEvent.getButton() == MouseEvent.BUTTON1) {
     // Linke Maustaste = Aktivieren/Deaktivieren
     if (getFieldComponent(idX, idY).isEnabled()) {
       getFieldComponent(idX, idY).setEnabled(false);
     } else {
       getFieldComponent(idX, idY).setEnabled(true);
     }
   }
   repaint();
 }
 /**
  * Removes the painted value.
  *
  * @see MouseListener#mouseReleased(MouseEvent)
  */
 public void mouseReleased(MouseEvent e) {
   canvas.setCursor(Cursor.getDefaultCursor());
   Point p = e.getPoint();
   if ((handleKeyDown && e.isAltDown()) || model.isBigImage()) {
     pan(p, true);
   }
   pressedPoint = DEFAULT_POINT;
   SwingUtilities.convertPointToScreen(pressedPoint, canvas);
   if (canvas instanceof BrowserBICanvas) ((BrowserBICanvas) canvas).setPaintedString(-1, -1);
 }
Example #7
0
  /**
   * Invoked when a mouse button has been pressed and released on a component
   *
   * @param e the mouse event
   */
  public void mouseClicked(MouseEvent e) {
    int col;
    boolean popup;

    col = m_TableArff.columnAtPoint(e.getPoint());
    popup =
        ((e.getButton() == MouseEvent.BUTTON3) && (e.getClickCount() == 1))
            || ((e.getButton() == MouseEvent.BUTTON1)
                && (e.getClickCount() == 1)
                && e.isAltDown()
                && !e.isControlDown()
                && !e.isShiftDown());
    popup = popup && (getInstances() != null);

    if (e.getSource() == m_TableArff.getTableHeader()) {
      m_CurrentCol = col;

      // Popup-Menu
      if (popup) {
        e.consume();
        setMenu();
        initPopupMenus();
        m_PopupHeader.show(e.getComponent(), e.getX(), e.getY());
      }
    } else if (e.getSource() == m_TableArff) {
      // Popup-Menu
      if (popup) {
        e.consume();
        setMenu();
        initPopupMenus();
        m_PopupRows.show(e.getComponent(), e.getX(), e.getY());
      }
    }

    // highlihgt column
    if ((e.getButton() == MouseEvent.BUTTON1)
        && (e.getClickCount() == 1)
        && (!e.isAltDown())
        && (col > -1)) {
      m_TableArff.setSelectedColumn(col);
    }
  }
Example #8
0
    public void mouseClicked(MouseEvent e) {
      details = String.format("You clicked %d", e.getClickCount());

      // isMetaDown() = what kind mouse is used now? one button or two
      // button or more?
      if (e.isMetaDown()) details += "with right mouse button";
      else if (e.isAltDown()) details += "with center mouse button";
      else details += "with left mouse";

      statusBar.setText(details);
    }
 void setRoiModState(MouseEvent e, Roi roi, int handle) {
   if (roi == null || (handle >= 0 && roi.modState == Roi.NO_MODS)) return;
   if (roi.state == Roi.CONSTRUCTING) return;
   int tool = Toolbar.getToolId();
   if (tool > Toolbar.FREEROI && tool != Toolbar.WAND && tool != Toolbar.POINT) {
     roi.modState = Roi.NO_MODS;
     return;
   }
   if (e.isShiftDown()) roi.modState = Roi.ADD_TO_ROI;
   else if (e.isAltDown()) roi.modState = Roi.SUBTRACT_FROM_ROI;
   else roi.modState = Roi.NO_MODS;
   // IJ.log("setRoiModState: "+roi.modState+" "+ roi.state);
 }
Example #10
0
 // Variables declaration - do not modify//GEN-BEGIN:variables
 // End of variables declaration//GEN-END:variables
 @Override
 public void mouseClicked(MouseEvent e) {
   if ((e.getClickCount() & 1) == 0
       && (e.getClickCount() > 0)
       && !e.isConsumed()) { // double clicks and repeated double clicks
     e.consume();
     Object obj = e.getSource();
     if (obj instanceof Card) {
       if (e.isAltDown()) {
         cardEventSource.altDoubleClick(((Card) obj).getOriginal(), "alt-double-click");
       } else {
         cardEventSource.doubleClick(((Card) obj).getOriginal(), "double-click");
       }
     } else if (obj instanceof MageCard) {
       if (e.isAltDown()) {
         cardEventSource.altDoubleClick(((MageCard) obj).getOriginal(), "alt-double-click");
       } else {
         cardEventSource.doubleClick(((MageCard) obj).getOriginal(), "double-click");
       }
     }
   }
 }
    // handle mouse-click event and determine which button was pressed
    public void mouseClicked(MouseEvent event) {
      int xPos = event.getX(); // get x-position of mouse
      int yPos = event.getY(); // get y-position of mouse

      details = String.format("Clicked %d time(s)", event.getClickCount());

      if (event.isMetaDown()) // right mouse button
      details += " with right mouse button";
      else if (event.isAltDown()) // middle mouse button
      details += " with center mouse button";
      else // left mouse button
      details += " with left mouse button";

      statusBar.setText(details); // display message in statusBar
    } // end method mouseClicked
  private org.joshy.gfx.event.MouseEvent toEvent(
      MouseEvent e, Point2D point, Node node, Event.EventType type) {
    boolean meta = e.isMetaDown();
    if (e.isPopupTrigger()) {
      meta = false;
    }

    org.joshy.gfx.event.MouseEvent evt =
        new org.joshy.gfx.event.MouseEvent(
            type,
            point.getX(),
            point.getY(),
            node,
            e.getButton(),
            e.isShiftDown(),
            e.isAltDown(),
            e.isControlDown(),
            meta);
    return evt;
  }
 /**
  * Zooms in and out the image if the <code>Shift</code> key is down, pans if the <code>Alt</code>
  * key is down. Selects a new z-section and time-point otherwise.
  *
  * @see MouseMotionListener#mouseDragged(MouseEvent)
  */
 public void mouseDragged(MouseEvent e) {
   Point p = e.getPoint();
   if (handleKeyDown) {
     if (e.isShiftDown()) {
       if (model.isBigImage()) {
         pan(p, false);
         return;
       }
       if (p.y < pressedPoint.y) model.zoom(true);
       else if (p.y > pressedPoint.y) model.zoom(false);
       pressedPoint = p;
       return;
     } else if (e.isAltDown()) {
       pan(p, false);
       return;
     }
   }
   if (model.isBigImage()) { // panning
     pan(p, false);
     return;
   }
   int maxZ = model.getMaxZ();
   int maxT = model.getMaxT();
   if (maxZ <= 0 && maxT <= 0) return;
   int pressedZ = -1;
   int pressedT = -1;
   pressedZ = (p.y * maxZ) / area.height;
   if (pressedZ < 0) return;
   pressedZ = maxZ - pressedZ;
   if (pressedZ > maxZ) pressedZ = -1;
   pressedT = (p.x * maxT) / area.width;
   if (pressedT < 0) return;
   if (pressedT > maxT) return;
   model.setSelectedXYPlane(pressedZ, pressedT);
   if (canvas instanceof BrowserBICanvas)
     ((BrowserBICanvas) canvas).setPaintedString(pressedZ, pressedT);
 }
  // Handle mouse motion
  public void mouseDragged(MouseEvent mouseEvent) {
    if (measureTool == null) return;

    if (this.isActive()
        && this.isArmed()
        && (mouseEvent.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) {
      // Don't update the control point here because the wwd current cursor position will not
      // have been updated to reflect the current mouse position. Wait to update in the
      // position listener, but consume the event so the view doesn't respond to it.
      mouseEvent.consume();
    } else if (!this.isArmed()
        && this.isMoving()
        && (mouseEvent.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0
        && mouseEvent.isAltDown()) {
      // Consume the ALT+Drag mouse event to ensure the View does not respond to it. Don't update
      // the control
      // point here because the wwd current cursor position will not have been updated to reflect
      // the current
      // mouse position. Wait to update in the position listener, but consume the event so the view
      // doesn't
      // respond to it.
      mouseEvent.consume();
    }
  }
 @Override
 public void mouseMoved(MouseEvent me) {
   altDown = me.isAltDown() || me.isAltGraphDown();
   ctrlDown = me.isControlDown() || me.isMetaDown();
   shiftDown = me.isShiftDown();
 }
Example #16
0
  private void onMouseDown(MouseEvent e) {
    if (_tile != getTile(e)) return;

    // Remember mouse down location.
    int x = _xdown = e.getX();
    int y = _ydown = e.getY();

    // What segment and point, if any, was clicked?
    int[] i = {0, 0}, p = {0, 0};
    int icode = getSegmentAndPoint(x, y, i, p);
    int is = i[0], ip = i[1];
    int xp = p[0], yp = p[1];
    // trace("onMouseDown: is="+is+" ip="+ip);

    // If currently in the process of creating a new segment, ...
    if (_creating) {

      // If mouse is on previous (selected) point in the created segment,
      // then end segment creation.
      if (icode == 1 && isSelected(is, ip)) {
        _creating = false;
      }

      // Else append a new point to the created segment.
      else {
        is = _isSelected;
        ip = appendPoint(x, y);
        selectPoint(is, ip);
        addMotionListener();
      }
    }

    // Else if not currently in the process of creating a new segment, ...
    else {

      // If mouse on existing point, ...
      if (icode == 1) {

        // If alt key down, delete the point.
        if (e.isAltDown()) {
          selectPoint(is, ip);
          removeSelectedPoint();
        }

        // Else, select the point
        else {
          selectPoint(is, ip);
          addMotionListener();
        }
      }

      // Else if mouse on existing segment, ...
      else if (icode == 2) {

        // If shift key down, add a new point to existing segment.
        if (e.isShiftDown()) {
          insertPoint(is, ip, x, y);
          selectPoint(is, ip);
          addMotionListener();
        }
      }

      // Else if mouse down away from all segments, ...
      else {

        // If shift key down, create a new segment.
        if (e.isShiftDown()) {
          is = appendSegment(x, y);
          ip = 0;
          selectPoint(is, ip);
          addMotionListener();
          _creating = true;
        }

        // Else deselect all points.
        else {
          deselect();
        }
      }
    }
    updateAll();
  }
Example #17
0
  public void mousePressed(MouseEvent e) {
    // if (ij==null) return;
    showCursorStatus = true;
    int toolID = Toolbar.getToolId();
    ImageWindow win = imp.getWindow();
    if (win != null && win.running2 && toolID != Toolbar.MAGNIFIER) {
      if (win instanceof StackWindow) ((StackWindow) win).setAnimate(false);
      else win.running2 = false;
      return;
    }

    int x = e.getX();
    int y = e.getY();
    flags = e.getModifiers();
    // IJ.log("Mouse pressed: " + e.isPopupTrigger() + "  " + ij.modifiers(flags));
    // if (toolID!=Toolbar.MAGNIFIER && e.isPopupTrigger()) {
    if (toolID != Toolbar.MAGNIFIER
        && (e.isPopupTrigger() || (!IJ.isMacintosh() && (flags & Event.META_MASK) != 0))) {
      handlePopupMenu(e);
      return;
    }

    int ox = offScreenX(x);
    int oy = offScreenY(y);
    xMouse = ox;
    yMouse = oy;
    if (IJ.spaceBarDown()) {
      // temporarily switch to "hand" tool of space bar down
      setupScroll(ox, oy);
      return;
    }
    if (showAllROIs) {
      Roi roi = imp.getRoi();
      if (!(roi != null && (roi.contains(ox, oy) || roi.isHandle(x, y) >= 0))
          && roiManagerSelect(x, y)) return;
    }
    if (customRoi && overlay != null) return;

    switch (toolID) {
      case Toolbar.MAGNIFIER:
        if (IJ.shiftKeyDown()) zoomToSelection(ox, oy);
        else if ((flags & (Event.ALT_MASK | Event.META_MASK | Event.CTRL_MASK)) != 0) {
          // IJ.run("Out");
          zoomOut(x, y);
          if (getMagnification() < 1.0) imp.repaintWindow();
        } else {
          // IJ.run("In");
          zoomIn(x, y);
          if (getMagnification() <= 1.0) imp.repaintWindow();
        }
        break;
      case Toolbar.HAND:
        setupScroll(ox, oy);
        break;
      case Toolbar.DROPPER:
        setDrawingColor(ox, oy, IJ.altKeyDown());
        break;
      case Toolbar.WAND:
        Roi roi = imp.getRoi();
        if (roi != null && roi.contains(ox, oy)) {
          Rectangle r = roi.getBounds();
          if (r.width == imageWidth && r.height == imageHeight) imp.killRoi();
          else if (!e.isAltDown()) {
            handleRoiMouseDown(e);
            return;
          }
        }
        if (roi != null) {
          int handle = roi.isHandle(x, y);
          if (handle >= 0) {
            roi.mouseDownInHandle(handle, x, y);
            return;
          }
        }
        setRoiModState(e, roi, -1);
        String mode = WandToolOptions.getMode();
        double tolerance = WandToolOptions.getTolerance();
        int npoints = IJ.doWand(ox, oy, tolerance, mode);
        if (Recorder.record && npoints > 0) {
          if (tolerance == 0.0 && mode.equals("Legacy")) Recorder.record("doWand", ox, oy);
          else
            Recorder.recordString(
                "doWand(" + ox + ", " + oy + ", " + tolerance + ", \"" + mode + "\");\n");
        }
        break;
      case Toolbar.OVAL:
        if (Toolbar.getBrushSize() > 0) new RoiBrush();
        else handleRoiMouseDown(e);
        break;
      case Toolbar.SPARE1:
      case Toolbar.SPARE2:
      case Toolbar.SPARE3:
      case Toolbar.SPARE4:
      case Toolbar.SPARE5:
      case Toolbar.SPARE6:
      case Toolbar.SPARE7:
      case Toolbar.SPARE8:
      case Toolbar.SPARE9:
        Toolbar.getInstance().runMacroTool(toolID);
        break;
      default: // selection tool
        handleRoiMouseDown(e);
    }
  }
Example #18
0
  private void beadPlayer1MousePressed(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_beadPlayer1MousePressed
    /**
     * 2015-05-13
     *
     * <p>Update note. If a bead is already Connected to something, then the user can "Drag" to move
     * around the note.
     *
     * <p>One can overlap if s/he clicked on "offset margin"
     */
    point1 = evt.getPoint();
    Bead tmpBead = beadPlayer1.getBeadAt(point1.x, point1.y, beadPlayer1.page);

    if (evt.getButton() == MouseEvent.BUTTON1) // Left click
    {
      if (evt.isAltDown()) {
        if (isBeadPanelEmpty()) {
          refreshBeadPanel();
          beadPanelText.setVisible(true);
          activeBead.vibcompUI = this;

          Bead leftPossible = beadPlayer1.getBeadAt(point1.x - 27, point1.y, beadPlayer1.page);
          Bead rightPossible = beadPlayer1.getBeadAt(point1.x + 27, point1.y, beadPlayer1.page);
          if (leftPossible == null) { // If there exists no bead on the point's left
            if (rightPossible == null) {
              beadPlayer1.setBead(point1.x + 80, point1.y, activeBead);
            } else { // There is a bead on its right.
              beadPlayer1.setBead(rightPossible.getX() - 27, point1.y, activeBead);
            }
          } else if (rightPossible == null) { // There is a Bead on the left of clicked position.
            beadPlayer1.setBead(leftPossible.getX() + 80, point1.y, activeBead);
          }
        }
      }
      if (activeBead != null) {
        if (tmpBead == null) { // Create one
          beadPanelText.setVisible(true);
          activeBead.vibcompUI = this;
          Bead leftPossible = beadPlayer1.getBeadAt(point1.x - 27, point1.y, beadPlayer1.page);
          Bead rightPossible = beadPlayer1.getBeadAt(point1.x + 27, point1.y, beadPlayer1.page);
          if (leftPossible == null) { // If there exists no bead on the point's left
            if (rightPossible == null) {
              beadPlayer1.setBead(point1.x, point1.y, activeBead);
            } else { // There is a bead on its right.
              beadPlayer1.setBead(rightPossible.getX() - 27, point1.y, activeBead);
            }
          } else if (rightPossible == null) { // There is a Bead on the left of clicked position.
            beadPlayer1.setBead(leftPossible.getX() + 80, point1.y, activeBead);
          }
        } else { // There already is a bead at the location
          if (!activeBead.playable) {
            remove(activeBead); // Remove bead panel glitch
          } else {
            activeBead = tmpBead;
          }
        }
        // set slider positions
        intensitySlider.setValue(activeBead.getIntensity());
        frequencySlider.setValue(activeBead.getFrequency());

        // multi select
        if (evt.isShiftDown() || shiftOn) {
          if (multiSelect.contains(activeBead)) multiSelect.remove(activeBead);
          else multiSelect.add(activeBead);
        } else {
          multiSelect.clear();
        }
      } else if (beadPlayer1.beads.isEmpty()) {
        JOptionPane.showMessageDialog(
            null,
            "Please click 'New Bead' to create a Bead, then Click on then click on the canvas");
      } else if (activeBead == null && tmpBead != null) {
        activeBead = tmpBead;
      }
    }
    if (evt.getButton() == MouseEvent.BUTTON3
        || evt.getClickCount() == 2) { // Right click or double click
      if (tmpBead != null) {
        if (multiSelect.size() == 1) multiSelect.clear();
        multiSelect.add(tmpBead);
        activeBead = tmpBead;
      }
      menu.show(evt.getComponent(), evt.getX(), evt.getY());
    }
  } // GEN-LAST:event_beadPlayer1MousePressed
Example #19
0
 private boolean accept(MouseEvent e) {
   return e.getButton() == MouseEvent.BUTTON3
       && !e.isControlDown()
       && !e.isShiftDown()
       && !e.isAltDown();
 }
  /*
   * MouseListener implementation for popup menus
   */
  public void mouseClicked(java.awt.event.MouseEvent e) {
    // right click is consumed in mousePressed, but in GeoGebra 3D,
    // where heavyweight popup menus are enabled this doesn't work
    // so make sure that this is no right click as well (ticket #302)
    if (e.isConsumed() || AppD.isRightClick(e)) {
      return;
    }

    // get GeoElement at mouse location
    TreePath tp = tree.getPathForLocation(e.getX(), e.getY());
    GeoElement geo = AlgebraTree.getGeoElementForPath(tp);

    ArrayList<GeoElement> groupedGeos = null;

    // check if we clicked on the 16x16 show/hide icon
    if (geo != null) {
      Rectangle rect = tree.getPathBounds(tp);
      boolean iconClicked = rect != null && e.getX() - rect.x < 16; // distance from left border		
      if (iconClicked) {
        // icon clicked: toggle show/hide
        geo.setEuclidianVisible(!geo.isSetEuclidianVisible());
        geo.updateVisualStyle();
        app.storeUndoInfo();
        kernel.notifyRepaint();
        return;
      }

    } else { // try group action
      groupedGeos = groupAction(e, tp, false);
    }

    // check double click
    if (checkDoubleClick(geo, e)) return;

    EuclidianViewInterfaceCommon ev = app.getActiveEuclidianView();
    int mode = ev.getMode();
    if (!skipSelection && isSelectionModeForClick(mode)) {
      // update selection
      if (geo == null) {
        if (!AppD.isControlDown(e) && !e.isShiftDown()) app.clearSelectedGeos();

        if (groupedGeos != null) app.addSelectedGeos(groupedGeos, true);

      } else {
        // handle selecting geo
        if (AppD.isControlDown(e)) {
          app.toggleSelectedGeo(geo);
          if (app.getSelectedGeos().contains(geo)) lastSelectedGeo = geo;
        } else if (e.isShiftDown() && lastSelectedGeo != null) {
          ArrayList<GeoElement> geos = tree.getGeosBetween(lastSelectedGeo, geo);
          if (geos != null) {
            app.clearSelectedGeos(false); // repaint will be done next step
            app.addSelectedGeos(geos, true);
          }

        } else {
          app.clearSelectedGeos(false); // repaint will be done next step
          app.addSelectedGeo(geo);
          lastSelectedGeo = geo;
        }
      }
    } else if (mode != EuclidianConstants.MODE_SELECTION_LISTENER) {
      euclidianViewClick(ev, geo, e);
    } else
      // tell selection listener about click
      app.geoElementSelected(geo, false);

    // Alt click: copy definition to input field
    if (geo != null && e.isAltDown() && app.showAlgebraInput()) {
      // F3 key: copy definition to input bar
      app.getGlobalKeyDispatcher().handleFunctionKeyForAlgebraInput(3, geo);
    }

    ev.mouseMovedOver(null);
  }