Search in sources :

Example 31 with ScoreObject

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

the class MoveScoreObjectsEdit method undo.

@Override
public void undo() throws CannotUndoException {
    super.undo();
    for (int i = 0; i < scoreObjects.length; i++) {
        ScoreObject scoreObj = scoreObjects[i];
        if (initialStartTimes != null) {
            scoreObj.setStartTime(this.initialStartTimes[i]);
        }
        if (startLayers != null && endLayers != null && startLayers[i] != endLayers[i]) {
            endLayers[i].remove(scoreObj);
            startLayers[i].add(scoreObj);
        }
    }
}
Also used : ScoreObject(blue.score.ScoreObject)

Example 32 with ScoreObject

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

the class MoveScoreObjectsEdit method redo.

@Override
public void redo() throws CannotRedoException {
    super.redo();
    for (int i = 0; i < scoreObjects.length; i++) {
        ScoreObject scoreObj = scoreObjects[i];
        if (endingStartTimes != null) {
            scoreObj.setStartTime(this.endingStartTimes[i]);
        }
        if (startLayers != null && endLayers != null && startLayers[i] != endLayers[i]) {
            startLayers[i].remove(scoreObj);
            endLayers[i].add(scoreObj);
        }
    }
}
Also used : ScoreObject(blue.score.ScoreObject)

Example 33 with ScoreObject

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

the class ScoreTopComponent method reinitialize.

public synchronized void reinitialize() {
    BlueProject project = BlueProjectManager.getInstance().getCurrentProject();
    BlueData currentData = null;
    if (project != null) {
        currentData = project.getData();
    }
    if (this.currentTimeState != null) {
        this.currentTimeState.removePropertyChangeListener(this);
    }
    if (this.data != null) {
        this.data.removePropertyChangeListener(this);
        data.getScore().removeListener(this);
        content.remove(data.getScore());
    }
    this.clearAll();
    this.data = currentData;
    AutomationManager.getInstance().setData(this.data);
    for (ScoreObject scoreObj : getLookup().lookupAll(ScoreObject.class)) {
        content.remove(scoreObj);
    }
    if (data != null) {
        Tempo tempo = data.getScore().getTempo();
        tempoControlPanel.setTempo(tempo);
        tempoEditor.setTempo(tempo);
        timeBar.setData(data);
        this.data.addPropertyChangeListener(this);
        Score score = data.getScore();
        score.addListener(this);
        ScoreController.getInstance().setScore(score);
        content.add(score);
    } else {
    }
    layerHeaderPanel.repaint();
}
Also used : BlueData(blue.BlueData) Score(blue.score.Score) Tempo(blue.score.tempo.Tempo) BlueProject(blue.projects.BlueProject) ScoreObject(blue.score.ScoreObject)

Example 34 with ScoreObject

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

the class ScoreObjectSelectionListener method mousePressed.

@Override
public void mousePressed(MouseEvent e) {
    if (ModeManager.getInstance().getMode() != ScoreMode.SCORE) {
        return;
    }
    if (currentScoreObjectView == null) {
        return;
    }
    // consume as a click was done on a score object
    ScoreObject scoreObj = currentScoreObjectView.getScoreObject();
    Collection<? extends ScoreObject> selectedScoreObjects = scoreTC.getLookup().lookupAll(ScoreObject.class);
    if (e.isShiftDown()) {
        if (selectedScoreObjects.contains(scoreObj)) {
            ScoreController.getInstance().removeSelectedScoreObject(scoreObj);
        } else {
            ScoreController.getInstance().addSelectedScoreObject(scoreObj);
        }
        e.consume();
    } else {
        if (!selectedScoreObjects.contains(scoreObj)) {
            ScoreController.getInstance().setSelectedScoreObjects(Collections.singleton(scoreObj));
            e.consume();
        } else if (e.getClickCount() == 2) {
            editScoreObject(selectedScoreObjects, scoreObj);
            e.consume();
        }
    }
}
Also used : ScoreObject(blue.score.ScoreObject)

Example 35 with ScoreObject

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

the class ScoreController method copyScoreObjects.

public void copyScoreObjects() {
    if (lookup == null || content == null) {
        return;
    }
    Collection<? extends ScoreObject> scoreObjects = lookup.lookupAll(ScoreObject.class);
    if (scoreObjects.isEmpty()) {
        return;
    }
    buffer.clear();
    List<Layer> layers = getScorePath().getAllLayers();
    int layerMin = Integer.MAX_VALUE;
    List<Integer> indexes = new ArrayList<>();
    for (ScoreObject scoreObject : scoreObjects) {
        Layer foundLayer = null;
        for (Layer layer : layers) {
            if (layer.contains(scoreObject)) {
                foundLayer = layer;
                break;
            }
        }
        if (foundLayer == null) {
            throw new RuntimeException("Error: Trying to copy a ScoreObject without a layer: Internal Error");
        }
        int layerIndex = layers.indexOf(foundLayer);
        buffer.scoreObjects.add(scoreObject);
        indexes.add(layerIndex);
        if (layerIndex < layerMin) {
            layerMin = layerIndex;
        }
    }
    for (Integer layerIndex : indexes) {
        buffer.layerIndexes.add(layerIndex - layerMin);
    }
}
Also used : ArrayList(java.util.ArrayList) ScoreObject(blue.score.ScoreObject) 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