/[svn]/jsampler/trunk/src/org/jsampler/view/fantasia/Res.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/view/fantasia/Res.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1497 - (show annotations) (download)
Mon Nov 19 22:26:16 2007 UTC (16 years, 5 months ago) by iliev
File size: 12580 byte(s)
- minor bugfix

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 java.awt.Font;
26 import java.awt.Insets;
27
28 import java.util.Properties;
29 import java.util.logging.Level;
30
31 import javax.swing.ImageIcon;
32
33 import org.jsampler.CC;
34 import org.jsampler.HF;
35
36 import org.linuxsampler.lscp.Parser;
37
38
39 /**
40 * This class contains all pixmap resources needed by <b>Fantasia</b> view.
41 * @author Grigor Iliev
42 */
43 public class Res {
44
45 /** Forbits the instantiation of this class. */
46 private Res() { }
47
48 protected static ImageIcon gfxFantasiaLogo;
49
50 protected final static ImageIcon gfxPowerOn
51 = new ImageIcon(Res.class.getResource("res/gfx/power_on.png"));
52
53 protected final static ImageIcon gfxPowerOff
54 = new ImageIcon(Res.class.getResource("res/gfx/power_off.png"));
55
56 protected final static ImageIcon gfxMuteOn
57 = new ImageIcon(Res.class.getResource("res/gfx/btn_mute_on.png"));
58
59 protected final static ImageIcon gfxMuteOff
60 = new ImageIcon(Res.class.getResource("res/gfx/btn_mute_off.png"));
61
62 protected final static ImageIcon gfxMuteSoloDisabled
63 = new ImageIcon(Res.class.getResource("res/gfx/btn_mute_solo_disabled.png"));
64
65 protected final static ImageIcon gfxMutedBySolo
66 = new ImageIcon(Res.class.getResource("res/gfx/btn_mute_off.png"));
67
68 protected final static ImageIcon gfxSoloOn
69 = new ImageIcon(Res.class.getResource("res/gfx/btn_solo_on.png"));
70
71 protected final static ImageIcon gfxSoloOff
72 = new ImageIcon(Res.class.getResource("res/gfx/btn_mute_off.png"));
73
74 protected final static ImageIcon gfxMuteTitle
75 = new ImageIcon(Res.class.getResource("res/gfx/title_mute.png"));
76
77 protected final static ImageIcon gfxSoloTitle
78 = new ImageIcon(Res.class.getResource("res/gfx/title_solo.png"));
79
80 protected final static ImageIcon gfxVolumeTitle
81 = new ImageIcon(Res.class.getResource("res/gfx/title_volume.png"));
82
83 protected final static ImageIcon gfxVolumeDial
84 = new ImageIcon(Res.class.getResource("res/gfx/knob_volume.png"));
85
86 protected final static ImageIcon gfxOptionsTitle
87 = new ImageIcon(Res.class.getResource("res/gfx/title_options.png"));
88
89 protected final static ImageIcon gfxOptionsOn
90 = new ImageIcon(Res.class.getResource("res/gfx/btn_hide_channel_options.png"));
91
92 protected final static ImageIcon gfxOptionsOnRO
93 = new ImageIcon(Res.class.getResource("res/gfx/btn_hide_channel_options_ro.png"));
94
95 protected final static ImageIcon gfxOptionsOff
96 = new ImageIcon(Res.class.getResource("res/gfx/btn_show_channel_options.png"));
97
98 protected final static ImageIcon gfxOptionsOffRO
99 = new ImageIcon(Res.class.getResource("res/gfx/btn_show_channel_options_ro.png"));
100
101 protected final static ImageIcon gfxMidiInputTitle
102 = new ImageIcon(Res.class.getResource("res/gfx/title_midi_input.png"));
103
104 protected final static ImageIcon gfxEngineTitle
105 = new ImageIcon(Res.class.getResource("res/gfx/title_engine.png"));
106
107 protected final static ImageIcon gfxAudioOutputTitle
108 = new ImageIcon(Res.class.getResource("res/gfx/title_audio_output.png"));
109
110 protected final static ImageIcon gfxInstrumentMapTitle
111 = new ImageIcon(Res.class.getResource("res/gfx/title_midi_instrument_map.png"));
112
113 protected final static ImageIcon gfxChannel
114 = new ImageIcon(Res.class.getResource("res/gfx/channel.png"));
115
116 protected final static ImageIcon gfxChannelScreen
117 = new ImageIcon(Res.class.getResource("res/gfx/channel.screen.png"));
118
119 protected final static ImageIcon gfxHLine
120 = new ImageIcon(Res.class.getResource("res/gfx/line_hor.png"));
121
122 protected final static ImageIcon gfxVLine
123 = new ImageIcon(Res.class.getResource("res/gfx/line_vert.png"));
124
125 protected final static ImageIcon gfxChannelOptions
126 = new ImageIcon(Res.class.getResource("res/gfx/channel.options.png"));
127
128 protected final static ImageIcon gfxCreateChannel
129 = new ImageIcon(Res.class.getResource("res/gfx/create_channel.png"));
130
131 protected final static ImageIcon gfxTextField
132 = new ImageIcon(Res.class.getResource("res/gfx/tf_bg.png"));
133
134 protected final static ImageIcon gfxCbLabelBg
135 = new ImageIcon(Res.class.getResource("res/gfx/cb_label_bg.png"));
136
137 protected final static ImageIcon gfxCbArrow
138 = new ImageIcon(Res.class.getResource("res/gfx/cb_arrow.png"));
139
140 protected final static ImageIcon gfxCbArrowDisabled
141 = new ImageIcon(Res.class.getResource("res/gfx/cb_arrow_disabled.png"));
142
143 protected final static ImageIcon gfxCbArrowRO
144 = new ImageIcon(Res.class.getResource("res/gfx/cb_arrow_ro.png"));
145
146 protected final static ImageIcon gfxPowerOn18
147 = new ImageIcon(Res.class.getResource("res/gfx/power_on18.png"));
148
149 protected final static ImageIcon gfxPowerOff18
150 = new ImageIcon(Res.class.getResource("res/gfx/power_off18.png"));
151
152 protected final static ImageIcon gfxDeviceBg
153 = new ImageIcon(Res.class.getResource("res/gfx/device_bg.png"));
154
155 protected final static ImageIcon gfxRoundBg14
156 = new ImageIcon(Res.class.getResource("res/gfx/round_bg14.png"));
157 protected final static ImageIcon gfxRoundBg7
158 = new ImageIcon(Res.class.getResource("res/gfx/round_bg7.png"));
159 protected final static ImageIcon gfxMenuBarBg
160 = new ImageIcon(Res.class.getResource("res/gfx/menubar_bg.png"));
161
162 protected final static ImageIcon gfxToolBarBg
163 = new ImageIcon(Res.class.getResource("res/gfx/toolbar_bg.png"));
164
165 protected final static ImageIcon gfxScreenBtnBg
166 = new ImageIcon(Res.class.getResource("res/gfx/screen_btn_bg.png"));
167
168
169 protected final static ImageIcon gfxChannelsBg
170 = new ImageIcon(Res.class.getResource("res/gfx/channels_bg.png"));
171
172 protected static ImageIcon gfxToolBar;
173 protected static Insets insetsToolBar;
174
175 protected final static ImageIcon gfxBorder
176 = new ImageIcon(Res.class.getResource("res/gfx/border.png"));
177
178 protected final static ImageIcon gfxBtnCr
179 = new ImageIcon(Res.class.getResource("res/gfx/btn_cr.png"));
180
181 protected final static ImageIcon gfxBtnCrRO
182 = new ImageIcon(Res.class.getResource("res/gfx/btn_cr_ro.png"));
183
184
185 protected final static ImageIcon iconAppIcon
186 = new ImageIcon(Res.class.getResource("res/icons/app_icon.png"));
187
188 protected final static ImageIcon iconEngine12
189 = new ImageIcon(Res.class.getResource("res/icons/engine12.png"));
190
191 protected final static ImageIcon iconVolume14
192 = new ImageIcon(Res.class.getResource("res/icons/volume14.png"));
193
194 protected final static ImageIcon iconNew16
195 = new ImageIcon(Res.class.getResource("res/icons/new16.png"));
196
197 protected final static ImageIcon iconEdit16
198 = new ImageIcon(Res.class.getResource("res/icons/edit16.png"));
199
200 protected final static ImageIcon iconDelete16
201 = new ImageIcon(Res.class.getResource("res/icons/delete16.png"));
202
203 protected final static ImageIcon iconBack16
204 = new ImageIcon(Res.class.getResource("res/icons/back16.png"));
205
206 protected final static ImageIcon iconNext16
207 = new ImageIcon(Res.class.getResource("res/icons/next16.png"));
208
209 protected final static ImageIcon iconBrowse16
210 = new ImageIcon(Res.class.getResource("res/icons/folder_open16.png"));
211
212 protected final static ImageIcon iconDb16
213 = new ImageIcon(Res.class.getResource("res/icons/collection16.png"));
214
215 protected final static ImageIcon iconFolder16
216 = new ImageIcon(Res.class.getResource("res/icons/folder16.png"));
217
218 protected final static ImageIcon iconFolderOpen16
219 = new ImageIcon(Res.class.getResource("res/icons/folder_open16.png"));
220
221 protected final static ImageIcon iconInstrument16
222 = new ImageIcon(Res.class.getResource("res/icons/instr16.png"));
223
224 protected final static ImageIcon iconVolume22
225 = new ImageIcon(Res.class.getResource("res/icons/volume22.png"));
226
227 protected final static ImageIcon iconFind22
228 = new ImageIcon(Res.class.getResource("res/icons/Find22.png"));
229
230 protected final static ImageIcon iconGoUp22
231 = new ImageIcon(Res.class.getResource("res/icons/GoUp22.png"));
232
233 protected final static ImageIcon iconGoBack22
234 = new ImageIcon(Res.class.getResource("res/icons/GoBack22.png"));
235
236 protected final static ImageIcon iconGoForward22
237 = new ImageIcon(Res.class.getResource("res/icons/GoForward22.png"));
238
239 protected final static ImageIcon iconFolderOpen22
240 = new ImageIcon(Res.class.getResource("res/icons/folder_open22.png"));
241
242 protected final static ImageIcon iconPreferences22
243 = new ImageIcon(Res.class.getResource("res/icons/Preferences22.png"));
244
245 protected final static ImageIcon iconReload22
246 = new ImageIcon(Res.class.getResource("res/icons/reload22.png"));
247
248 protected final static ImageIcon iconSamplerInfo32
249 = new ImageIcon(Res.class.getResource("res/icons/sampler_info32.png"));
250
251 protected final static ImageIcon iconOpen32
252 = new ImageIcon(Res.class.getResource("res/icons/open32.png"));
253
254 protected final static ImageIcon iconSave32
255 = new ImageIcon(Res.class.getResource("res/icons/save32.png"));
256
257 protected final static ImageIcon iconReload32
258 = new ImageIcon(Res.class.getResource("res/icons/reload32.png"));
259
260 protected final static ImageIcon iconReset32
261 = new ImageIcon(Res.class.getResource("res/icons/purge32.png"));
262
263 protected final static ImageIcon iconPreferences32
264 = new ImageIcon(Res.class.getResource("res/icons/preferences32.png"));
265
266 protected final static ImageIcon iconLSConsole32
267 = new ImageIcon(Res.class.getResource("res/icons/ls_console32.png"));
268
269 protected final static ImageIcon iconLSConsole
270 = new ImageIcon(Res.class.getResource("res/icons/ls_console.png"));
271
272 protected final static ImageIcon iconDb32
273 = new ImageIcon(Res.class.getResource("res/icons/db32.png"));
274
275 protected final static ImageIcon iconWarning32
276 = new ImageIcon(Res.class.getResource("res/icons/warning32.png"));
277
278 protected final static ImageIcon iconLinuxSamplerLogo
279 = new ImageIcon(Res.class.getResource("res/icons/LinuxSampler-logo.png"));
280
281 protected static Font fontScreen = null;
282 protected static Font fontScreenMono = null;
283
284
285 static {
286 try {
287 fontScreen = Font.createFont (
288 Font.TRUETYPE_FONT,
289 Res.class.getResourceAsStream("res/fonts/DejaVuLGCCondensedSansBold.ttf")
290 );
291 fontScreen = fontScreen.deriveFont(10.0f);
292
293 fontScreenMono = Font.createFont (
294 Font.TRUETYPE_FONT,
295 Res.class.getResourceAsStream("res/fonts/DejaVuLGCMonoSansBold.ttf")
296 );
297 fontScreenMono = fontScreenMono.deriveFont(10.0f);
298 } catch(Exception e) {
299 CC.getLogger().warning(HF.getErrorMessage(e));
300 }
301 }
302
303 protected static void
304 loadTheme(String themeName) {
305 try {
306 Properties p = new Properties();
307 p.load(Res.class.getResourceAsStream("res/themes/themes.properties"));
308
309 String path = p.getProperty(themeName);
310 if(path == null) {
311 String s = "Failed to load theme " + themeName;
312 s += "! Falling back to the default theme...";
313 CC.getLogger().warning(s);
314 path = p.getProperty("Graphite");
315 if(path == null) {
316 CC.getLogger().warning("Failed to load the default theme!");
317 CC.cleanExit();
318 return;
319 }
320 }
321
322 path = "res/" + path;
323 if(path.charAt(path.length() - 1) != '/') path += "/";
324 path += "theme.properties";
325 p.load(Res.class.getResourceAsStream(path));
326
327 String s = "res/" + p.getProperty("FantasiaLogo.gfx");
328 gfxFantasiaLogo = new ImageIcon(Res.class.getResource(s));
329
330 s = "res/" + p.getProperty("StandardBar.gfx");
331 gfxToolBar = new ImageIcon(Res.class.getResource(s));
332
333 insetsToolBar = parseInsets(p.getProperty("StandardBar.insets"));
334 } catch(Exception e) {
335 CC.getLogger().log(Level.INFO, "Failed to load theme " + themeName, e);
336 CC.cleanExit();
337 }
338 }
339
340 private static Insets
341 parseInsets(String s) {
342 Insets i = new Insets(0, 0, 0, 0);
343 try {
344 Integer[] list = Parser.parseIntList(s);
345 if(list.length != 4) throw new Exception();
346 i.set(list[0], list[1], list[2], list[3]);
347 } catch(Exception x) {
348 CC.getLogger().warning("Failed to parse insets: " + s);
349 }
350
351 return i;
352 }
353 }

  ViewVC Help
Powered by ViewVC