return selected;
}
+ /**
+ * Returns the note of this element.
+ * @return the note
+ */
+ public MooNote getNote() {
+ return note;
+ }
+
/**
* Selects the current NoteElement.
* @param state if the element should be selected
}
*/
- g2.drawString(notePitch, 1, 9);
- g2.drawString("" + noteVelocity, 21, 9);
+ g2.drawString(notePitch, 1, 8);
+ g2.drawString("" + noteVelocity, 21, 8);
}
/**
noteVelocity = ""+note.getVelocity();
}
- /**
- * Gets the note that is element represents
- * @return the MooNote object.
- */
- public MooNote getNote(){
- return note;
- }
-
/**
* Listener that checks the mouse actions on this element.
*/
class MAdapter extends MouseAdapter {
+
+ public void mouseClicked(MouseEvent e) {
+
+ }
+
/**
* Checks if the mouse is pressed.
* Pops up the menu if right mousebutton is used.
* Asks the MooTrackView that it's painted on to remove this element and the note.
*/
protected void remove(){
- mtv.removeNote(this, note);
+ mtv.removeNote(this);
}
}
}
}
+ /**
+ * Returns the track of this view.
+ * @return the track of this view
+ */
public Track getTrack() {
return track;
}
-
/**
- * Updates the track view.
+ * Returns the title of this view.
+ * @return the title of this view
*/
- public void update(long tickPosition) {
- repaint();
+ public MooTrackTitle getTitle() {
+ return title;
}
private boolean isOccupied(Rectangle r) {
return false;
}
+ /**
+ * Adds the given note to the current track, and visualises it.
+ * @param mn the note to add
+ */
public void addNote(MooNote mn) {
mn.addTo(track);
MooNoteElement elem = new MooNoteElement(this, mn);
repaint();
}
- public void removeNote(MooNoteElement elem, MooNote mn) {
- mn.removeFrom(track);
+ /**
+ * Removes the given note element from the view and its note from the current track.
+ * @param elem the note element to remove
+ */
+ public void removeNote(MooNoteElement elem) {
+ elem.getNote().removeFrom(track);
remove(elem);
elem.getNote().removeFrom(track);
repaint();
*/
public void update(long tickPosition) {
getViewport().setViewPosition(new Point((int)getViewport().getViewPosition().getX(), (int)(tickPosition / (Moosique.getSequence().getResolution() / 4)) * MooTrackView.NOTE_HEIGHT));
- Component[] comps = getComponents();
- for (int i = 0; i < comps.length; i++) {
- if(comps[i] instanceof MooTrackView) ((MooTrackView)comps[i]).update(tickPosition);
- }
}
/**
}
/**
- * Shows the given message in the status bar.
- * @param text the message to show
+ * Returns whether the given track should be drawn
+ * @return true if the given track should be drawn
*/
public static boolean shouldBeDrawn(Track track) {
if (drawEmptyTracks) return true;
/**
- * Shows the given message in the status bar.
- * @param text the message to show
+ * Sets whether empty tracks should be drawn
+ * @param state true if empty tracks should be drawn
*/
public static void setDrawEmptyTracks(boolean state) {
drawEmptyTracks = state;