]> ruin.nu Git - moosique.git/commitdiff
no message
authorEinar Pehrson <einarp@itstud.chalmers.se>
Wed, 21 May 2003 13:04:27 +0000 (13:04 +0000)
committerEinar Pehrson <einarp@itstud.chalmers.se>
Wed, 21 May 2003 13:04:27 +0000 (13:04 +0000)
MooDialog.java
MooMenu.java
MooTrackView.java
Moosique.java
To Do.txt

index a2adf4754b5f44472d20a9b69b6797ab903e2338..07e719aeb2af1ca0a10e777fc14ff474443f802d 100644 (file)
@@ -663,7 +663,12 @@ public class MooDialog extends JDialog {
                } catch (Exception ex) {
                        s = "Manual not found";
                }
-               pane.add(new JScrollPane(new JTextArea(s, 30, 95)));
+               JTextArea text = new JTextArea(s, 30, 95);
+               text.setLineWrap(true);
+               text.setWrapStyleWord(true);
+               text.setEnabled(false);
+               text.setDisabledTextColor(Color.black);
+               pane.add(new JScrollPane(text));
                Action close = new AbstractAction("Close") {
                        public void actionPerformed(ActionEvent ae) {
                                setVisible(false);
index f8c67d7602a22b703201e8ec2b1305caf1925aa7..d30d181d20541aae81695a48401d2b2d9232bfa0 100644 (file)
@@ -15,6 +15,7 @@ public class MooMenu extends JMenuBar implements ActionListener {
        private JMenu file, edit, keyboard, playback, music, help;
        private JFileChooser chooser;
        private File directory;
+       private String[] openedFiles;
 
        /**
         * Creates the menu bar.
index 873e2d80191b575d080e91286dd22ed06f567c5d..cb22b42def09d6aa15a1223891a317fc5df0e729 100644 (file)
@@ -134,8 +134,8 @@ public class MooTrackView extends JPanel {
                x = insets.left;
                if (quantizeRecording) {
                        // Snap to nearest sixteenth
-                       y = insets.top + (int)((mn.getTick() * NOTE_HEIGHT) / ticksPerSixteenth);
-                       height = (mn.getDuration() * NOTE_HEIGHT) / ticksPerSixteenth;
+                       y = insets.top + Math.round(mn.getTick() / ticksPerSixteenth) * NOTE_HEIGHT;
+                       height = (mn.getDuration() / ticksPerSixteenth) * NOTE_HEIGHT;
                } else {
                        y = insets.top + (int)((mn.getTick() * NOTE_HEIGHT) / ticksPerSixteenth);
                        height = (mn.getDuration() * NOTE_HEIGHT) / ticksPerSixteenth;
index 860f561a3d720e50dcf333554824f65f6fd18a0c..298c045ff30523290cc1ee234668f9355119ed9b 100644 (file)
@@ -68,6 +68,9 @@ public class Moosique {
                }
                System.out.println("Done");
 
+               // Loads user preferences (work directory, last opened files etc).
+               loadPreferences();
+
                //If a filename is given as the command-line argument, attempts to load a sequence from the file.
                if (fileArg != null) {
                        System.out.print("Loading MIDI sequence from " + fileArg + "...");
@@ -509,10 +512,11 @@ public class Moosique {
        /** 
         * Wraps each NoteOn event in the track with its NoteOff event in a MooNote.
         */
-       public static void convertTrack(Track track) {
+       public static List convertTrack(Track track) {
                // Searches the track for NoteOn and NoteOff events
                ArrayList noteOns = new ArrayList(track.size() / 2);
                ArrayList noteOffs = new ArrayList(track.size() / 2);
+               ArrayList mooNotes = new ArrayList();
                MidiEvent event;
                for (int j = 0; j < track.size(); j++) {
                        event = track.get(j);
@@ -536,28 +540,34 @@ public class Moosique {
                ShortMessage onMsg, nextOffMsg;
                while(iOn.hasNext()) {
                        on = (MidiEvent)iOn.next();
-                       onMsg = (ShortMessage)on.getMessage();
-                       iOff = noteOffs.iterator();
-                       while(iOff.hasNext()) {
-                               nextOff = (MidiEvent)iOff.next();
-                               nextOffMsg = (ShortMessage)nextOff.getMessage();
-                               if(onMsg.getChannel() == nextOffMsg.getChannel() &&
-                                  onMsg.getData1() == nextOffMsg.getData1() &&
-                                  c.compare(nextOff, on) > 0) {
-                                       off = nextOff;
-                                       iOff.remove();
-                                       break;
+                       if (!(on instanceof MooNote)) {
+                               onMsg = (ShortMessage)on.getMessage();
+                               iOff = noteOffs.iterator();
+                               while(iOff.hasNext()) {
+                                       nextOff = (MidiEvent)iOff.next();
+                                       nextOffMsg = (ShortMessage)nextOff.getMessage();
+                                       if(onMsg.getChannel() == nextOffMsg.getChannel() &&
+                                          onMsg.getData1() == nextOffMsg.getData1() &&
+                                          c.compare(nextOff, on) > 0) {
+                                               off = nextOff;
+                                               iOff.remove();
+                                               break;
+                                       }
+                                               
                                }
-                                       
-                       }
-                       track.remove(on);
-                       if (off != null) {
-                               track.add(new MooNote(on, off));
-                       } else {
-                               track.add(new MooNote(on, new MidiEvent((ShortMessage)on.getMessage().clone(), on.getTick() + 48)));
+                               track.remove(on);
+                               MooNote mn;
+                               if (off != null) {
+                                       mn = new MooNote(on, off);
+                               } else {
+                                       mn = new MooNote(on, new MidiEvent((ShortMessage)on.getMessage().clone(), on.getTick() + 48));
+                               }
+                               track.add(mn);
+                               mooNotes.add(mn);
+                               iOn.remove();
                        }
-                       iOn.remove();
                }
+               return mooNotes;
        }
 
        /** 
@@ -612,6 +622,20 @@ public class Moosique {
                return true;
        }
 
+       /** 
+        * Loads the user preferences.
+        */
+       public static void loadPreferences() {
+               
+       }
+
+       /** 
+        * Saves the user preferences.
+        */
+       public static void savePreferences() {
+               
+       }
+
        /** 
         * Prompts the user .
         */
@@ -661,6 +685,7 @@ public class Moosique {
                if (gui != null) {
                        if (promptOnUnsavedChanges()) return;
                }
+               savePreferences();
                if (sequencer.isOpen()) sequencer.close();
                if (synthesizer.isOpen()) synthesizer.close();
                System.exit(0);
index 37c1bb99999b7b589ceb286fa1b41e1bff86687b..82bc7fe995b39d872fff9addea50fc47582dfae4 100644 (file)
--- a/To Do.txt
+++ b/To Do.txt
@@ -3,16 +3,6 @@
 jar cmf manif Moosique.jar *.class *.java midi\*.mid images\*.gif Manual.txt
 manif: Main-Class: Moosique
 
-\f
-Presentation
-
-EDIT-huset vån 2 ES52
-Onsdag 19/5 10-12
-
-TID    PRESENTATION    OPPOSITION
-11:00  Group 03        Vi
-11:30  Vi              Group 11 
-
 \f
 Varför ritar den ut de tomma spåren i en ny fil? Rätt, men hur?
 Lägg till redigeringsfunktionerna i menyn. Metoderna flyttas till MooView?
@@ -21,12 +11,11 @@ Kopiera/flytta sp
 
 \f
 IO
-x Implementera ljudlös körning med -m.
 x Lägg till alla metameddelanden i filerna vi skapar. Annars är det lite dumt.
 x Play hänger sig om man ändrar duration på en not.
 x Spara konfiguration?
        Arbetskatalog
-       Fem senast öppnade filerna
+       Fem senaste öppnade filerna
        Valda MIDI-enheter
 
 x Stopp