use of blue.udo.UserDefinedOpcode in project blue by kunstmusik.
the class OpcodeListEditPanel method addUDO.
/**
*/
protected void addUDO() {
if (opcodeList != null) {
UserDefinedOpcode udo = new UserDefinedOpcode();
udo.opcodeName += opcodeList.size();
opcodeList.addOpcode(udo);
}
}
use of blue.udo.UserDefinedOpcode in project blue by kunstmusik.
the class OpcodeListEditPanel method exportBlueUdo.
protected void exportBlueUdo() {
UserDefinedOpcode[] selected = getSelectedUDOs();
if (selected == null || selected.length != 1) {
return;
}
File retVal = FileChooserManager.getDefault().showSaveDialog(EXPORT_BLUE_UDO_DIALOG, SwingUtilities.getRoot(OpcodeListEditPanel.this));
if (retVal != null) {
File f = retVal;
if (f.exists()) {
int overWrite = JOptionPane.showConfirmDialog(SwingUtilities.getRoot(OpcodeListEditPanel.this), "Please confirm you would like to overwrite this file.");
if (overWrite != JOptionPane.OK_OPTION) {
return;
}
}
Element node = selected[0].saveAsXML();
try (PrintWriter out = new PrintWriter(new FileWriter(f))) {
out.print(node.toString());
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
use of blue.udo.UserDefinedOpcode in project blue by kunstmusik.
the class OpcodeListEditPanel method handlePaste.
private void handlePaste(Object obj) {
if (obj instanceof UserDefinedOpcode) {
opcodeList.addOpcode(new UserDefinedOpcode((UserDefinedOpcode) obj));
} else if (obj instanceof UserDefinedOpcode[]) {
UserDefinedOpcode[] udos = (UserDefinedOpcode[]) obj;
UserDefinedOpcode[] copies = new UserDefinedOpcode[udos.length];
for (int i = 0; i < udos.length; i++) {
copies[i] = new UserDefinedOpcode(udos[i]);
}
opcodeList.addOpcodes(copies);
} else if (obj instanceof UDOCategory) {
UDOCategory cat = (UDOCategory) obj;
ArrayList<UserDefinedOpcode> udos = cat.getAllUserDefinedOpcodes();
UserDefinedOpcode[] copies = new UserDefinedOpcode[udos.size()];
for (int i = 0; i < udos.size(); i++) {
copies[i] = new UserDefinedOpcode(udos.get(i));
}
opcodeList.addOpcodes(copies);
}
}
use of blue.udo.UserDefinedOpcode in project blue by kunstmusik.
the class OpcodeListEditPanel method exportCsoundUdo.
protected void exportCsoundUdo() {
UserDefinedOpcode[] selected = getSelectedUDOs();
if (selected == null || selected.length != 1) {
return;
}
File retVal = FileChooserManager.getDefault().showSaveDialog(EXPORT_CSOUND_UDO_DIALOG, SwingUtilities.getRoot(OpcodeListEditPanel.this));
if (retVal != null) {
File f = retVal;
if (f.exists()) {
int overWrite = JOptionPane.showConfirmDialog(SwingUtilities.getRoot(OpcodeListEditPanel.this), "Please confirm you would like to overwrite this file.");
if (overWrite != JOptionPane.OK_OPTION) {
return;
}
}
String udoText = selected[0].generateCode();
try (PrintWriter out = new PrintWriter(new FileWriter(f))) {
out.print(udoText);
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
use of blue.udo.UserDefinedOpcode in project blue by kunstmusik.
the class UDOTreePopup method addUDO.
private void addUDO() {
UserDefinedOpcode newUDO = new UserDefinedOpcode();
UDOCategory currentCategory = (UDOCategory) userObj;
instrGUI.iLibrary.addUDO(currentCategory, newUDO);
/*
* BlueUndoManager.setUndoManager("orchestra"); BlueUndoManager.addEdit(
* new AddEdit(orchTableModel, clone, new Integer(iNum)));
*/
}
Aggregations