Search in sources :

Example 1 with PythonObject

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

the class PythonEditor method editScoreObject.

@Override
public final void editScoreObject(ScoreObject sObj) {
    this.pObj = null;
    if (sObj == null) {
        codeEditor.setText("null soundObject");
        codeEditor.getJEditorPane().setEnabled(false);
        processOnLoadCheckBox.setEnabled(false);
        return;
    }
    if (!(sObj instanceof PythonObject)) {
        codeEditor.setText("[ERROR] GenericEditor::editSoundObject - not instance " + "of GenericEditable");
        codeEditor.getJEditorPane().setEnabled(false);
        processOnLoadCheckBox.setEnabled(false);
        return;
    }
    PythonObject tempPObj = (PythonObject) sObj;
    codeEditor.setText(tempPObj.getText());
    codeEditor.getJEditorPane().setEnabled(true);
    codeEditor.getJEditorPane().setCaretPosition(0);
    processOnLoadCheckBox.setSelected(tempPObj.isOnLoadProcessable());
    processOnLoadCheckBox.setEnabled(true);
    undo.discardAllEdits();
    this.pObj = tempPObj;
}
Also used : PythonObject(blue.soundObject.PythonObject)

Example 2 with PythonObject

use of blue.soundObject.PythonObject 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

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