Subversion Repositories svn.mios

Rev

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

Rev 505 Rev 628
Line 19... Line 19...
19
 */
19
 */
20
20
21
package org.midibox.sidedit.gui.bassline;
21
package org.midibox.sidedit.gui.bassline;
22
22
23
import java.awt.BorderLayout;
23
import java.awt.BorderLayout;
24
import java.awt.event.*;
24
import java.awt.Dimension;
25
import java.awt.FlowLayout;
-
 
26
import java.awt.Font;
25
import java.awt.Font;
27
import java.awt.GridBagConstraints;
26
import java.awt.GridBagConstraints;
28
import java.awt.GridBagLayout;
27
import java.awt.GridBagLayout;
29
import java.awt.GridLayout;
-
 
30
import java.awt.Dimension;
-
 
31
import java.awt.GridLayout;
28
import java.awt.GridLayout;
32
import java.awt.event.ActionEvent;
29
import java.awt.event.ActionEvent;
33
import java.awt.event.ActionListener;
30
import java.awt.event.ActionListener;
34
import java.util.Vector;
31
import java.util.Vector;
35
32
36
import javax.swing.AbstractButton;
-
 
37
import javax.swing.BorderFactory;
33
import javax.swing.BorderFactory;
38
import javax.swing.BoxLayout;
34
import javax.swing.BoxLayout;
39
import javax.swing.ButtonGroup;
35
import javax.swing.ButtonGroup;
40
import javax.swing.JComboBox;
-
 
41
import javax.swing.JLabel;
36
import javax.swing.JLabel;
42
import javax.swing.JPanel;
37
import javax.swing.JPanel;
43
import javax.swing.JSlider;
-
 
44
import javax.swing.JToggleButton;
-
 
45
-
 
46
import org.midibox.sidedit.SIDEditController;
-
 
47
import org.midibox.sidedit.SIDSysexInfo;
-
 
48
import org.midibox.sidedit.SIDSysexParameterControl;
-
 
49
import org.midibox.utils.gui.ImageLoader;
-
 
50
import org.midibox.utils.gui.JVertLabel;
-
 
51
import org.midibox.utils.gui.Knob;
-
 
52
import org.midibox.utils.gui.MyButtonUI;
-
 
53
import  org.midibox.sidedit.gui.controls.*;
-
 
54
import org.midibox.sidedit.gui.lead.LeadGUI;
-
 
55
import javax.swing.JRadioButton;
38
import javax.swing.JRadioButton;
-
 
39
-
 
40
import org.midibox.sidedit.gui.controls.SIDSysexParameterControlGUI;
-
 
41
import org.midibox.sidedit.gui.controls.SIDSysexParameterControlKnob;
56
42
57
public class SequencerGUI extends JPanel implements ActionListener{
43
public class SequencerGUI extends JPanel implements ActionListener {
58
    private JPanel seqPanel,currentPanel,seq1,seq2,seq3,seq4,seq5,seq6,seq7,seq8;
44
    private JPanel seqPanel, currentPanel, seq1, seq2, seq3, seq4, seq5, seq6,
-
 
45
            seq7, seq8;
59
    private JRadioButton radioButtons[];
46
    private JRadioButton radioButtons[];
60
    private int[] snapvals = {0,1,2,3,4,5,6,7,8,9,10,11,12};
47
    private int[] snapvals = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
61
   
48
62
    protected SequencerGUI(Vector V1GUIv, Vector V2GUIv, Vector V3GUIv) {
49
    protected SequencerGUI(Vector V1GUIv, Vector V2GUIv, Vector V3GUIv) {
63
        setLayout(new BorderLayout());
50
        setLayout(new BorderLayout());
Line 70... Line 57...
70
        seqPanel = new JPanel();
57
        seqPanel = new JPanel();
71
        seqPanel.setLayout(new BoxLayout(seqPanel, BoxLayout.X_AXIS));
58
        seqPanel.setLayout(new BoxLayout(seqPanel, BoxLayout.X_AXIS));
72
        seqPanel.setBorder(BorderFactory.createEtchedBorder());
59
        seqPanel.setBorder(BorderFactory.createEtchedBorder());
73
        seqPanel.setBorder(BorderFactory.createTitledBorder("Sequencer data"));
60
        seqPanel.setBorder(BorderFactory.createTitledBorder("Sequencer data"));
74
        seqPanel.setOpaque(false);
61
        seqPanel.setOpaque(false);
75
       
-
 
76
       
62
77
        JPanel comboPanel = new JPanel();
63
        JPanel comboPanel = new JPanel();
78
        comboPanel.setLayout(new BoxLayout(comboPanel, BoxLayout.Y_AXIS));
64
        comboPanel.setLayout(new BoxLayout(comboPanel, BoxLayout.Y_AXIS));
79
        comboPanel.setOpaque(false);       
65
        comboPanel.setOpaque(false);
-
 
66
        String[] s = { "Sequence #1", "Sequence #2", "Sequence #3",
80
        String[] s = {"Sequence #1","Sequence #2","Sequence #3","Sequence #4","Sequence #5","Sequence #6","Sequence #7","Sequence #8"};
67
                "Sequence #4", "Sequence #5", "Sequence #6", "Sequence #7",
-
 
68
                "Sequence #8" };
81
        ButtonGroup bg = new ButtonGroup();
69
        ButtonGroup bg = new ButtonGroup();
82
        radioButtons = new JRadioButton[s.length];
70
        radioButtons = new JRadioButton[s.length];
83
        for (int i=0;i<s.length;i++) {         
71
        for (int i = 0; i < s.length; i++) {
84
            radioButtons[i] = new JRadioButton(s[i], true);
72
            radioButtons[i] = new JRadioButton(s[i], true);
85
            radioButtons[i].setOpaque(false);
73
            radioButtons[i].setOpaque(false);
Line 87... Line 75...
87
            bg.add(radioButtons[i]);
75
            bg.add(radioButtons[i]);
88
            comboPanel.add(radioButtons[i]);
76
            comboPanel.add(radioButtons[i]);
89
        }  
77
        }
90
       
78
91
        seqPanel.add(comboPanel);
79
        seqPanel.add(comboPanel);
92
       
-
 
93
               
80
94
        seq1 = createSeqData(V1GUIv,0);
81
        seq1 = createSeqData(V1GUIv, 0);
95
        seq2 = createSeqData(V1GUIv,96);
82
        seq2 = createSeqData(V1GUIv, 96);
96
        seq3 = createSeqData(V1GUIv,192);
83
        seq3 = createSeqData(V1GUIv, 192);
97
        seq4 = createSeqData(V1GUIv,288);
84
        seq4 = createSeqData(V1GUIv, 288);
Line 133... Line 120...
133
        seqPanel.setLayout(new GridBagLayout());       
120
        seqPanel.setLayout(new GridBagLayout());
134
        seqPanel.setOpaque(false);
121
        seqPanel.setOpaque(false);
135
        GridBagConstraints c = new GridBagConstraints();       
122
        GridBagConstraints c = new GridBagConstraints();
136
        c.fill = GridBagConstraints.HORIZONTAL;    
123
        c.fill = GridBagConstraints.HORIZONTAL;
137
       
124
138
        String[] names = {"Step","Note","Octave","Param","Glide","Accent","Gate"};
125
        String[] names = { "Step", "Note", "Octave", "Param", "Glide",
-
 
126
                "Accent", "Gate" };
139
        for(int row=0;row<7;row++) {
127
        for (int row = 0; row < 7; row++) {
140
            c.gridx = 0;
128
            c.gridx = 0;
141
            c.gridy = row;
129
            c.gridy = row;
142
            JLabel label = new JLabel(names[row]);
130
            JLabel label = new JLabel(names[row]);
143
            label.setVerticalAlignment(JLabel.CENTER);
131
            label.setVerticalAlignment(JLabel.CENTER);
Line 158... Line 146...
158
        }
146
        }
159
        for(int col=0;col<16;col++) {
147
        for (int col = 0; col < 16; col++) {
160
            for(int row=0;row<6;row++) {
148
            for (int row = 0; row < 6; row++) {
161
                c.gridx = col+1;
149
                c.gridx = col + 1;
162
                c.gridy = row+1;
150
                c.gridy = row + 1;
163
                seqPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(row+(6*col)+offset), c);             
151
                seqPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(row
-
 
152
                        + (6 * col) + offset), c);
164
                if (row==0) {
153
                if (row == 0) {
165
                    ((SIDSysexParameterControlKnob) vGUI.elementAt(row+(6*col)+offset)).setSnapvals(snapvals);
154
                    ((SIDSysexParameterControlKnob) vGUI.elementAt(row
-
 
155
                            + (6 * col) + offset)).setSnapvals(snapvals);
166
                    ((SIDSysexParameterControlKnob) vGUI.elementAt(row+(6*col)+offset)).setSnap(true);
156
                    ((SIDSysexParameterControlKnob) vGUI.elementAt(row
-
 
157
                            + (6 * col) + offset)).setSnap(true);
167
                }
158
                }
168
            }
159
            }
169
        }      
160
        }
170
        return seqPanel;
161
        return seqPanel;
171
    }  
162
    }
172
   
163
173
    public void actionPerformed(ActionEvent ae) {
164
    public void actionPerformed(ActionEvent ae) {
174
        for (int i=1;i<radioButtons.length;i++) {
165
        for (int i = 1; i < radioButtons.length; i++) {
175
            if ((ae.getSource()==radioButtons[i]) && (radioButtons[i].isSelected())) {
166
            if ((ae.getSource() == radioButtons[i])
-
 
167
                    && (radioButtons[i].isSelected())) {
176
                seqPanel.remove(currentPanel);
168
                seqPanel.remove(currentPanel);
177
                switch (i) {
169
                switch (i) {
178
                case 0:                
170
                case 0:
179
                    currentPanel = seq1;
171
                    currentPanel = seq1;
180
                    break;
172
                    break;