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 javax.swing.Icon; |
26 |
import javax.swing.JDialog; |
27 |
import javax.swing.JFrame; |
28 |
import javax.swing.UIManager; |
29 |
|
30 |
import org.jsampler.CC; |
31 |
import org.jsampler.JSPrefs; |
32 |
|
33 |
import org.jsampler.view.InstrumentsDbTableView; |
34 |
import org.jsampler.view.InstrumentsDbTreeView; |
35 |
import org.jsampler.view.BasicIconSet; |
36 |
import org.jsampler.view.JSViewConfig; |
37 |
|
38 |
import org.jvnet.substance.api.SubstanceConstants; |
39 |
import org.jvnet.substance.SubstanceLookAndFeel; |
40 |
import org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel; |
41 |
|
42 |
/** |
43 |
* |
44 |
* @author Grigor Iliev |
45 |
*/ |
46 |
public class ViewConfig extends JSViewConfig { |
47 |
private InstrumentsDbTreeView instrumentsDbTreeView = new TreeView(); |
48 |
private InstrumentsDbTableView instrumentsDbTableView = new TableView(); |
49 |
private BasicIconSet basicIconSet = new IconSet(); |
50 |
|
51 |
/** Creates a new instance of <code>ViewConfig</code> */ |
52 |
public |
53 |
ViewConfig() { |
54 |
try { |
55 |
UIManager.setLookAndFeel(new SubstanceRavenGraphiteLookAndFeel()); |
56 |
UIManager.put(SubstanceLookAndFeel.WATERMARK_VISIBLE, Boolean.FALSE); |
57 |
|
58 |
UIManager.put ( |
59 |
SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND, |
60 |
SubstanceConstants.TabContentPaneBorderKind.SINGLE_FULL |
61 |
); |
62 |
|
63 |
if(!preferences().getBoolProperty("TurnOffCustomWindowDecoration")) { |
64 |
javax.swing.JFrame.setDefaultLookAndFeelDecorated(true); |
65 |
javax.swing.JDialog.setDefaultLookAndFeelDecorated(true); |
66 |
} |
67 |
|
68 |
Res.loadTheme(preferences().getStringProperty("Theme")); |
69 |
} catch(Exception e) { |
70 |
e.printStackTrace(); |
71 |
} |
72 |
} |
73 |
|
74 |
public JSPrefs |
75 |
preferences() { return FantasiaPrefs.preferences(); } |
76 |
|
77 |
public InstrumentsDbTreeView |
78 |
getInstrumentsDbTreeView() { return instrumentsDbTreeView; } |
79 |
|
80 |
public InstrumentsDbTableView |
81 |
getInstrumentsDbTableView() { return instrumentsDbTableView; } |
82 |
|
83 |
public BasicIconSet |
84 |
getBasicIconSet() { return basicIconSet; } |
85 |
|
86 |
private class TreeView implements InstrumentsDbTreeView { |
87 |
public Icon |
88 |
getRootIcon() { return Res.iconDb16; } |
89 |
|
90 |
public Icon |
91 |
getClosedIcon() { return Res.iconFolder16; } |
92 |
|
93 |
public Icon |
94 |
getOpenIcon() { return Res.iconFolderOpen16; } |
95 |
|
96 |
public Icon |
97 |
getInstrumentIcon() { return Res.iconInstrument16; } |
98 |
|
99 |
public Icon |
100 |
getGigInstrumentIcon() { return Res.iconInstrument16; } |
101 |
} |
102 |
|
103 |
private static class TableView implements InstrumentsDbTableView { |
104 |
public Icon |
105 |
getFolderIcon() { return Res.iconFolder16; } |
106 |
|
107 |
public Icon |
108 |
getInstrumentIcon() { return Res.iconInstrument16; } |
109 |
|
110 |
public Icon |
111 |
getGigInstrumentIcon() { return Res.iconInstrument16; } |
112 |
} |
113 |
|
114 |
private class IconSet implements BasicIconSet { |
115 |
public Icon |
116 |
getBack16Icon() { return Res.iconBack16; } |
117 |
|
118 |
public Icon |
119 |
getUp16Icon() { return Res.iconUp16; } |
120 |
|
121 |
public Icon |
122 |
getForward16Icon() { return Res.iconNext16; } |
123 |
|
124 |
public Icon |
125 |
getReload16Icon() { return Res.iconReload16; } |
126 |
|
127 |
public Icon |
128 |
getPreferences16Icon() { return Res.iconPreferences16; } |
129 |
} |
130 |
|
131 |
public boolean |
132 |
getInstrumentsDbSupport() { return true; } |
133 |
} |