X-Git-Url: https://ruin.nu/git/?p=moosique.git;a=blobdiff_plain;f=MooToolbar.java;h=43027c5a7ddbb75cd4f2191c0f6d8484b261332a;hp=08e4a0d2f580622ffd20587ab17d0fa31f552322;hb=aae2d0b4428236b4147f466b3858a34bb7ed174f;hpb=a25242af0e55e3db5135b29e2d7e554d5fafaaaa diff --git a/MooToolbar.java b/MooToolbar.java index 08e4a0d..43027c5 100644 --- a/MooToolbar.java +++ b/MooToolbar.java @@ -74,6 +74,7 @@ public class MooToolbar extends JToolBar { * @param tickPosition the tick position to visualize */ public void updateProgInd(long tickPosition) { + ticksPerBeat = Moosique.getSequence().getResolution(); if (tickPosition == 0) { resetProgInd(); } else { @@ -99,7 +100,7 @@ public class MooToolbar extends JToolBar { ticksPerBeat = Moosique.getSequence().getResolution(); } - /* + /** * Creates a button with the specified image and tooltip. */ private JButton createButton(String imagelocation, String tooltip) { @@ -109,7 +110,7 @@ public class MooToolbar extends JToolBar { return button; } - /* + /** * Creates labels with the specified text and font size. */ private JLabel createLabel(String title, int fontSize){ @@ -118,7 +119,7 @@ public class MooToolbar extends JToolBar { return label; } - /* + /** * Formats the given label for the progress indicator. */ private JLabel formatProgInd(JLabel label){ @@ -145,37 +146,30 @@ public class MooToolbar extends JToolBar { playpause.setToolTipText("Pause"); Moosique.resume(); } else if (toolTip == "Stop") { - resetProgInd(); Moosique.stop(); } } else if (e.getSource() instanceof JLabel) { - long position = Moosique.getSequencer().getTickPosition(); + long position = Moosique.getEditPosition(); if (e.getSource().equals(measuresValue)) { if (SwingUtilities.isRightMouseButton(e)) { - System.out.println("IncM"); position += beatsPerMeasure * ticksPerBeat; } else if (SwingUtilities.isLeftMouseButton(e) && Integer.parseInt(measuresValue.getText()) > 1) { - System.out.println("DecM"); position -= beatsPerMeasure * ticksPerBeat; } } else if (e.getSource().equals(beatsValue)) { if (SwingUtilities.isRightMouseButton(e)) { - System.out.println("IncB"); position += ticksPerBeat; } else if (SwingUtilities.isLeftMouseButton(e) && Integer.parseInt(beatsValue.getText()) > 1) { - System.out.println("DecB"); position -= ticksPerBeat; } } else if (e.getSource().equals(ticksValue)) { if (SwingUtilities.isRightMouseButton(e)) { - System.out.println("IncT"); position += 1; } else if (SwingUtilities.isLeftMouseButton(e) && Integer.parseInt(ticksValue.getText()) > 1) { - System.out.println("DecT"); position -= 1; } } - Moosique.getSequencer().setTickPosition(position); + Moosique.setEditPosition(position); Moosique.getGUI().update(position); } } @@ -192,4 +186,4 @@ public class MooToolbar extends JToolBar { public void mouseReleased(MouseEvent e) {} } -} \ No newline at end of file +}