/** {@inheritedDoc} */
 public void mouseWheelMoved(MouseWheelEvent e) {
   if ((isMac && e.isMetaDown()) || e.isControlDown()) {
     int n = e.getWheelRotation();
     if (currentFontSize != Math.min(Math.max(0, currentFontSize + n), 6)) {
       modifyFontInEDT(n);
     }
     e.consume();
   }
 }
示例#2
0
  /* (non-Javadoc)
   * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent)
   *
   * Thread safety: This method is thread safe
   */
  @Override
  public void mouseWheelMoved(MouseWheelEvent e) {

    int lines = e.getWheelRotation();
    if (e.isControlDown()) {
      this.fastTextView.scrollPage((lines < 0) ? true : false);
    } else {
      this.fastTextView.scrollLines(2 * lines);
    }
  }
 public void mouseWheelMoved(MouseWheelEvent e) {
   Options options = OptionsManager.getInstance().getOptions();
   EditorOptions editorOptions = options.getEditorOptions();
   ZoomOptions zoomOptions = editorOptions.getZoomOptions();
   if (zoomOptions.isWheelZooming() && e.isControlDown()) {
     if (e.getWheelRotation() < 0) {
       zoomModel.zoomOut();
     } else {
       zoomModel.zoomIn();
     }
     e.consume();
   }
 }
示例#4
0
文件: Z.java 项目: adamldavis/z
 @Override
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (e.isControlDown()) {
     log.debug("zoom:" + e.getWheelRotation());
     if (e.getWheelRotation() > 0 && scale > 0.125f) {
       scale /= 2f;
     } else if (e.getWheelRotation() < 0 && scale < 32) {
       scale *= 2f;
     }
     log.debug("Scale:" + scale);
     if (!edit.getEditors().isEmpty()) {
       for (Editor editor : edit.getEditors()) {
         editor.setScale(scale);
       }
     }
   }
 }
  /*
   * (non-Javadoc)
   *
   * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.
   * MouseWheelEvent)
   */
  @Override
  public void mouseWheelMoved(MouseWheelEvent ev) {

    // checks if the graph exists and if the control key is pressed
    DirectedWeightedGraph canvasGraph = _canvas.get_graph();
    if (canvasGraph != null && ev.isControlDown()) {

      // We search the name of canvas parent
      CanvasPanel panelParent;
      String panel = _canvas.getParent().getClass().getName();
      if (panel.equals("acide.gui.debugPanel.traceSQLPanel.AcideTraceSQLPanel"))
        panelParent = CanvasPanel.TraceSQL;
      else if (panel.equals("acide.gui.debugPanel.debugSQLPanel.AcideDebugSQLPanel"))
        panelParent = CanvasPanel.DebugSQL;
      else if (panel.equals("acide.gui.debugPanel.traceDatalogPanel.AcideTraceDatalogPanel"))
        panelParent = CanvasPanel.TraceData;
      else panelParent = null;

      // gets the coordinates of the event
      int difx = ev.getX() - _canvas.getX0();
      int dify = ev.getY() - _canvas.getY0();
      // checks the wheel rotation direction
      if (ev.getWheelRotation() < 0) {
        // zooms in the canvas and move the graph
        _canvas.zoomIn(panelParent);
        int difx2 = ev.getX() - _canvas.getX0();
        int dify2 = ev.getY() - _canvas.getY0();
        _canvas.moveGraph(difx2 - difx, dify2 - dify);
      } else {
        // zooms out the canvas and move the graph
        _canvas.zoomOut(panelParent);
        int difx2 = ev.getX() - _canvas.getX0();
        int dify2 = ev.getY() - _canvas.getY0();
        _canvas.moveGraph(difx2 - difx, dify2 - dify);
      }
      // repaint the canvas
      _canvas.repaint();
    }
  }
 /**
  * Determines the value of the z-section.
  *
  * @see MouseWheelListener#mouseWheelMoved(MouseWheelEvent)
  */
 public void mouseWheelMoved(MouseWheelEvent e) {
   if (model.isBigImage()) return;
   if (e.isAltDown() || e.isShiftDown() || e.isControlDown()) { // zooming
     if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
       int v = e.getWheelRotation();
       model.zoom(v < 0); // zoom in and out.
     }
     return;
   }
   // change the z-section.
   int maxZ = model.getMaxZ();
   int maxT = model.getMaxT();
   if (maxZ <= 0 && maxT <= 0) return;
   boolean up = true;
   if (e.getWheelRotation() > 0) up = false;
   if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
     int v = model.getDefaultZ() - e.getWheelRotation();
     if (up) {
       if (v <= maxZ) {
         model.setSelectedXYPlane(v, -1);
         if (canvas instanceof BrowserBICanvas)
           ((BrowserBICanvas) canvas).setPaintedString(v, model.getDefaultT());
       } else {
         if (canvas instanceof BrowserBICanvas)
           ((BrowserBICanvas) canvas).setPaintedString(-1, -1);
       }
     } else { // moving down
       if (v >= 0) {
         model.setSelectedXYPlane(v, -1);
         if (canvas instanceof BrowserBICanvas)
           ((BrowserBICanvas) canvas).setPaintedString(v, model.getDefaultT());
       } else {
         if (canvas instanceof BrowserBICanvas)
           ((BrowserBICanvas) canvas).setPaintedString(-1, -1);
       }
     }
   }
 }