/[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 1743 - (show annotations) (download)
Sat May 31 23:04:01 2008 UTC (15 years, 10 months ago) by iliev
File size: 19846 byte(s)
* Renamed the column labels in the Channel Routing dialog: The column
  representing the sampler channel's audio channels is "Audio In" and
  the column representing the audio device's channels is "Audio Out"
* Remember the last used tab in the Preferences dialog
* Fantasia: The sampler channels are now referenced by their position
  in the list, not by their ID
* Fantasia: Implemented options to show the channel number and/or the MIDI
  input port/channel on the sampler channel screen when using Small View
  (choose Edit/Preferences, then click the `Channels' tab)
* Fantasia: Migrated to substance 5

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

  ViewVC Help
Powered by ViewVC