Package com.softsynth.jmsl.score
Class ScoreLayoutManager
java.lang.Object
com.softsynth.jmsl.score.ScoreLayoutManager
- All Implemented Interfaces:
ZoomListener
public class ScoreLayoutManager extends java.lang.Object implements ZoomListener
Manage layout of measures on a rectangular drawing surface
JMSL Notation Project
JMSL Notation Project
- Author:
- Nick Didkovsky, copyright 2000 Nick Didkovsky
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Stringcopyright -
Constructor Summary
Constructors Constructor Description ScoreLayoutManager(Score score, int width, int height)ScoreLayoutManager(Score score, int width, int height, int measuresPerLine)Constructor gets passed the dimensions of the drawing canvas -
Method Summary
Modifier and Type Method Description voidcalcDrawableDimensions()Call this after changing width and height so layoutMeasures reflects changestatic doublecalcNoteYPos(double staffDrawingAnchorY, int noteLevel, double zoom)static booleanclefsSame(Measure m1, Measure m2)java.util.Enumerationelements()doublegetDrawableHeight()doublegetDrawableWidth()intgetHeight()java.util.VectorgetMeasures()intgetMeasuresPerLine()intgetWidth()booleangetWrap()doublegetZoom()drawing scale, 1.0=normal sizestatic booleankeySignaturesSame(Measure m1, Measure m2)intlayoutMeasures(int startingMeasure)Lay out as many measures as will fit horizontally and vertically.voidsetHeight(int h)voidsetWidth(int w)voidsetWrap(boolean f)Set flag to try to fit more than one system on a page or notvoidsetZoom(double z)drawing scale, 1.0=normal sizestatic booleantimeSigsSame(Measure m1, Measure m2)Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
copyright
public static final java.lang.String copyright- See Also:
- Constant Field Values
-
-
Constructor Details
-
ScoreLayoutManager
-
ScoreLayoutManager
Constructor gets passed the dimensions of the drawing canvas
-
-
Method Details
-
calcDrawableDimensions
public void calcDrawableDimensions()Call this after changing width and height so layoutMeasures reflects change -
elements
public java.util.Enumeration elements()- Returns:
- Enumeration of all Notes in this layout
-
getWrap
public boolean getWrap()- Returns:
- wrap flag
-
setWrap
public void setWrap(boolean f)Set flag to try to fit more than one system on a page or not -
getMeasures
public java.util.Vector getMeasures()- Returns:
- a Vector of Measures displayed in this layout
-
getMeasuresPerLine
public int getMeasuresPerLine() -
getWidth
public int getWidth()- Returns:
- width of drawing surface
-
setWidth
public void setWidth(int w) -
setHeight
public void setHeight(int h) -
getHeight
public int getHeight()- Returns:
- height of drawing surface
-
getDrawableWidth
public double getDrawableWidth()- Returns:
- width of drawing surface minus margins
-
getDrawableHeight
public double getDrawableHeight()- Returns:
- height of drawing surface minus margins
-
getZoom
public double getZoom()drawing scale, 1.0=normal size -
setZoom
public void setZoom(double z)drawing scale, 1.0=normal size- Specified by:
setZoomin interfaceZoomListener
-
calcNoteYPos
public static double calcNoteYPos(double staffDrawingAnchorY, int noteLevel, double zoom)- Returns:
- the y position of a note to be drawn at specified level, on a staff with specified drawing anchor, and zoom
-
clefsSame
- Returns:
- true if corresponding staves of both measure have same clefs
-
keySignaturesSame
-
timeSigsSame
-
layoutMeasures
public int layoutMeasures(int startingMeasure)Lay out as many measures as will fit horizontally and vertically.
"Lay out" simply means set the drawing anchors of all measures that will fit.
No drawing is actually done.- Returns:
- the number of measures that fit this layout.
- Throws:
JustificationException
-