X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=MooNoteElement.java;h=7488d1543d94a54a9a66099263d072767f0dad55;hb=948e069926266ead58bc5466520e131941f2466c;hp=d5e4d2a433ece1f041b1056403b473425c75d63a;hpb=b5028dc9c03585cdf231a37d8996a7e836932c3e;p=moosique.git diff --git a/MooNoteElement.java b/MooNoteElement.java index d5e4d2a..7488d15 100644 --- a/MooNoteElement.java +++ b/MooNoteElement.java @@ -13,7 +13,6 @@ public class MooNoteElement extends JPanel { private MooTrackView mtv; private MooNote note; - private int columns; private boolean selected; private Rectangle pitchRect, veloRect; public static final Color bgColor = new Color(160, 218, 255); @@ -31,7 +30,6 @@ public class MooNoteElement extends JPanel { mtv = parent; note = mn; calculateString(); - columns = mn.getDuration() / (Moosique.getSequence().getResolution() / 4); setBorder(BorderFactory.createLineBorder(Color.black)); setBackground(bgColor); addMouseListener(new MAdapter()); @@ -115,6 +113,10 @@ public class MooNoteElement extends JPanel { noteVelocity = ""+note.getVelocity(); } + public MooNote getNote(){ + return note; + } + class MAdapter extends MouseAdapter { public void mousePressed(MouseEvent e) { if (e.isControlDown()) { @@ -134,8 +136,7 @@ public class MooNoteElement extends JPanel { calculateString(); } e.getComponent().repaint(); - } - if (e.isPopupTrigger()) { + } else if (e.isPopupTrigger()) { popup.show(e.getComponent(), e.getX(), e.getY()); } } @@ -147,8 +148,13 @@ public class MooNoteElement extends JPanel { if (source == popupProp) { new MooDialog(note); } else if (source == popupRemove) { - mtv.remove((MooNoteElement)((JComponent)e.getSource()).getParent().getParent()); + remove(); } } } + + protected void remove(){ + mtv.remove(this); + } + }