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

Diff of /jsampler/trunk/src/org/jsampler/view/fantasia/PrefsDlg.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1286 by iliev, Fri Aug 10 20:24:23 2007 UTC revision 1743 by iliev, Sat May 31 23:04:01 2008 UTC
# Line 46  import org.jsampler.LSConsoleModel; Line 46  import org.jsampler.LSConsoleModel;
46  import org.jsampler.Prefs;  import org.jsampler.Prefs;
47    
48  import org.jsampler.view.std.JSConnectionPropsPane;  import org.jsampler.view.std.JSConnectionPropsPane;
49    import org.jsampler.view.std.JSDefaultsPropsPane;
50  import org.jsampler.view.std.JSGeneralProps;  import org.jsampler.view.std.JSGeneralProps;
51  import org.jsampler.view.std.JSLSConsolePropsPane;  import org.jsampler.view.std.JSLSConsolePropsPane;
52    import org.jsampler.view.std.JSViewProps;
53    
54  import static org.jsampler.view.fantasia.FantasiaI18n.i18n;  import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
55  import static org.jsampler.view.fantasia.FantasiaPrefs.*;  import static org.jsampler.view.fantasia.FantasiaPrefs.*;
# Line 58  import static org.jsampler.view.fantasia Line 60  import static org.jsampler.view.fantasia
60   * @author Grigor Iliev   * @author Grigor Iliev
61   */   */
62  public class PrefsDlg extends EnhancedDialog {  public class PrefsDlg extends EnhancedDialog {
63            private final JTabbedPane tabbedPane = new JTabbedPane();
64            
65          private final GeneralPane genPane = new GeneralPane();          private final GeneralPane genPane = new GeneralPane();
66            private final ViewPane viewPane = new ViewPane();
67            private final ChannelsPropsPane channelsPane = new ChannelsPropsPane();
68          private final ConsolePane consolePane = new ConsolePane();          private final ConsolePane consolePane = new ConsolePane();
69          private final JSConnectionPropsPane connectionPane = new JSConnectionPropsPane();          private final JSConnectionPropsPane connectionPane = new JSConnectionPropsPane();
70            private final JSDefaultsPropsPane defaultsPane;
71                    
72          private final JButton btnApply = new JButton(i18n.getButtonLabel("apply"));          private final JButton btnApply = new JButton(i18n.getButtonLabel("apply"));
73          private final JButton btnClose = new JButton(i18n.getButtonLabel("close"));          private final JButton btnClose = new JButton(i18n.getButtonLabel("close"));
# Line 68  public class PrefsDlg extends EnhancedDi Line 75  public class PrefsDlg extends EnhancedDi
75                    
76          /** Creates a new instance of <code>PrefsDlg</code> */          /** Creates a new instance of <code>PrefsDlg</code> */
77          public          public
78          PrefsDlg(Frame owner) {          PrefsDlg(Frame owner) {
79                  super(owner, i18n.getLabel("PrefsDlg.title"), true);                  super(owner, i18n.getLabel("PrefsDlg.title"), true);
80                                    
81                  JTabbedPane tp = new JTabbedPane();                  defaultsPane = new JSDefaultsPropsPane(this, Res.iconEdit16, true);
82                    
83                    JTabbedPane tp = tabbedPane;
84                    tp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
85                    
86                  tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane);                  tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane);
87                    tp.addTab(i18n.getLabel("PrefsDlg.tabView"), viewPane);
88                    tp.addTab(i18n.getLabel("PrefsDlg.tabChannels"), channelsPane);
89                  tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane);                  tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane);
90                                    
91                  JPanel p = new JPanel();                  JPanel p = new JPanel();
92                  p.setLayout(new BorderLayout());                  p.setLayout(new BorderLayout());
93                  p.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));                  p.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
94                  p.add(connectionPane, BorderLayout.NORTH);                  p.add(connectionPane);
95                  tp.addTab(i18n.getLabel("PrefsDlg.tabConnection"), p);                  tp.addTab(i18n.getLabel("PrefsDlg.tabBackend"), p);
96                    tp.addTab(i18n.getLabel("PrefsDlg.tabDefaults"), defaultsPane);
97                                    
98                  tp.setAlignmentX(RIGHT_ALIGNMENT);                  tp.setAlignmentX(RIGHT_ALIGNMENT);
99                                    
# Line 110  public class PrefsDlg extends EnhancedDi Line 124  public class PrefsDlg extends EnhancedDi
124                                    
125                  installListeners();                  installListeners();
126                                    
127                  connectionPane.setLSAddress(Prefs.getLSAddress());                  int i = preferences().getIntProperty("PrefsDlg.tabIndex");
128                  connectionPane.setLSPort(String.valueOf(Prefs.getLSPort()));                  
129                    if(i >= 0 && i < tp.getTabCount()) tp.setSelectedIndex(i);
130          }          }
131                    
132          private void          private void
# Line 136  public class PrefsDlg extends EnhancedDi Line 151  public class PrefsDlg extends EnhancedDi
151          private void          private void
152          onApply() {          onApply() {
153                  genPane.apply();                  genPane.apply();
154                    viewPane.apply();
155                    channelsPane.apply();
156                  consolePane.apply();                  consolePane.apply();
157                  connectionPane.apply();                  connectionPane.apply();
158                    defaultsPane.apply();
159                    
160                    preferences().setIntProperty("PrefsDlg.tabIndex", tabbedPane.getSelectedIndex());
161                                    
162                  setVisible(false);                  setVisible(false);
163          }          }
# Line 153  class GeneralPane extends JPanel { Line 173  class GeneralPane extends JPanel {
173          private final JCheckBox checkShowLSConsoleWhenRunScript =          private final JCheckBox checkShowLSConsoleWhenRunScript =
174                  new JCheckBox(i18n.getLabel("GeneralPane.checkShowLSConsoleWhenRunScript"));                  new JCheckBox(i18n.getLabel("GeneralPane.checkShowLSConsoleWhenRunScript"));
175                    
176            private final JCheckBox checkShowVolumesInDecibels =
177                    new JCheckBox(i18n.getLabel("GeneralPane.checkShowVolumesInDecibels"));
178            
179            private final JSGeneralProps.MaxVolumePane maxVolPane = new JSGeneralProps.MaxVolumePane();
180            
181          private final JSGeneralProps.JSamplerHomePane jSamplerHomePane =          private final JSGeneralProps.JSamplerHomePane jSamplerHomePane =
182                  new JSGeneralProps.JSamplerHomePane();                  new JSGeneralProps.JSamplerHomePane();
183                    
# Line 180  class GeneralPane extends JPanel { Line 205  class GeneralPane extends JPanel {
205                                    
206                  add(Box.createRigidArea(new Dimension(0, 6)));                  add(Box.createRigidArea(new Dimension(0, 6)));
207                                    
208                    b = preferences().getBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL);
209                    checkShowVolumesInDecibels.setSelected(b);
210                    
211                    add(checkShowVolumesInDecibels);
212                    
213                    add(Box.createRigidArea(new Dimension(0, 6)));
214                    
215                    add(maxVolPane);
216                    
217                    add(Box.createRigidArea(new Dimension(0, 6)));
218                    
219                  add(jSamplerHomePane);                  add(jSamplerHomePane);
220                                    
221                  add(Box.createRigidArea(new Dimension(0, 6)));                  add(Box.createRigidArea(new Dimension(0, 6)));
# Line 194  class GeneralPane extends JPanel { Line 230  class GeneralPane extends JPanel {
230                    
231          protected void          protected void
232          apply() {          apply() {
233                    maxVolPane.apply();
234                    
235                  boolean b = !checkTurnOffAnimationEffects.isSelected();                  boolean b = !checkTurnOffAnimationEffects.isSelected();
236                  preferences().setBoolProperty(ANIMATED, b);                  preferences().setBoolProperty(ANIMATED, b);
237                                    
238                  b = checkShowLSConsoleWhenRunScript.isSelected();                  b = checkShowLSConsoleWhenRunScript.isSelected();
239                  preferences().setBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, b);                  preferences().setBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, b);
240                                    
241                    b = checkShowVolumesInDecibels.isSelected();
242                    preferences().setBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL, b);
243                    
244                  int size = recentScriptsPane.getRecentScriptsSize();                  int size = recentScriptsPane.getRecentScriptsSize();
245                  preferences().setIntProperty(RECENT_LSCP_SCRIPTS_SIZE, size);                  preferences().setIntProperty(RECENT_LSCP_SCRIPTS_SIZE, size);
246                  ((MainFrame)CC.getMainFrame()).updateRecentScriptsMenu();                  ((MainFrame)CC.getMainFrame()).updateRecentScriptsMenu();
# Line 218  class GeneralPane extends JPanel { Line 259  class GeneralPane extends JPanel {
259          }          }
260  }  }
261    
262    class ViewPane extends JPanel {
263            private final JCheckBox checkTurnOffCustomWindowDecoration =
264                    new JCheckBox(i18n.getLabel("ViewPane.checkTurnOffCustomWindowDecoration"));
265            
266            private final JCheckBox checkShowInstrumentsDb =
267                    new JCheckBox(i18n.getLabel("ViewPane.checkShowInstrumentsDb"));
268            
269            private final JSViewProps.MidiDevicesPane midiDevsPane = new JSViewProps.MidiDevicesPane();
270            private final JSViewProps.AudioDevicesPane audioDevsPane = new JSViewProps.AudioDevicesPane();
271            
272            private final JSViewProps.ConfirmationMessagesPane confirmationMessagesPane =
273                    new JSViewProps.ConfirmationMessagesPane();
274            
275            ViewPane() {
276                    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
277                    
278                    boolean b = preferences().getBoolProperty("TurnOffCustomWindowDecoration");
279                    checkTurnOffCustomWindowDecoration.setSelected(b);
280                    checkTurnOffCustomWindowDecoration.setAlignmentX(JPanel.LEFT_ALIGNMENT);
281                    add(checkTurnOffCustomWindowDecoration);
282                    add(Box.createRigidArea(new Dimension(0, 6)));
283                    
284                    b = preferences().getBoolProperty("rightSidePane.showInstrumentsDb");
285                    checkShowInstrumentsDb.setSelected(b);
286                    checkShowInstrumentsDb.setAlignmentX(JPanel.LEFT_ALIGNMENT);
287                    add(checkShowInstrumentsDb);
288                    add(Box.createRigidArea(new Dimension(0, 6)));
289                    
290                    add(midiDevsPane);
291                    add(audioDevsPane);
292                    add(confirmationMessagesPane);
293            }
294            
295            protected void
296            apply() {
297                    String s = "TurnOffCustomWindowDecoration";
298                    preferences().setBoolProperty(s, checkTurnOffCustomWindowDecoration.isSelected());
299                    
300                    s = "rightSidePane.showInstrumentsDb";
301                    preferences().setBoolProperty(s, checkShowInstrumentsDb.isSelected());
302                    
303                    midiDevsPane.apply();
304                    audioDevsPane.apply();
305                    confirmationMessagesPane.apply();
306            }
307    }
308    
309    class ChannelsPropsPane extends JPanel {
310            private final JCheckBox checkShowChannelNumbering =
311                    new JCheckBox(i18n.getLabel("ChannelsPropsPane.checkShowChannelNumbering"));
312            
313            private final JCheckBox checkShowMidiInfo =
314                    new JCheckBox(i18n.getLabel("ChannelsPropsPane.checkShowMidiInfo"));
315            
316            ChannelsPropsPane() {
317                    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
318                    
319                    add(createSmallViewPane());
320                    JPanel p = new JPanel();
321                    p.setLayout(new BorderLayout());
322                    add(p);
323            }
324            
325            protected void
326            apply() {
327                    boolean b = checkShowChannelNumbering.isSelected();
328                    preferences().setBoolProperty("channel.smallView.showChannelNumbering", b);
329                    
330                    b = checkShowMidiInfo.isSelected();
331                    preferences().setBoolProperty("channel.smallView.showMidiInfo", b);
332            }
333            
334            private JPanel
335            createSmallViewPane() {
336                    JPanel p = new JPanel();
337                    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
338                    
339                    boolean b = preferences().getBoolProperty("channel.smallView.showChannelNumbering");
340                    checkShowChannelNumbering.setSelected(b);
341                    checkShowChannelNumbering.setAlignmentX(LEFT_ALIGNMENT);
342                    p.add(checkShowChannelNumbering);
343                    
344                    b = preferences().getBoolProperty("channel.smallView.showMidiInfo");
345                    checkShowMidiInfo.setSelected(b);
346                    checkShowMidiInfo.setAlignmentX(LEFT_ALIGNMENT);
347                    p.add(checkShowMidiInfo);
348                    
349                    String s = i18n.getLabel("ChannelsPropsPane.smallView");
350                    p.setBorder(BorderFactory.createTitledBorder(s));
351                    p.setMaximumSize(new Dimension(Short.MAX_VALUE, p.getPreferredSize().height));
352                    
353                    return p;
354            }
355    }
356    
357  class ConsolePane extends JSLSConsolePropsPane {  class ConsolePane extends JSLSConsolePropsPane {
358          protected void          protected void
359          clearConsoleHistory() {          clearConsoleHistory() {

Legend:
Removed from v.1286  
changed lines
  Added in v.1743

  ViewVC Help
Powered by ViewVC