]> ruin.nu Git - moosique.git/blobdiff - MooTrackView.java
Added some popup-menu items.
[moosique.git] / MooTrackView.java
index 4d58e1d2ddac24fd1e83141c7f153538c807af8b..bac8cbc59fa4d8c75cd09c0078ac5be21a22a1ac 100644 (file)
@@ -172,7 +172,8 @@ public class MooTrackView extends JPanel {
         * Adds a standard note to this track.
         */
        private void addStandardNote() {
-               long timestamp = (long)(ticksPerSixteenth * (popupY - insets.top) / NOTE_HEIGHT);
+               int row =  (popupY - insets.top) / NOTE_HEIGHT;
+               long timestamp = (long)(ticksPerSixteenth * row);
                addNote(new MooNote(title.getChannel(), 60, 100, timestamp, Moosique.getSequence().getResolution() / 4));
        }
 
@@ -196,6 +197,7 @@ public class MooTrackView extends JPanel {
         * The adapter used to listen on mouse actions
         */
        class MAdapter extends MouseAdapter {
+
                /**
                 * Adds a standard note if doubleclicked.
                 */
@@ -206,10 +208,18 @@ public class MooTrackView extends JPanel {
                        }
                }
        
+               public void mousePressed(MouseEvent e) {
+                       maybeShowPopup(e);
+               }
+
+               public void mouseReleased(MouseEvent e) {
+                       maybeShowPopup(e);
+               }
+
                /**
-                * Shows the menu if on standard poptriggers.
+                * Shows the menu if an OS-specific popup-trigger was activated.
                 */
-               public void mousePressed(MouseEvent e) {
+               private void maybeShowPopup(MouseEvent e) {
                        if (e.isPopupTrigger()) {
                                popupY = e.getY();
                                popup.show(e.getComponent(), e.getX(), e.getY());