22 |
|
|
23 |
package org.jsampler.view.fantasia; |
package org.jsampler.view.fantasia; |
24 |
|
|
25 |
|
import java.awt.Container; |
26 |
import java.awt.Cursor; |
import java.awt.Cursor; |
27 |
import java.awt.Dimension; |
import java.awt.Dimension; |
28 |
import java.awt.Graphics; |
import java.awt.Graphics; |
29 |
|
import java.awt.Graphics2D; |
30 |
import java.awt.Insets; |
import java.awt.Insets; |
31 |
|
import java.awt.Rectangle; |
32 |
|
|
33 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
34 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
53 |
import javax.swing.JMenuItem; |
import javax.swing.JMenuItem; |
54 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
55 |
import javax.swing.JPopupMenu; |
import javax.swing.JPopupMenu; |
56 |
|
import javax.swing.JScrollPane; |
57 |
import javax.swing.JToggleButton; |
import javax.swing.JToggleButton; |
58 |
import javax.swing.JToolBar; |
import javax.swing.JToolBar; |
59 |
import javax.swing.SwingConstants; |
import javax.swing.SwingConstants; |
275 |
public void |
public void |
276 |
propertyChange(PropertyChangeEvent e) { |
propertyChange(PropertyChangeEvent e) { |
277 |
if(e.getNewValue() == "expanded") { |
if(e.getNewValue() == "expanded") { |
278 |
|
// TODO: this should be done regardles the listener != null? |
279 |
mainPane.removePropertyChangeListener(s, this); |
mainPane.removePropertyChangeListener(s, this); |
280 |
|
/////// |
281 |
listener.actionPerformed(null); |
listener.actionPerformed(null); |
282 |
|
ensureChannelIsVisible(); |
283 |
|
} else if(e.getNewValue() == "expanding/collapsing") { |
284 |
|
ensureChannelIsVisible(); |
285 |
} |
} |
286 |
} |
} |
287 |
}); |
}); |
309 |
CC.getSamplerModel().addSamplerChannelListListener(getHandler()); |
CC.getSamplerModel().addSamplerChannelListListener(getHandler()); |
310 |
} |
} |
311 |
|
|
312 |
|
private void |
313 |
|
ensureChannelIsVisible() { |
314 |
|
Container p = getParent(); |
315 |
|
JScrollPane sp = null; |
316 |
|
while(p != null) { |
317 |
|
if(p instanceof JScrollPane) { |
318 |
|
sp = (JScrollPane)p; |
319 |
|
break; |
320 |
|
} |
321 |
|
p = p.getParent(); |
322 |
|
} |
323 |
|
if(sp == null) return; |
324 |
|
int h = sp.getViewport().getView().getHeight(); |
325 |
|
sp.getViewport().scrollRectToVisible(new Rectangle(0, h - 2, 1, 1)); |
326 |
|
} |
327 |
|
|
328 |
private JPanel |
private JPanel |
329 |
createVSeparator() { |
createVSeparator() { |
330 |
PixmapPane p = new PixmapPane(Res.gfxVLine); |
PixmapPane p = new PixmapPane(Res.gfxVLine); |
675 |
|
|
676 |
private final JPopupMenu menuEngines = new JPopupMenu(); |
private final JPopupMenu menuEngines = new JPopupMenu(); |
677 |
|
|
678 |
private final JLabel lVolume = new Label(); |
private final JLabel lVolume = new ScreenLabel(""); |
679 |
private final JLabel lStreams = new Label("--"); |
private final JLabel lStreams = new ScreenLabel(" --"); |
680 |
private final JLabel lVoices = new Label("--"); |
private final JLabel lVoices = new ScreenLabel("-- "); |
681 |
|
|
682 |
private InformationDialog fxSendsDlg = null; |
private InformationDialog fxSendsDlg = null; |
683 |
|
|
685 |
|
|
686 |
private Timer timer; |
private Timer timer; |
687 |
|
|
|
class Label extends JLabel { |
|
|
Label() { this(""); } |
|
|
|
|
|
Label(String s) { |
|
|
super(s); |
|
|
setFont(Res.fontScreen); |
|
|
setForeground(new java.awt.Color(0xFFA300)); |
|
|
} |
|
|
} |
|
|
|
|
688 |
ChannelScreen(final Channel channel) { |
ChannelScreen(final Channel channel) { |
689 |
super(Res.gfxChannelScreen); |
super(Res.gfxChannelScreen); |
690 |
setPixmapInsets(new Insets(6, 6, 6, 6)); |
setPixmapInsets(new Insets(6, 6, 6, 6)); |
691 |
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); |
setBorder(BorderFactory.createEmptyBorder(5, 4, 5, 4)); |
692 |
|
|
693 |
this.channel = channel; |
this.channel = channel; |
694 |
|
|
740 |
|
|
741 |
p.add(Box.createGlue()); |
p.add(Box.createGlue()); |
742 |
|
|
743 |
|
lStreams.setFont(Res.fontScreenMono); |
744 |
|
lStreams.setHorizontalAlignment(JLabel.RIGHT); |
745 |
p.add(lStreams); |
p.add(lStreams); |
|
p.add(new Label("/")); |
|
|
p.add(lVoices); |
|
746 |
|
|
747 |
p.add(Box.createRigidArea(new Dimension(12, 0))); |
JLabel l = new ScreenLabel("/"); |
748 |
|
l.setFont(Res.fontScreenMono); |
749 |
|
p.add(l); |
750 |
|
|
751 |
|
lVoices.setFont(Res.fontScreenMono); |
752 |
|
p.add(lVoices); |
753 |
|
|
754 |
lVolume.setIcon(Res.iconVolume14); |
lVolume.setIcon(Res.iconVolume14); |
755 |
lVolume.setAlignmentX(RIGHT_ALIGNMENT); |
lVolume.setAlignmentX(RIGHT_ALIGNMENT); |
1001 |
setFont(Res.fontScreen); |
setFont(Res.fontScreen); |
1002 |
setForeground(new java.awt.Color(0xFFA300)); |
setForeground(new java.awt.Color(0xFFA300)); |
1003 |
} |
} |
1004 |
|
|
1005 |
|
protected void |
1006 |
|
paintComponent(Graphics g) { |
1007 |
|
Graphics2D g2d = (Graphics2D)g; |
1008 |
|
|
1009 |
|
g2d.setRenderingHint ( |
1010 |
|
java.awt.RenderingHints.KEY_TEXT_ANTIALIASING, |
1011 |
|
java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON |
1012 |
|
); |
1013 |
|
|
1014 |
|
super.paintComponent(g2d); |
1015 |
|
} |
1016 |
} |
} |
1017 |
|
|
1018 |
static class ScreenButtonBg extends PixmapPane { |
static class ScreenButtonBg extends PixmapPane { |
1031 |
} |
} |
1032 |
} |
} |
1033 |
|
|
1034 |
|
|
1035 |
|
|
1036 |
|
static class ScreenLabel extends JLabel { |
1037 |
|
ScreenLabel() { this(""); } |
1038 |
|
|
1039 |
|
ScreenLabel(String s) { |
1040 |
|
super(s); |
1041 |
|
setFont(Res.fontScreen); |
1042 |
|
setForeground(new java.awt.Color(0xFFA300)); |
1043 |
|
} |
1044 |
|
|
1045 |
|
protected void |
1046 |
|
paintComponent(Graphics g) { |
1047 |
|
Graphics2D g2d = (Graphics2D)g; |
1048 |
|
|
1049 |
|
g2d.setRenderingHint ( |
1050 |
|
java.awt.RenderingHints.KEY_TEXT_ANTIALIASING, |
1051 |
|
java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON |
1052 |
|
); |
1053 |
|
|
1054 |
|
super.paintComponent(g2d); |
1055 |
|
} |
1056 |
|
} |
1057 |
|
|
1058 |
private final EventHandler eventHandler = new EventHandler(); |
private final EventHandler eventHandler = new EventHandler(); |
1059 |
|
|
1060 |
private EventHandler |
private EventHandler |