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

Diff of /jsampler/trunk/src/org/jsampler/view/fantasia/Channel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1357 by iliev, Sat Sep 22 17:27:06 2007 UTC revision 1496 by iliev, Mon Nov 19 22:22:22 2007 UTC
# Line 22  Line 22 
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;
# Line 50  import javax.swing.JLabel; Line 53  import javax.swing.JLabel;
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;
# Line 271  public class Channel extends org.jsample Line 275  public class Channel extends org.jsample
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                          });                          });
# Line 300  public class Channel extends org.jsample Line 309  public class Channel extends org.jsample
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);
# Line 650  class ChannelScreen extends PixmapPane { Line 675  class ChannelScreen extends PixmapPane {
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                    
# Line 660  class ChannelScreen extends PixmapPane { Line 685  class ChannelScreen extends PixmapPane {
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                                    
# Line 725  class ChannelScreen extends PixmapPane { Line 740  class ChannelScreen extends PixmapPane {
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);
# Line 981  class ChannelScreen extends PixmapPane { Line 1001  class ChannelScreen extends PixmapPane {
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 {
# Line 999  class ChannelScreen extends PixmapPane { Line 1031  class ChannelScreen 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

Legend:
Removed from v.1357  
changed lines
  Added in v.1496

  ViewVC Help
Powered by ViewVC