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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1285 - (hide annotations) (download)
Fri Aug 10 19:55:03 2007 UTC (16 years, 8 months ago) by iliev
File size: 18795 byte(s)
* Updated to version 0.6a. The Fantasia distribution is now
  capable of controlling all features available in LinuxSampler

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

  ViewVC Help
Powered by ViewVC