1 |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
4 |
* Copyright (C) 2005, 2006 Grigor Kirilov Iliev |
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.classic; |
24 |
|
25 |
import java.awt.Color; |
26 |
|
27 |
import java.util.prefs.Preferences; |
28 |
|
29 |
|
30 |
/** |
31 |
* This class represents the preferences of the JS Classic package. |
32 |
* @author Grigor Iliev |
33 |
*/ |
34 |
public class ClassicPrefs { |
35 |
private final static String prefNode = "org.jsampler.view.classic"; |
36 |
|
37 |
private final static String WINDOW_SIZE_AND_LOCATION = "Mainframe.sizeAndLocation"; |
38 |
private final static String DEF_WINDOW_SIZE_AND_LOCATION = null; |
39 |
|
40 |
private final static String WINDOW_MAXIMIZED = "Mainframe.maximized"; |
41 |
private final static boolean DEF_WINDOW_MAXIMIZED = false; |
42 |
|
43 |
private final static String SAVE_WINDOW_PROPERTIES = "Mainframe.saveProperties"; |
44 |
private final static boolean DEF_SAVE_WINDOW_PROPERTIES = true; |
45 |
|
46 |
private final static String HSPLIT_DIVIDER_LOCATION = "HSplit.dividerLocation"; |
47 |
private final static int DEF_HSPLIT_DIVIDER_LOCATION = 180; |
48 |
|
49 |
private final static String SAVE_LEFT_PANE_STATE = "LeftPane.saveState"; |
50 |
private final static boolean DEF_SAVE_LEFT_PANE_STATE = true; |
51 |
|
52 |
private final static String LEFT_PANE_PAGE_IDX = "LeftPane.pageIndex"; |
53 |
private final static int DEF_LEFT_PANE_PAGE_IDX = 0; |
54 |
|
55 |
private final static String SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT = "showLSConsoleWhenRunScript"; |
56 |
private final static boolean DEF_SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT = true; |
57 |
|
58 |
private final static String SHOW_TOOLBAR = "Toolbar.visible"; |
59 |
private final static boolean DEF_SHOW_TOOLBAR = true; |
60 |
|
61 |
private final static String SHOW_STATUSBAR = "Statusbar.visible"; |
62 |
private final static boolean DEF_SHOW_STATUSBAR = true; |
63 |
|
64 |
private final static String SHOW_LEFT_PANE = "LeftPane.visible"; |
65 |
private final static boolean DEF_SHOW_LEFT_PANE = true; |
66 |
|
67 |
private final static String RECENT_SCRIPTS = "recentScripts"; |
68 |
private final static String DEF_RECENT_SCRIPTS = ""; |
69 |
|
70 |
private final static String RECENT_SCRIPTS_SIZE = "recentScripts.maxNumber"; |
71 |
private final static int DEF_RECENT_SCRIPTS_SIZE = 7; |
72 |
|
73 |
private final static String SHOW_LS_CONSOLE = "LSConsole.visible"; |
74 |
private final static boolean DEF_SHOW_LS_CONSOLE = false; |
75 |
|
76 |
private final static String LS_CONSOLE_POPOUT = "LSConsole.popout"; |
77 |
private final static boolean DEF_LS_CONSOLE_POPOUT = false; |
78 |
|
79 |
private final static String LS_CONSOLE_HISTORY = "LSConsole.history"; |
80 |
private final static String DEF_LS_CONSOLE_HISTORY = ""; |
81 |
|
82 |
private final static String LS_CONSOLE_HISTSIZE = "LSConsole.histsize"; |
83 |
private final static int DEF_LS_CONSOLE_HISTSIZE = 1000; |
84 |
|
85 |
private final static String LS_CONSOLE_TEXT_COLOR = "LSConsole.textColor"; |
86 |
private final static int DEF_LS_CONSOLE_TEXT_COLOR = 0x000000; |
87 |
|
88 |
private final static String LS_CONSOLE_BACKGROUND_COLOR = "LSConsole.backgroundColor"; |
89 |
private final static int DEF_LS_CONSOLE_BACKGROUND_COLOR = 0xffffff; |
90 |
|
91 |
private final static String LS_CONSOLE_NOTIFY_COLOR = "LSConsole.notifyColor"; |
92 |
private final static int DEF_LS_CONSOLE_NOTIFY_COLOR = 0xcccccc; |
93 |
|
94 |
private final static String LS_CONSOLE_WARNING_COLOR = "LSConsole.warningColor"; |
95 |
private final static int DEF_LS_CONSOLE_WARNING_COLOR = 0x6699ff; |
96 |
|
97 |
private final static String LS_CONSOLE_ERROR_COLOR = "LSConsole.errorColor"; |
98 |
private final static int DEF_LS_CONSOLE_ERROR_COLOR = 0xff0000; |
99 |
|
100 |
private final static String CHANNEL_BORDER_COLOR = "Channel.borderColor"; |
101 |
private final static int DEF_CHANNEL_BORDER_COLOR = 0xb8cfe5; |
102 |
|
103 |
private final static String CUSTOM_CHANNEL_BORDER_COLOR = "Channel.customBorderColor"; |
104 |
private final static boolean DEF_CUSTOM_CHANNEL_BORDER_COLOR = false; |
105 |
|
106 |
private final static String VSPLIT_DIVIDER_LOCATION = "VSplit.dividerLocation"; |
107 |
private final static int DEF_VSPLIT_DIVIDER_LOCATION = 200; |
108 |
|
109 |
private final static String CURRENT_ORCHESTRA_IDX = "OrchestrasPage.currentOrchestraIndex"; |
110 |
private final static int DEF_CURRENT_ORCHESTRA_IDX = 0; |
111 |
|
112 |
private static Preferences userPrefs = Preferences.userRoot().node(prefNode); |
113 |
|
114 |
public static Preferences |
115 |
user() { return userPrefs; } |
116 |
|
117 |
/** |
118 |
* Gets a string representation of the main window's size and location. |
119 |
* The string representation is a comma-separated list |
120 |
* of x and y coordinates, and width and height of the window. |
121 |
* @return A string representation of the main window's size and location, |
122 |
* or <code>null</code> if the value is not set. |
123 |
*/ |
124 |
public static String |
125 |
getWindowSizeAndLocation() { |
126 |
return user().get(WINDOW_SIZE_AND_LOCATION, DEF_WINDOW_SIZE_AND_LOCATION); |
127 |
} |
128 |
|
129 |
/** |
130 |
* Sets the main window's size and location. |
131 |
* Use <code>null</code> to remove the current value. |
132 |
* @param s A string representation of the main window's size and location. |
133 |
*/ |
134 |
public static void |
135 |
setWindowSizeAndLocation(String s) { |
136 |
if(s == null) { |
137 |
user().remove(WINDOW_SIZE_AND_LOCATION); |
138 |
return; |
139 |
} |
140 |
|
141 |
user().put(WINDOW_SIZE_AND_LOCATION, s); |
142 |
} |
143 |
|
144 |
/** |
145 |
* Determines whether the main window should be maximized. |
146 |
* @return <code>true</code> if the main window should be maximized, |
147 |
* <code>false</code> otherwise. |
148 |
*/ |
149 |
public static boolean |
150 |
getWindowMaximized() { |
151 |
return user().getBoolean(WINDOW_MAXIMIZED, DEF_WINDOW_MAXIMIZED); |
152 |
} |
153 |
|
154 |
/** |
155 |
* Sets whether the main window should be maximized. |
156 |
* @param b If <code>true</code> the main window should be maximized. |
157 |
*/ |
158 |
public static void |
159 |
setWindowMaximized(boolean b) { |
160 |
if(b == getWindowMaximized()) return; |
161 |
user().putBoolean(WINDOW_MAXIMIZED, b); |
162 |
} |
163 |
|
164 |
/** |
165 |
* Gets the divider location of the horizontal split pane. |
166 |
* @return The divider location of the horizontal split pane. |
167 |
*/ |
168 |
public static int |
169 |
getHSplitDividerLocation() { |
170 |
return user().getInt(HSPLIT_DIVIDER_LOCATION, DEF_HSPLIT_DIVIDER_LOCATION); |
171 |
} |
172 |
|
173 |
/** |
174 |
* Sets the divider location of the horizontal split pane. |
175 |
* @param i The new divider location of the horizontal split pane. |
176 |
*/ |
177 |
public static void |
178 |
setHSplitDividerLocation(int i) { |
179 |
if(i == getHSplitDividerLocation()) return; |
180 |
user().putInt(HSPLIT_DIVIDER_LOCATION, i); |
181 |
} |
182 |
|
183 |
/** |
184 |
* Determines whether the window properties (like size and location) should be saved. |
185 |
* @return <code>true</code> if the window properties should be saved, |
186 |
* <code>false</code> otherwise. |
187 |
*/ |
188 |
public static boolean |
189 |
getSaveWindowProperties() { |
190 |
return user().getBoolean(SAVE_WINDOW_PROPERTIES, DEF_SAVE_WINDOW_PROPERTIES); |
191 |
} |
192 |
|
193 |
/** |
194 |
* Sets whether the window properties (like size and location) should be saved. |
195 |
* @param b If <code>true</code> the window properties will be saved. |
196 |
*/ |
197 |
public static void |
198 |
setSaveWindowProperties(boolean b) { |
199 |
if(b == getSaveWindowProperties()) return; |
200 |
user().putBoolean(SAVE_WINDOW_PROPERTIES, b); |
201 |
} |
202 |
|
203 |
/** |
204 |
* Determines whether the Left Pane state should be saved. |
205 |
* @return <code>true</code> if the Left Pane state should be saved, |
206 |
* <code>false</code> otherwise. |
207 |
*/ |
208 |
public static boolean |
209 |
getSaveLeftPaneState() { |
210 |
return user().getBoolean(SAVE_LEFT_PANE_STATE, DEF_SAVE_LEFT_PANE_STATE); |
211 |
} |
212 |
|
213 |
/** |
214 |
* Sets whether the Left Pane state should be saved. |
215 |
* @param b If <code>true</code> the Left Pane state will be saved. |
216 |
*/ |
217 |
public static void |
218 |
setSaveLeftPaneState(boolean b) { |
219 |
if(b == getSaveLeftPaneState()) return; |
220 |
user().putBoolean(SAVE_LEFT_PANE_STATE, b); |
221 |
} |
222 |
|
223 |
/** |
224 |
* Gets the index of the page to be shown in the Left Pane. |
225 |
* @return The index of the page to be shown in the Left Pane. |
226 |
*/ |
227 |
public static int |
228 |
getLeftPanePageIndex() { |
229 |
return user().getInt(LEFT_PANE_PAGE_IDX, DEF_LEFT_PANE_PAGE_IDX); |
230 |
} |
231 |
|
232 |
/** |
233 |
* Sets the maximum number of recent scripts to be kept. |
234 |
* @param i Determines the maximum number of recent scripts to be kept. |
235 |
*/ |
236 |
public static void |
237 |
setLeftPanePageIndex(int i) { |
238 |
if(i == getLeftPanePageIndex()) return; |
239 |
user().putInt(LEFT_PANE_PAGE_IDX, i); |
240 |
} |
241 |
|
242 |
/** |
243 |
* Determines whether to show the LS Console when script is run. |
244 |
* @return <code>true</code> if the LS Console should be shown when script is run, |
245 |
* <code>false</code> otherwise. |
246 |
*/ |
247 |
public static boolean |
248 |
getShowLSConsoleWhenRunScript() { |
249 |
return user().getBoolean ( |
250 |
SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, DEF_SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT |
251 |
); |
252 |
} |
253 |
|
254 |
/** |
255 |
* Sets whether to show the LS Console when script is run. |
256 |
* @param b Specify <code>true</code> to show LS Console when script is run, |
257 |
* <code>false</code> otherwise. |
258 |
*/ |
259 |
public static void |
260 |
setShowLSConsoleWhenRunScript(boolean b) { |
261 |
if(b == getShowLSConsoleWhenRunScript()) return; |
262 |
user().putBoolean(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, b); |
263 |
} |
264 |
|
265 |
/** |
266 |
* Determines whether the toolbar should be visible. |
267 |
* @return <code>true</code> if the toolbar should be visible, |
268 |
* <code>false</code> otherwise. |
269 |
*/ |
270 |
public static boolean |
271 |
shouldShowToolbar() { return user().getBoolean(SHOW_TOOLBAR, DEF_SHOW_TOOLBAR); } |
272 |
|
273 |
/** |
274 |
* Sets whether the toolbar should be visible. |
275 |
* @param b If <code>true</code> the toolbar will be visible at startup. |
276 |
*/ |
277 |
public static void |
278 |
setShowToolbar(boolean b) { |
279 |
if(b == shouldShowToolbar()) return; |
280 |
user().putBoolean(SHOW_TOOLBAR, b); |
281 |
} |
282 |
|
283 |
/** |
284 |
* Determines whether the statusbar should be visible. |
285 |
* @return <code>true</code> if the statusbar should be visible, |
286 |
* <code>false</code> otherwise. |
287 |
*/ |
288 |
public static boolean |
289 |
shouldShowStatusbar() { return user().getBoolean(SHOW_STATUSBAR, DEF_SHOW_STATUSBAR); } |
290 |
|
291 |
/** |
292 |
* Sets whether the statusbar should be visible. |
293 |
* @param b If <code>true</code> the statusbar will be visible at startup. |
294 |
*/ |
295 |
public static void |
296 |
setShowStatusbar(boolean b) { |
297 |
if(b == shouldShowStatusbar()) return; |
298 |
user().putBoolean(SHOW_STATUSBAR, b); |
299 |
} |
300 |
|
301 |
/** |
302 |
* Gets the recent script list. |
303 |
* @return The recent script list. |
304 |
*/ |
305 |
public static String |
306 |
getRecentScripts() { |
307 |
return user().get(RECENT_SCRIPTS, DEF_RECENT_SCRIPTS); |
308 |
} |
309 |
|
310 |
/** |
311 |
* Sets the recent script list. |
312 |
* @param s The recent script list. |
313 |
*/ |
314 |
public static void |
315 |
setRecentScripts(String s) { |
316 |
if(s == null) { |
317 |
user().remove(RECENT_SCRIPTS); |
318 |
return; |
319 |
} |
320 |
|
321 |
user().put(RECENT_SCRIPTS, s); |
322 |
} |
323 |
|
324 |
/** |
325 |
* Determines the maximum number of recent scripts to be kept. |
326 |
* @return The maximum number of recent scripts to be kept. |
327 |
*/ |
328 |
public static int |
329 |
getRecentScriptsSize() { |
330 |
return user().getInt(RECENT_SCRIPTS_SIZE, DEF_RECENT_SCRIPTS_SIZE); |
331 |
} |
332 |
|
333 |
/** |
334 |
* Sets the maximum number of recent scripts to be kept. |
335 |
* @param i Determines the maximum number of recent scripts to be kept. |
336 |
*/ |
337 |
public static void |
338 |
setRecentScriptstSize(int i) { |
339 |
if(i == getRecentScriptsSize()) return; |
340 |
user().putInt(RECENT_SCRIPTS_SIZE, i); |
341 |
} |
342 |
|
343 |
/** |
344 |
* Determines whether the LS Console should be visible. |
345 |
* @return <code>true</code> if the LS Console should be visible, |
346 |
* <code>false</code> otherwise. |
347 |
*/ |
348 |
public static boolean |
349 |
shouldShowLSConsole() { return user().getBoolean(SHOW_LS_CONSOLE, DEF_SHOW_LS_CONSOLE); } |
350 |
|
351 |
/** |
352 |
* Sets whether the LS Console should be visible. |
353 |
* @param b If <code>true</code> the LS Console will be visible at startup. |
354 |
*/ |
355 |
public static void |
356 |
setShowLSConsole(boolean b) { |
357 |
if(b == shouldShowLSConsole()) return; |
358 |
user().putBoolean(SHOW_LS_CONSOLE, b); |
359 |
} |
360 |
|
361 |
/** |
362 |
* Determines whether the LS Console should be shown in a new window or |
363 |
* docked in the main frame. |
364 |
* @return <code>true</code> if the LS Console should be shown in a new window, |
365 |
* <code>false</code> if the LS Console should be docked in the main frame. |
366 |
*/ |
367 |
public static boolean |
368 |
isLSConsolePopOut() { return user().getBoolean(LS_CONSOLE_POPOUT, DEF_LS_CONSOLE_POPOUT); } |
369 |
|
370 |
/** |
371 |
* Sets whether the LS Console should be shown in a new window or |
372 |
* docked in the main frame. |
373 |
* @param b code>true</code> means that the LS Console will be shown in a new window; |
374 |
* <code>false</code> means that the LS Console will be docked in the main frame. |
375 |
*/ |
376 |
public static void |
377 |
setLSConsolePopOut(boolean b) { |
378 |
if(b == isLSConsolePopOut()) return; |
379 |
user().putBoolean(LS_CONSOLE_POPOUT, b); |
380 |
} |
381 |
|
382 |
/** |
383 |
* Gets the LS Console's command history. |
384 |
* @return The LS Console's command history. |
385 |
*/ |
386 |
public static String |
387 |
getLSConsoleHistory() { |
388 |
return user().get(LS_CONSOLE_HISTORY, DEF_LS_CONSOLE_HISTORY); |
389 |
} |
390 |
|
391 |
/** |
392 |
* Sets the LS Console's command history. |
393 |
* @param s The LS Console's command history. |
394 |
*/ |
395 |
public static void |
396 |
setLSConsoleHistory(String s) { |
397 |
if(s == null) { |
398 |
user().remove(LS_CONSOLE_HISTORY); |
399 |
return; |
400 |
} |
401 |
|
402 |
user().put(LS_CONSOLE_HISTORY, s); |
403 |
} |
404 |
|
405 |
/** |
406 |
* Gets the LS Console's command history size. |
407 |
* @return The maximum number of lines to be kept in the command history. |
408 |
*/ |
409 |
public static int |
410 |
getLSConsoleHistSize() { |
411 |
return user().getInt(LS_CONSOLE_HISTSIZE, DEF_LS_CONSOLE_HISTSIZE); |
412 |
} |
413 |
|
414 |
/** |
415 |
* Sets the LS Console's command history size. |
416 |
* @param i The maximum number of lines to be kept in the command history. |
417 |
*/ |
418 |
public static void |
419 |
setLSConsoleHistSize(int i) { |
420 |
if(i == getLSConsoleHistSize()) return; |
421 |
user().putInt(LS_CONSOLE_HISTSIZE, i); |
422 |
} |
423 |
|
424 |
/** |
425 |
* Gets the text color of the LS Console. |
426 |
* @return The text color of the LS Console. |
427 |
*/ |
428 |
public static Color |
429 |
getLSConsoleTextColor() { |
430 |
int c = user().getInt(LS_CONSOLE_TEXT_COLOR, DEF_LS_CONSOLE_TEXT_COLOR); |
431 |
return new Color(c); |
432 |
} |
433 |
|
434 |
/** |
435 |
* Sets the text color of the LS Console. |
436 |
* Use <code>null</code> to remove the current value. |
437 |
* @param color The text color of the LS Console. |
438 |
*/ |
439 |
public static void |
440 |
setLSConsoleTextColor(Color c) { |
441 |
if(c == null) { |
442 |
user().remove(LS_CONSOLE_TEXT_COLOR); |
443 |
return; |
444 |
} |
445 |
|
446 |
if(c.getRGB() == getLSConsoleTextColor().getRGB()) return; |
447 |
|
448 |
user().putInt(LS_CONSOLE_TEXT_COLOR, c.getRGB()); |
449 |
} |
450 |
|
451 |
/** |
452 |
* Gets the background color of the LS Console. |
453 |
* @return The background color of the LS Console. |
454 |
*/ |
455 |
public static Color |
456 |
getLSConsoleBackgroundColor() { |
457 |
int c = user().getInt(LS_CONSOLE_BACKGROUND_COLOR, DEF_LS_CONSOLE_BACKGROUND_COLOR); |
458 |
return new Color(c); |
459 |
} |
460 |
|
461 |
/** |
462 |
* Sets the background color of the LS Console. |
463 |
* Use <code>null</code> to remove the current value. |
464 |
* @param color The background color of the LS Console. |
465 |
*/ |
466 |
public static void |
467 |
setLSConsoleBackgroundColor(Color c) { |
468 |
if(c == null) { |
469 |
user().remove(LS_CONSOLE_BACKGROUND_COLOR); |
470 |
return; |
471 |
} |
472 |
|
473 |
if(c.getRGB() == getLSConsoleBackgroundColor().getRGB()) return; |
474 |
|
475 |
user().putInt(LS_CONSOLE_BACKGROUND_COLOR, c.getRGB()); |
476 |
} |
477 |
|
478 |
/** |
479 |
* Gets the notification messages' color. |
480 |
* @return The notification messages' color. |
481 |
*/ |
482 |
public static Color |
483 |
getLSConsoleNotifyColor() { |
484 |
int c = user().getInt(LS_CONSOLE_NOTIFY_COLOR, DEF_LS_CONSOLE_NOTIFY_COLOR); |
485 |
return new Color(c); |
486 |
} |
487 |
|
488 |
/** |
489 |
* Sets the notification messages' color. |
490 |
* Use <code>null</code> to remove the current value. |
491 |
* @param color The notification messages' color. |
492 |
*/ |
493 |
public static void |
494 |
setLSConsoleNotifyColor(Color c) { |
495 |
if(c == null) { |
496 |
user().remove(LS_CONSOLE_NOTIFY_COLOR); |
497 |
return; |
498 |
} |
499 |
|
500 |
if(c.getRGB() == getLSConsoleNotifyColor().getRGB()) return; |
501 |
|
502 |
user().putInt(LS_CONSOLE_NOTIFY_COLOR, c.getRGB()); |
503 |
} |
504 |
|
505 |
/** |
506 |
* Gets the warning messages' color. |
507 |
* @return The warning messages' color. |
508 |
*/ |
509 |
public static Color |
510 |
getLSConsoleWarningColor() { |
511 |
int c = user().getInt(LS_CONSOLE_WARNING_COLOR, DEF_LS_CONSOLE_WARNING_COLOR); |
512 |
return new Color(c); |
513 |
} |
514 |
|
515 |
/** |
516 |
* Sets the warning messages' color. |
517 |
* Use <code>null</code> to remove the current value. |
518 |
* @param color The warning messages' color. |
519 |
*/ |
520 |
public static void |
521 |
setLSConsoleWarningColor(Color c) { |
522 |
if(c == null) { |
523 |
user().remove(LS_CONSOLE_WARNING_COLOR); |
524 |
return; |
525 |
} |
526 |
|
527 |
if(c.getRGB() == getLSConsoleWarningColor().getRGB()) return; |
528 |
|
529 |
user().putInt(LS_CONSOLE_WARNING_COLOR, c.getRGB()); |
530 |
} |
531 |
|
532 |
/** |
533 |
* Gets the error messages' color. |
534 |
* @return The error messages' color. |
535 |
*/ |
536 |
public static Color |
537 |
getLSConsoleErrorColor() { |
538 |
int c = user().getInt(LS_CONSOLE_ERROR_COLOR, DEF_LS_CONSOLE_ERROR_COLOR); |
539 |
return new Color(c); |
540 |
} |
541 |
|
542 |
/** |
543 |
* Sets the error messages' color. |
544 |
* Use <code>null</code> to remove the current value. |
545 |
* @param color The error messages' color. |
546 |
*/ |
547 |
public static void |
548 |
setLSConsoleErrorColor(Color c) { |
549 |
if(c == null) { |
550 |
user().remove(LS_CONSOLE_ERROR_COLOR); |
551 |
return; |
552 |
} |
553 |
|
554 |
if(c.getRGB() == getLSConsoleErrorColor().getRGB()) return; |
555 |
|
556 |
user().putInt(LS_CONSOLE_ERROR_COLOR, c.getRGB()); |
557 |
} |
558 |
|
559 |
/** |
560 |
* Determines whether the left pane should be visible. |
561 |
* @return <code>true</code> if the left pane should be visible, |
562 |
* <code>false</code> otherwise. |
563 |
*/ |
564 |
public static boolean |
565 |
shouldShowLeftPane() { return user().getBoolean(SHOW_LEFT_PANE, DEF_SHOW_LEFT_PANE); } |
566 |
|
567 |
/** |
568 |
* Sets whether the left pane should be visible. |
569 |
* @param b If <code>true</code> the left pane will be visible at startup. |
570 |
*/ |
571 |
public static void |
572 |
setShowLeftPane(boolean b) { |
573 |
if(b == shouldShowLeftPane()) return; |
574 |
user().putBoolean(SHOW_LEFT_PANE, b); |
575 |
} |
576 |
|
577 |
/** |
578 |
* Gets the default border color that is used for the selected channels. |
579 |
* @return The default border color that is used for the selected channels. |
580 |
*/ |
581 |
public static Color |
582 |
getDefaultChannelBorderColor() { return new Color(DEF_CHANNEL_BORDER_COLOR); } |
583 |
|
584 |
/** |
585 |
* Gets the custom border color to be used for the selected channels. |
586 |
* @return The custom border color to be used for the selected channels. |
587 |
*/ |
588 |
public static Color |
589 |
getChannelBorderColor() { |
590 |
int c = user().getInt(CHANNEL_BORDER_COLOR, DEF_CHANNEL_BORDER_COLOR); |
591 |
return new Color(c); |
592 |
} |
593 |
|
594 |
/** |
595 |
* Sets the border color to be used for the selected channels. |
596 |
* Use <code>null</code> to remove the current value. |
597 |
* @param color The border color to be used for the selected channels. |
598 |
*/ |
599 |
public static void |
600 |
setChannelBorderColor(Color c) { |
601 |
if(c == null) { |
602 |
user().remove(CHANNEL_BORDER_COLOR); |
603 |
return; |
604 |
} |
605 |
|
606 |
if(c.getRGB() == getChannelBorderColor().getRGB()) return; |
607 |
|
608 |
user().putInt(CHANNEL_BORDER_COLOR, c.getRGB()); |
609 |
} |
610 |
|
611 |
/** |
612 |
* Determines whether to use a custom border color for the selected channels. |
613 |
* @return <code>true</code> if custom border color must be used |
614 |
* for the selected channels, <code>false</code> otherwise. |
615 |
*/ |
616 |
public static boolean |
617 |
getCustomChannelBorderColor() { |
618 |
return user().getBoolean ( |
619 |
CUSTOM_CHANNEL_BORDER_COLOR, DEF_CUSTOM_CHANNEL_BORDER_COLOR |
620 |
); |
621 |
} |
622 |
|
623 |
/** |
624 |
* Sets whether to use a custom border color for the selected channels. |
625 |
* @param b specify <code>true</code> to use a custom border color |
626 |
* for the selected channels, <code>false</code> otherwise. |
627 |
*/ |
628 |
public static void |
629 |
setCustomChannelBorderColor(boolean b) { |
630 |
if(b == getCustomChannelBorderColor()) return; |
631 |
user().putBoolean(CUSTOM_CHANNEL_BORDER_COLOR, b); |
632 |
} |
633 |
|
634 |
/** |
635 |
* Gets the divider location of the vertical split pane. |
636 |
* @return The divider location of the vertical split pane. |
637 |
*/ |
638 |
public static int |
639 |
getVSplitDividerLocation() { |
640 |
return user().getInt(VSPLIT_DIVIDER_LOCATION, DEF_VSPLIT_DIVIDER_LOCATION); |
641 |
} |
642 |
|
643 |
/** |
644 |
* Sets the divider location of the vertical split pane. |
645 |
* @param i The new divider location of the vertical split pane. |
646 |
*/ |
647 |
public static void |
648 |
setVSplitDividerLocation(int i) { |
649 |
if(i == getVSplitDividerLocation()) return; |
650 |
user().putInt(VSPLIT_DIVIDER_LOCATION, i); |
651 |
} |
652 |
|
653 |
/** |
654 |
* Gets the current orchestra index of the last session. |
655 |
* @return The current orchestra index of the last session. |
656 |
*/ |
657 |
public static int |
658 |
getCurrentOrchestraIndex() { |
659 |
return user().getInt(CURRENT_ORCHESTRA_IDX, DEF_CURRENT_ORCHESTRA_IDX); |
660 |
} |
661 |
|
662 |
/** |
663 |
* Sets the current orchestra index. |
664 |
* @param i The orchestra index to be set as current. |
665 |
*/ |
666 |
public static void |
667 |
setCurrentOrchestraIndex(int i) { |
668 |
if(i == getCurrentOrchestraIndex()) return; |
669 |
user().putInt(CURRENT_ORCHESTRA_IDX, i); |
670 |
} |
671 |
} |