1 |
iliev |
1285 |
/* |
2 |
|
|
* JSampler - a java front-end for LinuxSampler |
3 |
|
|
* |
4 |
iliev |
1752 |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
5 |
iliev |
1285 |
* |
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; |
24 |
|
|
|
25 |
iliev |
1540 |
import java.beans.PropertyChangeEvent; |
26 |
|
|
import java.beans.PropertyChangeListener; |
27 |
|
|
|
28 |
iliev |
1285 |
import org.jsampler.JSPrefs; |
29 |
iliev |
1767 |
import org.jsampler.MidiInstrument; |
30 |
iliev |
1285 |
|
31 |
iliev |
1767 |
import static org.jsampler.JSPrefs.*; |
32 |
iliev |
1540 |
|
33 |
iliev |
1285 |
/** |
34 |
|
|
* Provides the view configuration. |
35 |
|
|
* @author Grigor Iliev |
36 |
|
|
*/ |
37 |
|
|
public abstract class JSViewConfig { |
38 |
iliev |
1540 |
private boolean measurementUnitDecibel; |
39 |
iliev |
1285 |
|
40 |
iliev |
1767 |
private int firstMidiBankNumber; |
41 |
|
|
private int firstMidiProgramNumber; |
42 |
|
|
|
43 |
iliev |
1285 |
/** Creates a new instance of <code>JSViewConfig</code> */ |
44 |
|
|
public |
45 |
|
|
JSViewConfig() { |
46 |
iliev |
1540 |
measurementUnitDecibel = preferences().getBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL); |
47 |
iliev |
1285 |
|
48 |
iliev |
1540 |
String s = VOL_MEASUREMENT_UNIT_DECIBEL; |
49 |
|
|
preferences().addPropertyChangeListener(s, new PropertyChangeListener() { |
50 |
|
|
public void |
51 |
|
|
propertyChange(PropertyChangeEvent e) { |
52 |
|
|
boolean b; |
53 |
|
|
b = preferences().getBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL); |
54 |
|
|
measurementUnitDecibel = b; |
55 |
|
|
} |
56 |
|
|
}); |
57 |
iliev |
1767 |
|
58 |
|
|
firstMidiBankNumber = preferences().getIntProperty(FIRST_MIDI_BANK_NUMBER); |
59 |
|
|
firstMidiProgramNumber = preferences().getIntProperty(FIRST_MIDI_PROGRAM_NUMBER); |
60 |
|
|
|
61 |
|
|
MidiInstrument.setFirstProgramNumber(firstMidiProgramNumber); |
62 |
|
|
|
63 |
|
|
s = FIRST_MIDI_BANK_NUMBER; |
64 |
|
|
preferences().addPropertyChangeListener(s, new PropertyChangeListener() { |
65 |
|
|
public void |
66 |
|
|
propertyChange(PropertyChangeEvent e) { |
67 |
|
|
firstMidiBankNumber = preferences().getIntProperty(FIRST_MIDI_BANK_NUMBER); |
68 |
|
|
} |
69 |
|
|
}); |
70 |
|
|
|
71 |
|
|
s = FIRST_MIDI_PROGRAM_NUMBER; |
72 |
|
|
preferences().addPropertyChangeListener(s, new PropertyChangeListener() { |
73 |
|
|
public void |
74 |
|
|
propertyChange(PropertyChangeEvent e) { |
75 |
|
|
firstMidiProgramNumber = preferences().getIntProperty(FIRST_MIDI_PROGRAM_NUMBER); |
76 |
|
|
MidiInstrument.setFirstProgramNumber(firstMidiProgramNumber); |
77 |
|
|
} |
78 |
|
|
}); |
79 |
iliev |
1285 |
} |
80 |
|
|
|
81 |
|
|
/** |
82 |
|
|
* Provides UI information for instruments database trees. |
83 |
|
|
*/ |
84 |
|
|
public abstract InstrumentsDbTreeView getInstrumentsDbTreeView(); |
85 |
|
|
|
86 |
|
|
/** |
87 |
|
|
* Provides UI information for instruments database tables. |
88 |
|
|
*/ |
89 |
|
|
public abstract InstrumentsDbTableView getInstrumentsDbTableView(); |
90 |
|
|
|
91 |
iliev |
1752 |
public abstract BasicIconSet getBasicIconSet(); |
92 |
|
|
|
93 |
iliev |
1285 |
public abstract JSPrefs preferences(); |
94 |
|
|
|
95 |
|
|
/** |
96 |
|
|
* Determines whether this view provides instruments database support. |
97 |
|
|
* @return <code>false</code> |
98 |
|
|
*/ |
99 |
|
|
public boolean |
100 |
|
|
getInstrumentsDbSupport() { return false; } |
101 |
iliev |
1540 |
|
102 |
|
|
/** |
103 |
|
|
* Determines whether the volume values should be shown in decibels. |
104 |
|
|
*/ |
105 |
|
|
public boolean |
106 |
|
|
isMeasurementUnitDecibel() { return measurementUnitDecibel; } |
107 |
iliev |
1752 |
|
108 |
|
|
/** Exports the view configuration of the current session. */ |
109 |
|
|
public String |
110 |
|
|
exportSessionViewConfig() { return ""; } |
111 |
iliev |
1767 |
|
112 |
iliev |
1818 |
private SessionViewConfig sessionViewConfig = null; |
113 |
|
|
|
114 |
|
|
public SessionViewConfig |
115 |
|
|
getSessionViewConfig() { return sessionViewConfig; } |
116 |
|
|
|
117 |
|
|
public void |
118 |
|
|
setSessionViewConfig(SessionViewConfig config) { sessionViewConfig = config; } |
119 |
|
|
|
120 |
iliev |
1767 |
public int |
121 |
|
|
getFirstMidiBankNumber() { return firstMidiBankNumber; } |
122 |
|
|
|
123 |
|
|
public int |
124 |
|
|
getFirstMidiProgramNumber() { return firstMidiProgramNumber; } |
125 |
iliev |
1285 |
} |