/[svn]/jsampler/trunk/src/org/jsampler/view/std/JSViewProps.java
ViewVC logotype

Annotation of /jsampler/trunk/src/org/jsampler/view/std/JSViewProps.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1688 - (hide annotations) (download)
Thu Feb 14 16:52:36 2008 UTC (16 years, 3 months ago) by iliev
File size: 4982 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 1357 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4     * Copyright (C) 2005-2007 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.std;
24    
25     import java.awt.Dimension;
26    
27     import javax.swing.BorderFactory;
28     import javax.swing.Box;
29     import javax.swing.BoxLayout;
30     import javax.swing.JCheckBox;
31     import javax.swing.JPanel;
32    
33     import org.jsampler.CC;
34     import org.jsampler.JSPrefs;
35    
36     import static org.jsampler.view.std.StdI18n.i18n;
37     import static org.jsampler.view.std.StdPrefs.*;
38    
39     /**
40     *
41     * @author Grigor Iliev
42     */
43     public class JSViewProps {
44    
45     /** Forbids the instantiation of this class. */
46     private JSViewProps() { }
47    
48     private static JSPrefs
49     preferences() { return CC.getViewConfig().preferences(); }
50    
51    
52     public static class MidiDevicesPane extends JPanel {
53     private final JCheckBox checkAdditionalParams =
54     new JCheckBox(i18n.getLabel("JSViewProps.checkAdditionalParams"));
55 iliev 1688
56 iliev 1357 public
57     MidiDevicesPane() {
58     setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
59     checkAdditionalParams.setAlignmentX(JPanel.LEFT_ALIGNMENT);
60     add(checkAdditionalParams);
61     String s = "MidiDevice.showAdditionalParameters";
62     boolean b = preferences().getBoolProperty(s);
63     checkAdditionalParams.setSelected(b);
64     s = i18n.getLabel("JSViewProps.MidiDevicesPane");
65     setBorder(BorderFactory.createTitledBorder(s));
66     setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height));
67     setAlignmentX(JPanel.LEFT_ALIGNMENT);
68     }
69    
70     public void
71     apply() {
72     String s = "MidiDevice.showAdditionalParameters";
73     preferences().setBoolProperty(s, checkAdditionalParams.isSelected());
74     }
75     }
76    
77     public static class AudioDevicesPane extends JPanel {
78     private final JCheckBox checkAdditionalParams =
79     new JCheckBox(i18n.getLabel("JSViewProps.checkAdditionalParams"));
80 iliev 1688
81 iliev 1357 public
82     AudioDevicesPane() {
83     setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
84     checkAdditionalParams.setAlignmentX(JPanel.LEFT_ALIGNMENT);
85     add(checkAdditionalParams);
86     String s = "AudioDevice.showAdditionalParameters";
87     boolean b = preferences().getBoolProperty(s);
88     checkAdditionalParams.setSelected(b);
89     s = i18n.getLabel("JSViewProps.AudioDevicesPane");
90     setBorder(BorderFactory.createTitledBorder(s));
91     setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height));
92     setAlignmentX(JPanel.LEFT_ALIGNMENT);
93     }
94    
95     public void
96     apply() {
97     String s = "AudioDevice.showAdditionalParameters";
98     preferences().setBoolProperty(s, checkAdditionalParams.isSelected());
99     }
100     }
101 iliev 1688
102     public static class ConfirmationMessagesPane extends JPanel {
103     private final JCheckBox checkConfirmChannelRemoval =
104     new JCheckBox(i18n.getLabel("JSViewProps.checkConfirmChannelRemoval"));
105    
106     private final JCheckBox checkConfirmDeviceRemoval =
107     new JCheckBox(i18n.getLabel("JSViewProps.checkConfirmDeviceRemoval"));
108    
109     private final JCheckBox checkConfirmAppQuit =
110     new JCheckBox(i18n.getLabel("JSViewProps.checkConfirmAppQuit"));
111    
112     public
113     ConfirmationMessagesPane() {
114     setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
115    
116     checkConfirmChannelRemoval.setAlignmentX(JPanel.LEFT_ALIGNMENT);
117     add(checkConfirmChannelRemoval);
118     boolean b = preferences().getBoolProperty(CONFIRM_CHANNEL_REMOVAL);
119     checkConfirmChannelRemoval.setSelected(b);
120    
121     checkConfirmDeviceRemoval.setAlignmentX(JPanel.LEFT_ALIGNMENT);
122     add(checkConfirmDeviceRemoval);
123     b = preferences().getBoolProperty(CONFIRM_DEVICE_REMOVAL);
124     checkConfirmDeviceRemoval.setSelected(b);
125    
126     checkConfirmAppQuit.setAlignmentX(JPanel.LEFT_ALIGNMENT);
127     add(checkConfirmAppQuit);
128     b = preferences().getBoolProperty(CONFIRM_APP_QUIT);
129     checkConfirmAppQuit.setSelected(b);
130    
131     String s = i18n.getLabel("JSViewProps.ConfirmationMessagesPane");
132     setBorder(BorderFactory.createTitledBorder(s));
133     setMaximumSize(new Dimension(Short.MAX_VALUE, getPreferredSize().height));
134     setAlignmentX(JPanel.LEFT_ALIGNMENT);
135     }
136    
137     public void
138     apply() {
139     String s = CONFIRM_CHANNEL_REMOVAL;
140     preferences().setBoolProperty(s, checkConfirmChannelRemoval.isSelected());
141    
142     s = CONFIRM_DEVICE_REMOVAL;
143     preferences().setBoolProperty(s, checkConfirmDeviceRemoval.isSelected());
144    
145     s = CONFIRM_APP_QUIT;
146     preferences().setBoolProperty(s, checkConfirmAppQuit.isSelected());
147     }
148     }
149 iliev 1357 }

  ViewVC Help
Powered by ViewVC