Subversion Repositories svn.mios

Rev

Rev 303 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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