X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=MooTrackView.java;fp=MooTrackView.java;h=bac8cbc59fa4d8c75cd09c0078ac5be21a22a1ac;hb=8acc1b9983cf0c679fbe556f480a6d7f4d45e518;hp=4d58e1d2ddac24fd1e83141c7f153538c807af8b;hpb=c87df9f217c5730ae465252b415bb7e52a4f3fed;p=moosique.git diff --git a/MooTrackView.java b/MooTrackView.java index 4d58e1d..bac8cbc 100644 --- a/MooTrackView.java +++ b/MooTrackView.java @@ -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());