X-Git-Url: https://ruin.nu/git/?p=moosique.git;a=blobdiff_plain;f=MooMenu.java;h=d25ec0caa9a2cfd0a1fef8f0c74d65bdf44f19d8;hp=ca973298bf464b4584d7897f17bdec980e32497e;hb=c3a31c2aa833e2197f0929655c69a2090e8bbecc;hpb=83ec11f99e143607d057db2a68c262ca9672e524 diff --git a/MooMenu.java b/MooMenu.java index ca97329..d25ec0c 100644 --- a/MooMenu.java +++ b/MooMenu.java @@ -37,6 +37,7 @@ public class MooMenu extends JMenuBar implements ActionListener { addItem(edit, "Paste", KeyEvent.VK_V, ActionEvent.CTRL_MASK); addItem(edit, "Select all", KeyEvent.VK_E, ActionEvent.CTRL_MASK); addItem(edit, "Invert selection", KeyEvent.VK_I, ActionEvent.CTRL_MASK); + edit.addSeparator(); addItem(edit, "Preferences...", KeyEvent.VK_P, ActionEvent.CTRL_MASK); playback = createMenu("Playback", KeyEvent.VK_P); @@ -54,8 +55,10 @@ public class MooMenu extends JMenuBar implements ActionListener { addItem(music, "Delete track...", KeyEvent.VK_D, ActionEvent.CTRL_MASK); addItem(music, "Copy track...", KeyEvent.VK_Y, ActionEvent.CTRL_MASK); addItem(music, "Move track...", KeyEvent.VK_M, ActionEvent.CTRL_MASK); + music.addSeparator(); addItem(music, "Insert measure..."); addItem(music, "Delete measure..."); + music.addSeparator(); addItem(music, "Set time signature..."); addItem(music, "Set tempo..."); addItem(music, "Scale velocity..."); @@ -68,13 +71,24 @@ public class MooMenu extends JMenuBar implements ActionListener { addItem(help, "Getting started"); addItem(help, "About"); } - + /** + * Creats a menu in the menubar. + * @param name The name of the menu. + * @param mnemnic The shortcut-key to access the menu. + * @return menu The menu created. + */ private JMenu createMenu(String name, int mnemonic) { JMenu menu = new JMenu(name); menu.setMnemonic(mnemonic); return menu; } + /** + * Creats a menuitem in the menu. + * @param menu The menu where to add the menuitem. + * @param name The name of the menuitem. + * @return item The menuitem created. + */ private JMenuItem addItem(JMenu menu, String name) { JMenuItem item = new JMenuItem(name); item.addActionListener(this); @@ -82,6 +96,13 @@ public class MooMenu extends JMenuBar implements ActionListener { return item; } + /** + * Creats a menuitem in the menu. + * @param menu The menu to where to add the menuitem. + * @param name The name of the menuitem. + * @param key The keystroke to access this menuitem. + * @return item The menuitem created. + */ private JMenuItem addItem(JMenu menu, String name, String key) { JMenuItem item = new JMenuItem(name); item.setAccelerator(KeyStroke.getKeyStroke(key)); @@ -90,6 +111,14 @@ public class MooMenu extends JMenuBar implements ActionListener { return item; } + /** + * Creats a menuitem in the menu. + * @param menu The menu to where to add the menuitem. + * @param name The name of the menuitem. + * @param key The keystroke to access this menuitem. + * @param mask The keyboard mask. + * @return item The menuitem created. + */ private JMenuItem addItem(JMenu menu, String name, int key, int mask) { JMenuItem item = new JMenuItem(name); item.setAccelerator(KeyStroke.getKeyStroke(key, mask)); @@ -105,7 +134,10 @@ public class MooMenu extends JMenuBar implements ActionListener { } return false; } - + /** + * Gets the users command of takes and properiate action + * @param e The action perfomed. + */ public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); Sequence seq; @@ -167,13 +199,11 @@ public class MooMenu extends JMenuBar implements ActionListener { } else if (command == "Stop") { Moosique.stop(); } else if (command == "Jump...") { - + MooDialog what = new MooDialog(MooDialog.JUMP); + // Moosique.setPosition(???); Räkna ut från msr, beats, ticks, time sig. } else if (command == "Add track...") { - MooDialog what = new MooDialog(MooDialog.ADD_TRACK); - Moosique.getSequence().createTrack(); - } else if (command == "Delete track...") { MooDialog what = new MooDialog(MooDialog.DELETE_TRACK); @@ -183,13 +213,9 @@ public class MooMenu extends JMenuBar implements ActionListener { seq.deleteTrack(seq.getTracks()[NUMBER]); */ } else if (command == "Copy track...") { - MooDialog what = new MooDialog(MooDialog.COPY_TRACK); - } else if (command == "Move track...") { - MooDialog what = new MooDialog(MooDialog.MOVE_TRACK); - } else if (command == "Insert measure...") { } else if (command == "Delete measure...") { @@ -203,15 +229,13 @@ public class MooMenu extends JMenuBar implements ActionListener { } else if (command == "Transpose...") { } else if (command == "Contents") { - // contents to be filled in - JOptionPane.showMessageDialog(this, "här kommer contents komma"); - + MooDialog contents = new MooDialog(MooDialog.CONTENTS); } else if (command == "Getting started") { - // getting started to be filled in + JOptionPane.showMessageDialog(null, "här kommer getting started komma"); } else if (command == "About") { - // about to be filled in + JOptionPane.showMessageDialog(null, "här kommer about att komma"); } } @@ -224,7 +248,7 @@ public class MooMenu extends JMenuBar implements ActionListener { return false; } - /* + /** * gets the description of the filetype * @return "Midifiles the only filetyp compatibel with the program */