Search in sources :

Example 6 with ScoreObject

use of blue.score.ScoreObject in project blue by kunstmusik.

the class SoundObjectPropertiesTopComponent method updateUseRepeatPoint.

private void updateUseRepeatPoint() {
    if (!(sObj instanceof ScoreObject)) {
        return;
    }
    SoundObject soundObj = (SoundObject) sObj;
    repeatePointText.setEnabled(useRepeatPoint.isSelected());
    if (!isUpdating) {
        double dur = -1.0f;
        if (useRepeatPoint.isSelected()) {
            dur = sObj.getSubjectiveDuration();
        }
        soundObj.setRepeatPoint(dur);
        repeatePointText.setText(Double.toString(dur));
    }
}
Also used : SoundObject(blue.soundObject.SoundObject) ScoreObject(blue.score.ScoreObject)

Example 7 with ScoreObject

use of blue.score.ScoreObject in project blue by kunstmusik.

the class SelectAllAfterAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    // FIXME -
    // if (p.y < 0 || p.y > comp.getHeight()) {
    // return;
    // }
    float pointTime = (float) p.x / timeState.getPixelSecond();
    List<ScoreObject> newSelected = new ArrayList<>();
    List<Layer> allLayers = scorePath.getAllLayers();
    for (Layer layer : allLayers) {
        if (layer instanceof ScoreObjectLayer) {
            ScoreObjectLayer<ScoreObject> sLayer = (ScoreObjectLayer) layer;
            for (ScoreObject scoreObject : sLayer) {
                if (scoreObject.getStartTime() >= pointTime) {
                    newSelected.add(scoreObject);
                }
            }
        }
    }
    ScoreController.getInstance().setSelectedScoreObjects(newSelected);
}
Also used : ScoreObjectLayer(blue.score.layers.ScoreObjectLayer) ScoreObject(blue.score.ScoreObject) ArrayList(java.util.ArrayList) Layer(blue.score.layers.Layer) ScoreObjectLayer(blue.score.layers.ScoreObjectLayer)

Example 8 with ScoreObject

use of blue.score.ScoreObject in project blue by kunstmusik.

the class SelectAllBeforeAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    // FIXME
    // JComponent comp = ((JComponent) lgPanel);
    // 
    // if (p.y < 0 || p.y > comp.getHeight()) {
    // return;
    // }
    float pointTime = (float) p.x / timeState.getPixelSecond();
    List<ScoreObject> newSelected = new ArrayList<>();
    List<Layer> allLayers = scorePath.getAllLayers();
    for (Layer layer : allLayers) {
        if (layer instanceof ScoreObjectLayer) {
            ScoreObjectLayer<ScoreObject> sLayer = (ScoreObjectLayer) layer;
            for (ScoreObject scoreObject : sLayer) {
                if (scoreObject.getStartTime() + scoreObject.getSubjectiveDuration() <= pointTime) {
                    newSelected.add(scoreObject);
                }
            }
        }
    }
    ScoreController.getInstance().setSelectedScoreObjects(newSelected);
}
Also used : ScoreObjectLayer(blue.score.layers.ScoreObjectLayer) ScoreObject(blue.score.ScoreObject) ArrayList(java.util.ArrayList) Layer(blue.score.layers.Layer) ScoreObjectLayer(blue.score.layers.ScoreObjectLayer)

Example 9 with ScoreObject

use of blue.score.ScoreObject in project blue by kunstmusik.

the class ScoreObjectEditorTopComponent method editScoreObject.

public void editScoreObject(ScoreObject sObj) {
    if (currentSoundObject == sObj) {
        return;
    }
    currentSoundObject = sObj;
    cardLayout.show(editPanel, "none");
    if (sObj == null) {
        // JOptionPane.showMessageDialog(null, "yo");
        return;
    }
    ScoreObject sObjToEdit = sObj;
    BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
    if (sObj instanceof Instance) {
        sObjToEdit = ((Instance) sObj).getSoundObject();
        this.setEditingLibraryObject(SelectionEvent.SELECTION_LIBRARY);
    } else if (data.getSoundObjectLibrary().contains(sObjToEdit)) {
        this.setEditingLibraryObject(SelectionEvent.SELECTION_LIBRARY);
    } else {
        this.setEditingLibraryObject(null);
    }
    ScoreObjectEditor editor = editors.get(sObjToEdit.getClass());
    if (editor == null) {
        for (Class c : sObjEditorMap.keySet()) {
            if (c.isAssignableFrom(sObjToEdit.getClass())) {
                LazyPlugin<ScoreObjectEditor> plugin = sObjEditorMap.get(c);
                editor = plugin.getInstance();
                editors.put(sObjToEdit.getClass(), editor);
                editPanel.add(editor, editor.getClass().getName());
                break;
            }
        }
    }
    if (editor == null) {
        DialogDisplayer.getDefault().notify(new NotifyDescriptor("Could not find editor for SoundObject of type: " + sObjToEdit.getClass().getCanonicalName(), "Error", NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.ERROR_MESSAGE, null, null));
        return;
    }
    editor.editScoreObject(sObjToEdit);
    cardLayout.show(editPanel, editor.getClass().getName());
// Logger.getLogger(ScoreObjectEditorTopComponent.class.getName()).fine("SoundObject Selected: " + className);;
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) BlueData(blue.BlueData) Instance(blue.soundObject.Instance) ScoreObject(blue.score.ScoreObject) ScoreObjectEditor(blue.soundObject.editor.ScoreObjectEditor)

Example 10 with ScoreObject

use of blue.score.ScoreObject in project blue by kunstmusik.

the class ScoreController method deleteScoreObjects.

public void deleteScoreObjects() {
    if (lookup == null || content == null) {
        return;
    }
    Collection<? extends ScoreObject> scoreObjects = ScoreController.getInstance().getSelectedScoreObjects();
    Score score = lookup.lookup(Score.class);
    if (score == null) {
        throw new RuntimeException("Score object not set in ScoreController: internal error");
    }
    if (scoreObjects.isEmpty()) {
        return;
    }
    List<Layer> layers = getScorePath().getAllLayers();
    RemoveScoreObjectEdit top = null;
    for (ScoreObject scoreObj : scoreObjects) {
        RemoveScoreObjectEdit edit = null;
        for (Layer layer : layers) {
            if (layer.remove(scoreObj)) {
                edit = new RemoveScoreObjectEdit((ScoreObjectLayer) layer, scoreObj);
                break;
            }
        }
        if (edit == null) {
            throw new RuntimeException("Error: Unable to find Layer to remove ScoreObject: Internal Error");
        }
        if (top == null) {
            top = edit;
        } else {
            top.appendNextEdit(edit);
        }
        content.remove(scoreObj);
    }
    BlueUndoManager.setUndoManager("score");
    BlueUndoManager.addEdit(top);
}
Also used : Score(blue.score.Score) ScoreObjectLayer(blue.score.layers.ScoreObjectLayer) ScoreObject(blue.score.ScoreObject) RemoveScoreObjectEdit(blue.ui.core.score.undo.RemoveScoreObjectEdit) Layer(blue.score.layers.Layer) ScoreObjectLayer(blue.score.layers.ScoreObjectLayer)

Aggregations

ScoreObject (blue.score.ScoreObject)39 ScoreObjectLayer (blue.score.layers.ScoreObjectLayer)13 Layer (blue.score.layers.Layer)12 ArrayList (java.util.ArrayList)9 Point (java.awt.Point)8 BlueData (blue.BlueData)6 SoundObject (blue.soundObject.SoundObject)6 ScorePath (blue.ui.core.score.ScorePath)6 SoundLayer (blue.SoundLayer)5 AlignEdit (blue.ui.core.score.undo.AlignEdit)5 Instance (blue.soundObject.Instance)4 PolyObject (blue.soundObject.PolyObject)4 ScoreController (blue.ui.core.score.ScoreController)4 AddScoreObjectEdit (blue.ui.core.score.undo.AddScoreObjectEdit)4 MoveScoreObjectsEdit (blue.ui.core.score.undo.MoveScoreObjectsEdit)4 SoundObjectLibrary (blue.SoundObjectLibrary)2 AlphaMarquee (blue.components.AlphaMarquee)2 Score (blue.score.Score)2 GenericScore (blue.soundObject.GenericScore)2 Test (org.junit.Test)2