From e31778837bee5cfbbaf643d17f1eaeb086d8e50c Mon Sep 17 00:00:00 2001 From: Einar Pehrson Date: Fri, 16 May 2003 15:09:36 +0000 Subject: [PATCH] *** empty log message *** --- MooNoteElement.java | 27 ++++++++++++++++----------- MooTrackView.java | 24 ++++++++++++++++++------ MooView.java | 4 ---- Moosique.java | 8 ++++---- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/MooNoteElement.java b/MooNoteElement.java index 6f37234..8d8778d 100644 --- a/MooNoteElement.java +++ b/MooNoteElement.java @@ -59,6 +59,14 @@ public class MooNoteElement extends JPanel { 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 @@ -85,8 +93,8 @@ public class MooNoteElement extends JPanel { } */ - g2.drawString(notePitch, 1, 9); - g2.drawString("" + noteVelocity, 21, 9); + g2.drawString(notePitch, 1, 8); + g2.drawString("" + noteVelocity, 21, 8); } /** @@ -117,18 +125,15 @@ public class MooNoteElement extends JPanel { 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. @@ -178,7 +183,7 @@ public class MooNoteElement extends JPanel { * 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); } } diff --git a/MooTrackView.java b/MooTrackView.java index 513792d..8eba152 100644 --- a/MooTrackView.java +++ b/MooTrackView.java @@ -106,16 +106,20 @@ public class MooTrackView extends JPanel { } } + /** + * 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) { @@ -126,6 +130,10 @@ public class MooTrackView extends JPanel { 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); @@ -135,8 +143,12 @@ public class MooTrackView extends JPanel { 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(); diff --git a/MooView.java b/MooView.java index c16699c..0215b82 100644 --- a/MooView.java +++ b/MooView.java @@ -100,10 +100,6 @@ public class MooView extends JScrollPane { */ 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); - } } /** diff --git a/Moosique.java b/Moosique.java index 0a148b6..01b6b76 100644 --- a/Moosique.java +++ b/Moosique.java @@ -312,8 +312,8 @@ public class Moosique { } /** - * 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; @@ -322,8 +322,8 @@ public class Moosique { /** - * 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; -- 2.39.2