|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softsynth.jmsl.view.PVPanelAdapter com.softsynth.jmsl.view.MusicShapeEditor
public class MusicShapeEditor
View MusicShapes and manipulate their data with the mouse.
NOTE: Since JMSL v103, MusicShapeEditor adds the getComponent() method. Use this to access
component panel for layout.
OLD: myContainer.add(myMusicShapeEditor); // broken since v103
NEW: myContainer.add(myMusicShapeEditor.getComponent);
// user panel example final MusicShapeEditor se2 = new MusicShapeEditor("I am another MusicShapeEditor", 600, 100, Color.cyan, new Font( "Times-Roman", Font.ITALIC, 16), DRAW_EDIT, 4.0, false, true); final PVButton launcherButton = JMSL.getViewFactory().createButton("Launch"); final PVButton finisherButton = JMSL.getViewFactory().createButton("Finish"); finisherButton.setEnabled(false); launcherButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { MusicShape shapeToLaunch = se2.getMusicShape(); System.out.println("Launching " + shapeToLaunch.getName()); shapeToLaunch.launch(JMSL.now()); launcherButton.setEnabled(false); finisherButton.setEnabled(true); } }); finisherButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { MusicShape shapeToLaunch = se2.getMusicShape(); System.out.println("Finishing " + shapeToLaunch.getName()); shapeToLaunch.finish(); launcherButton.setEnabled(true); finisherButton.setEnabled(false); } }); PVPanel myUserPanel = se2.getUserPanel(); myUserPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); myUserPanel.add(new PVLabelAdapter("My User Panel").getComponent()); myUserPanel.add(launcherButton.getComponent()); myUserPanel.add(finisherButton.getComponent());
RetrogradeMusicShapeEditorOperator
,
ScrambleMusicShapeEditorOperator
,
RandomizeMusicShapeEditorOperator
Field Summary | |
---|---|
static int |
DRAW_EDIT
|
static int |
RANGE_SELECT
|
static int |
SAFE
|
static int |
ZOOMING
|
Constructor Summary | |
---|---|
MusicShapeEditor()
Construct a new Music Shape Editor with default title, width, height, and color |
|
MusicShapeEditor(java.lang.String title)
Construct a new Music Shape Editor with default width, height, and color |
|
MusicShapeEditor(java.lang.String title,
int w,
int h)
Construct a new Music Shape Editor with default color |
|
MusicShapeEditor(java.lang.String title,
int w,
int h,
java.awt.Color color)
|
|
MusicShapeEditor(java.lang.String title,
int w,
int h,
java.awt.Color color,
java.awt.Font font,
double zoom,
boolean lockToInt,
boolean showGrid)
Construct a new MusicShape Editor with specified startup values. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ev)
|
void |
addMusicShape(MusicShape s)
Add a MusicShape to the MusicShape Editor's list of MusicShapes |
void |
addMusicShapeEditorOperator(MusicShapeEditorOperator op)
|
static int |
bufferSize()
|
void |
buildUserPanel()
override this in subclass. |
void |
clear()
Remove all MusicShapes from Editor |
static void |
clearBuffer()
remove all MusicShapes from static buffer |
void |
elementEditedOrYChanged(int index,
double value)
Respond to an element being edited |
static MusicShape |
fromBuffer(int n)
|
double |
getCeiling()
get the max threshold value set by the user, scaled to the values meaningful to currently displayed musicshape's currently dimension, clipped to current dimension's limits |
int |
getDimension()
|
int |
getEditMode()
|
double |
getFloor()
get the min threshold value set by the user, scaled to the values meaningful to currently displayed musicshape's currently dimension, clipped to current dimension's limits |
java.awt.Font |
getFont()
|
double |
getInvert()
get the inversion value set by the user (drawn in magenta), scaled to the values meaningful to currently displayed musicshape's currently displayed dimension. |
boolean |
getLockedToInt()
|
MusicShape |
getMusicShape()
|
int |
getRangeEndIndex()
|
int |
getRangeStartIndex()
|
PVPanel |
getUserPanel()
This is an empty PVPanel which is at the very bottom of the layout, below the musicshape and dimension choices. |
double |
getV1()
|
double |
getV2()
|
double |
getV3()
|
void |
itemStateChanged(java.awt.event.ItemEvent e)
|
static void |
main(java.lang.String[] args)
Test MusicShapeEditor by adding a couple of them to a PortView Frame (PortView Frames can be either AWT or Swing Source: |
void |
notifyPlayLurker(double playTime,
MusicJob list,
int index)
|
void |
refresh()
|
void |
removeMusicShapeRangeOperator(MusicShapeEditorOperator op)
|
void |
repackParent()
run up the parent component hierarchy until you get null or you get a Window, then pack() the Window |
void |
repaint()
|
void |
reset()
force recalculation of MusicShape drawing parameters. |
void |
setFont(java.awt.Font font)
|
void |
setRange(int startIndex,
int endIndex)
|
void |
setZoom(double zoom)
|
void |
showMessage(java.lang.String msg)
|
static void |
toBuffer(MusicShape s)
adds a copy of MusicShape to static buffer |
static void |
toBuffer(MusicShape s,
int n)
puts copy of MusicShape into nth position of buffer vector. |
void |
updateMinMaxLabels()
|
Methods inherited from class com.softsynth.jmsl.view.PVPanelAdapter |
---|
add, add, addKeyListener, equals, getBackground, getBounds, getComponent, getParent, hashCode, isEnabled, remove, removeAll, removeKeyListener, setBackground, setEnabled, setLayout, setLocation, setVisible, toString, validate |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SAFE
public static final int DRAW_EDIT
public static final int RANGE_SELECT
public static final int ZOOMING
Constructor Detail |
---|
public MusicShapeEditor(java.lang.String title, int w, int h, java.awt.Color color, java.awt.Font font, double zoom, boolean lockToInt, boolean showGrid)
public MusicShapeEditor(java.lang.String title, int w, int h, java.awt.Color color)
public MusicShapeEditor(java.lang.String title, int w, int h)
public MusicShapeEditor(java.lang.String title)
public MusicShapeEditor()
Method Detail |
---|
public static void toBuffer(MusicShape s)
public static MusicShape fromBuffer(int n)
java.lang.IndexOutOfBoundsException
- if n>= buffer.size()public static void toBuffer(MusicShape s, int n)
IndexOutpuBoundsException
- if n>= buffer.size()public static void clearBuffer()
public static int bufferSize()
public void repackParent()
public void notifyPlayLurker(double playTime, MusicJob list, int index)
notifyPlayLurker
in interface PlayLurker
public int getEditMode()
public void addMusicShapeEditorOperator(MusicShapeEditorOperator op)
public void removeMusicShapeRangeOperator(MusicShapeEditorOperator op)
public void addMusicShape(MusicShape s)
public MusicShape getMusicShape()
public void elementEditedOrYChanged(int index, double value)
public void clear()
public void repaint()
public void updateMinMaxLabels()
public void refresh()
public void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged
in interface java.awt.event.ItemListener
public void setZoom(double zoom)
public void actionPerformed(java.awt.event.ActionEvent ev)
actionPerformed
in interface java.awt.event.ActionListener
public boolean getLockedToInt()
public java.awt.Font getFont()
getFont
in interface PVComponent
getFont
in class PVPanelAdapter
public void setFont(java.awt.Font font)
setFont
in interface PVComponent
setFont
in class PVPanelAdapter
public PVPanel getUserPanel()
public void buildUserPanel()
public int getRangeStartIndex()
public int getRangeEndIndex()
public int getDimension()
public double getFloor()
public double getCeiling()
public double getInvert()
public double getV1()
public double getV2()
public double getV3()
public void reset()
public void setRange(int startIndex, int endIndex)
public static void main(java.lang.String[] args)
public static void main(String args[]) { boolean swing = false; if (swing) JMSL.setViewFactory(new com.didkovsky.portview.swing.ViewFactorySwing()); else JMSL.setViewFactory(new com.didkovsky.portview.awt.ViewFactoryAWT()); PVFrame f = new PVFrameAdapter("MusicShapeEditors are Panels for viewing/editing MusicShapes"); f.setFrameLayout(new GridLayout(0, 1, 10, 10)); f.setBackground(Color.black); MusicShapeEditor se1 = new MusicShapeEditor("I am a MusicShapeEditor", 600, 100); MusicShapeEditor se2 = new MusicShapeEditor("I am another MusicShapeEditor", 600, 100, Color.cyan); MusicShape s1 = new MusicShape(4); MusicShape s2 = new MusicShape(4); MusicShape s3 = new MusicShape(4); s1.prefab(); s2.prefab(); s3.prefab(); // s2.setDimensionName(2, "ampy"); se1.addMusicShape(s1); se1.addMusicShape(s2); se2.addMusicShape(s3); f.add(se1.getComponent()); f.add(se2.getComponent()); f.pack(); f.setVisible(true); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); }
public void showMessage(java.lang.String msg)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |