Search in sources :

Example 1 with BlueProject

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);
    }
}
Also used : BlueData(blue.BlueData) Frame(java.awt.Frame) BlueProject(blue.projects.BlueProject) File(java.io.File)

Example 2 with BlueProject

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);
}
Also used : BlueData(blue.BlueData) Frame(java.awt.Frame) NoteParseException(blue.soundObject.NoteParseException) BlueProject(blue.projects.BlueProject) File(java.io.File) PolyObject(blue.soundObject.PolyObject)

Example 3 with BlueProject

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();
        }
    }
}
Also used : BlueData(blue.BlueData) BlueProject(blue.projects.BlueProject) Document(electric.xml.Document)

Example 4 with BlueProject

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());
    }
}
Also used : BlueData(blue.BlueData) BlueProject(blue.projects.BlueProject)

Example 5 with BlueProject

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);
    });
}
Also used : BlueProjectManager(blue.projects.BlueProjectManager) BlueProject(blue.projects.BlueProject)

Aggregations

BlueProject (blue.projects.BlueProject)31 BlueData (blue.BlueData)18 File (java.io.File)6 BlueProjectManager (blue.projects.BlueProjectManager)4 Frame (java.awt.Frame)3 GlobalOrcSco (blue.GlobalOrcSco)2 DiskRenderSettings (blue.settings.DiskRenderSettings)2 ProjectProperties (blue.ProjectProperties)1 Tables (blue.Tables)1 ChannelList (blue.mixer.ChannelList)1 ProjectPluginEditor (blue.project.ProjectPluginEditor)1 Score (blue.score.Score)1 ScoreObject (blue.score.ScoreObject)1 AudioLayerChannelBinding (blue.score.layers.audio.ui.bindings.AudioLayerChannelBinding)1 AudioLayerGroupBinding (blue.score.layers.audio.ui.bindings.AudioLayerGroupBinding)1 Tempo (blue.score.tempo.Tempo)1 RenderTimeManager (blue.services.render.RenderTimeManager)1 NoteParseException (blue.soundObject.NoteParseException)1 PolyObject (blue.soundObject.PolyObject)1 OpcodeList (blue.udo.OpcodeList)1