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

Annotation of /jsampler/trunk/src/org/jsampler/view/JSViewConfig.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1864 - (hide annotations) (download)
Sat Mar 14 20:44:58 2009 UTC (15 years, 1 month ago) by iliev
File size: 4262 byte(s)
* Fixed bug in the parameter table when editing
  string list parameters with no possibilities
* Mac OS integration, work in progress:
* ant: added new target build-fantasia-osx
* Moved the menu bar on top of the screen
* Use custom application icon
* Register LSCP scripts to be opened with Fantasia
* Changed shortcut keys (use command key instead of ctrl key)

1 iliev 1285 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4 iliev 1864 * Copyright (C) 2005-2009 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 1864 import java.awt.event.KeyEvent;
26    
27 iliev 1540 import java.beans.PropertyChangeEvent;
28     import java.beans.PropertyChangeListener;
29    
30 iliev 1864 import org.jsampler.CC;
31 iliev 1285 import org.jsampler.JSPrefs;
32 iliev 1767 import org.jsampler.MidiInstrument;
33 iliev 1285
34 iliev 1767 import static org.jsampler.JSPrefs.*;
35 iliev 1540
36 iliev 1285 /**
37     * Provides the view configuration.
38     * @author Grigor Iliev
39     */
40     public abstract class JSViewConfig {
41 iliev 1540 private boolean measurementUnitDecibel;
42 iliev 1285
43 iliev 1767 private int firstMidiBankNumber;
44     private int firstMidiProgramNumber;
45    
46 iliev 1285 /** Creates a new instance of <code>JSViewConfig</code> */
47     public
48     JSViewConfig() {
49 iliev 1540 measurementUnitDecibel = preferences().getBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL);
50 iliev 1285
51 iliev 1540 String s = VOL_MEASUREMENT_UNIT_DECIBEL;
52     preferences().addPropertyChangeListener(s, new PropertyChangeListener() {
53     public void
54     propertyChange(PropertyChangeEvent e) {
55     boolean b;
56     b = preferences().getBoolProperty(VOL_MEASUREMENT_UNIT_DECIBEL);
57     measurementUnitDecibel = b;
58     }
59     });
60 iliev 1767
61     firstMidiBankNumber = preferences().getIntProperty(FIRST_MIDI_BANK_NUMBER);
62     firstMidiProgramNumber = preferences().getIntProperty(FIRST_MIDI_PROGRAM_NUMBER);
63    
64     MidiInstrument.setFirstProgramNumber(firstMidiProgramNumber);
65    
66     s = FIRST_MIDI_BANK_NUMBER;
67     preferences().addPropertyChangeListener(s, new PropertyChangeListener() {
68     public void
69     propertyChange(PropertyChangeEvent e) {
70     firstMidiBankNumber = preferences().getIntProperty(FIRST_MIDI_BANK_NUMBER);
71     }
72     });
73    
74     s = FIRST_MIDI_PROGRAM_NUMBER;
75     preferences().addPropertyChangeListener(s, new PropertyChangeListener() {
76     public void
77     propertyChange(PropertyChangeEvent e) {
78     firstMidiProgramNumber = preferences().getIntProperty(FIRST_MIDI_PROGRAM_NUMBER);
79     MidiInstrument.setFirstProgramNumber(firstMidiProgramNumber);
80     }
81     });
82 iliev 1285 }
83    
84     /**
85     * Provides UI information for instruments database trees.
86     */
87     public abstract InstrumentsDbTreeView getInstrumentsDbTreeView();
88    
89     /**
90     * Provides UI information for instruments database tables.
91     */
92     public abstract InstrumentsDbTableView getInstrumentsDbTableView();
93    
94 iliev 1752 public abstract BasicIconSet getBasicIconSet();
95    
96 iliev 1285 public abstract JSPrefs preferences();
97    
98     /**
99     * Determines whether this view provides instruments database support.
100     * @return <code>false</code>
101     */
102     public boolean
103     getInstrumentsDbSupport() { return false; }
104 iliev 1540
105     /**
106     * Determines whether the volume values should be shown in decibels.
107     */
108     public boolean
109     isMeasurementUnitDecibel() { return measurementUnitDecibel; }
110 iliev 1752
111     /** Exports the view configuration of the current session. */
112     public String
113     exportSessionViewConfig() { return ""; }
114 iliev 1767
115 iliev 1818 private SessionViewConfig sessionViewConfig = null;
116    
117     public SessionViewConfig
118     getSessionViewConfig() { return sessionViewConfig; }
119    
120     public void
121     setSessionViewConfig(SessionViewConfig config) { sessionViewConfig = config; }
122    
123 iliev 1767 public int
124     getFirstMidiBankNumber() { return firstMidiBankNumber; }
125    
126     public int
127     getFirstMidiProgramNumber() { return firstMidiProgramNumber; }
128 iliev 1864
129     public int
130     getDefaultModKey() {
131     return CC.isMacOS() ? KeyEvent.META_MASK : KeyEvent.CTRL_MASK;
132     }
133    
134     /**
135     * Determines whether main menu is moved to
136     * the screen menu bar when running on Mac OS
137     */
138     public boolean
139     isUsingScreenMenuBar() {
140     if(!CC.isMacOS()) return false;
141     String s = System.getProperty("apple.laf.useScreenMenuBar");
142     return (s != null && "true".equalsIgnoreCase(s)) ? true : false;
143     }
144 iliev 1285 }

  ViewVC Help
Powered by ViewVC