use of blue.projects.BlueProject in project blue by kunstmusik.
the class ImportOrcScoAction method importOrcSco.
public void importOrcSco() {
final Frame mainWindow = WindowManager.getDefault().getMainWindow();
List<File> rValue = FileChooserManager.getDefault().showOpenDialog(orcFilter, mainWindow);
if (rValue.isEmpty()) {
StatusDisplayer.getDefault().setStatusText(BlueSystem.getString("message.actionCancelled"));
return;
}
File orcFile = rValue.get(0);
rValue = FileChooserManager.getDefault().showOpenDialog(scoFilter, mainWindow);
if (rValue.isEmpty()) {
StatusDisplayer.getDefault().setStatusText(BlueSystem.getString("message.actionCancelled"));
return;
}
File scoFile = rValue.get(0);
final Object[] values = { BlueSystem.getString("csd.import1"), BlueSystem.getString("csd.import2"), BlueSystem.getString("csd.import3") };
Object selectedValue = JOptionPane.showInputDialog(mainWindow, BlueSystem.getString("csd.importMethod.message"), BlueSystem.getString("csd.importMethod.title"), JOptionPane.INFORMATION_MESSAGE, null, values, values[0]);
if (selectedValue == null) {
return;
}
int modeType = 0;
for (int i = 0; i < values.length; i++) {
if (selectedValue == values[i]) {
modeType = i;
break;
}
}
BlueData tempData = CSDUtility.convertOrcScoToBlue(orcFile, scoFile, modeType);
if (tempData != null) {
BlueProject project = new BlueProject(tempData, null);
BlueProjectManager.getInstance().setCurrentProject(project);
} else {
JOptionPane.showMessageDialog(mainWindow, BlueSystem.getString("message.file.couldNotImport"), BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
}
}
use of blue.projects.BlueProject in project blue by kunstmusik.
the class ImportMidiAction method importMidiFile.
public void importMidiFile() {
final Frame mainWindow = WindowManager.getDefault().getMainWindow();
List<File> rValue = FileChooserManager.getDefault().showOpenDialog(this.getClass(), mainWindow);
if (rValue.size() == 0) {
StatusDisplayer.getDefault().setStatusText(BlueSystem.getString("message.actionCancelled"));
return;
}
File midiFile = rValue.get(0);
BlueData tempData = new BlueData();
try {
PolyObject pObj = MidiImportUtilities.convertMidiFile(mainWindow, midiFile);
if (pObj == null) {
JOptionPane.showMessageDialog(mainWindow, BlueSystem.getString("message.file.couldNotImport"), BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
tempData.getScore().clear();
tempData.getScore().add(pObj);
} catch (NoteParseException e) {
JOptionPane.showMessageDialog(mainWindow, BlueSystem.getString("message.file.couldNotImport"), BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
BlueProject project = new BlueProject(tempData, null);
BlueProjectManager.getInstance().setCurrentProject(project);
}
use of blue.projects.BlueProject in project blue by kunstmusik.
the class RevertAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent actionEvent) {
BlueProject project = BlueProjectManager.getInstance().getCurrentProject();
if (project == null || project.getDataFile() == null) {
return;
}
int retVal = JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), BlueSystem.getString("message.file.revert.text"), BlueSystem.getString("message.file.revert.title"), JOptionPane.YES_NO_CANCEL_OPTION);
if (retVal == JOptionPane.YES_OPTION) {
try {
String text = TextUtilities.getTextFromFile(project.getDataFile());
BlueData tempData;
if (text.startsWith("<blueData")) {
Document d = new Document(text);
tempData = BlueData.loadFromXML(d.getElement("blueData"));
} else {
return;
}
project.setData(tempData);
BlueProjectManager.getInstance().setCurrentProject(project);
} catch (Exception e) {
e.printStackTrace();
}
}
}
use of blue.projects.BlueProject in project blue by kunstmusik.
the class SoundObjectLibraryTopComponent method reinitialize.
public void reinitialize() {
BlueProject project = BlueProjectManager.getInstance().getCurrentProject();
if (project != null) {
BlueData currentData = project.getData();
setSoundObjectLibrary(currentData.getSoundObjectLibrary());
}
}
use of blue.projects.BlueProject in project blue by kunstmusik.
the class Installer method setWindowTitle.
private void setWindowTitle() {
BlueProjectManager bpm = BlueProjectManager.getInstance();
BlueProject proj = bpm.getCurrentProject();
String title = "blue - " + BlueConstants.getVersion();
if (proj != null) {
title += " - ";
if (proj.getDataFile() == null) {
title += "New Project";
} else {
title += proj.getDataFile().getName();
}
}
final String t = title;
SwingUtilities.invokeLater(() -> {
WindowManager.getDefault().getMainWindow().setTitle(t);
});
}
Aggregations