use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.
the class BlueSynthBuilderEditor method editInstrument.
@Override
public void editInstrument(Instrument instr) {
if (instr == null) {
this.bsb = null;
return;
}
if (!(instr instanceof BlueSynthBuilder)) {
this.bsb = null;
return;
}
this.bsb = (BlueSynthBuilder) instr;
PresetGroup presetGroup = bsb.getPresetGroup();
BSBGraphicInterface graphicInterface = bsb.getGraphicInterface();
Platform.runLater(() -> interfaceEditor.editInterface(graphicInterface, presetGroup));
this.codeEditor.editBlueSynthBuilder(bsb);
this.udoPanel.editOpcodeList(bsb.getOpcodeList());
}
use of blue.orchestra.blueSynthBuilder.PresetGroup 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());
});
}
use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.
the class PresetPane method setPresetsMenu.
private void setPresetsMenu(PresetGroup pGroup, Menu parent) {
for (PresetGroup subGroup : pGroup.getSubGroups()) {
Menu menu = new Menu(subGroup.getPresetGroupName());
setPresetsMenu(subGroup, menu);
if (parent == null) {
rootMenu.getItems().add(menu);
} else {
parent.getItems().add(menu);
}
}
for (Preset preset : pGroup.getPresets()) {
MenuItem item = new MenuItem(preset.getPresetName());
item.setUserData(preset);
item.setOnAction(presetSelectedAction);
if (parent == null) {
rootMenu.getItems().add(item);
} else {
parent.getItems().add(item);
}
}
if (parent == null) {
rootMenu.getItems().add(new SeparatorMenuItem());
} else {
parent.getItems().add(new SeparatorMenuItem());
}
MenuItem addFolder = new MenuItem("Add Folder");
addFolder.setUserData(pGroup);
addFolder.setOnAction(addFolderAction);
MenuItem addPreset = new MenuItem("Add Preset");
addPreset.setUserData(pGroup);
addPreset.setOnAction(addPresetAction);
if (parent == null) {
MenuItem syncPresets = new MenuItem("Synchronize Presets");
syncPresets.setOnAction(e -> {
PresetsUtilities.synchronizePresets(getPresetGroup(), bsbInterface);
});
MenuItem managePresets = new MenuItem("Manage Presets");
managePresets.setOnAction(e -> {
PresetGroup[] retVal = new PresetGroup[1];
CountDownLatch latch = new CountDownLatch(1);
SwingUtilities.invokeLater(() -> {
try {
if (presetsManager == null) {
presetsManager = new PresetsManagerDialog(WindowManager.getDefault().getMainWindow());
}
retVal[0] = presetsManager.editPresetGroup(pGroup);
} finally {
latch.countDown();
}
});
try {
latch.await();
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
}
if (retVal[0] != null) {
pGroup.setPresets(retVal[0].getPresets());
pGroup.setSubGroups(retVal[0].getSubGroups());
updatePresetMenu();
Preset preset = pGroup.findPresetByUniqueId(pGroup.getCurrentPresetUniqueId());
if (preset == null) {
pGroup.setCurrentPresetUniqueId(null);
pGroup.setCurrentPresetModified(false);
}
updateCurrentPresetUI();
}
});
rootMenu.getItems().addAll(addFolder, addPreset, new SeparatorMenuItem(), syncPresets, managePresets);
} else {
parent.getItems().addAll(addFolder, addPreset);
}
}
use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.
the class TransferablePreset method dragGestureRecognized.
@Override
public void dragGestureRecognized(DragGestureEvent dge) {
TreePath path = sourceTree.getSelectionPath();
if ((path == null) || (path.getPathCount() <= 1)) {
// We can't really move the root node (or an empty selection).
return;
}
if (path.getLastPathComponent() instanceof Preset || path.getLastPathComponent() instanceof PresetGroup) {
oldNode = path.getLastPathComponent();
transferable = new TransferablePreset(oldNode);
source.startDrag(dge, null, transferable, this);
}
}
use of blue.orchestra.blueSynthBuilder.PresetGroup in project blue by kunstmusik.
the class PresetsTreeDropTarget method dragEnter.
@Override
public void dragEnter(DropTargetDragEvent dtde) {
Point p = dtde.getLocation();
DropTargetContext dtc = dtde.getDropTargetContext();
JTree tree = (JTree) dtc.getComponent();
TreePath path = tree.getClosestPathForLocation(p.x, p.y);
if (path.getLastPathComponent() instanceof PresetGroup) {
dtde.acceptDrag(dtde.getSourceActions());
} else {
dtde.rejectDrag();
}
}
Aggregations