]> ruin.nu Git - moosique.git/blobdiff - MooGUI.java
.
[moosique.git] / MooGUI.java
index ce67d69e7cb65db5daccde7fbb97fc6bce7bb101..146ca6daa8483350c78cbc2fcea6557d67a05121 100644 (file)
@@ -39,7 +39,7 @@ public class MooGUI extends JFrame {
                pane.add(toolbar, BorderLayout.NORTH);
 
                // Adds main view.
-               view = new MooView(seq.getTracks());
+               view = new MooView(seq);
                pane.add(view, BorderLayout.CENTER);
 
                // Adds status bar.
@@ -55,6 +55,19 @@ public class MooGUI extends JFrame {
                statusBar.setBackground(bgColor);
                view.setBackground(bgColor);
 
+               ActionMap am = getRootPane().getActionMap();
+
+               Action playAction = new AbstractAction() {
+                       public void actionPerformed(ActionEvent ae) {
+                               Moosique.resumepause();
+                       }};
+               am.put("play", playAction);
+
+               InputMap im = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+               KeyStroke playKey = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0);
+               im.put(playKey, "play");
+
+
                // Configures window.
                addWindowListener(new MooGUICloser());
                pack();
@@ -74,14 +87,14 @@ public class MooGUI extends JFrame {
                        comps[i].setBackground(bgColor);
                }
        }
-       
+
        /** 
         * Changes the sequence of the GUI.
         * @param sequence      the MIDI sequence to visualize
         */
        public void setSequence(Sequence sequence) {
                seq = sequence;
-               view.update(seq.getTracks());
+               view.setSequence(seq);
        }
 
        /** 
@@ -91,10 +104,19 @@ public class MooGUI extends JFrame {
        public void setStatus(String text) {
                statusBar.setText(text);
        }
-       
+
+       /**
+        * Update the view.
+        */
+       public void update(){
+               view.update();
+               // Calls on the toolbar to update the progress indicator.
+               //toolbar.updateProgInd();
+       }
+
        class MooGUICloser extends WindowAdapter {
                public void windowClosing(WindowEvent e) {
                        Moosique.quit();
                }
        }
-}
\ No newline at end of file
+}