com.softsynth.jsyn.view11x
Class EnvelopeEditor

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by com.softsynth.jsyn.view102.XYController
              extended by com.softsynth.jsyn.view11x.XYController
                  extended by com.softsynth.jsyn.view11x.EnvelopeEditor
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class EnvelopeEditor
extends XYController
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Edit a vector of ordered duration,value pairs suitable for use with a SynthEnvelope.

Author:
(C) 1997 Phil Burk, SoftSynth.com, All Rights Reserved
See Also:
SynthEnvelope, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static int EDIT_POINTS
           
static int SELECT_RELEASE
           
static int SELECT_SUSTAIN
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
EnvelopeEditor()
           
 
Method Summary
 void addEditListener(EditListener listener)
          Add a listener to receive edit events.
 void drawAllPoints(java.awt.Graphics g)
           
 void drawPoints(java.awt.Graphics g, java.awt.Color lineColor)
           
 void drawRange(java.awt.Graphics g)
          Draw selected range.
 void drawSelections(java.awt.Graphics g)
           
 void drawUnderlay(java.awt.Graphics g)
          Override this to draw a grid or other stuff under the envelope.
 int findPointBefore(double wx)
          Return index of point before this X position.
 double getMaximumXRange()
           
 int getMaxPoints()
           
 double getMinimumXRange()
           
 int getMode()
           
 int getNumPoints()
           
 EnvelopePoints getPoints()
           
 boolean getVerticalBarsEnabled()
           
 double getVerticalBarSpacing()
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paint(java.awt.Graphics g)
           
 void removeEditListener(EditListener listener)
           
 void setMaximumXRange(double maxXRange)
           
 void setMaxPoints(int maxPoints)
           
 void setMinimumXRange(double minXRange)
           
 void setMode(int mode)
          Set mode to either EDIT_POINTS or SELECT_SUSTAIN, SELECT_RELEASE;
 void setPoints(EnvelopePoints points)
           
 void setSelection(int start, int end)
           
 void setVerticalBarsEnabled(boolean flag)
           
 void setVerticalBarSpacing(double spacing)
          Set spacing in world coordinates.
 void updateEditListeners()
          Send event to every subscribed listener.
 
Methods inherited from class com.softsynth.jsyn.view102.XYController
clipWorldX, clipWorldY, convertGXtoWX, convertGYtoWY, convertWXtoGX, convertWYtoGY, getMaxWorldX, getMaxWorldY, getMinWorldX, getMinWorldY, setMaxWorldX, setMaxWorldY, setMinWorldX, setMinWorldY
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EDIT_POINTS

public static final int EDIT_POINTS
See Also:
Constant Field Values

SELECT_SUSTAIN

public static final int SELECT_SUSTAIN
See Also:
Constant Field Values

SELECT_RELEASE

public static final int SELECT_RELEASE
See Also:
Constant Field Values
Constructor Detail

EnvelopeEditor

public EnvelopeEditor()
Method Detail

setMaximumXRange

public void setMaximumXRange(double maxXRange)

getMaximumXRange

public double getMaximumXRange()

setMinimumXRange

public void setMinimumXRange(double minXRange)

getMinimumXRange

public double getMinimumXRange()

setSelection

public void setSelection(int start,
                         int end)

setMode

public void setMode(int mode)
Set mode to either EDIT_POINTS or SELECT_SUSTAIN, SELECT_RELEASE;


getMode

public int getMode()

addEditListener

public void addEditListener(EditListener listener)
Add a listener to receive edit events. Listener will be passed the editor object and the edited object.


removeEditListener

public void removeEditListener(EditListener listener)

updateEditListeners

public void updateEditListeners()
Send event to every subscribed listener.


setMaxPoints

public void setMaxPoints(int maxPoints)

getMaxPoints

public int getMaxPoints()

getNumPoints

public int getNumPoints()

setPoints

public void setPoints(EnvelopePoints points)

getPoints

public EnvelopePoints getPoints()

findPointBefore

public int findPointBefore(double wx)
Return index of point before this X position.


mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mousePressed

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

mouseClicked

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

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased 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

drawRange

public void drawRange(java.awt.Graphics g)
Draw selected range.


drawSelections

public void drawSelections(java.awt.Graphics g)

drawUnderlay

public void drawUnderlay(java.awt.Graphics g)
Override this to draw a grid or other stuff under the envelope.


setVerticalBarsEnabled

public void setVerticalBarsEnabled(boolean flag)

getVerticalBarsEnabled

public boolean getVerticalBarsEnabled()

setVerticalBarSpacing

public void setVerticalBarSpacing(double spacing)
Set spacing in world coordinates.


getVerticalBarSpacing

public double getVerticalBarSpacing()

drawPoints

public void drawPoints(java.awt.Graphics g,
                       java.awt.Color lineColor)

drawAllPoints

public void drawAllPoints(java.awt.Graphics g)

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Canvas