X-Git-Url: https://ruin.nu/git/index.pl?a=blobdiff_plain;f=MooTrackView.java;h=bac8cbc59fa4d8c75cd09c0078ac5be21a22a1ac;hb=8acc1b9983cf0c679fbe556f480a6d7f4d45e518;hp=6f1dca5e4be1b241dd734a9e461d91fdf321021f;hpb=6db25ccdfe57a846eacef59ee20fc60e5954f24e;p=moosique.git diff --git a/MooTrackView.java b/MooTrackView.java index 6f1dca5..bac8cbc 100644 --- a/MooTrackView.java +++ b/MooTrackView.java @@ -172,8 +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); - System.out.println(ticksPerSixteenth + ", " + popupY + ", " + insets.top + ", " + timestamp); + int row = (popupY - insets.top) / NOTE_HEIGHT; + long timestamp = (long)(ticksPerSixteenth * row); addNote(new MooNote(title.getChannel(), 60, 100, timestamp, Moosique.getSequence().getResolution() / 4)); } @@ -197,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. */ @@ -207,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());