1 |
iliev |
1286 |
/* |
2 |
|
|
* JSampler - a java front-end for LinuxSampler |
3 |
|
|
* |
4 |
|
|
* Copyright (C) 2005-2007 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 |
|
|
import java.awt.Graphics; |
28 |
|
|
import java.awt.Insets; |
29 |
|
|
|
30 |
|
|
import javax.swing.Action; |
31 |
|
|
import javax.swing.BorderFactory; |
32 |
|
|
import javax.swing.Box; |
33 |
|
|
import javax.swing.BoxLayout; |
34 |
|
|
import javax.swing.JButton; |
35 |
|
|
import javax.swing.JLabel; |
36 |
|
|
import javax.swing.JPanel; |
37 |
|
|
import javax.swing.JToolBar; |
38 |
|
|
|
39 |
|
|
import static org.jsampler.view.fantasia.A4n.a4n; |
40 |
|
|
|
41 |
|
|
/** |
42 |
|
|
* |
43 |
|
|
* @author Grigor Iliev |
44 |
|
|
*/ |
45 |
|
|
public class StandardBar extends PixmapPane { |
46 |
|
|
private final JToolBar toolbar = new JToolBar(); |
47 |
|
|
|
48 |
|
|
private final ToolbarButton btnSamplerInfo = new ToolbarButton(a4n.samplerInfo); |
49 |
|
|
private final ToolbarButton btnLoadSession = new ToolbarButton(a4n.loadScript); |
50 |
|
|
private final ToolbarButton btnExportSession = new ToolbarButton(a4n.exportSamplerConfig); |
51 |
|
|
private final ToolbarButton btnRefresh = new ToolbarButton(a4n.refresh); |
52 |
|
|
private final ToolbarButton btnResetSampler = new ToolbarButton(a4n.resetSampler); |
53 |
|
|
|
54 |
|
|
private final ToolbarButton btnLSConsole = new ToolbarButton(a4n.windowLSConsole); |
55 |
|
|
private final ToolbarButton btnInstrumentsDb = new ToolbarButton(a4n.windowInstrumentsDb); |
56 |
|
|
|
57 |
|
|
private final ToolbarButton btnPreferences = new ToolbarButton(a4n.editPreferences); |
58 |
|
|
|
59 |
|
|
/** Creates a new instance of <code>StandardBar</code> */ |
60 |
|
|
public |
61 |
|
|
StandardBar() { |
62 |
|
|
super(Res.gfxToolBarBg); |
63 |
|
|
setPixmapInsets(new Insets(0, 6, 12, 6)); |
64 |
|
|
|
65 |
|
|
setLayout(new BorderLayout()); |
66 |
|
|
setOpaque(false); |
67 |
|
|
|
68 |
|
|
Dimension d = new Dimension(60, 60); |
69 |
|
|
setMinimumSize(d); |
70 |
|
|
setPreferredSize(d); |
71 |
|
|
d = new Dimension(Short.MAX_VALUE, 60); |
72 |
|
|
setMaximumSize(d); |
73 |
|
|
setBorder(BorderFactory.createEmptyBorder(0, 5, 11, 5)); |
74 |
|
|
|
75 |
|
|
|
76 |
|
|
PixmapPane p = new PixmapPane(Res.gfxToolbar); |
77 |
|
|
p.setPixmapInsets(new Insets(1, 1, 1, 1)); |
78 |
|
|
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
79 |
|
|
|
80 |
|
|
toolbar.setOpaque(false); |
81 |
|
|
toolbar.setFloatable(false); |
82 |
|
|
|
83 |
|
|
toolbar.add(btnSamplerInfo); |
84 |
|
|
toolbar.addSeparator(); |
85 |
|
|
toolbar.add(btnLoadSession); |
86 |
|
|
toolbar.add(btnExportSession); |
87 |
|
|
toolbar.add(btnRefresh); |
88 |
|
|
toolbar.add(btnResetSampler); |
89 |
|
|
toolbar.addSeparator(); |
90 |
|
|
toolbar.add(btnLSConsole); |
91 |
|
|
toolbar.add(btnInstrumentsDb); |
92 |
|
|
toolbar.addSeparator(); |
93 |
|
|
toolbar.add(btnPreferences); |
94 |
|
|
|
95 |
|
|
p.add(toolbar); |
96 |
|
|
p.add(Box.createGlue()); |
97 |
|
|
|
98 |
|
|
JLabel l = new JLabel(Res.gfxFantasiaLogo); |
99 |
|
|
p.add(l); |
100 |
|
|
p.add(Box.createRigidArea(new Dimension(17, 0))); |
101 |
|
|
add(p); |
102 |
|
|
} |
103 |
|
|
|
104 |
|
|
private static class FantasiaToolBar extends JToolBar { |
105 |
|
|
private static Insets pixmapInsets = new Insets(1, 1, 1, 1); |
106 |
|
|
|
107 |
|
|
FantasiaToolBar() { |
108 |
|
|
setOpaque(false); |
109 |
|
|
} |
110 |
|
|
|
111 |
|
|
protected void |
112 |
|
|
paintComponent(Graphics g) { |
113 |
|
|
super.paintComponent(g); |
114 |
|
|
PixmapPane.paintComponent(this, g, Res.gfxToolbar, pixmapInsets); |
115 |
|
|
} |
116 |
|
|
} |
117 |
|
|
} |