source: trunk/src_apollo/org/apollo/gui/SoundDeskPopup.java@ 315

Last change on this file since 315 was 315, checked in by bjn8, 16 years ago

Apollo spin-off added

File size: 11.3 KB
Line 
1package org.apollo.gui;
2
3/**
4 *
5 * @author Brook Novak
6 * @deprecated
7 */
8public class SoundDeskPopup {
9
10
11 //
12//
13// /**
14// * Why doesn't java support partial classes!
15// *
16// * @author Brook Novak
17// *
18// */
19// private class SoundDeskPopup extends Popup implements ActionListener {
20//
21// private JButton playPauseButton;
22// private JButton stopButton;
23// private JButton rewindButton;
24// private JButton closeButton;
25// private JToggleButton soloButton;
26// private JToggleButton muteButton;
27// private JSlider volumeSlider;
28// private JPanel nameLabelParent;
29// private JTree trackTree;
30// private JButton scrollLeftButton;
31// private JButton scrollRightButton;
32// private JPanel channelPane;
33//
34// private EmulatedTextItem nameLabel;
35//
36// private boolean isUpdatingGUI = false;
37//
38// /**
39// * Initializes the GUI
40// */
41// SoundDeskPopup() {
42//
43// super(new BorderLayout());
44 //
45// JPanel toolbar = createToolbar();
46//
47// JPanel optionsPane = createOptionsPane();
48//
49// JSplitPane centerStage = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
50//
51//
52//
53// }
54//
55// /**
56// * Creates the "toolbar" like appearance at the top
57// *
58// * @return
59// * The JPanel containing the toolbar buttons.
60// */
61// private JPanel createToolbar() {
62//
63// final int BUTTON_SIZE = 40;
64//
65// playPauseButton = new JButton();
66// playPauseButton.addActionListener(this);
67// playPauseButton.setIcon(IconRepository.getIcon("play.png"));
68// playPauseButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
69// playPauseButton.setToolTipText("Play selection / Pause");
70//
71// stopButton = new JButton();
72// stopButton.setEnabled(false);
73// stopButton.addActionListener(this);
74// stopButton.setIcon(IconRepository.getIcon("stop.png"));
75// stopButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
76// stopButton.setToolTipText("Stop playback");
77//
78// rewindButton = new JButton();
79// rewindButton.addActionListener(this);
80// rewindButton.setIcon(IconRepository.getIcon("rewind.png"));
81// rewindButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
82// rewindButton.setToolTipText("Rewind to start");
83//
84// // Icon changes
85// muteButton = new JToggleButton();
86// muteButton.setSelectedIcon(IconRepository.getIcon("volmute.png"));
87// muteButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
88// muteButton.setToolTipText("Toggle mute");
89// muteButton.addChangeListener(new ChangeListener() {
90// public void stateChanged(ChangeEvent e) {
91// if (!isUpdatingGUI) {
92// masterMix.setMuted(muteButton.isSelected());
93//
94// }
95// }
96// });
97//
98// soloButton = new JToggleButton();
99// soloButton.setIcon(IconRepository.getIcon("solo.png"));
100// soloButton.setSelectedIcon(IconRepository.getIcon("soloon.png"));
101// soloButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
102// soloButton.setToolTipText("Toggle solo");
103// soloButton.addChangeListener(new ChangeListener() {
104// public void stateChanged(ChangeEvent e) {
105// if (!isUpdatingGUI) {
106// SoundDesk.getInstance().setSoloIDPrefix(soloButton.isSelected() ?
107// masterMix.getChannelID() : null
108// );
109//
110// }
111// }
112// });
113//
114// closeButton = new JButton();
115// closeButton.addActionListener(this);
116// closeButton.setIcon(IconRepository.getIcon("close.png"));
117// closeButton.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
118// closeButton.setToolTipText("Close");
119//
120// final int VOLUME_SPACING = 6;
121// volumeSlider = new JSlider(JSlider.HORIZONTAL);
122// volumeSlider.setMinimum(0);
123// volumeSlider.setMaximum(100);
124// volumeSlider.addChangeListener(new ChangeListener() {
125// public void stateChanged(ChangeEvent e) {
126// if (!isUpdatingGUI) {
127// masterMix.setVolume(((float)volumeSlider.getValue()) / 100.0f);
128// }
129// // Update the icons
130// updateButtonGUI();
131// }
132// });
133//
134// volumeSlider.setPreferredSize(new Dimension(100 - (2 * VOLUME_SPACING), BUTTON_SIZE));
135//
136 //
137// nameLabelParent = new JPanel();
138//
139// nameLabelParent.addMouseListener(new MouseListener() {
140 //
141// public void mouseClicked(MouseEvent e) {
142// if (nameLabel != null) {
143// if (nameLabel.onMouseClicked(e)) {
144// e.consume();
145// return;
146// }
147// }
148// }
149 //
150// public void mouseEntered(MouseEvent e) {
151// }
152 //
153// public void mouseExited(MouseEvent e) {
154// }
155 //
156// public void mousePressed(MouseEvent e) {
157// if (nameLabel != null) {
158// if (nameLabel.onMousePressed(e)) {
159// e.consume();
160// }
161// }
162// }
163 //
164// public void mouseReleased(MouseEvent e) {
165// if (nameLabel != null) {
166// if (nameLabel.onMouseReleased(e)) {
167// e.consume();
168// }
169// }
170// }
171//
172// });
173//
174// nameLabelParent.addMouseMotionListener(new MouseMotionListener() {
175 //
176// public void mouseDragged(MouseEvent e) {
177// if (nameLabel != null) {
178// if (nameLabel.onMouseDragged(e)) {
179// e.consume();
180// }
181// }
182// }
183 //
184// public void mouseMoved(MouseEvent e) {
185// if (nameLabel != null) {
186// nameLabel.onMouseMoved(e, nameLabelParent);
187// }
188// }
189 //
190// });
191//
192// nameLabelParent.addKeyListener(new KeyListener() {
193 //
194// public void keyPressed(KeyEvent e) {
195// if (nameLabel != null) {
196// if (nameLabel.onKeyPressed(e, nameLabelParent)) {
197// e.consume();
198// }
199// }
200// }
201 //
202// public void keyReleased(KeyEvent e) {
203// if (nameLabel != null) {
204// if (nameLabel.onKeyReleased(e, nameLabelParent)) {
205// e.consume();
206// }
207// }
208 //
209// }
210 //
211// public void keyTyped(KeyEvent e) {
212// }
213//
214// });
215//
216// nameLabel = new EmulatedTextItem(nameLabelParent, new Point(10, 25));
217// nameLabel.setFontStyle(Font.BOLD);
218// nameLabel.setFontSize(16);
219// nameLabel.setBackgroundColor(Color.WHITE);
220// nameLabel.setText(LinkedTrack.this.getName());
221 //
222// nameLabel.addTextChangeListener(new TextChangeListener() { // a little bit loopy!
223 //
224// public void onTextChanged(Object source, String newLabel) {
225// if (!nameLabel.getText().equals(LinkedTrack.this.getName())) {
226// SoundDeskPopup.this.setName(nameLabel.getText());
227// }
228// }
229 //
230// });
231//
232// // Create the toolbar
233// JPanel toolBarPanel = new JPanel(new GridBagLayout());
234 //
235// GridBagConstraints c = new GridBagConstraints();
236// c.gridx = 0;
237// c.gridy = 0;
238// c.fill = GridBagConstraints.BOTH;
239// toolBarPanel.add(playPauseButton, c);
240//
241// c = new GridBagConstraints();
242// c.gridx = 1;
243// c.gridy = 0;
244// c.fill = GridBagConstraints.BOTH;
245// toolBarPanel.add(stopButton, c);
246//
247// c = new GridBagConstraints();
248// c.gridx = 2;
249// c.gridy = 0;
250// c.fill = GridBagConstraints.BOTH;
251// toolBarPanel.add(rewindButton, c);
252//
253// c = new GridBagConstraints();
254// c.gridx = 3;
255// c.gridy = 0;
256// c.fill = GridBagConstraints.BOTH;
257// toolBarPanel.add(soloButton, c);
258//
259// c = new GridBagConstraints();
260// c.gridx = 4;
261// c.gridy = 0;
262// c.fill = GridBagConstraints.BOTH;
263// toolBarPanel.add(muteButton, c);
264//
265// c = new GridBagConstraints();
266// c.gridx = 5;
267// c.gridy = 0;
268// c.fill = GridBagConstraints.BOTH;
269// c.insets = new Insets(0,VOLUME_SPACING,0,VOLUME_SPACING);
270// toolBarPanel.add(volumeSlider, c);
271//
272// c = new GridBagConstraints();
273// c.gridx = 6;
274// c.gridy = 0;
275// c.fill = GridBagConstraints.BOTH;
276// c.weightx = 1.0f;
277// toolBarPanel.add(nameLabelParent, c);
278//
279// c = new GridBagConstraints();
280// c.gridx = 7;
281// c.gridy = 0;
282// c.fill = GridBagConstraints.BOTH;
283// toolBarPanel.add(closeButton, c);
284//
285// return toolBarPanel;
286 //
287// }
288//
289// private JPanel createOptionsPane() {
290//
291// JPanel panel = new JPanel(new BorderLayout());
292//
293// JLabel tmpLabl = new JLabel("todo: Options - check boxes");
294// tmpLabl.setPreferredSize(new Dimension(100, 30));
295// panel.add(tmpLabl, BorderLayout.CENTER);
296//
297// return panel;
298// }
299//
300// private JSplitPane createCenterStage() {
301//
302// DefaultMutableTreeNode root = new DefaultMutableTreeNode();
303// createTreeNodes(root);
304// trackTree = new JTree(root);
305//
306//
307// scrollRightButton = new JButton(">");
308//
309// scrollLeftButton = new JButton("<");
310//
311// channelPane = new JPanel();
312//
313//
314// JPanel leftComposite = new JPanel(new BorderLayout());
315//
316// JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
317//
318// // todo: Wrap with scroll pane
319//
320// sp.setLeftComponent(trackTree);
321// sp.setLeftComponent(trackTree);
322//
323// return sp;
324// }
325//
326// private void createTreeNodes(DefaultMutableTreeNode root) {
327//
328// }
329//
330// public void actionPerformed(ActionEvent e) {
331//
332// if (!(state == PLAYING || state == STOPPED)) return;
333//
334// if (e.getSource() == closeButton) {
335//
336// // todo ... close
337//
338// } else {
339//
340// // Relay shared action
341// masterActionListener.actionPerformed(e);
342//
343// }
344//
345// }
346//
347// /**
348// * Sets the mute icon to represent the current volume value in the slider.
349// * Note: this is not the icon if mute is on.
350// */
351// private void updateButtonGUI() {
352//
353// Icon newIcon = null;
354// if (volumeSlider.getValue() <= 25)
355// newIcon = IconRepository.getIcon("vol25.png");
356// else if (volumeSlider.getValue() <= 50)
357// newIcon = IconRepository.getIcon("vol50.png");
358// else if (volumeSlider.getValue() <= 75)
359// newIcon = IconRepository.getIcon("vol75.png");
360// else // maxing
361// newIcon = IconRepository.getIcon("vol100.png");
362//
363// muteButton.setIcon(newIcon);
364// }
365//
366// /**
367// * Updates the volume GUI.
368// * {@link #volumeChanged()} is not raised as a result of this call.
369// *
370// * @param vol
371// * The volume ranging from 0 - 100. Clamped.
372// */
373// protected void updateVolume(int vol) {
374//
375// if (volumeSlider.getValue() == vol) return;
376 //
377// // Clamp
378// if(vol < 0) vol = 0;
379// else if (vol > 100) vol = 100;
380//
381// isUpdatingGUI = true;
382//
383// volumeSlider.setValue(vol);
384//
385// isUpdatingGUI = false;
386// }
387//
388 //
389// /**
390// * Updates the mute button GUI.
391// * {@link #muteChanged()} is not raised as a result of this call.
392// *
393// * @param isMuted
394// * True if set gui to muted.
395// */
396// protected void updateMute(boolean isMuted) {
397//
398// if (muteButton.isSelected() == isMuted) return;
399 //
400// isUpdatingGUI = true;
401//
402// muteButton.setSelected(isMuted);
403 //
404// isUpdatingGUI = false;
405// }
406 //
407 //
408// /**
409// * Updates the solo button GUI.
410// * {@link #muteChanged()} is not raised as a result of this call.
411// *
412// * @param isSolo
413// * True if set gui to solo on.
414// */
415// protected void updateSolo(boolean isSolo) {
416//
417// if (soloButton.isSelected() == isSolo) return;
418 //
419// isUpdatingGUI = true;
420//
421// soloButton.setSelected(isSolo);
422 //
423// isUpdatingGUI = false;
424// }
425//
426//
427// }
428}
Note: See TracBrowser for help on using the repository browser.