/[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 1688 - (hide annotations) (download)
Thu Feb 14 16:52:36 2008 UTC (16 years, 2 months ago) by iliev
File size: 19502 byte(s)
* Implemented a backend list with option to manually choose a backend
  to connect on startup(Edit/Preferences, then click the `Backend' tab)
  and option to change the backend without restarting JSampler
  (Actions/Change Backend or Ctrl + B)

* Added confirmation messages for removing sampler channels and
  audio/MIDI devices (Edit/Preferences, then click the `View' tab)

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

  ViewVC Help
Powered by ViewVC