]> ruin.nu Git - moosique.git/blobdiff - MooTrackView.java
Changed MooNoteElement constructor
[moosique.git] / MooTrackView.java
index 5efb00238f5366180076fcc8b65a48d83b431a70..a9a41d9f127a9c6a8871b5b8515c46cfcd9d1aea 100644 (file)
@@ -23,6 +23,7 @@ public class MooTrackView extends JPanel implements ActionListener {
        
 
        public MooTrackView (Track track) {
+               super(true);
                this.track = track;
                //setPreferredSize(new Dimension(200, 9000));
                setLayout(new BorderLayout());
@@ -70,6 +71,7 @@ public class MooTrackView extends JPanel implements ActionListener {
 
                public NoteArea(Track track) {
                        // Configuring panel
+                       super(true);
                        setLayout(null);
                        trackLength = 140;
                        setPreferredSize(new Dimension(200, 140 * NOTE_HEIGHT));
@@ -87,14 +89,14 @@ public class MooTrackView extends JPanel implements ActionListener {
                                if (note instanceof MooNote) {
                                        // Adds the note element to the note area.
                                        MooNote mn = (MooNote)note;
-                                       elem = new MooNoteElement(mn);
+                                       elem = new MooNoteElement(mn, mn.getDuration() / 24);
                                        add(elem);
 
                                        // Moves the note element to the appropriate place.
                                        x = insets.left;
                                        y = insets.top + (int)(mn.getTick() / 24) * NOTE_HEIGHT;
-                                       height = NOTE_HEIGHT;
-                                       // height = (mn.getDuration() / 24) * NOTE_HEIGHT;
+                                       height = (mn.getDuration() / 24) * 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);
                                        elem.setBounds(r);
@@ -145,4 +147,4 @@ public class MooTrackView extends JPanel implements ActionListener {
                        }
                }
        }
-}
\ No newline at end of file
+}