31 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
32 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
33 |
|
|
34 |
|
import java.text.NumberFormat; |
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; |
51 |
import org.linuxsampler.lscp.SamplerEngine; |
import org.linuxsampler.lscp.SamplerEngine; |
52 |
|
|
53 |
import org.jsampler.CC; |
import org.jsampler.CC; |
54 |
|
import org.jsampler.HF; |
55 |
import org.jsampler.JSPrefs; |
import org.jsampler.JSPrefs; |
56 |
|
|
57 |
import static org.jsampler.view.std.StdI18n.i18n; |
import static org.jsampler.view.std.StdI18n.i18n; |
106 |
|
|
107 |
private DefaultMap defaultMap = new DefaultMap(); |
private DefaultMap defaultMap = new DefaultMap(); |
108 |
|
|
109 |
|
private static NumberFormat numberFormat = NumberFormat.getInstance(); |
110 |
|
|
111 |
|
|
112 |
/** Creates a new instance of <code>JSChannelsDefaultSettingsPane</code> */ |
/** Creates a new instance of <code>JSChannelsDefaultSettingsPane</code> */ |
113 |
public |
public |
114 |
JSChannelsDefaultSettingsPane() { |
JSChannelsDefaultSettingsPane() { |
115 |
|
numberFormat.setMaximumFractionDigits(1); |
116 |
|
|
117 |
GridBagLayout gridbag = new GridBagLayout(); |
GridBagLayout gridbag = new GridBagLayout(); |
118 |
GridBagConstraints c = new GridBagConstraints(); |
GridBagConstraints c = new GridBagConstraints(); |
119 |
|
|
184 |
|
|
185 |
lVolume.setHorizontalAlignment(lVolume.RIGHT); |
lVolume.setHorizontalAlignment(lVolume.RIGHT); |
186 |
|
|
187 |
// We use this to set the size of the lVolume that will be used in setVolume() |
// We use this to set the size of the lVolume |
188 |
// to prevent the frequent resizing of lVolume |
// to prevent the frequent resizing of lVolume |
189 |
lVolume.setText("100%"); |
lVolume.setText("100000%"); |
190 |
|
lVolume.setPreferredSize(lVolume.getPreferredSize()); |
191 |
|
lVolume.setMinimumSize(lVolume.getPreferredSize()); |
192 |
|
|
193 |
volumePane.add(lVolume); |
volumePane.add(lVolume); |
194 |
|
|
310 |
private void |
private void |
311 |
updateVolume() { |
updateVolume() { |
312 |
int volume = slChannelVolume.getValue(); |
int volume = slChannelVolume.getValue(); |
313 |
Dimension d = lVolume.getPreferredSize(); |
if(CC.getViewConfig().isMeasurementUnitDecibel()) { |
314 |
lVolume.setText(String.valueOf(volume) + '%'); |
double dB = HF.percentsToDecibels(volume); |
315 |
d = JuifeUtils.getUnionSize(d, lVolume.getPreferredSize()); |
lVolume.setText(numberFormat.format(dB) + "dB"); |
316 |
lVolume.setMinimumSize(d); |
} else { |
317 |
lVolume.setPreferredSize(d); |
lVolume.setText(String.valueOf(volume) + '%'); |
318 |
lVolume.setMaximumSize(d); |
} |
319 |
|
|
320 |
if(slChannelVolume.getValueIsAdjusting()) return; |
if(slChannelVolume.getValueIsAdjusting()) return; |
321 |
preferences().setIntProperty(DEFAULT_CHANNEL_VOLUME, slChannelVolume.getValue()); |
preferences().setIntProperty(DEFAULT_CHANNEL_VOLUME, slChannelVolume.getValue()); |