1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
23 |
package org.jsampler.view.fantasia; |
package org.jsampler.view.fantasia; |
24 |
|
|
25 |
import java.awt.BorderLayout; |
import java.awt.BorderLayout; |
26 |
|
import java.awt.Color; |
27 |
|
import java.awt.Composite; |
28 |
import java.awt.Dialog; |
import java.awt.Dialog; |
29 |
import java.awt.Dimension; |
import java.awt.Dimension; |
30 |
import java.awt.Frame; |
import java.awt.Frame; |
31 |
import java.awt.Point; |
import java.awt.Graphics; |
32 |
|
import java.awt.Graphics2D; |
33 |
|
import java.awt.GridBagConstraints; |
34 |
|
import java.awt.GridBagLayout; |
35 |
|
import java.awt.Insets; |
36 |
|
import java.awt.Paint; |
37 |
|
import java.awt.Rectangle; |
38 |
|
|
39 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
40 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
41 |
import java.awt.event.MouseAdapter; |
import java.awt.event.KeyEvent; |
|
import java.awt.event.MouseEvent; |
|
42 |
|
|
43 |
import java.util.logging.Level; |
import java.beans.PropertyChangeEvent; |
44 |
|
import java.beans.PropertyChangeListener; |
45 |
|
|
46 |
import javax.swing.Box; |
import java.io.BufferedReader; |
47 |
|
import java.io.File; |
48 |
|
import java.io.FileNotFoundException; |
49 |
|
import java.io.FileReader; |
50 |
|
|
51 |
|
import java.util.Vector; |
52 |
|
|
53 |
|
import javax.swing.BorderFactory; |
54 |
import javax.swing.BoxLayout; |
import javax.swing.BoxLayout; |
55 |
import javax.swing.JCheckBoxMenuItem; |
import javax.swing.JCheckBoxMenuItem; |
56 |
|
import javax.swing.JFileChooser; |
57 |
import javax.swing.JMenu; |
import javax.swing.JMenu; |
58 |
|
import javax.swing.JMenuBar; |
59 |
import javax.swing.JMenuItem; |
import javax.swing.JMenuItem; |
60 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
61 |
import javax.swing.JPopupMenu; |
import javax.swing.JSplitPane; |
62 |
import javax.swing.JToggleButton; |
import javax.swing.KeyStroke; |
63 |
import javax.swing.UIManager; |
import javax.swing.SwingUtilities; |
64 |
import javax.swing.plaf.synth.SynthLookAndFeel; |
import javax.swing.Timer; |
|
|
|
|
import net.sf.juife.TitleBar; |
|
65 |
|
|
66 |
import org.jsampler.CC; |
import org.jsampler.CC; |
67 |
import org.jsampler.HF; |
import org.jsampler.HF; |
68 |
|
import org.jsampler.LSConsoleModel; |
69 |
|
import org.jsampler.Server; |
70 |
|
|
|
import org.jsampler.view.JSChannel; |
|
71 |
import org.jsampler.view.JSChannelsPane; |
import org.jsampler.view.JSChannelsPane; |
72 |
import org.jsampler.view.JSMainFrame; |
import org.jsampler.view.JSMainFrame; |
73 |
|
import org.jsampler.view.LscpFileFilter; |
74 |
|
|
75 |
|
import org.jsampler.view.fantasia.basic.FantasiaPainter; |
76 |
|
import org.jsampler.view.fantasia.basic.FantasiaPanel; |
77 |
|
import org.jsampler.view.fantasia.basic.FantasiaSubPanel; |
78 |
|
|
79 |
|
import org.jsampler.view.std.JSBackendLogFrame; |
80 |
|
import org.jsampler.view.std.JSConnectDlg; |
81 |
|
import org.jsampler.view.std.JSDetailedErrorDlg; |
82 |
|
import org.jsampler.view.std.JSQuitDlg; |
83 |
|
import org.jsampler.view.std.JSamplerHomeChooser; |
84 |
|
import org.jsampler.view.std.StdUtils; |
85 |
|
|
86 |
|
import static org.jsampler.view.fantasia.A4n.a4n; |
87 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
88 |
|
import static org.jsampler.view.fantasia.FantasiaPrefs.preferences; |
89 |
|
import static org.jsampler.view.std.StdPrefs.*; |
90 |
|
|
91 |
|
|
92 |
/** |
/** |
94 |
* @author Grigor Iliev |
* @author Grigor Iliev |
95 |
*/ |
*/ |
96 |
public class MainFrame extends JSMainFrame { |
public class MainFrame extends JSMainFrame { |
97 |
private final static int TITLE_BAR_WIDTH = 420; |
private final StandardBar standardBar = new StandardBar(); |
98 |
private final static int TITLE_BAR_HEIGHT = 29; |
private final FantasiaMenuBar menuBar = new FantasiaMenuBar(); |
99 |
|
private final JPanel rootPane = new RootPane(); |
100 |
|
private final BottomPane bottomPane; |
101 |
|
private final MainPane mainPane; |
102 |
|
private final PianoKeyboardPane pianoKeyboardPane; |
103 |
|
|
104 |
|
private final JMenu recentScriptsMenu = |
105 |
|
new JMenu(i18n.getMenuLabel("actions.recentScripts")); |
106 |
|
|
107 |
private final ChannelsPane channelsPane = new ChannelsPane(""); |
private final JSplitPane hSplitPane; |
108 |
|
|
109 |
|
private final LeftSidePane leftSidePane; |
110 |
|
private final RightSidePane rightSidePane; |
111 |
|
private final JPanel rightPane; |
112 |
|
|
113 |
|
//private final StatusBar statusBar = new StatusBar(); |
114 |
|
|
115 |
|
private final LSConsoleFrame lsConsoleFrame = new LSConsoleFrame(); |
116 |
|
private final Vector<String> recentScripts = new Vector<String>(); |
117 |
|
|
118 |
|
private final JSBackendLogFrame backendLogFrame = new JSBackendLogFrame(); |
119 |
|
|
120 |
|
|
121 |
|
private final JCheckBoxMenuItem cbmiToolBarVisible = |
122 |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.toolBar")); |
123 |
|
|
124 |
|
private final JCheckBoxMenuItem cbmiLeftSidePaneVisible = |
125 |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.leftSidePane")); |
126 |
|
|
127 |
|
private final JCheckBoxMenuItem cbmiRightSidePaneVisible = |
128 |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.rightSidePane")); |
129 |
|
|
130 |
|
private final JCheckBoxMenuItem cbmiMidiKeyboardVisible = |
131 |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.midiKeyboard")); |
132 |
|
|
133 |
|
private final Timer guiTimer = new Timer(1000, null); |
134 |
|
|
135 |
/** Creates a new instance of <code>MainFrame</code> */ |
/** Creates a new instance of <code>MainFrame</code> */ |
136 |
public |
public |
137 |
MainFrame() { |
MainFrame() { |
|
try { |
|
|
SynthLookAndFeel synth = new SynthLookAndFeel(); |
|
|
synth.load(MainFrame.class.getResourceAsStream("gui.xml"), MainFrame.class); |
|
|
UIManager.setLookAndFeel(synth); |
|
|
} catch(Exception e) { |
|
|
CC.getLogger().log(Level.INFO, HF.getErrorMessage(e), e); |
|
|
} |
|
|
|
|
138 |
setTitle(i18n.getLabel("MainFrame.title")); |
setTitle(i18n.getLabel("MainFrame.title")); |
139 |
addChannelsPane(channelsPane); |
//setUndecorated(true); |
140 |
add(channelsPane); |
if(Res.iconAppIcon != null) setIconImage(Res.iconAppIcon.getImage()); |
|
setUndecorated(true); |
|
|
|
|
|
JToggleButton btn = new PixmapToggleButton(Res.iconPowerOff, Res.iconPowerOn) { |
|
|
public boolean |
|
|
contains(int x, int y) { |
|
|
return (x - 11)*(x - 11) + (y - 11)*(y - 11) < 71; |
|
|
} |
|
|
}; |
|
141 |
|
|
142 |
btn.setSelected(true); |
CC.setMainFrame(this); // TODO: |
143 |
btn.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
mainPane = new MainPane(); |
144 |
btn.addActionListener(new ActionListener() { |
leftSidePane = new LeftSidePane(); |
145 |
public void |
rightSidePane = new RightSidePane(); |
|
actionPerformed(ActionEvent e) { onWindowClose(); } |
|
|
}); |
|
146 |
|
|
147 |
|
setSelectedChannelsPane(mainPane.getChannelsPane(0)); |
148 |
|
|
149 |
FantasiaTitleBar tb = new FantasiaTitleBar(); |
getContentPane().add(standardBar, BorderLayout.NORTH); |
|
tb.setName("FantasiaTitleBar"); |
|
|
tb.setLayout(new BoxLayout(tb, BoxLayout.X_AXIS)); |
|
|
tb.setOpaque(true); |
|
|
tb.add(Box.createRigidArea(new Dimension(4, 0))); |
|
|
tb.add(btn); |
|
|
tb.add(Box.createRigidArea(new Dimension(3, 0))); |
|
150 |
|
|
151 |
|
rightPane = createRightPane(); |
152 |
|
|
153 |
|
hSplitPane = new JSplitPane ( |
154 |
|
JSplitPane.HORIZONTAL_SPLIT, |
155 |
|
true, // continuousLayout |
156 |
|
leftSidePane, rightPane |
157 |
|
); |
158 |
|
hSplitPane.setResizeWeight(0.5); |
159 |
|
|
160 |
tb.add(createVSeparator()); |
pianoKeyboardPane = new PianoKeyboardPane(); |
161 |
|
|
162 |
tb.add(Box.createRigidArea(new Dimension(275, 0))); |
for(int i = 0; i < mainPane.getChannelsPaneCount(); i++) { |
163 |
|
addChannelsPane(mainPane.getChannelsPane(i)); |
164 |
|
getChannelsPane(i).addListSelectionListener(pianoKeyboardPane); |
165 |
|
} |
166 |
|
|
|
tb.add(createVSeparator()); |
|
167 |
|
|
168 |
tb.add(Box.createRigidArea(new Dimension(29, 0))); |
int h = preferences().getIntProperty("midiKeyboard.height"); |
169 |
|
setMidiKeyboardHeight(h); |
170 |
|
|
171 |
tb.add(createVSeparator()); |
PropertyChangeListener l = new PropertyChangeListener() { |
172 |
|
public void |
173 |
|
propertyChange(PropertyChangeEvent e) { |
174 |
|
int h = preferences().getIntProperty("midiKeyboard.height"); |
175 |
|
setMidiKeyboardHeight(h); |
176 |
|
} |
177 |
|
}; |
178 |
|
|
179 |
tb.add(Box.createRigidArea(new Dimension(40, 0))); |
CC.preferences().addPropertyChangeListener("midiKeyboard.height", l); |
180 |
|
|
181 |
tb.add(createVSeparator()); |
bottomPane = new BottomPane(); |
182 |
|
|
183 |
tb.setPreferredSize(new Dimension(TITLE_BAR_WIDTH, TITLE_BAR_HEIGHT)); |
hSplitPane.setOpaque(false); |
184 |
tb.setMinimumSize(tb.getPreferredSize()); |
rootPane.add(hSplitPane); |
185 |
tb.setMaximumSize(tb.getPreferredSize()); |
rootPane.add(bottomPane, BorderLayout.SOUTH); |
186 |
add(tb, BorderLayout.SOUTH); |
add(rootPane); |
187 |
|
|
188 |
getContentPane().setBackground(new java.awt.Color(0x818181)); |
addMenu(); |
|
getRootPane().setOpaque(false); |
|
|
getLayeredPane().setOpaque(false); |
|
|
//getContentPane().setVisible(false); |
|
189 |
|
|
190 |
setAlwaysOnTop(FantasiaPrefs.isAlwaysOnTop()); |
int i = preferences().getIntProperty("MainFrame.hSplitDividerLocation", 220); |
191 |
pack(); |
hSplitPane.setDividerLocation(i); |
192 |
|
|
193 |
String s = FantasiaPrefs.getWindowLocation(); |
setSavedSize(); |
194 |
|
|
195 |
try { |
guiTimer.start(); |
196 |
if(s == null) { |
} |
197 |
setDefaultLocation(); |
|
198 |
} else { |
private JPanel |
199 |
int i = s.indexOf(','); |
createRightPane() { |
200 |
int x = Integer.parseInt(s.substring(0, i)); |
JPanel p = new FantasiaPanel(); |
201 |
|
p.setOpaque(false); |
202 |
s = s.substring(i + 1); |
|
203 |
int y = Integer.parseInt(s); |
GridBagLayout gridbag = new GridBagLayout(); |
204 |
|
GridBagConstraints c = new GridBagConstraints(); |
205 |
setLocation(x, y); |
|
206 |
} |
p.setLayout(gridbag); |
207 |
} catch(Exception x) { |
|
208 |
String msg = "Parsing of window size and location string failed"; |
c.fill = GridBagConstraints.BOTH; |
209 |
CC.getLogger().log(Level.INFO, msg, x); |
|
210 |
setDefaultLocation(); |
c.gridx = 1; |
211 |
|
c.gridy = 0; |
212 |
|
c.weightx = 1.0; |
213 |
|
c.weighty = 1.0; |
214 |
|
c.insets = new Insets(0, 3, 0, 0); |
215 |
|
gridbag.setConstraints(rightSidePane, c); |
216 |
|
p.add(rightSidePane); |
217 |
|
|
218 |
|
c.gridx = 0; |
219 |
|
c.gridy = 0; |
220 |
|
c.weightx = 0.0; |
221 |
|
c.weighty = 1.0; |
222 |
|
c.insets = new Insets(0, 0, 0, 3); |
223 |
|
c.fill = GridBagConstraints.VERTICAL; |
224 |
|
gridbag.setConstraints(mainPane, c); |
225 |
|
p.add(mainPane); |
226 |
|
|
227 |
|
return p; |
228 |
|
} |
229 |
|
|
230 |
|
private void |
231 |
|
setSavedSize() { |
232 |
|
Rectangle r = StdUtils.getWindowBounds("MainFrame"); |
233 |
|
if(r == null) { |
234 |
|
setDefaultSizeAndLocation(); |
235 |
|
return; |
236 |
} |
} |
237 |
|
|
238 |
|
setBounds(r); |
239 |
} |
} |
240 |
|
|
241 |
private void |
private void |
242 |
setDefaultLocation() { |
setDefaultSizeAndLocation() { |
243 |
Dimension d = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); |
setPreferredSize(new Dimension(900, 600)); |
244 |
setLocation((d.width - TITLE_BAR_WIDTH) / 2, (d.height - TITLE_BAR_HEIGHT) / 2); |
pack(); |
245 |
|
setLocationRelativeTo(null); |
246 |
} |
} |
247 |
|
|
248 |
|
|
249 |
/** Invoked when this window is about to close. */ |
/** Invoked when this window is about to close. */ |
250 |
|
@Override |
251 |
protected void |
protected void |
252 |
onWindowClose() { |
onWindowClose() { |
253 |
FantasiaPrefs.setAlwaysOnTop(isAlwaysOnTop()); |
boolean b = preferences().getBoolProperty(CONFIRM_APP_QUIT); |
254 |
|
if(b && CC.getSamplerModel().isModified()) { |
255 |
|
JSQuitDlg dlg = new JSQuitDlg(Res.iconQuestion32); |
256 |
|
dlg.setVisible(true); |
257 |
|
if(dlg.isCancelled()) return; |
258 |
|
} |
259 |
|
|
260 |
|
leftSidePane.savePreferences(); |
261 |
|
rightSidePane.savePreferences(); |
262 |
|
|
263 |
java.awt.Point p = getLocation(); |
int i = hSplitPane.getDividerLocation(); |
264 |
Dimension d = getSize(); |
preferences().setIntProperty("MainFrame.hSplitDividerLocation", i); |
265 |
StringBuffer sb = new StringBuffer(); |
|
266 |
sb.append(p.x).append(',').append(p.y + getSize().height - TITLE_BAR_HEIGHT); |
preferences().setBoolProperty ( |
267 |
FantasiaPrefs.setWindowLocation(sb.toString()); |
"MainFrame.windowMaximized", |
268 |
|
(getExtendedState() & MAXIMIZED_BOTH) == MAXIMIZED_BOTH |
269 |
|
); |
270 |
|
|
271 |
|
if(preferences().getBoolProperty("MainFrame.windowMaximized")) { |
272 |
|
super.onWindowClose(); |
273 |
|
return; |
274 |
|
} |
275 |
|
|
276 |
|
StdUtils.saveWindowBounds("MainFrame", getBounds()); |
277 |
|
|
278 |
|
String[] list = recentScripts.toArray(new String[recentScripts.size()]); |
279 |
|
preferences().setStringListProperty(RECENT_LSCP_SCRIPTS, list); |
280 |
|
|
281 |
|
if(preferences().getBoolProperty(SAVE_LS_CONSOLE_HISTORY)) { |
282 |
|
if(lsConsoleFrame != null) getLSConsolePane().saveConsoleHistory(); |
283 |
|
} |
284 |
|
|
285 |
|
if(getBackendLogFrame() != null) getBackendLogFrame().stopTimer(); |
286 |
|
if(getLSConsolePane() != null) getLSConsolePane().disconnect(); |
287 |
|
|
288 |
super.onWindowClose(); |
super.onWindowClose(); |
289 |
} |
} |
290 |
|
|
291 |
private JPanel |
@Override |
292 |
createVSeparator() { |
public void |
293 |
JPanel p = new JPanel(); |
setVisible(boolean b) { |
294 |
p.setName("VSeparator"); |
if(b == isVisible()) return; |
295 |
p.setOpaque(false); |
|
296 |
p.setPreferredSize(new Dimension(2, 29)); |
super.setVisible(b); |
297 |
p.setMinimumSize(p.getPreferredSize()); |
|
298 |
p.setMaximumSize(p.getPreferredSize()); |
if(b && preferences().getBoolProperty("MainFrame.windowMaximized")) { |
299 |
return p; |
setExtendedState(getExtendedState() | MAXIMIZED_BOTH); |
300 |
|
} |
301 |
} |
} |
302 |
|
|
303 |
|
private void |
304 |
|
addMenu() { |
305 |
|
JMenu m; |
306 |
|
JMenuItem mi; |
307 |
|
|
308 |
|
setJMenuBar(menuBar); |
309 |
|
|
310 |
|
// Actions |
311 |
|
m = new FantasiaMenu(i18n.getMenuLabel("actions")); |
312 |
|
|
313 |
|
mi = new JMenuItem(a4n.refresh); |
314 |
|
mi.setIcon(null); |
315 |
|
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); |
316 |
|
m.add(mi); |
317 |
|
|
318 |
|
mi = new JMenuItem(a4n.samplerInfo); |
319 |
|
mi.setIcon(null); |
320 |
|
m.add(mi); |
321 |
|
|
322 |
|
mi = new JMenuItem(a4n.resetSampler); |
323 |
|
mi.setIcon(null); |
324 |
|
m.add(mi); |
325 |
|
|
326 |
|
m.addSeparator(); |
327 |
|
|
328 |
|
JMenu exportMenu = new JMenu(i18n.getMenuLabel("actions.export")); |
329 |
|
m.add(exportMenu); |
330 |
|
|
331 |
|
mi = new JMenuItem(a4n.exportSamplerConfig); |
332 |
|
mi.setIcon(null); |
333 |
|
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK)); |
334 |
|
exportMenu.add(mi); |
335 |
|
|
336 |
|
mi = new JMenuItem(a4n.exportMidiInstrumentMaps); |
337 |
|
mi.setIcon(null); |
338 |
|
exportMenu.add(mi); |
339 |
|
|
340 |
|
m.addSeparator(); |
341 |
|
|
342 |
|
mi = new JMenuItem(a4n.loadScript); |
343 |
|
mi.setIcon(null); |
344 |
|
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_MASK)); |
345 |
|
m.add(mi); |
346 |
|
|
347 |
|
String[] list = preferences().getStringListProperty(RECENT_LSCP_SCRIPTS); |
348 |
|
for(String s : list) recentScripts.add(s); |
349 |
|
|
350 |
|
updateRecentScriptsMenu(); |
351 |
|
|
352 |
|
m.add(recentScriptsMenu); |
353 |
|
|
354 |
|
m.addSeparator(); |
355 |
|
|
356 |
|
mi = new JMenuItem(a4n.changeBackend); |
357 |
|
mi.setIcon(null); |
358 |
|
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_MASK)); |
359 |
|
m.add(mi); |
360 |
|
|
361 |
|
m.addSeparator(); |
362 |
|
|
363 |
|
mi = new JMenuItem(i18n.getMenuLabel("actions.exit")); |
364 |
|
m.add(mi); |
365 |
|
mi.addActionListener(new ActionListener() { |
366 |
|
public void |
367 |
|
actionPerformed(ActionEvent e) { onWindowClose(); } |
368 |
|
}); |
369 |
|
|
370 |
|
menuBar.add(m); |
371 |
|
|
372 |
|
|
373 |
|
// Edit |
374 |
|
m = new FantasiaMenu(i18n.getMenuLabel("edit")); |
375 |
|
menuBar.add(m); |
376 |
|
|
377 |
|
mi = new JMenuItem(i18n.getMenuLabel("edit.addChannel")); |
378 |
|
m.add(mi); |
379 |
|
mi.addActionListener(new ActionListener() { |
380 |
|
public void |
381 |
|
actionPerformed(ActionEvent e) { |
382 |
|
CC.getSamplerModel().addBackendChannel(); |
383 |
|
} |
384 |
|
}); |
385 |
|
|
386 |
|
m.addSeparator(); |
387 |
|
|
388 |
|
mi = new JMenuItem(a4n.createMidiDevice); |
389 |
|
mi.setIcon(null); |
390 |
|
m.add(mi); |
391 |
|
|
392 |
|
mi = new JMenuItem(a4n.createAudioDevice); |
393 |
|
mi.setIcon(null); |
394 |
|
m.add(mi); |
395 |
|
|
396 |
|
m.addSeparator(); |
397 |
|
|
398 |
|
mi = new JMenuItem(a4n.editPreferences); |
399 |
|
mi.setIcon(null); |
400 |
|
mi.setAccelerator(KeyStroke.getKeyStroke ( |
401 |
|
KeyEvent.VK_P, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK |
402 |
|
)); |
403 |
|
m.add(mi); |
404 |
|
|
405 |
|
// View |
406 |
|
m = new FantasiaMenu(i18n.getMenuLabel("view")); |
407 |
|
menuBar.add(m); |
408 |
|
|
409 |
|
m.add(cbmiToolBarVisible); |
410 |
|
|
411 |
|
cbmiToolBarVisible.addActionListener(new ActionListener() { |
412 |
|
public void |
413 |
|
actionPerformed(ActionEvent e) { |
414 |
|
showToolBar(cbmiToolBarVisible.getState()); |
415 |
|
} |
416 |
|
}); |
417 |
|
|
418 |
|
boolean b = preferences().getBoolProperty("toolBar.visible"); |
419 |
|
cbmiToolBarVisible.setSelected(b); |
420 |
|
showToolBar(b); |
421 |
|
|
422 |
|
cbmiLeftSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( |
423 |
|
KeyEvent.VK_L, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK |
424 |
|
)); |
425 |
|
m.add(cbmiLeftSidePaneVisible); |
426 |
|
|
427 |
|
cbmiLeftSidePaneVisible.addActionListener(new ActionListener() { |
428 |
|
public void |
429 |
|
actionPerformed(ActionEvent e) { |
430 |
|
showSidePane(cbmiLeftSidePaneVisible.getState()); |
431 |
|
} |
432 |
|
}); |
433 |
|
|
434 |
|
b = preferences().getBoolProperty("leftSidePane.visible"); |
435 |
|
cbmiLeftSidePaneVisible.setSelected(b); |
436 |
|
showSidePane(b); |
437 |
|
|
438 |
|
cbmiRightSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( |
439 |
|
KeyEvent.VK_R, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK |
440 |
|
)); |
441 |
|
m.add(cbmiRightSidePaneVisible); |
442 |
|
|
443 |
|
cbmiRightSidePaneVisible.addActionListener(new ActionListener() { |
444 |
|
public void |
445 |
|
actionPerformed(ActionEvent e) { |
446 |
|
showDevicesPane(cbmiRightSidePaneVisible.getState()); |
447 |
|
} |
448 |
|
}); |
449 |
|
|
450 |
|
b = preferences().getBoolProperty("rightSidePane.visible"); |
451 |
|
cbmiRightSidePaneVisible.setSelected(b); |
452 |
|
showDevicesPane(b); |
453 |
|
|
454 |
|
m.addSeparator(); |
455 |
|
|
456 |
|
m.add(cbmiMidiKeyboardVisible); |
457 |
|
|
458 |
|
cbmiMidiKeyboardVisible.addActionListener(new ActionListener() { |
459 |
|
public void |
460 |
|
actionPerformed(ActionEvent e) { |
461 |
|
setMidiKeyboardVisible(cbmiMidiKeyboardVisible.getState()); |
462 |
|
} |
463 |
|
}); |
464 |
|
|
465 |
|
b = preferences().getBoolProperty("midiKeyboard.visible"); |
466 |
|
cbmiMidiKeyboardVisible.setSelected(b); |
467 |
|
setMidiKeyboardVisible(b); |
468 |
|
|
469 |
|
|
470 |
|
// Window |
471 |
|
m = new FantasiaMenu(i18n.getMenuLabel("window")); |
472 |
|
menuBar.add(m); |
473 |
|
|
474 |
|
mi = new JMenuItem(a4n.windowLSConsole); |
475 |
|
mi.setIcon(null); |
476 |
|
m.add(mi); |
477 |
|
|
478 |
|
mi = new JMenuItem(a4n.windowInstrumentsDb); |
479 |
|
mi.setIcon(null); |
480 |
|
m.add(mi); |
481 |
|
|
482 |
|
m.addSeparator(); |
483 |
|
|
484 |
|
final JMenuItem mi2 = new JMenuItem(i18n.getMenuLabel("window.backendLog")); |
485 |
|
m.add(mi2); |
486 |
|
mi2.addActionListener(new ActionListener() { |
487 |
|
public void |
488 |
|
actionPerformed(ActionEvent e) { |
489 |
|
if(getBackendLogFrame().isVisible()) { |
490 |
|
getBackendLogFrame().setVisible(false); |
491 |
|
} |
492 |
|
|
493 |
|
getBackendLogFrame().setVisible(true); |
494 |
|
} |
495 |
|
}); |
496 |
|
|
497 |
|
mi2.setEnabled(CC.getBackendProcess() != null); |
498 |
|
|
499 |
|
CC.addBackendProcessListener(new ActionListener() { |
500 |
|
public void |
501 |
|
actionPerformed(ActionEvent e) { |
502 |
|
mi2.setEnabled(CC.getBackendProcess() != null); |
503 |
|
} |
504 |
|
}); |
505 |
|
|
506 |
|
|
507 |
|
// Help |
508 |
|
m = new FantasiaMenu(i18n.getMenuLabel("help")); |
509 |
|
|
510 |
|
mi = new JMenuItem(a4n.browseOnlineTutorial); |
511 |
|
mi.setIcon(null); |
512 |
|
m.add(mi); |
513 |
|
|
514 |
|
m.addSeparator(); |
515 |
|
|
516 |
|
mi = new JMenuItem(a4n.helpAbout); |
517 |
|
mi.setIcon(null); |
518 |
|
m.add(mi); |
519 |
|
|
520 |
|
menuBar.add(m); |
521 |
|
} |
522 |
|
|
523 |
|
public RightSidePane |
524 |
|
getRightSidePane() { return rightSidePane; } |
525 |
|
|
526 |
/** |
/** |
527 |
* This method does nothing, because <b>Fantasia</b> has exactly |
* This method does nothing, because <b>Fantasia</b> has constant |
528 |
* one pane containing sampler channels, which can not be changed. |
* number of panes containing sampler channels, which can not be changed. |
529 |
*/ |
*/ |
530 |
|
@Override |
531 |
public void |
public void |
532 |
insertChannelsPane(JSChannelsPane pane, int idx) { |
insertChannelsPane(JSChannelsPane pane, int idx) { |
533 |
getChannelsPaneList().removeAllElements(); |
|
534 |
addChannelsPane(pane); |
} |
535 |
|
|
536 |
|
@Override |
537 |
|
public JSChannelsPane |
538 |
|
getSelectedChannelsPane() { return mainPane.getSelectedChannelsPane(); } |
539 |
|
|
540 |
|
@Override |
541 |
|
public void |
542 |
|
setSelectedChannelsPane(JSChannelsPane pane) { |
543 |
|
mainPane.setSelectedChannelsPane(pane); |
544 |
|
fireChannelsPaneSelectionChanged(); |
545 |
|
} |
546 |
|
|
547 |
|
@Override |
548 |
|
public void |
549 |
|
installJSamplerHome() { |
550 |
|
JSamplerHomeChooser chooser = new JSamplerHomeChooser(this); |
551 |
|
chooser.setVisible(true); |
552 |
|
if(chooser.isCancelled()) return; |
553 |
|
|
554 |
|
CC.changeJSamplerHome(chooser.getJSamplerHome()); |
555 |
|
} |
556 |
|
|
557 |
|
@Override |
558 |
|
public void |
559 |
|
showDetailedErrorMessage(Frame owner, String err, String details) { |
560 |
|
JSDetailedErrorDlg dlg = new JSDetailedErrorDlg ( |
561 |
|
owner, Res.iconWarning32, i18n.getError("error"), err, details |
562 |
|
); |
563 |
|
dlg.setVisible(true); |
564 |
|
} |
565 |
|
|
566 |
|
@Override |
567 |
|
public void |
568 |
|
showDetailedErrorMessage(Dialog owner, String err, String details) { |
569 |
|
JSDetailedErrorDlg dlg = new JSDetailedErrorDlg ( |
570 |
|
owner, Res.iconWarning32, i18n.getError("error"), err, details |
571 |
|
); |
572 |
|
dlg.setVisible(true); |
573 |
} |
} |
574 |
|
|
575 |
/** |
/** |
576 |
* This method always returns the <code>JSChannelsPane</code> at index 0, |
* Gets the server address to which to connect. If the server should be |
577 |
* because the <b>Fantasia</b> view has exactly one pane containing sampler channels. |
* manually selected, a dialog asking the user to choose a server is displayed. |
|
* @return The <code>JSChannelsPane</code> at index 0. |
|
578 |
*/ |
*/ |
579 |
public JSChannelsPane |
@Override |
580 |
getSelectedChannelsPane() { return getChannelsPane(0); } |
public Server |
581 |
|
getServer() { |
582 |
|
boolean b = preferences().getBoolProperty(MANUAL_SERVER_SELECT_ON_STARTUP); |
583 |
|
return getServer(b); |
584 |
|
} |
585 |
|
|
586 |
/** |
/** |
587 |
* This method does nothing because the <b>Fantasia</b> view has |
* Gets the server address to which to connect. If the server should be |
588 |
* exactly one pane containing sampler channels which is always shown. |
* manually selected, a dialog asking the user to choose a server is displayed. |
589 |
|
* @param manualSelect Determines whether the server should be manually selected. |
590 |
*/ |
*/ |
591 |
|
@Override |
592 |
|
public Server |
593 |
|
getServer(boolean manualSelect) { |
594 |
|
if(manualSelect) { |
595 |
|
JSConnectDlg dlg = new JSConnectDlg(); |
596 |
|
dlg.setVisible(true); |
597 |
|
|
598 |
|
return dlg.getSelectedServer(); |
599 |
|
} |
600 |
|
|
601 |
|
int i = preferences().getIntProperty(SERVER_INDEX); |
602 |
|
int size = CC.getServerList().getServerCount(); |
603 |
|
if(size == 0) return null; |
604 |
|
if(i >= size) return CC.getServerList().getServer(0); |
605 |
|
|
606 |
|
return CC.getServerList().getServer(i); |
607 |
|
} |
608 |
|
|
609 |
|
public Timer |
610 |
|
getGuiTimer() { return guiTimer; } |
611 |
|
|
612 |
|
protected LSConsoleModel |
613 |
|
getLSConsoleModel() { return getLSConsolePane().getModel(); } |
614 |
|
|
615 |
|
protected LSConsolePane |
616 |
|
getLSConsolePane() { |
617 |
|
return getLSConsoleFrame().getLSConsolePane(); |
618 |
|
} |
619 |
|
|
620 |
|
protected LSConsoleFrame |
621 |
|
getLSConsoleFrame() { return lsConsoleFrame; } |
622 |
|
|
623 |
|
public JSBackendLogFrame |
624 |
|
getBackendLogFrame() { return backendLogFrame; } |
625 |
|
|
626 |
|
protected boolean |
627 |
|
runScript() { |
628 |
|
String s = preferences().getStringProperty("lastScriptLocation"); |
629 |
|
JFileChooser fc = new JFileChooser(s); |
630 |
|
fc.setFileFilter(new LscpFileFilter()); |
631 |
|
int result = fc.showOpenDialog(this); |
632 |
|
if(result != JFileChooser.APPROVE_OPTION) return false; |
633 |
|
|
634 |
|
String path = fc.getCurrentDirectory().getAbsolutePath(); |
635 |
|
preferences().setStringProperty("lastScriptLocation", path); |
636 |
|
|
637 |
|
runScript(fc.getSelectedFile()); |
638 |
|
|
639 |
|
return true; |
640 |
|
} |
641 |
|
|
642 |
|
@Override |
643 |
public void |
public void |
644 |
setSelectedChannelsPane(JSChannelsPane pane) { } |
runScript(String script) { runScript(new File(script)); } |
645 |
|
|
646 |
|
private void |
647 |
|
runScript(File script) { |
648 |
|
FileReader fr; |
649 |
|
try { fr = new FileReader(script); } |
650 |
|
catch(FileNotFoundException e) { |
651 |
|
HF.showErrorMessage(i18n.getMessage("FileNotFound!")); |
652 |
|
return; |
653 |
|
} |
654 |
|
|
655 |
|
BufferedReader br = new BufferedReader(fr); |
656 |
|
|
657 |
|
try { |
658 |
|
String s = br.readLine(); |
659 |
|
while(s != null) { |
660 |
|
getLSConsoleModel().setCommandLineText(s); |
661 |
|
getLSConsoleModel().execCommand(); |
662 |
|
s = br.readLine(); |
663 |
|
} |
664 |
|
} catch(Exception e) { |
665 |
|
HF.showErrorMessage(e); |
666 |
|
return; |
667 |
|
} |
668 |
|
|
669 |
|
String s = script.getAbsolutePath(); |
670 |
|
recentScripts.remove(s); |
671 |
|
recentScripts.insertElementAt(s, 0); |
672 |
|
|
673 |
|
updateRecentScriptsMenu(); |
674 |
|
} |
675 |
|
|
676 |
public static void |
protected void |
677 |
repack(JSMainFrame frame) { |
clearRecentScripts() { |
678 |
int y = frame.getLocation().y; |
recentScripts.removeAllElements(); |
679 |
int height = frame.getSize().height; |
updateRecentScriptsMenu(); |
680 |
y += (height - frame.getPreferredSize().height); |
} |
681 |
|
|
682 |
if((height - frame.getPreferredSize().height) > 0) { |
protected void |
683 |
frame.pack(); |
updateRecentScriptsMenu() { |
684 |
frame.setLocation(frame.getLocation().x, y); |
int size = preferences().getIntProperty(RECENT_LSCP_SCRIPTS_SIZE); |
685 |
|
while(recentScripts.size() > size) { |
686 |
|
recentScripts.removeElementAt(recentScripts.size() - 1); |
687 |
|
} |
688 |
|
|
689 |
|
recentScriptsMenu.removeAll(); |
690 |
|
|
691 |
|
for(String script : recentScripts) { |
692 |
|
JMenuItem mi = new JMenuItem(script); |
693 |
|
recentScriptsMenu.add(mi); |
694 |
|
mi.addActionListener(new RecentScriptHandler(script)); |
695 |
|
} |
696 |
|
|
697 |
|
recentScriptsMenu.setEnabled(recentScripts.size() != 0); |
698 |
|
} |
699 |
|
|
700 |
|
private void |
701 |
|
showToolBar(boolean b) { |
702 |
|
preferences().setBoolProperty("toolBar.visible", b); |
703 |
|
standardBar.setVisible(b); |
704 |
|
} |
705 |
|
|
706 |
|
private void |
707 |
|
showSidePane(boolean b) { |
708 |
|
preferences().setBoolProperty("leftSidePane.visible", b); |
709 |
|
rootPane.remove(rightPane); |
710 |
|
rootPane.remove(hSplitPane); |
711 |
|
|
712 |
|
if(b) { |
713 |
|
hSplitPane.setRightComponent(rightPane); |
714 |
|
rootPane.add(hSplitPane); |
715 |
|
int i = preferences().getIntProperty("MainFrame.hSplitDividerLocation", 220); |
716 |
|
|
717 |
|
hSplitPane.setDividerLocation(i); |
718 |
|
hSplitPane.validate(); |
719 |
} else { |
} else { |
720 |
frame.setLocation(frame.getLocation().x, y); |
rootPane.add(rightPane); |
721 |
frame.pack(); |
|
722 |
} |
} |
723 |
|
|
724 |
|
int w = getPreferredSize().width; |
725 |
|
int h = getSize().height; |
726 |
|
setSize(new Dimension(w, h)); |
727 |
|
|
728 |
|
rootPane.revalidate(); |
729 |
|
rootPane.validate(); |
730 |
|
rootPane.repaint(); |
731 |
|
|
732 |
|
SwingUtilities.invokeLater(new Runnable() { |
733 |
|
public void |
734 |
|
run() { sidePanesVisibilityChanged(); } |
735 |
|
}); |
736 |
} |
} |
737 |
|
|
738 |
public void |
private void |
739 |
installJSamplerHome() { } |
showDevicesPane(boolean b) { |
740 |
|
preferences().setBoolProperty("rightSidePane.visible", b); |
741 |
|
|
742 |
|
int width = leftSidePane.getWidth(); |
743 |
|
int height = leftSidePane.getPreferredSize().height; |
744 |
|
if(width != 0) leftSidePane.setPreferredSize(new Dimension(width, height)); |
745 |
|
|
746 |
|
if(b) { |
747 |
|
int w = preferences().getIntProperty("devicesPane.width", 200); |
748 |
|
|
749 |
|
int h = rightSidePane.getPreferredSize().height; |
750 |
|
rightSidePane.setPreferredSize(new Dimension(w, h)); |
751 |
|
} else { |
752 |
|
int w = rightSidePane.getWidth(); |
753 |
|
if(w > 0 && w < 200) w = 200; |
754 |
|
if(w != 0) preferences().setIntProperty("devicesPane.width", w); |
755 |
|
} |
756 |
|
|
757 |
|
hSplitPane.setResizeWeight(0.0); |
758 |
|
rightSidePane.setVisible(b); |
759 |
|
hSplitPane.resetToPreferredSizes(); |
760 |
|
|
761 |
|
int w = getPreferredSize().width; |
762 |
|
int h = getSize().height; |
763 |
|
setSize(new Dimension(w, h)); |
764 |
|
|
765 |
|
rootPane.validate(); |
766 |
|
rootPane.repaint(); |
767 |
|
//hSplitPane.validate(); |
768 |
|
|
769 |
|
SwingUtilities.invokeLater(new Runnable() { |
770 |
|
public void |
771 |
|
run() { sidePanesVisibilityChanged(); } |
772 |
|
}); |
773 |
|
} |
774 |
|
|
775 |
public void |
public void |
776 |
showDetailedErrorMessage(Frame owner, String err, String details) { |
setMidiKeyboardVisible(boolean b) { |
777 |
// TODO: |
preferences().setBoolProperty("midiKeyboard.visible", b); |
778 |
|
pianoKeyboardPane.setVisible(b); |
779 |
|
|
780 |
|
if(cbmiMidiKeyboardVisible.isSelected() != b) { |
781 |
|
cbmiMidiKeyboardVisible.setSelected(b); |
782 |
|
} |
783 |
|
|
784 |
|
if(standardBar.btnMidiKeyboard.isSelected() != b) { |
785 |
|
standardBar.btnMidiKeyboard.setSelected(b); |
786 |
|
} |
787 |
|
|
788 |
|
if(pianoKeyboardPane.btnPower.isSelected() != b) { |
789 |
|
pianoKeyboardPane.btnPower.setSelected(b); |
790 |
|
} |
791 |
|
|
792 |
|
rootPane.validate(); |
793 |
|
rootPane.repaint(); |
794 |
} |
} |
795 |
|
|
796 |
public void |
public void |
797 |
showDetailedErrorMessage(Dialog owner, String err, String details) { |
setMidiKeyboardHeight(int height) { |
798 |
// TODO: |
Dimension d = pianoKeyboardPane.getPreferredSize(); |
799 |
|
d = new Dimension(d.width, height); |
800 |
|
pianoKeyboardPane.setPreferredSize(d); |
801 |
|
pianoKeyboardPane.setMinimumSize(d); |
802 |
|
pianoKeyboardPane.revalidate(); |
803 |
|
pianoKeyboardPane.repaint(); |
804 |
} |
} |
|
} |
|
|
|
|
|
class FantasiaTitleBar extends TitleBar { |
|
|
FantasiaTitleBar() { this.addMouseListener(new ContextMenu()); } |
|
805 |
|
|
806 |
class ContextMenu extends MouseAdapter { |
private void |
807 |
private final JPopupMenu cmenu = new JPopupMenu(); |
sidePanesVisibilityChanged() { |
808 |
|
boolean leftSidePaneVisible = cbmiLeftSidePaneVisible.isSelected(); |
809 |
|
boolean rightSidePaneVisible = cbmiRightSidePaneVisible.isSelected(); |
810 |
|
|
811 |
|
if(leftSidePaneVisible && rightSidePaneVisible) { |
812 |
|
hSplitPane.setResizeWeight(0.5); |
813 |
|
} else if(leftSidePaneVisible && !rightSidePaneVisible) { |
814 |
|
hSplitPane.setResizeWeight(1.0); |
815 |
|
} |
816 |
|
|
817 |
ContextMenu() { |
if(!leftSidePaneVisible && !rightSidePaneVisible) { |
818 |
JMenuItem mi; |
standardBar.showFantasiaLogo(false); |
819 |
|
if(isResizable()) setResizable(false); |
820 |
|
} else { |
821 |
|
standardBar.showFantasiaLogo(true); |
822 |
|
if(!isResizable()) setResizable(true); |
823 |
|
} |
824 |
|
} |
825 |
|
|
826 |
|
private class RecentScriptHandler implements ActionListener { |
827 |
|
private String script; |
828 |
|
|
829 |
|
RecentScriptHandler(String script) { this.script = script; } |
830 |
|
|
831 |
|
@Override |
832 |
|
public void |
833 |
|
actionPerformed(ActionEvent e) { |
834 |
|
runScript(script); |
835 |
|
if(preferences().getBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT)) { |
836 |
|
a4n.windowLSConsole.actionPerformed(null); |
837 |
|
} |
838 |
|
} |
839 |
|
} |
840 |
|
|
841 |
|
private static class FantasiaMenu extends JMenu { |
842 |
|
FantasiaMenu(String s) { |
843 |
|
super(s); |
844 |
|
setFont(getFont().deriveFont(java.awt.Font.BOLD)); |
845 |
|
setOpaque(false); |
846 |
|
setContentAreaFilled(false); |
847 |
|
} |
848 |
|
} |
849 |
|
|
850 |
|
private class FantasiaMenuBar extends JMenuBar { |
851 |
|
FantasiaMenuBar() { |
852 |
|
setOpaque(false); |
853 |
|
setBorder(BorderFactory.createEmptyBorder(2, 6, 0, 0)); |
854 |
|
} |
855 |
|
|
856 |
|
@Override |
857 |
|
protected void |
858 |
|
paintComponent(Graphics g) { |
859 |
|
//super.paintComponent(g); |
860 |
|
Graphics2D g2 = (Graphics2D)g; |
861 |
|
|
862 |
final JCheckBoxMenuItem cmi = new JCheckBoxMenuItem ( |
Paint oldPaint = g2.getPaint(); |
863 |
i18n.getMenuLabel("FantasiaTitleBar.AlwaysOnTop") |
Composite oldComposite = g2.getComposite(); |
864 |
); |
|
865 |
cmi.setIcon(null); |
double h = getSize().getHeight(); |
866 |
cmi.setSelected(FantasiaPrefs.isAlwaysOnTop()); |
double w = getSize().getWidth(); |
867 |
|
|
868 |
cmenu.add(cmi); |
FantasiaPainter.paintGradient(g2, 0.0, 0.0, w - 1, h - 1, FantasiaPainter.color6, FantasiaPainter.color5); |
|
|
|
|
cmi.addActionListener(new ActionListener() { |
|
|
public void |
|
|
actionPerformed(ActionEvent e) { |
|
|
CC.getMainFrame().setAlwaysOnTop(cmi.isSelected()); |
|
|
} |
|
|
}); |
|
869 |
|
|
870 |
/*mi = new JMenuItem(A4n.moveChannelsUp); |
FantasiaPainter.Border b; |
|
mi.setIcon(null); |
|
|
cmenu.add(mi); |
|
871 |
|
|
|
cmenu.addSeparator(); |
|
872 |
|
|
873 |
mi = new JMenuItem(A4n.removeChannels); |
if(standardBar.isVisible()) { |
874 |
mi.setIcon(null); |
b = new FantasiaPainter.Border(true, true, false, true); |
875 |
cmenu.add(mi);*/ |
FantasiaPainter.paintBoldOuterBorder(g2, 0, 0, w - 1, h + 1, b); |
876 |
|
} else { |
877 |
|
b = new FantasiaPainter.Border(true, true, true, true); |
878 |
|
FantasiaPainter.paintBoldOuterBorder(g2, 0, 0, w - 1, h - 1, b); |
879 |
|
} |
880 |
|
|
881 |
|
g2.setPaint(oldPaint); |
882 |
|
g2.setComposite(oldComposite); |
883 |
} |
} |
884 |
|
} |
885 |
|
|
886 |
|
class RootPane extends FantasiaSubPanel { |
887 |
|
private final Color color1 = new Color(0x454545); |
888 |
|
private final Color color2 = new Color(0x2e2e2e); |
889 |
|
|
890 |
|
RootPane() { |
891 |
|
setLayout(new BorderLayout()); |
892 |
|
setBorder(BorderFactory.createEmptyBorder(9, 10, 6, 10)); |
893 |
|
setOpaque(false); |
894 |
|
|
|
public void |
|
|
mousePressed(MouseEvent e) { |
|
|
if(e.isPopupTrigger()) show(e); |
|
895 |
} |
} |
896 |
|
|
897 |
|
@Override |
898 |
public void |
public void |
899 |
mouseReleased(MouseEvent e) { |
paintComponent(Graphics g) { |
900 |
if(e.isPopupTrigger()) show(e); |
Graphics2D g2 = (Graphics2D)g; |
901 |
|
|
902 |
|
Paint oldPaint = g2.getPaint(); |
903 |
|
Composite oldComposite = g2.getComposite(); |
904 |
|
|
905 |
|
double h = getSize().getHeight(); |
906 |
|
double w = getSize().getWidth(); |
907 |
|
|
908 |
|
FantasiaPainter.paintBorder(g2, 0, -3, w - 1, h - 1, 6, false); |
909 |
|
paintComponent(g2, 5, 1, w - 10, h - 6, color1, color2); |
910 |
|
|
911 |
|
g2.setPaint(oldPaint); |
912 |
|
g2.setComposite(oldComposite); |
913 |
} |
} |
914 |
|
} |
915 |
|
|
916 |
void |
class BottomPane extends FantasiaPanel { |
917 |
show(MouseEvent e) { |
BottomPane() { |
918 |
cmenu.show(e.getComponent(), e.getX(), e.getY()); |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
919 |
|
setOpaque(false); |
920 |
|
add(pianoKeyboardPane); |
921 |
|
|
922 |
} |
} |
923 |
} |
} |
924 |
} |
} |