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.*; |
61 |
*/ |
*/ |
62 |
public class PrefsDlg extends EnhancedDialog { |
public class PrefsDlg extends EnhancedDialog { |
63 |
private final GeneralPane genPane = new GeneralPane(); |
private final GeneralPane genPane = new GeneralPane(); |
64 |
|
private final ViewPane viewPane = new ViewPane(); |
65 |
private final ConsolePane consolePane = new ConsolePane(); |
private final ConsolePane consolePane = new ConsolePane(); |
66 |
private final JSConnectionPropsPane connectionPane = new JSConnectionPropsPane(); |
private final JSConnectionPropsPane connectionPane = new JSConnectionPropsPane(); |
67 |
|
private final JSDefaultsPropsPane defaultsPane; |
68 |
|
|
69 |
private final JButton btnApply = new JButton(i18n.getButtonLabel("apply")); |
private final JButton btnApply = new JButton(i18n.getButtonLabel("apply")); |
70 |
private final JButton btnClose = new JButton(i18n.getButtonLabel("close")); |
private final JButton btnClose = new JButton(i18n.getButtonLabel("close")); |
72 |
|
|
73 |
/** Creates a new instance of <code>PrefsDlg</code> */ |
/** Creates a new instance of <code>PrefsDlg</code> */ |
74 |
public |
public |
75 |
PrefsDlg(Frame owner) { |
PrefsDlg(Frame owner) { |
76 |
super(owner, i18n.getLabel("PrefsDlg.title"), true); |
super(owner, i18n.getLabel("PrefsDlg.title"), true); |
77 |
|
|
78 |
|
defaultsPane = new JSDefaultsPropsPane(this, Res.iconEdit16); |
79 |
|
|
80 |
JTabbedPane tp = new JTabbedPane(); |
JTabbedPane tp = new JTabbedPane(); |
81 |
tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane); |
tp.addTab(i18n.getLabel("PrefsDlg.tabGeneral"), genPane); |
82 |
|
tp.addTab(i18n.getLabel("PrefsDlg.tabView"), viewPane); |
83 |
tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane); |
tp.addTab(i18n.getLabel("PrefsDlg.tabConsole"), consolePane); |
84 |
|
|
85 |
JPanel p = new JPanel(); |
JPanel p = new JPanel(); |
86 |
p.setLayout(new BorderLayout()); |
p.setLayout(new BorderLayout()); |
87 |
p.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
p.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); |
88 |
p.add(connectionPane, BorderLayout.NORTH); |
p.add(connectionPane); |
89 |
tp.addTab(i18n.getLabel("PrefsDlg.tabConnection"), p); |
tp.addTab(i18n.getLabel("PrefsDlg.tabBackend"), p); |
90 |
|
tp.addTab(i18n.getLabel("PrefsDlg.tabDefaults"), defaultsPane); |
91 |
|
|
92 |
tp.setAlignmentX(RIGHT_ALIGNMENT); |
tp.setAlignmentX(RIGHT_ALIGNMENT); |
93 |
|
|
117 |
setLocation(JuifeUtils.centerLocation(this, owner)); |
setLocation(JuifeUtils.centerLocation(this, owner)); |
118 |
|
|
119 |
installListeners(); |
installListeners(); |
|
|
|
|
connectionPane.setLSAddress(Prefs.getLSAddress()); |
|
|
connectionPane.setLSPort(String.valueOf(Prefs.getLSPort())); |
|
120 |
} |
} |
121 |
|
|
122 |
private void |
private void |
141 |
private void |
private void |
142 |
onApply() { |
onApply() { |
143 |
genPane.apply(); |
genPane.apply(); |
144 |
|
viewPane.apply(); |
145 |
consolePane.apply(); |
consolePane.apply(); |
146 |
connectionPane.apply(); |
connectionPane.apply(); |
147 |
|
defaultsPane.apply(); |
148 |
|
|
149 |
setVisible(false); |
setVisible(false); |
150 |
} |
} |
160 |
private final JCheckBox checkShowLSConsoleWhenRunScript = |
private final JCheckBox checkShowLSConsoleWhenRunScript = |
161 |
new JCheckBox(i18n.getLabel("GeneralPane.checkShowLSConsoleWhenRunScript")); |
new JCheckBox(i18n.getLabel("GeneralPane.checkShowLSConsoleWhenRunScript")); |
162 |
|
|
163 |
|
private final JCheckBox checkShowVolumesInDecibels = |
164 |
|
new JCheckBox(i18n.getLabel("GeneralPane.checkShowVolumesInDecibels")); |
165 |
|
|
166 |
|
private final JSGeneralProps.MaxVolumePane maxVolPane = new JSGeneralProps.MaxVolumePane(); |
167 |
|
|
168 |
private final JSGeneralProps.JSamplerHomePane jSamplerHomePane = |
private final JSGeneralProps.JSamplerHomePane jSamplerHomePane = |
169 |
new JSGeneralProps.JSamplerHomePane(); |
new JSGeneralProps.JSamplerHomePane(); |
170 |
|
|
192 |
|
|
193 |
add(Box.createRigidArea(new Dimension(0, 6))); |
add(Box.createRigidArea(new Dimension(0, 6))); |
194 |
|
|
195 |
|
b = preferences().getBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL); |
196 |
|
checkShowVolumesInDecibels.setSelected(b); |
197 |
|
|
198 |
|
add(checkShowVolumesInDecibels); |
199 |
|
|
200 |
|
add(Box.createRigidArea(new Dimension(0, 6))); |
201 |
|
|
202 |
|
add(maxVolPane); |
203 |
|
|
204 |
|
add(Box.createRigidArea(new Dimension(0, 6))); |
205 |
|
|
206 |
add(jSamplerHomePane); |
add(jSamplerHomePane); |
207 |
|
|
208 |
add(Box.createRigidArea(new Dimension(0, 6))); |
add(Box.createRigidArea(new Dimension(0, 6))); |
217 |
|
|
218 |
protected void |
protected void |
219 |
apply() { |
apply() { |
220 |
|
maxVolPane.apply(); |
221 |
|
|
222 |
boolean b = !checkTurnOffAnimationEffects.isSelected(); |
boolean b = !checkTurnOffAnimationEffects.isSelected(); |
223 |
preferences().setBoolProperty(ANIMATED, b); |
preferences().setBoolProperty(ANIMATED, b); |
224 |
|
|
225 |
b = checkShowLSConsoleWhenRunScript.isSelected(); |
b = checkShowLSConsoleWhenRunScript.isSelected(); |
226 |
preferences().setBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, b); |
preferences().setBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, b); |
227 |
|
|
228 |
|
b = checkShowVolumesInDecibels.isSelected(); |
229 |
|
preferences().setBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL, b); |
230 |
|
|
231 |
int size = recentScriptsPane.getRecentScriptsSize(); |
int size = recentScriptsPane.getRecentScriptsSize(); |
232 |
preferences().setIntProperty(RECENT_LSCP_SCRIPTS_SIZE, size); |
preferences().setIntProperty(RECENT_LSCP_SCRIPTS_SIZE, size); |
233 |
((MainFrame)CC.getMainFrame()).updateRecentScriptsMenu(); |
((MainFrame)CC.getMainFrame()).updateRecentScriptsMenu(); |
246 |
} |
} |
247 |
} |
} |
248 |
|
|
249 |
|
class ViewPane extends JPanel { |
250 |
|
private final JCheckBox checkTurnOffCustomWindowDecoration = |
251 |
|
new JCheckBox(i18n.getLabel("ViewPane.checkTurnOffCustomWindowDecoration")); |
252 |
|
|
253 |
|
private final JSViewProps.MidiDevicesPane midiDevsPane = new JSViewProps.MidiDevicesPane(); |
254 |
|
private final JSViewProps.AudioDevicesPane audioDevsPane = new JSViewProps.AudioDevicesPane(); |
255 |
|
|
256 |
|
private final JSViewProps.ConfirmationMessagesPane confirmationMessagesPane = |
257 |
|
new JSViewProps.ConfirmationMessagesPane(); |
258 |
|
|
259 |
|
ViewPane() { |
260 |
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
261 |
|
|
262 |
|
boolean b = preferences().getBoolProperty("TurnOffCustomWindowDecoration"); |
263 |
|
checkTurnOffCustomWindowDecoration.setSelected(b); |
264 |
|
checkTurnOffCustomWindowDecoration.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
265 |
|
add(checkTurnOffCustomWindowDecoration); |
266 |
|
add(Box.createRigidArea(new Dimension(0, 6))); |
267 |
|
add(midiDevsPane); |
268 |
|
add(audioDevsPane); |
269 |
|
add(confirmationMessagesPane); |
270 |
|
} |
271 |
|
|
272 |
|
protected void |
273 |
|
apply() { |
274 |
|
String s = "TurnOffCustomWindowDecoration"; |
275 |
|
preferences().setBoolProperty(s, checkTurnOffCustomWindowDecoration.isSelected()); |
276 |
|
|
277 |
|
midiDevsPane.apply(); |
278 |
|
audioDevsPane.apply(); |
279 |
|
confirmationMessagesPane.apply(); |
280 |
|
} |
281 |
|
} |
282 |
|
|
283 |
class ConsolePane extends JSLSConsolePropsPane { |
class ConsolePane extends JSLSConsolePropsPane { |
284 |
protected void |
protected void |
285 |
clearConsoleHistory() { |
clearConsoleHistory() { |