Subversion Repositories svn.mios

Rev

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

Rev 250 Rev 628
Line 19... Line 19...
19
 */
19
 */
20
20
21
package org.midibox.sidedit.gui.drum;
21
package org.midibox.sidedit.gui.drum;
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;
25
import java.awt.FlowLayout;
26
import java.awt.Font;
26
import java.awt.Font;
27
import java.awt.GridBagConstraints;
27
import java.awt.GridBagConstraints;
28
import java.awt.GridBagLayout;
28
import java.awt.GridBagLayout;
29
import java.awt.GridLayout;
-
 
30
import java.awt.Dimension;
-
 
31
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.JComboBox;
35
import javax.swing.JComboBox;
40
import javax.swing.JLabel;
36
import javax.swing.JLabel;
41
import javax.swing.JPanel;
37
import javax.swing.JPanel;
42
import javax.swing.JSlider;
-
 
43
import javax.swing.JToggleButton;
-
 
44
38
45
import org.midibox.sidedit.SIDEditController;
-
 
46
import org.midibox.sidedit.SIDSysexInfo;
-
 
47
import org.midibox.sidedit.SIDSysexParameterControl;
39
import org.midibox.sidedit.SIDSysexParameterControl;
48
import org.midibox.utils.gui.ImageLoader;
-
 
49
import org.midibox.utils.gui.JVertLabel;
-
 
50
import org.midibox.utils.gui.Knob;
-
 
51
import org.midibox.utils.gui.MyButtonUI;
-
 
52
import  org.midibox.sidedit.gui.controls.*;
40
import org.midibox.sidedit.gui.SequencerButton;
53
import org.midibox.sidedit.gui.lead.LeadGUI;
41
import org.midibox.sidedit.gui.controls.SIDSysexParameterControlGUI;
54
import org.midibox.sidedit.gui.*;
-
 
-
 
42
55
public class SequencerGUI extends JPanel implements ActionListener{
43
public class SequencerGUI extends JPanel implements ActionListener {
56
    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;
57
    private JComboBox combo;
46
    private JComboBox combo;
58
    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 };
59
   
48
60
    protected SequencerGUI(Vector V1GUIv, Vector V2GUIv) {
49
    protected SequencerGUI(Vector V1GUIv, Vector V2GUIv) {
61
        setLayout(new BorderLayout());
50
        setLayout(new BorderLayout());
Line 71... Line 60...
71
        seqPanel.setBorder(BorderFactory.createTitledBorder("Sequencer data"));
60
        seqPanel.setBorder(BorderFactory.createTitledBorder("Sequencer data"));
72
        seqPanel.setOpaque(false);
61
        seqPanel.setOpaque(false);
73
       
62
74
        JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
63
        JPanel comboPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
75
        comboPanel.setOpaque(false);
64
        comboPanel.setOpaque(false);
-
 
65
        String[] s = { "Sequence #1", "Sequence #2", "Sequence #3",
76
        String[] s = {"Sequence #1","Sequence #2","Sequence #3","Sequence #4","Sequence #5","Sequence #6","Sequence #7","Sequence #8"};
66
                "Sequence #4", "Sequence #5", "Sequence #6", "Sequence #7",
-
 
67
                "Sequence #8" };
77
        combo = new JComboBox(s);
68
        combo = new JComboBox(s);
78
        combo.setPreferredSize(new Dimension(110,20));
69
        combo.setPreferredSize(new Dimension(110, 20));
79
        combo.setFont(new Font("sansserif", Font.BOLD, 11));
70
        combo.setFont(new Font("sansserif", Font.BOLD, 11));
80
        combo.addActionListener(this);
71
        combo.addActionListener(this);
81
        comboPanel.add(combo);
72
        comboPanel.add(combo);
Line 123... Line 114...
123
        c.anchor = GridBagConstraints.CENTER;
114
        c.anchor = GridBagConstraints.CENTER;
124
       
115
125
        // Loop over all channels
116
        // Loop over all channels
126
        for(int chan=0;chan<8;chan++) {
117
        for (int chan = 0; chan < 8; chan++) {
127
            // Dummy panel to fill
118
            // Dummy panel to fill
-
 
119
            c.gridx = 0;
128
            c.gridx = 0;c.gridy = (2*chan)+2;c.gridheight=1;
120
            c.gridy = (2 * chan) + 2;
-
 
121
            c.gridheight = 1;
129
            JPanel transp = new JPanel();
122
            JPanel transp = new JPanel();
130
            transp.setOpaque(false);
123
            transp.setOpaque(false);
131
            chanPanel.add(transp, c);
124
            chanPanel.add(transp, c);
132
           
125
133
            // Row labels
126
            // Row labels
134
            c.gridwidth=2;
127
            c.gridwidth = 2;
-
 
128
            if (chan == 0) {
-
 
129
                c.gridx = 0;
-
 
130
                c.gridy = (2 * chan);
135
            if(chan==0) {c.gridx = 0;c.gridy = (2*chan); chanPanel.add(createSeqLabel("Step"), c);}
131
                chanPanel.add(createSeqLabel("Step"), c);
-
 
132
            }
-
 
133
            c.gridx = 0;
136
            c.gridx = 0;c.gridy = (2*chan)+1;
134
            c.gridy = (2 * chan) + 1;
137
            chanPanel.add(createSeqLabel("Chan."+Integer.toString(chan+1)), c);
135
            chanPanel.add(createSeqLabel("Chan." + Integer.toString(chan + 1)),
-
 
136
                    c);
138
            c.gridwidth=1;
137
            c.gridwidth = 1;
139
           
138
140
            int offset = (32*chan) + (seqNr*256) ; 
139
            int offset = (32 * chan) + (seqNr * 256);
141
            for(int col=0;col<16;col++) {              
140
            for (int col = 0; col < 16; col++) {
142
                // Column labels
141
                // Column labels
143
                if (chan==0) {
142
                if (chan == 0) {
144
                    JLabel label = new JLabel(Integer.toString(col+1));
143
                    JLabel label = new JLabel(Integer.toString(col + 1));
145
                    label.setHorizontalAlignment(JLabel.CENTER);
144
                    label.setHorizontalAlignment(JLabel.CENTER);
146
                    label.setFont(new Font("serif",Font.BOLD,10));
145
                    label.setFont(new Font("serif", Font.BOLD, 10));
147
                    label.setOpaque(false);
146
                    label.setOpaque(false);
-
 
147
                    c.gridx = col + 2;
148
                    c.gridx = col+2;c.gridy = (2*chan);
148
                    c.gridy = (2 * chan);
149
                    chanPanel.add(label, c);
149
                    chanPanel.add(label, c);
150
                }
150
                }
151
               
151
152
                // Buttons
152
                // Buttons
-
 
153
                c.gridx = col + 2;
153
                c.gridx = col+2;c.gridy = 1+(2*chan);              
154
                c.gridy = 1 + (2 * chan);
154
                SIDSysexParameterControl mp1 = ((SIDSysexParameterControlGUI) vGUI.elementAt(0+offset+col)).getMidiParameter();
155
                SIDSysexParameterControl mp1 = ((SIDSysexParameterControlGUI) vGUI
-
 
156
                        .elementAt(0 + offset + col)).getMidiParameter();
155
                SIDSysexParameterControl mp2 = ((SIDSysexParameterControlGUI) vGUI.elementAt(0+offset+col+16)).getMidiParameter();             
157
                SIDSysexParameterControl mp2 = ((SIDSysexParameterControlGUI) vGUI
-
 
158
                        .elementAt(0 + offset + col + 16)).getMidiParameter();
156
                chanPanel.add(new SequencerButton(mp1, mp2), c);               
159
                chanPanel.add(new SequencerButton(mp1, mp2), c);
157
            }      
160
            }
158
        }
161
        }
159
        return chanPanel;  
162
        return chanPanel;
160
    }  
163
    }