/[svn]/jsampler/trunk/src/org/jsampler/view/fantasia/DevicesPane.java
ViewVC logotype

Annotation of /jsampler/trunk/src/org/jsampler/view/fantasia/DevicesPane.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1778 - (hide annotations) (download)
Sun Sep 28 20:38:36 2008 UTC (15 years, 7 months ago) by iliev
File size: 3723 byte(s)
* Fantasia: Improved look and feel
* Fantasia: Added buttons for increasing/decreasing the key number
  of the MIDI keyboard (Ctrl+Up Arrow/Ctrl+Down Arrow)
* Fantasia: Added buttons for scrolling left/right on the MIDI keyboard
  (Ctrl+Left Arrow/Ctrl+Right Arrow)
* Added key bindings for triggering MIDI notes using the computer keyboard
  (from a to ' for the white keys and from 0 to 7 for changing the octaves)
* Notes are now triggered when dragging the mouse over the MIDI keyboard

1 iliev 1286 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4 iliev 1767 * Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com>
5 iliev 1286 *
6     * This file is part of JSampler.
7     *
8     * JSampler is free software; you can redistribute it and/or modify
9     * it under the terms of the GNU General Public License version 2
10     * as published by the Free Software Foundation.
11     *
12     * JSampler is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with JSampler; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20     * MA 02111-1307 USA
21     */
22    
23     package org.jsampler.view.fantasia;
24    
25     import java.awt.BorderLayout;
26     import java.awt.Dimension;
27     import java.awt.Graphics;
28     import java.awt.Insets;
29    
30     import java.beans.PropertyChangeEvent;
31     import java.beans.PropertyChangeListener;
32    
33 iliev 1729 import javax.swing.BorderFactory;
34 iliev 1286 import javax.swing.JPanel;
35    
36 iliev 1778 import org.jdesktop.swingx.JXTaskPane;
37    
38 iliev 1286 import org.jvnet.substance.SubstanceLookAndFeel;
39 iliev 1743 import org.jvnet.substance.api.SubstanceConstants.FocusKind;
40     import org.jvnet.substance.shaper.ClassicButtonShaper;
41 iliev 1286
42     import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
43     import static org.jsampler.view.fantasia.FantasiaPrefs.*;
44    
45     /**
46     *
47     * @author Grigor Iliev
48     */
49 iliev 1778 public class DevicesPane extends FantasiaPanel {
50 iliev 1729 private final TaskPaneContainer taskPaneContainer = new TaskPaneContainer();
51 iliev 1778 private final JXTaskPane midiDevicesTaskPane = new FantasiaTaskPane();
52     private final JXTaskPane audioDevicesTaskPane = new FantasiaTaskPane();
53 iliev 1286
54 iliev 1767 private final MidiDevicesPane midiDevicesPane = new MidiDevicesPane();
55     private final AudioDevicesPane audioDevicesPane = new AudioDevicesPane();
56    
57 iliev 1286 /** Creates a new instance of <code>DevicesPane</code> */
58     public
59     DevicesPane() {
60 iliev 1729 setOpaque(false);
61 iliev 1286 setLayout(new BorderLayout());
62     midiDevicesTaskPane.setTitle(i18n.getLabel("DevicesPane.midiDevicesTaskPane"));
63     midiDevicesTaskPane.setAnimated(preferences().getBoolProperty(ANIMATED));
64    
65     preferences().addPropertyChangeListener(ANIMATED, new PropertyChangeListener() {
66     public void
67     propertyChange(PropertyChangeEvent e) {
68     boolean b = preferences().getBoolProperty(ANIMATED);
69     midiDevicesTaskPane.setAnimated(b);
70     }
71     });
72    
73     audioDevicesTaskPane.setTitle(i18n.getLabel("DevicesPane.audioDevicesTaskPane"));
74     audioDevicesTaskPane.setAnimated(preferences().getBoolProperty(ANIMATED));
75    
76     preferences().addPropertyChangeListener(ANIMATED, new PropertyChangeListener() {
77     public void
78     propertyChange(PropertyChangeEvent e) {
79     boolean b = preferences().getBoolProperty(ANIMATED);
80     audioDevicesTaskPane.setAnimated(b);
81     }
82     });
83    
84     midiDevicesTaskPane.putClientProperty (
85     SubstanceLookAndFeel.FOCUS_KIND, FocusKind.NONE
86     );
87    
88     taskPaneContainer.putClientProperty (
89     SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new ClassicButtonShaper()
90     );
91    
92     taskPaneContainer.add(midiDevicesTaskPane);
93     taskPaneContainer.add(audioDevicesTaskPane);
94 iliev 1729 taskPaneContainer.setBorder(BorderFactory.createEmptyBorder());
95 iliev 1286 add(taskPaneContainer);
96    
97 iliev 1778 FantasiaSubPanel fsp = new FantasiaSubPanel(false, true, false);
98     fsp.add(midiDevicesPane);
99     midiDevicesTaskPane.add(fsp);
100 iliev 1286
101 iliev 1778 fsp = new FantasiaSubPanel(false, true, false);
102     fsp.add(audioDevicesPane);
103     audioDevicesTaskPane.add(fsp);
104    
105 iliev 1286 taskPaneContainer.setOpaque(false);
106     }
107 iliev 1767
108     public MidiDevicesPane
109     getMidiDevicesPane() { return midiDevicesPane; }
110    
111     public AudioDevicesPane
112     getAudioDevicesPane() { return audioDevicesPane; }
113 iliev 1286 }

  ViewVC Help
Powered by ViewVC