1 |
iliev |
1286 |
/* |
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.fantasia; |
24 |
|
|
|
25 |
|
|
import java.awt.event.ActionEvent; |
26 |
|
|
|
27 |
|
|
import javax.swing.AbstractAction; |
28 |
|
|
import javax.swing.Action; |
29 |
|
|
|
30 |
|
|
import org.jsampler.CC; |
31 |
|
|
import org.jsampler.HF; |
32 |
|
|
|
33 |
|
|
import org.jsampler.view.std.JSNewAudioDeviceDlg; |
34 |
|
|
import org.jsampler.view.std.JSNewMidiDeviceDlg; |
35 |
|
|
import org.jsampler.view.std.StdA4n; |
36 |
|
|
|
37 |
|
|
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
38 |
|
|
import static org.jsampler.view.std.StdPrefs.*; |
39 |
|
|
|
40 |
|
|
/** |
41 |
|
|
* |
42 |
|
|
* @author Grigor Iliev |
43 |
|
|
*/ |
44 |
|
|
public class A4n extends StdA4n { |
45 |
|
|
protected static A4n a4n = new A4n(); |
46 |
|
|
|
47 |
|
|
/** Forbids the instantiation of <code>A4n</code> */ |
48 |
|
|
private A4n() { |
49 |
|
|
refresh.putValue(Action.SMALL_ICON, Res.iconReload32); |
50 |
|
|
resetSampler.putValue(Action.SMALL_ICON, Res.iconReset32); |
51 |
|
|
exportSamplerConfig.putValue(Action.SMALL_ICON, Res.iconSave32); |
52 |
|
|
//exportMidiInstrumentMaps.putValue(Action.SMALL_ICON, Res.icon); |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
protected FantasiaPrefs |
56 |
|
|
preferences() { |
57 |
|
|
return FantasiaPrefs.preferences(); |
58 |
|
|
} |
59 |
|
|
|
60 |
|
|
public final Action samplerInfo = new SamplerInfo(); |
61 |
|
|
|
62 |
|
|
private static class SamplerInfo extends AbstractAction { |
63 |
|
|
SamplerInfo() { |
64 |
|
|
super(i18n.getMenuLabel("actions.samplerInfo")); |
65 |
|
|
|
66 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("actions.samplerInfo.tt")); |
67 |
|
|
putValue(Action.SMALL_ICON, Res.iconSamplerInfo32); |
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
public void |
71 |
|
|
actionPerformed(ActionEvent e) { |
72 |
|
|
new SamplerInfoDlg(CC.getMainFrame()).setVisible(true); |
73 |
|
|
} |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
public final Action loadScript = new LoadLscpScript(); |
77 |
|
|
|
78 |
|
|
private class LoadLscpScript extends AbstractAction { |
79 |
|
|
LoadLscpScript() { |
80 |
|
|
super(i18n.getMenuLabel("actions.runScript")); |
81 |
|
|
|
82 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("actions.runScript.tt")); |
83 |
|
|
putValue(Action.SMALL_ICON, Res.iconOpen32); |
84 |
|
|
} |
85 |
|
|
|
86 |
|
|
public void |
87 |
|
|
actionPerformed(ActionEvent e) { |
88 |
iliev |
1688 |
if(!((MainFrame)CC.getMainFrame()).runScript()) return; |
89 |
iliev |
1286 |
|
90 |
|
|
if(preferences().getBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT)) { |
91 |
|
|
windowLSConsole.actionPerformed(null); |
92 |
|
|
} |
93 |
|
|
} |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
public final Action createMidiDevice = new CreateMidiDevice(); |
97 |
|
|
|
98 |
|
|
private class CreateMidiDevice extends AbstractAction { |
99 |
|
|
CreateMidiDevice() { |
100 |
iliev |
1323 |
super(i18n.getMenuLabel("edit.createMidiDevice")); |
101 |
iliev |
1286 |
|
102 |
iliev |
1323 |
String s = i18n.getMenuLabel("edit.createMidiDevice.tt"); |
103 |
iliev |
1286 |
putValue(SHORT_DESCRIPTION, s); |
104 |
|
|
//putValue(Action.SMALL_ICON, Res.iconNew16); |
105 |
|
|
} |
106 |
|
|
|
107 |
|
|
public void |
108 |
|
|
actionPerformed(ActionEvent e) { |
109 |
iliev |
1688 |
if(!CC.verifyConnection()) return; |
110 |
iliev |
1286 |
new JSNewMidiDeviceDlg(CC.getMainFrame()).setVisible(true); |
111 |
|
|
} |
112 |
|
|
} |
113 |
|
|
|
114 |
|
|
public final Action createAudioDevice = new CreateAudioDevice(); |
115 |
|
|
|
116 |
|
|
private class CreateAudioDevice extends AbstractAction { |
117 |
|
|
CreateAudioDevice() { |
118 |
iliev |
1323 |
super(i18n.getMenuLabel("edit.createAudioDevice")); |
119 |
iliev |
1286 |
|
120 |
iliev |
1323 |
String s = i18n.getMenuLabel("edit.createAudioDevice.tt"); |
121 |
iliev |
1286 |
putValue(SHORT_DESCRIPTION, s); |
122 |
|
|
//putValue(Action.SMALL_ICON, Res.iconNew16); |
123 |
|
|
} |
124 |
|
|
|
125 |
|
|
public void |
126 |
|
|
actionPerformed(ActionEvent e) { |
127 |
iliev |
1688 |
if(!CC.verifyConnection()) return; |
128 |
iliev |
1286 |
new JSNewAudioDeviceDlg(CC.getMainFrame()).setVisible(true); |
129 |
|
|
} |
130 |
|
|
} |
131 |
|
|
|
132 |
|
|
// EDIT |
133 |
|
|
|
134 |
|
|
public final Action editPreferences = new EditPreferences(); |
135 |
|
|
|
136 |
|
|
private class EditPreferences extends AbstractAction { |
137 |
|
|
EditPreferences() { |
138 |
|
|
super(i18n.getMenuLabel("edit.preferences")); |
139 |
|
|
|
140 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("edit.preferences.tt")); |
141 |
|
|
putValue(Action.SMALL_ICON, Res.iconPreferences32); |
142 |
|
|
} |
143 |
|
|
|
144 |
|
|
public void |
145 |
|
|
actionPerformed(ActionEvent e) { new PrefsDlg(CC.getMainFrame()).setVisible(true); } |
146 |
|
|
} |
147 |
|
|
|
148 |
|
|
// WINDOW |
149 |
|
|
public final Action windowLSConsole = new WindowLSConsole(); |
150 |
|
|
|
151 |
|
|
private class WindowLSConsole extends AbstractAction { |
152 |
|
|
WindowLSConsole() { |
153 |
|
|
super(i18n.getMenuLabel("window.lsConsole")); |
154 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("window.lsConsole.tt")); |
155 |
|
|
putValue(Action.SMALL_ICON, Res.iconLSConsole32); |
156 |
|
|
} |
157 |
|
|
|
158 |
|
|
public void |
159 |
|
|
actionPerformed(ActionEvent e) { |
160 |
|
|
LSConsoleFrame console = ((MainFrame)CC.getMainFrame()).getLSConsoleFrame(); |
161 |
|
|
|
162 |
|
|
if(console.isVisible()) console.setVisible(false); |
163 |
|
|
|
164 |
|
|
console.setVisible(true); |
165 |
|
|
} |
166 |
|
|
} |
167 |
|
|
|
168 |
|
|
public final Action windowInstrumentsDb = new WindowInstrumentsDb(); |
169 |
|
|
|
170 |
|
|
private class WindowInstrumentsDb extends AbstractAction { |
171 |
|
|
InstrumentsDbFrame instrumentsDbFrame = null; |
172 |
|
|
|
173 |
|
|
WindowInstrumentsDb() { |
174 |
|
|
super(i18n.getMenuLabel("window.instrumentsDb")); |
175 |
|
|
putValue(SHORT_DESCRIPTION, i18n.getMenuLabel("window.instrumentsDb.tt")); |
176 |
|
|
putValue(Action.SMALL_ICON, Res.iconDb32); |
177 |
|
|
} |
178 |
|
|
|
179 |
|
|
public void |
180 |
|
|
actionPerformed(ActionEvent e) { |
181 |
iliev |
1688 |
if(!CC.verifyConnection()) return; |
182 |
|
|
|
183 |
iliev |
1286 |
if(CC.getInstrumentsDbTreeModel() == null) { |
184 |
|
|
String s = i18n.getMessage("A4n.noInstrumentsDbSupport!"); |
185 |
|
|
HF.showErrorMessage(s, CC.getMainFrame()); |
186 |
|
|
return; |
187 |
|
|
} |
188 |
|
|
|
189 |
|
|
if(instrumentsDbFrame != null && instrumentsDbFrame.isVisible()) { |
190 |
|
|
instrumentsDbFrame.setVisible(false); |
191 |
|
|
instrumentsDbFrame.setVisible(true); |
192 |
|
|
return; |
193 |
|
|
} |
194 |
|
|
|
195 |
|
|
instrumentsDbFrame = new InstrumentsDbFrame(); |
196 |
|
|
instrumentsDbFrame.setVisible(true); |
197 |
|
|
} |
198 |
|
|
} |
199 |
|
|
|
200 |
|
|
// HELP |
201 |
|
|
public final Action helpAbout = new HelpAbout(); |
202 |
|
|
|
203 |
|
|
private class HelpAbout extends AbstractAction { |
204 |
|
|
HelpAbout() { |
205 |
|
|
super(i18n.getMenuLabel("help.about", "Fantasia")); |
206 |
|
|
} |
207 |
|
|
|
208 |
|
|
public void |
209 |
|
|
actionPerformed(ActionEvent e) { |
210 |
|
|
new HelpAboutDlg(CC.getMainFrame()).setVisible(true); |
211 |
|
|
} |
212 |
|
|
} |
213 |
|
|
} |