Package com.softsynth.jmsl.score
Class ScoreCanvasAdapter
java.lang.Object
com.softsynth.jmsl.score.ScoreCanvasAdapter
- All Implemented Interfaces:
PVCanvas
,PVComponent
,EditStateListener
,ScoreCanvas
,ZoomListener
,java.awt.event.KeyListener
,java.awt.image.ImageObserver
,java.util.EventListener
- Direct Known Subclasses:
ScoreCanvasAWT
,ScoreCanvasSwing
public abstract class ScoreCanvasAdapter extends java.lang.Object implements ScoreCanvas, java.awt.image.ImageObserver, EditStateListener, ZoomListener, java.awt.event.KeyListener
-
Field Summary
Fields Modifier and Type Field Description static int
NO_CURSOR
static int
NO_RECTANGLE
Fields inherited from interface com.softsynth.jmsl.score.EditStateListener
copyright
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface com.softsynth.jmsl.score.ScoreCanvas
copyright
Fields inherited from interface com.softsynth.jmsl.score.ZoomListener
copyright
-
Constructor Summary
Constructors Constructor Description ScoreCanvasAdapter()
-
Method Summary
Modifier and Type Method Description void
addScoreCanvasListener(ScoreCanvasListener listener)
void
build(int w, int h)
void
editStateChanged(EditStateProvider esp)
EditStateListener interface.java.awt.Component
getComponent()
java.awt.Point
getCursorLocationOrigin()
java.awt.Point
getCursorLocationTerminus()
Note
getCursorNote()
java.awt.Font
getFont()
java.awt.Graphics
getGraphics()
int
getHeight()
java.awt.Point
getRectSelectOriginCorner()
java.awt.Point
getRectSelectTerminalCorner()
abstract java.awt.Graphics
getRenderGraphics()
java.util.Vector
getScoreCanvasListeners()
ScorePainter
getScorePainter()
int
getWidth()
void
handleMouseClick(java.awt.event.MouseEvent ev)
void
handleMouseDrag(int x, int y, java.awt.event.MouseEvent ev)
void
handleMousePressed(java.awt.event.MouseEvent ev)
void
handleMouseReleased(java.awt.event.MouseEvent ev)
void
handlePrint(Score score)
boolean
isCursorWasPlaced()
boolean
isDrawIt()
boolean
isRectangleInProgress()
boolean
isRectangleWasSelected()
boolean
isTranslationJustChanged()
void
keyPressed(java.awt.event.KeyEvent ev)
KeyListener interfacevoid
keyReleased(java.awt.event.KeyEvent ev)
KeyListener interfacevoid
keyTyped(java.awt.event.KeyEvent ev)
KeyListener interfacestatic void
main(java.lang.String[] args)
void
notify(int code)
Used to call back from listenervoid
notifyReady()
void
removeAllScoreCanvasListeners()
void
removeScoreCanvasListener(ScoreCanvasListener listener)
void
repaint()
component.repaint();void
setCursorLocation(java.awt.Point p1, java.awt.Point p2)
After notifying listener where the mouse was pressed, listener may respond by telling the cursor where to draw itself according to the context of what is being drawn (ie between two notes, drawn to the height of the staff - stuff that's unknown to the canvas)void
setCursorLocationOrigin(java.awt.Point cursorLocationOrigin)
void
setCursorLocationTerminus(java.awt.Point cursorLocationTerminus)
void
setCursorNote(Note cursorNote)
void
setCursorWasPlaced(boolean cursorWasPlaced)
void
setDrawIt(boolean drawIt)
void
setFont(java.awt.Font font)
void
setRectangleInProgress(boolean rectangleInProgress)
void
setRectangleWasSelected(boolean rectangleWasSelected)
void
setRectSelectOriginCorner(java.awt.Point rectSelectOriginCorner)
void
setRectSelectTerminalCorner(java.awt.Point rectSelectTerminalCorner)
void
setScorePainter(ScorePainter scorePainter)
void
setTranslationJustChanged(boolean translationJustChanged)
void
setZoom(double zoom)
ZoomListener interfaceMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.awt.image.ImageObserver
imageUpdate
Methods inherited from interface com.didkovsky.portview.PVCanvas
setCanvasSize
Methods inherited from interface com.didkovsky.portview.PVComponent
addKeyListener, getBackground, getBounds, getLocation, getParent, isEnabled, removeKeyListener, setBackground, setEnabled, setLocation
Methods inherited from interface com.softsynth.jmsl.score.ScoreCanvas
updateSize
-
Field Details
-
NO_CURSOR
public static final int NO_CURSOR- See Also:
- Constant Field Values
-
NO_RECTANGLE
public static final int NO_RECTANGLE- See Also:
- Constant Field Values
-
-
Constructor Details
-
ScoreCanvasAdapter
public ScoreCanvasAdapter()
-
-
Method Details
-
build
public void build(int w, int h)- Specified by:
build
in interfaceScoreCanvas
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent ev)KeyListener interface- Specified by:
keyPressed
in interfacejava.awt.event.KeyListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent ev)KeyListener interface- Specified by:
keyReleased
in interfacejava.awt.event.KeyListener
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent ev)KeyListener interface- Specified by:
keyTyped
in interfacejava.awt.event.KeyListener
-
handlePrint
- Specified by:
handlePrint
in interfaceScoreCanvas
-
getWidth
public int getWidth()- Specified by:
getWidth
in interfaceScoreCanvas
-
getHeight
public int getHeight()- Specified by:
getHeight
in interfaceScoreCanvas
-
addScoreCanvasListener
- Specified by:
addScoreCanvasListener
in interfaceScoreCanvas
-
removeScoreCanvasListener
- Specified by:
removeScoreCanvasListener
in interfaceScoreCanvas
-
removeAllScoreCanvasListeners
public void removeAllScoreCanvasListeners()- Specified by:
removeAllScoreCanvasListeners
in interfaceScoreCanvas
-
notifyReady
public void notifyReady()- Specified by:
notifyReady
in interfaceScoreCanvas
-
handleMouseClick
public void handleMouseClick(java.awt.event.MouseEvent ev) -
handleMouseDrag
public void handleMouseDrag(int x, int y, java.awt.event.MouseEvent ev) -
handleMousePressed
public void handleMousePressed(java.awt.event.MouseEvent ev) -
handleMouseReleased
public void handleMouseReleased(java.awt.event.MouseEvent ev) -
getRenderGraphics
public abstract java.awt.Graphics getRenderGraphics()- Specified by:
getRenderGraphics
in interfaceScoreCanvas
-
notify
public void notify(int code)Used to call back from listener- Specified by:
notify
in interfaceScoreCanvas
-
setCursorLocation
public void setCursorLocation(java.awt.Point p1, java.awt.Point p2)After notifying listener where the mouse was pressed, listener may respond by telling the cursor where to draw itself according to the context of what is being drawn (ie between two notes, drawn to the height of the staff - stuff that's unknown to the canvas) -
main
public static void main(java.lang.String[] args) -
setZoom
public void setZoom(double zoom)ZoomListener interface- Specified by:
setZoom
in interfaceZoomListener
-
editStateChanged
EditStateListener interface. Does nothing as of 20080629 (used to change static staff active track index- Specified by:
editStateChanged
in interfaceEditStateListener
-
getComponent
public java.awt.Component getComponent()- Specified by:
getComponent
in interfacePVComponent
- Returns:
- component upon which Score is rendered (Canvas for AWT, JPanel for Swing)
-
getGraphics
public java.awt.Graphics getGraphics()- Specified by:
getGraphics
in interfacePVCanvas
- Specified by:
getGraphics
in interfaceScoreCanvas
- Returns:
- component.getGraphics()
- See Also:
ScoreCanvas.getGraphics()
-
repaint
public void repaint()component.repaint();- Specified by:
repaint
in interfacePVCanvas
- See Also:
PVCanvas.repaint()
-
getCursorNote
- Returns:
- Returns the cursorNote.
-
setCursorNote
- Parameters:
cursorNote
- The cursorNote to set.
-
isCursorWasPlaced
public boolean isCursorWasPlaced()- Returns:
- Returns the cursorWasPlaced.
-
setCursorWasPlaced
public void setCursorWasPlaced(boolean cursorWasPlaced)- Parameters:
cursorWasPlaced
- The cursorWasPlaced to set.
-
isRectangleInProgress
public boolean isRectangleInProgress()- Returns:
- Returns the rectangleInProgress.
-
setRectangleInProgress
public void setRectangleInProgress(boolean rectangleInProgress)- Parameters:
rectangleInProgress
- The rectangleInProgress to set.
-
isRectangleWasSelected
public boolean isRectangleWasSelected()- Returns:
- Returns the rectangleWasSelected.
-
setRectangleWasSelected
public void setRectangleWasSelected(boolean rectangleWasSelected)- Parameters:
rectangleWasSelected
- The rectangleWasSelected to set.
-
getRectSelectOriginCorner
public java.awt.Point getRectSelectOriginCorner()- Returns:
- Returns the rectSelectOriginCorner.
-
setRectSelectOriginCorner
public void setRectSelectOriginCorner(java.awt.Point rectSelectOriginCorner)- Parameters:
rectSelectOriginCorner
- The rectSelectOriginCorner to set.
-
getRectSelectTerminalCorner
public java.awt.Point getRectSelectTerminalCorner()- Returns:
- Returns the rectSelectTerminalCorner.
-
setRectSelectTerminalCorner
public void setRectSelectTerminalCorner(java.awt.Point rectSelectTerminalCorner)- Parameters:
rectSelectTerminalCorner
- The rectSelectTerminalCorner to set.
-
isDrawIt
public boolean isDrawIt()- Returns:
- Returns the drawIt.
-
setDrawIt
public void setDrawIt(boolean drawIt)- Parameters:
drawIt
- The drawIt to set.
-
getCursorLocationOrigin
public java.awt.Point getCursorLocationOrigin()- Returns:
- Returns the cursorLocationOrigin.
-
setCursorLocationOrigin
public void setCursorLocationOrigin(java.awt.Point cursorLocationOrigin)- Parameters:
cursorLocationOrigin
- The cursorLocationOrigin to set.
-
getCursorLocationTerminus
public java.awt.Point getCursorLocationTerminus()- Returns:
- Returns the cursorLocationTerminus.
-
setCursorLocationTerminus
public void setCursorLocationTerminus(java.awt.Point cursorLocationTerminus)- Parameters:
cursorLocationTerminus
- The cursorLocationTerminus to set.
-
isTranslationJustChanged
public boolean isTranslationJustChanged()- Returns:
- Returns the translationJustChanged.
-
setTranslationJustChanged
public void setTranslationJustChanged(boolean translationJustChanged)- Parameters:
translationJustChanged
- The translationJustChanged to set.
-
setScorePainter
- Specified by:
setScorePainter
in interfaceScoreCanvas
- Parameters:
scorePainter
- The scorePainter to set.
-
getScorePainter
- Returns:
- Returns the scorePainter.
-
setFont
public void setFont(java.awt.Font font)- Specified by:
setFont
in interfacePVComponent
-
getFont
public java.awt.Font getFont()- Specified by:
getFont
in interfacePVComponent
-
getScoreCanvasListeners
public java.util.Vector getScoreCanvasListeners()
-