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);
}
}
}
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);
}
}
}
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();
}
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();
}
}
}
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);
}
}
Aggregations