/[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 1743 - (hide annotations) (download)
Sat May 31 23:04:01 2008 UTC (15 years, 11 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 iliev 787 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4 iliev 1743 * Copyright (C) 2005-2008 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 1743 private final JTabbedPane tabbedPane = new JTabbedPane();
84    
85 iliev 911 private final GeneralPane genPane = new GeneralPane();
86 iliev 787 private final ViewPane viewPane = new ViewPane();
87 iliev 911 private final ConsolePane consolePane = new ConsolePane();
88 iliev 1285 private final JSConnectionPropsPane connectionPane = new JSConnectionPropsPane();
89 iliev 1313 private final JSDefaultsPropsPane defaultsPane;
90 iliev 787
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 iliev 1313 defaultsPane = new JSDefaultsPropsPane(this, Res.iconEdit16);
100    
101 iliev 787 initPrefsDlg();
102 iliev 1285 installListeners();
103 iliev 787
104     setLocation(JuifeUtils.centerLocation(this, frm));
105 iliev 1743
106     int i = preferences().getIntProperty("PrefsDlg.tabIndex");
107    
108     if(i >= 0 && i < tabbedPane.getTabCount()) tabbedPane.setSelectedIndex(i);
109 iliev 787 }
110    
111     private void
112     initPrefsDlg() {
113 iliev 1743 JTabbedPane tp = tabbedPane;
114     tp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
115    
116 iliev 787 tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane);
117     tp.addTab(i18n.getLabel("PrefsDlg.tabView"), viewPane);
118 iliev 911 tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane);
119 iliev 1285
120     JPanel p = new JPanel();
121     p.setLayout(new BorderLayout());
122     p.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
123 iliev 1688 p.add(connectionPane);
124     tp.addTab(i18n.getLabel("PrefsDlg.tabBackend"), p);
125 iliev 1313 tp.addTab(i18n.getLabel("PrefsDlg.tabDefaults"), defaultsPane);
126 iliev 1285
127 iliev 787 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 iliev 1285 installListeners() {
156 iliev 787 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 iliev 842 genPane.apply();
176     viewPane.apply();
177 iliev 911 consolePane.apply();
178 iliev 1285 connectionPane.apply();
179 iliev 1313 defaultsPane.apply();
180 iliev 787
181 iliev 1743 preferences().setIntProperty("PrefsDlg.tabIndex", tabbedPane.getSelectedIndex());
182    
183 iliev 787 setVisible(false);
184     }
185    
186     private void
187     onExit() { setVisible(false); }
188     }
189    
190     class GeneralPane extends JPanel {
191 iliev 842 private final JCheckBox checkWindowSizeAndLocation =
192     new JCheckBox(i18n.getLabel("GeneralPane.checkWindowSizeAndLocation"));
193    
194 iliev 911 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 iliev 1567 private final JCheckBox checkShowVolumesInDecibels =
201     new JCheckBox(i18n.getLabel("GeneralPane.checkShowVolumesInDecibels"));
202    
203 iliev 1357 private final JSGeneralProps.MaxVolumePane maxVolPane = new JSGeneralProps.MaxVolumePane();
204    
205 iliev 1285 private final JSGeneralProps.JSamplerHomePane jSamplerHomePane =
206     new JSGeneralProps.JSamplerHomePane();
207 iliev 1143
208 iliev 1285 private final RecentScriptsPane recentScriptsPane = new RecentScriptsPane();
209 iliev 911
210    
211 iliev 787 public
212 iliev 911 GeneralPane() {
213 iliev 842 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
214 iliev 787
215 iliev 911 checkWindowSizeAndLocation.setAlignmentX(JPanel.LEFT_ALIGNMENT);
216 iliev 842
217 iliev 911 checkWindowSizeAndLocation.setSelected(ClassicPrefs.getSaveWindowProperties());
218 iliev 842 checkWindowSizeAndLocation.addItemListener(new ItemListener() {
219     public void
220     itemStateChanged(ItemEvent e) {
221     boolean b = e.getStateChange() == e.SELECTED;
222 iliev 911 //checkWindowSizeAndLocation.setEnabled(b);
223 iliev 842 }
224     });
225    
226 iliev 911 add(checkWindowSizeAndLocation);
227 iliev 842
228 iliev 911 checkLeftPaneState.setAlignmentX(JPanel.LEFT_ALIGNMENT);
229     checkLeftPaneState.setSelected(ClassicPrefs.getSaveLeftPaneState());
230     add(checkLeftPaneState);
231    
232     checkShowLSConsoleWhenRunScript.setAlignmentX(JPanel.LEFT_ALIGNMENT);
233    
234 iliev 1285 boolean b = preferences().getBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT);
235 iliev 911 checkShowLSConsoleWhenRunScript.setSelected(b);
236    
237     add(checkShowLSConsoleWhenRunScript);
238    
239 iliev 1567 b = preferences().getBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL);
240     checkShowVolumesInDecibels.setSelected(b);
241    
242     add(checkShowVolumesInDecibels);
243    
244 iliev 911 add(Box.createRigidArea(new Dimension(0, 6)));
245    
246 iliev 1357 add(maxVolPane);
247    
248     add(Box.createRigidArea(new Dimension(0, 6)));
249    
250 iliev 1285 add(jSamplerHomePane);
251 iliev 1143
252     add(Box.createRigidArea(new Dimension(0, 6)));
253    
254 iliev 1285 add(recentScriptsPane);
255 iliev 911 add(Box.createGlue());
256    
257     setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
258 iliev 787 }
259 iliev 842
260     protected void
261     apply() {
262 iliev 1357 maxVolPane.apply();
263    
264 iliev 911 ClassicPrefs.setSaveWindowProperties(checkWindowSizeAndLocation.isSelected());
265     ClassicPrefs.setSaveLeftPaneState(checkLeftPaneState.isSelected());
266    
267     boolean b = checkShowLSConsoleWhenRunScript.isSelected();
268 iliev 1285 preferences().setBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, b);
269 iliev 911
270 iliev 1567 b = checkShowVolumesInDecibels.isSelected();
271     preferences().setBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL, b);
272    
273 iliev 1285 int size = recentScriptsPane.getRecentScriptsSize();
274     preferences().setIntProperty(RECENT_LSCP_SCRIPTS_SIZE, size);
275 iliev 911 ((MainFrame)CC.getMainFrame()).updateRecentScriptsMenu();
276 iliev 1143
277 iliev 1285 String s = jSamplerHomePane.getJSamplerHome();
278 iliev 1143 if(s.length() > 0 && !s.equals(CC.getJSamplerHome())) {
279     CC.changeJSamplerHome(s);
280     }
281 iliev 842 }
282 iliev 1285
283     private class RecentScriptsPane extends JSGeneralProps.RecentScriptsPane {
284     protected void
285     clearRecentScripts() {
286     ((MainFrame)CC.getMainFrame()).clearRecentScripts();
287     }
288     }
289 iliev 787 }
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 iliev 842 private final JCheckBox checkBorderColor =
301     new JCheckBox(i18n.getLabel("ViewPane.channelBorderColor"));
302 iliev 1285 private final JSColorButton btnBorderColor = new JSColorButton(Color.WHITE);
303 iliev 842
304 iliev 1143 private final JCheckBox checkHlChnBorderColor =
305     new JCheckBox(i18n.getLabel("ViewPane.checkHlChnBorderColor"));
306 iliev 1285 private final JSColorButton btnHlChnBorderColor = new JSColorButton(Color.WHITE);
307 iliev 1143
308     private final JCheckBox checkSelChnBgColor =
309     new JCheckBox(i18n.getLabel("ViewPane.checkSelChnBgColor"));
310 iliev 1285 private final JSColorButton btnSelChnBgColor = new JSColorButton(Color.WHITE);
311 iliev 1143
312     private final JCheckBox checkHlChnBgColor =
313     new JCheckBox(i18n.getLabel("ViewPane.checkHlChnBgColor"));
314 iliev 1285 private final JSColorButton btnHlChnBgColor = new JSColorButton(Color.WHITE);
315 iliev 1143
316 iliev 787 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 iliev 842 add(Box.createRigidArea(new Dimension(0, 6)));
367     add(createCustomColorsPane());
368    
369 iliev 787 setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
370     }
371    
372 iliev 842 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 iliev 1143 btnHlChnBorderColor.setColor(ClassicPrefs.getChannelBorderHlColor());
388     btnHlChnBorderColor.setEnabled(ClassicPrefs.getCustomChannelBorderHlColor());
389 iliev 842
390 iliev 1143 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 iliev 842 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 iliev 1143
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 iliev 842 }
446     });
447    
448 iliev 1143 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 iliev 842 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 iliev 1143 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 iliev 842 ccp.add(p);
517 iliev 1143
518 iliev 842 ccp.setBorder (
519     BorderFactory.createTitledBorder(i18n.getLabel("ViewPane.CustomColorsPane"))
520     );
521    
522 iliev 911 ccp.setMaximumSize(new Dimension(Short.MAX_VALUE, ccp.getPreferredSize().height));
523 iliev 842
524     return ccp;
525     }
526    
527     private String
528 iliev 787 getInterfaceLanguage() {
529     LocaleBox box = (LocaleBox)cbIfaceLanguage.getSelectedItem();
530     if(box == null) return null;
531     return box.getLocale().getLanguage();
532     }
533    
534 iliev 842 private String
535 iliev 787 getInterfaceCountry() {
536     LocaleBox box = (LocaleBox)cbIfaceLanguage.getSelectedItem();
537     if(box == null) return null;
538     return box.getLocale().getCountry();
539     }
540    
541 iliev 842 private String
542 iliev 787 getInterfaceFontName() { return cbIfaceFont.getSelectedItem().toString(); }
543    
544 iliev 842 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 iliev 1143
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 iliev 842 }
608    
609 iliev 787 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 iliev 911 }
621    
622 iliev 1285 class ConsolePane extends JSLSConsolePropsPane {
623     protected void
624     clearConsoleHistory() {
625     MainFrame mainFrame = (MainFrame)CC.getMainFrame();
626     mainFrame.getLSConsoleModel().clearCommandHistory();
627 iliev 1143 }
628    
629 iliev 911 protected void
630     apply() {
631 iliev 1285 super.apply();
632 iliev 1143
633 iliev 911 MainFrame mainFrame = (MainFrame)CC.getMainFrame();
634 iliev 842
635 iliev 1285 LSConsoleModel model = mainFrame.getLSConsoleModel();
636     model.setCommandHistorySize(preferences().getIntProperty(LS_CONSOLE_HISTSIZE));
637 iliev 842
638 iliev 1285 int c = preferences().getIntProperty(LS_CONSOLE_TEXT_COLOR);
639     mainFrame.setLSConsoleTextColor(new Color(c));
640 iliev 842
641 iliev 1285 c = preferences().getIntProperty(LS_CONSOLE_BACKGROUND_COLOR);
642     mainFrame.setLSConsoleBackgroundColor(new Color(c));
643 iliev 911
644 iliev 1285 c = preferences().getIntProperty(LS_CONSOLE_NOTIFY_COLOR);
645     mainFrame.setLSConsoleNotifyColor(new Color(c));
646 iliev 911
647 iliev 1285 c = preferences().getIntProperty(LS_CONSOLE_WARNING_COLOR);
648     mainFrame.setLSConsoleWarningColor(new Color(c));
649 iliev 787
650 iliev 1285 c = preferences().getIntProperty(LS_CONSOLE_ERROR_COLOR);
651     mainFrame.setLSConsoleErrorColor(new Color(c));
652 iliev 787 }
653     }

  ViewVC Help
Powered by ViewVC