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