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.Timer; |
import javax.swing.Timer; |
|
import javax.swing.UIManager; |
|
|
|
|
|
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; |
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; |
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 PianoKeyboardPane pianoKeyboardPane; |
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 LeftSidePane leftSidePane = new LeftSidePane(); |
private final LeftSidePane leftSidePane = new LeftSidePane(); |
96 |
private final RightSidePane rightSidePane = new RightSidePane(); |
private final RightSidePane rightSidePane = new RightSidePane(); |
111 |
private final JCheckBoxMenuItem cbmiRightSidePaneVisible = |
private final JCheckBoxMenuItem cbmiRightSidePaneVisible = |
112 |
new JCheckBoxMenuItem(i18n.getMenuLabel("view.rightSidePane")); |
new JCheckBoxMenuItem(i18n.getMenuLabel("view.rightSidePane")); |
113 |
|
|
114 |
|
private final JCheckBoxMenuItem cbmiMidiKeyboardVisible = |
115 |
|
new JCheckBoxMenuItem(i18n.getMenuLabel("view.midiKeyboard")); |
116 |
|
|
117 |
private final Timer guiTimer = new Timer(1000, null); |
private final Timer guiTimer = new Timer(1000, null); |
118 |
|
|
119 |
/** Creates a new instance of <code>MainFrame</code> */ |
/** Creates a new instance of <code>MainFrame</code> */ |
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); |
432 |
cbmiRightSidePaneVisible.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")); |
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 leftSidePaneVisible = cbmiLeftSidePaneVisible.isSelected(); |
boolean leftSidePaneVisible = cbmiLeftSidePaneVisible.isSelected(); |
745 |
boolean rightSidePaneVisible = cbmiRightSidePaneVisible.isSelected(); |
boolean rightSidePaneVisible = cbmiRightSidePaneVisible.isSelected(); |
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 |
|
|