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
Author:
Nick Didkovsky, copyright 2000 Nick Didkovsky
  • Field Details

  • Constructor Details

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

      public static boolean clefsSame​(Measure m1, Measure m2)
      Returns:
      true if corresponding staves of both measure have same clefs
    • 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 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