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

Annotation of /jsampler/trunk/src/org/jsampler/view/fantasia/ViewConfig.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1786 - (hide annotations) (download)
Wed Oct 8 22:38:15 2008 UTC (15 years, 6 months ago) by iliev
File size: 5425 byte(s)
* Implemented option to launch the backend if it is not yet started
  (choose Edit/Preferences, then click the `Backend' tab)
* LSCP scripts can now be run by passing them to jsampler
  as command-line arguments
* The scripts in the `scripts' directory now pass the command-line
  arguments to the respective jsampler distribution
* ant: the default target is now build-fantasia
* bugfix: backend address was always set to 127.0.0.1 when adding
  backend to the backend list

1 iliev 1286 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4 iliev 1752 * Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com>
5 iliev 1286 *
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.fantasia;
24    
25     import javax.swing.Icon;
26 iliev 1786 import javax.swing.ImageIcon;
27 iliev 1286 import javax.swing.UIManager;
28    
29 iliev 1752 import org.jsampler.CC;
30 iliev 1286 import org.jsampler.JSPrefs;
31    
32     import org.jsampler.view.InstrumentsDbTableView;
33     import org.jsampler.view.InstrumentsDbTreeView;
34 iliev 1752 import org.jsampler.view.BasicIconSet;
35 iliev 1286 import org.jsampler.view.JSViewConfig;
36    
37 iliev 1743 import org.jvnet.substance.api.SubstanceConstants;
38 iliev 1286 import org.jvnet.substance.SubstanceLookAndFeel;
39     import org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel;
40    
41     /**
42     *
43     * @author Grigor Iliev
44     */
45     public class ViewConfig extends JSViewConfig {
46     private InstrumentsDbTreeView instrumentsDbTreeView = new TreeView();
47     private InstrumentsDbTableView instrumentsDbTableView = new TableView();
48 iliev 1752 private BasicIconSet basicIconSet = new IconSet();
49 iliev 1286
50     /** Creates a new instance of <code>ViewConfig</code> */
51     public
52     ViewConfig() {
53     try {
54     UIManager.setLookAndFeel(new SubstanceRavenGraphiteLookAndFeel());
55 iliev 1743 UIManager.put(SubstanceLookAndFeel.WATERMARK_VISIBLE, Boolean.FALSE);
56 iliev 1496
57 iliev 1729 UIManager.put (
58     SubstanceLookAndFeel.TABBED_PANE_CONTENT_BORDER_KIND,
59     SubstanceConstants.TabContentPaneBorderKind.SINGLE_FULL
60     );
61    
62 iliev 1496 if(!preferences().getBoolProperty("TurnOffCustomWindowDecoration")) {
63     javax.swing.JFrame.setDefaultLookAndFeelDecorated(true);
64     javax.swing.JDialog.setDefaultLookAndFeelDecorated(true);
65     }
66    
67     Res.loadTheme(preferences().getStringProperty("Theme"));
68 iliev 1286 } catch(Exception e) {
69     e.printStackTrace();
70     }
71     }
72    
73 iliev 1786 @Override
74 iliev 1286 public JSPrefs
75     preferences() { return FantasiaPrefs.preferences(); }
76    
77 iliev 1767 /** Exports the view configuration of the current session. */
78 iliev 1786 @Override
79 iliev 1767 public String
80     exportSessionViewConfig() {
81     StringBuffer sb = new StringBuffer();
82     MainFrame frame = (MainFrame)CC.getMainFrame();
83    
84     for(int i = 0; i < frame.getChannelsPane(0).getChannelCount(); i++) {
85     Channel c = (Channel)frame.getChannelsPane(0).getChannel(i);
86    
87     sb.append("#jsampler.fantasia: [channel]\r\n");
88    
89     switch(c.getViewTracker().getOriginalView().getType()) {
90     case SMALL:
91     sb.append("#jsampler.fantasia: viewType = SMALL\r\n");
92     break;
93    
94     case NORMAL:
95     sb.append("#jsampler.fantasia: viewType = NORMAL\r\n");
96     break;
97     }
98    
99     sb.append("#jsampler.fantasia: \r\n");
100     }
101    
102     MidiDevicesPane midi = frame.getRightSidePane().getDevicesPane().getMidiDevicesPane();
103    
104     for(int i = 0; i < midi.getDevicePaneCount(); i++) {
105     sb.append("#jsampler.fantasia: [MIDI device]\r\n");
106    
107     if(midi.getDevicePaneAt(i).isOptionsPaneExpanded()) {
108     sb.append("#jsampler.fantasia: expanded = true\r\n");
109     } else {
110     sb.append("#jsampler.fantasia: expanded = false\r\n");
111     }
112    
113     sb.append("#jsampler.fantasia: \r\n");
114     }
115    
116     return sb.toString();
117     }
118    
119 iliev 1786 @Override
120 iliev 1286 public InstrumentsDbTreeView
121     getInstrumentsDbTreeView() { return instrumentsDbTreeView; }
122    
123 iliev 1786 @Override
124 iliev 1286 public InstrumentsDbTableView
125     getInstrumentsDbTableView() { return instrumentsDbTableView; }
126    
127 iliev 1786 @Override
128 iliev 1752 public BasicIconSet
129     getBasicIconSet() { return basicIconSet; }
130    
131 iliev 1286 private class TreeView implements InstrumentsDbTreeView {
132 iliev 1786 @Override
133 iliev 1286 public Icon
134     getRootIcon() { return Res.iconDb16; }
135    
136 iliev 1786 @Override
137 iliev 1286 public Icon
138     getClosedIcon() { return Res.iconFolder16; }
139    
140 iliev 1786 @Override
141 iliev 1286 public Icon
142     getOpenIcon() { return Res.iconFolderOpen16; }
143    
144 iliev 1786 @Override
145 iliev 1286 public Icon
146     getInstrumentIcon() { return Res.iconInstrument16; }
147    
148 iliev 1786 @Override
149 iliev 1286 public Icon
150     getGigInstrumentIcon() { return Res.iconInstrument16; }
151     }
152    
153     private static class TableView implements InstrumentsDbTableView {
154 iliev 1786 @Override
155 iliev 1286 public Icon
156     getFolderIcon() { return Res.iconFolder16; }
157    
158 iliev 1786 @Override
159 iliev 1286 public Icon
160     getInstrumentIcon() { return Res.iconInstrument16; }
161    
162 iliev 1786 @Override
163 iliev 1286 public Icon
164     getGigInstrumentIcon() { return Res.iconInstrument16; }
165     }
166    
167 iliev 1752 private class IconSet implements BasicIconSet {
168 iliev 1786 @Override
169     public ImageIcon
170     getApplicationIcon() { return Res.iconAppIcon; }
171    
172     @Override
173 iliev 1752 public Icon
174     getBack16Icon() { return Res.iconBack16; }
175    
176 iliev 1786 @Override
177 iliev 1752 public Icon
178     getUp16Icon() { return Res.iconUp16; }
179    
180 iliev 1786 @Override
181 iliev 1752 public Icon
182     getForward16Icon() { return Res.iconNext16; }
183    
184 iliev 1786 @Override
185 iliev 1752 public Icon
186     getReload16Icon() { return Res.iconReload16; }
187    
188 iliev 1786 @Override
189 iliev 1752 public Icon
190     getPreferences16Icon() { return Res.iconPreferences16; }
191 iliev 1767
192 iliev 1786 @Override
193 iliev 1767 public Icon
194     getWarning32Icon() { return Res.iconWarning32; }
195    
196 iliev 1786 @Override
197 iliev 1767 public Icon
198     getQuestion32Icon() { return Res.iconQuestion32; }
199 iliev 1752 }
200    
201 iliev 1786 @Override
202 iliev 1286 public boolean
203     getInstrumentsDbSupport() { return true; }
204     }

  ViewVC Help
Powered by ViewVC