X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=MooGUI.java;h=3ecb3081ec6f2aeb9e5c99fc943dca2ca42a00cf;hb=1d2d2bfd14ba0addab97692527d4414d3a87e13d;hp=77883c9c2b3d271e602a96d27f7a5337ce709da9;hpb=a8b0b5e27d120df964c5b6d8554a6207951b00d0;p=moosique.git diff --git a/MooGUI.java b/MooGUI.java index 77883c9..3ecb308 100644 --- a/MooGUI.java +++ b/MooGUI.java @@ -3,6 +3,7 @@ import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; +import java.io.*; /** * Moosique's graphical user interface. @@ -27,8 +28,9 @@ public class MooGUI extends JFrame { * Creates the GUI. * @param seq The sequence that the program is operating on. */ - public MooGUI(Sequence seq) { + public MooGUI(Sequence seq, File file) { super("Moosique"); + if (file != null) setTitle("Moosique - " + file.getName()); this.seq = seq; advanceStatus(); @@ -76,8 +78,8 @@ public class MooGUI extends JFrame { } }}; am.put("Play", playAction); - am.put("Change octave up", createOctaveAction(1)); - am.put("Change octave down", createOctaveAction(-1)); + am.put("Change octave up", createOctaveAction(true)); + am.put("Change octave down", createOctaveAction(false)); InputMap im = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); KeyStroke playKey = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0); @@ -93,7 +95,7 @@ public class MooGUI extends JFrame { pack(); setIconImage(logo); Dimension bounds = Toolkit.getDefaultToolkit().getScreenSize(); - setSize(bounds.width,bounds.height - 40); + setSize(bounds.width,bounds.height - 28); setLocation(0, 0); setBackground(Color.white); advanceStatus(); @@ -143,12 +145,12 @@ public class MooGUI extends JFrame { /** * Creates an action for a specific octave. - * @param octave The octave we want an action for. + * @param increase true for increase, false for decrease */ - private Action createOctaveAction(final int octave) { + private Action createOctaveAction(final boolean increase) { Action octaveAction = new AbstractAction() { public void actionPerformed(ActionEvent ae) { - MooKeyboard.setOctave(octave); + MooKeyboard.setRelativeOctave(increase); }}; return octaveAction; }