]> ruin.nu Git - moosique.git/blobdiff - MooTrackView.java
*** empty log message ***
[moosique.git] / MooTrackView.java
index 4e4f0027161da12374c71d308f5124438d1bcd3b..dd348fd98e18080327fbf74cfabd20afb0d232cf 100644 (file)
@@ -50,18 +50,42 @@ public class MooTrackView extends JPanel implements ActionListener {
        public Track getTrack() {
                return track;
        }
+       
+
+       /** 
+        * Updates the track view.
+        */
+       public void update() {
+       
+       }
 
        class NoteArea extends JPanel {
 
+               public static final int NOTE_SIZE = 20;
+
                public NoteArea(Track track) {
+                       setLayout(null);
                        MidiEvent note;
+                       MooNoteElement elem;
+                       boolean isOccupied;
+                       int x, y, height;
+                       Insets insets = getInsets();
                        for (int i = 0; i < track.size(); i++) {
                                note = track.get(i);
                                if (note instanceof MooNote) {
-                                       add(new MooNoteElement((MooNote)note));
+                                       // Adds the note element to the note area.
+                                       MooNote mn = (MooNote)note;
+                                       elem = new MooNoteElement(mn);
+                                       add(elem);
+
+                                       // Places the note element in the appropriate place.
+                                       x = insets.left;
+                                       y = insets.top + (int)(mn.getTick() / 24) * NOTE_SIZE;
+                                       height = (mn.getDuration() / 24) * NOTE_SIZE;
+                                       //System.out.println(findComponentAt(x, y) != this);
+                                       elem.setBounds(x, y, NOTE_SIZE, 20);
                                }
                        }
-                       validate();
                }
 
                public void paintComponent(Graphics g) {
@@ -92,4 +116,4 @@ public class MooTrackView extends JPanel implements ActionListener {
                        }
                }
        }
-}
\ No newline at end of file
+}