]> ruin.nu Git - moosique.git/commitdiff
no message
authorEinar Pehrson <einarp@itstud.chalmers.se>
Tue, 13 May 2003 18:22:43 +0000 (18:22 +0000)
committerEinar Pehrson <einarp@itstud.chalmers.se>
Tue, 13 May 2003 18:22:43 +0000 (18:22 +0000)
MooNoteElement.java
MooTrackView.java
MooView.java

index 65afa7bc8061552e130eb6bb1af4a63ed15e86a7..46b8047c4ae9bf5c1c26ed569fd283ffdafa1bba 100644 (file)
@@ -23,7 +23,7 @@ public class MooNoteElement extends JPanel {
         */
        public MooNoteElement (MooNote mn) {
                note = mn;
-               columns = mn.getDuration() / 24;
+               columns = mn.getDuration() / (Moosique.getSequence().getResolution() / 4);
                setBorder(BorderFactory.createLineBorder(Color.black));
                setBackground(bgColor);
        }
index c44bc24eeb0c5974b428f8eb82cefefd19f6681c..a0da5dc7339c6f45c90e7063dd0c199333e02879 100644 (file)
@@ -81,6 +81,7 @@ public class MooTrackView extends JPanel implements ActionListener {
                        MidiEvent note;
                        MooNoteElement elem;
                        int x, y, height;
+                       int beatsPerSixteenth = Moosique.getSequence().getResolution() / 4;
                        rects = new ArrayList(track.size() / 2);
 
                        // Placing note elements
@@ -95,8 +96,8 @@ public class MooTrackView extends JPanel implements ActionListener {
 
                                        // Moves the note element to the appropriate place.
                                        x = insets.left;
-                                       y = insets.top + (int)(mn.getTick() / 24) * NOTE_HEIGHT;
-                                       height = (mn.getDuration() / 24) * NOTE_HEIGHT;
+                                       y = insets.top + (int)(mn.getTick() / beatsPerSixteenth) * NOTE_HEIGHT;
+                                       height = (mn.getDuration() / beatsPerSixteenth) * NOTE_HEIGHT;
                                        if (height == 0) height = NOTE_HEIGHT;
                                        Rectangle r = new Rectangle(x, y, NOTE_WIDTH, height);
                                        while(isOccupied(r)) r.translate(NOTE_WIDTH, 0);
index 146738d55ea50db6b83c5f69e27bc9635dda6cdf..50819ef3784a4b153de6a1694e7538eba65067e2 100644 (file)
@@ -84,7 +84,7 @@ public class MooView extends JScrollPane {
         * Calls on each track view to update itself.
         */
        public void update(long tickPosition) {
-               getViewport().setViewPosition(new Point((int)getViewport().getViewPosition().getX(), (int)(tickPosition / 24) * MooTrackView.NOTE_HEIGHT));
+               getViewport().setViewPosition(new Point((int)getViewport().getViewPosition().getX(), (int)(tickPosition / (Moosique.getSequence().getResolution() / 4)) * MooTrackView.NOTE_HEIGHT));
                Component[] comps = getComponents();
                for (int i = 0; i < comps.length; i++) {
                        if(comps[i] instanceof MooTrackView) ((MooTrackView)comps[i]).update(tickPosition);