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

Contents of /jsampler/trunk/src/org/jsampler/view/fantasia/RightSidePane.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1729 - (show annotations) (download)
Tue Apr 29 22:22:40 2008 UTC (16 years ago) by iliev
File size: 3739 byte(s)
* Added support for handling lost files in the Instruments Database
  (In the Instruments Database window choose Actions/Check For Lost Files)
* Fantasia: Added option to show the Instruments Database
  on the Right-Side Pane of the Fantasia's main window
  (choose Edit/Preferences, then click the `View' tab)
* Added new menu item in the Instruments Database window: Edit/Find
* Some minor bugfixes and enhancements

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com>
5 *
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
28 import java.beans.PropertyChangeEvent;
29 import java.beans.PropertyChangeListener;
30
31 import javax.swing.BorderFactory;
32 import javax.swing.JScrollPane;
33 import javax.swing.JTabbedPane;
34
35 import javax.swing.event.ChangeEvent;
36 import javax.swing.event.ChangeListener;
37
38 import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
39 import static org.jsampler.view.fantasia.FantasiaPrefs.preferences;
40
41
42 /**
43 *
44 * @author Grigor Iliev
45 */
46 public class RightSidePane extends PixmapPane {
47 private JTabbedPane tabbedPane = new JTabbedPane();
48 private InstrumentsDbPane instrumentsDbPane = null;
49 private final DevicesPane devicesPane = new DevicesPane();
50 private final JScrollPane spDevicesPane = new JScrollPane();
51
52
53 /**
54 * Creates a new instance of <code>RightSidePane</code>
55 */
56 public
57 RightSidePane() {
58 super(Res.gfxRoundBg14);
59 setOpaque(false);
60 setPixmapInsets(new java.awt.Insets(6, 6, 6, 6));
61 setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
62 setLayout(new BorderLayout());
63
64 spDevicesPane.setOpaque(false);
65 spDevicesPane.getViewport().setOpaque(false);
66 spDevicesPane.setViewportView(devicesPane);
67 spDevicesPane.setBorder(BorderFactory.createEmptyBorder());
68 int h = spDevicesPane.getMinimumSize().height;
69 spDevicesPane.setMinimumSize(new Dimension(200, h));
70
71 final String s = "rightSidePane.showInstrumentsDb";
72 setTabbedView(preferences().getBoolProperty(s));
73
74 preferences().addPropertyChangeListener(s, getHandler());
75 }
76
77 private void
78 setTabbedView(boolean b) {
79 remove(spDevicesPane);
80 remove(tabbedPane);
81
82 tabbedPane.removeChangeListener(getHandler());
83 tabbedPane.removeAll();
84
85 if(b) {
86 if(instrumentsDbPane == null) instrumentsDbPane = new InstrumentsDbPane();
87 tabbedPane.addTab(i18n.getLabel("RightSidePane.tabDevices"), spDevicesPane);
88 tabbedPane.addTab(i18n.getLabel("RightSidePane.tabInstrumentsDb"), instrumentsDbPane);
89 tabbedPane.addChangeListener(getHandler());
90 add(tabbedPane);
91
92 int i = preferences().getIntProperty("rightSidePane.tabIndex", 0);
93 if(tabbedPane.getTabCount() > i) tabbedPane.setSelectedIndex(i);
94 } else {
95 add(spDevicesPane);
96 }
97
98 validate();
99 }
100
101 protected void
102 savePreferences() {
103 if(instrumentsDbPane != null) instrumentsDbPane.savePreferences();
104 }
105
106 private final EventHandler eventHandler = new EventHandler();
107
108 private EventHandler
109 getHandler() { return eventHandler; }
110
111 private class EventHandler implements ChangeListener, PropertyChangeListener {
112 public void
113 stateChanged(ChangeEvent e) {
114 int idx = tabbedPane.getSelectedIndex();
115 if(idx == -1) return;
116 preferences().setIntProperty("rightSidePane.tabIndex", idx);
117 }
118
119 public void
120 propertyChange(PropertyChangeEvent e) {
121 setTabbedView(preferences().getBoolProperty("rightSidePane.showInstrumentsDb"));
122 }
123 }
124 }

  ViewVC Help
Powered by ViewVC