1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com> |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
22 |
|
|
23 |
package org.jsampler.view; |
package org.jsampler.view; |
24 |
|
|
25 |
|
import java.beans.PropertyChangeEvent; |
26 |
|
import java.beans.PropertyChangeListener; |
27 |
|
|
28 |
import org.jsampler.JSPrefs; |
import org.jsampler.JSPrefs; |
29 |
|
import org.jsampler.MidiInstrument; |
30 |
|
|
31 |
|
import static org.jsampler.JSPrefs.*; |
32 |
|
|
33 |
/** |
/** |
34 |
* Provides the view configuration. |
* Provides the view configuration. |
35 |
* @author Grigor Iliev |
* @author Grigor Iliev |
36 |
*/ |
*/ |
37 |
public abstract class JSViewConfig { |
public abstract class JSViewConfig { |
38 |
|
private boolean measurementUnitDecibel; |
39 |
|
|
40 |
|
private int firstMidiBankNumber; |
41 |
|
private int firstMidiProgramNumber; |
42 |
|
|
43 |
/** Creates a new instance of <code>JSViewConfig</code> */ |
/** Creates a new instance of <code>JSViewConfig</code> */ |
44 |
public |
public |
45 |
JSViewConfig() { |
JSViewConfig() { |
46 |
|
measurementUnitDecibel = preferences().getBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL); |
47 |
|
|
48 |
|
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 |
|
|
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 |
} |
} |
80 |
|
|
81 |
/** |
/** |
88 |
*/ |
*/ |
89 |
public abstract InstrumentsDbTableView getInstrumentsDbTableView(); |
public abstract InstrumentsDbTableView getInstrumentsDbTableView(); |
90 |
|
|
91 |
|
public abstract BasicIconSet getBasicIconSet(); |
92 |
|
|
93 |
public abstract JSPrefs preferences(); |
public abstract JSPrefs preferences(); |
94 |
|
|
95 |
/** |
/** |
98 |
*/ |
*/ |
99 |
public boolean |
public boolean |
100 |
getInstrumentsDbSupport() { return false; } |
getInstrumentsDbSupport() { return false; } |
101 |
|
|
102 |
|
/** |
103 |
|
* Determines whether the volume values should be shown in decibels. |
104 |
|
*/ |
105 |
|
public boolean |
106 |
|
isMeasurementUnitDecibel() { return measurementUnitDecibel; } |
107 |
|
|
108 |
|
/** Exports the view configuration of the current session. */ |
109 |
|
public String |
110 |
|
exportSessionViewConfig() { return ""; } |
111 |
|
|
112 |
|
private SessionViewConfig sessionViewConfig = null; |
113 |
|
|
114 |
|
public SessionViewConfig |
115 |
|
getSessionViewConfig() { return sessionViewConfig; } |
116 |
|
|
117 |
|
public void |
118 |
|
setSessionViewConfig(SessionViewConfig config) { sessionViewConfig = config; } |
119 |
|
|
120 |
|
public int |
121 |
|
getFirstMidiBankNumber() { return firstMidiBankNumber; } |
122 |
|
|
123 |
|
public int |
124 |
|
getFirstMidiProgramNumber() { return firstMidiProgramNumber; } |
125 |
} |
} |