/[svn]/jsampler/trunk/src/org/jsampler/view/fantasia/NormalChannelOptionsView.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/view/fantasia/NormalChannelOptionsView.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1785 - (show annotations) (download)
Tue Oct 7 00:07:14 2008 UTC (15 years, 6 months ago) by iliev
File size: 19620 byte(s)
* Fantasia: Implemented multiple channels panels
* Fantasia: Refactoring - all basic UI components moved to
  org.jsampler.view.fantasia.basic package

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com>
5 *
6 * This file is part of JSampler.
7 *
8 * JSampler is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
11 *
12 * JSampler is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with JSampler; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23 package org.jsampler.view.fantasia;
24
25 import java.awt.BorderLayout;
26 import java.awt.Dimension;
27 import java.awt.Insets;
28
29 import java.awt.event.ActionEvent;
30 import java.awt.event.ActionListener;
31
32 import java.util.logging.Level;
33
34 import javax.swing.BorderFactory;
35 import javax.swing.Box;
36 import javax.swing.BoxLayout;
37 import javax.swing.JComboBox;
38 import javax.swing.JComponent;
39 import javax.swing.JLabel;
40 import javax.swing.JPanel;
41 import javax.swing.SwingConstants;
42
43 import org.jsampler.AudioDeviceModel;
44 import org.jsampler.CC;
45 import org.jsampler.MidiDeviceModel;
46 import org.jsampler.MidiInstrumentMap;
47 import org.jsampler.SamplerModel;
48
49 import org.jsampler.event.ListEvent;
50 import org.jsampler.event.ListListener;
51 import org.jsampler.event.MidiDeviceEvent;
52 import org.jsampler.event.MidiDeviceListEvent;
53 import org.jsampler.event.MidiDeviceListListener;
54 import org.jsampler.event.MidiDeviceListener;
55 import org.jsampler.event.SamplerAdapter;
56 import org.jsampler.event.SamplerChannelAdapter;
57 import org.jsampler.event.SamplerChannelEvent;
58 import org.jsampler.event.SamplerEvent;
59 import org.jsampler.event.SamplerListener;
60
61 import org.jsampler.view.fantasia.basic.*;
62 import org.jsampler.view.std.JSChannelOutputRoutingDlg;
63
64 import org.linuxsampler.lscp.AudioOutputDevice;
65 import org.linuxsampler.lscp.MidiInputDevice;
66 import org.linuxsampler.lscp.MidiPort;
67 import org.linuxsampler.lscp.SamplerChannel;
68
69 import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
70
71 /**
72 *
73 * @author Grigor Iliev
74 */
75 public class NormalChannelOptionsView extends JPanel implements ChannelOptionsView {
76 private final Channel channel;
77 private MidiDeviceModel midiDevice = null;
78
79 private final JComboBox cbMidiDevice = new FantasiaComboBox();
80 private final JComboBox cbMidiPort = new FantasiaComboBox();
81 private final JComboBox cbMidiChannel = new FantasiaComboBox();
82 private final JComboBox cbInstrumentMap = new FantasiaComboBox();
83 private final JComboBox cbAudioDevice = new FantasiaComboBox();
84
85 private final PixmapButton btnChannelRouting;
86
87 private boolean update = false;
88
89 private final SamplerListener samplerListener;
90 private final MapListListener mapListListener = new MapListListener();
91
92 private class NoMap {
93 public String
94 toString() { return "[None]"; }
95 }
96
97 private NoMap noMap = new NoMap();
98
99 private class DefaultMap {
100 public String
101 toString() { return "[Default]"; }
102 }
103
104 private DefaultMap defaultMap = new DefaultMap();
105
106 /** Creates a new instance of <code>NormalChannelOptionsView</code> */
107 public
108 NormalChannelOptionsView(final Channel channel) {
109 setLayout(new BorderLayout());
110 PixmapPane bgp = new PixmapPane(Res.gfxChannelOptions);
111 bgp.setPixmapInsets(new Insets(1, 1, 1, 1));
112
113 this.channel = channel;
114
115 bgp.setBorder(BorderFactory.createEmptyBorder(5, 4, 5, 4));
116 bgp.setLayout(new BoxLayout(bgp, BoxLayout.X_AXIS));
117
118 bgp.setPreferredSize(new Dimension(420, 44));
119 bgp.setMinimumSize(getPreferredSize());
120 bgp.setMaximumSize(getPreferredSize());
121
122 JPanel p = new FantasiaPanel();
123 p.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 4));
124 p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
125 JLabel l = new JLabel(Res.gfxMidiInputTitle);
126 l.setAlignmentX(LEFT_ALIGNMENT);
127 p.add(l);
128
129 JPanel p2 = new FantasiaPanel();
130 p2.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
131 p2.setLayout(new BoxLayout(p2, BoxLayout.X_AXIS));
132
133 Object o = cbMidiDevice.getRenderer();
134 if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.CENTER);
135
136 cbMidiDevice.setPreferredSize(new Dimension(40, 18));
137 cbMidiDevice.setMinimumSize(cbMidiDevice.getPreferredSize());
138 cbMidiDevice.setMaximumSize(cbMidiDevice.getPreferredSize());
139 p2.add(cbMidiDevice);
140
141 p2.add(Box.createRigidArea(new Dimension(3, 0)));
142
143 o = cbMidiPort.getRenderer();
144 if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.CENTER);
145
146 cbMidiPort.setPreferredSize(new Dimension(62, 18));
147 cbMidiPort.setMinimumSize(cbMidiPort.getPreferredSize());
148 cbMidiPort.setMaximumSize(cbMidiPort.getPreferredSize());
149 p2.add(cbMidiPort);
150
151 p2.add(Box.createRigidArea(new Dimension(3, 0)));
152
153 o = cbMidiChannel.getRenderer();
154 if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.CENTER);
155
156 cbMidiChannel.addItem("All");
157 for(int i = 1; i <= 16; i++) cbMidiChannel.addItem("Channel " + String.valueOf(i));
158 cbMidiChannel.setPreferredSize(new Dimension(84, 18));
159 cbMidiChannel.setMinimumSize(cbMidiChannel.getPreferredSize());
160 cbMidiChannel.setMaximumSize(cbMidiChannel.getPreferredSize());
161
162 p2.add(cbMidiChannel);
163 p2.setAlignmentX(LEFT_ALIGNMENT);
164 p2.setOpaque(false);
165 p.add(p2);
166 p.setBackground(new java.awt.Color(0x818181));
167
168 bgp.add(p);
169
170 bgp.add(Box.createRigidArea(new Dimension(4, 0)));
171
172 p = new FantasiaPanel();
173 p.setOpaque(true);
174 p.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 4));
175 p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
176 l = new JLabel(Res.gfxInstrumentMapTitle);
177 l.setAlignmentX(LEFT_ALIGNMENT);
178 l.setAlignmentX(LEFT_ALIGNMENT);
179 p.add(l);
180
181 p.add(Box.createRigidArea(new Dimension(0, 3)));
182
183 //o = cbInstrumentMap.getRenderer();
184 //if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.CENTER);
185
186 cbInstrumentMap.setPreferredSize(new Dimension(122, 18));
187 cbInstrumentMap.setMinimumSize(cbInstrumentMap.getPreferredSize());
188 cbInstrumentMap.setMaximumSize(cbInstrumentMap.getPreferredSize());
189 cbInstrumentMap.setAlignmentX(LEFT_ALIGNMENT);
190 p.add(cbInstrumentMap);
191 p.setBackground(new java.awt.Color(0x818181));
192 bgp.add(p);
193
194 bgp.add(Box.createRigidArea(new Dimension(4, 0)));
195
196 p = new FantasiaPanel();
197 p.setOpaque(true);
198 p.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 4));
199 p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
200 l = new JLabel(Res.gfxAudioOutputTitle);
201 l.setAlignmentX(LEFT_ALIGNMENT);
202 p.add(l);
203
204 //p.add(Box.createRigidArea(new Dimension(0, 3)));
205
206 p2 = new FantasiaPanel();
207 p2.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
208 p2.setLayout(new BoxLayout(p2, BoxLayout.X_AXIS));
209 p2.setOpaque(false);
210 p2.setAlignmentX(LEFT_ALIGNMENT);
211
212 o = cbAudioDevice.getRenderer();
213 if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.RIGHT);
214
215 cbAudioDevice.setPreferredSize(new Dimension(40, 18));
216 cbAudioDevice.setMinimumSize(cbAudioDevice.getPreferredSize());
217 cbAudioDevice.setMaximumSize(cbAudioDevice.getPreferredSize());
218
219 p2.add(cbAudioDevice);
220 p2.add(Box.createRigidArea(new Dimension(3, 0)));
221 btnChannelRouting = new PixmapButton(Res.gfxBtnCr, Res.gfxBtnCrRO);
222 btnChannelRouting.setPressedIcon(Res.gfxBtnCrRO);
223 btnChannelRouting.setEnabled(false);
224 btnChannelRouting.setToolTipText(i18n.getLabel("ChannelOptions.routing"));
225
226 btnChannelRouting.addActionListener(new ActionListener() {
227 public void
228 actionPerformed(ActionEvent e) {
229 SamplerChannel c = channel.getChannelInfo();
230 new JSChannelOutputRoutingDlg(CC.getMainFrame(), c).setVisible(true);
231
232 }
233 });
234
235 p2.add(btnChannelRouting);
236
237 p.add(p2);
238 p.setBackground(new java.awt.Color(0x818181));
239 p2 = new FantasiaPanel();
240 p2.setLayout(new java.awt.BorderLayout());
241 p.add(p2);
242 bgp.add(p);
243
244 add(bgp);
245
246 cbMidiDevice.addActionListener(new ActionListener() {
247 public void
248 actionPerformed(ActionEvent e) { setMidiDevice(); }
249 });
250
251 cbMidiPort.addActionListener(new ActionListener() {
252 public void
253 actionPerformed(ActionEvent e) { setMidiPort(); }
254 });
255
256 cbMidiChannel.addActionListener(new ActionListener() {
257 public void
258 actionPerformed(ActionEvent e) { setMidiChannel(); }
259 });
260
261 samplerListener = new SamplerAdapter() {
262 /** Invoked when the default MIDI instrument map is changed. */
263 public void
264 defaultMapChanged(SamplerEvent e) {
265 updateCbInstrumentMapToolTipText();
266
267 }
268 };
269
270 CC.getSamplerModel().addSamplerListener(samplerListener);
271
272 cbInstrumentMap.addItem(noMap);
273 cbInstrumentMap.addItem(defaultMap);
274 for(MidiInstrumentMap map : CC.getSamplerModel().getMidiInstrumentMaps()) {
275 cbInstrumentMap.addItem(map);
276 }
277
278 int map = channel.getModel().getChannelInfo().getMidiInstrumentMapId();
279 cbInstrumentMap.setSelectedItem(CC.getSamplerModel().getMidiInstrumentMapById(map));
280 if(cbInstrumentMap.getSelectedItem() == null) {
281 if(map == -1) cbInstrumentMap.setSelectedItem(noMap);
282 else if(map == -2) {
283 cbInstrumentMap.setSelectedItem(defaultMap);
284 }
285 }
286
287 updateCbInstrumentMapToolTipText();
288
289 if(channel.getModel().getChannelInfo().getEngine() == null) {
290 cbInstrumentMap.setEnabled(false);
291 }
292
293 cbInstrumentMap.addActionListener(new ActionListener() {
294 public void
295 actionPerformed(ActionEvent e) { updateInstrumentMap(); }
296 });
297
298 CC.getSamplerModel().addMidiInstrumentMapListListener(mapListListener);
299
300 cbAudioDevice.addActionListener(new ActionListener() {
301 public void
302 actionPerformed(ActionEvent e) { setBackendAudioDevice(); }
303 });
304
305 channel.getModel().addSamplerChannelListener(new SamplerChannelAdapter() {
306 public void
307 channelChanged(SamplerChannelEvent e) { updateChannelProperties(); }
308 });
309
310 CC.getSamplerModel().addMidiDeviceListListener(getHandler());
311 CC.getSamplerModel().addAudioDeviceListListener(getHandler());
312
313 updateMidiDevices();
314 updateAudioDevices();
315 updateChannelProperties();
316 }
317
318 //////////////////////////////////////////////
319 // Implementation of the ChannelOptionsView interface
320 //////////////////////////////////////////////
321
322 public JComponent
323 getComponent() { return this; }
324
325 public void
326 installView() { }
327
328 public void
329 uninstallView() {
330 onDestroy();
331 }
332
333 public void
334 updateChannelInfo() {
335
336 }
337
338 //////////////////////////////////////////////
339
340 /**
341 * Updates the channel settings. This method is invoked when changes to the
342 * channel were made.
343 */
344 private void
345 updateChannelProperties() {
346 SamplerModel sm = CC.getSamplerModel();
347 SamplerChannel sc = channel.getModel().getChannelInfo();
348
349 MidiDeviceModel mm = sm.getMidiDeviceById(sc.getMidiInputDevice());
350 AudioDeviceModel am = sm.getAudioDeviceById(sc.getAudioOutputDevice());
351
352 if(isUpdate()) CC.getLogger().warning("Unexpected update state!");
353
354 setUpdate(true);
355
356 try {
357 cbMidiDevice.setSelectedItem(mm == null ? null : mm.getDeviceInfo());
358
359 cbAudioDevice.setSelectedItem(am == null ? null : am.getDeviceInfo());
360 btnChannelRouting.setEnabled(am != null);
361 } catch(Exception x) {
362 CC.getLogger().log(Level.WARNING, "Unkown error", x);
363 }
364
365 if(sc.getEngine() != null) {
366 cbInstrumentMap.setEnabled(true);
367 int id = sc.getMidiInstrumentMapId();
368 Object o;
369 if(id == -2) o = defaultMap;
370 else if(id == -1) o = noMap;
371 else o = CC.getSamplerModel().getMidiInstrumentMapById(id);
372
373 if(cbInstrumentMap.getSelectedItem() != o) {
374 cbInstrumentMap.setSelectedItem(o);
375 }
376 } else {
377 cbInstrumentMap.setSelectedItem(noMap);
378 cbInstrumentMap.setEnabled(false);
379 }
380
381 setUpdate(false);
382 }
383
384 /**
385 * Updates the MIDI device list.
386 */
387 private void
388 updateMidiDevices() {
389 SamplerModel sm = CC.getSamplerModel();
390 SamplerChannel sc = channel.getModel().getChannelInfo();
391
392 setUpdate(true);
393
394 try {
395 cbMidiDevice.removeAllItems();
396
397 for(MidiDeviceModel m : sm.getMidiDevices())
398 cbMidiDevice.addItem(m.getDeviceInfo());
399
400 MidiDeviceModel mm = sm.getMidiDeviceById(sc.getMidiInputDevice());
401 cbMidiDevice.setSelectedItem(mm == null ? null : mm.getDeviceInfo());
402 } catch(Exception x) {
403 CC.getLogger().log(Level.WARNING, "Unkown error", x);
404 }
405
406 setUpdate(false);
407 }
408
409
410 private void
411 updateInstrumentMap() {
412 updateCbInstrumentMapToolTipText();
413
414 int id = channel.getModel().getChannelInfo().getMidiInstrumentMapId();
415 Object o = cbInstrumentMap.getSelectedItem();
416 if(o == null && id == -1) return;
417
418 int cbId;
419 if(o == null || o == noMap) cbId = -1;
420 else if(o == defaultMap) cbId = -2;
421 else cbId = ((MidiInstrumentMap)o).getMapId();
422
423 if(cbId == id) return;
424
425 channel.getModel().setBackendMidiInstrumentMap(cbId);
426 }
427
428 private void
429 updateCbInstrumentMapToolTipText() {
430 if(cbInstrumentMap.getSelectedItem() != defaultMap) {
431 cbInstrumentMap.setToolTipText(null);
432 return;
433 }
434
435 MidiInstrumentMap m = CC.getSamplerModel().getDefaultMidiInstrumentMap();
436 if(m != null) {
437 String s = i18n.getLabel("Channel.ttDefault", m.getName());
438 cbInstrumentMap.setToolTipText(s);
439 } else {
440 cbInstrumentMap.setToolTipText(null);
441 }
442 }
443
444 /**
445 * Updates the audio device list.
446 */
447 private void
448 updateAudioDevices() {
449 SamplerModel sm = CC.getSamplerModel();
450 SamplerChannel sc = channel.getModel().getChannelInfo();
451
452 setUpdate(true);
453
454 try {
455 cbAudioDevice.removeAllItems();
456
457 for(AudioDeviceModel m : sm.getAudioDevices())
458 cbAudioDevice.addItem(m.getDeviceInfo());
459
460 AudioDeviceModel am = sm.getAudioDeviceById(sc.getAudioOutputDevice());
461 cbAudioDevice.setSelectedItem(am == null ? null : am.getDeviceInfo());
462 } catch(Exception x) {
463 CC.getLogger().log(Level.WARNING, "Unkown error", x);
464 }
465
466 setUpdate(false);
467 }
468
469 private void
470 setMidiDevice() {
471 MidiInputDevice mid = (MidiInputDevice)cbMidiDevice.getSelectedItem();
472
473 if(!isUpdate()) {
474 if(mid != null) {
475 channel.getModel().setBackendMidiInputDevice(mid.getDeviceId());
476 }
477
478 return;
479 }
480
481 if(midiDevice != null) midiDevice.removeMidiDeviceListener(getHandler());
482
483 cbMidiPort.removeAllItems();
484
485 if(mid == null) {
486 midiDevice = null;
487 cbMidiPort.setEnabled(false);
488
489 cbMidiChannel.setSelectedItem(null);
490 cbMidiChannel.setEnabled(false);
491 } else {
492 midiDevice = CC.getSamplerModel().getMidiDeviceById(mid.getDeviceId());
493 if(midiDevice != null) midiDevice.addMidiDeviceListener(getHandler());
494
495 cbMidiPort.setEnabled(true);
496
497 MidiPort[] ports = mid.getMidiPorts();
498 for(MidiPort port : ports) cbMidiPort.addItem(port);
499
500 int p = channel.getModel().getChannelInfo().getMidiInputPort();
501 cbMidiPort.setSelectedItem(p >= 0 && p < ports.length ? ports[p] : null);
502
503 cbMidiChannel.setEnabled(true);
504 int c = channel.getModel().getChannelInfo().getMidiInputChannel();
505 cbMidiChannel.setSelectedItem(c == -1 ? "All" : "Channel " + (c + 1));
506 }
507 }
508
509 private void
510 setMidiPort() {
511 if(isUpdate()) return;
512
513 channel.getModel().setBackendMidiInputPort(cbMidiPort.getSelectedIndex());
514 }
515
516 private void
517 setMidiChannel() {
518 if(isUpdate()) return;
519
520 Object o = cbMidiChannel.getSelectedItem();
521 if(o == null) return;
522 String s = o.toString();
523
524 int c = s.equals("All") ? -1 : Integer.parseInt(s.substring(8)) - 1;
525
526 channel.getModel().setBackendMidiInputChannel(c);
527 }
528
529 private void
530 setBackendAudioDevice() {
531 if(isUpdate()) return;
532 AudioOutputDevice dev = (AudioOutputDevice)cbAudioDevice.getSelectedItem();
533 if(dev != null) channel.getModel().setBackendAudioOutputDevice(dev.getDeviceId());
534 }
535
536 /**
537 * Determines whether the currently processed changes are due to update.
538 * @return <code>true</code> if the currently processed changes are due to update and
539 * <code>false</code> if the currently processed changes are due to user input.
540 */
541 private boolean
542 isUpdate() { return update; }
543
544 /**
545 * Sets whether the currently processed changes are due to update.
546 * @param b Specify <code>true</code> to indicate that the currently
547 * processed changes are due to update; <code>false</code>
548 * indicates that the currently processed changes are due to user input.
549 */
550 private void
551 setUpdate(boolean b) { update = b; }
552
553 protected void
554 onDestroy() {
555 SamplerModel sm = CC.getSamplerModel();
556
557 sm.removeMidiDeviceListListener(getHandler());
558 sm.removeAudioDeviceListListener(getHandler());
559 sm.removeMidiInstrumentMapListListener(mapListListener);
560 sm.removeSamplerListener(samplerListener);
561
562 if(midiDevice != null) {
563 midiDevice.removeMidiDeviceListener(getHandler());
564 }
565 }
566
567 private final Handler handler = new Handler();
568
569 private Handler
570 getHandler() { return handler; }
571
572 private class Handler implements MidiDeviceListListener, ListListener<AudioDeviceModel>,
573 MidiDeviceListener {
574 /**
575 * Invoked when a new MIDI device is created.
576 * @param e A <code>MidiDeviceListEvent</code>
577 * instance providing the event information.
578 */
579 @Override
580 public void
581 deviceAdded(MidiDeviceListEvent e) {
582 cbMidiDevice.addItem(e.getMidiDeviceModel().getDeviceInfo());
583 }
584
585 /**
586 * Invoked when a MIDI device is removed.
587 * @param e A <code>MidiDeviceListEvent</code>
588 * instance providing the event information.
589 */
590 @Override
591 public void
592 deviceRemoved(MidiDeviceListEvent e) {
593 cbMidiDevice.removeItem(e.getMidiDeviceModel().getDeviceInfo());
594 }
595
596 /**
597 * Invoked when a new audio device is created.
598 * @param e An <code>AudioDeviceListEvent</code>
599 * instance providing the event information.
600 */
601 @Override
602 public void
603 entryAdded(ListEvent<AudioDeviceModel> e) {
604 cbAudioDevice.addItem(e.getEntry().getDeviceInfo());
605 }
606
607 /**
608 * Invoked when an audio device is removed.
609 * @param e An <code>AudioDeviceListEvent</code>
610 * instance providing the event information.
611 */
612 @Override
613 public void
614 entryRemoved(ListEvent<AudioDeviceModel> e) {
615 cbAudioDevice.removeItem(e.getEntry().getDeviceInfo());
616 }
617
618 @Override
619 public void
620 settingsChanged(MidiDeviceEvent e) {
621 if(isUpdate()) {
622 CC.getLogger().warning("Invalid update state");
623 return;
624 }
625
626 setUpdate(true);
627 int idx = cbMidiPort.getSelectedIndex();
628 MidiInputDevice d = e.getMidiDeviceModel().getDeviceInfo();
629
630 cbMidiPort.removeAllItems();
631 for(MidiPort port : d.getMidiPorts()) cbMidiPort.addItem(port);
632
633 if(idx >= cbMidiPort.getModel().getSize()) idx = 0;
634
635 setUpdate(false);
636
637 if(cbMidiPort.getModel().getSize() > 0) cbMidiPort.setSelectedIndex(idx);
638 }
639 }
640
641 private class MapListListener implements ListListener<MidiInstrumentMap> {
642 /** Invoked when a new MIDI instrument map is added to a list. */
643 @Override
644 public void
645 entryAdded(ListEvent<MidiInstrumentMap> e) {
646 cbInstrumentMap.insertItemAt(e.getEntry(), cbInstrumentMap.getItemCount());
647 boolean b = channel.getModel().getChannelInfo().getEngine() != null;
648 if(b && !cbInstrumentMap.isEnabled()) cbInstrumentMap.setEnabled(true);
649 }
650
651 /** Invoked when a new MIDI instrument map is removed from a list. */
652 @Override
653 public void
654 entryRemoved(ListEvent<MidiInstrumentMap> e) {
655 cbInstrumentMap.removeItem(e.getEntry());
656 if(cbInstrumentMap.getItemCount() == 0) { // TODO: ?
657 cbInstrumentMap.setSelectedItem(noMap);
658 cbInstrumentMap.setEnabled(false);
659 }
660 }
661 }
662 }

  ViewVC Help
Powered by ViewVC