24 |
|
|
25 |
import java.awt.Dialog; |
import java.awt.Dialog; |
26 |
import java.awt.Dimension; |
import java.awt.Dimension; |
27 |
|
import java.awt.GridBagConstraints; |
28 |
|
import java.awt.GridBagLayout; |
29 |
|
import java.awt.Insets; |
30 |
|
|
31 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
32 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
99 |
|
|
100 |
private final JButton btnChannelDefaults; |
private final JButton btnChannelDefaults; |
101 |
|
|
102 |
|
private ChannelViewDefaultsPane channelViewDefaultsPane = null; |
103 |
private final boolean showDefaultView; |
private final boolean showDefaultView; |
|
private final JComboBox cbDefaultView = new JComboBox(); |
|
104 |
|
|
105 |
|
|
106 |
public |
public |
128 |
p.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); |
p.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); |
129 |
add(p); |
add(p); |
130 |
|
|
|
setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
|
|
|
|
131 |
String s = i18n.getLabel("JSDefaultsPropsPane.titleChannels"); |
String s = i18n.getLabel("JSDefaultsPropsPane.titleChannels"); |
132 |
setBorder(BorderFactory.createTitledBorder(s)); |
setBorder(BorderFactory.createTitledBorder(s)); |
133 |
setAlignmentX(LEFT_ALIGNMENT); |
setAlignmentX(LEFT_ALIGNMENT); |
149 |
}); |
}); |
150 |
|
|
151 |
if(showDefaultView) { |
if(showDefaultView) { |
152 |
p = new JPanel(); |
add(Box.createRigidArea(new Dimension(0, 6))); |
153 |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
add(new javax.swing.JSeparator()); |
154 |
|
add(Box.createRigidArea(new Dimension(0, 6))); |
|
s = i18n.getLabel("JSDefaultsPropsPane.lDefaultChannelView"); |
|
|
p.add(new JLabel(s)); |
|
|
|
|
|
p.add(Box.createRigidArea(new Dimension(5, 0))); |
|
|
|
|
|
s = i18n.getLabel("JSDefaultsPropsPane.lSmallView"); |
|
|
cbDefaultView.addItem(s); |
|
|
|
|
|
s = i18n.getLabel("JSDefaultsPropsPane.lNormalView"); |
|
|
cbDefaultView.addItem(s); |
|
|
|
|
|
int i = preferences().getIntProperty(DEFAULT_CHANNEL_VIEW); |
|
|
if(i < 0 || i >= cbDefaultView.getItemCount()) i = 1; |
|
|
|
|
|
cbDefaultView.setSelectedIndex(i); |
|
155 |
|
|
156 |
p.add(cbDefaultView); |
channelViewDefaultsPane = new ChannelViewDefaultsPane(); |
157 |
|
add(channelViewDefaultsPane); |
|
p.setAlignmentX(LEFT_ALIGNMENT); |
|
|
p.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); |
|
|
add(p); |
|
158 |
} |
} |
159 |
|
|
160 |
setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height)); |
setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height)); |
166 |
preferences().setBoolProperty(USE_CHANNEL_DEFAULTS, b); |
preferences().setBoolProperty(USE_CHANNEL_DEFAULTS, b); |
167 |
|
|
168 |
if(showDefaultView) { |
if(showDefaultView) { |
169 |
int i = cbDefaultView.getSelectedIndex(); |
channelViewDefaultsPane.apply(); |
|
preferences().setIntProperty(DEFAULT_CHANNEL_VIEW, i); |
|
170 |
} |
} |
171 |
} |
} |
172 |
|
|
177 |
} |
} |
178 |
} |
} |
179 |
|
|
180 |
|
public static class ChannelViewDefaultsPane extends JPanel { |
181 |
|
private final ComboBox cbDefaultView = new ComboBox(); |
182 |
|
private final ComboBox cbMouseOverView = new ComboBox(); |
183 |
|
|
184 |
|
private final JCheckBox checkMouseOverView = |
185 |
|
new JCheckBox(i18n.getLabel("JSDefaultsPropsPane.checkMouseOverView")); |
186 |
|
|
187 |
|
ChannelViewDefaultsPane() { |
188 |
|
GridBagLayout gridbag = new GridBagLayout(); |
189 |
|
GridBagConstraints c = new GridBagConstraints(); |
190 |
|
|
191 |
|
setLayout(gridbag); |
192 |
|
|
193 |
|
c.fill = GridBagConstraints.NONE; |
194 |
|
|
195 |
|
String s = i18n.getLabel("JSDefaultsPropsPane.lDefaultChannelView"); |
196 |
|
JLabel l = new JLabel(s); |
197 |
|
|
198 |
|
c.gridx = 0; |
199 |
|
c.gridy = 0; |
200 |
|
c.anchor = GridBagConstraints.EAST; |
201 |
|
c.insets = new Insets(3, 3, 3, 3); |
202 |
|
gridbag.setConstraints(l, c); |
203 |
|
add(l); |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
int i = preferences().getIntProperty(DEFAULT_CHANNEL_VIEW); |
208 |
|
cbDefaultView.setView(i); |
209 |
|
|
210 |
|
c.gridx = 1; |
211 |
|
c.gridy = 0; |
212 |
|
c.fill = GridBagConstraints.HORIZONTAL; |
213 |
|
c.anchor = GridBagConstraints.WEST; |
214 |
|
gridbag.setConstraints(cbDefaultView, c); |
215 |
|
add(cbDefaultView); |
216 |
|
|
217 |
|
c.gridx = 0; |
218 |
|
c.gridy = 1; |
219 |
|
c.gridwidth = 2; |
220 |
|
c.insets = new Insets(9, 3, 3, 3); |
221 |
|
gridbag.setConstraints(checkMouseOverView, c); |
222 |
|
add(checkMouseOverView); |
223 |
|
|
224 |
|
i = preferences().getIntProperty(CHANNEL_VIEW_ON_MOUSE_OVER); |
225 |
|
cbMouseOverView.setView(i); |
226 |
|
|
227 |
|
c.gridx = 1; |
228 |
|
c.gridy = 2; |
229 |
|
c.gridwidth = 1; |
230 |
|
c.insets = new Insets(0, 3, 5, 3); |
231 |
|
gridbag.setConstraints(cbMouseOverView, c); |
232 |
|
add(cbMouseOverView); |
233 |
|
|
234 |
|
setAlignmentX(LEFT_ALIGNMENT); |
235 |
|
|
236 |
|
checkMouseOverView.addItemListener(new ItemListener() { |
237 |
|
public void |
238 |
|
itemStateChanged(ItemEvent e) { |
239 |
|
cbMouseOverView.setEnabled(checkMouseOverView.isSelected()); |
240 |
|
} |
241 |
|
}); |
242 |
|
|
243 |
|
cbMouseOverView.setEnabled(false); |
244 |
|
if(preferences().getBoolProperty(DIFFERENT_CHANNEL_VIEW_ON_MOUSE_OVER)) { |
245 |
|
checkMouseOverView.doClick(0); |
246 |
|
} |
247 |
|
} |
248 |
|
|
249 |
|
public void |
250 |
|
apply() { |
251 |
|
int i = cbDefaultView.getSelectedIndex(); |
252 |
|
preferences().setIntProperty(DEFAULT_CHANNEL_VIEW, i); |
253 |
|
|
254 |
|
boolean b = checkMouseOverView.isSelected(); |
255 |
|
preferences().setBoolProperty(DIFFERENT_CHANNEL_VIEW_ON_MOUSE_OVER, b); |
256 |
|
|
257 |
|
i = cbMouseOverView.getSelectedIndex(); |
258 |
|
preferences().setIntProperty(CHANNEL_VIEW_ON_MOUSE_OVER, i); |
259 |
|
} |
260 |
|
|
261 |
|
class ComboBox extends JComboBox { |
262 |
|
ComboBox() { |
263 |
|
String s = i18n.getLabel("JSDefaultsPropsPane.lSmallView"); |
264 |
|
addItem(s); |
265 |
|
|
266 |
|
s = i18n.getLabel("JSDefaultsPropsPane.lNormalView"); |
267 |
|
addItem(s); |
268 |
|
} |
269 |
|
|
270 |
|
public void |
271 |
|
setView(int i) { |
272 |
|
if(i < 0 || i >= getItemCount()) i = 1; |
273 |
|
|
274 |
|
setSelectedIndex(i); |
275 |
|
} |
276 |
|
} |
277 |
|
} |
278 |
|
|
279 |
public static class DefaultMidiDriverPane extends JPanel { |
public static class DefaultMidiDriverPane extends JPanel { |
280 |
private final JComboBox cbDriver = new JComboBox(); |
private final JComboBox cbDriver = new JComboBox(); |
281 |
|
|