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 |
iliev |
1786 |
import javax.swing.ImageIcon; |
27 |
iliev |
1286 |
import javax.swing.UIManager; |
28 |
|
|
|
29 |
iliev |
1752 |
import org.jsampler.CC; |
30 |
iliev |
1286 |
import org.jsampler.JSPrefs; |
31 |
|
|
|
32 |
|
|
import org.jsampler.view.InstrumentsDbTableView; |
33 |
|
|
import org.jsampler.view.InstrumentsDbTreeView; |
34 |
iliev |
1752 |
import org.jsampler.view.BasicIconSet; |
35 |
iliev |
1818 |
import org.jsampler.view.JSMainFrame; |
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 |
iliev |
1786 |
@Override |
75 |
iliev |
1286 |
public JSPrefs |
76 |
|
|
preferences() { return FantasiaPrefs.preferences(); } |
77 |
|
|
|
78 |
iliev |
1767 |
/** Exports the view configuration of the current session. */ |
79 |
iliev |
1786 |
@Override |
80 |
iliev |
1767 |
public String |
81 |
|
|
exportSessionViewConfig() { |
82 |
|
|
StringBuffer sb = new StringBuffer(); |
83 |
|
|
MainFrame frame = (MainFrame)CC.getMainFrame(); |
84 |
|
|
|
85 |
iliev |
1818 |
for(int i = 0; i < frame.getChannelsPaneCount(); i++) { |
86 |
|
|
exportSamplerChannels(sb, i); |
87 |
|
|
} |
88 |
|
|
|
89 |
|
|
MidiDevicesPane midi = frame.getRightSidePane().getDevicesPane().getMidiDevicesPane(); |
90 |
|
|
|
91 |
|
|
for(int i = 0; i < midi.getDevicePaneCount(); i++) { |
92 |
|
|
sb.append("#jsampler.fantasia: [MIDI device]\r\n"); |
93 |
iliev |
1767 |
|
94 |
iliev |
1818 |
boolean b = midi.getDevicePaneAt(i).isOptionsPaneExpanded(); |
95 |
|
|
sb.append("#jsampler.fantasia: expanded = ").append(b).append("\r\n"); |
96 |
|
|
|
97 |
|
|
sb.append("#\r\n"); |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
AudioDevicesPane au = frame.getRightSidePane().getDevicesPane().getAudioDevicesPane(); |
101 |
|
|
|
102 |
|
|
for(int i = 0; i < au.getDevicePaneCount(); i++) { |
103 |
|
|
sb.append("#jsampler.fantasia: [audio device]\r\n"); |
104 |
|
|
|
105 |
|
|
boolean b = au.getDevicePaneAt(i).isOptionsPaneExpanded(); |
106 |
|
|
sb.append("#jsampler.fantasia: expanded = ").append(b).append("\r\n"); |
107 |
|
|
|
108 |
|
|
sb.append("#\r\n"); |
109 |
|
|
} |
110 |
|
|
|
111 |
|
|
return sb.toString(); |
112 |
|
|
} |
113 |
|
|
|
114 |
|
|
private void |
115 |
|
|
exportSamplerChannels(StringBuffer sb, int channelsPane) { |
116 |
|
|
JSMainFrame frame = CC.getMainFrame(); |
117 |
|
|
|
118 |
|
|
for(int i = 0; i < frame.getChannelsPane(channelsPane).getChannelCount(); i++) { |
119 |
|
|
Channel c = (Channel)frame.getChannelsPane(channelsPane).getChannel(i); |
120 |
|
|
|
121 |
iliev |
1767 |
sb.append("#jsampler.fantasia: [channel]\r\n"); |
122 |
|
|
|
123 |
iliev |
1818 |
sb.append("#jsampler.fantasia: channelsPanel = "); |
124 |
|
|
sb.append(channelsPane + 1).append("\r\n"); |
125 |
|
|
|
126 |
iliev |
1767 |
switch(c.getViewTracker().getOriginalView().getType()) { |
127 |
|
|
case SMALL: |
128 |
|
|
sb.append("#jsampler.fantasia: viewType = SMALL\r\n"); |
129 |
|
|
break; |
130 |
|
|
|
131 |
|
|
case NORMAL: |
132 |
|
|
sb.append("#jsampler.fantasia: viewType = NORMAL\r\n"); |
133 |
|
|
break; |
134 |
|
|
} |
135 |
|
|
|
136 |
iliev |
1818 |
boolean b = c.getViewTracker().getOriginalView().isOptionsButtonSelected(); |
137 |
|
|
sb.append("#jsampler.fantasia: expanded = ").append(b).append("\r\n"); |
138 |
iliev |
1767 |
|
139 |
iliev |
1818 |
sb.append("#\r\n"); |
140 |
iliev |
1767 |
} |
141 |
|
|
} |
142 |
|
|
|
143 |
iliev |
1786 |
@Override |
144 |
iliev |
1286 |
public InstrumentsDbTreeView |
145 |
|
|
getInstrumentsDbTreeView() { return instrumentsDbTreeView; } |
146 |
|
|
|
147 |
iliev |
1786 |
@Override |
148 |
iliev |
1286 |
public InstrumentsDbTableView |
149 |
|
|
getInstrumentsDbTableView() { return instrumentsDbTableView; } |
150 |
|
|
|
151 |
iliev |
1786 |
@Override |
152 |
iliev |
1752 |
public BasicIconSet |
153 |
|
|
getBasicIconSet() { return basicIconSet; } |
154 |
|
|
|
155 |
iliev |
1286 |
private class TreeView implements InstrumentsDbTreeView { |
156 |
iliev |
1786 |
@Override |
157 |
iliev |
1286 |
public Icon |
158 |
|
|
getRootIcon() { return Res.iconDb16; } |
159 |
|
|
|
160 |
iliev |
1786 |
@Override |
161 |
iliev |
1286 |
public Icon |
162 |
|
|
getClosedIcon() { return Res.iconFolder16; } |
163 |
|
|
|
164 |
iliev |
1786 |
@Override |
165 |
iliev |
1286 |
public Icon |
166 |
|
|
getOpenIcon() { return Res.iconFolderOpen16; } |
167 |
|
|
|
168 |
iliev |
1786 |
@Override |
169 |
iliev |
1286 |
public Icon |
170 |
|
|
getInstrumentIcon() { return Res.iconInstrument16; } |
171 |
|
|
|
172 |
iliev |
1786 |
@Override |
173 |
iliev |
1286 |
public Icon |
174 |
|
|
getGigInstrumentIcon() { return Res.iconInstrument16; } |
175 |
|
|
} |
176 |
|
|
|
177 |
|
|
private static class TableView implements InstrumentsDbTableView { |
178 |
iliev |
1786 |
@Override |
179 |
iliev |
1286 |
public Icon |
180 |
|
|
getFolderIcon() { return Res.iconFolder16; } |
181 |
|
|
|
182 |
iliev |
1786 |
@Override |
183 |
iliev |
1286 |
public Icon |
184 |
|
|
getInstrumentIcon() { return Res.iconInstrument16; } |
185 |
|
|
|
186 |
iliev |
1786 |
@Override |
187 |
iliev |
1286 |
public Icon |
188 |
|
|
getGigInstrumentIcon() { return Res.iconInstrument16; } |
189 |
|
|
} |
190 |
|
|
|
191 |
iliev |
1752 |
private class IconSet implements BasicIconSet { |
192 |
iliev |
1786 |
@Override |
193 |
|
|
public ImageIcon |
194 |
|
|
getApplicationIcon() { return Res.iconAppIcon; } |
195 |
|
|
|
196 |
|
|
@Override |
197 |
iliev |
1752 |
public Icon |
198 |
|
|
getBack16Icon() { return Res.iconBack16; } |
199 |
|
|
|
200 |
iliev |
1786 |
@Override |
201 |
iliev |
1752 |
public Icon |
202 |
|
|
getUp16Icon() { return Res.iconUp16; } |
203 |
|
|
|
204 |
iliev |
1786 |
@Override |
205 |
iliev |
1752 |
public Icon |
206 |
|
|
getForward16Icon() { return Res.iconNext16; } |
207 |
|
|
|
208 |
iliev |
1786 |
@Override |
209 |
iliev |
1752 |
public Icon |
210 |
|
|
getReload16Icon() { return Res.iconReload16; } |
211 |
|
|
|
212 |
iliev |
1786 |
@Override |
213 |
iliev |
1752 |
public Icon |
214 |
|
|
getPreferences16Icon() { return Res.iconPreferences16; } |
215 |
iliev |
1767 |
|
216 |
iliev |
1786 |
@Override |
217 |
iliev |
1767 |
public Icon |
218 |
|
|
getWarning32Icon() { return Res.iconWarning32; } |
219 |
|
|
|
220 |
iliev |
1786 |
@Override |
221 |
iliev |
1767 |
public Icon |
222 |
|
|
getQuestion32Icon() { return Res.iconQuestion32; } |
223 |
iliev |
1752 |
} |
224 |
|
|
|
225 |
iliev |
1786 |
@Override |
226 |
iliev |
1286 |
public boolean |
227 |
|
|
getInstrumentsDbSupport() { return true; } |
228 |
|
|
} |