27 |
|
|
28 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
29 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
30 |
|
import java.awt.event.MouseAdapter; |
31 |
|
import java.awt.event.MouseEvent; |
32 |
|
|
33 |
import javax.swing.AbstractAction; |
import javax.swing.AbstractAction; |
34 |
import javax.swing.Action; |
import javax.swing.Action; |
45 |
import javax.swing.JSplitPane; |
import javax.swing.JSplitPane; |
46 |
import javax.swing.JTable; |
import javax.swing.JTable; |
47 |
import javax.swing.JToolBar; |
import javax.swing.JToolBar; |
48 |
|
import javax.swing.JToolTip; |
49 |
|
import javax.swing.Popup; |
50 |
|
import javax.swing.PopupFactory; |
51 |
|
|
52 |
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeEvent; |
53 |
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
91 |
protected final Action actionRemoveFxSend = new RemoveFxSendAction(); |
protected final Action actionRemoveFxSend = new RemoveFxSendAction(); |
92 |
|
|
93 |
private final JComboBox cbMidiCtrls = new JComboBox(); |
private final JComboBox cbMidiCtrls = new JComboBox(); |
94 |
private final JSlider slVolume = new JSlider(0, 100); |
private final JSlider slVolume = new JSlider(0, 100, 100); |
95 |
|
private Popup popup = null; |
96 |
|
private final JToolTip tip = new JToolTip(); |
97 |
|
|
98 |
private final JLabel lMidiCtrl = new JLabel(i18n.getLabel("JSFxSendsPane.lMidiCtrl")); |
private final JLabel lMidiCtrl = new JLabel(i18n.getLabel("JSFxSendsPane.lMidiCtrl")); |
99 |
private final JLabel lVolume = new JLabel(i18n.getLabel("JSFxSendsPane.lVolume")); |
private final JLabel lVolume = new JLabel(i18n.getLabel("JSFxSendsPane.lVolume")); |
148 |
int h = d.height > 300 ? d.height : 300; |
int h = d.height > 300 ? d.height : 300; |
149 |
setPreferredSize(new Dimension(w, h)); |
setPreferredSize(new Dimension(w, h)); |
150 |
splitPane.setDividerLocation(200); |
splitPane.setDividerLocation(200); |
151 |
|
|
152 |
|
// Setting the tooltip size |
153 |
|
tip.setTipText(i18n.getLabel("JSFxSendsPane.volume", 100)); |
154 |
|
tip.setMinimumSize(tip.getPreferredSize()); |
155 |
|
tip.setPreferredSize(tip.getPreferredSize()); // workaround for preserving that size |
156 |
|
tip.setComponent(slVolume); |
157 |
|
/////// |
158 |
|
|
159 |
|
slVolume.addMouseListener(new MouseAdapter() { |
160 |
|
public void |
161 |
|
mousePressed(MouseEvent e) { |
162 |
|
if(popup != null) { |
163 |
|
popup.hide(); |
164 |
|
popup = null; |
165 |
|
} |
166 |
|
|
167 |
|
java.awt.Point p = slVolume.getLocationOnScreen(); |
168 |
|
PopupFactory pf = PopupFactory.getSharedInstance(); |
169 |
|
popup = pf.getPopup(slVolume, tip, p.x, p.y - 22); |
170 |
|
popup.show(); |
171 |
|
} |
172 |
|
|
173 |
|
public void |
174 |
|
mouseReleased(MouseEvent e) { |
175 |
|
if(popup != null) { |
176 |
|
popup.hide(); |
177 |
|
popup = null; |
178 |
|
} |
179 |
|
} |
180 |
|
}); |
181 |
} |
} |
182 |
|
|
183 |
protected JToolBar |
protected JToolBar |
226 |
|
|
227 |
slVolume.addChangeListener(new ChangeListener() { |
slVolume.addChangeListener(new ChangeListener() { |
228 |
public void |
public void |
229 |
stateChanged(ChangeEvent e) { |
stateChanged(ChangeEvent e) { setVolume(); } |
|
if(slVolume.getValueIsAdjusting() || fxSend == null) return; |
|
|
|
|
|
int i = (int)(fxSend.getLevel() * 100); |
|
|
if(slVolume.getValue() == i) return; |
|
|
|
|
|
float vol = slVolume.getValue(); |
|
|
vol /= 100; |
|
|
channelModel.setBackendFxSendLevel(fxSend.getFxSendId(), vol); |
|
|
} |
|
230 |
}); |
}); |
231 |
|
|
232 |
JPanel rightPane = new JPanel(); |
JPanel rightPane = new JPanel(); |
261 |
return rightPane; |
return rightPane; |
262 |
} |
} |
263 |
|
|
264 |
|
private void |
265 |
|
setVolume() { |
266 |
|
String s = i18n.getLabel("JSFxSendsPane.volume", slVolume.getValue()); |
267 |
|
slVolume.setToolTipText(s); |
268 |
|
tip.setTipText(s); |
269 |
|
tip.repaint(); |
270 |
|
if(fxSend == null || slVolume.getValueIsAdjusting()) return; |
271 |
|
|
272 |
|
int i = (int)(fxSend.getLevel() * 100); |
273 |
|
if(slVolume.getValue() == i) return; |
274 |
|
|
275 |
|
float vol = slVolume.getValue(); |
276 |
|
vol /= 100; |
277 |
|
channelModel.setBackendFxSendLevel(fxSend.getFxSendId(), vol); |
278 |
|
} |
279 |
|
|
280 |
public void |
public void |
281 |
valueChanged(ListSelectionEvent e) { |
valueChanged(ListSelectionEvent e) { |
282 |
if(e.getValueIsAdjusting()) return; |
if(e.getValueIsAdjusting()) return; |