Subversion Repositories svn.mios

Rev

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