]> ruin.nu Git - moosique.git/blobdiff - MooNoteElement.java
Fixed drag select in track view.
[moosique.git] / MooNoteElement.java
index 67555fcf5ccc80c45c85c7512b7ae69f1928ccd3..7ea74227d0be3a456226583adfa3fe9a8bed560f 100644 (file)
@@ -87,6 +87,15 @@ public class MooNoteElement extends JPanel {
                repaint();
        }
 
+       /** 
+        * Transposes the current note element the given number of halftones.
+        * @param halftones     the number of halftones to transpose - positive for up, negative for down
+        */
+       public void transpose(int halftones) {
+               note.transpose(halftones);
+               update();
+       }
+
        /**
         * Draws the string that shows the note's properties.
         * @param g     The Graphics object used to draw the strings.
@@ -155,16 +164,24 @@ public class MooNoteElement extends JPanel {
        }
 
        /**
-        * layout this changed elemnt
+        * Layout this changed elemnt.
         */
        protected void newLayout(){
                mtv.layoutElement(this,true);
        }
+
        /**
         * Listener that checks the mouse actions on this element.
         */
        class MAdapter extends MouseAdapter {
        
+               /**
+                * Selects the note if 
+                */
+               public void mouseEntered(MouseEvent e) {
+                       if (mtv.isLeftMouseButtonPressed()) select();
+               }
+
                /**
                 * If left mouse button is clicked, selects the note and plays it.
                 */
@@ -232,11 +249,9 @@ public class MooNoteElement extends JPanel {
                        } else if (source == popupRemove) {
                                remove();
                        } else if (source == popupTranspOctUp) {
-                               note.transpose(12);
-                               update();
+                               transpose(12);
                        } else if (source == popupTranspOctDown) {
-                               note.transpose(-12);
-                               update();
+                               transpose(-12);
                        }
                }
        }