From 4526e51b70110f7272b0c2a3a5f207657d690029 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Lanneskog?= Date: Mon, 19 May 2003 16:52:15 +0000 Subject: [PATCH] =?utf8?q?nu=20=E4r=20=E4ven=20den=20fina=20scale=20veloci?= =?utf8?q?ty=20dialogen=20f=E4rdig?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- MooDialog.java | 128 ++++++++++++++++++++++++++++++++++++++++++++++++- MooMenu.java | 1 + 2 files changed, 127 insertions(+), 2 deletions(-) diff --git a/MooDialog.java b/MooDialog.java index a1be78d..96def13 100644 --- a/MooDialog.java +++ b/MooDialog.java @@ -28,7 +28,8 @@ public class MooDialog extends JDialog { DELETE_MEASURE = 8, SET_TEMPO = 9, PREFERENCES = 10, - TRANSPOSE = 11; + TRANSPOSE = 11, + SCALE_VELOCITY = 12; /** * Constructor of the dialogs. @@ -53,6 +54,7 @@ public class MooDialog extends JDialog { case SET_TEMPO: makeSetTempoDialog(pane); break; case PREFERENCES: makePrefsDialog(pane); break; case TRANSPOSE: makeTransposeDialog(pane, tracks); break; + case SCALE_VELOCITY: makeScaleVelocityDialog(pane, tracks); break; } } @@ -441,7 +443,7 @@ public class MooDialog extends JDialog { pane.add(labelF); labelG = new JLabel("1/2 octaves", JLabel.LEFT); pane.add(labelG); - // what track to edig label + // what track to edit label labelH = new JLabel("Track to edit:", JLabel.CENTER); pane.add(labelH); // combobox representing the tracks @@ -522,6 +524,128 @@ public class MooDialog extends JDialog { setVisible(true); } + /** + * Builds the scale velocity dialog. + * @param pane The container to put the dialog in. + * @param tracks A array containing miditracks. + */ + private void makeScaleVelocityDialog(Container pane, Track[] tracks) { + + setTitle("Scale velocity"); + + // create contents of dialog and add to container + // track edit-intervall labels + labelA = new JLabel("Measure", JLabel.CENTER); + pane.add(labelA); + labelB = new JLabel("Beat", JLabel.CENTER); + pane.add(labelB); + labelC = new JLabel("Tick", JLabel.CENTER); + pane.add(labelC); + // start and end labels + labelD = new JLabel("Start at:", JLabel.RIGHT); + pane.add(labelD); + labelE = new JLabel("End at:", JLabel.RIGHT); + pane.add(labelE); + // from-to label + labelF = new JLabel("to", JLabel.CENTER); + pane.add(labelF); + // what track to edit label + labelG = new JLabel("Track to edit:", JLabel.CENTER); + pane.add(labelG); + // combobox representing the tracks + trackListA = new JComboBox(); + for (int i = 1; i <= tracks.length; i++) trackListA.addItem("Track " + i); + pane.add(trackListA); + // start inputvaluefields + textFieldA = new JTextField(); + pane.add(textFieldA); + textFieldB = new JTextField(); + pane.add(textFieldB); + textFieldC = new JTextField(); + pane.add(textFieldC); + // end inputvaluefield + textFieldD = new JTextField(); + pane.add(textFieldD); + textFieldE = new JTextField(); + pane.add(textFieldE); + textFieldF = new JTextField(); + pane.add(textFieldF); + // the radiobuttonlists inputvaluefields + textFieldG = new JTextField(); + pane.add(textFieldG); + textFieldH = new JTextField(); + pane.add(textFieldH); + textFieldI = new JTextField(); + pane.add(textFieldI); + textFieldJ = new JTextField(); + pane.add(textFieldJ); + textFieldK = new JTextField(); + pane.add(textFieldK); + // the radiobuttonlist with associating titles + JRadioButton constant = new JRadioButton("Change all values to:"); + constant.setSelected(true); + pane.add(constant); + JRadioButton change = new JRadioButton("Gradually change value:"); + pane.add(change); + JRadioButton scale = new JRadioButton("Scale values to %:"); + pane.add(scale); + JRadioButton add = new JRadioButton("Add to current value:"); + pane.add(add); + // a buttongroup for the radiobuttons + ButtonGroup group = new ButtonGroup(); + group.add(constant); + group.add(change); + group.add(scale); + group.add(add); + // ok and cancelbutton + cancelButton = new JButton("Cancel"); + pane.add(cancelButton); + okButton = new JButton("OK"); + pane.add(okButton); + + // set bounds of track edit-intervall labels + labelA.setBounds(80, 75, 50, 20); + labelB.setBounds(145, 75, 50, 20); + labelC.setBounds(210, 75, 50, 20); + // set bounds of start and end labels + labelD.setBounds(20, 95, 60, 20); + labelE.setBounds(20, 115, 60, 20); + // set bounds of from-to label + labelF.setBounds(255, 175, 20 ,20); + // set bounds of trackslist label + labelG.setBounds(30, 30, 100, 20); + // set bounds of start inputvaluefields + textFieldA.setBounds(80, 95, 50, 20); + textFieldB.setBounds(145, 95, 50, 20); + textFieldC.setBounds(210, 95, 50, 20); + // set bounds of end inputvaluefield + textFieldD.setBounds(80, 115, 50, 20); + textFieldE.setBounds(145,115, 50, 20); + textFieldF.setBounds(210, 115, 50, 20); + // set bounds of radiobuttonlists inputvaluefields + textFieldG.setBounds(220, 150, 35, 20); + textFieldH.setBounds(220, 175, 35, 20); + textFieldI.setBounds(280, 175, 35, 20); + textFieldJ.setBounds(220, 200, 35, 20); + textFieldK.setBounds(220, 225, 35, 20); + // set bounds of radiobuttonlist items + constant.setBounds(20, 150, 180, 20); + change.setBounds(20, 175, 200, 20); + scale.setBounds(20, 200, 150, 20); + add.setBounds(20, 225, 175, 20); + // set bounds of tracklist + trackListA.setBounds(145, 30, 120, 20); + // set bounds of ok and cancelbutton + cancelButton.setBounds(75, 265, 80, 30); + okButton.setBounds(195, 265, 60, 30); + + setResizable(false); + pack(); + setSize(340,350); + setLocationRelativeTo(Moosique.getGUI()); + setVisible(true); + } + private void makeTextDialog(Container pane, String filename) { setTitle("User Manual"); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); diff --git a/MooMenu.java b/MooMenu.java index 0401547..9062f2d 100644 --- a/MooMenu.java +++ b/MooMenu.java @@ -224,6 +224,7 @@ public class MooMenu extends JMenuBar implements ActionListener { MooDialog newDialog = new MooDialog(MooDialog.SET_TEMPO); } else if (command == "Scale velocity...") { + MooDialog newDialog = new MooDialog(MooDialog.SCALE_VELOCITY); } else if (command == "Transpose...") { MooDialog newDialog = new MooDialog(MooDialog.TRANSPOSE); -- 2.39.2