]> ruin.nu Git - moosique.git/commitdiff
*** empty log message ***
authorEinar Pehrson <einarp@itstud.chalmers.se>
Fri, 16 May 2003 15:09:36 +0000 (15:09 +0000)
committerEinar Pehrson <einarp@itstud.chalmers.se>
Fri, 16 May 2003 15:09:36 +0000 (15:09 +0000)
MooNoteElement.java
MooTrackView.java
MooView.java
Moosique.java

index 6f372349e5372c2e657f71333366075c0d4dfe50..8d8778d369e57a18b778f39734a9158644b50385 100644 (file)
@@ -59,6 +59,14 @@ public class MooNoteElement extends JPanel {
                return selected;
        }
 
                return selected;
        }
 
+       /** 
+        * Returns the note of this element.
+        * @return the note
+        */
+       public MooNote getNote() {
+               return note;
+       }
+
        /** 
         * Selects the current NoteElement.
         * @param state if the element should be selected
        /** 
         * Selects the current NoteElement.
         * @param state if the element should be selected
@@ -85,8 +93,8 @@ public class MooNoteElement extends JPanel {
                }
        */
                
                }
        */
                
-               g2.drawString(notePitch, 1, 9);
-               g2.drawString("" + noteVelocity, 21, 9);
+               g2.drawString(notePitch, 1, 8);
+               g2.drawString("" + noteVelocity, 21, 8);
        }
 
        /**
        }
 
        /**
@@ -117,18 +125,15 @@ public class MooNoteElement extends JPanel {
                noteVelocity = ""+note.getVelocity();
        }
 
                noteVelocity = ""+note.getVelocity();
        }
 
-       /**
-        * Gets the note that is element represents
-        * @return the MooNote object.
-        */
-       public MooNote getNote(){
-               return note;
-       }
-
        /**
         * Listener that checks the mouse actions on this element.
         */
        class MAdapter extends MouseAdapter {
        /**
         * Listener that checks the mouse actions on this element.
         */
        class MAdapter extends MouseAdapter {
+       
+               public void mouseClicked(MouseEvent e) {
+                       
+               }
+
                /**
                 * Checks if the mouse is pressed.
                 * Pops up the menu if right mousebutton is used.
                /**
                 * Checks if the mouse is pressed.
                 * Pops up the menu if right mousebutton is used.
@@ -178,7 +183,7 @@ public class MooNoteElement extends JPanel {
         * Asks the MooTrackView that it's painted on to remove this element and the note.
         */
        protected void remove(){
         * Asks the MooTrackView that it's painted on to remove this element and the note.
         */
        protected void remove(){
-               mtv.removeNote(this, note);
+               mtv.removeNote(this);
        }
 
 }
        }
 
 }
index 513792de17c09597de455aa3600e081bfd84cb07..8eba152152198159e9d33ab49d3cb4bc4a5d3f31 100644 (file)
@@ -106,16 +106,20 @@ public class MooTrackView extends JPanel {
                }
        }
 
                }
        }
 
+       /** 
+        * Returns the track of this view.
+        * @return the track of this view
+        */
        public Track getTrack() {
                return track;
        }
 
        public Track getTrack() {
                return track;
        }
 
-
        /** 
        /** 
-        * Updates the track view.
+        * Returns the title of this view.
+        * @return the title of this view
         */
         */
-       public void update(long tickPosition) {
-               repaint();
+       public MooTrackTitle getTitle() {
+               return title;
        }
 
        private boolean isOccupied(Rectangle r) {
        }
 
        private boolean isOccupied(Rectangle r) {
@@ -126,6 +130,10 @@ public class MooTrackView extends JPanel {
                return false;
        }
        
                return false;
        }
        
+       /** 
+        * Adds the given note to the current track, and visualises it.
+        * @param mn    the note to add
+        */
        public void addNote(MooNote mn) {
                mn.addTo(track);
                MooNoteElement elem = new MooNoteElement(this, mn);
        public void addNote(MooNote mn) {
                mn.addTo(track);
                MooNoteElement elem = new MooNoteElement(this, mn);
@@ -135,8 +143,12 @@ public class MooTrackView extends JPanel {
                repaint();
        }
 
                repaint();
        }
 
-       public void removeNote(MooNoteElement elem, MooNote mn) {
-               mn.removeFrom(track);
+       /** 
+        * Removes the given note element from the view and its note from the current track.
+        * @param elem  the note element to remove
+        */
+       public void removeNote(MooNoteElement elem) {
+               elem.getNote().removeFrom(track);
                remove(elem);
                elem.getNote().removeFrom(track);
                repaint();
                remove(elem);
                elem.getNote().removeFrom(track);
                repaint();
index c16699cbdbf3e473194e97ddece5ef9fd0286d41..0215b829054c51c50fb6e9f6bb273b6239025db7 100644 (file)
@@ -100,10 +100,6 @@ public class MooView extends JScrollPane {
         */
        public void update(long tickPosition) {
                getViewport().setViewPosition(new Point((int)getViewport().getViewPosition().getX(), (int)(tickPosition / (Moosique.getSequence().getResolution() / 4)) * MooTrackView.NOTE_HEIGHT));
         */
        public void update(long tickPosition) {
                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);
-               }
        }
 
        /** 
        }
 
        /** 
index 0a148b60a3acf0ae2422d98f902f22947cb3b26d..01b6b7664345685d633f6585aeaace8c8d011fad 100644 (file)
@@ -312,8 +312,8 @@ public class Moosique {
        }
 
        /** 
        }
 
        /** 
-        * Shows the given message in the status bar.
-        * @param text  the message to show
+        * Returns whether the given track should be drawn
+        * @return true if the given track should be drawn
         */
        public static boolean shouldBeDrawn(Track track) {
                if (drawEmptyTracks) return true;
         */
        public static boolean shouldBeDrawn(Track track) {
                if (drawEmptyTracks) return true;
@@ -322,8 +322,8 @@ public class Moosique {
 
 
        /** 
 
 
        /** 
-        * Shows the given message in the status bar.
-        * @param text  the message to show
+        * Sets whether empty tracks should be drawn
+        * @param state         true if empty tracks should be drawn
         */
        public static void setDrawEmptyTracks(boolean state) {
                drawEmptyTracks = state;
         */
        public static void setDrawEmptyTracks(boolean state) {
                drawEmptyTracks = state;