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