/[svn]/jsampler/trunk/src/org/jsampler/view/classic/PrefsDlg.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/view/classic/PrefsDlg.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2288 - (show annotations) (download)
Wed Nov 23 21:19:44 2011 UTC (12 years, 4 months ago) by iliev
File size: 20530 byte(s)
* Added option to select a sampler engine in Add/Edit Instrument dialog
* Moved all Swing dependent code outside the JSampler core

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2011 Grigor Iliev <grigor@grigoriliev.com>
5 *
6 * This file is part of JSampler.
7 *
8 * JSampler is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
11 *
12 * JSampler is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with JSampler; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23 package org.jsampler.view.classic;
24
25 import java.awt.BorderLayout;
26 import java.awt.Color;
27 import java.awt.Dialog;
28 import java.awt.Dimension;
29 import java.awt.GraphicsEnvironment;
30 import java.awt.Frame;
31 import java.awt.GridBagConstraints;
32 import java.awt.GridBagLayout;
33 import java.awt.Insets;
34
35 import java.awt.event.ActionEvent;
36 import java.awt.event.ActionListener;
37 import java.awt.event.ItemEvent;
38 import java.awt.event.ItemListener;
39
40 import java.util.Locale;
41
42 import javax.swing.BorderFactory;
43 import javax.swing.Box;
44 import javax.swing.BoxLayout;
45 import javax.swing.JButton;
46 import javax.swing.JCheckBox;
47 import javax.swing.JComboBox;
48 import javax.swing.JLabel;
49 import javax.swing.JOptionPane;
50 import javax.swing.JPanel;
51 import javax.swing.JTabbedPane;
52
53 import net.sf.juife.swing.EnhancedDialog;
54 import net.sf.juife.swing.JuifeUtils;
55
56 import org.jsampler.CC;
57 import org.jsampler.JSI18n;
58 import org.jsampler.JSUtils;
59 import org.jsampler.LSConsoleModel;
60 import org.jsampler.Prefs;
61
62 import org.jsampler.view.std.JSAdvancedGeneralPropsDlg;
63 import org.jsampler.view.std.JSColorButton;
64 import org.jsampler.view.std.JSConnectionPropsPane;
65 import org.jsampler.view.std.JSDefaultsPropsPane;
66 import org.jsampler.view.std.JSGeneralProps;
67 import org.jsampler.view.std.JSLSConsolePropsPane;
68 import org.jsampler.view.swing.SHF;
69
70 import static org.jsampler.JSPrefs.*;
71 import static org.jsampler.view.classic.ClassicI18n.i18n;
72 import static org.jsampler.view.classic.ClassicPrefs.preferences;
73
74
75 /**
76 *
77 * @author Grigor Iliev
78 */
79 public class PrefsDlg extends EnhancedDialog {
80 private final JTabbedPane tabbedPane = new JTabbedPane();
81
82 private final GeneralPane genPane = new GeneralPane(this);
83 private final ViewPane viewPane = new ViewPane();
84 private final ConsolePane consolePane = new ConsolePane();
85 private final JSConnectionPropsPane connectionPane = new JSConnectionPropsPane();
86 private final JSDefaultsPropsPane defaultsPane;
87
88 private final JButton btnApply = new JButton(i18n.getButtonLabel("apply"));
89 private final JButton btnClose = new JButton(i18n.getButtonLabel("close"));
90
91
92 public
93 PrefsDlg(Frame frm) {
94 super(frm, i18n.getLabel("PrefsDlg"), true);
95
96 defaultsPane = new JSDefaultsPropsPane(this, Res.iconEdit16);
97
98 initPrefsDlg();
99 installListeners();
100
101 setLocation(JuifeUtils.centerLocation(this, frm));
102
103 int i = preferences().getIntProperty("PrefsDlg.tabIndex");
104
105 if(i >= 0 && i < tabbedPane.getTabCount()) tabbedPane.setSelectedIndex(i);
106 }
107
108 private void
109 initPrefsDlg() {
110 JTabbedPane tp = tabbedPane;
111 tp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
112
113 tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane);
114 tp.addTab(i18n.getLabel("PrefsDlg.tabView"), viewPane);
115 tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane);
116
117 JPanel p = new JPanel();
118 p.setLayout(new BorderLayout());
119 p.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
120 p.add(connectionPane);
121 tp.addTab(i18n.getLabel("PrefsDlg.tabBackend"), p);
122 tp.addTab(i18n.getLabel("PrefsDlg.tabDefaults"), defaultsPane);
123
124 tp.setAlignmentX(RIGHT_ALIGNMENT);
125
126 // Set preferred size for Apply & Exit buttons
127 Dimension d = JuifeUtils.getUnionSize(btnApply, btnClose);
128 btnApply.setPreferredSize(d);
129 btnClose.setPreferredSize(d);
130
131 JPanel btnPane = new JPanel();
132 btnPane.setLayout(new BoxLayout(btnPane, BoxLayout.X_AXIS));
133 btnPane.add(btnApply);
134 btnPane.add(Box.createRigidArea(new Dimension(5, 0)));
135 btnPane.add(btnClose);
136 btnPane.setAlignmentX(RIGHT_ALIGNMENT);
137
138 JPanel mainPane = new JPanel();
139 mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS));
140 mainPane.add(tp);
141 mainPane.add(Box.createRigidArea(new Dimension(0, 12)));
142 mainPane.add(btnPane);
143 mainPane.setBorder(BorderFactory.createEmptyBorder(11, 12, 12, 12));
144
145 getContentPane().add(mainPane);
146
147 pack();
148 setResizable(false);
149 }
150
151 private void
152 installListeners() {
153 btnApply.addActionListener(new ActionListener() {
154 public void
155 actionPerformed(ActionEvent e) { onApply(); }
156 });
157
158 btnClose.addActionListener(new ActionListener() {
159 public void
160 actionPerformed(ActionEvent e) { onExit(); }
161 });
162 }
163
164 protected void
165 onOk() { onApply(); }
166
167 protected void
168 onCancel() { onExit(); }
169
170 private void
171 onApply() {
172 genPane.apply();
173 viewPane.apply();
174 consolePane.apply();
175 connectionPane.apply();
176 defaultsPane.apply();
177
178 preferences().setIntProperty("PrefsDlg.tabIndex", tabbedPane.getSelectedIndex());
179
180 setVisible(false);
181 }
182
183 private void
184 onExit() { setVisible(false); }
185 }
186
187 class GeneralPane extends JPanel {
188 private final JCheckBox checkWindowSizeAndLocation =
189 new JCheckBox(i18n.getLabel("GeneralPane.checkWindowSizeAndLocation"));
190
191 private final JCheckBox checkLeftPaneState =
192 new JCheckBox(i18n.getLabel("GeneralPane.checkLeftPaneState"));
193
194 private final JCheckBox checkShowLSConsoleWhenRunScript =
195 new JCheckBox(i18n.getLabel("GeneralPane.checkShowLSConsoleWhenRunScript"));
196
197 private final JCheckBox checkShowVolumesInDecibels =
198 new JCheckBox(i18n.getLabel("GeneralPane.checkShowVolumesInDecibels"));
199
200 private final JSGeneralProps.MaxVolumePane maxVolPane = new JSGeneralProps.MaxVolumePane();
201
202 private final JSGeneralProps.JSamplerHomePane jSamplerHomePane =
203 new JSGeneralProps.JSamplerHomePane();
204
205 private final RecentScriptsPane recentScriptsPane = new RecentScriptsPane();
206
207 private final JButton btnAdvanced = new JButton(i18n.getButtonLabel("GeneralPane.btnAdvanced"));
208
209 private final Dialog owner;
210
211 public
212 GeneralPane(Dialog owner) {
213 this.owner = owner;
214
215 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
216
217 checkWindowSizeAndLocation.setAlignmentX(JPanel.LEFT_ALIGNMENT);
218
219 checkWindowSizeAndLocation.setSelected(ClassicPrefs.getSaveWindowProperties());
220 checkWindowSizeAndLocation.addItemListener(new ItemListener() {
221 public void
222 itemStateChanged(ItemEvent e) {
223 boolean b = e.getStateChange() == e.SELECTED;
224 //checkWindowSizeAndLocation.setEnabled(b);
225 }
226 });
227
228 add(checkWindowSizeAndLocation);
229
230 checkLeftPaneState.setAlignmentX(JPanel.LEFT_ALIGNMENT);
231 checkLeftPaneState.setSelected(ClassicPrefs.getSaveLeftPaneState());
232 add(checkLeftPaneState);
233
234 checkShowLSConsoleWhenRunScript.setAlignmentX(JPanel.LEFT_ALIGNMENT);
235
236 boolean b = preferences().getBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT);
237 checkShowLSConsoleWhenRunScript.setSelected(b);
238
239 add(checkShowLSConsoleWhenRunScript);
240
241 b = preferences().getBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL);
242 checkShowVolumesInDecibels.setSelected(b);
243
244 add(checkShowVolumesInDecibels);
245
246 add(Box.createRigidArea(new Dimension(0, 6)));
247
248 add(maxVolPane);
249
250 add(Box.createRigidArea(new Dimension(0, 6)));
251
252 add(jSamplerHomePane);
253
254 add(Box.createRigidArea(new Dimension(0, 6)));
255
256 add(recentScriptsPane);
257
258 add(Box.createRigidArea(new Dimension(0, 6)));
259
260 JPanel p = new JPanel();
261 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
262
263 JPanel p2 = new JPanel();
264 p2.setLayout(new BorderLayout());
265 p.add(p2);
266 p.add(btnAdvanced);
267 p.setAlignmentX(JPanel.LEFT_ALIGNMENT);
268 add(p);
269
270 add(Box.createGlue());
271
272 setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
273
274 btnAdvanced.addActionListener(new ActionListener() {
275 public void
276 actionPerformed(ActionEvent e) { showAdvancedProperties(); }
277 });
278 }
279
280 private void
281 showAdvancedProperties() {
282 new JSAdvancedGeneralPropsDlg(owner).setVisible(true);
283 }
284
285 protected void
286 apply() {
287 maxVolPane.apply();
288
289 ClassicPrefs.setSaveWindowProperties(checkWindowSizeAndLocation.isSelected());
290 ClassicPrefs.setSaveLeftPaneState(checkLeftPaneState.isSelected());
291
292 boolean b = checkShowLSConsoleWhenRunScript.isSelected();
293 preferences().setBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, b);
294
295 b = checkShowVolumesInDecibels.isSelected();
296 preferences().setBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL, b);
297
298 int size = recentScriptsPane.getRecentScriptsSize();
299 preferences().setIntProperty(RECENT_LSCP_SCRIPTS_SIZE, size);
300 ((MainFrame)SHF.getMainFrame()).updateRecentScriptsMenu();
301
302 String s = jSamplerHomePane.getJSamplerHome();
303 if(s.length() > 0 && !s.equals(CC.getJSamplerHome())) {
304 JSUtils.changeJSamplerHome(s);
305 }
306 }
307
308 private class RecentScriptsPane extends JSGeneralProps.RecentScriptsPane {
309 @Override
310 protected void
311 clearRecentScripts() {
312 ((MainFrame)SHF.getMainFrame()).clearRecentScripts();
313 }
314 }
315 }
316
317 class ViewPane extends JPanel {
318 private final JLabel lIfaceLanguage =
319 new JLabel(i18n.getLabel("ViewPane.lIfaceLanguage"));
320 private final JComboBox cbIfaceLanguage = new JComboBox();
321
322 private final JLabel lIfaceFont =
323 new JLabel(i18n.getLabel("ViewPane.lIfaceFont"));
324 private final JComboBox cbIfaceFont = new JComboBox();
325
326 private final JCheckBox checkBorderColor =
327 new JCheckBox(i18n.getLabel("ViewPane.channelBorderColor"));
328 private final JSColorButton btnBorderColor = new JSColorButton(Color.WHITE);
329
330 private final JCheckBox checkHlChnBorderColor =
331 new JCheckBox(i18n.getLabel("ViewPane.checkHlChnBorderColor"));
332 private final JSColorButton btnHlChnBorderColor = new JSColorButton(Color.WHITE);
333
334 private final JCheckBox checkSelChnBgColor =
335 new JCheckBox(i18n.getLabel("ViewPane.checkSelChnBgColor"));
336 private final JSColorButton btnSelChnBgColor = new JSColorButton(Color.WHITE);
337
338 private final JCheckBox checkHlChnBgColor =
339 new JCheckBox(i18n.getLabel("ViewPane.checkHlChnBgColor"));
340 private final JSColorButton btnHlChnBgColor = new JSColorButton(Color.WHITE);
341
342 public
343 ViewPane() { initViewPane(); }
344
345 private void
346 initViewPane() {
347 cbIfaceLanguage.setMaximumSize (
348 new Dimension(Short.MAX_VALUE, cbIfaceLanguage.getPreferredSize().height)
349 );
350
351 for(Locale l : JSI18n.getAvailableLocales()) {
352 LocaleBox box = new LocaleBox(l);
353 cbIfaceLanguage.addItem(box);
354 if ( l.getLanguage().equals(Prefs.getInterfaceLanguage()) &&
355 l.getCountry().equals(Prefs.getInterfaceCountry())
356 ) cbIfaceLanguage.setSelectedItem(box);
357 }
358
359 cbIfaceFont.setMaximumSize (
360 new Dimension(Short.MAX_VALUE, cbIfaceFont.getPreferredSize().height)
361 );
362
363 cbIfaceFont.addItem("[Default]");
364
365 String[] fontS =
366 GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
367
368 for(String f : fontS) cbIfaceFont.addItem(f);
369
370 if(Prefs.getInterfaceFont() == null) cbIfaceFont.setSelectedItem("[Default]");
371 else cbIfaceFont.setSelectedItem(Prefs.getInterfaceFont());
372
373 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
374
375 JPanel ifacePane = new JPanel();
376 ifacePane.setLayout(new BoxLayout(ifacePane, BoxLayout.X_AXIS));
377 ifacePane.add(lIfaceLanguage);
378 ifacePane.add(Box.createRigidArea(new Dimension(5, 0)));
379 ifacePane.add(cbIfaceLanguage);
380
381 add(ifacePane);
382
383 add(Box.createRigidArea(new Dimension(0, 6)));
384
385 JPanel fontPane = new JPanel();
386 fontPane.setLayout(new BoxLayout(fontPane, BoxLayout.X_AXIS));
387 fontPane.add(lIfaceFont);
388 fontPane.add(Box.createRigidArea(new Dimension(5, 0)));
389 fontPane.add(cbIfaceFont);
390
391 add(fontPane);
392 add(Box.createRigidArea(new Dimension(0, 6)));
393 add(createCustomColorsPane());
394
395 setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
396 }
397
398 private JPanel
399 createCustomColorsPane() {
400 btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor());
401 btnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderColor());
402
403 checkBorderColor.setSelected(ClassicPrefs.getCustomChannelBorderColor());
404
405 checkBorderColor.addItemListener(new ItemListener() {
406 public void
407 itemStateChanged(ItemEvent e) {
408 boolean b = e.getStateChange() == e.SELECTED;
409 btnBorderColor.setEnabled(b);
410 }
411 });
412
413 btnHlChnBorderColor.setColor(ClassicPrefs.getChannelBorderHlColor());
414 btnHlChnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderHlColor());
415
416 checkHlChnBorderColor.setSelected(ClassicPrefs.getCustomChannelBorderHlColor());
417
418 checkHlChnBorderColor.addItemListener(new ItemListener() {
419 public void
420 itemStateChanged(ItemEvent e) {
421 boolean b = e.getStateChange() == e.SELECTED;
422 btnHlChnBorderColor.setEnabled(b);
423 }
424 });
425
426 Color color = ClassicPrefs.getSelectedChannelBgColor();
427 if(color == null) color = new Color(getBackground().getRGB());
428 btnSelChnBgColor.setColor(color);
429 btnSelChnBgColor.setEnabled(ClassicPrefs.getCustomSelectedChannelBgColor());
430
431 checkSelChnBgColor.setSelected(ClassicPrefs.getCustomSelectedChannelBgColor());
432
433 checkSelChnBgColor.addItemListener(new ItemListener() {
434 public void
435 itemStateChanged(ItemEvent e) {
436 boolean b = e.getStateChange() == e.SELECTED;
437 btnSelChnBgColor.setEnabled(b);
438 }
439 });
440
441 color = ClassicPrefs.getHighlightedChannelBgColor();
442 if(color == null) color = new Color(getBackground().getRGB());
443 btnHlChnBgColor.setColor(color);
444 btnHlChnBgColor.setEnabled(ClassicPrefs.getCustomHighlightedChannelBgColor());
445
446 checkHlChnBgColor.setSelected(ClassicPrefs.getCustomHighlightedChannelBgColor());
447
448 checkHlChnBgColor.addItemListener(new ItemListener() {
449 public void
450 itemStateChanged(ItemEvent e) {
451 boolean b = e.getStateChange() == e.SELECTED;
452 btnHlChnBgColor.setEnabled(b);
453 }
454 });
455
456 JButton btnDefaults = new JButton("Reset to defaults");
457 btnDefaults.addActionListener(new ActionListener() {
458 public void
459 actionPerformed(ActionEvent e) {
460 ClassicPrefs.setChannelBorderColor(null);
461 btnBorderColor.setColor(ClassicPrefs.getChannelBorderColor());
462
463 ClassicPrefs.setChannelBorderHlColor(null);
464 btnHlChnBorderColor.setColor(ClassicPrefs.getChannelBorderHlColor());
465
466 ClassicPrefs.setSelectedChannelBgColor(null);
467 btnSelChnBgColor.setColor(ClassicPrefs.getSelectedChannelBgColor());
468
469 ClassicPrefs.setHighlightedChannelBgColor(null);
470 btnHlChnBgColor.setColor(ClassicPrefs.getHighlightedChannelBgColor());
471 }
472 });
473
474 GridBagLayout gridbag = new GridBagLayout();
475 GridBagConstraints c = new GridBagConstraints();
476
477 JPanel ccp = new JPanel();
478 ccp.setLayout(gridbag);
479
480 c.fill = GridBagConstraints.NONE;
481
482 c.gridx = 0;
483 c.gridy = 0;
484 c.anchor = GridBagConstraints.WEST;
485 c.insets = new Insets(0, 3, 3, 3);
486 gridbag.setConstraints(checkBorderColor, c);
487 ccp.add(checkBorderColor);
488
489
490 c.gridx = 1;
491 c.gridy = 0;
492 gridbag.setConstraints(btnBorderColor, c);
493 ccp.add(btnBorderColor);
494
495 c.gridx = 0;
496 c.gridy = 1;
497 gridbag.setConstraints(checkHlChnBorderColor, c);
498 ccp.add(checkHlChnBorderColor);
499
500 c.gridx = 1;
501 c.gridy = 1;
502 gridbag.setConstraints(btnHlChnBorderColor, c);
503 ccp.add(btnHlChnBorderColor);
504
505 c.gridx = 0;
506 c.gridy = 2;
507 gridbag.setConstraints(checkSelChnBgColor, c);
508 ccp.add(checkSelChnBgColor);
509
510 c.gridx = 1;
511 c.gridy = 2;
512 gridbag.setConstraints(btnSelChnBgColor, c);
513 ccp.add(btnSelChnBgColor);
514
515 c.gridx = 0;
516 c.gridy = 3;
517 gridbag.setConstraints(checkHlChnBgColor, c);
518 ccp.add(checkHlChnBgColor);
519
520 c.gridx = 1;
521 c.gridy = 3;
522 gridbag.setConstraints(btnHlChnBgColor, c);
523 ccp.add(btnHlChnBgColor);
524
525 JPanel p = new JPanel();
526 p.setAlignmentX(LEFT_ALIGNMENT);
527 p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
528 p.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 6));
529 p.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
530
531 p.add(Box.createGlue());
532 p.add(btnDefaults);
533 p.add(Box.createGlue());
534
535 c.fill = GridBagConstraints.HORIZONTAL;
536 c.gridx = 0;
537 c.gridy = 4;
538 c.gridwidth = 2;
539 c.weightx = 1.0;
540 c.anchor = GridBagConstraints.CENTER;
541 gridbag.setConstraints(p, c);
542 ccp.add(p);
543
544 ccp.setBorder (
545 BorderFactory.createTitledBorder(i18n.getLabel("ViewPane.CustomColorsPane"))
546 );
547
548 ccp.setMaximumSize(new Dimension(Short.MAX_VALUE, ccp.getPreferredSize().height));
549
550 return ccp;
551 }
552
553 private String
554 getInterfaceLanguage() {
555 LocaleBox box = (LocaleBox)cbIfaceLanguage.getSelectedItem();
556 if(box == null) return null;
557 return box.getLocale().getLanguage();
558 }
559
560 private String
561 getInterfaceCountry() {
562 LocaleBox box = (LocaleBox)cbIfaceLanguage.getSelectedItem();
563 if(box == null) return null;
564 return box.getLocale().getCountry();
565 }
566
567 private String
568 getInterfaceFontName() { return cbIfaceFont.getSelectedItem().toString(); }
569
570 protected void
571 apply() {
572 boolean b = Prefs.setInterfaceLanguage(getInterfaceLanguage());
573 boolean b2 = Prefs.setInterfaceCountry(getInterfaceCountry());
574 if (b || b2) JOptionPane.showMessageDialog (
575 this,
576 i18n.getMessage("PrefsDlg.ifaceChangeInfo", "JS Classic"),
577 null,
578 JOptionPane.INFORMATION_MESSAGE
579 );
580
581 b = false;
582 String fontName = getInterfaceFontName();
583 if(fontName.equals("[Default]")) {
584 b = Prefs.setInterfaceFont(null);
585 } else if(Prefs.setInterfaceFont(fontName)) {
586 CC.getViewConfig().setUIDefaultFont(fontName);
587 b = true;
588 }
589
590 if(b) JOptionPane.showMessageDialog (
591 this,
592 i18n.getMessage("PrefsDlg.ifaceFontChangeInfo", "JS Classic"),
593 null,
594 JOptionPane.INFORMATION_MESSAGE
595 );
596
597 ///***///
598
599 b = checkBorderColor.isSelected();
600 ClassicPrefs.setCustomChannelBorderColor(b);
601 if(b) ClassicPrefs.setChannelBorderColor(btnBorderColor.getColor());
602
603 Color c;
604 if(b) c = ClassicPrefs.getChannelBorderColor();
605 else c = ClassicPrefs.getDefaultChannelBorderColor();
606 Channel.setBorderColor(c);
607
608 b = checkHlChnBorderColor.isSelected();
609 ClassicPrefs.setCustomChannelBorderHlColor(b);
610 if(b) ClassicPrefs.setChannelBorderHlColor(btnHlChnBorderColor.getColor());
611
612 if(b) c = ClassicPrefs.getChannelBorderHlColor();
613 else c = ClassicPrefs.getDefaultChannelBorderHlColor();
614 Channel.setBorderHighlightedColor(c);
615
616 b = checkSelChnBgColor.isSelected();
617 ClassicPrefs.setCustomSelectedChannelBgColor(b);
618 if(b) ClassicPrefs.setSelectedChannelBgColor(btnSelChnBgColor.getColor());
619
620 if(b) c = ClassicPrefs.getSelectedChannelBgColor();
621 else c = new Color(getBackground().getRGB());
622 if(c == null) c = new Color(getBackground().getRGB());
623 Channel.setSelectedChannelBgColor(c);
624
625 b = checkHlChnBgColor.isSelected();
626 ClassicPrefs.setCustomHighlightedChannelBgColor(b);
627 if(b) ClassicPrefs.setHighlightedChannelBgColor(btnHlChnBgColor.getColor());
628
629 if(b) c = ClassicPrefs.getHighlightedChannelBgColor();
630 else c = new Color(getBackground().getRGB());
631 if(c == null) c = new Color(getBackground().getRGB());
632 Channel.setHighlightedChannelBgColor(c);
633 }
634
635 class LocaleBox {
636 private Locale locale;
637
638 LocaleBox(Locale locale) { this.locale = locale; }
639
640 public Locale
641 getLocale() { return locale; }
642
643 @Override
644 public String
645 toString() { return locale.getDisplayLanguage(JSI18n.i18n.getCurrentLocale()); }
646 }
647 }
648
649 class ConsolePane extends JSLSConsolePropsPane {
650 @Override
651 protected void
652 clearConsoleHistory() {
653 MainFrame frame = (MainFrame)SHF.getMainFrame();
654 frame.getLSConsoleModel().clearCommandHistory();
655 }
656
657 @Override
658 protected void
659 apply() {
660 super.apply();
661
662 MainFrame frame = (MainFrame)SHF.getMainFrame();
663
664 LSConsoleModel model = frame.getLSConsoleModel();
665 model.setCommandHistorySize(preferences().getIntProperty(LS_CONSOLE_HISTSIZE));
666
667 int c = preferences().getIntProperty(LS_CONSOLE_TEXT_COLOR);
668 frame.setLSConsoleTextColor(new Color(c));
669
670 c = preferences().getIntProperty(LS_CONSOLE_BACKGROUND_COLOR);
671 frame.setLSConsoleBackgroundColor(new Color(c));
672
673 c = preferences().getIntProperty(LS_CONSOLE_NOTIFY_COLOR);
674 frame.setLSConsoleNotifyColor(new Color(c));
675
676 c = preferences().getIntProperty(LS_CONSOLE_WARNING_COLOR);
677 frame.setLSConsoleWarningColor(new Color(c));
678
679 c = preferences().getIntProperty(LS_CONSOLE_ERROR_COLOR);
680 frame.setLSConsoleErrorColor(new Color(c));
681 }
682 }

  ViewVC Help
Powered by ViewVC