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-2008 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
30 |
import java.awt.GridBagConstraints; |
import java.awt.GridBagConstraints; |
31 |
import java.awt.GridBagLayout; |
import java.awt.GridBagLayout; |
32 |
import java.awt.Insets; |
import java.awt.Insets; |
|
import java.awt.Point; |
|
33 |
|
|
34 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
35 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
36 |
import java.awt.event.KeyEvent; |
import java.awt.event.KeyEvent; |
|
import java.awt.event.MouseAdapter; |
|
|
import java.awt.event.MouseEvent; |
|
37 |
|
|
38 |
import java.io.BufferedReader; |
import java.io.BufferedReader; |
39 |
import java.io.File; |
import java.io.File; |
44 |
import java.util.logging.Level; |
import java.util.logging.Level; |
45 |
|
|
46 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
|
import javax.swing.Box; |
|
|
import javax.swing.BoxLayout; |
|
47 |
import javax.swing.JCheckBoxMenuItem; |
import javax.swing.JCheckBoxMenuItem; |
|
import javax.swing.JComponent; |
|
|
import javax.swing.JDialog; |
|
48 |
import javax.swing.JFileChooser; |
import javax.swing.JFileChooser; |
|
import javax.swing.JFrame; |
|
49 |
import javax.swing.JMenu; |
import javax.swing.JMenu; |
50 |
import javax.swing.JMenuBar; |
import javax.swing.JMenuBar; |
51 |
import javax.swing.JMenuItem; |
import javax.swing.JMenuItem; |
52 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
|
import javax.swing.JPopupMenu; |
|
|
import javax.swing.JScrollPane; |
|
53 |
import javax.swing.JSplitPane; |
import javax.swing.JSplitPane; |
|
import javax.swing.JToggleButton; |
|
54 |
import javax.swing.KeyStroke; |
import javax.swing.KeyStroke; |
55 |
import javax.swing.SwingUtilities; |
import javax.swing.SwingUtilities; |
56 |
import javax.swing.UIManager; |
import javax.swing.Timer; |
|
|
|
|
import net.sf.juife.TitleBar; |
|
57 |
|
|
58 |
import org.jsampler.CC; |
import org.jsampler.CC; |
59 |
import org.jsampler.HF; |
import org.jsampler.HF; |
60 |
import org.jsampler.LSConsoleModel; |
import org.jsampler.LSConsoleModel; |
61 |
|
import org.jsampler.Server; |
62 |
|
|
|
import org.jsampler.view.JSChannel; |
|
63 |
import org.jsampler.view.JSChannelsPane; |
import org.jsampler.view.JSChannelsPane; |
64 |
import org.jsampler.view.JSMainFrame; |
import org.jsampler.view.JSMainFrame; |
65 |
import org.jsampler.view.LscpFileFilter; |
import org.jsampler.view.LscpFileFilter; |
66 |
|
|
67 |
|
import org.jsampler.view.std.JSConnectDlg; |
68 |
import org.jsampler.view.std.JSDetailedErrorDlg; |
import org.jsampler.view.std.JSDetailedErrorDlg; |
69 |
|
import org.jsampler.view.std.JSQuitDlg; |
70 |
import org.jsampler.view.std.JSamplerHomeChooser; |
import org.jsampler.view.std.JSamplerHomeChooser; |
71 |
|
|
72 |
import static org.jsampler.view.fantasia.A4n.a4n; |
import static org.jsampler.view.fantasia.A4n.a4n; |
84 |
private final FantasiaMenuBar menuBar = new FantasiaMenuBar(); |
private final FantasiaMenuBar menuBar = new FantasiaMenuBar(); |
85 |
private final JPanel rootPane = new JPanel(); |
private final JPanel rootPane = new JPanel(); |
86 |
private final MainPane mainPane = new MainPane(); |
private final MainPane mainPane = new MainPane(); |
87 |
private final DevicesPane devicesPane = new DevicesPane(); |
private final PianoKeyboardPane pianoKeyboardPane; |
|
private final JScrollPane spDevicesPane = new JScrollPane(); |
|
88 |
|
|
89 |
private final JMenu recentScriptsMenu = |
private final JMenu recentScriptsMenu = |
90 |
new JMenu(i18n.getMenuLabel("actions.recentScripts")); |
new JMenu(i18n.getMenuLabel("actions.recentScripts")); |
91 |
|
|
92 |
private final JSplitPane hSplitPane; |
private final JSplitPane hSplitPane; |
93 |
|
private final JSplitPane pianoRollSplitPane; |
94 |
|
|
95 |
private final SidePane sidePane = new SidePane(); |
private final LeftSidePane leftSidePane = new LeftSidePane(); |
96 |
|
private final RightSidePane rightSidePane = new RightSidePane(); |
97 |
private final JPanel rightPane; |
private final JPanel rightPane; |
98 |
|
|
99 |
|
//private final StatusBar statusBar = new StatusBar(); |
100 |
|
|
101 |
private final LSConsoleFrame lsConsoleFrame = new LSConsoleFrame(); |
private final LSConsoleFrame lsConsoleFrame = new LSConsoleFrame(); |
102 |
private final Vector<String> recentScripts = new Vector<String>(); |
private final Vector<String> recentScripts = new Vector<String>(); |
103 |
|
|
105 |
private final JCheckBoxMenuItem cbmiToolBarVisible = |
private final JCheckBoxMenuItem cbmiToolBarVisible = |
106 |
new JCheckBoxMenuItem(i18n.getMenuLabel("view.toolBar")); |
new JCheckBoxMenuItem(i18n.getMenuLabel("view.toolBar")); |
107 |
|
|
108 |
private final JCheckBoxMenuItem cbmiSidePaneVisible = |
private final JCheckBoxMenuItem cbmiLeftSidePaneVisible = |
109 |
new JCheckBoxMenuItem(i18n.getMenuLabel("view.sidePane")); |
new JCheckBoxMenuItem(i18n.getMenuLabel("view.leftSidePane")); |
110 |
|
|
111 |
|
private final JCheckBoxMenuItem cbmiRightSidePaneVisible = |
112 |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.rightSidePane")); |
113 |
|
|
114 |
|
private final JCheckBoxMenuItem cbmiMidiKeyboardVisible = |
115 |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.midiKeyboard")); |
116 |
|
|
117 |
private final JCheckBoxMenuItem cbmiDevicesPaneVisible = |
private final Timer guiTimer = new Timer(1000, null); |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.devicesPane")); |
|
118 |
|
|
119 |
/** Creates a new instance of <code>MainFrame</code> */ |
/** Creates a new instance of <code>MainFrame</code> */ |
120 |
public |
public |
124 |
if(Res.iconAppIcon != null) setIconImage(Res.iconAppIcon.getImage()); |
if(Res.iconAppIcon != null) setIconImage(Res.iconAppIcon.getImage()); |
125 |
|
|
126 |
getContentPane().add(standardBar, BorderLayout.NORTH); |
getContentPane().add(standardBar, BorderLayout.NORTH); |
127 |
|
//getContentPane().add(statusBar, BorderLayout.SOUTH); |
128 |
|
|
129 |
rightPane = createRightPane(); |
rightPane = createRightPane(); |
130 |
|
|
131 |
hSplitPane = new JSplitPane ( |
hSplitPane = new JSplitPane ( |
132 |
JSplitPane.HORIZONTAL_SPLIT, |
JSplitPane.HORIZONTAL_SPLIT, |
133 |
true, // continuousLayout |
true, // continuousLayout |
134 |
sidePane, rightPane |
leftSidePane, rightPane |
135 |
); |
); |
136 |
hSplitPane.setResizeWeight(0.5); |
hSplitPane.setResizeWeight(0.5); |
137 |
|
|
138 |
|
addChannelsPane(mainPane.getChannelsPane()); |
139 |
|
|
140 |
|
pianoKeyboardPane = new PianoKeyboardPane(); |
141 |
|
getChannelsPane(0).addListSelectionListener(pianoKeyboardPane); |
142 |
|
|
143 |
|
pianoRollSplitPane = new JSplitPane ( |
144 |
|
JSplitPane.VERTICAL_SPLIT, |
145 |
|
true, // continuousLayout |
146 |
|
rootPane, pianoKeyboardPane |
147 |
|
); |
148 |
|
|
149 |
|
pianoRollSplitPane.setResizeWeight(0.5); |
150 |
|
|
151 |
rootPane.setLayout(new BorderLayout()); |
rootPane.setLayout(new BorderLayout()); |
152 |
rootPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0)); |
rootPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0)); |
153 |
rootPane.setOpaque(false); |
rootPane.setOpaque(false); |
155 |
|
|
156 |
addMenu(); |
addMenu(); |
157 |
|
|
158 |
addChannelsPane(mainPane.getChannelsPane()); |
getContentPane().add(pianoRollSplitPane); |
|
|
|
|
getContentPane().add(rootPane); |
|
159 |
|
|
160 |
int i = preferences().getIntProperty("MainFrame.hSplitDividerLocation", 220); |
int i = preferences().getIntProperty("MainFrame.hSplitDividerLocation", 220); |
161 |
hSplitPane.setDividerLocation(i); |
hSplitPane.setDividerLocation(i); |
162 |
|
|
163 |
setSavedSize(); |
setSavedSize(); |
164 |
|
|
165 |
|
guiTimer.start(); |
166 |
} |
} |
167 |
|
|
168 |
private JPanel |
private JPanel |
175 |
|
|
176 |
c.fill = GridBagConstraints.BOTH; |
c.fill = GridBagConstraints.BOTH; |
177 |
|
|
|
spDevicesPane.setViewportView(devicesPane); |
|
|
spDevicesPane.setBorder(BorderFactory.createEmptyBorder()); |
|
|
int h = spDevicesPane.getMinimumSize().height; |
|
|
spDevicesPane.setMinimumSize(new Dimension(200, h)); |
|
|
|
|
178 |
c.gridx = 1; |
c.gridx = 1; |
179 |
c.gridy = 0; |
c.gridy = 0; |
180 |
c.weightx = 1.0; |
c.weightx = 1.0; |
181 |
c.weighty = 1.0; |
c.weighty = 1.0; |
182 |
c.insets = new Insets(0, 3, 3, 0); |
c.insets = new Insets(0, 3, 0, 0); |
183 |
gridbag.setConstraints(spDevicesPane, c); |
gridbag.setConstraints(rightSidePane, c); |
184 |
p.add(spDevicesPane); |
p.add(rightSidePane); |
185 |
|
|
186 |
c.gridx = 0; |
c.gridx = 0; |
187 |
c.gridy = 0; |
c.gridy = 0; |
188 |
c.weightx = 0.0; |
c.weightx = 0.0; |
189 |
c.weighty = 1.0; |
c.weighty = 1.0; |
190 |
c.insets = new Insets(0, 3, 3, 3); |
c.insets = new Insets(0, 3, 0, 3); |
191 |
c.fill = GridBagConstraints.VERTICAL; |
c.fill = GridBagConstraints.VERTICAL; |
192 |
gridbag.setConstraints(mainPane, c); |
gridbag.setConstraints(mainPane, c); |
193 |
p.add(mainPane); |
p.add(mainPane); |
241 |
/** Invoked when this window is about to close. */ |
/** Invoked when this window is about to close. */ |
242 |
protected void |
protected void |
243 |
onWindowClose() { |
onWindowClose() { |
244 |
sidePane.savePreferences(); |
boolean b = preferences().getBoolProperty(CONFIRM_APP_QUIT); |
245 |
|
if(b && CC.getSamplerModel().isModified()) { |
246 |
|
JSQuitDlg dlg = new JSQuitDlg(Res.iconQuestion32); |
247 |
|
dlg.setVisible(true); |
248 |
|
if(dlg.isCancelled()) return; |
249 |
|
} |
250 |
|
|
251 |
|
leftSidePane.savePreferences(); |
252 |
|
rightSidePane.savePreferences(); |
253 |
|
|
254 |
int i = hSplitPane.getDividerLocation(); |
int i = hSplitPane.getDividerLocation(); |
255 |
preferences().setIntProperty("MainFrame.hSplitDividerLocation", i); |
preferences().setIntProperty("MainFrame.hSplitDividerLocation", i); |
291 |
// Actions |
// Actions |
292 |
m = new FantasiaMenu(i18n.getMenuLabel("actions")); |
m = new FantasiaMenu(i18n.getMenuLabel("actions")); |
293 |
|
|
294 |
mi = new JMenuItem(a4n.connect); |
mi = new JMenuItem(a4n.refresh); |
295 |
mi.setIcon(null); |
mi.setIcon(null); |
296 |
//mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)); |
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); |
297 |
m.add(mi); |
m.add(mi); |
298 |
|
|
299 |
mi = new JMenuItem(a4n.samplerInfo); |
mi = new JMenuItem(a4n.samplerInfo); |
300 |
mi.setIcon(null); |
mi.setIcon(null); |
301 |
m.add(mi); |
m.add(mi); |
302 |
|
|
303 |
|
mi = new JMenuItem(a4n.resetSampler); |
304 |
|
mi.setIcon(null); |
305 |
|
m.add(mi); |
306 |
|
|
307 |
m.addSeparator(); |
m.addSeparator(); |
308 |
|
|
309 |
JMenu exportMenu = new JMenu(i18n.getMenuLabel("actions.export")); |
JMenu exportMenu = new JMenu(i18n.getMenuLabel("actions.export")); |
322 |
|
|
323 |
mi = new JMenuItem(a4n.loadScript); |
mi = new JMenuItem(a4n.loadScript); |
324 |
mi.setIcon(null); |
mi.setIcon(null); |
325 |
|
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_MASK)); |
326 |
m.add(mi); |
m.add(mi); |
327 |
|
|
328 |
String[] list = preferences().getStringListProperty(RECENT_LSCP_SCRIPTS); |
String[] list = preferences().getStringListProperty(RECENT_LSCP_SCRIPTS); |
334 |
|
|
335 |
m.addSeparator(); |
m.addSeparator(); |
336 |
|
|
337 |
|
mi = new JMenuItem(a4n.changeBackend); |
338 |
|
mi.setIcon(null); |
339 |
|
mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_MASK)); |
340 |
|
m.add(mi); |
341 |
|
|
342 |
|
m.addSeparator(); |
343 |
|
|
344 |
mi = new JMenuItem(i18n.getMenuLabel("actions.exit")); |
mi = new JMenuItem(i18n.getMenuLabel("actions.exit")); |
345 |
m.add(mi); |
m.add(mi); |
346 |
mi.addActionListener(new ActionListener() { |
mi.addActionListener(new ActionListener() { |
400 |
cbmiToolBarVisible.setSelected(b); |
cbmiToolBarVisible.setSelected(b); |
401 |
showToolBar(b); |
showToolBar(b); |
402 |
|
|
403 |
cbmiSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( |
cbmiLeftSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( |
404 |
KeyEvent.VK_L, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK |
KeyEvent.VK_L, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK |
405 |
)); |
)); |
406 |
m.add(cbmiSidePaneVisible); |
m.add(cbmiLeftSidePaneVisible); |
407 |
|
|
408 |
cbmiSidePaneVisible.addActionListener(new ActionListener() { |
cbmiLeftSidePaneVisible.addActionListener(new ActionListener() { |
409 |
public void |
public void |
410 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
411 |
showSidePane(cbmiSidePaneVisible.getState()); |
showSidePane(cbmiLeftSidePaneVisible.getState()); |
412 |
} |
} |
413 |
}); |
}); |
414 |
|
|
415 |
b = preferences().getBoolProperty("sidePane.visible"); |
b = preferences().getBoolProperty("leftSidePane.visible"); |
416 |
cbmiSidePaneVisible.setSelected(b); |
cbmiLeftSidePaneVisible.setSelected(b); |
417 |
showSidePane(b); |
showSidePane(b); |
418 |
|
|
419 |
cbmiDevicesPaneVisible.setAccelerator(KeyStroke.getKeyStroke ( |
cbmiRightSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( |
420 |
KeyEvent.VK_R, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK |
KeyEvent.VK_R, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK |
421 |
)); |
)); |
422 |
m.add(cbmiDevicesPaneVisible); |
m.add(cbmiRightSidePaneVisible); |
423 |
|
|
424 |
cbmiDevicesPaneVisible.addActionListener(new ActionListener() { |
cbmiRightSidePaneVisible.addActionListener(new ActionListener() { |
425 |
public void |
public void |
426 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
427 |
showDevicesPane(cbmiDevicesPaneVisible.getState()); |
showDevicesPane(cbmiRightSidePaneVisible.getState()); |
428 |
} |
} |
429 |
}); |
}); |
430 |
|
|
431 |
b = preferences().getBoolProperty("devicesPane.visible"); |
b = preferences().getBoolProperty("rightSidePane.visible"); |
432 |
cbmiDevicesPaneVisible.setSelected(b); |
cbmiRightSidePaneVisible.setSelected(b); |
433 |
showDevicesPane(b); |
showDevicesPane(b); |
434 |
|
|
435 |
|
m.addSeparator(); |
436 |
|
|
437 |
|
m.add(cbmiMidiKeyboardVisible); |
438 |
|
|
439 |
|
cbmiMidiKeyboardVisible.addActionListener(new ActionListener() { |
440 |
|
public void |
441 |
|
actionPerformed(ActionEvent e) { |
442 |
|
showMidiKeyboard(cbmiMidiKeyboardVisible.getState()); |
443 |
|
} |
444 |
|
}); |
445 |
|
|
446 |
|
b = preferences().getBoolProperty("midiKeyboard.visible"); |
447 |
|
cbmiMidiKeyboardVisible.setSelected(b); |
448 |
|
showMidiKeyboard(b); |
449 |
|
|
450 |
|
|
451 |
// Window |
// Window |
452 |
m = new FantasiaMenu(i18n.getMenuLabel("window")); |
m = new FantasiaMenu(i18n.getMenuLabel("window")); |
464 |
// Help |
// Help |
465 |
m = new FantasiaMenu(i18n.getMenuLabel("help")); |
m = new FantasiaMenu(i18n.getMenuLabel("help")); |
466 |
|
|
467 |
|
mi = new JMenuItem(a4n.browseOnlineTutorial); |
468 |
|
mi.setIcon(null); |
469 |
|
m.add(mi); |
470 |
|
|
471 |
|
m.addSeparator(); |
472 |
|
|
473 |
mi = new JMenuItem(a4n.helpAbout); |
mi = new JMenuItem(a4n.helpAbout); |
474 |
mi.setIcon(null); |
mi.setIcon(null); |
475 |
m.add(mi); |
m.add(mi); |
477 |
menuBar.add(m); |
menuBar.add(m); |
478 |
} |
} |
479 |
|
|
480 |
|
public RightSidePane |
481 |
|
getRightSidePane() { return rightSidePane; } |
482 |
|
|
483 |
/** |
/** |
484 |
* This method does nothing, because <b>Fantasia</b> has exactly |
* This method does nothing, because <b>Fantasia</b> has exactly |
485 |
* one pane containing sampler channels, which can not be changed. |
* one pane containing sampler channels, which can not be changed. |
529 |
dlg.setVisible(true); |
dlg.setVisible(true); |
530 |
} |
} |
531 |
|
|
532 |
|
/** |
533 |
|
* Gets the server address to which to connect. If the server should be |
534 |
|
* manually selected, a dialog asking the user to choose a server is displayed. |
535 |
|
*/ |
536 |
|
public Server |
537 |
|
getServer() { |
538 |
|
boolean b = preferences().getBoolProperty(MANUAL_SERVER_SELECT_ON_STARTUP); |
539 |
|
return getServer(b); |
540 |
|
} |
541 |
|
|
542 |
|
/** |
543 |
|
* Gets the server address to which to connect. If the server should be |
544 |
|
* manually selected, a dialog asking the user to choose a server is displayed. |
545 |
|
* @param manualSelect Determines whether the server should be manually selected. |
546 |
|
*/ |
547 |
|
public Server |
548 |
|
getServer(boolean manualSelect) { |
549 |
|
if(manualSelect) { |
550 |
|
JSConnectDlg dlg = new JSConnectDlg(); |
551 |
|
dlg.setVisible(true); |
552 |
|
return dlg.getSelectedServer(); |
553 |
|
} |
554 |
|
|
555 |
|
int i = preferences().getIntProperty(SERVER_INDEX); |
556 |
|
int size = CC.getServerList().getServerCount(); |
557 |
|
if(size == 0) return null; |
558 |
|
if(i >= size) return CC.getServerList().getServer(0); |
559 |
|
|
560 |
|
return CC.getServerList().getServer(i); |
561 |
|
} |
562 |
|
|
563 |
|
public Timer |
564 |
|
getGuiTimer() { return guiTimer; } |
565 |
|
|
566 |
protected LSConsoleModel |
protected LSConsoleModel |
567 |
getLSConsoleModel() { return getLSConsolePane().getModel(); } |
getLSConsoleModel() { return getLSConsolePane().getModel(); } |
568 |
|
|
574 |
protected LSConsoleFrame |
protected LSConsoleFrame |
575 |
getLSConsoleFrame() { return lsConsoleFrame; } |
getLSConsoleFrame() { return lsConsoleFrame; } |
576 |
|
|
577 |
protected void |
protected boolean |
578 |
runScript() { |
runScript() { |
579 |
String s = preferences().getStringProperty("lastScriptLocation"); |
String s = preferences().getStringProperty("lastScriptLocation"); |
580 |
JFileChooser fc = new JFileChooser(s); |
JFileChooser fc = new JFileChooser(s); |
581 |
fc.setFileFilter(new LscpFileFilter()); |
fc.setFileFilter(new LscpFileFilter()); |
582 |
int result = fc.showOpenDialog(this); |
int result = fc.showOpenDialog(this); |
583 |
if(result != JFileChooser.APPROVE_OPTION) return; |
if(result != JFileChooser.APPROVE_OPTION) return false; |
584 |
|
|
585 |
String path = fc.getCurrentDirectory().getAbsolutePath(); |
String path = fc.getCurrentDirectory().getAbsolutePath(); |
586 |
preferences().setStringProperty("lastScriptLocation", path); |
preferences().setStringProperty("lastScriptLocation", path); |
587 |
|
|
588 |
runScript(fc.getSelectedFile()); |
runScript(fc.getSelectedFile()); |
589 |
|
|
590 |
|
return true; |
591 |
} |
} |
592 |
|
|
593 |
private void |
private void |
655 |
|
|
656 |
private void |
private void |
657 |
showSidePane(boolean b) { |
showSidePane(boolean b) { |
658 |
preferences().setBoolProperty("sidePane.visible", b); |
preferences().setBoolProperty("leftSidePane.visible", b); |
659 |
rootPane.remove(rightPane); |
rootPane.remove(rightPane); |
660 |
rootPane.remove(hSplitPane); |
rootPane.remove(hSplitPane); |
661 |
|
|
687 |
|
|
688 |
private void |
private void |
689 |
showDevicesPane(boolean b) { |
showDevicesPane(boolean b) { |
690 |
preferences().setBoolProperty("devicesPane.visible", b); |
preferences().setBoolProperty("rightSidePane.visible", b); |
691 |
|
|
692 |
int width = sidePane.getWidth(); |
int width = leftSidePane.getWidth(); |
693 |
int height = sidePane.getPreferredSize().height; |
int height = leftSidePane.getPreferredSize().height; |
694 |
if(width != 0) sidePane.setPreferredSize(new Dimension(width, height)); |
if(width != 0) leftSidePane.setPreferredSize(new Dimension(width, height)); |
695 |
|
|
696 |
if(b) { |
if(b) { |
697 |
int w = preferences().getIntProperty("devicesPane.width", 200); |
int w = preferences().getIntProperty("devicesPane.width", 200); |
698 |
|
|
699 |
int h = spDevicesPane.getPreferredSize().height; |
int h = rightSidePane.getPreferredSize().height; |
700 |
spDevicesPane.setPreferredSize(new Dimension(w, h)); |
rightSidePane.setPreferredSize(new Dimension(w, h)); |
701 |
} else { |
} else { |
702 |
int w = spDevicesPane.getWidth(); |
int w = rightSidePane.getWidth(); |
703 |
if(w > 0 && w < 200) w = 200; |
if(w > 0 && w < 200) w = 200; |
704 |
if(w != 0) preferences().setIntProperty("devicesPane.width", w); |
if(w != 0) preferences().setIntProperty("devicesPane.width", w); |
705 |
} |
} |
706 |
|
|
707 |
hSplitPane.setResizeWeight(0.0); |
hSplitPane.setResizeWeight(0.0); |
708 |
spDevicesPane.setVisible(b); |
rightSidePane.setVisible(b); |
709 |
hSplitPane.resetToPreferredSizes(); |
hSplitPane.resetToPreferredSizes(); |
710 |
|
|
711 |
int w = getPreferredSize().width; |
int w = getPreferredSize().width; |
723 |
} |
} |
724 |
|
|
725 |
private void |
private void |
726 |
|
showMidiKeyboard(boolean b) { |
727 |
|
preferences().setBoolProperty("midiKeyboard.visible", b); |
728 |
|
if(b) { |
729 |
|
getContentPane().remove(rootPane); |
730 |
|
pianoRollSplitPane.setTopComponent(rootPane); |
731 |
|
getContentPane().add(pianoRollSplitPane); |
732 |
|
} else { |
733 |
|
getContentPane().remove(pianoRollSplitPane); |
734 |
|
pianoRollSplitPane.remove(rootPane); |
735 |
|
getContentPane().add(rootPane); |
736 |
|
} |
737 |
|
|
738 |
|
getContentPane().validate(); |
739 |
|
getContentPane().repaint(); |
740 |
|
} |
741 |
|
|
742 |
|
private void |
743 |
sidePanesVisibilityChanged() { |
sidePanesVisibilityChanged() { |
744 |
boolean sidePaneVisible = cbmiSidePaneVisible.isSelected(); |
boolean leftSidePaneVisible = cbmiLeftSidePaneVisible.isSelected(); |
745 |
boolean devicesPaneVisible = cbmiDevicesPaneVisible.isSelected(); |
boolean rightSidePaneVisible = cbmiRightSidePaneVisible.isSelected(); |
746 |
|
|
747 |
if(sidePaneVisible && devicesPaneVisible) { |
if(leftSidePaneVisible && rightSidePaneVisible) { |
748 |
hSplitPane.setResizeWeight(0.5); |
hSplitPane.setResizeWeight(0.5); |
749 |
} else if(sidePaneVisible && !devicesPaneVisible) { |
} else if(leftSidePaneVisible && !rightSidePaneVisible) { |
750 |
hSplitPane.setResizeWeight(1.0); |
hSplitPane.setResizeWeight(1.0); |
751 |
} |
} |
752 |
|
|
753 |
if(!sidePaneVisible && !devicesPaneVisible) { |
if(!leftSidePaneVisible && !rightSidePaneVisible) { |
754 |
standardBar.showFantasiaLogo(false); |
standardBar.showFantasiaLogo(false); |
755 |
if(isResizable()) setResizable(false); |
if(isResizable()) setResizable(false); |
756 |
} else { |
} else { |
778 |
super(s); |
super(s); |
779 |
setFont(getFont().deriveFont(java.awt.Font.BOLD)); |
setFont(getFont().deriveFont(java.awt.Font.BOLD)); |
780 |
setOpaque(false); |
setOpaque(false); |
781 |
|
setContentAreaFilled(false); |
782 |
} |
} |
783 |
} |
} |
784 |
|
|