1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
* Copyright (C) 2005-2010 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
66 |
import org.linuxsampler.lscp.MidiPort; |
import org.linuxsampler.lscp.MidiPort; |
67 |
import org.linuxsampler.lscp.SamplerChannel; |
import org.linuxsampler.lscp.SamplerChannel; |
68 |
|
|
69 |
|
import org.pushingpixels.substance.api.SubstanceLookAndFeel; |
70 |
|
|
71 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
72 |
|
|
73 |
/** |
/** |
143 |
p2.add(Box.createRigidArea(new Dimension(3, 0))); |
p2.add(Box.createRigidArea(new Dimension(3, 0))); |
144 |
|
|
145 |
o = cbMidiPort.getRenderer(); |
o = cbMidiPort.getRenderer(); |
146 |
if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.CENTER); |
if(o instanceof JLabel) ((JLabel )o).setHorizontalAlignment(SwingConstants.LEFT); |
147 |
|
|
148 |
|
cbMidiPort.addActionListener(new ActionListener() { |
149 |
|
public void |
150 |
|
actionPerformed(ActionEvent e) { |
151 |
|
updateCbMidiPortToolTipText(); |
152 |
|
} |
153 |
|
}); |
154 |
|
|
155 |
cbMidiPort.setPreferredSize(new Dimension(62, 18)); |
cbMidiPort.setPreferredSize(new Dimension(62, 18)); |
156 |
cbMidiPort.setMinimumSize(cbMidiPort.getPreferredSize()); |
cbMidiPort.setMinimumSize(cbMidiPort.getPreferredSize()); |
157 |
cbMidiPort.setMaximumSize(cbMidiPort.getPreferredSize()); |
cbMidiPort.setMaximumSize(cbMidiPort.getPreferredSize()); |
435 |
} |
} |
436 |
|
|
437 |
private void |
private void |
438 |
|
updateCbMidiPortToolTipText() { |
439 |
|
if(cbMidiPort.getSelectedItem() == null) { |
440 |
|
cbMidiPort.setToolTipText(null); |
441 |
|
return; |
442 |
|
} |
443 |
|
|
444 |
|
cbMidiPort.setToolTipText(cbMidiPort.getSelectedItem().toString()); |
445 |
|
} |
446 |
|
|
447 |
|
private void |
448 |
updateCbInstrumentMapToolTipText() { |
updateCbInstrumentMapToolTipText() { |
449 |
if(cbInstrumentMap.getSelectedItem() != defaultMap) { |
if(cbInstrumentMap.getSelectedItem() != defaultMap) { |
450 |
cbInstrumentMap.setToolTipText(null); |
cbInstrumentMap.setToolTipText(null); |
451 |
return; |
return; |
452 |
} |
} |
453 |
|
|
454 |
MidiInstrumentMap m = CC.getSamplerModel().getDefaultMidiInstrumentMap(); |
MidiInstrumentMap m = CC.getSamplerModel().getDefaultMidiInstrumentMap(); |
455 |
if(m != null) { |
if(m != null) { |
456 |
String s = i18n.getLabel("Channel.ttDefault", m.getName()); |
String s = i18n.getLabel("Channel.ttDefault", m.getName()); |
518 |
|
|
519 |
int p = channel.getModel().getChannelInfo().getMidiInputPort(); |
int p = channel.getModel().getChannelInfo().getMidiInputPort(); |
520 |
cbMidiPort.setSelectedItem(p >= 0 && p < ports.length ? ports[p] : null); |
cbMidiPort.setSelectedItem(p >= 0 && p < ports.length ? ports[p] : null); |
521 |
|
|
522 |
|
cbMidiPort.putClientProperty ( |
523 |
|
SubstanceLookAndFeel.COMBO_POPUP_PROTOTYPE, |
524 |
|
new FantasiaComboBox.WidestComboPopupPrototype() |
525 |
|
); |
526 |
|
|
527 |
cbMidiChannel.setEnabled(true); |
cbMidiChannel.setEnabled(true); |
528 |
int c = channel.getModel().getChannelInfo().getMidiInputChannel(); |
int c = channel.getModel().getChannelInfo().getMidiInputChannel(); |