Subversion Repositories svn.mios

Rev

Rev 272 | Rev 696 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 272 Rev 628
Line 19... Line 19...
19
 */
19
 */
20
20
21
package org.midibox.sidedit.gui.controls;
21
package org.midibox.sidedit.gui.controls;
22
22
23
import java.awt.BorderLayout;
23
import java.awt.BorderLayout;
-
 
24
import java.awt.Dimension;
24
import java.awt.FlowLayout;
25
import java.awt.FlowLayout;
-
 
26
import java.awt.Font;
25
import java.awt.event.ActionEvent;
27
import java.awt.event.ActionEvent;
26
import java.awt.Dimension;
-
 
27
import javax.swing.*;
-
 
28
28
29
import org.midibox.sidedit.*;
29
import javax.swing.JComboBox;
-
 
30
import javax.swing.JPanel;
30
31
31
import java.awt.Font;
32
import org.midibox.sidedit.SIDSysexParameterControl;
32
33
33
public class SIDSysexParameterControlCombo extends SIDSysexParameterControlGUI {
34
public class SIDSysexParameterControlCombo extends SIDSysexParameterControlGUI {
34
35
35
    public static float mouseWheelResolution = 10.0f;
36
    public static float mouseWheelResolution = 10.0f;
36
    private JComboBox combo;
37
    private JComboBox combo;
37
38
-
 
39
    public SIDSysexParameterControlCombo(
38
    public SIDSysexParameterControlCombo(SIDSysexParameterControl midiParameter, JComboBox combo,
40
            SIDSysexParameterControl midiParameter, JComboBox combo,
39
            boolean showLabel, String labelLocation, boolean valueBelow, boolean showValue) {
41
            boolean showLabel, String labelLocation, boolean valueBelow,
-
 
42
            boolean showValue) {
40
        super(midiParameter, showLabel, labelLocation, valueBelow, showValue);
43
        super(midiParameter, showLabel, labelLocation, valueBelow, showValue);
41
        this.combo = combo;
44
        this.combo = combo;
42
        combo.setPreferredSize(new Dimension(110,20));
45
        combo.setPreferredSize(new Dimension(110, 20));
43
        combo.setFont(new Font("sansserif", Font.BOLD, 11));
46
        combo.setFont(new Font("sansserif", Font.BOLD, 11));
44
        JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
47
        JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
Line 55... Line 58...
55
        super.actionPerformed(ae);
58
        super.actionPerformed(ae);
56
59
57
        if (ae.getSource() == combo) {
60
        if (ae.getSource() == combo) {
58
            if (update) {
61
            if (update) {
59
                update = false;
62
                update = false;
60
                int newval = midiParameter.lookUpAlias((String)combo.getSelectedItem());
63
                int newval = midiParameter.lookUpAlias((String) combo
-
 
64
                        .getSelectedItem());
61
                midiParameter.setMidiValue(newval, true);
65
                midiParameter.setMidiValue(newval, true);
62
               
66
63
                for (int c = 0; c < midiParameters.size(); c++) {
67
                for (int c = 0; c < midiParameters.size(); c++) {
64
                    SIDSysexParameterControl mp = (SIDSysexParameterControl) midiParameters.elementAt(c);
68
                    SIDSysexParameterControl mp = (SIDSysexParameterControl) midiParameters
-
 
69
                            .elementAt(c);
65
                    mp.setMidiValue(newval, false);
70
                    mp.setMidiValue(newval, false);
66
                }
71
                }
67
               
72
68
                update = true;
73
                update = true;
69
            }
74
            }
Line 72... Line 77...
72
   
77
73
    public void updateGraphics() {
78
    public void updateGraphics() {
74
        super.updateGraphics();
79
        super.updateGraphics();
75
        if (update) {
80
        if (update) {
76
            update = false;
81
            update = false;
77
            combo.setSelectedIndex(midiParameter.lookUpValue(midiParameter.getMidiValue()));
82
            combo.setSelectedIndex(midiParameter.lookUpValue(midiParameter
-
 
83
                    .getMidiValue()));
78
            update = true;
84
            update = true;
79
        }
85
        }
80
    }
86
    }
81
}
87
}