1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
* Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
24 |
|
|
25 |
import java.awt.Cursor; |
import java.awt.Cursor; |
26 |
import java.awt.Dimension; |
import java.awt.Dimension; |
27 |
|
import java.awt.Graphics; |
28 |
import java.awt.Insets; |
import java.awt.Insets; |
29 |
|
|
30 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
31 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
32 |
|
import java.awt.event.HierarchyEvent; |
33 |
|
import java.awt.event.HierarchyListener; |
34 |
import java.awt.event.MouseAdapter; |
import java.awt.event.MouseAdapter; |
35 |
import java.awt.event.MouseEvent; |
import java.awt.event.MouseEvent; |
36 |
|
|
37 |
|
import java.beans.PropertyChangeEvent; |
38 |
|
import java.beans.PropertyChangeListener; |
39 |
|
|
40 |
import java.util.logging.Level; |
import java.util.logging.Level; |
41 |
|
|
42 |
|
import javax.swing.Action; |
43 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
44 |
import javax.swing.Box; |
import javax.swing.Box; |
45 |
import javax.swing.BoxLayout; |
import javax.swing.BoxLayout; |
47 |
import javax.swing.JButton; |
import javax.swing.JButton; |
48 |
import javax.swing.JComboBox; |
import javax.swing.JComboBox; |
49 |
import javax.swing.JLabel; |
import javax.swing.JLabel; |
50 |
|
import javax.swing.JMenuItem; |
51 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
52 |
|
import javax.swing.JPopupMenu; |
53 |
import javax.swing.JToggleButton; |
import javax.swing.JToggleButton; |
54 |
|
import javax.swing.JToolBar; |
55 |
import javax.swing.SwingConstants; |
import javax.swing.SwingConstants; |
56 |
|
import javax.swing.Timer; |
57 |
|
|
58 |
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeEvent; |
59 |
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
60 |
|
|
61 |
import net.sf.juife.Dial; |
import net.sf.juife.Dial; |
62 |
|
import net.sf.juife.InformationDialog; |
63 |
import net.sf.juife.JuifeUtils; |
import net.sf.juife.JuifeUtils; |
64 |
import net.sf.juife.TitleBar; |
import net.sf.juife.TitleBar; |
65 |
|
|
66 |
|
import org.jdesktop.swingx.JXCollapsiblePane; |
67 |
|
|
68 |
import org.jsampler.AudioDeviceModel; |
import org.jsampler.AudioDeviceModel; |
69 |
import org.jsampler.CC; |
import org.jsampler.CC; |
70 |
import org.jsampler.MidiDeviceModel; |
import org.jsampler.MidiDeviceModel; |
71 |
|
import org.jsampler.MidiInstrumentMap; |
72 |
import org.jsampler.SamplerChannelModel; |
import org.jsampler.SamplerChannelModel; |
73 |
import org.jsampler.SamplerModel; |
import org.jsampler.SamplerModel; |
74 |
|
|
75 |
import org.jsampler.event.ListEvent; |
import org.jsampler.event.ListEvent; |
76 |
import org.jsampler.event.ListListener; |
import org.jsampler.event.ListListener; |
77 |
|
import org.jsampler.event.MidiDeviceEvent; |
78 |
import org.jsampler.event.MidiDeviceListEvent; |
import org.jsampler.event.MidiDeviceListEvent; |
79 |
import org.jsampler.event.MidiDeviceListListener; |
import org.jsampler.event.MidiDeviceListListener; |
80 |
|
import org.jsampler.event.MidiDeviceListener; |
81 |
|
import org.jsampler.event.SamplerAdapter; |
82 |
import org.jsampler.event.SamplerChannelAdapter; |
import org.jsampler.event.SamplerChannelAdapter; |
83 |
import org.jsampler.event.SamplerChannelEvent; |
import org.jsampler.event.SamplerChannelEvent; |
84 |
|
import org.jsampler.event.SamplerChannelListEvent; |
85 |
|
import org.jsampler.event.SamplerChannelListListener; |
86 |
import org.jsampler.event.SamplerChannelListener; |
import org.jsampler.event.SamplerChannelListener; |
87 |
|
import org.jsampler.event.SamplerEvent; |
88 |
|
import org.jsampler.event.SamplerListener; |
89 |
|
|
90 |
|
import org.jsampler.view.std.JSChannelOutputRoutingDlg; |
91 |
|
import org.jsampler.view.std.JSFxSendsPane; |
92 |
|
import org.jsampler.view.std.JSInstrumentChooser; |
93 |
|
|
94 |
|
import org.jvnet.lafwidget.animation.FadeConfigurationManager; |
95 |
|
import org.jvnet.lafwidget.animation.FadeKind; |
96 |
|
|
97 |
|
import org.jvnet.substance.SubstanceImageCreator; |
98 |
|
import org.jvnet.substance.SubstanceLookAndFeel; |
99 |
|
|
100 |
import org.linuxsampler.lscp.AudioOutputDevice; |
import org.linuxsampler.lscp.AudioOutputDevice; |
101 |
import org.linuxsampler.lscp.MidiInputDevice; |
import org.linuxsampler.lscp.MidiInputDevice; |
104 |
import org.linuxsampler.lscp.SamplerEngine; |
import org.linuxsampler.lscp.SamplerEngine; |
105 |
|
|
106 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
107 |
|
import static org.jsampler.view.fantasia.FantasiaPrefs.*; |
108 |
|
|
109 |
|
|
110 |
/** |
/** |
112 |
* @author Grigor Iliev |
* @author Grigor Iliev |
113 |
*/ |
*/ |
114 |
public class Channel extends org.jsampler.view.JSChannel { |
public class Channel extends org.jsampler.view.JSChannel { |
115 |
|
private final JXCollapsiblePane mainPane; |
116 |
private final ChannelScreen screen = new ChannelScreen(this); |
private final ChannelScreen screen = new ChannelScreen(this); |
117 |
private final ChannelOptions optionsPane = new ChannelOptions(this); |
private final ChannelOptions optionsPane = new ChannelOptions(this); |
118 |
|
|
133 |
*/ |
*/ |
134 |
public |
public |
135 |
Channel(SamplerChannelModel model) { |
Channel(SamplerChannelModel model) { |
136 |
|
this(model, null); |
137 |
|
} |
138 |
|
|
139 |
|
/** |
140 |
|
* Creates a new instance of <code>Channel</code> using the specified |
141 |
|
* non-<code>null</code> channel model. |
142 |
|
* @param model The model to be used by this channel. |
143 |
|
* @param listener A listener which is notified when the newly created |
144 |
|
* channel is fully expanded on the screen. |
145 |
|
* @throws IllegalArgumentException If the model is <code>null</code>. |
146 |
|
*/ |
147 |
|
public |
148 |
|
Channel(SamplerChannelModel model, final ActionListener listener) { |
149 |
super(model); |
super(model); |
150 |
|
|
151 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
152 |
JPanel p = new JPanel(); |
ChannelPane p = new ChannelPane(); |
|
p.setName("Channel"); |
|
153 |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
154 |
|
|
155 |
//p.add(Box.createRigidArea(new Dimension(3, 0))); |
//p.add(Box.createRigidArea(new Dimension(3, 0))); |
156 |
|
|
157 |
btnPower.setAlignmentY(JPanel.TOP_ALIGNMENT); |
btnPower.setAlignmentY(JPanel.TOP_ALIGNMENT); |
158 |
|
|
159 |
TitleBar tb = new TitleBar(); |
JPanel tb = new JPanel(); |
160 |
tb.setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 4)); |
tb.setBorder(BorderFactory.createEmptyBorder(3, 3, 0, 4)); |
161 |
tb.setLayout(new BoxLayout(tb, BoxLayout.X_AXIS)); |
tb.setLayout(new BoxLayout(tb, BoxLayout.X_AXIS)); |
162 |
tb.setOpaque(false); |
tb.setOpaque(false); |
188 |
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); |
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); |
189 |
p2.setAlignmentY(JPanel.TOP_ALIGNMENT); |
p2.setAlignmentY(JPanel.TOP_ALIGNMENT); |
190 |
p2.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); |
p2.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); |
191 |
p2.add(new JLabel(Res.iconMuteTitle)); |
p2.add(new JLabel(Res.gfxMuteTitle)); |
192 |
p2.add(btnMute); |
p2.add(btnMute); |
193 |
p2.add(new JLabel(Res.iconSoloTitle)); |
p2.add(new JLabel(Res.gfxSoloTitle)); |
194 |
p2.add(btnSolo); |
p2.add(btnSolo); |
195 |
|
|
196 |
p.add(p2); |
p.add(p2); |
202 |
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); |
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); |
203 |
p2.setAlignmentY(JPanel.TOP_ALIGNMENT); |
p2.setAlignmentY(JPanel.TOP_ALIGNMENT); |
204 |
p2.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); |
p2.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); |
205 |
JLabel l = new JLabel(Res.iconVolumeTitle); |
JLabel l = new JLabel(Res.gfxVolumeTitle); |
206 |
l.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
l.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
207 |
l.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0)); |
l.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0)); |
208 |
p2.add(l); |
p2.add(l); |
209 |
dialVolume.setDialPixmap(Res.iconVolumeDial, 30, 330); |
dialVolume.setDialPixmap(Res.gfxVolumeDial, 30, 330); |
210 |
dialVolume.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
dialVolume.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
211 |
p2.add(dialVolume); |
p2.add(dialVolume); |
212 |
p.add(p2); |
p.add(p2); |
218 |
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); |
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); |
219 |
p2.setAlignmentY(JPanel.TOP_ALIGNMENT); |
p2.setAlignmentY(JPanel.TOP_ALIGNMENT); |
220 |
p2.setBorder(BorderFactory.createEmptyBorder(27, 0, 0, 0)); |
p2.setBorder(BorderFactory.createEmptyBorder(27, 0, 0, 0)); |
221 |
l = new JLabel(Res.iconOptionsTitle); |
l = new JLabel(Res.gfxOptionsTitle); |
222 |
l.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
l.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
223 |
l.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0)); |
l.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0)); |
224 |
p2.add(l); |
p2.add(l); |
237 |
|
|
238 |
p.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
p.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
239 |
optionsPane.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
optionsPane.setAlignmentX(JPanel.CENTER_ALIGNMENT); |
|
add(p); |
|
|
add(optionsPane); |
|
240 |
|
|
241 |
setOpaque(true); |
mainPane = new JXCollapsiblePane(); |
242 |
|
mainPane.getContentPane().setLayout ( |
243 |
|
new BoxLayout(mainPane.getContentPane(), BoxLayout.Y_AXIS) |
244 |
|
); |
245 |
|
|
246 |
|
mainPane.add(p); |
247 |
|
mainPane.add(optionsPane); |
248 |
|
|
249 |
|
setOpaque(false); |
250 |
|
|
251 |
getModel().addSamplerChannelListener(getHandler()); |
getModel().addSamplerChannelListener(getHandler()); |
252 |
|
|
253 |
updateChannelInfo(); |
updateChannelInfo(); |
254 |
|
|
255 |
|
add(mainPane); |
256 |
|
|
257 |
|
if(listener != null) { |
258 |
|
final String s = JXCollapsiblePane.ANIMATION_STATE_KEY; |
259 |
|
mainPane.addPropertyChangeListener(s, new PropertyChangeListener() { |
260 |
|
public void |
261 |
|
propertyChange(PropertyChangeEvent e) { |
262 |
|
if(e.getNewValue() == "expanded") { |
263 |
|
mainPane.removePropertyChangeListener(s, this); |
264 |
|
listener.actionPerformed(null); |
265 |
|
} |
266 |
|
} |
267 |
|
}); |
268 |
|
} |
269 |
|
|
270 |
|
mainPane.setAnimated(false); |
271 |
|
mainPane.setCollapsed(true); |
272 |
|
mainPane.setAnimated(preferences().getBoolProperty(ANIMATED)); |
273 |
|
mainPane.setCollapsed(false); |
274 |
|
|
275 |
|
preferences().addPropertyChangeListener(ANIMATED, new PropertyChangeListener() { |
276 |
|
public void |
277 |
|
propertyChange(PropertyChangeEvent e) { |
278 |
|
mainPane.setAnimated(preferences().getBoolProperty(ANIMATED)); |
279 |
|
} |
280 |
|
}); |
281 |
|
|
282 |
|
if(listener != null) { |
283 |
|
javax.swing.SwingUtilities.invokeLater(new Runnable() { |
284 |
|
public void |
285 |
|
run() { listener.actionPerformed(null); } |
286 |
|
}); |
287 |
|
} |
288 |
|
|
289 |
|
CC.getSamplerModel().addSamplerChannelListListener(getHandler()); |
290 |
} |
} |
291 |
|
|
292 |
private JPanel |
private JPanel |
293 |
createVSeparator() { |
createVSeparator() { |
294 |
JPanel p = new JPanel(); |
PixmapPane p = new PixmapPane(Res.gfxVLine); |
|
p.setName("VSeparator"); |
|
|
p.setOpaque(false); |
|
295 |
p.setAlignmentY(JPanel.TOP_ALIGNMENT); |
p.setAlignmentY(JPanel.TOP_ALIGNMENT); |
296 |
p.setPreferredSize(new Dimension(2, 60)); |
p.setPreferredSize(new Dimension(2, 60)); |
297 |
p.setMinimumSize(p.getPreferredSize()); |
p.setMinimumSize(p.getPreferredSize()); |
319 |
|
|
320 |
/** Shows the channel properties. */ |
/** Shows the channel properties. */ |
321 |
public void |
public void |
322 |
expandChannel() { if(!btnOptions.isSelected()) btnOptions.doClick(); } |
expandChannel() { expandChannel(optionsPane.isAnimated()); } |
323 |
|
|
324 |
|
/** Shows the channel properties. */ |
325 |
|
public void |
326 |
|
expandChannel(boolean animated) { |
327 |
|
if(btnOptions.isSelected()) return; |
328 |
|
|
329 |
|
boolean b = optionsPane.isAnimated(); |
330 |
|
optionsPane.setAnimated(animated); |
331 |
|
btnOptions.doClick(); |
332 |
|
optionsPane.setAnimated(b); |
333 |
|
} |
334 |
|
|
335 |
|
|
336 |
/** Invoked when the user changes the volume */ |
/** Invoked when the user changes the volume */ |
366 |
screen.updateScreenInfo(sc); |
screen.updateScreenInfo(sc); |
367 |
updateMuteIcon(sc); |
updateMuteIcon(sc); |
368 |
|
|
369 |
if(sc.isSoloChannel()) btnSolo.setIcon(Res.iconSoloOn); |
if(sc.isSoloChannel()) btnSolo.setIcon(Res.gfxSoloOn); |
370 |
else btnSolo.setIcon(Res.iconSoloOff); |
else btnSolo.setIcon(Res.gfxSoloOff); |
371 |
|
|
372 |
dialVolume.setValue((int)(sc.getVolume() * 100)); |
dialVolume.setValue((int)(sc.getVolume() * 100)); |
373 |
|
|
385 |
*/ |
*/ |
386 |
private void |
private void |
387 |
updateMuteIcon(SamplerChannel channel) { |
updateMuteIcon(SamplerChannel channel) { |
388 |
if(channel.isMutedBySolo()) btnMute.setIcon(Res.iconMutedBySolo); |
if(channel.isMutedBySolo()) btnMute.setIcon(Res.gfxMutedBySolo); |
389 |
else if(channel.isMuted()) btnMute.setIcon(Res.iconMuteOn); |
else if(channel.isMuted()) btnMute.setIcon(Res.gfxMuteOn); |
390 |
else btnMute.setIcon(Res.iconMuteOff); |
else btnMute.setIcon(Res.gfxMuteOff); |
391 |
} |
} |
392 |
|
|
393 |
private class EnhancedDial extends Dial { |
private class EnhancedDial extends Dial { |
418 |
} |
} |
419 |
} |
} |
420 |
|
|
421 |
|
protected void |
422 |
|
onDestroy() { |
423 |
|
CC.getSamplerModel().removeSamplerChannelListListener(getHandler()); |
424 |
|
|
425 |
|
screen.onDestroy(); |
426 |
|
optionsPane.onDestroy(); |
427 |
|
} |
428 |
|
|
429 |
private final EventHandler eventHandler = new EventHandler(); |
private final EventHandler eventHandler = new EventHandler(); |
430 |
|
|
431 |
private EventHandler |
private EventHandler |
432 |
getHandler() { return eventHandler; } |
getHandler() { return eventHandler; } |
433 |
|
|
434 |
private class EventHandler implements SamplerChannelListener { |
private class EventHandler implements SamplerChannelListener, SamplerChannelListListener { |
435 |
/** |
/** |
436 |
* Invoked when changes are made to a sampler channel. |
* Invoked when changes are made to a sampler channel. |
437 |
* @param e A <code>SamplerChannelEvent</code> instance |
* @param e A <code>SamplerChannelEvent</code> instance |
459 |
voiceCountChanged(SamplerChannelEvent e) { |
voiceCountChanged(SamplerChannelEvent e) { |
460 |
screen.updateVoiceCount(getModel().getVoiceCount()); |
screen.updateVoiceCount(getModel().getVoiceCount()); |
461 |
} |
} |
462 |
|
|
463 |
|
/** |
464 |
|
* Invoked when a new sampler channel is created. |
465 |
|
* @param e A <code>SamplerChannelListEvent</code> |
466 |
|
* instance providing the event information. |
467 |
|
*/ |
468 |
|
public void |
469 |
|
channelAdded(SamplerChannelListEvent e) { } |
470 |
|
|
471 |
|
/** |
472 |
|
* Invoked when a sampler channel is removed. |
473 |
|
* @param e A <code>SamplerChannelListEvent</code> |
474 |
|
* instance providing the event information. |
475 |
|
*/ |
476 |
|
public void |
477 |
|
channelRemoved(SamplerChannelListEvent e) { |
478 |
|
// Some cleanup when the channel is removed. |
479 |
|
if(e.getChannelModel().getChannelId() == getChannelId()) { |
480 |
|
onDestroy(); |
481 |
|
} |
482 |
|
} |
483 |
} |
} |
484 |
|
|
485 |
|
|
486 |
private class PowerButton extends PixmapToggleButton implements ActionListener { |
private class PowerButton extends PixmapToggleButton |
487 |
|
implements ActionListener, PropertyChangeListener { |
488 |
|
|
489 |
PowerButton() { |
PowerButton() { |
490 |
super(Res.iconPowerOff, Res.iconPowerOn); |
super(Res.gfxPowerOff, Res.gfxPowerOn); |
491 |
|
|
492 |
setSelected(true); |
setSelected(true); |
493 |
addActionListener(this); |
addActionListener(this); |
495 |
|
|
496 |
public void |
public void |
497 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
498 |
CC.getSamplerModel().removeBackendChannel(getChannelId()); |
if(!mainPane.isAnimated()) { |
499 |
|
CC.getSamplerModel().removeBackendChannel(getChannelId()); |
500 |
|
return; |
501 |
|
} |
502 |
|
|
503 |
|
String s = JXCollapsiblePane.ANIMATION_STATE_KEY; |
504 |
|
mainPane.addPropertyChangeListener(s, this); |
505 |
|
mainPane.setCollapsed(true); |
506 |
|
} |
507 |
|
|
508 |
|
public void |
509 |
|
propertyChange(PropertyChangeEvent e) { |
510 |
|
if(e.getNewValue() == "collapsed") { |
511 |
|
CC.getSamplerModel().removeBackendChannel(getChannelId()); |
512 |
|
} |
513 |
} |
} |
514 |
|
|
515 |
public boolean |
public boolean |
518 |
|
|
519 |
private class MuteButton extends PixmapButton implements ActionListener { |
private class MuteButton extends PixmapButton implements ActionListener { |
520 |
MuteButton() { |
MuteButton() { |
521 |
super(Res.iconMuteOff); |
super(Res.gfxMuteOff); |
522 |
setDisabledIcon(Res.iconMuteSoloDisabled); |
//setDisabledIcon(Res.gfxMuteSoloDisabled); |
523 |
|
setDisabledIcon ( |
524 |
|
SubstanceImageCreator.makeTransparent(this, Res.gfxMuteOff, 0.4) |
525 |
|
); |
526 |
addActionListener(this); |
addActionListener(this); |
527 |
} |
} |
528 |
|
|
539 |
b = false; |
b = false; |
540 |
boolean hasSolo = CC.getSamplerModel().hasSoloChannel(); |
boolean hasSolo = CC.getSamplerModel().hasSoloChannel(); |
541 |
|
|
542 |
if(sc.isSoloChannel() || !hasSolo) setIcon(Res.iconMuteOff); |
if(sc.isSoloChannel() || !hasSolo) setIcon(Res.gfxMuteOff); |
543 |
else setIcon(Res.iconMutedBySolo); |
else setIcon(Res.gfxMutedBySolo); |
544 |
} else setIcon(Res.iconMuteOn); |
} else setIcon(Res.gfxMuteOn); |
545 |
|
|
546 |
Channel.this.getModel().setBackendMute(b); |
Channel.this.getModel().setBackendMute(b); |
547 |
} |
} |
552 |
|
|
553 |
private class SoloButton extends PixmapButton implements ActionListener { |
private class SoloButton extends PixmapButton implements ActionListener { |
554 |
SoloButton() { |
SoloButton() { |
555 |
super(Res.iconSoloOff); |
super(Res.gfxSoloOff); |
556 |
setDisabledIcon(Res.iconMuteSoloDisabled); |
//setDisabledIcon(Res.gfxMuteSoloDisabled); |
557 |
|
setDisabledIcon ( |
558 |
|
SubstanceImageCreator.makeTransparent(this, Res.gfxSoloOff, 0.4) |
559 |
|
); |
560 |
addActionListener(this); |
addActionListener(this); |
561 |
} |
} |
562 |
|
|
570 |
* leaving the work to the notification mechanism of the LinuxSampler. |
* leaving the work to the notification mechanism of the LinuxSampler. |
571 |
*/ |
*/ |
572 |
if(b) { |
if(b) { |
573 |
setIcon(Res.iconSoloOn); |
setIcon(Res.gfxSoloOn); |
574 |
if(sc.isMutedBySolo()) btnMute.setIcon(Res.iconMuteOff); |
if(sc.isMutedBySolo()) btnMute.setIcon(Res.gfxMuteOff); |
575 |
} else { |
} else { |
576 |
setIcon(Res.iconSoloOff); |
setIcon(Res.gfxSoloOff); |
577 |
if(!sc.isMuted() && CC.getSamplerModel().getSoloChannelCount() > 1) |
if(!sc.isMuted() && CC.getSamplerModel().getSoloChannelCount() > 1) |
578 |
btnMute.setIcon(Res.iconMutedBySolo); |
btnMute.setIcon(Res.gfxMutedBySolo); |
579 |
} |
} |
580 |
|
|
581 |
Channel.this.getModel().setBackendSolo(b); |
Channel.this.getModel().setBackendSolo(b); |
587 |
|
|
588 |
private class OptionsButton extends PixmapToggleButton implements ActionListener { |
private class OptionsButton extends PixmapToggleButton implements ActionListener { |
589 |
OptionsButton() { |
OptionsButton() { |
590 |
super(Res.iconOptionsOff, Res.iconOptionsOn); |
super(Res.gfxOptionsOff, Res.gfxOptionsOn); |
591 |
setRolloverIcon(Res.iconOptionsOffRO); |
setRolloverIcon(Res.gfxOptionsOffRO); |
592 |
this.setRolloverSelectedIcon(Res.iconOptionsOnRO); |
this.setRolloverSelectedIcon(Res.gfxOptionsOnRO); |
593 |
addActionListener(this); |
addActionListener(this); |
594 |
} |
} |
595 |
|
|
606 |
|
|
607 |
private void |
private void |
608 |
showOptionsPane(boolean show) { |
showOptionsPane(boolean show) { |
609 |
optionsPane.setVisible(show); |
optionsPane.setCollapsed(!show); |
|
MainFrame.repack(CC.getMainFrame()); |
|
610 |
} |
} |
611 |
|
|
612 |
public boolean |
public boolean |
614 |
} |
} |
615 |
} |
} |
616 |
|
|
617 |
class ChannelScreen extends JPanel { |
class ChannelPane extends PixmapPane { |
618 |
|
ChannelPane() { |
619 |
|
super(Res.gfxChannel); |
620 |
|
setPixmapInsets(new Insets(3, 3, 3, 3)); |
621 |
|
} |
622 |
|
} |
623 |
|
|
624 |
|
class ChannelScreen extends PixmapPane { |
625 |
private final Channel channel; |
private final Channel channel; |
626 |
|
|
627 |
|
private final InstrumentPane instrumentPane; |
628 |
private JButton btnInstr = new ScreenButton(i18n.getButtonLabel("ChannelScreen.btnInstr")); |
private JButton btnInstr = new ScreenButton(i18n.getButtonLabel("ChannelScreen.btnInstr")); |
|
private JButton btnReset = new ScreenButton(i18n.getButtonLabel("ChannelScreen.btnReset")); |
|
|
private JButton btnDuplicate = |
|
|
new ScreenButton(i18n.getButtonLabel("ChannelScreen.btnDuplicate")); |
|
|
|
|
|
private final JLabel lVolume = new JLabel(); |
|
|
private final JLabel lStreams = new JLabel("--"); |
|
|
private final JLabel lVoices = new JLabel("--"); |
|
629 |
|
|
630 |
ChannelScreen(Channel channel) { |
private final JButton btnEditInstr = |
631 |
|
new ScreenButton(i18n.getButtonLabel("ChannelScreen.btnEditInstr")); |
632 |
|
private final ScreenButtonBg sbbEditInstr = new ScreenButtonBg(btnEditInstr); |
633 |
|
|
634 |
|
private final JButton btnFxSends = |
635 |
|
new ScreenButton(i18n.getButtonLabel("ChannelScreen.btnFxSends")); |
636 |
|
|
637 |
|
private final JButton btnEngine |
638 |
|
= new ScreenButton(i18n.getButtonLabel("ChannelScreen.btnEngine")); |
639 |
|
|
640 |
|
private final JPopupMenu menuEngines = new JPopupMenu(); |
641 |
|
|
642 |
|
private final JLabel lVolume = new Label(); |
643 |
|
private final JLabel lStreams = new Label("--"); |
644 |
|
private final JLabel lVoices = new Label("--"); |
645 |
|
|
646 |
|
private InformationDialog fxSendsDlg = null; |
647 |
|
|
648 |
|
private Dimension dimVolume; |
649 |
|
|
650 |
|
private Timer timer; |
651 |
|
|
652 |
|
class Label extends JLabel { |
653 |
|
Label() { this(""); } |
654 |
|
|
655 |
|
Label(String s) { |
656 |
|
super(s); |
657 |
|
setFont(Res.fontScreen); |
658 |
|
setForeground(new java.awt.Color(0xFFA300)); |
659 |
|
} |
660 |
|
} |
661 |
|
|
662 |
|
ChannelScreen(final Channel channel) { |
663 |
|
super(Res.gfxChannelScreen); |
664 |
|
setPixmapInsets(new Insets(6, 6, 6, 6)); |
665 |
|
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
666 |
|
|
667 |
this.channel = channel; |
this.channel = channel; |
668 |
|
|
669 |
setName("ChannelScreen"); |
setOpaque(false); |
|
setOpaque(true); |
|
670 |
|
|
671 |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
672 |
|
|
|
btnInstr.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); |
|
673 |
btnInstr.setAlignmentX(CENTER_ALIGNMENT); |
btnInstr.setAlignmentX(CENTER_ALIGNMENT); |
674 |
|
btnInstr.setRolloverEnabled(false); |
675 |
|
btnInstr.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); |
676 |
|
|
677 |
add(btnInstr); |
instrumentPane = new InstrumentPane(); |
678 |
|
add(instrumentPane); |
679 |
|
|
680 |
JPanel p = new JPanel(); |
JPanel p = new JPanel(); |
|
p.setOpaque(false); |
|
681 |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
682 |
p.setAlignmentX(CENTER_ALIGNMENT); |
p.setAlignmentX(CENTER_ALIGNMENT); |
683 |
p.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); |
p.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
|
//lVolume.setFont(lVolume.getFont().deriveFont(java.awt.Font.PLAIN)); |
|
684 |
|
|
685 |
p.add(btnDuplicate); |
btnFxSends.setToolTipText(i18n.getButtonLabel("ChannelScreen.btnFxSends.tt")); |
686 |
|
btnFxSends.addActionListener(new ActionListener() { |
687 |
|
public void |
688 |
|
actionPerformed(ActionEvent e) { |
689 |
|
if(fxSendsDlg != null && fxSendsDlg.isVisible()) { |
690 |
|
fxSendsDlg.toFront(); |
691 |
|
return; |
692 |
|
} |
693 |
|
FxSendsPane p = new FxSendsPane(channel.getModel()); |
694 |
|
int id = channel.getModel().getChannelId(); |
695 |
|
fxSendsDlg = new InformationDialog(CC.getMainFrame(), p); |
696 |
|
fxSendsDlg.setTitle(i18n.getLabel("FxSendsDlg.title", id)); |
697 |
|
fxSendsDlg.setModal(false); |
698 |
|
fxSendsDlg.showCloseButton(false); |
699 |
|
fxSendsDlg.setVisible(true); |
700 |
|
} |
701 |
|
}); |
702 |
|
|
703 |
|
p.add(btnFxSends); |
704 |
|
|
705 |
p.add(Box.createRigidArea(new Dimension(6, 0))); |
p.add(Box.createRigidArea(new Dimension(6, 0))); |
706 |
|
|
707 |
p.add(new JLabel("|")); |
btnEngine.setIcon(Res.iconEngine12); |
708 |
|
p.add(btnEngine); |
709 |
|
//p.add(new Label("|")); |
710 |
|
|
711 |
p.add(Box.createRigidArea(new Dimension(6, 0))); |
//p.add(Box.createRigidArea(new Dimension(6, 0))); |
712 |
|
|
713 |
p.add(btnReset); |
//p.add(btnReset); |
714 |
|
|
715 |
p.add(Box.createGlue()); |
p.add(Box.createGlue()); |
716 |
|
|
717 |
p.add(lStreams); |
p.add(lStreams); |
718 |
p.add(new JLabel("/")); |
p.add(new Label("/")); |
719 |
p.add(lVoices); |
p.add(lVoices); |
720 |
|
|
721 |
p.add(Box.createRigidArea(new Dimension(12, 0))); |
p.add(Box.createRigidArea(new Dimension(12, 0))); |
722 |
|
|
723 |
|
lVolume.setIcon(Res.iconVolume14); |
724 |
lVolume.setAlignmentX(RIGHT_ALIGNMENT); |
lVolume.setAlignmentX(RIGHT_ALIGNMENT); |
725 |
|
updateVolumeInfo(100); |
726 |
|
dimVolume = lVolume.getPreferredSize(); |
727 |
p.add(lVolume); |
p.add(lVolume); |
728 |
p.setPreferredSize(new Dimension(250, p.getPreferredSize().height)); |
p.setPreferredSize(new Dimension(250, p.getPreferredSize().height)); |
729 |
p.setMinimumSize(p.getPreferredSize()); |
p.setMinimumSize(p.getPreferredSize()); |
730 |
p.setMaximumSize(p.getPreferredSize()); |
p.setMaximumSize(p.getPreferredSize()); |
731 |
|
|
732 |
|
//btnInstr.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); |
733 |
|
p.setOpaque(false); |
734 |
add(p); |
add(p); |
735 |
|
|
736 |
|
|
738 |
setMinimumSize(getPreferredSize()); |
setMinimumSize(getPreferredSize()); |
739 |
setMaximumSize(getPreferredSize()); |
setMaximumSize(getPreferredSize()); |
740 |
|
|
741 |
|
createEngineMenu(); |
742 |
installListeners(); |
installListeners(); |
743 |
} |
} |
744 |
|
|
745 |
|
protected void |
746 |
|
onDestroy() { timer.stop(); } |
747 |
|
|
748 |
|
private void |
749 |
|
createEngineMenu() { |
750 |
|
for(final SamplerEngine engine : CC.getSamplerModel().getEngines()) { |
751 |
|
JMenuItem mi = new JMenuItem(engine.getDescription()); |
752 |
|
|
753 |
|
mi.addActionListener(new ActionListener() { |
754 |
|
public void |
755 |
|
actionPerformed(ActionEvent e) { |
756 |
|
channel.getModel().setBackendEngineType(engine.getName()); |
757 |
|
} |
758 |
|
}); |
759 |
|
|
760 |
|
menuEngines.add(mi); |
761 |
|
} |
762 |
|
} |
763 |
|
|
764 |
private void |
private void |
765 |
installListeners() { |
installListeners() { |
766 |
btnInstr.addActionListener(new ActionListener() { |
btnInstr.addActionListener(new ActionListener() { |
767 |
public void |
public void |
768 |
actionPerformed(ActionEvent e) { loadInstrument(); } |
actionPerformed(ActionEvent e) { loadInstrument(); } |
769 |
}); |
}); |
770 |
|
|
771 |
btnReset.addActionListener(new ActionListener() { |
btnEditInstr.addActionListener(new ActionListener() { |
772 |
public void |
public void |
773 |
actionPerformed(ActionEvent e) { channel.getModel().resetBackendChannel(); } |
actionPerformed(ActionEvent e) { |
774 |
|
CC.getSamplerModel().editBackendInstrument(channel.getChannelId()); |
775 |
|
} |
776 |
}); |
}); |
777 |
|
|
778 |
btnDuplicate.addActionListener(new ActionListener() { |
btnEngine.addActionListener(new ActionListener() { |
779 |
public void |
public void |
780 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
781 |
channel.getModel().duplicateBackendChannel(); |
int y = btnEngine.getHeight() + 1; |
782 |
|
menuEngines.show(btnEngine, 0, y); |
783 |
} |
} |
784 |
}); |
}); |
785 |
|
|
786 |
|
addMouseListener(getHandler()); |
787 |
|
addHierarchyListener(getHandler()); |
788 |
|
|
789 |
|
ActionListener l = new ActionListener() { |
790 |
|
public void |
791 |
|
actionPerformed(ActionEvent e) { |
792 |
|
if(getMousePosition(true) != null) { |
793 |
|
getHandler().mouseEntered(null); |
794 |
|
} else { |
795 |
|
getHandler().mouseExited(null); |
796 |
|
} |
797 |
|
} |
798 |
|
}; |
799 |
|
timer = new Timer(1000, l); |
800 |
|
timer.start(); |
801 |
} |
} |
802 |
|
|
803 |
private void |
private void |
804 |
loadInstrument() { |
loadInstrument() { |
805 |
InstrumentChooser dlg = new InstrumentChooser(CC.getMainFrame()); |
JSInstrumentChooser dlg = new JSInstrumentChooser(CC.getMainFrame()); |
806 |
dlg.setVisible(true); |
dlg.setVisible(true); |
807 |
|
|
808 |
if(!dlg.isCancelled()) { |
if(!dlg.isCancelled()) { |
809 |
SamplerChannelModel m = channel.getModel(); |
SamplerChannelModel m = channel.getModel(); |
810 |
m.loadBackendInstrument(dlg.getFileName(), dlg.getInstrumentIndex()); |
m.loadBackendInstrument(dlg.getInstrumentFile(), dlg.getInstrumentIndex()); |
811 |
} |
} |
812 |
} |
} |
813 |
|
|
824 |
if(sc.getInstrumentName() != null) btnInstr.setText(sc.getInstrumentName()); |
if(sc.getInstrumentName() != null) btnInstr.setText(sc.getInstrumentName()); |
825 |
else btnInstr.setText(i18n.getButtonLabel("ChannelScreen.btnInstr")); |
else btnInstr.setText(i18n.getButtonLabel("ChannelScreen.btnInstr")); |
826 |
} |
} |
|
|
|
827 |
|
|
828 |
|
instrumentPane.update(); |
829 |
|
|
830 |
|
if(sc.getEngine() != null) { |
831 |
|
String s = sc.getEngine().getDescription(); |
832 |
|
if(!s.equals(btnEngine.getText())) btnEngine.setText(s); |
833 |
|
} |
834 |
|
|
835 |
} |
} |
836 |
|
|
837 |
protected void |
protected void |
838 |
updateVolumeInfo(int volume) { |
updateVolumeInfo(int volume) { |
839 |
lVolume.setText(i18n.getLabel("ChannelScreen.volume", volume)); |
lVolume.setText(i18n.getLabel("ChannelScreen.volume", volume)); |
840 |
|
lVolume.setMinimumSize(dimVolume); |
841 |
|
lVolume.setPreferredSize(dimVolume); |
842 |
|
|
843 |
} |
} |
844 |
|
|
870 |
lVoices.setMaximumSize(d); |
lVoices.setMaximumSize(d); |
871 |
} |
} |
872 |
|
|
873 |
|
class InstrumentPane extends JPanel { |
874 |
|
private final JPanel leftPane = new JPanel(); |
875 |
|
private final JPanel rightPane = new JPanel(); |
876 |
|
|
877 |
|
InstrumentPane() { |
878 |
|
setOpaque(false); |
879 |
|
setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); |
880 |
|
add(leftPane); |
881 |
|
add(btnInstr); |
882 |
|
add(rightPane); |
883 |
|
add(sbbEditInstr); |
884 |
|
btnEditInstr.setToolTipText(i18n.getLabel("ChannelScreen.btnEditInstr.tt")); |
885 |
|
sbbEditInstr.setVisible(false); |
886 |
|
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 6)); |
887 |
|
|
888 |
|
update(); |
889 |
|
} |
890 |
|
|
891 |
|
public void |
892 |
|
update() { |
893 |
|
int a = btnInstr.getMinimumSize().width; |
894 |
|
int b = 0; |
895 |
|
if(sbbEditInstr.isVisible()) b = sbbEditInstr.getPreferredSize().width; |
896 |
|
|
897 |
|
int max = 254 - b; |
898 |
|
if(a > max) a = max; |
899 |
|
|
900 |
|
int h = btnInstr.getPreferredSize().height; |
901 |
|
btnInstr.setPreferredSize(new Dimension(a, h)); |
902 |
|
h = btnInstr.getMaximumSize().height; |
903 |
|
btnInstr.setMaximumSize(new Dimension(a, h)); |
904 |
|
|
905 |
|
|
906 |
|
int i = (254 - btnInstr.getPreferredSize().width) / 2; |
907 |
|
|
908 |
|
int j = i; |
909 |
|
if(sbbEditInstr.isVisible()) j -= sbbEditInstr.getPreferredSize().width; |
910 |
|
if(i < 0 || j < 0) i = j = 0; |
911 |
|
|
912 |
|
Dimension d = new Dimension(i, 1); |
913 |
|
leftPane.setMinimumSize(d); |
914 |
|
leftPane.setPreferredSize(d); |
915 |
|
leftPane.setMaximumSize(d); |
916 |
|
|
917 |
|
d = new Dimension(j, 1); |
918 |
|
rightPane.setMinimumSize(d); |
919 |
|
rightPane.setPreferredSize(d); |
920 |
|
rightPane.setMaximumSize(d); |
921 |
|
|
922 |
|
validate(); |
923 |
|
} |
924 |
|
} |
925 |
|
|
926 |
|
class FxSendsPane extends JSFxSendsPane { |
927 |
|
FxSendsPane(SamplerChannelModel model) { |
928 |
|
super(model); |
929 |
|
|
930 |
|
actionAddFxSend.putValue(Action.SMALL_ICON, Res.iconNew16); |
931 |
|
actionRemoveFxSend.putValue(Action.SMALL_ICON, Res.iconDelete16); |
932 |
|
} |
933 |
|
|
934 |
|
protected JToolBar |
935 |
|
createToolBar() { |
936 |
|
JToolBar tb = new JToolBar(); |
937 |
|
Dimension d = new Dimension(Short.MAX_VALUE, tb.getPreferredSize().height); |
938 |
|
tb.setMaximumSize(d); |
939 |
|
tb.setFloatable(false); |
940 |
|
tb.setAlignmentX(JPanel.RIGHT_ALIGNMENT); |
941 |
|
|
942 |
|
tb.add(new ToolbarButton(actionAddFxSend)); |
943 |
|
tb.add(new ToolbarButton(actionRemoveFxSend)); |
944 |
|
|
945 |
|
return tb; |
946 |
|
} |
947 |
|
} |
948 |
|
|
949 |
static class ScreenButton extends JButton { |
static class ScreenButton extends JButton { |
950 |
ScreenButton(String s) { |
ScreenButton(String s) { |
951 |
super(s); |
super(s); |
953 |
setFocusPainted(false); |
setFocusPainted(false); |
954 |
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
955 |
setMargin(new Insets(0, 0, 0, 0)); |
setMargin(new Insets(0, 0, 0, 0)); |
956 |
|
|
957 |
|
putClientProperty ( |
958 |
|
SubstanceLookAndFeel.BUTTON_NO_MIN_SIZE_PROPERTY, Boolean.TRUE |
959 |
|
); |
960 |
|
|
961 |
|
putClientProperty ( |
962 |
|
SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY, Boolean.TRUE |
963 |
|
); |
964 |
|
|
965 |
|
putClientProperty(SubstanceLookAndFeel.FLAT_PROPERTY, Boolean.TRUE); |
966 |
|
|
967 |
|
FadeConfigurationManager.getInstance().disallowFades(FadeKind.ROLLOVER, this); |
968 |
|
|
969 |
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
970 |
|
setFont(Res.fontScreen); |
971 |
|
setForeground(new java.awt.Color(0xFFA300)); |
972 |
|
} |
973 |
|
} |
974 |
|
|
975 |
|
static class ScreenButtonBg extends PixmapPane { |
976 |
|
ScreenButtonBg(JButton btn) { |
977 |
|
super(Res.gfxScreenBtnBg); |
978 |
|
setPixmapInsets(new Insets(4, 4, 4, 4)); |
979 |
|
setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); |
980 |
|
setBorder(BorderFactory.createEmptyBorder(0, 7, 0, 7)); |
981 |
|
add(btn); |
982 |
|
setPreferredSize(new Dimension(getPreferredSize().width, 13)); |
983 |
|
} |
984 |
|
|
985 |
|
public Dimension |
986 |
|
getPreferredSize() { |
987 |
|
return new Dimension(super.getPreferredSize().width, 13); |
988 |
|
} |
989 |
|
} |
990 |
|
|
991 |
|
private final EventHandler eventHandler = new EventHandler(); |
992 |
|
|
993 |
|
private EventHandler |
994 |
|
getHandler() { return eventHandler; } |
995 |
|
|
996 |
|
private class EventHandler extends MouseAdapter implements HierarchyListener { |
997 |
|
public void |
998 |
|
mouseEntered(MouseEvent e) { |
999 |
|
if(!sbbEditInstr.isVisible()) { |
1000 |
|
sbbEditInstr.setVisible(true); |
1001 |
|
instrumentPane.update(); |
1002 |
|
} |
1003 |
|
} |
1004 |
|
|
1005 |
|
public void |
1006 |
|
mouseExited(MouseEvent e) { |
1007 |
|
if(getMousePosition(true) != null) return; |
1008 |
|
if(sbbEditInstr.isVisible()) { |
1009 |
|
sbbEditInstr.setVisible(false); |
1010 |
|
instrumentPane.update(); |
1011 |
|
} |
1012 |
|
} |
1013 |
|
|
1014 |
|
/** Called when the hierarchy has been changed. */ |
1015 |
|
public void |
1016 |
|
hierarchyChanged(HierarchyEvent e) { |
1017 |
|
if((e.getChangeFlags() & e.SHOWING_CHANGED) == e.SHOWING_CHANGED) { |
1018 |
|
if(getMousePosition() == null) mouseExited(null); |
1019 |
|
else mouseEntered(null); |
1020 |
|
} |
1021 |
} |
} |
1022 |
} |
} |
1023 |
} |
} |
1024 |
|
|
1025 |
class ChannelOptions extends JPanel { |
class ChannelOptions extends JXCollapsiblePane { |
1026 |
private final Channel channel; |
private final Channel channel; |
1027 |
|
private MidiDeviceModel midiDevice = null; |
1028 |
|
|
1029 |
|
private final JComboBox cbMidiDevice = new FantasiaComboBox(); |
1030 |
|
private final JComboBox cbMidiPort = new FantasiaComboBox(); |
1031 |
|
private final JComboBox cbMidiChannel = new FantasiaComboBox(); |
1032 |
|
private final JComboBox cbInstrumentMap = new FantasiaComboBox(); |
1033 |
|
private final JComboBox cbAudioDevice = new FantasiaComboBox(); |
1034 |
|
|
1035 |
private final JComboBox cbMidiDevice = new JComboBox(); |
private final PixmapButton btnChannelRouting; |
|
private final JComboBox cbMidiPort = new JComboBox(); |
|
|
private final JComboBox cbMidiChannel = new JComboBox(); |
|
|
private final JComboBox cbEngine = new JComboBox(); |
|
|
private final JComboBox cbAudioDevice = new JComboBox(); |
|
1036 |
|
|
1037 |
private boolean update = false; |
private boolean update = false; |
1038 |
|
|
1039 |
ChannelOptions(Channel channel) { |
private final SamplerListener samplerListener; |
1040 |
|
private final MapListListener mapListListener = new MapListListener(); |
1041 |
|
|
1042 |
|
private class NoMap { |
1043 |
|
public String |
1044 |
|
toString() { return "[None]"; } |
1045 |
|
} |
1046 |
|
|
1047 |
|
private NoMap noMap = new NoMap(); |
1048 |
|
|
1049 |
|
private class DefaultMap { |
1050 |
|
public String |
1051 |
|
toString() { return "[Default]"; } |
1052 |
|
} |
1053 |
|
|
1054 |
|
private DefaultMap defaultMap = new DefaultMap(); |
1055 |
|
|
1056 |
|
ChannelOptions(final Channel channel) { |
1057 |
|
setAnimated(false); |
1058 |
|
setCollapsed(true); |
1059 |
|
setAnimated(preferences().getBoolProperty(ANIMATED)); |
1060 |
|
|
1061 |
|
preferences().addPropertyChangeListener(ANIMATED, new PropertyChangeListener() { |
1062 |
|
public void |
1063 |
|
propertyChange(PropertyChangeEvent e) { |
1064 |
|
setAnimated(preferences().getBoolProperty(ANIMATED)); |
1065 |
|
} |
1066 |
|
}); |
1067 |
|
|
1068 |
|
PixmapPane bgp = new PixmapPane(Res.gfxChannelOptions); |
1069 |
|
bgp.setPixmapInsets(new Insets(1, 1, 1, 1)); |
1070 |
|
|
1071 |
this.channel = channel; |
this.channel = channel; |
1072 |
|
|
1073 |
setName("ChannelOptions"); |
bgp.setBorder(BorderFactory.createEmptyBorder(5, 4, 5, 4)); |
1074 |
setVisible(false); |
bgp.setLayout(new BoxLayout(bgp, BoxLayout.X_AXIS)); |
|
setBorder(BorderFactory.createEmptyBorder(5, 4, 5, 4)); |
|
|
setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); |
|
1075 |
|
|
1076 |
setPreferredSize(new Dimension(420, 44)); |
bgp.setPreferredSize(new Dimension(420, 44)); |
1077 |
setMinimumSize(getPreferredSize()); |
bgp.setMinimumSize(getPreferredSize()); |
1078 |
setMaximumSize(getPreferredSize()); |
bgp.setMaximumSize(getPreferredSize()); |
1079 |
|
|
1080 |
JPanel p = new JPanel(); |
JPanel p = new JPanel(); |
|
p.setOpaque(true); |
|
1081 |
p.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 4)); |
p.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 4)); |
1082 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
1083 |
JLabel l = new JLabel(Res.iconMidiInputTitle); |
JLabel l = new JLabel(Res.gfxMidiInputTitle); |
1084 |
l.setAlignmentX(LEFT_ALIGNMENT); |
l.setAlignmentX(LEFT_ALIGNMENT); |
1085 |
p.add(l); |
p.add(l); |
1086 |
|
|
1101 |
o = cbMidiPort.getRenderer(); |
o = cbMidiPort.getRenderer(); |
1102 |
if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.CENTER); |
if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.CENTER); |
1103 |
|
|
1104 |
cbMidiPort.setPreferredSize(new Dimension(67, 18)); |
cbMidiPort.setPreferredSize(new Dimension(62, 18)); |
1105 |
cbMidiPort.setMinimumSize(cbMidiPort.getPreferredSize()); |
cbMidiPort.setMinimumSize(cbMidiPort.getPreferredSize()); |
1106 |
cbMidiPort.setMaximumSize(cbMidiPort.getPreferredSize()); |
cbMidiPort.setMaximumSize(cbMidiPort.getPreferredSize()); |
1107 |
p2.add(cbMidiPort); |
p2.add(cbMidiPort); |
1119 |
|
|
1120 |
p2.add(cbMidiChannel); |
p2.add(cbMidiChannel); |
1121 |
p2.setAlignmentX(LEFT_ALIGNMENT); |
p2.setAlignmentX(LEFT_ALIGNMENT); |
1122 |
|
p2.setOpaque(false); |
1123 |
p.add(p2); |
p.add(p2); |
1124 |
|
p.setBackground(new java.awt.Color(0x818181)); |
1125 |
|
|
1126 |
add(p); |
bgp.add(p); |
1127 |
|
|
1128 |
add(Box.createRigidArea(new Dimension(4, 0))); |
bgp.add(Box.createRigidArea(new Dimension(4, 0))); |
1129 |
|
|
1130 |
p = new JPanel(); |
p = new JPanel(); |
1131 |
p.setOpaque(true); |
p.setOpaque(true); |
1132 |
p.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 4)); |
p.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 4)); |
1133 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
1134 |
l = new JLabel(Res.iconEngineTitle); |
l = new JLabel(Res.gfxInstrumentMapTitle); |
1135 |
l.setAlignmentX(LEFT_ALIGNMENT); |
l.setAlignmentX(LEFT_ALIGNMENT); |
1136 |
l.setAlignmentX(LEFT_ALIGNMENT); |
l.setAlignmentX(LEFT_ALIGNMENT); |
1137 |
p.add(l); |
p.add(l); |
1138 |
|
|
1139 |
p.add(Box.createRigidArea(new Dimension(0, 3))); |
p.add(Box.createRigidArea(new Dimension(0, 3))); |
1140 |
|
|
1141 |
o = cbEngine.getRenderer(); |
//o = cbInstrumentMap.getRenderer(); |
1142 |
if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.CENTER); |
//if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.CENTER); |
|
|
|
|
for(SamplerEngine e : CC.getSamplerModel().getEngines()) cbEngine.addItem(e); |
|
|
cbEngine.setPreferredSize(new Dimension(125, 18)); |
|
|
cbEngine.setMinimumSize(cbEngine.getPreferredSize()); |
|
|
cbEngine.setMaximumSize(cbEngine.getPreferredSize()); |
|
|
cbEngine.setAlignmentX(LEFT_ALIGNMENT); |
|
|
p.add(cbEngine); |
|
1143 |
|
|
1144 |
add(p); |
cbInstrumentMap.setPreferredSize(new Dimension(126, 18)); |
1145 |
|
cbInstrumentMap.setMinimumSize(cbInstrumentMap.getPreferredSize()); |
1146 |
|
cbInstrumentMap.setMaximumSize(cbInstrumentMap.getPreferredSize()); |
1147 |
|
cbInstrumentMap.setAlignmentX(LEFT_ALIGNMENT); |
1148 |
|
p.add(cbInstrumentMap); |
1149 |
|
p.setBackground(new java.awt.Color(0x818181)); |
1150 |
|
bgp.add(p); |
1151 |
|
|
1152 |
add(Box.createRigidArea(new Dimension(4, 0))); |
bgp.add(Box.createRigidArea(new Dimension(4, 0))); |
1153 |
|
|
1154 |
p = new JPanel(); |
p = new JPanel(); |
1155 |
p.setOpaque(true); |
p.setOpaque(true); |
1156 |
p.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 4)); |
p.setBorder(BorderFactory.createEmptyBorder(3, 4, 3, 4)); |
1157 |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
1158 |
l = new JLabel(Res.iconAudioOutputTitle); |
l = new JLabel(Res.gfxAudioOutputTitle); |
|
l.setAlignmentX(LEFT_ALIGNMENT); |
|
1159 |
l.setAlignmentX(LEFT_ALIGNMENT); |
l.setAlignmentX(LEFT_ALIGNMENT); |
1160 |
p.add(l); |
p.add(l); |
1161 |
|
|
1162 |
p.add(Box.createRigidArea(new Dimension(0, 3))); |
//p.add(Box.createRigidArea(new Dimension(0, 3))); |
1163 |
|
|
1164 |
|
p2 = new JPanel(); |
1165 |
|
p2.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0)); |
1166 |
|
p2.setLayout(new BoxLayout(p2, BoxLayout.X_AXIS)); |
1167 |
|
p2.setOpaque(false); |
1168 |
|
p2.setAlignmentX(LEFT_ALIGNMENT); |
1169 |
|
|
1170 |
o = cbAudioDevice.getRenderer(); |
o = cbAudioDevice.getRenderer(); |
1171 |
if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.RIGHT); |
if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.RIGHT); |
1172 |
|
|
1173 |
cbAudioDevice.setPreferredSize(new Dimension(61, 18)); |
cbAudioDevice.setPreferredSize(new Dimension(40, 18)); |
1174 |
cbAudioDevice.setMinimumSize(cbAudioDevice.getPreferredSize()); |
cbAudioDevice.setMinimumSize(cbAudioDevice.getPreferredSize()); |
1175 |
cbAudioDevice.setMaximumSize(cbAudioDevice.getPreferredSize()); |
cbAudioDevice.setMaximumSize(cbAudioDevice.getPreferredSize()); |
|
cbAudioDevice.setAlignmentX(LEFT_ALIGNMENT); |
|
|
p.add(cbAudioDevice); |
|
1176 |
|
|
1177 |
add(p); |
p2.add(cbAudioDevice); |
1178 |
|
p2.add(Box.createRigidArea(new Dimension(3, 0))); |
1179 |
|
btnChannelRouting = new PixmapButton(Res.gfxBtnCr, Res.gfxBtnCrRO); |
1180 |
|
btnChannelRouting.setPressedIcon(Res.gfxBtnCrRO); |
1181 |
|
btnChannelRouting.setEnabled(false); |
1182 |
|
btnChannelRouting.setToolTipText(i18n.getLabel("ChannelOptions.routing")); |
1183 |
|
|
1184 |
|
btnChannelRouting.addActionListener(new ActionListener() { |
1185 |
|
public void |
1186 |
|
actionPerformed(ActionEvent e) { |
1187 |
|
SamplerChannel c = channel.getChannelInfo(); |
1188 |
|
new JSChannelOutputRoutingDlg(CC.getMainFrame(), c).setVisible(true); |
1189 |
|
|
1190 |
|
} |
1191 |
|
}); |
1192 |
|
|
1193 |
|
p2.add(btnChannelRouting); |
1194 |
|
|
1195 |
|
p.add(p2); |
1196 |
|
p.setBackground(new java.awt.Color(0x818181)); |
1197 |
|
p2 = new JPanel(); |
1198 |
|
p2.setLayout(new java.awt.BorderLayout()); |
1199 |
|
p.add(p2); |
1200 |
|
bgp.add(p); |
1201 |
|
|
1202 |
|
setContentPane(bgp); |
1203 |
|
|
1204 |
cbMidiDevice.addActionListener(new ActionListener() { |
cbMidiDevice.addActionListener(new ActionListener() { |
1205 |
public void |
public void |
1216 |
actionPerformed(ActionEvent e) { setMidiChannel(); } |
actionPerformed(ActionEvent e) { setMidiChannel(); } |
1217 |
}); |
}); |
1218 |
|
|
1219 |
cbEngine.addActionListener(new ActionListener() { |
samplerListener = new SamplerAdapter() { |
1220 |
|
/** Invoked when the default MIDI instrument map is changed. */ |
1221 |
|
public void |
1222 |
|
defaultMapChanged(SamplerEvent e) { |
1223 |
|
updateCbInstrumentMapToolTipText(); |
1224 |
|
|
1225 |
|
} |
1226 |
|
}; |
1227 |
|
|
1228 |
|
CC.getSamplerModel().addSamplerListener(samplerListener); |
1229 |
|
|
1230 |
|
cbInstrumentMap.addItem(noMap); |
1231 |
|
cbInstrumentMap.addItem(defaultMap); |
1232 |
|
for(MidiInstrumentMap map : CC.getSamplerModel().getMidiInstrumentMaps()) { |
1233 |
|
cbInstrumentMap.addItem(map); |
1234 |
|
} |
1235 |
|
|
1236 |
|
int map = channel.getModel().getChannelInfo().getMidiInstrumentMapId(); |
1237 |
|
cbInstrumentMap.setSelectedItem(CC.getSamplerModel().getMidiInstrumentMapById(map)); |
1238 |
|
if(cbInstrumentMap.getSelectedItem() == null) { |
1239 |
|
if(map == -1) cbInstrumentMap.setSelectedItem(noMap); |
1240 |
|
else if(map == -2) { |
1241 |
|
cbInstrumentMap.setSelectedItem(defaultMap); |
1242 |
|
} |
1243 |
|
} |
1244 |
|
|
1245 |
|
updateCbInstrumentMapToolTipText(); |
1246 |
|
|
1247 |
|
if(channel.getModel().getChannelInfo().getEngine() == null) { |
1248 |
|
cbInstrumentMap.setEnabled(false); |
1249 |
|
} |
1250 |
|
|
1251 |
|
cbInstrumentMap.addActionListener(new ActionListener() { |
1252 |
public void |
public void |
1253 |
actionPerformed(ActionEvent e) { setEngineType(); } |
actionPerformed(ActionEvent e) { updateInstrumentMap(); } |
1254 |
}); |
}); |
1255 |
|
|
1256 |
|
CC.getSamplerModel().addMidiInstrumentMapListListener(mapListListener); |
1257 |
|
|
1258 |
cbAudioDevice.addActionListener(new ActionListener() { |
cbAudioDevice.addActionListener(new ActionListener() { |
1259 |
public void |
public void |
1260 |
actionPerformed(ActionEvent e) { setBackendAudioDevice(); } |
actionPerformed(ActionEvent e) { setBackendAudioDevice(); } |
1292 |
try { |
try { |
1293 |
cbMidiDevice.setSelectedItem(mm == null ? null : mm.getDeviceInfo()); |
cbMidiDevice.setSelectedItem(mm == null ? null : mm.getDeviceInfo()); |
1294 |
|
|
|
cbEngine.setSelectedItem(sc.getEngine()); |
|
|
|
|
1295 |
cbAudioDevice.setSelectedItem(am == null ? null : am.getDeviceInfo()); |
cbAudioDevice.setSelectedItem(am == null ? null : am.getDeviceInfo()); |
1296 |
|
btnChannelRouting.setEnabled(am != null); |
1297 |
} catch(Exception x) { |
} catch(Exception x) { |
1298 |
CC.getLogger().log(Level.WARNING, "Unkown error", x); |
CC.getLogger().log(Level.WARNING, "Unkown error", x); |
1299 |
} |
} |
1300 |
|
|
1301 |
|
if(sc.getEngine() != null) { |
1302 |
|
cbInstrumentMap.setEnabled(true); |
1303 |
|
int id = sc.getMidiInstrumentMapId(); |
1304 |
|
Object o; |
1305 |
|
if(id == -2) o = defaultMap; |
1306 |
|
else if(id == -1) o = noMap; |
1307 |
|
else o = CC.getSamplerModel().getMidiInstrumentMapById(id); |
1308 |
|
|
1309 |
|
if(cbInstrumentMap.getSelectedItem() != o) { |
1310 |
|
cbInstrumentMap.setSelectedItem(o); |
1311 |
|
} |
1312 |
|
} else { |
1313 |
|
cbInstrumentMap.setSelectedItem(noMap); |
1314 |
|
cbInstrumentMap.setEnabled(false); |
1315 |
|
} |
1316 |
|
|
1317 |
setUpdate(false); |
setUpdate(false); |
1318 |
} |
} |
1319 |
|
|
1342 |
setUpdate(false); |
setUpdate(false); |
1343 |
} |
} |
1344 |
|
|
1345 |
|
|
1346 |
|
private void |
1347 |
|
updateInstrumentMap() { |
1348 |
|
updateCbInstrumentMapToolTipText(); |
1349 |
|
|
1350 |
|
int id = channel.getModel().getChannelInfo().getMidiInstrumentMapId(); |
1351 |
|
Object o = cbInstrumentMap.getSelectedItem(); |
1352 |
|
if(o == null && id == -1) return; |
1353 |
|
|
1354 |
|
int cbId; |
1355 |
|
if(o == null || o == noMap) cbId = -1; |
1356 |
|
else if(o == defaultMap) cbId = -2; |
1357 |
|
else cbId = ((MidiInstrumentMap)o).getMapId(); |
1358 |
|
|
1359 |
|
if(cbId == id) return; |
1360 |
|
|
1361 |
|
channel.getModel().setBackendMidiInstrumentMap(cbId); |
1362 |
|
} |
1363 |
|
|
1364 |
|
private void |
1365 |
|
updateCbInstrumentMapToolTipText() { |
1366 |
|
if(cbInstrumentMap.getSelectedItem() != defaultMap) { |
1367 |
|
cbInstrumentMap.setToolTipText(null); |
1368 |
|
return; |
1369 |
|
} |
1370 |
|
|
1371 |
|
MidiInstrumentMap m = CC.getSamplerModel().getDefaultMidiInstrumentMap(); |
1372 |
|
if(m != null) { |
1373 |
|
String s = i18n.getLabel("Channel.ttDefault", m.getName()); |
1374 |
|
cbInstrumentMap.setToolTipText(s); |
1375 |
|
} else { |
1376 |
|
cbInstrumentMap.setToolTipText(null); |
1377 |
|
} |
1378 |
|
} |
1379 |
|
|
1380 |
/** |
/** |
1381 |
* Updates the audio device list. |
* Updates the audio device list. |
1382 |
*/ |
*/ |
1414 |
return; |
return; |
1415 |
} |
} |
1416 |
|
|
1417 |
|
if(midiDevice != null) midiDevice.removeMidiDeviceListener(getHandler()); |
1418 |
|
|
1419 |
cbMidiPort.removeAllItems(); |
cbMidiPort.removeAllItems(); |
1420 |
|
|
1421 |
if(mid == null) { |
if(mid == null) { |
1422 |
|
midiDevice = null; |
1423 |
cbMidiPort.setEnabled(false); |
cbMidiPort.setEnabled(false); |
1424 |
|
|
1425 |
cbMidiChannel.setSelectedItem(null); |
cbMidiChannel.setSelectedItem(null); |
1426 |
cbMidiChannel.setEnabled(false); |
cbMidiChannel.setEnabled(false); |
1427 |
} else { |
} else { |
1428 |
|
midiDevice = CC.getSamplerModel().getMidiDeviceById(mid.getDeviceId()); |
1429 |
|
if(midiDevice != null) midiDevice.addMidiDeviceListener(getHandler()); |
1430 |
|
|
1431 |
cbMidiPort.setEnabled(true); |
cbMidiPort.setEnabled(true); |
1432 |
|
|
1433 |
MidiPort[] ports = mid.getMidiPorts(); |
MidiPort[] ports = mid.getMidiPorts(); |
1462 |
channel.getModel().setBackendMidiInputChannel(c); |
channel.getModel().setBackendMidiInputChannel(c); |
1463 |
} |
} |
1464 |
|
|
|
/** Invoked when the user selects an engine. */ |
|
|
private void |
|
|
setEngineType() { |
|
|
Object oldEngine = channel.getModel().getChannelInfo().getEngine(); |
|
|
SamplerEngine newEngine = (SamplerEngine)cbEngine.getSelectedItem(); |
|
|
|
|
|
if(oldEngine != null) { if(oldEngine.equals(newEngine)) return; } |
|
|
else if(newEngine == null) return; |
|
|
|
|
|
channel.getModel().setBackendEngineType(newEngine.getName()); |
|
|
|
|
|
} |
|
|
|
|
1465 |
private void |
private void |
1466 |
setBackendAudioDevice() { |
setBackendAudioDevice() { |
1467 |
if(isUpdate()) return; |
if(isUpdate()) return; |
1486 |
private void |
private void |
1487 |
setUpdate(boolean b) { update = b; } |
setUpdate(boolean b) { update = b; } |
1488 |
|
|
1489 |
|
protected void |
1490 |
|
onDestroy() { |
1491 |
|
SamplerModel sm = CC.getSamplerModel(); |
1492 |
|
|
1493 |
|
sm.removeMidiDeviceListListener(getHandler()); |
1494 |
|
sm.removeAudioDeviceListListener(getHandler()); |
1495 |
|
sm.removeMidiInstrumentMapListListener(mapListListener); |
1496 |
|
sm.removeSamplerListener(samplerListener); |
1497 |
|
|
1498 |
|
if(midiDevice != null) { |
1499 |
|
midiDevice.removeMidiDeviceListener(getHandler()); |
1500 |
|
} |
1501 |
|
} |
1502 |
|
|
1503 |
private final Handler handler = new Handler(); |
private final Handler handler = new Handler(); |
1504 |
|
|
1505 |
private Handler |
private Handler |
1506 |
getHandler() { return handler; } |
getHandler() { return handler; } |
1507 |
|
|
1508 |
private class Handler implements MidiDeviceListListener, ListListener<AudioDeviceModel> { |
private class Handler implements MidiDeviceListListener, ListListener<AudioDeviceModel>, |
1509 |
|
MidiDeviceListener { |
1510 |
/** |
/** |
1511 |
* Invoked when a new MIDI device is created. |
* Invoked when a new MIDI device is created. |
1512 |
* @param e A <code>MidiDeviceListEvent</code> |
* @param e A <code>MidiDeviceListEvent</code> |
1546 |
entryRemoved(ListEvent<AudioDeviceModel> e) { |
entryRemoved(ListEvent<AudioDeviceModel> e) { |
1547 |
cbAudioDevice.removeItem(e.getEntry().getDeviceInfo()); |
cbAudioDevice.removeItem(e.getEntry().getDeviceInfo()); |
1548 |
} |
} |
1549 |
|
|
1550 |
|
public void |
1551 |
|
settingsChanged(MidiDeviceEvent e) { |
1552 |
|
if(isUpdate()) { |
1553 |
|
CC.getLogger().warning("Invalid update state"); |
1554 |
|
return; |
1555 |
|
} |
1556 |
|
|
1557 |
|
setUpdate(true); |
1558 |
|
int idx = cbMidiPort.getSelectedIndex(); |
1559 |
|
MidiInputDevice d = e.getMidiDeviceModel().getDeviceInfo(); |
1560 |
|
|
1561 |
|
cbMidiPort.removeAllItems(); |
1562 |
|
for(MidiPort port : d.getMidiPorts()) cbMidiPort.addItem(port); |
1563 |
|
|
1564 |
|
if(idx >= cbMidiPort.getModel().getSize()) idx = 0; |
1565 |
|
|
1566 |
|
setUpdate(false); |
1567 |
|
|
1568 |
|
if(cbMidiPort.getModel().getSize() > 0) cbMidiPort.setSelectedIndex(idx); |
1569 |
|
} |
1570 |
|
} |
1571 |
|
|
1572 |
|
private class MapListListener implements ListListener<MidiInstrumentMap> { |
1573 |
|
/** Invoked when a new MIDI instrument map is added to a list. */ |
1574 |
|
public void |
1575 |
|
entryAdded(ListEvent<MidiInstrumentMap> e) { |
1576 |
|
cbInstrumentMap.insertItemAt(e.getEntry(), cbInstrumentMap.getItemCount()); |
1577 |
|
boolean b = channel.getModel().getChannelInfo().getEngine() != null; |
1578 |
|
if(b && !cbInstrumentMap.isEnabled()) cbInstrumentMap.setEnabled(true); |
1579 |
|
} |
1580 |
|
|
1581 |
|
/** Invoked when a new MIDI instrument map is removed from a list. */ |
1582 |
|
public void |
1583 |
|
entryRemoved(ListEvent<MidiInstrumentMap> e) { |
1584 |
|
cbInstrumentMap.removeItem(e.getEntry()); |
1585 |
|
if(cbInstrumentMap.getItemCount() == 0) { // TODO: ? |
1586 |
|
cbInstrumentMap.setSelectedItem(noMap); |
1587 |
|
cbInstrumentMap.setEnabled(false); |
1588 |
|
} |
1589 |
|
} |
1590 |
} |
} |
1591 |
} |
} |