Subversion Repositories svn.mios

Rev

Rev 304 | 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;
22
 
23
import java.awt.BorderLayout;
24
import java.awt.GridLayout;
628 adamjking 25
import java.util.Vector;
213 tk 26
 
628 adamjking 27
import javax.swing.BorderFactory;
28
import javax.swing.BoxLayout;
29
import javax.swing.JPanel;
213 tk 30
 
628 adamjking 31
import org.midibox.sidedit.gui.controls.SIDSysexParameterControlGUI;
213 tk 32
 
628 adamjking 33
public class GlobalGUI extends JPanel {
213 tk 34
 
35
    public GlobalGUI(Vector globalGUIv, Vector extGUIv) {
36
        setLayout(new BorderLayout());
37
        this.setOpaque(false);
38
 
39
        JPanel panel1 = new JPanel();
40
        panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS));
628 adamjking 41
 
213 tk 42
        panel1.add(createHardware(globalGUIv));
43
        panel1.add(createKnobs(globalGUIv));
44
        panel1.add(createExt(extGUIv));
628 adamjking 45
 
213 tk 46
        panel1.setOpaque(false);
628 adamjking 47
        this.add(panel1, BorderLayout.NORTH);
213 tk 48
    }
49
 
50
    protected JPanel createHardware(Vector midiParameterGUI) {
51
        JPanel hardwarePanel = new JPanel();
52
        hardwarePanel.setLayout(new BoxLayout(hardwarePanel, BoxLayout.X_AXIS));
53
        hardwarePanel.setOpaque(false);
628 adamjking 54
 
213 tk 55
        JPanel subPanel2 = new JPanel();
56
        subPanel2.setLayout(new BoxLayout(subPanel2, BoxLayout.X_AXIS));
57
        subPanel2.setBorder(BorderFactory.createEtchedBorder());
628 adamjking 58
        subPanel2.setBorder(BorderFactory
59
                .createTitledBorder("Hardware Information Flags"));
213 tk 60
        subPanel2.setOpaque(false);
628 adamjking 61
 
62
        subPanel2.add((SIDSysexParameterControlGUI) midiParameterGUI
63
                .elementAt(0));
64
        subPanel2.add((SIDSysexParameterControlGUI) midiParameterGUI
65
                .elementAt(1));
66
        subPanel2.add((SIDSysexParameterControlGUI) midiParameterGUI
67
                .elementAt(2));
68
 
213 tk 69
        JPanel subPanel3 = new JPanel();
70
        subPanel3.setLayout(new BoxLayout(subPanel3, BoxLayout.Y_AXIS));
71
        subPanel3.setBorder(BorderFactory.createEtchedBorder());
628 adamjking 72
        subPanel3.setBorder(BorderFactory
73
                .createTitledBorder("ADSR Bug Workaround"));
213 tk 74
        subPanel3.setOpaque(false);
628 adamjking 75
        subPanel3.add((SIDSysexParameterControlGUI) midiParameterGUI
76
                .elementAt(3));
77
 
213 tk 78
        JPanel subPanel4 = new JPanel();
79
        subPanel4.setLayout(new BoxLayout(subPanel4, BoxLayout.Y_AXIS));
80
        subPanel4.setBorder(BorderFactory.createEtchedBorder());
303 tk 81
        subPanel4.setBorder(BorderFactory.createTitledBorder("Master Volume"));
213 tk 82
        subPanel4.setOpaque(false);
628 adamjking 83
        subPanel4.add((SIDSysexParameterControlGUI) midiParameterGUI
84
                .elementAt(4));
85
 
213 tk 86
        hardwarePanel.add(subPanel2);
87
        hardwarePanel.add(subPanel3);
88
        hardwarePanel.add(subPanel4);
628 adamjking 89
        return hardwarePanel;
213 tk 90
    }
628 adamjking 91
 
213 tk 92
    protected JPanel createExt(Vector midiParameterGUI) {
93
        JPanel extPanel = new JPanel();
628 adamjking 94
        extPanel.setLayout(new GridLayout(2, 8));
213 tk 95
        extPanel.setBorder(BorderFactory.createEtchedBorder());
628 adamjking 96
        extPanel.setBorder(BorderFactory
97
                .createTitledBorder("External Switch / CV"));
98
        extPanel.setOpaque(false);
99
 
213 tk 100
        for (int c = 0; c < midiParameterGUI.size(); c++) {
628 adamjking 101
            extPanel.add((SIDSysexParameterControlGUI) midiParameterGUI
102
                    .elementAt(c));
213 tk 103
        }
104
        return extPanel;
105
    }
628 adamjking 106
 
213 tk 107
    protected JPanel createKnobs(Vector midiParameterGUI) {
108
        JPanel knobsPanel = new JPanel(new GridLayout(1, 8));
628 adamjking 109
        knobsPanel.setOpaque(false);
110
        knobsPanel.add(createKnob(midiParameterGUI, 0, "Modulation Wheel"));
111
        knobsPanel.add(createKnob(midiParameterGUI, 5, "CC#16"));
112
        knobsPanel.add(createKnob(midiParameterGUI, 10, "CC#17"));
113
        knobsPanel.add(createKnob(midiParameterGUI, 15, "CC#18"));
114
        knobsPanel.add(createKnob(midiParameterGUI, 20, "CC#19"));
115
        knobsPanel.add(createKnob(midiParameterGUI, 25, "Velocity"));
116
        knobsPanel.add(createKnob(midiParameterGUI, 30, "Pitch Bender"));
117
        knobsPanel.add(createKnob(midiParameterGUI, 35, "Aftertouch"));
213 tk 118
        return knobsPanel;
119
    }
628 adamjking 120
 
213 tk 121
    protected JPanel createKnob(Vector midiParameterGUI, int offset, String s) {
122
        JPanel knobPanel = new JPanel();
123
        knobPanel.setLayout(new BoxLayout(knobPanel, BoxLayout.Y_AXIS));
124
        knobPanel.setBorder(BorderFactory.createEtchedBorder());
125
        knobPanel.setBorder(BorderFactory.createTitledBorder(s));
126
        knobPanel.setOpaque(false);
628 adamjking 127
 
128
        knobPanel.add((SIDSysexParameterControlGUI) midiParameterGUI
129
                .elementAt(5 + offset));
130
        knobPanel.add((SIDSysexParameterControlGUI) midiParameterGUI
131
                .elementAt(6 + offset));
132
        knobPanel.add((SIDSysexParameterControlGUI) midiParameterGUI
133
                .elementAt(7 + offset));
134
        knobPanel.add((SIDSysexParameterControlGUI) midiParameterGUI
135
                .elementAt(8 + offset));
136
        knobPanel.add((SIDSysexParameterControlGUI) midiParameterGUI
137
                .elementAt(9 + offset));
138
 
139
        return knobPanel;
213 tk 140
    }
141
}