*/
public static class VersionInfo {
public static final String NAME = "MIDI Chord Helper";
- public static final String VERSION = "Ver.20170409.1";
+ public static final String VERSION = "Ver.20170410.1";
public static final String COPYRIGHT = "Copyright (C) 2004-2017";
public static final String AUTHER = "@きよし - Akiyoshi Kamide";
public static final String URL = "http://www.yk.rim.or.jp/~kamide/music/chordhelper/";
VersionInfo.NAME, VersionInfo.VERSION,
VersionInfo.COPYRIGHT ,VersionInfo.AUTHER, VersionInfo.URL);
}
- /**
- * ボタンの余白を詰めたいときに setMargin() の引数に指定するインセット
- */
+ /** ボタンの余白を詰めたいときに setMargin() の引数に指定するインセット */
public static final Insets ZERO_INSETS = new Insets(0,0,0,0);
- // GUIコンポーネント(Javaアプリメインからの参照用)
+ // MIDIエディタダイアログ(Javaアプリメインからもアクセスできるようprivateにしていない)
MidiSequenceEditorDialog midiEditor;
- PlaylistTableModel playlistModel;
// GUIコンポーネント(内部保存用)
+ private PlaylistTableModel playlistModel;
private MidiSequencerModel sequencerModel;
private ChordMatrix chordMatrix;
private JPanel keyboardSequencerPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
+import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.event.TableModelEvent;
updateFilename(((PlaylistTableModel)event.getSource()).getSequencerModel());
}
public AppletFrame(ChordHelperApplet applet, List<File> fileList) {
- add( applet, BorderLayout.CENTER );
- add( status_, BorderLayout.SOUTH );
+ add(applet, BorderLayout.CENTER);
+ add(status_, BorderLayout.SOUTH);
applet.setStub(this);
applet.init();
setIconImage(applet.getIconImage());
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent event) {
- if( ! applet.isModified() || applet.midiEditor.confirm(
- "MIDI file not saved, exit anyway ?\n"+
- "保存されていないMIDIファイルがありますが、終了してよろしいですか?"
- )) { applet.destroy(); System.exit(0); }
+ if( applet.isModified() && ! confirmBeforeExit() ) return;
+ applet.destroy();
+ System.exit(0);
}
});
- applet.playlistModel.getSequencerModel().addChangeListener(e->updateFilename((MidiSequencerModel)e.getSource()));
- applet.playlistModel.addTableModelListener(e->updateFilename(e));
- updateFilename(applet.playlistModel.getSequencerModel());
+ PlaylistTableModel playlistModel = applet.midiEditor.sequenceListTable.getModel();
+ playlistModel.getSequencerModel().addChangeListener(e->updateFilename((MidiSequencerModel)e.getSource()));
+ playlistModel.addTableModelListener(e->updateFilename(e));
+ updateFilename(playlistModel.getSequencerModel());
setVisible(true);
applet.start();
applet.midiEditor.play(fileList);
}
+ private boolean confirmBeforeExit() {
+ String message = "MIDI file not saved, exit anyway ?\n"+
+ "MIDIファイルが保存されていません。終了してよろしいですか?";
+ return JOptionPane.showConfirmDialog(
+ null, message, ChordHelperApplet.VersionInfo.NAME,
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION ;
+ }
@Override
public boolean isActive() { return true; }
@Override
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
-import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
* 新しいMIDIシーケンスを生成するダイアログ
*/
public class NewSequenceDialog extends JDialog {
- private static final Insets ZERO_INSETS = new Insets(0,0,0,0);
private static final Integer[] PPQList = {
48,60,80,96,120,160,192,240,320,384,480,960
};
add(measureSelecter);
}});
add(new JButton("Randomize (Tempo, Time signature, Chord progression)") {{
- setMargin(ZERO_INSETS);
+ setMargin(ChordHelperApplet.ZERO_INSETS);
addActionListener(e->setRandomChordProgression(measureSelecter.getMeasureDuration()));
}});
add(new JPanel() {{
add(new JLabel("Chord progression :"));
add(new JLabel("Transpose"));
add(new JButton(" + Up ") {{
- setMargin(ZERO_INSETS);
+ setMargin(ChordHelperApplet.ZERO_INSETS);
addActionListener(e->{
ChordProgression cp = createChordProgression();
cp.transpose(1);
});
}});
add(new JButton(" - Down ") {{
- setMargin(ZERO_INSETS);
+ setMargin(ChordHelperApplet.ZERO_INSETS);
addActionListener(e->{
ChordProgression cp = createChordProgression();
cp.transpose(-1);
});
}});
add(new JButton(" Enharmonic ") {{
- setMargin(ZERO_INSETS);
+ setMargin(ChordHelperApplet.ZERO_INSETS);
addActionListener(e->{
ChordProgression cp = createChordProgression();
cp.toggleEnharmonically();
});
}});
add(new JButton("Relative key") {{
- setMargin(ZERO_INSETS);
+ setMargin(ChordHelperApplet.ZERO_INSETS);
addActionListener(e->{
ChordProgression cp = createChordProgression();
cp.toggleKeyMajorMinor();
add(new JScrollPane(chordText));
add(new JPanel() {{
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
- add(new JButton(generateAction){{setMargin(ZERO_INSETS);}});
+ add(new JButton(generateAction){{
+ setMargin(ChordHelperApplet.ZERO_INSETS);
+ }});
}});
}});
add("Track", trackSpecPanel);