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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1323 - (show annotations) (download)
Tue Sep 4 15:41:13 2007 UTC (16 years, 7 months ago) by iliev
File size: 3708 byte(s)
* Fantasia: added new menu items - Edit/Add Channel,
  Edit/Create MIDI Device, Edit/Create Audio Device,
  View/Toolbar, View/Side Pane, View/Devices Pane

1 /*
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 private final PixmapPane mainPane;
48
49 private final ToolbarButton btnSamplerInfo = new ToolbarButton(a4n.samplerInfo);
50 private final ToolbarButton btnLoadSession = new ToolbarButton(a4n.loadScript);
51 private final ToolbarButton btnExportSession = new ToolbarButton(a4n.exportSamplerConfig);
52 private final ToolbarButton btnRefresh = new ToolbarButton(a4n.refresh);
53 private final ToolbarButton btnResetSampler = new ToolbarButton(a4n.resetSampler);
54
55 private final ToolbarButton btnLSConsole = new ToolbarButton(a4n.windowLSConsole);
56 private final ToolbarButton btnInstrumentsDb = new ToolbarButton(a4n.windowInstrumentsDb);
57
58 private final ToolbarButton btnPreferences = new ToolbarButton(a4n.editPreferences);
59
60 private final JLabel lLogo = new JLabel(Res.gfxFantasiaLogo);
61
62 /** Creates a new instance of <code>StandardBar</code> */
63 public
64 StandardBar() {
65 super(Res.gfxToolBarBg);
66 setPixmapInsets(new Insets(0, 6, 6, 6));
67
68 setLayout(new BorderLayout());
69 setOpaque(false);
70
71 Dimension d = new Dimension(60, 60);
72 setMinimumSize(d);
73 setPreferredSize(d);
74 d = new Dimension(Short.MAX_VALUE, 60);
75 setMaximumSize(d);
76 setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
77
78
79 mainPane = new PixmapPane(Res.gfxToolbar);
80 mainPane.setPixmapInsets(new Insets(1, 1, 1, 1));
81 mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.X_AXIS));
82
83 toolbar.setOpaque(false);
84 toolbar.setFloatable(false);
85
86 toolbar.add(btnSamplerInfo);
87 toolbar.addSeparator();
88 toolbar.add(btnLoadSession);
89 toolbar.add(btnExportSession);
90 toolbar.add(btnRefresh);
91 toolbar.add(btnResetSampler);
92 toolbar.addSeparator();
93 toolbar.add(btnLSConsole);
94 toolbar.add(btnInstrumentsDb);
95 toolbar.addSeparator();
96 toolbar.add(btnPreferences);
97
98 mainPane.add(toolbar);
99 mainPane.add(Box.createGlue());
100
101 mainPane.add(lLogo);
102 mainPane.add(Box.createRigidArea(new Dimension(17, 0)));
103 add(mainPane);
104 }
105
106 public void
107 showFantasiaLogo(boolean b) { lLogo.setVisible(b); }
108
109 private static class FantasiaToolBar extends JToolBar {
110 private static Insets pixmapInsets = new Insets(1, 1, 1, 1);
111
112 FantasiaToolBar() {
113 setOpaque(false);
114 }
115
116 protected void
117 paintComponent(Graphics g) {
118 super.paintComponent(g);
119 PixmapPane.paintComponent(this, g, Res.gfxToolbar, pixmapInsets);
120 }
121 }
122 }

  ViewVC Help
Powered by ViewVC