/*
* Created on February 10, 2007
*
* Copyright (c) 2007 Jens Gulden
*
* http://www.frinika.com
*
* This file is part of Frinika.
*
* Frinika is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* Frinika is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with Frinika; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.frinika.sequencer.gui.menu.midi;
import com.frinika.gui.OptionsEditor;
import com.frinika.sequencer.gui.NoteSelector;
import javax.swing.JPanel;
/**
* GUI-component for setting options of a MidiReverseAction.
*
* (Created with NetBeans 5.5 gui-editor, see corresponding .form file.)
*
* @see MidiReverseAction
* @author Jens Gulden
*/
class MidiReverseActionEditor extends JPanel implements OptionsEditor {
private MidiReverseAction action;
private NoteSelector mirrorNoteSelector;
/** Creates new form MidiReverseActionEditor */
public MidiReverseActionEditor(MidiReverseAction action) {
this.action = action;
initComponents();
mirrorNoteSelector = new NoteSelector(action.note);
mirrorNoteSelectorPanel.add(mirrorNoteSelector);
}
// some older code makes still a lot use of listeners and direct initializaion of values
// in dialogs - this is deprecated
// Instead: refresh / update via interface OptionsEditor
public void refresh() {
notesCheckBox.setSelected(action.notes);
startsCheckBox.setSelected(action.starts);
durationsCheckBox.setSelected(action.durations);
velocitiesCheckBox.setSelected(action.velocities);
controllersCheckBox.setSelected(action.controllers);
mirrorCheckBox.setSelected(action.mirror);
mirrorNoteSelector.setNote(action.note);
mirrorQuarterCheckBox.setSelected(action.mirrorQuarter);
}
public void update() {
action.notes = notesCheckBox.isSelected();
action.starts = startsCheckBox.isSelected();
action.durations = durationsCheckBox.isSelected();
action.velocities = velocitiesCheckBox.isSelected();
action.controllers = controllersCheckBox.isSelected();
action.mirror = mirrorCheckBox.isSelected();
action.note = mirrorNoteSelector.getNote();
action.mirrorQuarter = mirrorQuarterCheckBox.isSelected();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jLabel1 = new javax.swing.JLabel();
notesCheckBox = new javax.swing.JCheckBox();
startsCheckBox = new javax.swing.JCheckBox();
durationsCheckBox = new javax.swing.JCheckBox();
velocitiesCheckBox = new javax.swing.JCheckBox();
controllersCheckBox = new javax.swing.JCheckBox();
jPanel1 = new javax.swing.JPanel();
mirrorCheckBox = new javax.swing.JCheckBox();
mirrorNoteSelectorPanel = new javax.swing.JPanel();
mirrorQuarterCheckBox = new javax.swing.JCheckBox();
setLayout(new java.awt.GridBagLayout());
jLabel1.setText("Reverse...");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
add(jLabel1, gridBagConstraints);
notesCheckBox.setText("Notes");
notesCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
notesCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
add(notesCheckBox, gridBagConstraints);
startsCheckBox.setText("Starting Times");
startsCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
startsCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
add(startsCheckBox, gridBagConstraints);
durationsCheckBox.setText("Durations");
durationsCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
durationsCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
add(durationsCheckBox, gridBagConstraints);
velocitiesCheckBox.setText("Velocity");
velocitiesCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
velocitiesCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
add(velocitiesCheckBox, gridBagConstraints);
controllersCheckBox.setText("Controllers");
controllersCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
controllersCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
add(controllersCheckBox, gridBagConstraints);
jPanel1.setLayout(new java.awt.GridBagLayout());
mirrorCheckBox.setText("Mirror vertically at");
mirrorCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
mirrorCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
mirrorCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
mirrorCheckBoxStateChanged(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
jPanel1.add(mirrorCheckBox, gridBagConstraints);
mirrorNoteSelectorPanel.setLayout(new java.awt.GridBagLayout());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
jPanel1.add(mirrorNoteSelectorPanel, gridBagConstraints);
mirrorQuarterCheckBox.setText("+1/4");
mirrorQuarterCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
mirrorQuarterCheckBox.setEnabled(false);
mirrorQuarterCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
jPanel1.add(mirrorQuarterCheckBox, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
add(jPanel1, gridBagConstraints);
}// </editor-fold>//GEN-END:initComponents
private void mirrorCheckBoxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_mirrorCheckBoxStateChanged
boolean b = mirrorCheckBox.isSelected();
mirrorQuarterCheckBox.setEnabled(b);
}//GEN-LAST:event_mirrorCheckBoxStateChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JCheckBox controllersCheckBox;
private javax.swing.JCheckBox durationsCheckBox;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JCheckBox mirrorCheckBox;
private javax.swing.JPanel mirrorNoteSelectorPanel;
private javax.swing.JCheckBox mirrorQuarterCheckBox;
private javax.swing.JCheckBox notesCheckBox;
private javax.swing.JCheckBox startsCheckBox;
private javax.swing.JCheckBox velocitiesCheckBox;
// End of variables declaration//GEN-END:variables
}