60 |
* @author Grigor Iliev |
* @author Grigor Iliev |
61 |
*/ |
*/ |
62 |
public class PrefsDlg extends EnhancedDialog { |
public class PrefsDlg extends EnhancedDialog { |
63 |
|
private final JTabbedPane tabbedPane = new JTabbedPane(); |
64 |
|
|
65 |
private final GeneralPane genPane = new GeneralPane(); |
private final GeneralPane genPane = new GeneralPane(); |
66 |
private final ViewPane viewPane = new ViewPane(); |
private final ViewPane viewPane = new ViewPane(); |
67 |
|
private final ChannelsPropsPane channelsPane = new ChannelsPropsPane(); |
68 |
private final ConsolePane consolePane = new ConsolePane(); |
private final ConsolePane consolePane = new ConsolePane(); |
69 |
private final JSConnectionPropsPane connectionPane = new JSConnectionPropsPane(); |
private final JSConnectionPropsPane connectionPane = new JSConnectionPropsPane(); |
70 |
private final JSDefaultsPropsPane defaultsPane; |
private final JSDefaultsPropsPane defaultsPane; |
80 |
|
|
81 |
defaultsPane = new JSDefaultsPropsPane(this, Res.iconEdit16, true); |
defaultsPane = new JSDefaultsPropsPane(this, Res.iconEdit16, true); |
82 |
|
|
83 |
JTabbedPane tp = new JTabbedPane(); |
JTabbedPane tp = tabbedPane; |
84 |
|
tp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); |
85 |
|
|
86 |
tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane); |
tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane); |
87 |
tp.addTab(i18n.getLabel("PrefsDlg.tabView"), viewPane); |
tp.addTab(i18n.getLabel("PrefsDlg.tabView"), viewPane); |
88 |
|
tp.addTab(i18n.getLabel("PrefsDlg.tabChannels"), channelsPane); |
89 |
tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane); |
tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane); |
90 |
|
|
91 |
JPanel p = new JPanel(); |
JPanel p = new JPanel(); |
123 |
setLocation(JuifeUtils.centerLocation(this, owner)); |
setLocation(JuifeUtils.centerLocation(this, owner)); |
124 |
|
|
125 |
installListeners(); |
installListeners(); |
126 |
|
|
127 |
|
int i = preferences().getIntProperty("PrefsDlg.tabIndex"); |
128 |
|
|
129 |
|
if(i >= 0 && i < tp.getTabCount()) tp.setSelectedIndex(i); |
130 |
} |
} |
131 |
|
|
132 |
private void |
private void |
152 |
onApply() { |
onApply() { |
153 |
genPane.apply(); |
genPane.apply(); |
154 |
viewPane.apply(); |
viewPane.apply(); |
155 |
|
channelsPane.apply(); |
156 |
consolePane.apply(); |
consolePane.apply(); |
157 |
connectionPane.apply(); |
connectionPane.apply(); |
158 |
defaultsPane.apply(); |
defaultsPane.apply(); |
159 |
|
|
160 |
|
preferences().setIntProperty("PrefsDlg.tabIndex", tabbedPane.getSelectedIndex()); |
161 |
|
|
162 |
setVisible(false); |
setVisible(false); |
163 |
} |
} |
164 |
|
|
306 |
} |
} |
307 |
} |
} |
308 |
|
|
309 |
|
class ChannelsPropsPane extends JPanel { |
310 |
|
private final JCheckBox checkShowChannelNumbering = |
311 |
|
new JCheckBox(i18n.getLabel("ChannelsPropsPane.checkShowChannelNumbering")); |
312 |
|
|
313 |
|
private final JCheckBox checkShowMidiInfo = |
314 |
|
new JCheckBox(i18n.getLabel("ChannelsPropsPane.checkShowMidiInfo")); |
315 |
|
|
316 |
|
ChannelsPropsPane() { |
317 |
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
318 |
|
|
319 |
|
add(createSmallViewPane()); |
320 |
|
JPanel p = new JPanel(); |
321 |
|
p.setLayout(new BorderLayout()); |
322 |
|
add(p); |
323 |
|
} |
324 |
|
|
325 |
|
protected void |
326 |
|
apply() { |
327 |
|
boolean b = checkShowChannelNumbering.isSelected(); |
328 |
|
preferences().setBoolProperty("channel.smallView.showChannelNumbering", b); |
329 |
|
|
330 |
|
b = checkShowMidiInfo.isSelected(); |
331 |
|
preferences().setBoolProperty("channel.smallView.showMidiInfo", b); |
332 |
|
} |
333 |
|
|
334 |
|
private JPanel |
335 |
|
createSmallViewPane() { |
336 |
|
JPanel p = new JPanel(); |
337 |
|
p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); |
338 |
|
|
339 |
|
boolean b = preferences().getBoolProperty("channel.smallView.showChannelNumbering"); |
340 |
|
checkShowChannelNumbering.setSelected(b); |
341 |
|
checkShowChannelNumbering.setAlignmentX(LEFT_ALIGNMENT); |
342 |
|
p.add(checkShowChannelNumbering); |
343 |
|
|
344 |
|
b = preferences().getBoolProperty("channel.smallView.showMidiInfo"); |
345 |
|
checkShowMidiInfo.setSelected(b); |
346 |
|
checkShowMidiInfo.setAlignmentX(LEFT_ALIGNMENT); |
347 |
|
p.add(checkShowMidiInfo); |
348 |
|
|
349 |
|
String s = i18n.getLabel("ChannelsPropsPane.smallView"); |
350 |
|
p.setBorder(BorderFactory.createTitledBorder(s)); |
351 |
|
p.setMaximumSize(new Dimension(Short.MAX_VALUE, p.getPreferredSize().height)); |
352 |
|
|
353 |
|
return p; |
354 |
|
} |
355 |
|
} |
356 |
|
|
357 |
class ConsolePane extends JSLSConsolePropsPane { |
class ConsolePane extends JSLSConsolePropsPane { |
358 |
protected void |
protected void |
359 |
clearConsoleHistory() { |
clearConsoleHistory() { |