com.sun.electric.tool.user.ui
Class ClickZoomWireListener

java.lang.Object
  extended by com.sun.electric.tool.user.ui.ClickZoomWireListener
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

public class ClickZoomWireListener
extends java.lang.Object
implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener, java.awt.event.MouseWheelListener, java.awt.event.KeyListener, java.awt.event.ActionListener

Handles Selection, Zooming, and Wiring.

The Left Mouse Button handles Selection and Moving

The Right Mouse Button handles Zooming and Wiring

The Mouse Wheel handles panning User: gainsley Date: Feb 19, 2004 Time: 2:53:33 PM


Field Summary
static ClickZoomWireListener theOne
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Select object or Wire to object, depending upon popup menu used
 void clearSpecialSelect()
          Set ClickZoomWireListener to exclude hard to select objects
 long getCancelMoveDelayMillis()
           
static long getFactoryCancelMoveDelayMillis()
           
 java.awt.geom.Point2D getLastMouse()
          Return the last known location of the mouse.
 boolean getStickyMove()
          Returns state of 'stickyMove'.
 boolean getStickyWiring()
          Returns state of 'stickyWiring'.
 boolean getUseFatWiringMode()
           
 long getZoomInDelayMillis()
           
static boolean isMiddleMouse(java.awt.event.InputEvent evt)
          See if event is a middle mouse click.
static boolean isRightMouse(java.awt.event.InputEvent evt)
          See if event is a right mouse click.
 void keyPressed(java.awt.event.KeyEvent evt)
          Key pressed event Delete or Move selected objects
 void keyReleased(java.awt.event.KeyEvent evt)
           
 void keyTyped(java.awt.event.KeyEvent evt)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent evt)
          Handle mouse dragged event.
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent evt)
          Use to track sticky move of objects
 void mousePressed(java.awt.event.MouseEvent evt)
          Handle mouse press events.
 void mouseReleased(java.awt.event.MouseEvent evt)
          Handle mouse released event
 void mouseWheelMoved(java.awt.event.MouseWheelEvent evt)
          Mouse Wheel Events are used for panning Wheel Forward: scroll up Wheel Back: scroll down SHIFT + Wheel Forward: scroll right SHIFT + Wheel Back: scroll left
static void moveSelected(double dX, double dY, boolean scaleMove, boolean scaleMove2)
          Move selected object(s) via keystroke.
static void readPrefs()
          Recached Preferences after change
 javax.swing.JPopupMenu selectPopupMenu(java.util.List<Highlight2> objects)
          Popup menu when user is cycling through objects under pointer
 void setCancelMoveDelayMillis(long delay)
           
 void setRouter(InteractiveRouter router)
           
 void setSpecialSelect()
          Set ClickZoomWireListener to include hard to select objects
 void setUseFatWiringMode(boolean b)
           
 void setZoomInDelayMillis(long delay)
           
 void switchWiringTarget()
           
 void wireTo(int layerNumber)
          Wire to a layer.
 void zoomBoxSingleShot(java.util.EventListener oldListener)
          Sets the mode to zoom box for the next right click only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theOne

public static ClickZoomWireListener theOne
Method Detail

setSpecialSelect

public void setSpecialSelect()
Set ClickZoomWireListener to include hard to select objects


clearSpecialSelect

public void clearSpecialSelect()
Set ClickZoomWireListener to exclude hard to select objects


getStickyMove

public boolean getStickyMove()
Returns state of 'stickyMove'. If sticky move is true, after the user clicks and drags to move an object, the user can release the mouse button and the object will continue to move with the mouse. Clicking the select mouse key again will place the object. If sticky move is false, the user must hold and drag to move the object. Letting go of the select mouse key will place the object. This is the C-Electric style.

Returns:
state of preference 'stickyMove'

setRouter

public void setRouter(InteractiveRouter router)

getStickyWiring

public boolean getStickyWiring()
Returns state of 'stickyWiring'. If sticky wiring is true, after the user clicks and drags to draw a wire, the user can release the mouse button and the UI will remain in wire-draw mode. Click the mouse button again will draw the wire. If sticky wiring is false, the user must hold and drag to draw the tentative wire, and the wire gets drawn when the user releases the mouse button. This is C-Electric style.

Returns:
state of preference 'stickyWiring'

getLastMouse

public java.awt.geom.Point2D getLastMouse()
Return the last known location of the mouse. Note that these are screen coords, and are in the coordinate system of the current container(?).

Returns:
a Point2D containing the last mouse coords.

zoomBoxSingleShot

public void zoomBoxSingleShot(java.util.EventListener oldListener)
Sets the mode to zoom box for the next right click only.


isRightMouse

public static boolean isRightMouse(java.awt.event.InputEvent evt)
See if event is a right mouse click. Platform independent. One-button macs: Command + click == right mouse click.


isMiddleMouse

public static boolean isMiddleMouse(java.awt.event.InputEvent evt)
See if event is a middle mouse click. Platform independent.


mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Handle mouse press events.

Left Mouse Click: Select

Left Mouse Drag: Move Objects (or select area if not on object)

Left Mouse Double-Click: Get Info

CTRL + Left Mouse Click: Cycle through select

SHIFT + Left Mouse Click: invert selection

Right Mouse Click/Drag: Connect wire

SHIFT + Right Mouse Click: zoom out

SHIFT + Right Mouse Drag: zoom in

CTRL + SHIFT + Right Mouse Click: draw box

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
evt - the MouseEvent

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)
Handle mouse dragged event.

Left Mouse Drag: Move Objects (or select area if not on object)

Right Mouse Click/Drag: Connect wire

Right Mouse Drag + (later) CTRL: Connect wire in space (ignore objects)

SHIFT + Right Mouse Drag: zoom box

CTRL + Right Mouse Drag: draw box

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
evt - the MouseEvent

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Handle mouse released event

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
evt - the MouseEvent

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent evt)
Use to track sticky move of objects

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
evt - the MouseEvent

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseWheelMoved

public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt)
Mouse Wheel Events are used for panning Wheel Forward: scroll up Wheel Back: scroll down SHIFT + Wheel Forward: scroll right SHIFT + Wheel Back: scroll left

Specified by:
mouseWheelMoved in interface java.awt.event.MouseWheelListener
Parameters:
evt - the MouseWheelEvent

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Key pressed event Delete or Move selected objects

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
evt - the KeyEvent

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Specified by:
keyTyped in interface java.awt.event.KeyListener

moveSelected

public static void moveSelected(double dX,
                                double dY,
                                boolean scaleMove,
                                boolean scaleMove2)
Move selected object(s) via keystroke. If either scaleMove or scaleMove2 is true, the move is multiplied by the grid Bold frequency. If both are true the move gets multiplied twice.

Parameters:
dX - amount to move in X in lambda
dY - amount to move in Y in lambda
scaleMove - scales move up if true
scaleMove2 - scales move up if true (stacks with scaleMove)

switchWiringTarget

public void switchWiringTarget()

wireTo

public void wireTo(int layerNumber)
Wire to a layer.

Parameters:
layerNumber -

selectPopupMenu

public javax.swing.JPopupMenu selectPopupMenu(java.util.List<Highlight2> objects)
Popup menu when user is cycling through objects under pointer

Parameters:
objects - list of objects to put in menu
Returns:
the popup menu

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Select object or Wire to object, depending upon popup menu used

Specified by:
actionPerformed in interface java.awt.event.ActionListener

readPrefs

public static void readPrefs()
Recached Preferences after change


getCancelMoveDelayMillis

public long getCancelMoveDelayMillis()

getFactoryCancelMoveDelayMillis

public static long getFactoryCancelMoveDelayMillis()

setCancelMoveDelayMillis

public void setCancelMoveDelayMillis(long delay)

getZoomInDelayMillis

public long getZoomInDelayMillis()

setZoomInDelayMillis

public void setZoomInDelayMillis(long delay)

getUseFatWiringMode

public boolean getUseFatWiringMode()

setUseFatWiringMode

public void setUseFatWiringMode(boolean b)