* @version 1
*/
-public class MooNoteElement extends JPanel {
+public class MooNoteElement extends JPanel implements Comparable{
private MooTrackView mtv;
private MooNote note;
return note;
}
+ /**
+ * Compares the note of this element to that of another note.
+ * @return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object
+ */
+ public int compareTo(Object o) {
+ return note.compareTo(((MooNoteElement)o).getNote());
+ }
+
/**
* Selects the current NoteElement.
*/
}
public void mouseReleased(MouseEvent e) {
- if (!maybeShowPopup(e) && !mouseIn) mtv.maybeMoveSelectedNotes(getY(), getY() + e.getY());
+ if (!maybeShowPopup(e) && !mouseIn) {
+ int y = e.getY();
+ if (y < 0) mtv.maybeMoveSelectedNotes((int)Math.floor((double)y / MooTrackView.NOTE_HEIGHT) * MooTrackView.NOTE_HEIGHT);
+ if (y > getHeight()) mtv.maybeMoveSelectedNotes((int)Math.ceil(((double)y - getHeight()) / MooTrackView.NOTE_HEIGHT) * MooTrackView.NOTE_HEIGHT);
+
+ }
}
/**
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source == popupProp) {
+ System.out.println("Duration: " + note.getDuration());
new MooDialog(note);
+ System.out.println("Duration: " + note.getDuration());
newLayout();
+ repaint();
} else if (source == popupRemove) {
remove();
} else if (source == popupTranspOctUp) {