Subversion Repositories svn.mios

Rev

Rev 250 | 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.lead;
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;
628 adamjking 32
import org.midibox.sidedit.gui.WTTable;
33
import org.midibox.sidedit.gui.controls.SIDSysexParameterControlGUI;
213 tk 34
 
628 adamjking 35
public class WTGUI extends JPanel {
213 tk 36
    protected WTGUI(Vector WTGUIv) {
37
        setLayout(new BorderLayout());
38
        this.setOpaque(false);
628 adamjking 39
 
213 tk 40
        JPanel panel1 = new JPanel();
246 rutgerv 41
        panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));
213 tk 42
        panel1.setOpaque(false);
628 adamjking 43
 
213 tk 44
        JPanel panel2 = new JPanel();
628 adamjking 45
        panel2.setLayout(new GridLayout(4, 1));
213 tk 46
        panel2.setOpaque(false);
628 adamjking 47
 
48
        panel2.add(createWTE(WTGUIv, "Wavetable 1", 0));
49
        panel2.add(createWTE(WTGUIv, "Wavetable 2", 9));
50
        panel2.add(createWTE(WTGUIv, "Wavetable 3", 18));
51
        panel2.add(createWTE(WTGUIv, "Wavetable 4", 27));
52
 
213 tk 53
        panel1.add(panel2);
628 adamjking 54
        // panel1.add(createWTC(WTGUIv,"Wavetable"));
55
        panel1.add(createWTC2(WTGUIv, "Wavetable data"));
56
        this.add(panel1, BorderLayout.NORTH);
213 tk 57
    }
628 adamjking 58
 
59
    protected JPanel createWTE(Vector vGUI, String s, int offset) {
213 tk 60
        JPanel wtePanel = new JPanel();
61
        wtePanel.setLayout(new BoxLayout(wtePanel, BoxLayout.X_AXIS));
62
        wtePanel.setBorder(BorderFactory.createEtchedBorder());
63
        wtePanel.setBorder(BorderFactory.createTitledBorder(s));
64
        wtePanel.setOpaque(false);
628 adamjking 65
 
66
        wtePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(3 + offset));
67
 
68
        JPanel subPanel = new JPanel(new GridLayout(2, 4));
213 tk 69
        subPanel.setOpaque(false);
628 adamjking 70
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(4 + offset));
71
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(6 + offset));
72
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(7 + offset));
73
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(0 + offset));
74
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(1 + offset));
75
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(2 + offset));
76
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(5 + offset));
77
        subPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(8 + offset));
213 tk 78
        wtePanel.add(subPanel);
628 adamjking 79
 
213 tk 80
        return wtePanel;
628 adamjking 81
    }
213 tk 82
 
628 adamjking 83
    protected JPanel createWTC(Vector vGUI, String s) {
213 tk 84
        JPanel wtcPanel = new JPanel();
628 adamjking 85
        wtcPanel.setLayout(new GridLayout(3, 43));
213 tk 86
        wtcPanel.setBorder(BorderFactory.createEtchedBorder());
87
        wtcPanel.setBorder(BorderFactory.createTitledBorder(s));
88
        wtcPanel.setOpaque(false);
628 adamjking 89
        for (int c = 0; c < 128; c++) {
90
            wtcPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(36 + c));
213 tk 91
        }
92
        return wtcPanel;
93
    }
628 adamjking 94
 
95
    protected JPanel createWTC2(Vector vGUI, String s) {
213 tk 96
        JPanel wtcPanel = new JPanel();
97
        wtcPanel.setBorder(BorderFactory.createEtchedBorder());
98
        wtcPanel.setBorder(BorderFactory.createTitledBorder(s));
628 adamjking 99
        wtcPanel.setOpaque(false);
100
 
245 rutgerv 101
        Vector v = new Vector();
628 adamjking 102
        for (int c = 0; c < 128; c++) {
103
            v.add(((SIDSysexParameterControlGUI) vGUI.elementAt(36 + c))
104
                    .getMidiParameter());
245 rutgerv 105
        }
628 adamjking 106
 
245 rutgerv 107
        // Setup the parameters that control begin, end and loop
108
        SIDSysexParameterControl[][] config = new SIDSysexParameterControl[4][3];
628 adamjking 109
        config[0][0] = (((SIDSysexParameterControlGUI) vGUI.elementAt(4))
110
                .getMidiParameter());
111
        config[0][1] = (((SIDSysexParameterControlGUI) vGUI.elementAt(6))
112
                .getMidiParameter());
113
        config[0][2] = (((SIDSysexParameterControlGUI) vGUI.elementAt(7))
114
                .getMidiParameter());
115
        config[1][0] = (((SIDSysexParameterControlGUI) vGUI.elementAt(4 + 9))
116
                .getMidiParameter());
117
        config[1][1] = (((SIDSysexParameterControlGUI) vGUI.elementAt(6 + 9))
118
                .getMidiParameter());
119
        config[1][2] = (((SIDSysexParameterControlGUI) vGUI.elementAt(7 + 9))
120
                .getMidiParameter());
121
        config[2][0] = (((SIDSysexParameterControlGUI) vGUI.elementAt(4 + 18))
122
                .getMidiParameter());
123
        config[2][1] = (((SIDSysexParameterControlGUI) vGUI.elementAt(6 + 18))
124
                .getMidiParameter());
125
        config[2][2] = (((SIDSysexParameterControlGUI) vGUI.elementAt(7 + 18))
126
                .getMidiParameter());
127
        config[3][0] = (((SIDSysexParameterControlGUI) vGUI.elementAt(4 + 27))
128
                .getMidiParameter());
129
        config[3][1] = (((SIDSysexParameterControlGUI) vGUI.elementAt(6 + 27))
130
                .getMidiParameter());
131
        config[3][2] = (((SIDSysexParameterControlGUI) vGUI.elementAt(7 + 27))
132
                .getMidiParameter());
133
 
245 rutgerv 134
        wtcPanel.add(new WTTable(4, v, config));
213 tk 135
        return wtcPanel;
136
    }
137
}