Subversion Repositories svn.mios

Rev

Rev 272 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 272 Rev 628
Line 17... Line 17...
17
 * along with this application; if not, write to the Free Software
17
 * along with this application; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 */
19
 */
20
20
21
package org.midibox.sidedit.gui.controls;
21
package org.midibox.sidedit.gui.controls;
22
-
 
23
22
24
import java.awt.BorderLayout;
23
import java.awt.BorderLayout;
25
import java.awt.FlowLayout;
24
import java.awt.FlowLayout;
26
import java.awt.event.ActionEvent;
25
import java.awt.event.ActionEvent;
-
 
26
27
import javax.swing.JPanel;
27
import javax.swing.JPanel;
28
import javax.swing.JToggleButton;
28
import javax.swing.JToggleButton;
29
29
30
import org.midibox.sidedit.*;
30
import org.midibox.sidedit.SIDSysexParameterControl;
31
31
32
public class SIDSysexParameterControlToggleButton extends SIDSysexParameterControlGUI {
32
public class SIDSysexParameterControlToggleButton extends
-
 
33
        SIDSysexParameterControlGUI {
33
34
34
    private JToggleButton toggleButton;
35
    private JToggleButton toggleButton;
35
36
36
    private boolean momentary = false;
37
    private boolean momentary = false;
37
   
38
38
    private SIDSysexParameterControlGUI snapGUI = null;
39
    private SIDSysexParameterControlGUI snapGUI = null;
39
40
40
    public SIDSysexParameterControlToggleButton(SIDSysexParameterControl midiParameter,
41
    public SIDSysexParameterControlToggleButton(
-
 
42
            SIDSysexParameterControl midiParameter, JToggleButton toggleButton,
41
            JToggleButton toggleButton, boolean momentary, boolean showLabel,
43
            boolean momentary, boolean showLabel, String labelLocation,
42
            String labelLocation, boolean valueBelow, boolean showValue) {
44
            boolean valueBelow, boolean showValue) {
43
        super(midiParameter, showLabel, labelLocation, valueBelow, showValue);
45
        super(midiParameter, showLabel, labelLocation, valueBelow, showValue);
44
        this.toggleButton = toggleButton;
46
        this.toggleButton = toggleButton;
45
        this.momentary = momentary;
47
        this.momentary = momentary;
46
        JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
48
        JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
47
        panel.setOpaque(false);
49
        panel.setOpaque(false);
Line 61... Line 63...
61
        super.actionPerformed(ae);
63
        super.actionPerformed(ae);
62
64
63
        if (ae.getSource() == toggleButton) {
65
        if (ae.getSource() == toggleButton) {
64
            if (update) {
66
            if (update) {
65
                update = false;
67
                update = false;
66
                midiParameter.setMidiValue((toggleButton.isSelected())?1:0, true);
68
                midiParameter.setMidiValue((toggleButton.isSelected()) ? 1 : 0,
-
 
69
                        true);
67
                for (int c = 0; c < midiParameters.size(); c++) {
70
                for (int c = 0; c < midiParameters.size(); c++) {
68
                    SIDSysexParameterControl mp = (SIDSysexParameterControl) midiParameters.elementAt(c);
71
                    SIDSysexParameterControl mp = (SIDSysexParameterControl) midiParameters
-
 
72
                            .elementAt(c);
69
                    mp.setMidiValue((toggleButton.isSelected())?1:0, false);
73
                    mp.setMidiValue((toggleButton.isSelected()) ? 1 : 0, false);
70
                }
74
                }
71
                if (snapGUI!=null) {
75
                if (snapGUI != null) {
72
                    snapGUI.setSnap(toggleButton.isSelected());
76
                    snapGUI.setSnap(toggleButton.isSelected());
73
                }
77
                }