Search in sources :

Example 1 with GeneralSettings

use of blue.settings.GeneralSettings in project blue by kunstmusik.

the class CommandlineRunner method playModeChanged.

@Override
public void playModeChanged(int playMode) {
    if (playMode == PlayModeListener.PLAY_MODE_STOP) {
        if (console.getLastExitValue() != 0) {
            final GeneralSettings generalSettings = GeneralSettings.getInstance();
            if (generalSettings.isCsoundErrorWarningEnabled()) {
                if (errorPanel == null) {
                    errorPanel = new JPanel(new BorderLayout());
                    errorPanel.add(new JLabel("<html>There was an error in " + "running Csound.<br>" + "Please view the Csound Output Dialog for " + "more information.<br><br></html>"), BorderLayout.CENTER);
                    disableMessagesBox = new JCheckBox("Disable Error Message Dialog");
                    errorPanel.add(disableMessagesBox, BorderLayout.SOUTH);
                }
                disableMessagesBox.setSelected(false);
                SwingUtilities.invokeLater(() -> {
                    JOptionPane.showMessageDialog(null, errorPanel, "Csound Error", JOptionPane.ERROR_MESSAGE);
                    if (disableMessagesBox.isSelected()) {
                        generalSettings.setCsoundErrorWarningEnabled(false);
                        generalSettings.save();
                    }
                });
            }
            notifyPlayModeListeners(playMode);
            return;
        }
        if (data.isLoopRendering() && !shouldStop) {
            try {
                render();
            } catch (SoundObjectException e) {
                Exceptions.printStackTrace(e);
                // ExceptionDialog.showExceptionDialog(parent, e);
                notifyPlayModeListeners(PlayModeListener.PLAY_MODE_STOP);
            }
        } else {
            notifyPlayModeListeners(playMode);
        }
    } else {
        notifyPlayModeListeners(playMode);
    }
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JLabel(javax.swing.JLabel) SoundObjectException(blue.soundObject.SoundObjectException) GeneralSettings(blue.settings.GeneralSettings)

Aggregations

GeneralSettings (blue.settings.GeneralSettings)1 SoundObjectException (blue.soundObject.SoundObjectException)1 BorderLayout (java.awt.BorderLayout)1 JCheckBox (javax.swing.JCheckBox)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1