Subversion Repositories svn.mios

Rev

Rev 303 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
213 tk 1
/*
2
 * @(#)SIDV2librarian.java  beta1   2008/01/21
3
 *
4
 * Copyright (C) 2008    Rutger Vlek (rutgervlek@hotmail.com)
5
 *
6
 * This application is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This application is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
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
19
 */
20
 
21
package org.midibox.sidedit.gui.multi;
22
 
23
import java.awt.BorderLayout;
24
import java.awt.GridLayout;
25
import java.util.Vector;
26
 
27
import javax.swing.BorderFactory;
28
import javax.swing.BoxLayout;
29
import javax.swing.JPanel;
30
 
31
import org.midibox.sidedit.SIDSysexParameterControl;
255 rutgerv 32
import org.midibox.sidedit.gui.WTTable;
628 adamjking 33
import org.midibox.sidedit.gui.controls.SIDSysexParameterControlGUI;
34
 
35
public class WTGUI extends JPanel {
36
    protected WTGUI(Vector WTGUIv, Vector inst1, Vector inst2, Vector inst3,
37
            Vector inst4, Vector inst5, Vector inst6) {
213 tk 38
        setLayout(new BorderLayout());
39
        this.setOpaque(false);
628 adamjking 40
 
213 tk 41
        JPanel panel1 = new JPanel();
42
        panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS));
43
        panel1.setOpaque(false);
303 tk 44
 
45
        JPanel panel2 = new JPanel();
628 adamjking 46
        panel2.setLayout(new GridLayout(1, 2));
303 tk 47
        panel2.setOpaque(false);
628 adamjking 48
 
303 tk 49
        JPanel panel3 = new JPanel();
628 adamjking 50
        panel3.setLayout(new GridLayout(6, 1));
303 tk 51
        panel3.setOpaque(false);
628 adamjking 52
 
53
        panel3.add(createWTE(inst1, "Wavetable 1", 41));
54
        panel3.add(createWTE(inst2, "Wavetable 2", 41));
55
        panel3.add(createWTE(inst3, "Wavetable 3", 41));
56
        panel3.add(createWTE(inst4, "Wavetable 4", 41));
57
        panel3.add(createWTE(inst5, "Wavetable 5", 41));
58
        panel3.add(createWTE(inst6, "Wavetable 6", 41));
59
 
303 tk 60
        panel2.add(panel3);
628 adamjking 61
 
255 rutgerv 62
        // Setup the parameters that control begin, end and loop
63
        SIDSysexParameterControl[][] config = new SIDSysexParameterControl[6][3];
628 adamjking 64
        config[0][0] = (((SIDSysexParameterControlGUI) inst1.elementAt(45))
65
                .getMidiParameter());
66
        config[0][1] = (((SIDSysexParameterControlGUI) inst1.elementAt(47))
67
                .getMidiParameter());
68
        config[0][2] = (((SIDSysexParameterControlGUI) inst1.elementAt(48))
69
                .getMidiParameter());
70
        config[1][0] = (((SIDSysexParameterControlGUI) inst2.elementAt(45))
71
                .getMidiParameter());
72
        config[1][1] = (((SIDSysexParameterControlGUI) inst2.elementAt(47))
73
                .getMidiParameter());
74
        config[1][2] = (((SIDSysexParameterControlGUI) inst2.elementAt(48))
75
                .getMidiParameter());
76
        config[2][0] = (((SIDSysexParameterControlGUI) inst3.elementAt(45))
77
                .getMidiParameter());
78
        config[2][1] = (((SIDSysexParameterControlGUI) inst3.elementAt(47))
79
                .getMidiParameter());
80
        config[2][2] = (((SIDSysexParameterControlGUI) inst3.elementAt(48))
81
                .getMidiParameter());
82
        config[3][0] = (((SIDSysexParameterControlGUI) inst4.elementAt(45))
83
                .getMidiParameter());
84
        config[3][1] = (((SIDSysexParameterControlGUI) inst4.elementAt(47))
85
                .getMidiParameter());
86
        config[3][2] = (((SIDSysexParameterControlGUI) inst4.elementAt(48))
87
                .getMidiParameter());
88
        config[4][0] = (((SIDSysexParameterControlGUI) inst5.elementAt(45))
89
                .getMidiParameter());
90
        config[4][1] = (((SIDSysexParameterControlGUI) inst5.elementAt(47))
91
                .getMidiParameter());
92
        config[4][2] = (((SIDSysexParameterControlGUI) inst5.elementAt(48))
93
                .getMidiParameter());
94
        config[5][0] = (((SIDSysexParameterControlGUI) inst6.elementAt(45))
95
                .getMidiParameter());
96
        config[5][1] = (((SIDSysexParameterControlGUI) inst6.elementAt(47))
97
                .getMidiParameter());
98
        config[5][2] = (((SIDSysexParameterControlGUI) inst6.elementAt(48))
99
                .getMidiParameter());
303 tk 100
 
628 adamjking 101
        panel2.add(createWTC2(WTGUIv, config, "Wavetable data"));
303 tk 102
 
103
        panel1.add(panel2);
628 adamjking 104
 
105
        this.add(panel1, BorderLayout.NORTH);
213 tk 106
    }
628 adamjking 107
 
108
    protected JPanel createWTE(Vector vGUI, String s, int offset) {
303 tk 109
        JPanel wtePanel = new JPanel();
110
        wtePanel.setLayout(new BoxLayout(wtePanel, BoxLayout.X_AXIS));
111
        wtePanel.setBorder(BorderFactory.createEtchedBorder());
112
        wtePanel.setBorder(BorderFactory.createTitledBorder(s));
113
        wtePanel.setOpaque(false);
628 adamjking 114
 
115
        wtePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(3 + offset));
116
 
117
        JPanel subPanel = new JPanel(new GridLayout(1, 5));
303 tk 118
        subPanel.setOpaque(false);
628 adamjking 119
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(4 + offset));
120
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(6 + offset));
121
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(7 + offset));
122
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(0 + offset));
123
        // subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(1+offset));
124
        // // "to Left channel" not available for multi engine!
125
        // subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(2+offset));
126
        // // "to Right channel" not available for multi engine!
127
        // subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(5+offset));
128
        // // "Pos Controlled by MP" not available for multi engine!
129
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(8 + offset));
303 tk 130
        wtePanel.add(subPanel);
628 adamjking 131
 
303 tk 132
        return wtePanel;
133
    }
134
 
628 adamjking 135
    protected JPanel createWTC1(Vector vGUI, String s) {
213 tk 136
        JPanel wtcPanel = new JPanel();
628 adamjking 137
        wtcPanel.setLayout(new GridLayout(3, 43));
213 tk 138
        wtcPanel.setBorder(BorderFactory.createEtchedBorder());
139
        wtcPanel.setBorder(BorderFactory.createTitledBorder(s));
140
        wtcPanel.setOpaque(false);
628 adamjking 141
        for (int c = 0; c < 128; c++) {
142
            wtcPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(c));
213 tk 143
        }
144
        return wtcPanel;
145
    }
628 adamjking 146
 
147
    protected JPanel createWTC2(Vector vGUI,
148
            SIDSysexParameterControl[][] config, String s) {
255 rutgerv 149
        JPanel wtcPanel = new JPanel();
150
        wtcPanel.setBorder(BorderFactory.createEtchedBorder());
151
        wtcPanel.setBorder(BorderFactory.createTitledBorder(s));
628 adamjking 152
        wtcPanel.setOpaque(false);
153
 
255 rutgerv 154
        Vector v = new Vector();
628 adamjking 155
        for (int c = 0; c < 128; c++) {
156
            v.add(((SIDSysexParameterControlGUI) vGUI.elementAt(c))
157
                    .getMidiParameter());
255 rutgerv 158
        }
159
        wtcPanel.add(new WTTable(6, v, config));
160
        return wtcPanel;
161
    }
213 tk 162
}