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

Contents of /jsampler/trunk/src/org/jsampler/view/std/JSAdvancedGeneralPropsDlg.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1767 - (show annotations) (download)
Mon Sep 8 00:19:27 2008 UTC (15 years, 7 months ago) by iliev
File size: 5971 byte(s)
* Added `Copy To' and `Move To' commands to the MIDI bank context menu
  and to the MIDI instrument context menu
* Added commands to the MIDI instrument context menu for moving
  a MIDI instrument to another program
  (right-click on a MIDI instrument and choose `Change Program')
* Added option to choose between zero-based and one-based
  MIDI bank/program numbering
  (choose Edit/Preferences, then click the `Advanced' button)
* Added option to choose whether to include MIDI instrument
  mappings when exporting a sampler configuration to LSCP script.
  (choose Edit/Preferences, then click the `Advanced' button)
* Added option to set the MIDI instrument loading in background
  when exporting MIDI instrument mappings to LSCP script.
  (choose Edit/Preferences, then click the `Advanced' button)
* Implemented an option to change the socket read timeout
  (choose Edit/Preferences, then click the `Backend' tab)
* Updated LscpTree
* Fantasia: Added option to hide the active stream/voice count statistic
  in the sampler channel's small view
  (choose Edit/Preferences, then click the `Channels' tab)
* Fantasia: `Turn off animation effects' checkbox moved to the `View' tab

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2008 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.Dialog;
26 import java.awt.Dimension;
27 import java.awt.GridBagConstraints;
28 import java.awt.GridBagLayout;
29 import java.awt.Insets;
30
31 import javax.swing.BorderFactory;
32 import javax.swing.Box;
33 import javax.swing.BoxLayout;
34 import javax.swing.JCheckBox;
35 import javax.swing.JComboBox;
36 import javax.swing.JLabel;
37 import javax.swing.JPanel;
38
39 import net.sf.juife.OkCancelDialog;
40
41 import org.jsampler.CC;
42
43 import static org.jsampler.JSPrefs.*;
44 import static org.jsampler.view.std.StdI18n.i18n;
45
46
47 /**
48 *
49 * @author Grigor Iliev
50 */
51 public class JSAdvancedGeneralPropsDlg extends OkCancelDialog {
52 private final MainPane mainPane = new MainPane();
53
54 /** Creates a new instance of <code>JSAdvancedGeneralPropsDlg</code> */
55 public
56 JSAdvancedGeneralPropsDlg(Dialog owner) {
57 super(owner, i18n.getLabel("JSAdvancedGeneralPropsDlg.title"));
58 btnOk.setText(i18n.getButtonLabel("apply"));
59
60
61
62 setMainPane(mainPane);
63 btnOk.requestFocus();
64 }
65
66 protected void
67 onOk() {
68 if(!btnOk.isEnabled()) return;
69
70 mainPane.apply();
71
72 setVisible(false);
73 setCancelled(false);
74 }
75
76 protected void
77 onCancel() { setVisible(false); }
78
79 public static class MainPane extends JPanel {
80 private final MidiBankProgramNumberingPane numberingPane = new MidiBankProgramNumberingPane();
81 private final ExportSettingsPane exportSettingsPane = new ExportSettingsPane();
82
83 public
84 MainPane() {
85 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
86 add(numberingPane);
87 add(Box.createRigidArea(new Dimension(0, 6)));
88 add(exportSettingsPane);
89 }
90
91 public void
92 apply() {
93 numberingPane.apply();
94 exportSettingsPane.apply();
95 }
96 }
97
98 public static class MidiBankProgramNumberingPane extends JPanel {
99 private final JLabel lFirstBank =
100 new JLabel(i18n.getLabel("JSAdvancedGeneralPropsDlg.lFirstBank"));
101
102 private final JLabel lFirstProgram =
103 new JLabel(i18n.getLabel("JSAdvancedGeneralPropsDlg.lFirstProgram"));
104
105 private final JComboBox cbFirstBank = new JComboBox();
106 private final JComboBox cbFirstProgram = new JComboBox();
107
108 public
109 MidiBankProgramNumberingPane() {
110 GridBagLayout gridbag = new GridBagLayout();
111 GridBagConstraints c = new GridBagConstraints();
112
113 setLayout(gridbag);
114
115 c.fill = GridBagConstraints.NONE;
116
117 c.gridx = 0;
118 c.gridy = 0;
119 c.anchor = GridBagConstraints.EAST;
120 c.insets = new Insets(3, 3, 3, 3);
121 gridbag.setConstraints(lFirstBank, c);
122 add(lFirstBank);
123
124 c.gridx = 0;
125 c.gridy = 1;
126 gridbag.setConstraints(lFirstProgram, c);
127 add(lFirstProgram);
128
129 c.fill = GridBagConstraints.HORIZONTAL;
130 c.gridx = 1;
131 c.gridy = 0;
132 c.weightx = 1.0;
133 c.insets = new Insets(3, 3, 3, 3);
134 c.anchor = GridBagConstraints.WEST;
135 gridbag.setConstraints(cbFirstBank, c);
136 add(cbFirstBank);
137
138 c.gridx = 1;
139 c.gridy = 1;
140 gridbag.setConstraints(cbFirstProgram, c);
141 add(cbFirstProgram);
142
143 String s = i18n.getLabel("MidiBankProgramNumberingPane.title");
144 setBorder(BorderFactory.createTitledBorder(s));
145
146 cbFirstBank.addItem("0");
147 cbFirstBank.addItem("1");
148
149 cbFirstProgram.addItem("0");
150 cbFirstProgram.addItem("1");
151
152 int i = CC.preferences().getIntProperty(FIRST_MIDI_BANK_NUMBER);
153 if(i < 0 || i > 1) i = 1;
154 cbFirstBank.setSelectedIndex(i);
155
156 i = CC.preferences().getIntProperty(FIRST_MIDI_PROGRAM_NUMBER);
157 if(i < 0 || i > 1) i = 1;
158 cbFirstProgram.setSelectedIndex(i);
159
160 setAlignmentX(LEFT_ALIGNMENT);
161 }
162
163 public void
164 apply() {
165 int i = cbFirstBank.getSelectedIndex();
166 if(i < 0) i = 1;
167 CC.preferences().setIntProperty(FIRST_MIDI_BANK_NUMBER, i);
168
169 i = cbFirstProgram.getSelectedIndex();
170 if(i < 0) i = 1;
171 CC.preferences().setIntProperty(FIRST_MIDI_PROGRAM_NUMBER, i);
172 }
173 }
174
175 public static class ExportSettingsPane extends JPanel {
176 private final JCheckBox checkExportMidiMapsToSession =
177 new JCheckBox(i18n.getLabel("ExportSettingsPane.checkExportMidiMapsToSession"));
178
179 private final JCheckBox checkLoadInstrInBackground =
180 new JCheckBox(i18n.getLabel("ExportSettingsPane.checkLoadInstrInBackground"));
181
182 public
183 ExportSettingsPane() {
184 setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
185
186 boolean b;
187 b = CC.preferences().getBoolProperty(EXPORT_MIDI_MAPS_TO_SESSION_SCRIPT);
188 checkExportMidiMapsToSession.setSelected(b);
189 checkExportMidiMapsToSession.setAlignmentX(LEFT_ALIGNMENT);
190 add(checkExportMidiMapsToSession);
191
192 b = CC.preferences().getBoolProperty(LOAD_MIDI_INSTRUMENTS_IN_BACKGROUND);
193 checkLoadInstrInBackground.setSelected(b);
194 checkLoadInstrInBackground.setAlignmentX(LEFT_ALIGNMENT);
195 add(checkLoadInstrInBackground);
196
197 String s = i18n.getLabel("ExportSettingsPane.title");
198 setBorder(BorderFactory.createTitledBorder(s));
199 setAlignmentX(LEFT_ALIGNMENT);
200 }
201
202 protected void
203 apply() {
204 boolean b = checkExportMidiMapsToSession.isSelected();
205 CC.preferences().setBoolProperty(EXPORT_MIDI_MAPS_TO_SESSION_SCRIPT, b);
206
207 b = checkLoadInstrInBackground.isSelected();
208 CC.preferences().setBoolProperty(LOAD_MIDI_INSTRUMENTS_IN_BACKGROUND, b);
209 }
210 }
211 }

  ViewVC Help
Powered by ViewVC