30 |
import java.awt.event.ItemEvent; |
import java.awt.event.ItemEvent; |
31 |
import java.awt.event.ItemListener; |
import java.awt.event.ItemListener; |
32 |
|
|
33 |
|
import java.beans.PropertyChangeEvent; |
34 |
|
import java.beans.PropertyChangeListener; |
35 |
|
|
36 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
37 |
import javax.swing.Box; |
import javax.swing.Box; |
38 |
import javax.swing.BoxLayout; |
import javax.swing.BoxLayout; |
68 |
import org.linuxsampler.lscp.Parameter; |
import org.linuxsampler.lscp.Parameter; |
69 |
|
|
70 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
71 |
|
import static org.jsampler.view.fantasia.FantasiaPrefs.preferences; |
72 |
|
|
73 |
|
|
74 |
/** |
/** |
122 |
private final JLabel lPort = new JLabel(i18n.getLabel("MidiDevicePane.lPort")); |
private final JLabel lPort = new JLabel(i18n.getLabel("MidiDevicePane.lPort")); |
123 |
private final JComboBox cbPort = new JComboBox(); |
private final JComboBox cbPort = new JComboBox(); |
124 |
|
|
125 |
|
private final ParameterTable additionalParamsTable = new ParameterTable(); |
126 |
|
private final JPanel additionalParamsPane = new JPanel(); |
127 |
|
|
128 |
OptionsPane() { |
OptionsPane() { |
129 |
super(Res.gfxChannelOptions); |
super(Res.gfxChannelOptions); |
130 |
|
|
156 |
mainPane.add(p); |
mainPane.add(p); |
157 |
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); |
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); |
158 |
|
|
159 |
|
JPanel p2 = additionalParamsPane; |
160 |
|
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); |
161 |
|
p2.setOpaque(false); |
162 |
|
|
163 |
|
p2.add(createHSeparator()); |
164 |
|
p2.add(Box.createRigidArea(new Dimension(0, 5))); |
165 |
|
|
166 |
|
JScrollPane sp = new JScrollPane(additionalParamsTable); |
167 |
|
|
168 |
|
sp.setPreferredSize(new Dimension(77, 90)); |
169 |
|
p2.add(sp); |
170 |
|
mainPane.add(p2); |
171 |
|
|
172 |
|
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); |
173 |
|
|
174 |
mainPane.add(createHSeparator()); |
mainPane.add(createHSeparator()); |
175 |
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); |
mainPane.add(Box.createRigidArea(new Dimension(0, 5))); |
176 |
|
|
178 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
179 |
p.setOpaque(false); |
p.setOpaque(false); |
180 |
|
|
181 |
JPanel p2 = new JPanel(); |
p2 = new JPanel(); |
182 |
p2.setLayout(new BoxLayout(p2, BoxLayout.X_AXIS)); |
p2.setLayout(new BoxLayout(p2, BoxLayout.X_AXIS)); |
183 |
p2.add(lPort); |
p2.add(lPort); |
184 |
p2.add(Box.createRigidArea(new Dimension(5, 0))); |
p2.add(Box.createRigidArea(new Dimension(5, 0))); |
188 |
|
|
189 |
p.add(Box.createRigidArea(new Dimension(0, 5))); |
p.add(Box.createRigidArea(new Dimension(0, 5))); |
190 |
|
|
191 |
JScrollPane sp = new JScrollPane(portParamTable); |
sp = new JScrollPane(portParamTable); |
192 |
sp.setPreferredSize(new Dimension(77, 90)); |
sp.setPreferredSize(new Dimension(77, 90)); |
193 |
p.add(sp); |
p.add(sp); |
194 |
|
|
207 |
for(MidiPort port : midiDeviceModel.getDeviceInfo().getMidiPorts()) { |
for(MidiPort port : midiDeviceModel.getDeviceInfo().getMidiPorts()) { |
208 |
cbPort.addItem(port); |
cbPort.addItem(port); |
209 |
} |
} |
210 |
|
|
211 |
|
Parameter[] pS = midiDeviceModel.getDeviceInfo().getAdditionalParameters(); |
212 |
|
additionalParamsTable.getModel().setParameters(pS); |
213 |
|
additionalParamsTable.getModel().addParameterListener(new ParameterListener() { |
214 |
|
public void |
215 |
|
parameterChanged(ParameterEvent e) { |
216 |
|
midiDeviceModel.setBackendDeviceParameter(e.getParameter()); |
217 |
|
} |
218 |
|
}); |
219 |
|
|
220 |
|
updateAdditionalParamsViewState(); |
221 |
|
String s = "MidiDevice.showAdditionalParameters"; |
222 |
|
preferences().addPropertyChangeListener(s, new PropertyChangeListener() { |
223 |
|
public void |
224 |
|
propertyChange(PropertyChangeEvent e) { |
225 |
|
updateAdditionalParamsViewState(); |
226 |
|
} |
227 |
|
}); |
228 |
|
} |
229 |
|
|
230 |
|
private void |
231 |
|
updateAdditionalParamsViewState() { |
232 |
|
String s = "MidiDevice.showAdditionalParameters"; |
233 |
|
additionalParamsPane.setVisible(preferences().getBoolProperty(s)); |
234 |
|
validate(); |
235 |
} |
} |
236 |
|
|
237 |
public void |
public void |
273 |
|
|
274 |
MidiInputDevice d = e.getMidiDeviceModel().getDeviceInfo(); |
MidiInputDevice d = e.getMidiDeviceModel().getDeviceInfo(); |
275 |
|
|
276 |
|
Parameter[] params = d.getAdditionalParameters(); |
277 |
|
additionalParamsTable.getModel().setParameters(params); |
278 |
|
|
279 |
int idx = cbPort.getSelectedIndex(); |
int idx = cbPort.getSelectedIndex(); |
280 |
cbPort.removeAllItems(); |
cbPort.removeAllItems(); |
281 |
for(MidiPort port : d.getMidiPorts()) cbPort.addItem(port); |
for(MidiPort port : d.getMidiPorts()) cbPort.addItem(port); |