1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2011 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 |
package org.jsampler.view.fantasia; |
23 |
|
24 |
import java.awt.BorderLayout; |
25 |
import java.awt.Color; |
26 |
|
27 |
import javax.swing.JLabel; |
28 |
import javax.swing.JMenuBar; |
29 |
import javax.swing.JPanel; |
30 |
import javax.swing.JScrollPane; |
31 |
import javax.swing.JSplitPane; |
32 |
|
33 |
import org.jsampler.CC; |
34 |
import org.jsampler.view.SamplerTreeModel; |
35 |
import org.jsampler.view.std.JSFrame; |
36 |
import org.jsampler.view.std.JSSamplerTree; |
37 |
|
38 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
39 |
import static org.jsampler.view.fantasia.FantasiaPrefs.preferences; |
40 |
|
41 |
/** |
42 |
* |
43 |
* @author Grigor Iliev |
44 |
*/ |
45 |
public class SamplerBrowserFrame extends JSFrame { |
46 |
private final JMenuBar menuBar = new JMenuBar(); |
47 |
|
48 |
private final SidePane sidePane; |
49 |
private final JSplitPane splitPane; |
50 |
private final MainPane mainPane; |
51 |
|
52 |
private final JSSamplerTree samplerTree = new JSSamplerTree(new SamplerTreeModel()); |
53 |
|
54 |
/** |
55 |
* Creates a new instance of <code>InstrumentsDbFrame</code> |
56 |
*/ |
57 |
public |
58 |
SamplerBrowserFrame() { |
59 |
super(i18n.getLabel("SamplerBrowserFrame.title"), "SamplerBrowserFrame"); |
60 |
if(Res.iconAppIcon != null) setIconImage(Res.iconAppIcon.getImage()); |
61 |
|
62 |
((ViewConfig)CC.getViewConfig()).restoreMenuProperties(); |
63 |
|
64 |
sidePane = new SidePane(); |
65 |
mainPane = new MainPane(); |
66 |
|
67 |
splitPane = new JSplitPane ( |
68 |
JSplitPane.HORIZONTAL_SPLIT, |
69 |
true, // continuousLayout |
70 |
sidePane, |
71 |
mainPane |
72 |
); |
73 |
|
74 |
splitPane.setDividerSize(3); |
75 |
splitPane.setDividerLocation(200); |
76 |
|
77 |
// fix for moving the menu bar on top of the screen |
78 |
// when running on Mac OS and third party plugin is used |
79 |
((ViewConfig)CC.getViewConfig()).setNativeMenuProperties(); |
80 |
|
81 |
addMenu(); |
82 |
|
83 |
pack(); |
84 |
|
85 |
getContentPane().add(splitPane); |
86 |
} |
87 |
|
88 |
|
89 |
|
90 |
private void |
91 |
addMenu() { } |
92 |
|
93 |
class MainPane extends JPanel { |
94 |
MainPane() { |
95 |
setLayout(new BorderLayout()); |
96 |
JLabel l = new JLabel("Not implemented yet"); |
97 |
l.setHorizontalAlignment(l.CENTER); |
98 |
add(l); |
99 |
} |
100 |
} |
101 |
|
102 |
|
103 |
class SidePane extends JPanel { |
104 |
SidePane() { |
105 |
setLayout(new BorderLayout()); |
106 |
add(new JScrollPane(samplerTree)); |
107 |
} |
108 |
} |
109 |
} |