/[svn]/jsampler/trunk/src/org/jsampler/view/classic/ClassicPrefs.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/view/classic/ClassicPrefs.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1143 - (show annotations) (download)
Mon Apr 2 21:18:31 2007 UTC (17 years, 1 month ago) by iliev
File size: 29920 byte(s)
* upgrading to version 0.4a

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2006 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.classic;
24
25 import java.awt.Color;
26
27 import java.util.prefs.Preferences;
28
29 import org.jsampler.CC;
30
31
32 /**
33 * This class represents the preferences of the JS Classic package.
34 * @author Grigor Iliev
35 */
36 public class ClassicPrefs {
37 private final static String prefNode = "org.jsampler.view.classic";
38
39 private final static String WINDOW_SIZE_AND_LOCATION = "Mainframe.sizeAndLocation";
40 private final static String DEF_WINDOW_SIZE_AND_LOCATION = null;
41
42 private final static String WINDOW_MAXIMIZED = "Mainframe.maximized";
43 private final static boolean DEF_WINDOW_MAXIMIZED = false;
44
45 private final static String SAVE_WINDOW_PROPERTIES = "Mainframe.saveProperties";
46 private final static boolean DEF_SAVE_WINDOW_PROPERTIES = true;
47
48 private final static String HSPLIT_DIVIDER_LOCATION = "HSplit.dividerLocation";
49 private final static int DEF_HSPLIT_DIVIDER_LOCATION = 180;
50
51 private final static String SAVE_LEFT_PANE_STATE = "LeftPane.saveState";
52 private final static boolean DEF_SAVE_LEFT_PANE_STATE = true;
53
54 private final static String LEFT_PANE_PAGE_IDX = "LeftPane.pageIndex";
55 private final static int DEF_LEFT_PANE_PAGE_IDX = 0;
56
57 private final static String SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT = "showLSConsoleWhenRunScript";
58 private final static boolean DEF_SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT = true;
59
60 private final static String SHOW_CHANNELS_BAR = "ChannelsBar.visible";
61 private final static boolean DEF_SHOW_CHANNELS_BAR = true;
62
63 private final static String SHOW_STATUSBAR = "Statusbar.visible";
64 private final static boolean DEF_SHOW_STATUSBAR = true;
65
66 private final static String SHOW_LEFT_PANE = "LeftPane.visible";
67 private final static boolean DEF_SHOW_LEFT_PANE = true;
68
69 private final static String SHOW_STANDARD_BAR = "StandardBar.visible";
70 private final static boolean DEF_SHOW_STANDARD_BAR = true;
71
72 private final static String RECENT_SCRIPTS = "recentScripts";
73 private final static String DEF_RECENT_SCRIPTS = "";
74
75 private final static String RECENT_SCRIPTS_SIZE = "recentScripts.maxNumber";
76 private final static int DEF_RECENT_SCRIPTS_SIZE = 7;
77
78 private final static String SHOW_LS_CONSOLE = "LSConsole.visible";
79 private final static boolean DEF_SHOW_LS_CONSOLE = false;
80
81 private final static String LS_CONSOLE_POPOUT = "LSConsole.popout";
82 private final static boolean DEF_LS_CONSOLE_POPOUT = false;
83
84 private final static String LS_CONSOLE_HISTSIZE = "LSConsole.histsize";
85 private final static int DEF_LS_CONSOLE_HISTSIZE = 1000;
86
87 private final static String LS_CONSOLE_TEXT_COLOR = "LSConsole.textColor";
88 private final static int DEF_LS_CONSOLE_TEXT_COLOR = 0x000000;
89
90 private final static String LS_CONSOLE_BACKGROUND_COLOR = "LSConsole.backgroundColor";
91 private final static int DEF_LS_CONSOLE_BACKGROUND_COLOR = 0xffffff;
92
93 private final static String LS_CONSOLE_NOTIFY_COLOR = "LSConsole.notifyColor";
94 private final static int DEF_LS_CONSOLE_NOTIFY_COLOR = 0xcccccc;
95
96 private final static String LS_CONSOLE_WARNING_COLOR = "LSConsole.warningColor";
97 private final static int DEF_LS_CONSOLE_WARNING_COLOR = 0x6699ff;
98
99 private final static String LS_CONSOLE_ERROR_COLOR = "LSConsole.errorColor";
100 private final static int DEF_LS_CONSOLE_ERROR_COLOR = 0xff0000;
101
102 private final static String SAVE_LS_CONSOLE_HISTORY = "LSConsole.saveCommandHistory";
103 private final static boolean DEF_SAVE_LS_CONSOLE_HISTORY = true;
104
105 private final static String CHANNEL_BORDER_COLOR = "Channel.borderColor";
106 private final static int DEF_CHANNEL_BORDER_COLOR = 0xb8cfe5;
107
108 private final static String CUSTOM_CHANNEL_BORDER_COLOR = "Channel.customBorderColor";
109 private final static boolean DEF_CUSTOM_CHANNEL_BORDER_COLOR = false;
110
111 private final static String CHANNEL_BORDER_HL_COLOR = "Channel.borderMouseOverColor";
112 private final static int DEF_CHANNEL_BORDER_HL_COLOR = 0xb8cfe5;
113
114 private final static String CUSTOM_CHANNEL_BORDER_HL_COLOR = "Channel.customHlColor";
115 private final static boolean DEF_CUSTOM_CHANNEL_BORDER_HL_COLOR = false;
116
117 private final static String SEL_CHANNEL_BG_COLOR = "Channel.sel.BgColor";
118 private final static int DEF_SEL_CHANNEL_BG_COLOR = 0xe0e6eb;
119
120 private final static String CUSTOM_SEL_CHANNEL_BG_COLOR = "Channel.sel.customBgColor";
121 private final static boolean DEF_CUSTOM_SEL_CHANNEL_BG_COLOR = false;
122
123 private final static String HL_CHANNEL_BG_COLOR = "Channel.hl.BgColor";
124 private final static int DEF_HL_CHANNEL_BG_COLOR = -1;
125
126 private final static String CUSTOM_HL_CHANNEL_BG_COLOR = "Channel.hl.customBgColor";
127 private final static boolean DEF_CUSTOM_HL_CHANNEL_BG_COLOR = false;
128
129 private final static String VSPLIT_DIVIDER_LOCATION = "VSplit.dividerLocation";
130 private final static int DEF_VSPLIT_DIVIDER_LOCATION = 200;
131
132 private final static String CURRENT_ORCHESTRA_IDX = "OrchestrasPage.currentOrchestraIndex";
133 private final static int DEF_CURRENT_ORCHESTRA_IDX = 0;
134
135 private final static String LAST_SCRIPT_LOCATION = "lastScriptLocation";
136 private final static String DEF_LAST_SCRIPT_LOCATION = null;
137
138 private final static String NEW_MIDI_INSTR_WIZARD_SKIP1 = "NewMidiInstrumentWizard.skip1";
139 private final static boolean DEF_NEW_MIDI_INSTR_WIZARD_SKIP1 = false;
140
141 private final static String INSTR_LOCATION_METHOD = "InstrLocationMethod";
142 private final static int DEF_INSTR_LOCATION_METHOD = 0;
143
144 private static Preferences userPrefs = Preferences.userRoot().node(prefNode);
145
146 public static Preferences
147 user() { return userPrefs; }
148
149 /**
150 * Gets a string representation of the main window's size and location.
151 * The string representation is a comma-separated list
152 * of x and y coordinates, and width and height of the window.
153 * @return A string representation of the main window's size and location,
154 * or <code>null</code> if the value is not set.
155 */
156 public static String
157 getWindowSizeAndLocation() {
158 return user().get(WINDOW_SIZE_AND_LOCATION, DEF_WINDOW_SIZE_AND_LOCATION);
159 }
160
161 /**
162 * Sets the main window's size and location.
163 * Use <code>null</code> to remove the current value.
164 * @param s A string representation of the main window's size and location.
165 */
166 public static void
167 setWindowSizeAndLocation(String s) {
168 if(s == null) {
169 user().remove(WINDOW_SIZE_AND_LOCATION);
170 return;
171 }
172
173 user().put(WINDOW_SIZE_AND_LOCATION, s);
174 }
175
176 /**
177 * Determines whether the main window should be maximized.
178 * @return <code>true</code> if the main window should be maximized,
179 * <code>false</code> otherwise.
180 */
181 public static boolean
182 getWindowMaximized() {
183 return user().getBoolean(WINDOW_MAXIMIZED, DEF_WINDOW_MAXIMIZED);
184 }
185
186 /**
187 * Sets whether the main window should be maximized.
188 * @param b If <code>true</code> the main window should be maximized.
189 */
190 public static void
191 setWindowMaximized(boolean b) {
192 if(b == getWindowMaximized()) return;
193 user().putBoolean(WINDOW_MAXIMIZED, b);
194 }
195
196 /**
197 * Gets the divider location of the horizontal split pane.
198 * @return The divider location of the horizontal split pane.
199 */
200 public static int
201 getHSplitDividerLocation() {
202 return user().getInt(HSPLIT_DIVIDER_LOCATION, DEF_HSPLIT_DIVIDER_LOCATION);
203 }
204
205 /**
206 * Sets the divider location of the horizontal split pane.
207 * @param i The new divider location of the horizontal split pane.
208 */
209 public static void
210 setHSplitDividerLocation(int i) {
211 if(i == getHSplitDividerLocation()) return;
212 user().putInt(HSPLIT_DIVIDER_LOCATION, i);
213 }
214
215 /**
216 * Determines whether the window properties (like size and location) should be saved.
217 * @return <code>true</code> if the window properties should be saved,
218 * <code>false</code> otherwise.
219 */
220 public static boolean
221 getSaveWindowProperties() {
222 return user().getBoolean(SAVE_WINDOW_PROPERTIES, DEF_SAVE_WINDOW_PROPERTIES);
223 }
224
225 /**
226 * Sets whether the window properties (like size and location) should be saved.
227 * @param b If <code>true</code> the window properties will be saved.
228 */
229 public static void
230 setSaveWindowProperties(boolean b) {
231 if(b == getSaveWindowProperties()) return;
232 user().putBoolean(SAVE_WINDOW_PROPERTIES, b);
233 }
234
235 /**
236 * Determines whether the Left Pane state should be saved.
237 * @return <code>true</code> if the Left Pane state should be saved,
238 * <code>false</code> otherwise.
239 */
240 public static boolean
241 getSaveLeftPaneState() {
242 return user().getBoolean(SAVE_LEFT_PANE_STATE, DEF_SAVE_LEFT_PANE_STATE);
243 }
244
245 /**
246 * Sets whether the Left Pane state should be saved.
247 * @param b If <code>true</code> the Left Pane state will be saved.
248 */
249 public static void
250 setSaveLeftPaneState(boolean b) {
251 if(b == getSaveLeftPaneState()) return;
252 user().putBoolean(SAVE_LEFT_PANE_STATE, b);
253 }
254
255 /**
256 * Gets the index of the page to be shown in the Left Pane.
257 * @return The index of the page to be shown in the Left Pane.
258 */
259 public static int
260 getLeftPanePageIndex() {
261 return user().getInt(LEFT_PANE_PAGE_IDX, DEF_LEFT_PANE_PAGE_IDX);
262 }
263
264 /**
265 * Sets the maximum number of recent scripts to be kept.
266 * @param i Determines the maximum number of recent scripts to be kept.
267 */
268 public static void
269 setLeftPanePageIndex(int i) {
270 if(i == getLeftPanePageIndex()) return;
271 user().putInt(LEFT_PANE_PAGE_IDX, i);
272 }
273
274 /**
275 * Determines whether to show the LS Console when script is run.
276 * @return <code>true</code> if the LS Console should be shown when script is run,
277 * <code>false</code> otherwise.
278 */
279 public static boolean
280 getShowLSConsoleWhenRunScript() {
281 return user().getBoolean (
282 SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, DEF_SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT
283 );
284 }
285
286 /**
287 * Sets whether to show the LS Console when script is run.
288 * @param b Specify <code>true</code> to show LS Console when script is run,
289 * <code>false</code> otherwise.
290 */
291 public static void
292 setShowLSConsoleWhenRunScript(boolean b) {
293 if(b == getShowLSConsoleWhenRunScript()) return;
294 user().putBoolean(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT, b);
295 }
296
297 /**
298 * Determines whether the <b>Channels</b> toolbar should be visible.
299 * @return <code>true</code> if the <b>Channels</b> toolbar should be visible,
300 * <code>false</code> otherwise.
301 */
302 public static boolean
303 shouldShowChannelsBar() {
304 return user().getBoolean(SHOW_CHANNELS_BAR, DEF_SHOW_CHANNELS_BAR);
305 }
306
307 /**
308 * Sets whether the <b>Channels</b> toolbar should be visible.
309 * @param b If <code>true</code> the <b>Channels</b> toolbar will be visible at startup.
310 */
311 public static void
312 setShowChannelsBar(boolean b) {
313 if(b == shouldShowChannelsBar()) return;
314 user().putBoolean(SHOW_CHANNELS_BAR, b);
315 }
316
317 /**
318 * Determines whether the statusbar should be visible.
319 * @return <code>true</code> if the statusbar should be visible,
320 * <code>false</code> otherwise.
321 */
322 public static boolean
323 shouldShowStatusbar() { return user().getBoolean(SHOW_STATUSBAR, DEF_SHOW_STATUSBAR); }
324
325 /**
326 * Sets whether the statusbar should be visible.
327 * @param b If <code>true</code> the statusbar will be visible at startup.
328 */
329 public static void
330 setShowStatusbar(boolean b) {
331 if(b == shouldShowStatusbar()) return;
332 user().putBoolean(SHOW_STATUSBAR, b);
333 }
334
335 /**
336 * Gets the recent script list.
337 * @return The recent script list.
338 */
339 public static String
340 getRecentScripts() {
341 return user().get(RECENT_SCRIPTS, DEF_RECENT_SCRIPTS);
342 }
343
344 /**
345 * Sets the recent script list.
346 * @param s The recent script list.
347 */
348 public static void
349 setRecentScripts(String s) {
350 if(s == null) {
351 user().remove(RECENT_SCRIPTS);
352 return;
353 }
354
355 user().put(RECENT_SCRIPTS, s);
356 }
357
358 /**
359 * Determines the maximum number of recent scripts to be kept.
360 * @return The maximum number of recent scripts to be kept.
361 */
362 public static int
363 getRecentScriptsSize() {
364 return user().getInt(RECENT_SCRIPTS_SIZE, DEF_RECENT_SCRIPTS_SIZE);
365 }
366
367 /**
368 * Sets the maximum number of recent scripts to be kept.
369 * @param i Determines the maximum number of recent scripts to be kept.
370 */
371 public static void
372 setRecentScriptstSize(int i) {
373 if(i == getRecentScriptsSize()) return;
374 user().putInt(RECENT_SCRIPTS_SIZE, i);
375 }
376
377 /**
378 * Determines whether the LS Console should be visible.
379 * @return <code>true</code> if the LS Console should be visible,
380 * <code>false</code> otherwise.
381 */
382 public static boolean
383 shouldShowLSConsole() { return user().getBoolean(SHOW_LS_CONSOLE, DEF_SHOW_LS_CONSOLE); }
384
385 /**
386 * Sets whether the LS Console should be visible.
387 * @param b If <code>true</code> the LS Console will be visible at startup.
388 */
389 public static void
390 setShowLSConsole(boolean b) {
391 if(b == shouldShowLSConsole()) return;
392 user().putBoolean(SHOW_LS_CONSOLE, b);
393 }
394
395 /**
396 * Determines whether the LS Console should be shown in a new window or
397 * docked in the main frame.
398 * @return <code>true</code> if the LS Console should be shown in a new window,
399 * <code>false</code> if the LS Console should be docked in the main frame.
400 */
401 public static boolean
402 isLSConsolePopOut() { return user().getBoolean(LS_CONSOLE_POPOUT, DEF_LS_CONSOLE_POPOUT); }
403
404 /**
405 * Sets whether the LS Console should be shown in a new window or
406 * docked in the main frame.
407 * @param b code>true</code> means that the LS Console will be shown in a new window;
408 * <code>false</code> means that the LS Console will be docked in the main frame.
409 */
410 public static void
411 setLSConsolePopOut(boolean b) {
412 if(b == isLSConsolePopOut()) return;
413 user().putBoolean(LS_CONSOLE_POPOUT, b);
414 }
415
416 /**
417 * Gets the LS Console's command history size.
418 * @return The maximum number of lines to be kept in the command history.
419 */
420 public static int
421 getLSConsoleHistSize() {
422 return user().getInt(LS_CONSOLE_HISTSIZE, DEF_LS_CONSOLE_HISTSIZE);
423 }
424
425 /**
426 * Sets the LS Console's command history size.
427 * @param i The maximum number of lines to be kept in the command history.
428 */
429 public static void
430 setLSConsoleHistSize(int i) {
431 if(i == getLSConsoleHistSize()) return;
432 user().putInt(LS_CONSOLE_HISTSIZE, i);
433 }
434
435 /**
436 * Gets the text color of the LS Console.
437 * @return The text color of the LS Console.
438 */
439 public static Color
440 getLSConsoleTextColor() {
441 int c = user().getInt(LS_CONSOLE_TEXT_COLOR, DEF_LS_CONSOLE_TEXT_COLOR);
442 return new Color(c);
443 }
444
445 /**
446 * Sets the text color of the LS Console.
447 * Use <code>null</code> to remove the current value.
448 * @param color The text color of the LS Console.
449 */
450 public static void
451 setLSConsoleTextColor(Color c) {
452 if(c == null) {
453 user().remove(LS_CONSOLE_TEXT_COLOR);
454 return;
455 }
456
457 if(c.getRGB() == getLSConsoleTextColor().getRGB()) return;
458
459 user().putInt(LS_CONSOLE_TEXT_COLOR, c.getRGB());
460 }
461
462 /**
463 * Gets the background color of the LS Console.
464 * @return The background color of the LS Console.
465 */
466 public static Color
467 getLSConsoleBackgroundColor() {
468 int c = user().getInt(LS_CONSOLE_BACKGROUND_COLOR, DEF_LS_CONSOLE_BACKGROUND_COLOR);
469 return new Color(c);
470 }
471
472 /**
473 * Sets the background color of the LS Console.
474 * Use <code>null</code> to remove the current value.
475 * @param color The background color of the LS Console.
476 */
477 public static void
478 setLSConsoleBackgroundColor(Color c) {
479 if(c == null) {
480 user().remove(LS_CONSOLE_BACKGROUND_COLOR);
481 return;
482 }
483
484 if(c.getRGB() == getLSConsoleBackgroundColor().getRGB()) return;
485
486 user().putInt(LS_CONSOLE_BACKGROUND_COLOR, c.getRGB());
487 }
488
489 /**
490 * Gets the notification messages' color.
491 * @return The notification messages' color.
492 */
493 public static Color
494 getLSConsoleNotifyColor() {
495 int c = user().getInt(LS_CONSOLE_NOTIFY_COLOR, DEF_LS_CONSOLE_NOTIFY_COLOR);
496 return new Color(c);
497 }
498
499 /**
500 * Sets the notification messages' color.
501 * Use <code>null</code> to remove the current value.
502 * @param color The notification messages' color.
503 */
504 public static void
505 setLSConsoleNotifyColor(Color c) {
506 if(c == null) {
507 user().remove(LS_CONSOLE_NOTIFY_COLOR);
508 return;
509 }
510
511 if(c.getRGB() == getLSConsoleNotifyColor().getRGB()) return;
512
513 user().putInt(LS_CONSOLE_NOTIFY_COLOR, c.getRGB());
514 }
515
516 /**
517 * Gets the warning messages' color.
518 * @return The warning messages' color.
519 */
520 public static Color
521 getLSConsoleWarningColor() {
522 int c = user().getInt(LS_CONSOLE_WARNING_COLOR, DEF_LS_CONSOLE_WARNING_COLOR);
523 return new Color(c);
524 }
525
526 /**
527 * Sets the warning messages' color.
528 * Use <code>null</code> to remove the current value.
529 * @param color The warning messages' color.
530 */
531 public static void
532 setLSConsoleWarningColor(Color c) {
533 if(c == null) {
534 user().remove(LS_CONSOLE_WARNING_COLOR);
535 return;
536 }
537
538 if(c.getRGB() == getLSConsoleWarningColor().getRGB()) return;
539
540 user().putInt(LS_CONSOLE_WARNING_COLOR, c.getRGB());
541 }
542
543 /**
544 * Gets the error messages' color.
545 * @return The error messages' color.
546 */
547 public static Color
548 getLSConsoleErrorColor() {
549 int c = user().getInt(LS_CONSOLE_ERROR_COLOR, DEF_LS_CONSOLE_ERROR_COLOR);
550 return new Color(c);
551 }
552
553 /**
554 * Sets the error messages' color.
555 * Use <code>null</code> to remove the current value.
556 * @param color The error messages' color.
557 */
558 public static void
559 setLSConsoleErrorColor(Color c) {
560 if(c == null) {
561 user().remove(LS_CONSOLE_ERROR_COLOR);
562 return;
563 }
564
565 if(c.getRGB() == getLSConsoleErrorColor().getRGB()) return;
566
567 user().putInt(LS_CONSOLE_ERROR_COLOR, c.getRGB());
568 }
569
570 /**
571 * Determines whether the command history should be saved on exit.
572 * @return <code>true</code> if the command history should be saved on exit,
573 * <code>false</code> otherwise.
574 */
575 public static boolean
576 getSaveConsoleHistory() {
577 return user().getBoolean(SAVE_LS_CONSOLE_HISTORY, DEF_SAVE_LS_CONSOLE_HISTORY);
578 }
579
580 /**
581 * Sets whether the command history should be saved on exit.
582 * @param b If <code>true</code> the command history will be saved on exit.
583 */
584 public static void
585 setSaveConsoleHistory(boolean b) {
586 if(b == getSaveConsoleHistory()) return;
587 user().putBoolean(SAVE_LS_CONSOLE_HISTORY, b);
588 }
589
590 /**
591 * Determines whether the left pane should be visible.
592 * @return <code>true</code> if the left pane should be visible,
593 * <code>false</code> otherwise.
594 */
595 public static boolean
596 shouldShowLeftPane() { return user().getBoolean(SHOW_LEFT_PANE, DEF_SHOW_LEFT_PANE); }
597
598 /**
599 * Sets whether the left pane should be visible.
600 * @param b If <code>true</code> the left pane will be visible at startup.
601 */
602 public static void
603 setShowLeftPane(boolean b) {
604 if(b == shouldShowLeftPane()) return;
605 user().putBoolean(SHOW_LEFT_PANE, b);
606 }
607
608 /**
609 * Determines whether the <b>Standard</b> toolbar should be visible.
610 * @return <code>true</code> if the <b>Standard</b> toolbar should be visible,
611 * <code>false</code> otherwise.
612 */
613 public static boolean
614 shouldShowStandardBar() {
615 return user().getBoolean(SHOW_STANDARD_BAR, DEF_SHOW_STANDARD_BAR);
616 }
617
618 /**
619 * Sets whether the <b>Standard</b> toolbar should be visible.
620 * @param b If <code>true</code> the <b>Standard</b> toolbar will be visible at startup.
621 */
622 public static void
623 setShowStandardBar(boolean b) {
624 if(b == shouldShowStandardBar()) return;
625 user().putBoolean(SHOW_STANDARD_BAR, b);
626 }
627
628 /**
629 * Gets the default border color that is used for the selected channels.
630 * @return The default border color that is used for the selected channels.
631 */
632 public static Color
633 getDefaultChannelBorderColor() { return new Color(DEF_CHANNEL_BORDER_COLOR); }
634
635 /**
636 * Gets the custom border color to be used for the selected channels.
637 * @return The custom border color to be used for the selected
638 * channels or <code>null</code> if the color is not specified.
639 */
640 public static Color
641 getChannelBorderColor() {
642 int c = user().getInt(CHANNEL_BORDER_COLOR, DEF_CHANNEL_BORDER_COLOR);
643 return new Color(c);
644 }
645
646 /**
647 * Sets the border color to be used for the selected channels.
648 * Use <code>null</code> to remove the current value.
649 * @param color The border color to be used for the selected channels.
650 */
651 public static void
652 setChannelBorderColor(Color c) {
653 if(c == null) {
654 user().remove(CHANNEL_BORDER_COLOR);
655 return;
656 }
657
658 if(c.getRGB() == getChannelBorderColor().getRGB()) return;
659
660 user().putInt(CHANNEL_BORDER_COLOR, c.getRGB());
661 }
662
663 /**
664 * Determines whether to use a custom border color for the selected channels.
665 * @return <code>true</code> if custom border color must be used
666 * for the selected channels, <code>false</code> otherwise.
667 */
668 public static boolean
669 getCustomChannelBorderColor() {
670 return user().getBoolean (
671 CUSTOM_CHANNEL_BORDER_COLOR, DEF_CUSTOM_CHANNEL_BORDER_COLOR
672 );
673 }
674
675 /**
676 * Sets whether to use a custom border color for the selected channels.
677 * @param b specify <code>true</code> to use a custom border color
678 * for the selected channels, <code>false</code> otherwise.
679 */
680 public static void
681 setCustomChannelBorderColor(boolean b) {
682 if(b == getCustomChannelBorderColor()) return;
683 user().putBoolean(CUSTOM_CHANNEL_BORDER_COLOR, b);
684 }
685
686 /**
687 * Gets the default highlighted border color that
688 * is used when the mouse pointer is over a channel.
689 * @return The default highlighted border color.
690 */
691 public static Color
692 getDefaultChannelBorderHlColor() { return new Color(DEF_CHANNEL_BORDER_HL_COLOR); }
693
694 /**
695 * Gets the custom highlighted border color that
696 * is used when the mouse pointer is over a channel.
697 * @return The custom highlighted border color.
698 */
699 public static Color
700 getChannelBorderHlColor() {
701 int c = user().getInt(CHANNEL_BORDER_HL_COLOR, DEF_CHANNEL_BORDER_HL_COLOR);
702 return new Color(c);
703 }
704
705 /**
706 * Sets the highlighted border color that
707 * is used when the mouse pointer is over a channel.
708 * Use <code>null</code> to remove the current value.
709 * @param color The new highlighted border color.
710 */
711 public static void
712 setChannelBorderHlColor(Color c) {
713 if(c == null) {
714 user().remove(CHANNEL_BORDER_HL_COLOR);
715 return;
716 }
717
718 if(c.getRGB() == getChannelBorderHlColor().getRGB()) return;
719
720 user().putInt(CHANNEL_BORDER_HL_COLOR, c.getRGB());
721 }
722
723 /**
724 * Determines whether to use a custom highlighted border color.
725 * @return <code>true</code> if custom highlighted border color
726 * must be used, <code>false</code> otherwise.
727 */
728 public static boolean
729 getCustomChannelBorderHlColor() {
730 return user().getBoolean (
731 CUSTOM_CHANNEL_BORDER_HL_COLOR, DEF_CUSTOM_CHANNEL_BORDER_HL_COLOR
732 );
733 }
734
735 /**
736 * Sets whether to use a custom highlighted border color.
737 * @param b specify <code>true</code> to use a custom highlighted
738 * border color, <code>false</code> otherwise.
739 */
740 public static void
741 setCustomChannelBorderHlColor(boolean b) {
742 if(b == getCustomChannelBorderHlColor()) return;
743 user().putBoolean(CUSTOM_CHANNEL_BORDER_HL_COLOR, b);
744 }
745
746 /**
747 * Gets the custom background color that
748 * is used when the channel is selected.
749 * @return The custom background color that
750 * is used when the channel is selected.
751 */
752 public static Color
753 getSelectedChannelBgColor() {
754 int c = user().getInt(SEL_CHANNEL_BG_COLOR, DEF_SEL_CHANNEL_BG_COLOR);
755 return c == -1 ? null : new Color(c);
756 }
757
758 /**
759 * Sets the custom background color to
760 * be used when the channel is selected.
761 * Use <code>null</code> to remove the current value.
762 * @param color The new background color to
763 * be used when the channel is selected.
764 */
765 public static void
766 setSelectedChannelBgColor(Color c) {
767 if(c == null) {
768 user().remove(SEL_CHANNEL_BG_COLOR);
769 return;
770 }
771
772 if(getSelectedChannelBgColor() != null) {
773 if(c.getRGB() == getSelectedChannelBgColor().getRGB()) return;
774 }
775
776 user().putInt(SEL_CHANNEL_BG_COLOR, c.getRGB());
777 }
778
779 /**
780 * Determines whether to use a custom background color when a channel is selected.
781 * @return <code>true</code> if custom background color
782 * should be used, <code>false</code> otherwise.
783 */
784 public static boolean
785 getCustomSelectedChannelBgColor() {
786 return user().getBoolean (
787 CUSTOM_SEL_CHANNEL_BG_COLOR, DEF_CUSTOM_SEL_CHANNEL_BG_COLOR
788 );
789 }
790
791 /**
792 * Sets whether to use a custom background color when a channel is selected.
793 * @param b specify <code>true</code> to use a custom
794 * background color, <code>false</code> otherwise.
795 */
796 public static void
797 setCustomSelectedChannelBgColor(boolean b) {
798 if(b == getCustomSelectedChannelBgColor()) return;
799 user().putBoolean(CUSTOM_SEL_CHANNEL_BG_COLOR, b);
800 }
801
802 /**
803 * Gets the custom background color that
804 * is used when the mouse pointer is over a channel.
805 * @return The custom background color that
806 * is used when the mouse pointer is over a channel.
807 */
808 public static Color
809 getHighlightedChannelBgColor() {
810 int c = user().getInt(HL_CHANNEL_BG_COLOR, DEF_HL_CHANNEL_BG_COLOR);
811 return c == -1 ? null : new Color(c);
812 }
813
814 /**
815 * Sets the custom background color to
816 * be used when the mouse pointer is over a channel.
817 * Use <code>null</code> to remove the current value.
818 * @param color The new background color to
819 * be used when the mouse pointer is over a channel.
820 */
821 public static void
822 setHighlightedChannelBgColor(Color c) {
823 if(c == null) {
824 user().remove(HL_CHANNEL_BG_COLOR);
825 return;
826 }
827
828 if(getHighlightedChannelBgColor() != null) {
829 if(c.getRGB() == getHighlightedChannelBgColor().getRGB()) return;
830 }
831
832 user().putInt(HL_CHANNEL_BG_COLOR, c.getRGB());
833 }
834
835 /**
836 * Determines whether to use a custom background
837 * color when the mouse pointer is over a channel.
838 * @return <code>true</code> if custom background color
839 * should be used, <code>false</code> otherwise.
840 */
841 public static boolean
842 getCustomHighlightedChannelBgColor() {
843 return user().getBoolean (
844 CUSTOM_HL_CHANNEL_BG_COLOR, DEF_CUSTOM_HL_CHANNEL_BG_COLOR
845 );
846 }
847
848 /**
849 * Sets whether to use a custom background
850 * color when the mouse pointer is over a channel.
851 * @param b specify <code>true</code> to use a custom
852 * background color, <code>false</code> otherwise.
853 */
854 public static void
855 setCustomHighlightedChannelBgColor(boolean b) {
856 if(b == getCustomHighlightedChannelBgColor()) return;
857 user().putBoolean(CUSTOM_HL_CHANNEL_BG_COLOR, b);
858 }
859
860 /**
861 * Gets the divider location of the vertical split pane.
862 * @return The divider location of the vertical split pane.
863 */
864 public static int
865 getVSplitDividerLocation() {
866 return user().getInt(VSPLIT_DIVIDER_LOCATION, DEF_VSPLIT_DIVIDER_LOCATION);
867 }
868
869 /**
870 * Sets the divider location of the vertical split pane.
871 * @param i The new divider location of the vertical split pane.
872 */
873 public static void
874 setVSplitDividerLocation(int i) {
875 if(i == getVSplitDividerLocation()) return;
876 user().putInt(VSPLIT_DIVIDER_LOCATION, i);
877 }
878
879 /**
880 * Gets the current orchestra index of the last session.
881 * @return The current orchestra index of the last session.
882 */
883 public static int
884 getCurrentOrchestraIndex() {
885 return user().getInt(CURRENT_ORCHESTRA_IDX, DEF_CURRENT_ORCHESTRA_IDX);
886 }
887
888 /**
889 * Sets the current orchestra index.
890 * @param i The orchestra index to be set as current.
891 */
892 public static void
893 setCurrentOrchestraIndex(int i) {
894 if(i == getCurrentOrchestraIndex()) return;
895 user().putInt(CURRENT_ORCHESTRA_IDX, i);
896 }
897
898 /**
899 * Gets the absolute path of the directory containing the last saved script.
900 * @return The absolute path of the directory containing the last saved script or
901 * <code>null</code>.
902 */
903 public static String
904 getLastScriptLocation() {
905 return user().get(LAST_SCRIPT_LOCATION, DEF_LAST_SCRIPT_LOCATION);
906 }
907
908 /**
909 * Sets the absolute path of the directory containing the last saved script.
910 * @param s The absolute path of the directory containing the last saved script.
911 */
912 public static void
913 setLastScriptLocation(String s) {
914 if(s == null) {
915 user().remove(LAST_SCRIPT_LOCATION);
916 return;
917 }
918
919 user().put(LAST_SCRIPT_LOCATION, s);
920 }
921
922 /**
923 * Determines whether the first step in the
924 * <b>New MIDI Instrument Wizard</b> should be skipped.
925 * @return <code>true</code> if the first step should be skipped,
926 * <code>false</code> otherwise.
927 */
928 public static boolean
929 getNewMidiInstrWizardSkip1() {
930 return user().getBoolean (
931 NEW_MIDI_INSTR_WIZARD_SKIP1, DEF_NEW_MIDI_INSTR_WIZARD_SKIP1
932 );
933 }
934
935 /**
936 * Sets whether the first step in the
937 * <b>New MIDI Instrument Wizard</b> should be skipped.
938 * @param b If <code>true</code> the first step will be skipped.
939 */
940 public static void
941 setNewMidiInstrWizardSkip1(boolean b) {
942 if(b == getNewMidiInstrWizardSkip1()) return;
943 user().putBoolean(NEW_MIDI_INSTR_WIZARD_SKIP1, b);
944 }
945
946 /**
947 * Gets the instrument location method (locating an instrument by
948 * choosing from orchestra, etc).
949 * @return The index of the instrument location method.
950 */
951 public static int
952 getInstrLocationMethod() {
953 return user().getInt(INSTR_LOCATION_METHOD, DEF_INSTR_LOCATION_METHOD);
954 }
955
956 /**
957 * Sets the instrument location method.
958 * @param i Determines the instrument location method.
959 */
960 public static void
961 setInstrLocationMethod(int i) {
962 if(i == getInstrLocationMethod()) return;
963 user().putInt(INSTR_LOCATION_METHOD, i);
964 }
965
966
967 }

  ViewVC Help
Powered by ViewVC