--- jsampler/trunk/src/org/jsampler/view/fantasia/MainFrame.java 2007/09/17 23:55:27 1355 +++ jsampler/trunk/src/org/jsampler/view/fantasia/MainFrame.java 2008/10/08 22:38:15 1786 @@ -1,7 +1,7 @@ /* * JSampler - a java front-end for LinuxSampler * - * Copyright (C) 2005-2007 Grigor Iliev + * Copyright (C) 2005-2008 Grigor Iliev * * This file is part of JSampler. * @@ -23,20 +23,25 @@ package org.jsampler.view.fantasia; import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Composite; import java.awt.Dialog; import java.awt.Dimension; import java.awt.Frame; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; -import java.awt.Point; +import java.awt.Paint; +import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.io.BufferedReader; import java.io.File; @@ -44,41 +49,39 @@ import java.io.FileReader; import java.util.Vector; -import java.util.logging.Level; import javax.swing.BorderFactory; -import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JCheckBoxMenuItem; -import javax.swing.JComponent; -import javax.swing.JDialog; import javax.swing.JFileChooser; -import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JScrollPane; import javax.swing.JSplitPane; -import javax.swing.JToggleButton; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; -import javax.swing.UIManager; - -import net.sf.juife.TitleBar; +import javax.swing.Timer; import org.jsampler.CC; import org.jsampler.HF; import org.jsampler.LSConsoleModel; +import org.jsampler.Server; -import org.jsampler.view.JSChannel; import org.jsampler.view.JSChannelsPane; import org.jsampler.view.JSMainFrame; import org.jsampler.view.LscpFileFilter; +import org.jsampler.view.fantasia.basic.FantasiaPainter; +import org.jsampler.view.fantasia.basic.FantasiaPanel; +import org.jsampler.view.fantasia.basic.FantasiaSubPanel; + +import org.jsampler.view.std.JSBackendLogFrame; +import org.jsampler.view.std.JSConnectDlg; import org.jsampler.view.std.JSDetailedErrorDlg; +import org.jsampler.view.std.JSQuitDlg; import org.jsampler.view.std.JSamplerHomeChooser; +import org.jsampler.view.std.StdUtils; import static org.jsampler.view.fantasia.A4n.a4n; import static org.jsampler.view.fantasia.FantasiaI18n.i18n; @@ -93,39 +96,56 @@ public class MainFrame extends JSMainFrame { private final StandardBar standardBar = new StandardBar(); private final FantasiaMenuBar menuBar = new FantasiaMenuBar(); - private final JPanel rootPane = new JPanel(); - private final MainPane mainPane = new MainPane(); - private final DevicesPane devicesPane = new DevicesPane(); - private final JScrollPane spDevicesPane = new JScrollPane(); + private final JPanel rootPane = new RootPane(); + private final BottomPane bottomPane; + private final MainPane mainPane; + private final PianoKeyboardPane pianoKeyboardPane; private final JMenu recentScriptsMenu = new JMenu(i18n.getMenuLabel("actions.recentScripts")); private final JSplitPane hSplitPane; - private final SidePane sidePane = new SidePane(); + private final LeftSidePane leftSidePane; + private final RightSidePane rightSidePane; private final JPanel rightPane; + //private final StatusBar statusBar = new StatusBar(); + private final LSConsoleFrame lsConsoleFrame = new LSConsoleFrame(); private final Vector recentScripts = new Vector(); + + private final JSBackendLogFrame backendLogFrame = new JSBackendLogFrame(); private final JCheckBoxMenuItem cbmiToolBarVisible = new JCheckBoxMenuItem(i18n.getMenuLabel("view.toolBar")); - private final JCheckBoxMenuItem cbmiSidePaneVisible = - new JCheckBoxMenuItem(i18n.getMenuLabel("view.sidePane")); + private final JCheckBoxMenuItem cbmiLeftSidePaneVisible = + new JCheckBoxMenuItem(i18n.getMenuLabel("view.leftSidePane")); - private final JCheckBoxMenuItem cbmiDevicesPaneVisible = - new JCheckBoxMenuItem(i18n.getMenuLabel("view.devicesPane")); + private final JCheckBoxMenuItem cbmiRightSidePaneVisible = + new JCheckBoxMenuItem(i18n.getMenuLabel("view.rightSidePane")); + + private final JCheckBoxMenuItem cbmiMidiKeyboardVisible = + new JCheckBoxMenuItem(i18n.getMenuLabel("view.midiKeyboard")); + + private final Timer guiTimer = new Timer(1000, null); /** Creates a new instance of MainFrame */ public MainFrame() { setTitle(i18n.getLabel("MainFrame.title")); - + //setUndecorated(true); if(Res.iconAppIcon != null) setIconImage(Res.iconAppIcon.getImage()); + CC.setMainFrame(this); // TODO: + mainPane = new MainPane(); + leftSidePane = new LeftSidePane(); + rightSidePane = new RightSidePane(); + + setSelectedChannelsPane(mainPane.getChannelsPane(0)); + getContentPane().add(standardBar, BorderLayout.NORTH); rightPane = createRightPane(); @@ -133,30 +153,53 @@ hSplitPane = new JSplitPane ( JSplitPane.HORIZONTAL_SPLIT, true, // continuousLayout - sidePane, rightPane + leftSidePane, rightPane ); hSplitPane.setResizeWeight(0.5); - rootPane.setLayout(new BorderLayout()); - rootPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0)); - rootPane.setOpaque(false); - rootPane.add(hSplitPane); + pianoKeyboardPane = new PianoKeyboardPane(); - addMenu(); + for(int i = 0; i < mainPane.getChannelsPaneCount(); i++) { + addChannelsPane(mainPane.getChannelsPane(i)); + getChannelsPane(i).addListSelectionListener(pianoKeyboardPane); + } + + + int h = preferences().getIntProperty("midiKeyboard.height"); + setMidiKeyboardHeight(h); + + PropertyChangeListener l = new PropertyChangeListener() { + public void + propertyChange(PropertyChangeEvent e) { + int h = preferences().getIntProperty("midiKeyboard.height"); + setMidiKeyboardHeight(h); + } + }; - addChannelsPane(mainPane.getChannelsPane()); + CC.preferences().addPropertyChangeListener("midiKeyboard.height", l); - getContentPane().add(rootPane); + bottomPane = new BottomPane(); + + hSplitPane.setOpaque(false); + rootPane.add(hSplitPane); + rootPane.add(bottomPane, BorderLayout.SOUTH); + add(rootPane); + + addMenu(); int i = preferences().getIntProperty("MainFrame.hSplitDividerLocation", 220); hSplitPane.setDividerLocation(i); setSavedSize(); + + guiTimer.start(); } private JPanel createRightPane() { - JPanel p = new JPanel(); + JPanel p = new FantasiaPanel(); + p.setOpaque(false); + GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); @@ -164,24 +207,19 @@ c.fill = GridBagConstraints.BOTH; - spDevicesPane.setViewportView(devicesPane); - spDevicesPane.setBorder(BorderFactory.createEmptyBorder()); - int h = spDevicesPane.getMinimumSize().height; - spDevicesPane.setMinimumSize(new Dimension(200, h)); - c.gridx = 1; c.gridy = 0; c.weightx = 1.0; c.weighty = 1.0; - c.insets = new Insets(0, 3, 3, 0); - gridbag.setConstraints(spDevicesPane, c); - p.add(spDevicesPane); + c.insets = new Insets(0, 3, 0, 0); + gridbag.setConstraints(rightSidePane, c); + p.add(rightSidePane); c.gridx = 0; c.gridy = 0; c.weightx = 0.0; c.weighty = 1.0; - c.insets = new Insets(0, 3, 3, 3); + c.insets = new Insets(0, 0, 0, 3); c.fill = GridBagConstraints.VERTICAL; gridbag.setConstraints(mainPane, c); p.add(mainPane); @@ -191,37 +229,13 @@ private void setSavedSize() { - String s = preferences().getStringProperty("MainFrame.sizeAndLocation"); - if(s == null) { + Rectangle r = StdUtils.getWindowBounds("MainFrame"); + if(r == null) { setDefaultSizeAndLocation(); return; } - 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(); - } - if(preferences().getBoolProperty("MainFrame.windowMaximized")) { - setExtendedState(getExtendedState() | MAXIMIZED_BOTH); - } + setBounds(r); } private void @@ -233,9 +247,18 @@ /** Invoked when this window is about to close. */ + @Override protected void onWindowClose() { - sidePane.savePreferences(); + boolean b = preferences().getBoolProperty(CONFIRM_APP_QUIT); + if(b && CC.getSamplerModel().isModified()) { + JSQuitDlg dlg = new JSQuitDlg(Res.iconQuestion32); + dlg.setVisible(true); + if(dlg.isCancelled()) return; + } + + leftSidePane.savePreferences(); + rightSidePane.savePreferences(); int i = hSplitPane.getDividerLocation(); preferences().setIntProperty("MainFrame.hSplitDividerLocation", i); @@ -250,12 +273,7 @@ return; } - java.awt.Point p = getLocation(); - 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()); + StdUtils.saveWindowBounds("MainFrame", getBounds()); String[] list = recentScripts.toArray(new String[recentScripts.size()]); preferences().setStringListProperty(RECENT_LSCP_SCRIPTS, list); @@ -264,9 +282,24 @@ if(lsConsoleFrame != null) getLSConsolePane().saveConsoleHistory(); } + if(getBackendLogFrame() != null) getBackendLogFrame().stopTimer(); + if(getLSConsolePane() != null) getLSConsolePane().disconnect(); + super.onWindowClose(); } + @Override + public void + setVisible(boolean b) { + if(b == isVisible()) return; + + super.setVisible(b); + + if(b && preferences().getBoolProperty("MainFrame.windowMaximized")) { + setExtendedState(getExtendedState() | MAXIMIZED_BOTH); + } + } + private void addMenu() { JMenu m; @@ -277,15 +310,19 @@ // Actions m = new FantasiaMenu(i18n.getMenuLabel("actions")); - mi = new JMenuItem(a4n.connect); + mi = new JMenuItem(a4n.refresh); mi.setIcon(null); - //mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_MASK)); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); m.add(mi); mi = new JMenuItem(a4n.samplerInfo); mi.setIcon(null); m.add(mi); + mi = new JMenuItem(a4n.resetSampler); + mi.setIcon(null); + m.add(mi); + m.addSeparator(); JMenu exportMenu = new JMenu(i18n.getMenuLabel("actions.export")); @@ -304,6 +341,7 @@ mi = new JMenuItem(a4n.loadScript); mi.setIcon(null); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_MASK)); m.add(mi); String[] list = preferences().getStringListProperty(RECENT_LSCP_SCRIPTS); @@ -315,6 +353,13 @@ m.addSeparator(); + mi = new JMenuItem(a4n.changeBackend); + mi.setIcon(null); + mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_MASK)); + m.add(mi); + + m.addSeparator(); + mi = new JMenuItem(i18n.getMenuLabel("actions.exit")); m.add(mi); mi.addActionListener(new ActionListener() { @@ -374,38 +419,53 @@ cbmiToolBarVisible.setSelected(b); showToolBar(b); - cbmiSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( + cbmiLeftSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( KeyEvent.VK_L, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK )); - m.add(cbmiSidePaneVisible); + m.add(cbmiLeftSidePaneVisible); - cbmiSidePaneVisible.addActionListener(new ActionListener() { + cbmiLeftSidePaneVisible.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - showSidePane(cbmiSidePaneVisible.getState()); + showSidePane(cbmiLeftSidePaneVisible.getState()); } }); - b = preferences().getBoolProperty("sidePane.visible"); - cbmiSidePaneVisible.setSelected(b); + b = preferences().getBoolProperty("leftSidePane.visible"); + cbmiLeftSidePaneVisible.setSelected(b); showSidePane(b); - cbmiDevicesPaneVisible.setAccelerator(KeyStroke.getKeyStroke ( + cbmiRightSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke ( KeyEvent.VK_R, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK )); - m.add(cbmiDevicesPaneVisible); + m.add(cbmiRightSidePaneVisible); - cbmiDevicesPaneVisible.addActionListener(new ActionListener() { + cbmiRightSidePaneVisible.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - showDevicesPane(cbmiDevicesPaneVisible.getState()); + showDevicesPane(cbmiRightSidePaneVisible.getState()); } }); - b = preferences().getBoolProperty("devicesPane.visible"); - cbmiDevicesPaneVisible.setSelected(b); + b = preferences().getBoolProperty("rightSidePane.visible"); + cbmiRightSidePaneVisible.setSelected(b); showDevicesPane(b); + m.addSeparator(); + + m.add(cbmiMidiKeyboardVisible); + + cbmiMidiKeyboardVisible.addActionListener(new ActionListener() { + public void + actionPerformed(ActionEvent e) { + setMidiKeyboardVisible(cbmiMidiKeyboardVisible.getState()); + } + }); + + b = preferences().getBoolProperty("midiKeyboard.visible"); + cbmiMidiKeyboardVisible.setSelected(b); + setMidiKeyboardVisible(b); + // Window m = new FantasiaMenu(i18n.getMenuLabel("window")); @@ -419,10 +479,40 @@ mi.setIcon(null); m.add(mi); + m.addSeparator(); + + final JMenuItem mi2 = new JMenuItem(i18n.getMenuLabel("window.backendLog")); + m.add(mi2); + mi2.addActionListener(new ActionListener() { + public void + actionPerformed(ActionEvent e) { + if(getBackendLogFrame().isVisible()) { + getBackendLogFrame().setVisible(false); + } + + getBackendLogFrame().setVisible(true); + } + }); + + mi2.setEnabled(CC.getBackendProcess() != null); + + CC.addBackendProcessListener(new ActionListener() { + public void + actionPerformed(ActionEvent e) { + mi2.setEnabled(CC.getBackendProcess() != null); + } + }); + // Help m = new FantasiaMenu(i18n.getMenuLabel("help")); + mi = new JMenuItem(a4n.browseOnlineTutorial); + mi.setIcon(null); + m.add(mi); + + m.addSeparator(); + mi = new JMenuItem(a4n.helpAbout); mi.setIcon(null); m.add(mi); @@ -430,30 +520,31 @@ menuBar.add(m); } + public RightSidePane + getRightSidePane() { return rightSidePane; } + /** - * This method does nothing, because Fantasia has exactly - * one pane containing sampler channels, which can not be changed. + * This method does nothing, because Fantasia has constant + * number of panes containing sampler channels, which can not be changed. */ + @Override public void insertChannelsPane(JSChannelsPane pane, int idx) { } - /** - * This method always returns the JSChannelsPane at index 0, - * because the Fantasia view has exactly one pane containing sampler channels. - * @return The JSChannelsPane at index 0. - */ + @Override public JSChannelsPane - getSelectedChannelsPane() { return getChannelsPane(0); } + getSelectedChannelsPane() { return mainPane.getSelectedChannelsPane(); } - /** - * This method does nothing because the Fantasia view has - * exactly one pane containing sampler channels which is always shown. - */ + @Override public void - setSelectedChannelsPane(JSChannelsPane pane) { } + setSelectedChannelsPane(JSChannelsPane pane) { + mainPane.setSelectedChannelsPane(pane); + fireChannelsPaneSelectionChanged(); + } + @Override public void installJSamplerHome() { JSamplerHomeChooser chooser = new JSamplerHomeChooser(this); @@ -463,6 +554,7 @@ CC.changeJSamplerHome(chooser.getJSamplerHome()); } + @Override public void showDetailedErrorMessage(Frame owner, String err, String details) { JSDetailedErrorDlg dlg = new JSDetailedErrorDlg ( @@ -471,6 +563,7 @@ dlg.setVisible(true); } + @Override public void showDetailedErrorMessage(Dialog owner, String err, String details) { JSDetailedErrorDlg dlg = new JSDetailedErrorDlg ( @@ -479,6 +572,43 @@ dlg.setVisible(true); } + /** + * Gets the server address to which to connect. If the server should be + * manually selected, a dialog asking the user to choose a server is displayed. + */ + @Override + public Server + getServer() { + boolean b = preferences().getBoolProperty(MANUAL_SERVER_SELECT_ON_STARTUP); + return getServer(b); + } + + /** + * Gets the server address to which to connect. If the server should be + * manually selected, a dialog asking the user to choose a server is displayed. + * @param manualSelect Determines whether the server should be manually selected. + */ + @Override + public Server + getServer(boolean manualSelect) { + if(manualSelect) { + JSConnectDlg dlg = new JSConnectDlg(); + dlg.setVisible(true); + + return dlg.getSelectedServer(); + } + + int i = preferences().getIntProperty(SERVER_INDEX); + int size = CC.getServerList().getServerCount(); + if(size == 0) return null; + if(i >= size) return CC.getServerList().getServer(0); + + return CC.getServerList().getServer(i); + } + + public Timer + getGuiTimer() { return guiTimer; } + protected LSConsoleModel getLSConsoleModel() { return getLSConsolePane().getModel(); } @@ -490,21 +620,27 @@ protected LSConsoleFrame getLSConsoleFrame() { return lsConsoleFrame; } - protected void + public JSBackendLogFrame + getBackendLogFrame() { return backendLogFrame; } + + protected boolean runScript() { String s = preferences().getStringProperty("lastScriptLocation"); JFileChooser fc = new JFileChooser(s); fc.setFileFilter(new LscpFileFilter()); int result = fc.showOpenDialog(this); - if(result != JFileChooser.APPROVE_OPTION) return; + if(result != JFileChooser.APPROVE_OPTION) return false; String path = fc.getCurrentDirectory().getAbsolutePath(); preferences().setStringProperty("lastScriptLocation", path); runScript(fc.getSelectedFile()); + + return true; } - private void + @Override + public void runScript(String script) { runScript(new File(script)); } private void @@ -569,7 +705,7 @@ private void showSidePane(boolean b) { - preferences().setBoolProperty("sidePane.visible", b); + preferences().setBoolProperty("leftSidePane.visible", b); rootPane.remove(rightPane); rootPane.remove(hSplitPane); @@ -601,25 +737,25 @@ private void showDevicesPane(boolean b) { - preferences().setBoolProperty("devicesPane.visible", b); + preferences().setBoolProperty("rightSidePane.visible", b); - int width = sidePane.getWidth(); - int height = sidePane.getPreferredSize().height; - if(width != 0) sidePane.setPreferredSize(new Dimension(width, height)); + int width = leftSidePane.getWidth(); + int height = leftSidePane.getPreferredSize().height; + if(width != 0) leftSidePane.setPreferredSize(new Dimension(width, height)); if(b) { int w = preferences().getIntProperty("devicesPane.width", 200); - int h = spDevicesPane.getPreferredSize().height; - spDevicesPane.setPreferredSize(new Dimension(w, h)); + int h = rightSidePane.getPreferredSize().height; + rightSidePane.setPreferredSize(new Dimension(w, h)); } else { - int w = spDevicesPane.getWidth(); + int w = rightSidePane.getWidth(); if(w > 0 && w < 200) w = 200; if(w != 0) preferences().setIntProperty("devicesPane.width", w); } hSplitPane.setResizeWeight(0.0); - spDevicesPane.setVisible(b); + rightSidePane.setVisible(b); hSplitPane.resetToPreferredSizes(); int w = getPreferredSize().width; @@ -636,18 +772,49 @@ }); } + public void + setMidiKeyboardVisible(boolean b) { + preferences().setBoolProperty("midiKeyboard.visible", b); + pianoKeyboardPane.setVisible(b); + + if(cbmiMidiKeyboardVisible.isSelected() != b) { + cbmiMidiKeyboardVisible.setSelected(b); + } + + if(standardBar.btnMidiKeyboard.isSelected() != b) { + standardBar.btnMidiKeyboard.setSelected(b); + } + + if(pianoKeyboardPane.btnPower.isSelected() != b) { + pianoKeyboardPane.btnPower.setSelected(b); + } + + rootPane.validate(); + rootPane.repaint(); + } + + public void + setMidiKeyboardHeight(int height) { + Dimension d = pianoKeyboardPane.getPreferredSize(); + d = new Dimension(d.width, height); + pianoKeyboardPane.setPreferredSize(d); + pianoKeyboardPane.setMinimumSize(d); + pianoKeyboardPane.revalidate(); + pianoKeyboardPane.repaint(); + } + private void sidePanesVisibilityChanged() { - boolean sidePaneVisible = cbmiSidePaneVisible.isSelected(); - boolean devicesPaneVisible = cbmiDevicesPaneVisible.isSelected(); + boolean leftSidePaneVisible = cbmiLeftSidePaneVisible.isSelected(); + boolean rightSidePaneVisible = cbmiRightSidePaneVisible.isSelected(); - if(sidePaneVisible && devicesPaneVisible) { + if(leftSidePaneVisible && rightSidePaneVisible) { hSplitPane.setResizeWeight(0.5); - } else if(sidePaneVisible && !devicesPaneVisible) { + } else if(leftSidePaneVisible && !rightSidePaneVisible) { hSplitPane.setResizeWeight(1.0); } - if(!sidePaneVisible && !devicesPaneVisible) { + if(!leftSidePaneVisible && !rightSidePaneVisible) { standardBar.showFantasiaLogo(false); if(isResizable()) setResizable(false); } else { @@ -661,6 +828,7 @@ RecentScriptHandler(String script) { this.script = script; } + @Override public void actionPerformed(ActionEvent e) { runScript(script); @@ -675,25 +843,82 @@ super(s); setFont(getFont().deriveFont(java.awt.Font.BOLD)); setOpaque(false); + setContentAreaFilled(false); } } private class FantasiaMenuBar extends JMenuBar { - private Insets pixmapInsets = new Insets(6, 6, 0, 6); - private Insets pixmapInsets2 = new Insets(6, 6, 6, 6); - FantasiaMenuBar() { setOpaque(false); + setBorder(BorderFactory.createEmptyBorder(2, 6, 0, 0)); } + @Override protected void paintComponent(Graphics g) { - super.paintComponent(g); + //super.paintComponent(g); + Graphics2D g2 = (Graphics2D)g; + + Paint oldPaint = g2.getPaint(); + Composite oldComposite = g2.getComposite(); + + double h = getSize().getHeight(); + double w = getSize().getWidth(); + + FantasiaPainter.paintGradient(g2, 0.0, 0.0, w - 1, h - 1, FantasiaPainter.color6, FantasiaPainter.color5); + + FantasiaPainter.Border b; + + if(standardBar.isVisible()) { - PixmapPane.paintComponent(this, g, Res.gfxMenuBarBg, pixmapInsets); + b = new FantasiaPainter.Border(true, true, false, true); + FantasiaPainter.paintBoldOuterBorder(g2, 0, 0, w - 1, h + 1, b); } else { - PixmapPane.paintComponent(this, g, Res.gfxRoundBg14, pixmapInsets2); + b = new FantasiaPainter.Border(true, true, true, true); + FantasiaPainter.paintBoldOuterBorder(g2, 0, 0, w - 1, h - 1, b); } + + g2.setPaint(oldPaint); + g2.setComposite(oldComposite); + } + } + + class RootPane extends FantasiaSubPanel { + private final Color color1 = new Color(0x454545); + private final Color color2 = new Color(0x2e2e2e); + + RootPane() { + setLayout(new BorderLayout()); + setBorder(BorderFactory.createEmptyBorder(9, 10, 6, 10)); + setOpaque(false); + + } + + @Override + public void + paintComponent(Graphics g) { + Graphics2D g2 = (Graphics2D)g; + + Paint oldPaint = g2.getPaint(); + Composite oldComposite = g2.getComposite(); + + double h = getSize().getHeight(); + double w = getSize().getWidth(); + + FantasiaPainter.paintBorder(g2, 0, -3, w - 1, h - 1, 6, false); + paintComponent(g2, 5, 1, w - 10, h - 6, color1, color2); + + g2.setPaint(oldPaint); + g2.setComposite(oldComposite); + } + } + + class BottomPane extends FantasiaPanel { + BottomPane() { + setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + setOpaque(false); + add(pianoKeyboardPane); + } } }