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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1767 - (show annotations) (download)
Mon Sep 8 00:19:27 2008 UTC (15 years, 7 months ago) by iliev
File size: 5119 byte(s)
* Added `Copy To' and `Move To' commands to the MIDI bank context menu
  and to the MIDI instrument context menu
* Added commands to the MIDI instrument context menu for moving
  a MIDI instrument to another program
  (right-click on a MIDI instrument and choose `Change Program')
* Added option to choose between zero-based and one-based
  MIDI bank/program numbering
  (choose Edit/Preferences, then click the `Advanced' button)
* Added option to choose whether to include MIDI instrument
  mappings when exporting a sampler configuration to LSCP script.
  (choose Edit/Preferences, then click the `Advanced' button)
* Added option to set the MIDI instrument loading in background
  when exporting MIDI instrument mappings to LSCP script.
  (choose Edit/Preferences, then click the `Advanced' button)
* Implemented an option to change the socket read timeout
  (choose Edit/Preferences, then click the `Backend' tab)
* Updated LscpTree
* Fantasia: Added option to hide the active stream/voice count statistic
  in the sampler channel's small view
  (choose Edit/Preferences, then click the `Channels' tab)
* Fantasia: `Turn off animation effects' checkbox moved to the `View' tab

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

  ViewVC Help
Powered by ViewVC