Search in sources :

Example 1 with ObjectBuilder

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

the class ObjectBuilderEditor method editScoreObject.

@Override
public void editScoreObject(ScoreObject sObj) {
    if (sObj == null || !(sObj instanceof ObjectBuilder)) {
        this.objectBuilder = null;
        System.err.println("[ERROR] ObjectBuilder::editSoundObject - " + "not instance of ObjectBuilder");
        return;
    }
    if (this.objectBuilder != null) {
        final ObjectBuilder temp = this.objectBuilder;
        BlueFX.runOnFXThread(() -> temp.commentProperty().unbind());
    }
    this.objectBuilder = (ObjectBuilder) sObj;
    PresetGroup presetGroup = objectBuilder.getPresetGroup();
    BSBGraphicInterface graphicInterface = objectBuilder.getGraphicInterface();
    this.interfaceEditor.editInterface(graphicInterface, presetGroup);
    this.codeEditor.editObjectBuilder(objectBuilder);
    BlueFX.runOnFXThread(() -> {
        commentTextArea.setText(this.objectBuilder.getComment());
        this.objectBuilder.commentProperty().bind(commentTextArea.textProperty());
    });
}
Also used : BSBGraphicInterface(blue.orchestra.blueSynthBuilder.BSBGraphicInterface) PresetGroup(blue.orchestra.blueSynthBuilder.PresetGroup) ObjectBuilder(blue.soundObject.ObjectBuilder)

Example 2 with ObjectBuilder

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

the class SoundObjectExportPane method jbInit.

private void jbInit() throws Exception {
    this.setLayout(new BorderLayout());
    this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    soundObjectListPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    categoryPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    cateogriesLabel.setText(BlueSystem.getString("common.categories"));
    categoryPanel.setLayout(new BorderLayout());
    this.add(namePasswordPanel, BorderLayout.NORTH);
    this.add(mainSplitPane, BorderLayout.CENTER);
    this.add(jPanel2, BorderLayout.SOUTH);
    descriptionText.setText(BlueSystem.getString("blueShare.enterDescription"));
    descriptionText.setLineWrap(true);
    descriptionScrollPane.setBorder(new TitledBorder(null, BlueSystem.getString("blueShare.instrDescription")));
    submitButton.setText(BlueSystem.getString("common.submit"));
    soundObjectListPanel.setLayout(new BorderLayout());
    iLabel.setText("SoundObjects from Library");
    // soundObjectLibraryTree.setSelectionModel(TreeSelectionModel.SINGLE_TREE_SELECTION);
    topSplitPane.add(soundObjectListPanel, JSplitPane.LEFT);
    soundObjectListPanel.add(soundObjectListScrollPane, BorderLayout.CENTER);
    soundObjectListPanel.add(iLabel, BorderLayout.NORTH);
    soundObjectListScrollPane.getViewport().add(soundObjectLibraryTree, null);
    descriptionScrollPane.getViewport().add(descriptionText, null);
    jPanel2.add(submitButton, null);
    topSplitPane.setDividerLocation(300);
    mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    mainSplitPane.add(topSplitPane, JSplitPane.TOP);
    mainSplitPane.add(descriptionScrollPane, JSplitPane.BOTTOM);
    topSplitPane.add(categoryPanel, JSplitPane.RIGHT);
    categoryPanel.add(cateogriesLabel, BorderLayout.NORTH);
    categoryPanel.add(categoryScrollPane, BorderLayout.CENTER);
    categoryScrollPane.getViewport().add(categoryTree, null);
    mainSplitPane.setDividerLocation(200);
    submitButton.addActionListener((ActionEvent e) -> {
        submitSoundObject();
    });
    soundObjectLibraryTree.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            TreePath path = soundObjectLibraryTree.getSelectionPath();
            if (path == null) {
                descriptionText.setText(SELECT_INSTR_TEXT);
                descriptionText.setEnabled(false);
                return;
            }
            Object userObj = path.getLastPathComponent();
            TreeItem<LibraryItem<SoundObject>> node = (TreeItem<LibraryItem<SoundObject>>) userObj;
            if (!node.isLeaf()) {
                descriptionText.setText(SELECT_INSTR_TEXT);
                descriptionText.setEnabled(false);
                return;
            }
            SoundObject instr = node.getValue().getValue();
            if (instr instanceof Sound) {
                descriptionText.setText(((Sound) instr).getComment());
            } else if (instr instanceof ObjectBuilder) {
                descriptionText.setText(((ObjectBuilder) instr).getComment());
            } else {
                descriptionText.setText("");
            }
            descriptionText.setEnabled(true);
        }
    });
}
Also used : MouseEvent(java.awt.event.MouseEvent) LibraryItem(blue.library.LibraryItem) TreeItem(javafx.scene.control.TreeItem) ActionEvent(java.awt.event.ActionEvent) MouseAdapter(java.awt.event.MouseAdapter) Sound(blue.soundObject.Sound) ObjectBuilder(blue.soundObject.ObjectBuilder) TitledBorder(javax.swing.border.TitledBorder) BorderLayout(java.awt.BorderLayout) TreePath(javax.swing.tree.TreePath) SoundObject(blue.soundObject.SoundObject) SoundObject(blue.soundObject.SoundObject)

Example 3 with ObjectBuilder

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

the class ObjectBuilderCodeEditor method main.

public static void main(String[] args) {
    GUI.setBlueLookAndFeel();
    ObjectBuilderCodeEditor codeEditor = new ObjectBuilderCodeEditor();
    codeEditor.editObjectBuilder(new ObjectBuilder());
    GUI.showComponentAsStandalone(codeEditor, "ObjectBuilder Code Editor", true);
}
Also used : ObjectBuilder(blue.soundObject.ObjectBuilder)

Example 4 with ObjectBuilder

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

the class ObjectBuilderEditor method main.

public static void main(String[] args) {
    GUI.setBlueLookAndFeel();
    ObjectBuilderEditor objBuilderEditor = new ObjectBuilderEditor();
    objBuilderEditor.editScoreObject(new ObjectBuilder());
    GUI.showComponentAsStandalone(objBuilderEditor, "ObjectBuilder Editor", true);
}
Also used : ObjectBuilder(blue.soundObject.ObjectBuilder)

Example 5 with ObjectBuilder

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

ObjectBuilder (blue.soundObject.ObjectBuilder)5 SoundObject (blue.soundObject.SoundObject)2 SoundLayer (blue.SoundLayer)1 LibraryItem (blue.library.LibraryItem)1 BSBGraphicInterface (blue.orchestra.blueSynthBuilder.BSBGraphicInterface)1 PresetGroup (blue.orchestra.blueSynthBuilder.PresetGroup)1 External (blue.soundObject.External)1 PythonObject (blue.soundObject.PythonObject)1 Sound (blue.soundObject.Sound)1 BorderLayout (java.awt.BorderLayout)1 Point (java.awt.Point)1 ActionEvent (java.awt.event.ActionEvent)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 TreeItem (javafx.scene.control.TreeItem)1 TitledBorder (javax.swing.border.TitledBorder)1 TreePath (javax.swing.tree.TreePath)1