]> ruin.nu Git - moosique.git/blobdiff - MooGUI.java
Fixed accessors, encoders and decoders for tempo and time signature.
[moosique.git] / MooGUI.java
index 77883c9c2b3d271e602a96d27f7a5337ce709da9..3ecb3081ec6f2aeb9e5c99fc943dca2ca42a00cf 100644 (file)
@@ -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;
        }