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 |
* |
* |
37 |
import javax.swing.BorderFactory; |
import javax.swing.BorderFactory; |
38 |
import javax.swing.Box; |
import javax.swing.Box; |
39 |
import javax.swing.BoxLayout; |
import javax.swing.BoxLayout; |
|
import javax.swing.JButton; |
|
40 |
import javax.swing.JComboBox; |
import javax.swing.JComboBox; |
41 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
42 |
import javax.swing.JScrollPane; |
import javax.swing.JScrollPane; |
43 |
import javax.swing.JToolBar; |
import javax.swing.JToolBar; |
44 |
|
|
45 |
import org.jsampler.CC; |
import org.jsampler.CC; |
|
import org.jsampler.DefaultOrchestraModel; |
|
46 |
import org.jsampler.OrchestraModel; |
import org.jsampler.OrchestraModel; |
47 |
|
|
48 |
import org.jsampler.event.OrchestraAdapter; |
import org.jsampler.event.OrchestraAdapter; |
50 |
import org.jsampler.event.ListEvent; |
import org.jsampler.event.ListEvent; |
51 |
import org.jsampler.event.ListListener; |
import org.jsampler.event.ListListener; |
52 |
|
|
|
import org.jsampler.view.InstrumentTable; |
|
|
import org.jsampler.view.InstrumentTableModel; |
|
|
|
|
53 |
import org.jsampler.view.std.JSManageOrchestrasPane; |
import org.jsampler.view.std.JSManageOrchestrasPane; |
54 |
import org.jsampler.view.std.JSOrchestraPane; |
import org.jsampler.view.std.JSOrchestraPane; |
55 |
|
|
63 |
*/ |
*/ |
64 |
public class OrchestrasPane extends JPanel { |
public class OrchestrasPane extends JPanel { |
65 |
private final JPanel taskPaneContainer = new JPanel(); |
private final JPanel taskPaneContainer = new JPanel(); |
66 |
private final TaskPane orchestrasTaskPane = new TaskPane(); |
private final FantasiaTaskPane orchestrasTaskPane = new FantasiaTaskPane(); |
67 |
|
|
68 |
private ManageOrchestrasPane manageOrchestrasPane = new ManageOrchestrasPane(); |
private ManageOrchestrasPane manageOrchestrasPane = new ManageOrchestrasPane(); |
69 |
|
|
83 |
setOpaque(false); |
setOpaque(false); |
84 |
|
|
85 |
orchestrasTaskPane.setTitle(i18n.getLabel("OrchestrasPane.orchestrasTaskPane")); |
orchestrasTaskPane.setTitle(i18n.getLabel("OrchestrasPane.orchestrasTaskPane")); |
86 |
orchestrasTaskPane.add(manageOrchestrasPane); |
|
87 |
|
FantasiaSubPanel fsp = new FantasiaSubPanel(false, true, false); |
88 |
|
fsp.add(manageOrchestrasPane); |
89 |
|
orchestrasTaskPane.add(fsp); |
90 |
boolean b; |
boolean b; |
91 |
orchestrasTaskPane.setAnimated(preferences().getBoolProperty(ANIMATED)); |
orchestrasTaskPane.setAnimated(preferences().getBoolProperty(ANIMATED)); |
92 |
b = preferences().getBoolProperty("OrchestrasPane.orchestrasTaskPane.expanded"); |
b = preferences().getBoolProperty("OrchestrasPane.orchestrasTaskPane.expanded"); |
154 |
InstrumentsPane() { |
InstrumentsPane() { |
155 |
setOpaque(false); |
setOpaque(false); |
156 |
setLayout(new BorderLayout()); |
setLayout(new BorderLayout()); |
157 |
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5)); |
158 |
|
|
159 |
PixmapPane p = new PixmapPane(Res.gfxChannelOptions); |
FantasiaSubPanel p2 = new FantasiaSubPanel(true, false); |
|
p.setPixmapInsets(new Insets(1, 1, 1, 1)); |
|
|
p.setLayout(new BorderLayout()); |
|
|
p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
|
|
|
|
PixmapPane p2 = new PixmapPane(Res.gfxRoundBg7); |
|
|
p2.setPixmapInsets(new Insets(3, 3, 3, 3)); |
|
160 |
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); |
p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); |
161 |
p2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
p2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
162 |
p2.add(cbOrchestras); |
JPanel p = new FantasiaPanel(); |
163 |
p2.add(Box.createRigidArea(new Dimension(0, 5))); |
p.setOpaque(false); |
164 |
p2.add(orchestraPane); |
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
165 |
|
p.add(cbOrchestras); |
166 |
|
p.setBorder(BorderFactory.createEmptyBorder(3, 1, 5, 1)); |
167 |
|
p2.add(p); |
168 |
|
|
169 |
add(p2); |
FantasiaSubPanel fsp = new FantasiaSubPanel(false, true, false); |
170 |
} |
fsp.add(orchestraPane); |
171 |
} |
|
172 |
|
p2.add(fsp); |
|
static class ToolBar extends JToolBar { |
|
|
private static Insets pixmapInsets = new Insets(1, 1, 1, 1); |
|
|
|
|
|
ToolBar() { |
|
|
setFloatable(false); |
|
|
setOpaque(false); |
|
|
setPreferredSize(new Dimension(77, 29)); |
|
|
setMinimumSize(getPreferredSize()); |
|
|
} |
|
|
|
|
|
protected void |
|
|
paintComponent(Graphics g) { |
|
|
super.paintComponent(g); |
|
173 |
|
|
174 |
PixmapPane.paintComponent(this, g, Res.gfxCreateChannel, pixmapInsets); |
add(p2); |
175 |
} |
} |
176 |
} |
} |
177 |
|
|
183 |
|
|
184 |
removeAll(); |
removeAll(); |
185 |
|
|
186 |
ToolBar toolBar = new ToolBar(); |
JToolBar toolBar = FantasiaUtils.createSubToolBar(); |
187 |
toolBar.add(new ToolbarButton(actionAddOrchestra)); |
toolBar.add(new ToolbarButton(actionAddOrchestra)); |
188 |
toolBar.add(new ToolbarButton(actionEditOrchestra)); |
toolBar.add(new ToolbarButton(actionEditOrchestra)); |
189 |
toolBar.add(new ToolbarButton(actionDeleteOrchestra)); |
toolBar.add(new ToolbarButton(actionDeleteOrchestra)); |
192 |
JScrollPane sp = new JScrollPane(orchestraTable); |
JScrollPane sp = new JScrollPane(orchestraTable); |
193 |
sp.setPreferredSize(new Dimension(120, 130)); |
sp.setPreferredSize(new Dimension(120, 130)); |
194 |
|
|
195 |
PixmapPane p = new PixmapPane(Res.gfxChannelOptions); |
JPanel p = FantasiaUtils.createBottomSubPane(); |
196 |
p.setPixmapInsets(new Insets(1, 1, 1, 1)); |
p.add(sp); |
|
p.setLayout(new BorderLayout()); |
|
|
p.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); |
|
|
|
|
|
PixmapPane p2 = new PixmapPane(Res.gfxBorder); |
|
|
p2.setPixmapInsets(new Insets(1, 1, 1, 1)); |
|
|
p2.setLayout(new BorderLayout()); |
|
|
p2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
|
p2.add(sp); |
|
|
p.add(p2); |
|
197 |
|
|
198 |
add(p); |
add(p); |
199 |
} |
} |
209 |
|
|
210 |
removeAll(); |
removeAll(); |
211 |
|
|
212 |
ToolBar toolBar = new ToolBar(); |
JToolBar toolBar = FantasiaUtils.createSubToolBar(); |
213 |
toolBar.add(new ToolbarButton(actionAddInstrument)); |
toolBar.add(new ToolbarButton(actionAddInstrument)); |
214 |
toolBar.add(new ToolbarButton(actionEditInstrument)); |
toolBar.add(new ToolbarButton(actionEditInstrument)); |
215 |
toolBar.add(new ToolbarButton(actionDeleteInstrument)); |
toolBar.add(new ToolbarButton(actionDeleteInstrument)); |
227 |
d = new Dimension(sp.getMinimumSize().width, sp.getPreferredSize().height); |
d = new Dimension(sp.getMinimumSize().width, sp.getPreferredSize().height); |
228 |
sp.setPreferredSize(d); |
sp.setPreferredSize(d); |
229 |
|
|
230 |
PixmapPane p = new PixmapPane(Res.gfxChannelOptions); |
JPanel p = FantasiaUtils.createBottomSubPane(); |
231 |
p.setPixmapInsets(new Insets(1, 1, 1, 1)); |
p.add(sp); |
|
p.setLayout(new BorderLayout()); |
|
|
p.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); |
|
|
|
|
|
PixmapPane p2 = new PixmapPane(Res.gfxBorder); |
|
|
p2.setPixmapInsets(new Insets(1, 1, 1, 1)); |
|
|
p2.setLayout(new BorderLayout()); |
|
|
p2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
|
|
p2.add(sp); |
|
|
p.add(p2); |
|
232 |
|
|
233 |
add(p); |
add(p); |
234 |
} |
} |
241 |
|
|
242 |
private class Handler extends OrchestraAdapter implements ListListener<OrchestraModel> { |
private class Handler extends OrchestraAdapter implements ListListener<OrchestraModel> { |
243 |
/** Invoked when an orchestra is added to the orchestra list. */ |
/** Invoked when an orchestra is added to the orchestra list. */ |
244 |
|
@Override |
245 |
public void |
public void |
246 |
entryAdded(ListEvent<OrchestraModel> e) { |
entryAdded(ListEvent<OrchestraModel> e) { |
247 |
if(cbOrchestras.getItemCount() == 0) cbOrchestras.setEnabled(true); |
if(cbOrchestras.getItemCount() == 0) cbOrchestras.setEnabled(true); |
255 |
} |
} |
256 |
|
|
257 |
/** Invoked when an orchestra is removed from the orchestra list. */ |
/** Invoked when an orchestra is removed from the orchestra list. */ |
258 |
|
@Override |
259 |
public void |
public void |
260 |
entryRemoved(ListEvent<OrchestraModel> e) { |
entryRemoved(ListEvent<OrchestraModel> e) { |
261 |
cbOrchestras.removeItem(e.getEntry()); |
cbOrchestras.removeItem(e.getEntry()); |
265 |
} |
} |
266 |
|
|
267 |
/** Invoked when the name of orchestra is changed. */ |
/** Invoked when the name of orchestra is changed. */ |
268 |
|
@Override |
269 |
public void |
public void |
270 |
nameChanged(OrchestraEvent e) { |
nameChanged(OrchestraEvent e) { |
271 |
|
|
272 |
} |
} |
273 |
|
|
274 |
/** Invoked when the description of orchestra is changed. */ |
/** Invoked when the description of orchestra is changed. */ |
275 |
|
@Override |
276 |
public void |
public void |
277 |
descriptionChanged(OrchestraEvent e) { } |
descriptionChanged(OrchestraEvent e) { } |
278 |
|
|