Search in sources :

Example 1 with External

use of blue.soundObject.External in project blue by kunstmusik.

the class ConvertToObjectBuilderAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    SoundObject temp = soundObjects.iterator().next();
    int retVal = JOptionPane.showConfirmDialog(null, "This operation can not be undone.\nAre you sure?");
    if (retVal != JOptionPane.OK_OPTION) {
        return;
    }
    SoundLayer layer = (SoundLayer) scorePath.getGlobalLayerForY(p.y);
    ObjectBuilder objBuilder = new ObjectBuilder();
    if (temp instanceof PythonObject) {
        PythonObject tempPython = (PythonObject) temp;
        objBuilder.setName(tempPython.getName());
        objBuilder.setNoteProcessorChain(tempPython.getNoteProcessorChain());
        objBuilder.setTimeBehavior(tempPython.getTimeBehavior());
        objBuilder.setStartTime(tempPython.getStartTime());
        objBuilder.setSubjectiveDuration(tempPython.getSubjectiveDuration());
        objBuilder.setCode(tempPython.getText());
        objBuilder.setBackgroundColor(tempPython.getBackgroundColor());
    } else if (temp instanceof External) {
        External tempExt = (External) temp;
        objBuilder.setName(tempExt.getName());
        objBuilder.setNoteProcessorChain(tempExt.getNoteProcessorChain());
        objBuilder.setTimeBehavior(tempExt.getTimeBehavior());
        objBuilder.setStartTime(tempExt.getStartTime());
        objBuilder.setSubjectiveDuration(tempExt.getSubjectiveDuration());
        objBuilder.setCode(tempExt.getText());
        objBuilder.setCommandLine(tempExt.getCommandLine());
        objBuilder.setLanguageType(LanguageType.EXTERNAL);
        objBuilder.setBackgroundColor(tempExt.getBackgroundColor());
    } else {
        return;
    }
    layer.remove(temp);
    layer.add(objBuilder);
    ScoreController.getInstance().removeSelectedScoreObject(temp);
    ScoreController.getInstance().addSelectedScoreObject(objBuilder);
}
Also used : SoundObject(blue.soundObject.SoundObject) SoundLayer(blue.SoundLayer) External(blue.soundObject.External) ObjectBuilder(blue.soundObject.ObjectBuilder) Point(java.awt.Point) PythonObject(blue.soundObject.PythonObject)

Aggregations

SoundLayer (blue.SoundLayer)1 External (blue.soundObject.External)1 ObjectBuilder (blue.soundObject.ObjectBuilder)1 PythonObject (blue.soundObject.PythonObject)1 SoundObject (blue.soundObject.SoundObject)1 Point (java.awt.Point)1