1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com> |
* Copyright (C) 2005-2009 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.Graphics; |
import java.awt.Graphics; |
32 |
|
import java.awt.Graphics2D; |
33 |
import java.awt.GridBagConstraints; |
import java.awt.GridBagConstraints; |
34 |
import java.awt.GridBagLayout; |
import java.awt.GridBagLayout; |
35 |
import java.awt.Insets; |
import java.awt.Insets; |
36 |
import java.awt.Point; |
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.KeyEvent; |
import java.awt.event.KeyEvent; |
42 |
import java.awt.event.MouseAdapter; |
|
43 |
import java.awt.event.MouseEvent; |
import java.beans.PropertyChangeEvent; |
44 |
|
import java.beans.PropertyChangeListener; |
45 |
|
|
46 |
import java.io.BufferedReader; |
import java.io.BufferedReader; |
47 |
import java.io.File; |
import java.io.File; |
49 |
import java.io.FileReader; |
import java.io.FileReader; |
50 |
|
|
51 |
import java.util.Vector; |
import java.util.Vector; |
|
import java.util.logging.Level; |
|
52 |
|
|
53 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
|
import javax.swing.Box; |
|
54 |
import javax.swing.BoxLayout; |
import javax.swing.BoxLayout; |
55 |
import javax.swing.JCheckBoxMenuItem; |
import javax.swing.JCheckBoxMenuItem; |
|
import javax.swing.JComponent; |
|
|
import javax.swing.JDialog; |
|
56 |
import javax.swing.JFileChooser; |
import javax.swing.JFileChooser; |
|
import javax.swing.JFrame; |
|
57 |
import javax.swing.JMenu; |
import javax.swing.JMenu; |
58 |
import javax.swing.JMenuBar; |
import javax.swing.JMenuBar; |
59 |
import javax.swing.JMenuItem; |
import javax.swing.JMenuItem; |
60 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
|
import javax.swing.JPopupMenu; |
|
|
import javax.swing.JScrollPane; |
|
61 |
import javax.swing.JSplitPane; |
import javax.swing.JSplitPane; |
|
import javax.swing.JToggleButton; |
|
62 |
import javax.swing.KeyStroke; |
import javax.swing.KeyStroke; |
63 |
import javax.swing.SwingUtilities; |
import javax.swing.SwingUtilities; |
64 |
import javax.swing.UIManager; |
import javax.swing.Timer; |
65 |
|
|
66 |
import net.sf.juife.TitleBar; |
import javax.swing.event.ListSelectionEvent; |
67 |
|
import javax.swing.event.ListSelectionListener; |
68 |
|
|
69 |
import org.jsampler.CC; |
import org.jsampler.CC; |
70 |
import org.jsampler.HF; |
import org.jsampler.HF; |
71 |
import org.jsampler.LSConsoleModel; |
import org.jsampler.LSConsoleModel; |
72 |
|
import org.jsampler.Server; |
73 |
|
|
|
import org.jsampler.view.JSChannel; |
|
74 |
import org.jsampler.view.JSChannelsPane; |
import org.jsampler.view.JSChannelsPane; |
|
import org.jsampler.view.JSMainFrame; |
|
75 |
import org.jsampler.view.LscpFileFilter; |
import org.jsampler.view.LscpFileFilter; |
76 |
|
import org.jsampler.view.SessionViewConfig; |
77 |
|
|
78 |
|
import org.jsampler.view.fantasia.basic.FantasiaPainter; |
79 |
|
import org.jsampler.view.fantasia.basic.FantasiaPanel; |
80 |
|
import org.jsampler.view.fantasia.basic.FantasiaSubPanel; |
81 |
|
|
82 |
|
import org.jsampler.view.std.JSBackendLogFrame; |
83 |
|
import org.jsampler.view.std.JSConnectDlg; |
84 |
import org.jsampler.view.std.JSDetailedErrorDlg; |
import org.jsampler.view.std.JSDetailedErrorDlg; |
85 |
|
import org.jsampler.view.std.JSQuitDlg; |
86 |
import org.jsampler.view.std.JSamplerHomeChooser; |
import org.jsampler.view.std.JSamplerHomeChooser; |
87 |
|
import org.jsampler.view.std.StdMainFrame; |
88 |
|
import org.jsampler.view.std.StdUtils; |
89 |
|
|
90 |
import static org.jsampler.view.fantasia.A4n.a4n; |
import static org.jsampler.view.fantasia.A4n.a4n; |
91 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
97 |
* |
* |
98 |
* @author Grigor Iliev |
* @author Grigor Iliev |
99 |
*/ |
*/ |
100 |
public class MainFrame extends JSMainFrame { |
public class MainFrame extends StdMainFrame { |
101 |
private final StandardBar standardBar = new StandardBar(); |
private final StandardBar standardBar = new StandardBar(); |
102 |
private final FantasiaMenuBar menuBar = new FantasiaMenuBar(); |
private final FantasiaMenuBar menuBar = new FantasiaMenuBar(); |
103 |
private final JPanel rootPane = new JPanel(); |
private final JPanel rootPane = new RootPane(); |
104 |
private final MainPane mainPane = new MainPane(); |
private final BottomPane bottomPane; |
105 |
private final DevicesPane devicesPane = new DevicesPane(); |
private final MainPane mainPane; |
106 |
private final JScrollPane spDevicesPane = new JScrollPane(); |
private final PianoKeyboardPane pianoKeyboardPane; |
107 |
|
|
108 |
private final JMenu recentScriptsMenu = |
private final JMenu recentScriptsMenu = |
109 |
new JMenu(i18n.getMenuLabel("actions.recentScripts")); |
new JMenu(i18n.getMenuLabel("actions.recentScripts")); |
110 |
|
|
111 |
private final JSplitPane hSplitPane; |
private final JSplitPane hSplitPane; |
112 |
|
|
113 |
private final SidePane sidePane = new SidePane(); |
private final LeftSidePane leftSidePane; |
114 |
|
private final RightSidePane rightSidePane; |
115 |
private final JPanel rightPane; |
private final JPanel rightPane; |
116 |
|
|
117 |
|
//private final StatusBar statusBar = new StatusBar(); |
118 |
|
|
119 |
private final LSConsoleFrame lsConsoleFrame = new LSConsoleFrame(); |
private final LSConsoleFrame lsConsoleFrame = new LSConsoleFrame(); |
120 |
private final Vector<String> recentScripts = new Vector<String>(); |
private final Vector<String> recentScripts = new Vector<String>(); |
121 |
|
|
122 |
|
private final JSBackendLogFrame backendLogFrame = new JSBackendLogFrame(); |
123 |
|
|
124 |
|
|
125 |
private final JCheckBoxMenuItem cbmiToolBarVisible = |
private final JCheckBoxMenuItem cbmiToolBarVisible = |
126 |
new JCheckBoxMenuItem(i18n.getMenuLabel("view.toolBar")); |
new JCheckBoxMenuItem(i18n.getMenuLabel("view.toolBar")); |
127 |
|
|
128 |
private final JCheckBoxMenuItem cbmiSidePaneVisible = |
private final JCheckBoxMenuItem cbmiLeftSidePaneVisible = |
129 |
new JCheckBoxMenuItem(i18n.getMenuLabel("view.sidePane")); |
new JCheckBoxMenuItem(i18n.getMenuLabel("view.leftSidePane")); |
130 |
|
|
131 |
|
private final JCheckBoxMenuItem cbmiRightSidePaneVisible = |
132 |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.rightSidePane")); |
133 |
|
|
134 |
|
private final JCheckBoxMenuItem cbmiMidiKeyboardVisible = |
135 |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.midiKeyboard")); |
136 |
|
|
137 |
private final JCheckBoxMenuItem cbmiDevicesPaneVisible = |
private final Timer guiTimer = new Timer(1000, null); |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.devicesPane")); |
|
138 |
|
|
139 |
/** Creates a new instance of <code>MainFrame</code> */ |
/** Creates a new instance of <code>MainFrame</code> */ |
140 |
public |
public |
141 |
MainFrame() { |
MainFrame() { |
142 |
setTitle(i18n.getLabel("MainFrame.title")); |
setTitle(i18n.getLabel("MainFrame.title")); |
143 |
|
//setUndecorated(true); |
144 |
if(Res.iconAppIcon != null) setIconImage(Res.iconAppIcon.getImage()); |
if(Res.iconAppIcon != null) setIconImage(Res.iconAppIcon.getImage()); |
145 |
|
|
146 |
|
CC.setMainFrame(this); // TODO: |
147 |
|
mainPane = new MainPane(); |
148 |
|
leftSidePane = new LeftSidePane(); |
149 |
|
rightSidePane = new RightSidePane(); |
150 |
|
|
151 |
|
setSelectedChannelsPane(mainPane.getChannelsPane(0)); |
152 |
|
|
153 |
getContentPane().add(standardBar, BorderLayout.NORTH); |
getContentPane().add(standardBar, BorderLayout.NORTH); |
154 |
|
|
155 |
rightPane = createRightPane(); |
rightPane = createRightPane(); |
157 |
hSplitPane = new JSplitPane ( |
hSplitPane = new JSplitPane ( |
158 |
JSplitPane.HORIZONTAL_SPLIT, |
JSplitPane.HORIZONTAL_SPLIT, |
159 |
true, // continuousLayout |
true, // continuousLayout |
160 |
sidePane, rightPane |
leftSidePane, rightPane |
161 |
); |
); |
162 |
hSplitPane.setResizeWeight(0.5); |
hSplitPane.setResizeWeight(0.5); |
163 |
|
|
164 |
rootPane.setLayout(new BorderLayout()); |
pianoKeyboardPane = new PianoKeyboardPane(); |
165 |
rootPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0)); |
|
166 |
rootPane.setOpaque(false); |
for(int i = 0; i < mainPane.getChannelsPaneCount(); i++) { |
167 |
|
addChannelsPane(mainPane.getChannelsPane(i)); |
168 |
|
getChannelsPane(i).addListSelectionListener(pianoKeyboardPane); |
169 |
|
} |
170 |
|
|
171 |
|
|
172 |
|
int h = preferences().getIntProperty("midiKeyboard.height"); |
173 |
|
setMidiKeyboardHeight(h); |
174 |
|
|
175 |
|
PropertyChangeListener l = new PropertyChangeListener() { |
176 |
|
public void |
177 |
|
propertyChange(PropertyChangeEvent e) { |
178 |
|
int h = preferences().getIntProperty("midiKeyboard.height"); |
179 |
|
setMidiKeyboardHeight(h); |
180 |
|
} |
181 |
|
}; |
182 |
|
|
183 |
|
CC.preferences().addPropertyChangeListener("midiKeyboard.height", l); |
184 |
|
|
185 |
|
bottomPane = new BottomPane(); |
186 |
|
|
187 |
|
hSplitPane.setOpaque(false); |
188 |
rootPane.add(hSplitPane); |
rootPane.add(hSplitPane); |
189 |
|
rootPane.add(bottomPane, BorderLayout.SOUTH); |
190 |
|
add(rootPane); |
191 |
|
|
192 |
|
if(CC.isMacOS()) { |
193 |
|
try { |
194 |
|
String s = "org.jsampler.view.fantasia.MacOSApplicationHandler"; |
195 |
|
Class.forName(s).newInstance(); } |
196 |
|
catch(Throwable e) { } |
197 |
|
} |
198 |
|
|
199 |
addMenu(); |
addMenu(); |
200 |
|
|
201 |
addChannelsPane(mainPane.getChannelsPane()); |
if(CC.getViewConfig().isUsingScreenMenuBar()) { |
202 |
|
// fix for moving the menu bar on top of the screen |
203 |
getContentPane().add(rootPane); |
// when running on Mac OS and third party plugin is used |
204 |
|
((ViewConfig)CC.getViewConfig()).restoreMenuProperties(); |
205 |
|
} |
206 |
|
|
207 |
int i = preferences().getIntProperty("MainFrame.hSplitDividerLocation", 220); |
int i = preferences().getIntProperty("MainFrame.hSplitDividerLocation", 220); |
208 |
hSplitPane.setDividerLocation(i); |
hSplitPane.setDividerLocation(i); |
209 |
|
|
210 |
setSavedSize(); |
setSavedSize(); |
211 |
|
|
212 |
|
guiTimer.start(); |
213 |
} |
} |
214 |
|
|
215 |
private JPanel |
private JPanel |
216 |
createRightPane() { |
createRightPane() { |
217 |
JPanel p = new JPanel(); |
JPanel p = new FantasiaPanel(); |
218 |
|
p.setOpaque(false); |
219 |
|
|
220 |
GridBagLayout gridbag = new GridBagLayout(); |
GridBagLayout gridbag = new GridBagLayout(); |
221 |
GridBagConstraints c = new GridBagConstraints(); |
GridBagConstraints c = new GridBagConstraints(); |
222 |
|
|
224 |
|
|
225 |
c.fill = GridBagConstraints.BOTH; |
c.fill = GridBagConstraints.BOTH; |
226 |
|
|
|
spDevicesPane.setViewportView(devicesPane); |
|
|
spDevicesPane.setBorder(BorderFactory.createEmptyBorder()); |
|
|
int h = spDevicesPane.getMinimumSize().height; |
|
|
spDevicesPane.setMinimumSize(new Dimension(200, h)); |
|
|
|
|
227 |
c.gridx = 1; |
c.gridx = 1; |
228 |
c.gridy = 0; |
c.gridy = 0; |
229 |
c.weightx = 1.0; |
c.weightx = 1.0; |
230 |
c.weighty = 1.0; |
c.weighty = 1.0; |
231 |
c.insets = new Insets(0, 3, 3, 0); |
c.insets = new Insets(0, 3, 0, 0); |
232 |
gridbag.setConstraints(spDevicesPane, c); |
gridbag.setConstraints(rightSidePane, c); |
233 |
p.add(spDevicesPane); |
p.add(rightSidePane); |
234 |
|
|
235 |
c.gridx = 0; |
c.gridx = 0; |
236 |
c.gridy = 0; |
c.gridy = 0; |
237 |
c.weightx = 0.0; |
c.weightx = 0.0; |
238 |
c.weighty = 1.0; |
c.weighty = 1.0; |
239 |
c.insets = new Insets(0, 3, 3, 3); |
c.insets = new Insets(0, 0, 0, 3); |
240 |
c.fill = GridBagConstraints.VERTICAL; |
c.fill = GridBagConstraints.VERTICAL; |
241 |
gridbag.setConstraints(mainPane, c); |
gridbag.setConstraints(mainPane, c); |
242 |
p.add(mainPane); |
p.add(mainPane); |
246 |
|
|
247 |
private void |
private void |
248 |
setSavedSize() { |
setSavedSize() { |
249 |
String s = preferences().getStringProperty("MainFrame.sizeAndLocation"); |
Rectangle r = StdUtils.getWindowBounds("MainFrame"); |
250 |
if(s == null) { |
if(r == null) { |
251 |
setDefaultSizeAndLocation(); |
setDefaultSizeAndLocation(); |
252 |
return; |
return; |
253 |
} |
} |
|
pack(); |
|
|
try { |
|
|
int i = s.indexOf(','); |
|
|
int x = Integer.parseInt(s.substring(0, i)); |
|
|
|
|
|
s = s.substring(i + 1); |
|
|
i = s.indexOf(','); |
|
|
int y = Integer.parseInt(s.substring(0, i)); |
|
|
|
|
|
s = s.substring(i + 1); |
|
|
i = s.indexOf(','); |
|
|
int width = Integer.parseInt(s.substring(0, i)); |
|
|
|
|
|
s = s.substring(i + 1); |
|
|
int height = Integer.parseInt(s); |
|
|
|
|
|
setBounds(x, y, width, height); |
|
|
} catch(Exception x) { |
|
|
String msg = "Parsing of window size and location string failed"; |
|
|
CC.getLogger().log(Level.INFO, msg, x); |
|
|
setDefaultSizeAndLocation(); |
|
|
} |
|
254 |
|
|
255 |
if(preferences().getBoolProperty("MainFrame.windowMaximized")) { |
setBounds(r); |
|
setExtendedState(getExtendedState() | MAXIMIZED_BOTH); |
|
|
} |
|
256 |
} |
} |
257 |
|
|
258 |
private void |
private void |
264 |
|
|
265 |
|
|
266 |
/** Invoked when this window is about to close. */ |
/** Invoked when this window is about to close. */ |
267 |
protected void |
@Override |
268 |
|
public void |
269 |
onWindowClose() { |
onWindowClose() { |
270 |
sidePane.savePreferences(); |
boolean b = preferences().getBoolProperty(CONFIRM_APP_QUIT); |
271 |
|
if(b && CC.getSamplerModel().isModified()) { |
272 |
|
JSQuitDlg dlg = new JSQuitDlg(Res.iconQuestion32); |
273 |
|
dlg.setVisible(true); |
274 |
|
if(dlg.isCancelled()) return; |
275 |
|
} |
276 |
|
|
277 |
|
leftSidePane.savePreferences(); |
278 |
|
rightSidePane.savePreferences(); |
279 |
|
|
280 |
int i = hSplitPane.getDividerLocation(); |
int i = hSplitPane.getDividerLocation(); |
281 |
preferences().setIntProperty("MainFrame.hSplitDividerLocation", i); |
preferences().setIntProperty("MainFrame.hSplitDividerLocation", i); |
290 |
return; |
return; |
291 |
} |
} |
292 |
|
|
293 |
java.awt.Point p = getLocation(); |
StdUtils.saveWindowBounds("MainFrame", getBounds()); |
|
Dimension d = getSize(); |
|
|
StringBuffer sb = new StringBuffer(); |
|
|
sb.append(p.x).append(',').append(p.y).append(','); |
|
|
sb.append(d.width).append(',').append(d.height); |
|
|
preferences().setStringProperty("MainFrame.sizeAndLocation", sb.toString()); |
|
294 |
|
|
295 |
String[] list = recentScripts.toArray(new String[recentScripts.size()]); |
String[] list = recentScripts.toArray(new String[recentScripts.size()]); |
296 |
preferences().setStringListProperty(RECENT_LSCP_SCRIPTS, list); |
preferences().setStringListProperty(RECENT_LSCP_SCRIPTS, list); |
299 |
if(lsConsoleFrame != null) getLSConsolePane().saveConsoleHistory(); |
if(lsConsoleFrame != null) getLSConsolePane().saveConsoleHistory(); |
300 |
} |
} |
301 |
|
|
302 |
|
if(getBackendLogFrame() != null) getBackendLogFrame().stopTimer(); |
303 |
|
if(getLSConsolePane() != null) getLSConsolePane().disconnect(); |
304 |
|
|
305 |
super.onWindowClose(); |
super.onWindowClose(); |
306 |
} |
} |
307 |
|
|
308 |
|
@Override |
309 |
|
public void |
310 |
|
setVisible(boolean b) { |
311 |
|
if(b == isVisible()) return; |
312 |
|
|
313 |
|
super.setVisible(b); |
314 |
|
|
315 |
|
if(b && preferences().getBoolProperty("MainFrame.windowMaximized")) { |
316 |
|
setExtendedState(getExtendedState() | MAXIMIZED_BOTH); |
317 |
|
} |
318 |
|
} |
319 |
|
|
320 |
private void |
private void |
321 |
addMenu() { |
addMenu() { |
322 |
JMenu m; |
JMenu m; |
327 |
// Actions |
// Actions |
328 |
m = new FantasiaMenu(i18n.getMenuLabel("actions")); |
m = new FantasiaMenu(i18n.getMenuLabel("actions")); |
329 |
|
|
330 |
mi = new JMenuItem(a4n.connect); |
mi = new JMenuItem(a4n.refresh); |
331 |
mi.setIcon(null); |
mi.setIcon(null); |
332 |
//mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)); |
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); |
333 |
m.add(mi); |
m.add(mi); |
334 |
|
|
335 |
mi = new JMenuItem(a4n.samplerInfo); |
mi = new JMenuItem(a4n.samplerInfo); |
336 |
mi.setIcon(null); |
mi.setIcon(null); |
337 |
m.add(mi); |
m.add(mi); |
338 |
|
|
339 |
|
mi = new JMenuItem(a4n.resetSampler); |
340 |
|
mi.setIcon(null); |
341 |
|
m.add(mi); |
342 |
|
|
343 |
m.addSeparator(); |
m.addSeparator(); |
344 |
|
|
345 |
JMenu exportMenu = new JMenu(i18n.getMenuLabel("actions.export")); |
JMenu exportMenu = new JMenu(i18n.getMenuLabel("actions.export")); |
346 |
m.add(exportMenu); |
m.add(exportMenu); |
347 |
|
|
348 |
|
int modKey = CC.getViewConfig().getDefaultModKey(); |
349 |
|
|
350 |
mi = new JMenuItem(a4n.exportSamplerConfig); |
mi = new JMenuItem(a4n.exportSamplerConfig); |
351 |
mi.setIcon(null); |
mi.setIcon(null); |
352 |
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK)); |
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, modKey)); |
353 |
exportMenu.add(mi); |
exportMenu.add(mi); |
354 |
|
|
355 |
mi = new JMenuItem(a4n.exportMidiInstrumentMaps); |
mi = new JMenuItem(a4n.exportMidiInstrumentMaps); |
360 |
|
|
361 |
mi = new JMenuItem(a4n.loadScript); |
mi = new JMenuItem(a4n.loadScript); |
362 |
mi.setIcon(null); |
mi.setIcon(null); |
363 |
|
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, modKey)); |
364 |
m.add(mi); |
m.add(mi); |
365 |
|
|
366 |
String[] list = preferences().getStringListProperty(RECENT_LSCP_SCRIPTS); |
String[] list = preferences().getStringListProperty(RECENT_LSCP_SCRIPTS); |
372 |
|
|
373 |
m.addSeparator(); |
m.addSeparator(); |
374 |
|
|
375 |
|
mi = new JMenuItem(a4n.changeBackend); |
376 |
|
mi.setIcon(null); |
377 |
|
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, modKey)); |
378 |
|
m.add(mi); |
379 |
|
|
380 |
|
m.addSeparator(); |
381 |
|
|
382 |
mi = new JMenuItem(i18n.getMenuLabel("actions.exit")); |
mi = new JMenuItem(i18n.getMenuLabel("actions.exit")); |
383 |
m.add(mi); |
m.add(mi); |
384 |
mi.addActionListener(new ActionListener() { |
mi.addActionListener(new ActionListener() { |
417 |
mi = new JMenuItem(a4n.editPreferences); |
mi = new JMenuItem(a4n.editPreferences); |
418 |
mi.setIcon(null); |
mi.setIcon(null); |
419 |
mi.setAccelerator(KeyStroke.getKeyStroke ( |
mi.setAccelerator(KeyStroke.getKeyStroke ( |
420 |
KeyEvent.VK_P, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK |
KeyEvent.VK_P, modKey | KeyEvent.SHIFT_MASK |
421 |
)); |
)); |
422 |
m.add(mi); |
m.add(mi); |
423 |
|
|
438 |
cbmiToolBarVisible.setSelected(b); |
cbmiToolBarVisible.setSelected(b); |
439 |
showToolBar(b); |
showToolBar(b); |
440 |
|
|
441 |
cbmiSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( |
cbmiLeftSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( |
442 |
KeyEvent.VK_L, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK |
KeyEvent.VK_L, modKey | KeyEvent.SHIFT_MASK |
443 |
)); |
)); |
444 |
m.add(cbmiSidePaneVisible); |
m.add(cbmiLeftSidePaneVisible); |
445 |
|
|
446 |
cbmiSidePaneVisible.addActionListener(new ActionListener() { |
cbmiLeftSidePaneVisible.addActionListener(new ActionListener() { |
447 |
public void |
public void |
448 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
449 |
showSidePane(cbmiSidePaneVisible.getState()); |
showSidePane(cbmiLeftSidePaneVisible.getState()); |
450 |
} |
} |
451 |
}); |
}); |
452 |
|
|
453 |
b = preferences().getBoolProperty("sidePane.visible"); |
b = preferences().getBoolProperty("leftSidePane.visible"); |
454 |
cbmiSidePaneVisible.setSelected(b); |
cbmiLeftSidePaneVisible.setSelected(b); |
455 |
showSidePane(b); |
showSidePane(b); |
456 |
|
|
457 |
cbmiDevicesPaneVisible.setAccelerator(KeyStroke.getKeyStroke ( |
cbmiRightSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( |
458 |
KeyEvent.VK_R, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK |
KeyEvent.VK_R, modKey | KeyEvent.SHIFT_MASK |
459 |
)); |
)); |
460 |
m.add(cbmiDevicesPaneVisible); |
m.add(cbmiRightSidePaneVisible); |
461 |
|
|
462 |
cbmiDevicesPaneVisible.addActionListener(new ActionListener() { |
cbmiRightSidePaneVisible.addActionListener(new ActionListener() { |
463 |
public void |
public void |
464 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
465 |
showDevicesPane(cbmiDevicesPaneVisible.getState()); |
showDevicesPane(cbmiRightSidePaneVisible.getState()); |
466 |
} |
} |
467 |
}); |
}); |
468 |
|
|
469 |
b = preferences().getBoolProperty("devicesPane.visible"); |
b = preferences().getBoolProperty("rightSidePane.visible"); |
470 |
cbmiDevicesPaneVisible.setSelected(b); |
cbmiRightSidePaneVisible.setSelected(b); |
471 |
showDevicesPane(b); |
showDevicesPane(b); |
472 |
|
|
473 |
|
m.addSeparator(); |
474 |
|
|
475 |
|
m.add(cbmiMidiKeyboardVisible); |
476 |
|
|
477 |
|
cbmiMidiKeyboardVisible.addActionListener(new ActionListener() { |
478 |
|
public void |
479 |
|
actionPerformed(ActionEvent e) { |
480 |
|
setMidiKeyboardVisible(cbmiMidiKeyboardVisible.getState()); |
481 |
|
} |
482 |
|
}); |
483 |
|
|
484 |
|
b = preferences().getBoolProperty("midiKeyboard.visible"); |
485 |
|
cbmiMidiKeyboardVisible.setSelected(b); |
486 |
|
setMidiKeyboardVisible(b); |
487 |
|
|
488 |
|
|
489 |
|
// Channels |
490 |
|
m = new FantasiaMenu(i18n.getMenuLabel("channels")); |
491 |
|
|
492 |
|
mi = new JMenuItem(i18n.getMenuLabel("channels.newChannel")); |
493 |
|
mi.addActionListener(new ActionListener() { |
494 |
|
public void |
495 |
|
actionPerformed(ActionEvent e) { |
496 |
|
CC.getSamplerModel().addBackendChannel(); |
497 |
|
} |
498 |
|
}); |
499 |
|
m.add(mi); |
500 |
|
|
501 |
|
m.addSeparator(); |
502 |
|
|
503 |
|
MenuManager.ChannelViewGroup group = new MenuManager.ChannelViewGroup(); |
504 |
|
MenuManager.getMenuManager().registerChannelViewGroup(group); |
505 |
|
|
506 |
|
for(JMenuItem menuItem : group.getMenuItems()) m.add(menuItem); |
507 |
|
|
508 |
|
m.addSeparator(); |
509 |
|
|
510 |
|
m.add(new JMenuItem(a4n.moveChannelsOnTop)); |
511 |
|
m.add(new JMenuItem(a4n.moveChannelsUp)); |
512 |
|
m.add(new JMenuItem(a4n.moveChannelsDown)); |
513 |
|
m.add(new JMenuItem(a4n.moveChannelsAtBottom)); |
514 |
|
|
515 |
|
m.add(new ToPanelMenu()); |
516 |
|
|
517 |
|
m.addSeparator(); |
518 |
|
|
519 |
|
mi = new JMenuItem(a4n.selectAllChannels); |
520 |
|
mi.setIcon(null); |
521 |
|
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, modKey)); |
522 |
|
m.add(mi); |
523 |
|
|
524 |
|
mi = new JMenuItem(a4n.deselectChannels); |
525 |
|
mi.setIcon(null); |
526 |
|
mi.setAccelerator(KeyStroke.getKeyStroke ( |
527 |
|
KeyEvent.VK_A, modKey | KeyEvent.SHIFT_MASK |
528 |
|
)); |
529 |
|
m.add(mi); |
530 |
|
|
531 |
|
menuBar.add(m); |
532 |
|
|
533 |
// Window |
// Window |
534 |
m = new FantasiaMenu(i18n.getMenuLabel("window")); |
m = new FantasiaMenu(i18n.getMenuLabel("window")); |
542 |
mi.setIcon(null); |
mi.setIcon(null); |
543 |
m.add(mi); |
m.add(mi); |
544 |
|
|
545 |
|
m.addSeparator(); |
546 |
|
|
547 |
|
final JMenuItem mi2 = new JMenuItem(i18n.getMenuLabel("window.backendLog")); |
548 |
|
m.add(mi2); |
549 |
|
mi2.addActionListener(new ActionListener() { |
550 |
|
public void |
551 |
|
actionPerformed(ActionEvent e) { |
552 |
|
if(getBackendLogFrame().isVisible()) { |
553 |
|
getBackendLogFrame().setVisible(false); |
554 |
|
} |
555 |
|
|
556 |
|
getBackendLogFrame().setVisible(true); |
557 |
|
} |
558 |
|
}); |
559 |
|
|
560 |
|
mi2.setEnabled(CC.getBackendProcess() != null); |
561 |
|
|
562 |
|
CC.addBackendProcessListener(new ActionListener() { |
563 |
|
public void |
564 |
|
actionPerformed(ActionEvent e) { |
565 |
|
mi2.setEnabled(CC.getBackendProcess() != null); |
566 |
|
} |
567 |
|
}); |
568 |
|
|
569 |
|
|
570 |
// Help |
// Help |
571 |
m = new FantasiaMenu(i18n.getMenuLabel("help")); |
m = new FantasiaMenu(i18n.getMenuLabel("help")); |
572 |
|
|
573 |
|
mi = new JMenuItem(a4n.browseOnlineTutorial); |
574 |
|
mi.setIcon(null); |
575 |
|
m.add(mi); |
576 |
|
|
577 |
|
m.addSeparator(); |
578 |
|
|
579 |
mi = new JMenuItem(a4n.helpAbout); |
mi = new JMenuItem(a4n.helpAbout); |
580 |
mi.setIcon(null); |
mi.setIcon(null); |
581 |
m.add(mi); |
m.add(mi); |
583 |
menuBar.add(m); |
menuBar.add(m); |
584 |
} |
} |
585 |
|
|
586 |
|
public static class ToPanelMenu extends FantasiaMenu implements ListSelectionListener { |
587 |
|
public |
588 |
|
ToPanelMenu() { |
589 |
|
super(i18n.getMenuLabel("channels.toPanel")); |
590 |
|
setEnabled(CC.getMainFrame().getSelectedChannelsPane().hasSelectedChannel()); |
591 |
|
|
592 |
|
CC.getMainFrame().addChannelsPaneSelectionListener(this); |
593 |
|
|
594 |
|
for(int i = 0; i < CC.getMainFrame().getChannelsPaneCount(); i++) { |
595 |
|
JSChannelsPane p = CC.getMainFrame().getChannelsPane(i); |
596 |
|
add(new JMenuItem(new A4n.MoveChannelsToPanel(p))); |
597 |
|
p.addListSelectionListener(this); |
598 |
|
} |
599 |
|
} |
600 |
|
|
601 |
|
@Override |
602 |
|
public void |
603 |
|
valueChanged(ListSelectionEvent e) { |
604 |
|
setEnabled(CC.getMainFrame().getSelectedChannelsPane().hasSelectedChannel()); |
605 |
|
} |
606 |
|
} |
607 |
|
|
608 |
|
public RightSidePane |
609 |
|
getRightSidePane() { return rightSidePane; } |
610 |
|
|
611 |
|
@Override |
612 |
|
public A4n |
613 |
|
getA4n() { return A4n.a4n; } |
614 |
|
|
615 |
/** |
/** |
616 |
* This method does nothing, because <b>Fantasia</b> has exactly |
* This method does nothing, because <b>Fantasia</b> has constant |
617 |
* one pane containing sampler channels, which can not be changed. |
* number of panes containing sampler channels, which can not be changed. |
618 |
*/ |
*/ |
619 |
|
@Override |
620 |
public void |
public void |
621 |
insertChannelsPane(JSChannelsPane pane, int idx) { |
insertChannelsPane(JSChannelsPane pane, int idx) { |
622 |
|
|
623 |
} |
} |
624 |
|
|
625 |
/** |
@Override |
|
* This method always returns the <code>JSChannelsPane</code> at index 0, |
|
|
* because the <b>Fantasia</b> view has exactly one pane containing sampler channels. |
|
|
* @return The <code>JSChannelsPane</code> at index 0. |
|
|
*/ |
|
626 |
public JSChannelsPane |
public JSChannelsPane |
627 |
getSelectedChannelsPane() { return getChannelsPane(0); } |
getSelectedChannelsPane() { return mainPane.getSelectedChannelsPane(); } |
628 |
|
|
629 |
/** |
@Override |
|
* This method does nothing because the <b>Fantasia</b> view has |
|
|
* exactly one pane containing sampler channels which is always shown. |
|
|
*/ |
|
630 |
public void |
public void |
631 |
setSelectedChannelsPane(JSChannelsPane pane) { } |
setSelectedChannelsPane(JSChannelsPane pane) { |
632 |
|
mainPane.setSelectedChannelsPane(pane); |
633 |
|
fireChannelsPaneSelectionChanged(); |
634 |
|
} |
635 |
|
|
636 |
|
@Override |
637 |
public void |
public void |
638 |
installJSamplerHome() { |
installJSamplerHome() { |
639 |
JSamplerHomeChooser chooser = new JSamplerHomeChooser(this); |
JSamplerHomeChooser chooser = new JSamplerHomeChooser(this); |
643 |
CC.changeJSamplerHome(chooser.getJSamplerHome()); |
CC.changeJSamplerHome(chooser.getJSamplerHome()); |
644 |
} |
} |
645 |
|
|
646 |
|
@Override |
647 |
public void |
public void |
648 |
showDetailedErrorMessage(Frame owner, String err, String details) { |
showDetailedErrorMessage(Frame owner, String err, String details) { |
649 |
JSDetailedErrorDlg dlg = new JSDetailedErrorDlg ( |
JSDetailedErrorDlg dlg = new JSDetailedErrorDlg ( |
652 |
dlg.setVisible(true); |
dlg.setVisible(true); |
653 |
} |
} |
654 |
|
|
655 |
|
@Override |
656 |
public void |
public void |
657 |
showDetailedErrorMessage(Dialog owner, String err, String details) { |
showDetailedErrorMessage(Dialog owner, String err, String details) { |
658 |
JSDetailedErrorDlg dlg = new JSDetailedErrorDlg ( |
JSDetailedErrorDlg dlg = new JSDetailedErrorDlg ( |
661 |
dlg.setVisible(true); |
dlg.setVisible(true); |
662 |
} |
} |
663 |
|
|
664 |
|
/** |
665 |
|
* Gets the server address to which to connect. If the server should be |
666 |
|
* manually selected, a dialog asking the user to choose a server is displayed. |
667 |
|
*/ |
668 |
|
@Override |
669 |
|
public Server |
670 |
|
getServer() { |
671 |
|
boolean b = preferences().getBoolProperty(MANUAL_SERVER_SELECT_ON_STARTUP); |
672 |
|
return getServer(b); |
673 |
|
} |
674 |
|
|
675 |
|
/** |
676 |
|
* Gets the server address to which to connect. If the server should be |
677 |
|
* manually selected, a dialog asking the user to choose a server is displayed. |
678 |
|
* @param manualSelect Determines whether the server should be manually selected. |
679 |
|
*/ |
680 |
|
@Override |
681 |
|
public Server |
682 |
|
getServer(boolean manualSelect) { |
683 |
|
if(manualSelect) { |
684 |
|
JSConnectDlg dlg = new JSConnectDlg(); |
685 |
|
dlg.setVisible(true); |
686 |
|
|
687 |
|
return dlg.getSelectedServer(); |
688 |
|
} |
689 |
|
|
690 |
|
int i = preferences().getIntProperty(SERVER_INDEX); |
691 |
|
int size = CC.getServerList().getServerCount(); |
692 |
|
if(size == 0) return null; |
693 |
|
if(i >= size) return CC.getServerList().getServer(0); |
694 |
|
|
695 |
|
return CC.getServerList().getServer(i); |
696 |
|
} |
697 |
|
|
698 |
|
public Timer |
699 |
|
getGuiTimer() { return guiTimer; } |
700 |
|
|
701 |
protected LSConsoleModel |
protected LSConsoleModel |
702 |
getLSConsoleModel() { return getLSConsolePane().getModel(); } |
getLSConsoleModel() { return getLSConsolePane().getModel(); } |
703 |
|
|
709 |
protected LSConsoleFrame |
protected LSConsoleFrame |
710 |
getLSConsoleFrame() { return lsConsoleFrame; } |
getLSConsoleFrame() { return lsConsoleFrame; } |
711 |
|
|
712 |
protected void |
public JSBackendLogFrame |
713 |
|
getBackendLogFrame() { return backendLogFrame; } |
714 |
|
|
715 |
|
protected boolean |
716 |
runScript() { |
runScript() { |
717 |
String s = preferences().getStringProperty("lastScriptLocation"); |
String s = preferences().getStringProperty("lastScriptLocation"); |
718 |
JFileChooser fc = new JFileChooser(s); |
JFileChooser fc = new JFileChooser(s); |
719 |
fc.setFileFilter(new LscpFileFilter()); |
fc.setFileFilter(new LscpFileFilter()); |
720 |
int result = fc.showOpenDialog(this); |
int result = fc.showOpenDialog(this); |
721 |
if(result != JFileChooser.APPROVE_OPTION) return; |
if(result != JFileChooser.APPROVE_OPTION) return false; |
722 |
|
|
723 |
String path = fc.getCurrentDirectory().getAbsolutePath(); |
String path = fc.getCurrentDirectory().getAbsolutePath(); |
724 |
preferences().setStringProperty("lastScriptLocation", path); |
preferences().setStringProperty("lastScriptLocation", path); |
725 |
|
|
726 |
runScript(fc.getSelectedFile()); |
runScript(fc.getSelectedFile()); |
727 |
|
|
728 |
|
return true; |
729 |
} |
} |
730 |
|
|
731 |
private void |
@Override |
732 |
|
public void |
733 |
runScript(String script) { runScript(new File(script)); } |
runScript(String script) { runScript(new File(script)); } |
734 |
|
|
735 |
private void |
private void |
741 |
return; |
return; |
742 |
} |
} |
743 |
|
|
744 |
|
String prefix = "#jsampler.fantasia: "; |
745 |
|
Vector<String> v = new Vector<String>(); |
746 |
BufferedReader br = new BufferedReader(fr); |
BufferedReader br = new BufferedReader(fr); |
747 |
|
|
748 |
try { |
try { |
750 |
while(s != null) { |
while(s != null) { |
751 |
getLSConsoleModel().setCommandLineText(s); |
getLSConsoleModel().setCommandLineText(s); |
752 |
getLSConsoleModel().execCommand(); |
getLSConsoleModel().execCommand(); |
753 |
|
if(s.startsWith(prefix)) v.add(s.substring(prefix.length())); |
754 |
s = br.readLine(); |
s = br.readLine(); |
755 |
} |
} |
756 |
} catch(Exception e) { |
} catch(Exception e) { |
763 |
recentScripts.insertElementAt(s, 0); |
recentScripts.insertElementAt(s, 0); |
764 |
|
|
765 |
updateRecentScriptsMenu(); |
updateRecentScriptsMenu(); |
766 |
|
|
767 |
|
CC.getViewConfig().setSessionViewConfig( |
768 |
|
new SessionViewConfig(v.toArray(new String[v.size()])) |
769 |
|
); |
770 |
} |
} |
771 |
|
|
772 |
protected void |
protected void |
801 |
|
|
802 |
private void |
private void |
803 |
showSidePane(boolean b) { |
showSidePane(boolean b) { |
804 |
preferences().setBoolProperty("sidePane.visible", b); |
preferences().setBoolProperty("leftSidePane.visible", b); |
805 |
rootPane.remove(rightPane); |
rootPane.remove(rightPane); |
806 |
rootPane.remove(hSplitPane); |
rootPane.remove(hSplitPane); |
807 |
|
|
833 |
|
|
834 |
private void |
private void |
835 |
showDevicesPane(boolean b) { |
showDevicesPane(boolean b) { |
836 |
preferences().setBoolProperty("devicesPane.visible", b); |
preferences().setBoolProperty("rightSidePane.visible", b); |
837 |
|
|
838 |
int width = sidePane.getWidth(); |
int width = leftSidePane.getWidth(); |
839 |
int height = sidePane.getPreferredSize().height; |
int height = leftSidePane.getPreferredSize().height; |
840 |
if(width != 0) sidePane.setPreferredSize(new Dimension(width, height)); |
if(width != 0) leftSidePane.setPreferredSize(new Dimension(width, height)); |
841 |
|
|
842 |
if(b) { |
if(b) { |
843 |
int w = preferences().getIntProperty("devicesPane.width", 200); |
int w = preferences().getIntProperty("devicesPane.width", 200); |
844 |
|
|
845 |
int h = spDevicesPane.getPreferredSize().height; |
int h = rightSidePane.getPreferredSize().height; |
846 |
spDevicesPane.setPreferredSize(new Dimension(w, h)); |
rightSidePane.setPreferredSize(new Dimension(w, h)); |
847 |
} else { |
} else { |
848 |
int w = spDevicesPane.getWidth(); |
int w = rightSidePane.getWidth(); |
849 |
if(w > 0 && w < 200) w = 200; |
if(w > 0 && w < 200) w = 200; |
850 |
if(w != 0) preferences().setIntProperty("devicesPane.width", w); |
if(w != 0) preferences().setIntProperty("devicesPane.width", w); |
851 |
} |
} |
852 |
|
|
853 |
hSplitPane.setResizeWeight(0.0); |
hSplitPane.setResizeWeight(0.0); |
854 |
spDevicesPane.setVisible(b); |
rightSidePane.setVisible(b); |
855 |
hSplitPane.resetToPreferredSizes(); |
hSplitPane.resetToPreferredSizes(); |
856 |
|
|
857 |
int w = getPreferredSize().width; |
int w = getPreferredSize().width; |
868 |
}); |
}); |
869 |
} |
} |
870 |
|
|
871 |
|
public void |
872 |
|
setMidiKeyboardVisible(boolean b) { |
873 |
|
preferences().setBoolProperty("midiKeyboard.visible", b); |
874 |
|
pianoKeyboardPane.setVisible(b); |
875 |
|
|
876 |
|
if(cbmiMidiKeyboardVisible.isSelected() != b) { |
877 |
|
cbmiMidiKeyboardVisible.setSelected(b); |
878 |
|
} |
879 |
|
|
880 |
|
if(standardBar.btnMidiKeyboard.isSelected() != b) { |
881 |
|
standardBar.btnMidiKeyboard.setSelected(b); |
882 |
|
} |
883 |
|
|
884 |
|
if(pianoKeyboardPane.btnPower.isSelected() != b) { |
885 |
|
pianoKeyboardPane.btnPower.setSelected(b); |
886 |
|
} |
887 |
|
|
888 |
|
rootPane.validate(); |
889 |
|
rootPane.repaint(); |
890 |
|
} |
891 |
|
|
892 |
|
public void |
893 |
|
setMidiKeyboardHeight(int height) { |
894 |
|
Dimension d = pianoKeyboardPane.getPreferredSize(); |
895 |
|
d = new Dimension(d.width, height); |
896 |
|
pianoKeyboardPane.setPreferredSize(d); |
897 |
|
pianoKeyboardPane.setMinimumSize(d); |
898 |
|
pianoKeyboardPane.revalidate(); |
899 |
|
pianoKeyboardPane.repaint(); |
900 |
|
} |
901 |
|
|
902 |
private void |
private void |
903 |
sidePanesVisibilityChanged() { |
sidePanesVisibilityChanged() { |
904 |
boolean sidePaneVisible = cbmiSidePaneVisible.isSelected(); |
boolean leftSidePaneVisible = cbmiLeftSidePaneVisible.isSelected(); |
905 |
boolean devicesPaneVisible = cbmiDevicesPaneVisible.isSelected(); |
boolean rightSidePaneVisible = cbmiRightSidePaneVisible.isSelected(); |
906 |
|
|
907 |
if(sidePaneVisible && devicesPaneVisible) { |
if(leftSidePaneVisible && rightSidePaneVisible) { |
908 |
hSplitPane.setResizeWeight(0.5); |
hSplitPane.setResizeWeight(0.5); |
909 |
} else if(sidePaneVisible && !devicesPaneVisible) { |
} else if(leftSidePaneVisible && !rightSidePaneVisible) { |
910 |
hSplitPane.setResizeWeight(1.0); |
hSplitPane.setResizeWeight(1.0); |
911 |
} |
} |
912 |
|
|
913 |
if(!sidePaneVisible && !devicesPaneVisible) { |
if(!leftSidePaneVisible && !rightSidePaneVisible) { |
914 |
standardBar.showFantasiaLogo(false); |
standardBar.showFantasiaLogo(false); |
915 |
if(isResizable()) setResizable(false); |
if(isResizable()) setResizable(false); |
916 |
} else { |
} else { |
924 |
|
|
925 |
RecentScriptHandler(String script) { this.script = script; } |
RecentScriptHandler(String script) { this.script = script; } |
926 |
|
|
927 |
|
@Override |
928 |
public void |
public void |
929 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
930 |
runScript(script); |
runScript(script); |
939 |
super(s); |
super(s); |
940 |
setFont(getFont().deriveFont(java.awt.Font.BOLD)); |
setFont(getFont().deriveFont(java.awt.Font.BOLD)); |
941 |
setOpaque(false); |
setOpaque(false); |
942 |
|
setContentAreaFilled(false); |
943 |
} |
} |
944 |
} |
} |
945 |
|
|
946 |
private class FantasiaMenuBar extends JMenuBar { |
private class FantasiaMenuBar extends JMenuBar { |
|
private Insets pixmapInsets = new Insets(6, 6, 0, 6); |
|
|
private Insets pixmapInsets2 = new Insets(6, 6, 6, 6); |
|
|
|
|
947 |
FantasiaMenuBar() { |
FantasiaMenuBar() { |
948 |
setOpaque(false); |
setOpaque(false); |
949 |
|
setBorder(BorderFactory.createEmptyBorder(2, 6, 0, 0)); |
950 |
} |
} |
951 |
|
|
952 |
|
@Override |
953 |
protected void |
protected void |
954 |
paintComponent(Graphics g) { |
paintComponent(Graphics g) { |
955 |
super.paintComponent(g); |
//super.paintComponent(g); |
956 |
|
Graphics2D g2 = (Graphics2D)g; |
957 |
|
|
958 |
|
Paint oldPaint = g2.getPaint(); |
959 |
|
Composite oldComposite = g2.getComposite(); |
960 |
|
|
961 |
|
double h = getSize().getHeight(); |
962 |
|
double w = getSize().getWidth(); |
963 |
|
|
964 |
|
FantasiaPainter.paintGradient(g2, 0.0, 0.0, w - 1, h - 1, FantasiaPainter.color6, FantasiaPainter.color5); |
965 |
|
|
966 |
|
FantasiaPainter.Border b; |
967 |
|
|
968 |
|
|
969 |
if(standardBar.isVisible()) { |
if(standardBar.isVisible()) { |
970 |
PixmapPane.paintComponent(this, g, Res.gfxMenuBarBg, pixmapInsets); |
b = new FantasiaPainter.Border(true, true, false, true); |
971 |
|
FantasiaPainter.paintBoldOuterBorder(g2, 0, 0, w - 1, h + 1, b); |
972 |
} else { |
} else { |
973 |
PixmapPane.paintComponent(this, g, Res.gfxRoundBg14, pixmapInsets2); |
b = new FantasiaPainter.Border(true, true, true, true); |
974 |
|
FantasiaPainter.paintBoldOuterBorder(g2, 0, 0, w - 1, h - 1, b); |
975 |
} |
} |
976 |
|
|
977 |
|
g2.setPaint(oldPaint); |
978 |
|
g2.setComposite(oldComposite); |
979 |
|
} |
980 |
|
} |
981 |
|
|
982 |
|
class RootPane extends FantasiaSubPanel { |
983 |
|
private final Color color1 = new Color(0x454545); |
984 |
|
private final Color color2 = new Color(0x2e2e2e); |
985 |
|
|
986 |
|
RootPane() { |
987 |
|
setLayout(new BorderLayout()); |
988 |
|
setBorder(BorderFactory.createEmptyBorder(9, 10, 6, 10)); |
989 |
|
setOpaque(false); |
990 |
|
|
991 |
|
} |
992 |
|
|
993 |
|
@Override |
994 |
|
public void |
995 |
|
paintComponent(Graphics g) { |
996 |
|
Graphics2D g2 = (Graphics2D)g; |
997 |
|
|
998 |
|
Paint oldPaint = g2.getPaint(); |
999 |
|
Composite oldComposite = g2.getComposite(); |
1000 |
|
|
1001 |
|
double h = getSize().getHeight(); |
1002 |
|
double w = getSize().getWidth(); |
1003 |
|
|
1004 |
|
FantasiaPainter.paintBorder(g2, 0, -3, w - 1, h - 1, 6, false); |
1005 |
|
paintComponent(g2, 5, 1, w - 10, h - 6, color1, color2); |
1006 |
|
|
1007 |
|
g2.setPaint(oldPaint); |
1008 |
|
g2.setComposite(oldComposite); |
1009 |
|
} |
1010 |
|
} |
1011 |
|
|
1012 |
|
class BottomPane extends FantasiaPanel { |
1013 |
|
BottomPane() { |
1014 |
|
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
1015 |
|
setOpaque(false); |
1016 |
|
add(pianoKeyboardPane); |
1017 |
|
|
1018 |
} |
} |
1019 |
} |
} |
1020 |
} |
} |