+ /**
+ * Adds a standard note to this track.
+ */
+ private void addStandardNote() {
+ int row = (popupY - insets.top) / NOTE_HEIGHT;
+ long timestamp = (long)(ticksPerSixteenth * row);
+ addNote(new MooNote(title.getChannel(), 60, 100, timestamp, Moosique.getSequence().getResolution() / 4));
+ }
+
+ /**
+ * 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);
+ Rectangle r = new Rectangle();
+ r = elem.getBounds(r);
+ rects.remove(r);
+ Moosique.setEdited();
+ repaint();
+ }
+
+ /**
+ * Deselects all notes.
+ */
+ public void selectNote(MooNoteElement elem) {
+ selected.add(elem);
+ }
+
+ /**
+ * Deselects all notes.
+ */
+ public void deselectNote(MooNoteElement elem) {
+ selected.remove(selected.indexOf(elem));
+ }
+
+ /**
+ * Deselects all notes.
+ */
+ public void deselectAllNotes() {
+ Iterator it = selected.iterator();
+ while(it.hasNext()) {
+ ((MooNoteElement)it.next()).deselect();
+ }
+ selected.clear();
+ }
+
+ /**
+ * Determines if the given MooNoteElement is the only one in the track view that is selected.
+ * @return if the given element is the only selected one
+ */
+ public boolean isTheOnlySelected(MooNoteElement elem) {
+ Iterator it = selected.iterator();
+ while(it.hasNext()) {
+ if (!it.next().equals(elem)) return false;
+ }
+ return true;
+ }
+
+ /**
+ * Shows a popup-menu with options for the current selection of note elements.
+ * @param c the component over which to display the menu
+ * @param x the x-coordinate in which to display the menu
+ * @param y the y-coordinate in which to display the menu
+ */
+ public void showSelectionPopup(Component c, int x, int y) {
+ selPopup.show(c, x, y);
+ }
+
+ /**
+ * Transposes all selected notes the given number of halftones.
+ */
+ private void transposeSelectedNotes(int halftones) {
+ Iterator it = selected.iterator();
+ while(it.hasNext()) {
+ MooNoteElement elem = (MooNoteElement)it.next();
+ elem.getNote().transpose(halftones);
+ elem.update();
+ }
+ }
+
+ /**
+ * Draws the grid that is on the background.
+ * @param g The Graphics object used to draw the grid.
+ */