1 |
iliev |
1286 |
/* |
2 |
|
|
* JSampler - a java front-end for LinuxSampler |
3 |
|
|
* |
4 |
iliev |
1752 |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
5 |
iliev |
1286 |
* |
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 |
iliev |
1752 |
import org.jsampler.CC; |
31 |
iliev |
1286 |
import org.jsampler.JSPrefs; |
32 |
|
|
|
33 |
|
|
import org.jsampler.view.InstrumentsDbTableView; |
34 |
|
|
import org.jsampler.view.InstrumentsDbTreeView; |
35 |
iliev |
1752 |
import org.jsampler.view.BasicIconSet; |
36 |
iliev |
1286 |
import org.jsampler.view.JSViewConfig; |
37 |
|
|
|
38 |
iliev |
1743 |
import org.jvnet.substance.api.SubstanceConstants; |
39 |
iliev |
1286 |
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 |
iliev |
1752 |
private BasicIconSet basicIconSet = new IconSet(); |
50 |
iliev |
1286 |
|
51 |
|
|
/** Creates a new instance of <code>ViewConfig</code> */ |
52 |
|
|
public |
53 |
|
|
ViewConfig() { |
54 |
|
|
try { |
55 |
|
|
UIManager.setLookAndFeel(new SubstanceRavenGraphiteLookAndFeel()); |
56 |
iliev |
1743 |
UIManager.put(SubstanceLookAndFeel.WATERMARK_VISIBLE, Boolean.FALSE); |
57 |
iliev |
1496 |
|
58 |
iliev |
1729 |
UIManager.put ( |
59 |
|
|
SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND, |
60 |
|
|
SubstanceConstants.TabContentPaneBorderKind.SINGLE_FULL |
61 |
|
|
); |
62 |
|
|
|
63 |
iliev |
1496 |
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 |
iliev |
1286 |
} catch(Exception e) { |
70 |
|
|
e.printStackTrace(); |
71 |
|
|
} |
72 |
|
|
} |
73 |
|
|
|
74 |
|
|
public JSPrefs |
75 |
|
|
preferences() { return FantasiaPrefs.preferences(); } |
76 |
|
|
|
77 |
iliev |
1767 |
/** Exports the view configuration of the current session. */ |
78 |
|
|
public String |
79 |
|
|
exportSessionViewConfig() { |
80 |
|
|
StringBuffer sb = new StringBuffer(); |
81 |
|
|
MainFrame frame = (MainFrame)CC.getMainFrame(); |
82 |
|
|
|
83 |
|
|
for(int i = 0; i < frame.getChannelsPane(0).getChannelCount(); i++) { |
84 |
|
|
Channel c = (Channel)frame.getChannelsPane(0).getChannel(i); |
85 |
|
|
|
86 |
|
|
sb.append("#jsampler.fantasia: [channel]\r\n"); |
87 |
|
|
|
88 |
|
|
switch(c.getViewTracker().getOriginalView().getType()) { |
89 |
|
|
case SMALL: |
90 |
|
|
sb.append("#jsampler.fantasia: viewType = SMALL\r\n"); |
91 |
|
|
break; |
92 |
|
|
|
93 |
|
|
case NORMAL: |
94 |
|
|
sb.append("#jsampler.fantasia: viewType = NORMAL\r\n"); |
95 |
|
|
break; |
96 |
|
|
} |
97 |
|
|
|
98 |
|
|
sb.append("#jsampler.fantasia: \r\n"); |
99 |
|
|
} |
100 |
|
|
|
101 |
|
|
MidiDevicesPane midi = frame.getRightSidePane().getDevicesPane().getMidiDevicesPane(); |
102 |
|
|
|
103 |
|
|
for(int i = 0; i < midi.getDevicePaneCount(); i++) { |
104 |
|
|
sb.append("#jsampler.fantasia: [MIDI device]\r\n"); |
105 |
|
|
|
106 |
|
|
if(midi.getDevicePaneAt(i).isOptionsPaneExpanded()) { |
107 |
|
|
sb.append("#jsampler.fantasia: expanded = true\r\n"); |
108 |
|
|
} else { |
109 |
|
|
sb.append("#jsampler.fantasia: expanded = false\r\n"); |
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
sb.append("#jsampler.fantasia: \r\n"); |
113 |
|
|
} |
114 |
|
|
|
115 |
|
|
return sb.toString(); |
116 |
|
|
} |
117 |
|
|
|
118 |
iliev |
1286 |
public InstrumentsDbTreeView |
119 |
|
|
getInstrumentsDbTreeView() { return instrumentsDbTreeView; } |
120 |
|
|
|
121 |
|
|
public InstrumentsDbTableView |
122 |
|
|
getInstrumentsDbTableView() { return instrumentsDbTableView; } |
123 |
|
|
|
124 |
iliev |
1752 |
public BasicIconSet |
125 |
|
|
getBasicIconSet() { return basicIconSet; } |
126 |
|
|
|
127 |
iliev |
1286 |
private class TreeView implements InstrumentsDbTreeView { |
128 |
|
|
public Icon |
129 |
|
|
getRootIcon() { return Res.iconDb16; } |
130 |
|
|
|
131 |
|
|
public Icon |
132 |
|
|
getClosedIcon() { return Res.iconFolder16; } |
133 |
|
|
|
134 |
|
|
public Icon |
135 |
|
|
getOpenIcon() { return Res.iconFolderOpen16; } |
136 |
|
|
|
137 |
|
|
public Icon |
138 |
|
|
getInstrumentIcon() { return Res.iconInstrument16; } |
139 |
|
|
|
140 |
|
|
public Icon |
141 |
|
|
getGigInstrumentIcon() { return Res.iconInstrument16; } |
142 |
|
|
} |
143 |
|
|
|
144 |
|
|
private static class TableView implements InstrumentsDbTableView { |
145 |
|
|
public Icon |
146 |
|
|
getFolderIcon() { return Res.iconFolder16; } |
147 |
|
|
|
148 |
|
|
public Icon |
149 |
|
|
getInstrumentIcon() { return Res.iconInstrument16; } |
150 |
|
|
|
151 |
|
|
public Icon |
152 |
|
|
getGigInstrumentIcon() { return Res.iconInstrument16; } |
153 |
|
|
} |
154 |
|
|
|
155 |
iliev |
1752 |
private class IconSet implements BasicIconSet { |
156 |
|
|
public Icon |
157 |
|
|
getBack16Icon() { return Res.iconBack16; } |
158 |
|
|
|
159 |
|
|
public Icon |
160 |
|
|
getUp16Icon() { return Res.iconUp16; } |
161 |
|
|
|
162 |
|
|
public Icon |
163 |
|
|
getForward16Icon() { return Res.iconNext16; } |
164 |
|
|
|
165 |
|
|
public Icon |
166 |
|
|
getReload16Icon() { return Res.iconReload16; } |
167 |
|
|
|
168 |
|
|
public Icon |
169 |
|
|
getPreferences16Icon() { return Res.iconPreferences16; } |
170 |
iliev |
1767 |
|
171 |
|
|
public Icon |
172 |
|
|
getWarning32Icon() { return Res.iconWarning32; } |
173 |
|
|
|
174 |
|
|
public Icon |
175 |
|
|
getQuestion32Icon() { return Res.iconQuestion32; } |
176 |
iliev |
1752 |
} |
177 |
|
|
|
178 |
iliev |
1286 |
public boolean |
179 |
|
|
getInstrumentsDbSupport() { return true; } |
180 |
|
|
} |