Subversion Repositories svn.mios

Rev

Rev 213 | Rev 628 | 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.bassline;
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.SIDEditController;
32
import  org.midibox.sidedit.gui.controls.*;
33
public class OscillatorGUI extends JPanel{
34
    protected OscillatorGUI(Vector V1GUIv, Vector V2GUIv, Vector masterLeftGUIv, Vector masterRightGUIv) {
35
        setLayout(new BorderLayout());
36
        this.setOpaque(false);
37
 
38
        JPanel panel = new JPanel();
39
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
40
        panel.setOpaque(false);
41
 
42
        JPanel panel1 = new JPanel();
43
        panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));
44
        panel1.setOpaque(false);
45
 
46
        JPanel panel2 = new JPanel();
47
        panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS));
48
        panel2.setOpaque(false);
49
 
50
        panel2.add(createVoice(V1GUIv,"Voice 1 (left)"));
505 rutgerv 51
        panel2.add(createSlaveVoice(masterLeftGUIv,0,"Voice 2 (left)"));
52
        panel2.add(createSlaveVoice(masterLeftGUIv,4,"Voice 3 (left)"));
213 tk 53
 
54
        JPanel panel3 = new JPanel();
55
        panel3.setLayout(new BoxLayout(panel3, BoxLayout.Y_AXIS));
56
        panel3.setOpaque(false);
57
 
505 rutgerv 58
        panel3.add(createVoice(V2GUIv,"Voice 4 (right)"));
59
        panel3.add(createSlaveVoice(masterRightGUIv,0,"Voice 5 (right)"));
60
        panel3.add(createSlaveVoice(masterRightGUIv,4,"Voice 6 (right)"));
213 tk 61
 
62
        panel1.add(panel2);
63
        panel1.add(panel3);
64
 
65
        JPanel globPanel = new JPanel();
66
        globPanel.setLayout(new BoxLayout(globPanel, BoxLayout.Y_AXIS));
67
        globPanel.setOpaque(false);
68
 
69
        panel.add(createGlob(masterLeftGUIv, masterRightGUIv));    
70
        panel.add(panel1);
71
        this.add(panel, BorderLayout.NORTH);
72
    }
73
 
74
    protected JPanel createGlob(Vector vGUIL, Vector vGUIR) {          
75
        JPanel globPanel = new JPanel();
76
        globPanel.setLayout(new GridLayout(1,2));      
77
        globPanel.setOpaque(false);
78
 
79
        JPanel subPanelL = new JPanel();
80
        subPanelL.setLayout(new GridLayout(1,4));
81
        subPanelL.setOpaque(false);
82
        subPanelL.setBorder(BorderFactory.createEtchedBorder());
83
        subPanelL.setBorder(BorderFactory.createTitledBorder("Master Left"));
84
        subPanelL.add((SIDSysexParameterControlGUI) vGUIL.elementAt(0));
85
        subPanelL.add((SIDSysexParameterControlGUI) vGUIL.elementAt(1));
86
        subPanelL.add((SIDSysexParameterControlGUI) vGUIL.elementAt(2));
87
        subPanelL.add((SIDSysexParameterControlGUI) vGUIL.elementAt(3));
88
        globPanel.add(subPanelL);
89
 
90
        JPanel subPanelR = new JPanel();
91
        subPanelR.setLayout(new GridLayout(1,4));
92
        subPanelR.setOpaque(false);
93
        subPanelR.setBorder(BorderFactory.createEtchedBorder());
94
        subPanelR.setBorder(BorderFactory.createTitledBorder("Master Right"));
95
        subPanelR.add((SIDSysexParameterControlGUI) vGUIR.elementAt(0));
96
        subPanelR.add((SIDSysexParameterControlGUI) vGUIR.elementAt(1));
97
        subPanelR.add((SIDSysexParameterControlGUI) vGUIR.elementAt(2));
98
        subPanelR.add((SIDSysexParameterControlGUI) vGUIR.elementAt(3));
99
        globPanel.add(subPanelR);
100
 
101
        return globPanel;
102
    }
103
 
104
    protected JPanel createVoice(Vector vGUI, String s) {
105
 
106
        JPanel voicePanel = new JPanel();
107
        voicePanel.setLayout(new BoxLayout(voicePanel, BoxLayout.X_AXIS));
108
        voicePanel.setBorder(BorderFactory.createEtchedBorder());
109
        voicePanel.setBorder(BorderFactory.createTitledBorder(s));
110
        voicePanel.setOpaque(false);
111
 
112
        JPanel subPanel1 = new JPanel();
113
        subPanel1.setLayout(new BoxLayout(subPanel1, BoxLayout.Y_AXIS));
114
        subPanel1.setOpaque(false);
115
 
116
        JPanel subPanel2 = new JPanel();
117
        subPanel2.setLayout(new BoxLayout(subPanel2, BoxLayout.Y_AXIS));
118
        subPanel2.setOpaque(false);
119
 
120
        // Waveform selection
121
        subPanel1.add((SIDSysexParameterControlGUI) vGUI.elementAt(2));
122
 
123
        // Tuning Panel
124
        JPanel tunePanel = new JPanel();
125
        tunePanel.setLayout(new GridLayout(2,3));
126
        tunePanel.setOpaque(false);
127
        tunePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(10));
128
        tunePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(11));
129
        tunePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(12));
130
        tunePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(7));
131
        tunePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(8));
132
        tunePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(13));
133
        subPanel2.add(tunePanel);
134
 
135
        // Portamento Panel
136
        JPanel portaPanel = new JPanel();
137
        portaPanel.setLayout(new BoxLayout(portaPanel, BoxLayout.X_AXIS));
138
        portaPanel.setOpaque(false);
139
 
140
        portaPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(1));
141
        portaPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(0));
142
 
143
        subPanel2.add(portaPanel);
144
 
145
        // Envelope Panel
146
        JPanel envPanel = new JPanel();
147
        envPanel.setLayout(new BoxLayout(envPanel, BoxLayout.X_AXIS));
148
        envPanel.setOpaque(false);
149
        envPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(9));
150
        envPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(3));
151
        envPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(4));
152
        envPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(5));
153
        envPanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(6));
154
        subPanel1.add(envPanel);
155
 
156
        voicePanel.add(subPanel1);
157
        voicePanel.add(subPanel2);
158
        return voicePanel;
159
    }  
505 rutgerv 160
 
161
protected JPanel createSlaveVoice(Vector vGUI, int offset, String s) {
162
 
163
        JPanel voicePanel = new JPanel();
164
        voicePanel.setLayout(new BoxLayout(voicePanel, BoxLayout.X_AXIS));
165
        voicePanel.setBorder(BorderFactory.createEtchedBorder());
166
        voicePanel.setBorder(BorderFactory.createTitledBorder(s));
167
        voicePanel.setOpaque(false);
168
 
169
        JPanel subPanel1 = new JPanel();
170
        subPanel1.setLayout(new BoxLayout(subPanel1, BoxLayout.Y_AXIS));
171
        subPanel1.setOpaque(false);
172
 
173
        JPanel subPanel2 = new JPanel();
174
        subPanel2.setLayout(new BoxLayout(subPanel2, BoxLayout.Y_AXIS));
175
        subPanel2.setOpaque(false);
176
 
177
        // Waveform selection
178
        subPanel1.add((SIDSysexParameterControlGUI) vGUI.elementAt(4+offset));
179
 
180
        // Tuning Panel
181
        JPanel tunePanel = new JPanel();
182
        tunePanel.setLayout(new GridLayout(1,3));
183
        tunePanel.setOpaque(false);
184
        tunePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(5+offset));
185
        tunePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(6+offset));
186
        tunePanel.add((SIDSysexParameterControlGUI) vGUI.elementAt(7+offset));
187
        subPanel2.add(tunePanel);
188
 
189
        voicePanel.add(subPanel1);
190
        voicePanel.add(subPanel2);
191
        return voicePanel;
192
    }  
213 tk 193
}