com.softsynth.jmsl.score
Class ScoreLayoutManager

java.lang.Object
  extended by 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

Author:
Nick Didkovsky, copyright 2000 Nick Didkovsky

Field Summary
static double BOTTOM_MARGIN
           
static java.lang.String copyright
           
static double LEFT_MARGIN
           
static double RIGHT_MARGIN
           
static double TOP_MARGIN
           
 
Constructor Summary
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
 void calcDrawableDimensions()
          Call this after changing width and height so layoutMeasures reflects change
static int calcNoteYPos(int staffDrawingAnchorY, int noteLevel, double zoom)
           
static boolean clefsSame(Measure m1, Measure m2)
           
 java.util.Enumeration elements()
           
 double getDrawableHeight()
           
 double getDrawableWidth()
           
 int getHeight()
           
 java.util.Vector getMeasures()
           
 int getMeasuresPerLine()
           
 int getWidth()
           
 boolean getWrap()
           
 double getZoom()
          drawing scale, 1.0=normal size
static boolean keySignaturesSame(Measure m1, Measure m2)
           
 int layoutMeasures(int startingMeasure)
          Lay out as many measures as will fit horizintally and vertically.
 void setHeight(int h)
           
 void setWidth(int w)
           
 void setWrap(boolean f)
          Set flag to try to fit more than one system on a page or not
 void setZoom(double z)
          drawing scale, 1.0=normal size
static boolean timeSigsSame(Measure m1, Measure m2)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LEFT_MARGIN

public static final double LEFT_MARGIN
See Also:
Constant Field Values

RIGHT_MARGIN

public static final double RIGHT_MARGIN
See Also:
Constant Field Values

TOP_MARGIN

public static final double TOP_MARGIN
See Also:
Constant Field Values

BOTTOM_MARGIN

public static final double BOTTOM_MARGIN
See Also:
Constant Field Values

copyright

public static final java.lang.String copyright
See Also:
Constant Field Values
Constructor Detail

ScoreLayoutManager

public ScoreLayoutManager(Score score,
                          int width,
                          int height)

ScoreLayoutManager

public ScoreLayoutManager(Score score,
                          int width,
                          int height,
                          int measuresPerLine)
Constructor gets passed the dimensions of the drawing canvas

Method Detail

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:
setZoom in interface ZoomListener

calcNoteYPos

public static int calcNoteYPos(int 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

public static boolean clefsSame(Measure m1,
                                Measure m2)

keySignaturesSame

public static boolean keySignaturesSame(Measure m1,
                                        Measure m2)

timeSigsSame

public static boolean timeSigsSame(Measure m1,
                                   Measure m2)

layoutMeasures

public int layoutMeasures(int startingMeasure)
Lay out as many measures as will fit horizintally 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