COPY_TRACK = 3,
MOVE_TRACK = 4,
JUMP = 5,
- CONTENTS = 6;
+ CONTENTS = 6,
+ INSERT_MEASURE = 7,
+ DELETE_MEASURE = 8;
/**
* Constructor of the dialogs.
case MOVE_TRACK: makeMoveDialog(pane, tracks); break;
case JUMP: makeJumpDialog(pane); break;
case CONTENTS: makeTextDialog(pane, "Manual.txt"); break;
+ case INSERT_MEASURE: makeInsertMeasureDialog(pane); break;
+ case DELETE_MEASURE: makeDeleteMeasureDialog(pane); break;
}
}
(Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2);
setResizable(false);
pack();
- setSize(260,175);
+ setSize(260,165);
setVisible(true);
}
-
+
+ /**
+ * Builds the insert measure popupdialog.
+ * @param pane The container to put the dialog in.
+ */
+ private void makeInsertMeasureDialog(Container pane){
+
+ setTitle("Insert Measure");
+ labelA = new JLabel("Insert at:", JLabel.RIGHT);
+ pane.add(labelA);
+ labelB = new JLabel("Measure count:", JLabel.RIGHT);
+ pane.add(labelB);
+ textFieldA = new JTextField();
+ pane.add(textFieldA);
+ textFieldB = new JTextField();
+ pane.add(textFieldB);
+ cancelButton = new JButton("Cancel");
+ pane.add(cancelButton);
+ okButton = new JButton("OK");
+ pane.add(okButton);
+
+ labelA.setBounds(20, 20, 110 ,20);
+ labelB.setBounds(20, 50, 110, 20);
+ textFieldA.setBounds(140 ,20 , 40, 20);
+ textFieldB.setBounds(140,50, 40, 20);
+ cancelButton.setBounds(20 ,95 , 80, 30);
+ okButton.setBounds(120, 95, 60, 30);
+
+ setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - this.getWidth()) / 2,
+ (Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2);
+ setResizable(false);
+ pack();
+ setSize(210,175);
+ setVisible(true);
+ }
+
+ /**
+ * Builds the delete measure popupdialog.
+ * @param pane The container to put the dialog in.
+ */
+ private void makeDeleteMeasureDialog(Container pane) {
+
+ setTitle("Delete Measure");
+ labelA = new JLabel("Delete at:", JLabel.RIGHT);
+ pane.add(labelA);
+ labelB = new JLabel("Measure count:", JLabel.RIGHT);
+ pane.add(labelB);
+ textFieldA = new JTextField();
+ pane.add(textFieldA);
+ textFieldB = new JTextField();
+ pane.add(textFieldB);
+ cancelButton = new JButton("Cancel");
+ pane.add(cancelButton);
+ okButton = new JButton("OK");
+ pane.add(okButton);
+
+ labelA.setBounds(20, 20, 110 ,20);
+ labelB.setBounds(20, 50, 110, 20);
+ textFieldA.setBounds(140 ,20 , 40, 20);
+ textFieldB.setBounds(140,50, 40, 20);
+ cancelButton.setBounds(20 ,95 , 80, 30);
+ okButton.setBounds(120, 95, 60, 30);
+
+ setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - this.getWidth()) / 2,
+ (Toolkit.getDefaultToolkit().getScreenSize().height - this.getHeight()) / 2);
+ setResizable(false);
+ pack();
+ setSize(210,175);
+ setVisible(true);
+ }
+
private void makeTextDialog(Container pane, String filename) {
setTitle("Contents");
File manual = new File(filename);
} else if (command == "Stop") {
Moosique.stop();
} else if (command == "Jump...") {
- MooDialog what = new MooDialog(MooDialog.JUMP);
+ MooDialog newDialog = 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);
+ MooDialog newDialog = new MooDialog(MooDialog.ADD_TRACK);
Moosique.getSequence().createTrack();
} else if (command == "Delete track...") {
- MooDialog what = new MooDialog(MooDialog.DELETE_TRACK);
+ MooDialog newDialog = new MooDialog(MooDialog.DELETE_TRACK);
/* Let the user select a track from a list.
seq = Moosique.getSequence();
seq.deleteTrack(seq.getTracks()[NUMBER]);
*/
} else if (command == "Copy track...") {
- MooDialog what = new MooDialog(MooDialog.COPY_TRACK);
+ MooDialog newDialog = new MooDialog(MooDialog.COPY_TRACK);
} else if (command == "Move track...") {
- MooDialog what = new MooDialog(MooDialog.MOVE_TRACK);
+ MooDialog newDialog = new MooDialog(MooDialog.MOVE_TRACK);
} else if (command == "Insert measure...") {
-
+ MooDialog newDialog = new MooDialog(MooDialog.INSERT_MEASURE);
} else if (command == "Delete measure...") {
-
+ MooDialog newDialog = new MooDialog(MooDialog.DELETE_MEASURE);
} else if (command == "Set time signature...") {
} else if (command == "Set tempo...") {