]> ruin.nu Git - moosique.git/blobdiff - MooToolbar.java
no message
[moosique.git] / MooToolbar.java
index c1244f575e81b717e8db764427727b2d0362fd06..a9ec10bd09b9a79d53e33b6689fb8c0d80cd93de 100644 (file)
@@ -44,8 +44,11 @@ public class MooToolbar extends JToolBar {
                beats = createLabel("Beat", 10);
                ticks = createLabel("Tick", 10);
                measureValue = createLabel("1", 16);
+               measureValue.setBorder(BorderFactory.createLineBorder(Color.black));
                beatsValue = createLabel("1", 16);
+               beatsValue.setBorder(BorderFactory.createLineBorder(Color.black));
                ticksValue = createLabel("1", 16);
+               ticksValue.setBorder(BorderFactory.createLineBorder(Color.black));
                JPanel spacenorth = new JPanel();
                spacenorth.setBackground(bgColor);
                JPanel spacesouth = new JPanel();
@@ -71,12 +74,15 @@ public class MooToolbar extends JToolBar {
         * Updates the progress indicator.
         */
        public void updateProgInd() {
-               int pos = Moosique.getSequencer().getTickPosition();
-               int ticksPerBeat = Moosique.getSequencer().getResolution();
+               long pos = Moosique.getSequencer().getTickPosition();
+               int ticksPerBeat = Moosique.getSequence().getResolution();
                int beatsPerMeasure = 4;
-               measureValue.setText(pos / (beatsPerMeasure * ticksPerBeat));
-               beatsValue.setText((pos - measures * beatsPerMeasure * ticksPerBeat) / ticksPerBeat);
-               ticksValue.setText(pos - measures * beatsPerMeasure * ticksPerBeat - beats * ticksPerBeat);
+               long measures = pos / (beatsPerMeasure * ticksPerBeat);
+               long beats = (pos - measures * beatsPerMeasure * ticksPerBeat) / ticksPerBeat;
+               long ticks = pos - measures * beatsPerMeasure * ticksPerBeat - beats * ticksPerBeat;
+               measureValue.setText(Long.toString(measures));
+               beatsValue.setText(Long.toString(beats));
+               ticksValue.setText(Long.toString(ticks));
        }
 
        /**
@@ -100,7 +106,6 @@ public class MooToolbar extends JToolBar {
        private JLabel createLabel(String title, int fontSize){
                JLabel label = new JLabel(title,JLabel.CENTER);
                label.setFont(new Font("Times New Roman", Font.PLAIN, fontSize));
-               label.setBorder(BorderFactory.createLineBorder(Color.black));
                return label;
        }
 
@@ -110,6 +115,9 @@ public class MooToolbar extends JToolBar {
                                        Moosique.play();
                                        playpause.setIcon(pauseIcon);
                                        playpause.setToolTipText("Pause");
+                                       while(Moosique.getSequencer().isRunning()) {
+                                               Moosique.getGUI().update();
+                                       }
                        } else if (((JButton)e.getSource()).getToolTipText() == "Pause") {
                                        Moosique.pause();
                                        playpause.setIcon(playIcon);
@@ -118,6 +126,9 @@ public class MooToolbar extends JToolBar {
                                        Moosique.resume();
                                        playpause.setIcon(pauseIcon);
                                        playpause.setToolTipText("Pause");
+                                       while(Moosique.getSequencer().isRunning()) {
+                                               Moosique.getGUI().update();
+                                       }
                        } else if (((JButton)e.getSource()).getToolTipText() == "Stop") {
                                Moosique.stop();
                                playpause.setIcon(playIcon);