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

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

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

revision 1784 by iliev, Sat May 31 23:04:01 2008 UTC revision 1785 by iliev, Tue Oct 7 00:07:14 2008 UTC
# Line 1  Line 1 
1  /*  /*
2   *   JSampler - a java front-end for LinuxSampler   *   JSampler - a java front-end for LinuxSampler
3   *   *
4   *   Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com>   *   Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 24  package org.jsampler.view.fantasia; Line 24  package org.jsampler.view.fantasia;
24    
25  import java.awt.Dimension;  import java.awt.Dimension;
26  import java.awt.Insets;  import java.awt.Insets;
 import java.awt.Point;  
27    
28  import java.awt.event.ActionEvent;  import java.awt.event.ActionEvent;
29  import java.awt.event.ActionListener;  import java.awt.event.ActionListener;
 import java.awt.event.MouseAdapter;  
 import java.awt.event.MouseEvent;  
30    
31  import java.beans.PropertyChangeEvent;  import java.beans.PropertyChangeEvent;
32  import java.beans.PropertyChangeListener;  import java.beans.PropertyChangeListener;
# Line 43  import javax.swing.JButton; Line 40  import javax.swing.JButton;
40  import javax.swing.JLabel;  import javax.swing.JLabel;
41  import javax.swing.JPanel;  import javax.swing.JPanel;
42  import javax.swing.JSlider;  import javax.swing.JSlider;
 import javax.swing.JToolTip;  
43    
44  import javax.swing.event.ChangeEvent;  import javax.swing.event.ChangeEvent;
45  import javax.swing.event.ChangeListener;  import javax.swing.event.ChangeListener;
# Line 54  import org.jsampler.HF; Line 50  import org.jsampler.HF;
50  import org.jsampler.event.SamplerAdapter;  import org.jsampler.event.SamplerAdapter;
51  import org.jsampler.event.SamplerEvent;  import org.jsampler.event.SamplerEvent;
52    
53    import org.jsampler.view.fantasia.basic.*;
54    
55  import org.jsampler.view.std.JSVolumeEditorPopup;  import org.jsampler.view.std.JSVolumeEditorPopup;
56    
57  import static org.jsampler.view.fantasia.FantasiaI18n.i18n;  import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
# Line 75  public class ChannelsBar extends PixmapP Line 73  public class ChannelsBar extends PixmapP
73          private final JLabel lVoices = createScreenLabel("-- ");          private final JLabel lVoices = createScreenLabel("-- ");
74          private JSVolumeEditorPopup popupVolume;          private JSVolumeEditorPopup popupVolume;
75                    
76            private final FantasiaToggleButtonsPanel buttonsPanel;
77            
78          private static NumberFormat numberFormat = NumberFormat.getInstance();          private static NumberFormat numberFormat = NumberFormat.getInstance();
79                    
80          /** Creates a new instance of <code>ChannelsBar</code> */          /** Creates a new instance of <code>ChannelsBar</code> */
81          public          public
82          ChannelsBar() {          ChannelsBar(FantasiaToggleButtonsPanel buttonsPanel) {
83                  super(Res.gfxCreateChannel);                  super(Res.gfxCreateChannel);
84                                    
85                    this.buttonsPanel = buttonsPanel;
86                    
87                  numberFormat.setMaximumFractionDigits(1);                  numberFormat.setMaximumFractionDigits(1);
88                  popupVolume = new JSVolumeEditorPopup(btnVolume, VolumeType.MASTER);                  popupVolume = new JSVolumeEditorPopup(btnVolume, VolumeType.MASTER);
89                                    
# Line 93  public class ChannelsBar extends PixmapP Line 95  public class ChannelsBar extends PixmapP
95                  JLabel l = new JLabel(Res.iconVolume22);                  JLabel l = new JLabel(Res.iconVolume22);
96                  add(l);                  add(l);
97                                    
98                    slVolume.setUI(new FantasiaFaderUI(slVolume));
99                    slVolume.putClientProperty("Fader.knobSize", new Dimension(15, 22));
100                  slVolume.setOpaque(false);                  slVolume.setOpaque(false);
101                  slVolume.setFocusable(false);                  slVolume.setFocusable(false);
102                  Dimension d = new Dimension(150, 22);                  Dimension d = new Dimension(150, 22);
103                  slVolume.setPreferredSize(d);                  slVolume.setPreferredSize(d);
104                  slVolume.setMaximumSize(d);                  slVolume.setMaximumSize(d);
105                    slVolume.setAlignmentY(CENTER_ALIGNMENT);
106                                    
107                  add(slVolume);                  add(slVolume);
108                  add(Box.createRigidArea(new Dimension(5, 0)));                  add(Box.createRigidArea(new Dimension(5, 0)));
# Line 125  public class ChannelsBar extends PixmapP Line 130  public class ChannelsBar extends PixmapP
130                  lVoices.setToolTipText(i18n.getLabel("ChannelsBar.streamVoiceCount"));                  lVoices.setToolTipText(i18n.getLabel("ChannelsBar.streamVoiceCount"));
131                  p.add(lVoices);                  p.add(lVoices);
132                                    
                 add(Box.createRigidArea(new Dimension(5, 0)));  
                   
133                  btnVolume.setIcon(Res.iconVolume14);                  btnVolume.setIcon(Res.iconVolume14);
134                  btnVolume.setIconTextGap(2);                  btnVolume.setIconTextGap(2);
135                  btnVolume.setHorizontalAlignment(btnVolume.LEFT);                  btnVolume.setHorizontalAlignment(btnVolume.LEFT);
136                  d = btnVolume.getPreferredSize();                  d = btnVolume.getPreferredSize();
137                  d.width = 59;                  d.width = 65;
138                  btnVolume.setPreferredSize(d);                  btnVolume.setPreferredSize(d);
139                  btnVolume.setMaximumSize(d);                  btnVolume.setMaximumSize(d);
140                  p.add(btnVolume);                  p.add(btnVolume);
141                                    
142                  p.setMaximumSize(p.getPreferredSize());                  p.setMaximumSize(p.getPreferredSize());
143                    p.setAlignmentY(CENTER_ALIGNMENT);
144                                    
145                  add(p);                  add(p);
146                    
147                    add(Box.createRigidArea(new Dimension(2, 0)));
148                    add(createVSeparator());
149                    add(Box.createRigidArea(new Dimension(8, 0)));
150                    
151                    buttonsPanel.setAlignmentY(CENTER_ALIGNMENT);
152                    add(buttonsPanel);
153                  add(Box.createGlue());                  add(Box.createGlue());
154                                    
155                  d = new Dimension(420, 29);                  d = new Dimension(420, 29);
# Line 213  public class ChannelsBar extends PixmapP Line 224  public class ChannelsBar extends PixmapP
224                  });                  });
225          }          }
226                    
227            /*@Override
228            protected void
229            paintComponent(Graphics g) {
230                    if(isOpaque()) super.paintComponent(g);
231                    
232                    double h = getSize().getHeight();
233                    double w = getSize().getWidth();
234                    Graphics2D g2 = (Graphics2D)g;
235                    
236                    FantasiaPainter.paintGradient(g2, 0, 0, w - 1, h - 1);
237                    RoundCorners rc = new RoundCorners(false, true, true, false);
238                    FantasiaPainter.paintOuterBorder(g2, 0, -1, w - 1, h - 1, rc);
239                    
240            }*/
241            
242          private void          private void
243          setVolume() {          setVolume() {
244                  int volume = slVolume.getValue();                  int volume = slVolume.getValue();
# Line 245  public class ChannelsBar extends PixmapP Line 271  public class ChannelsBar extends PixmapP
271                  slVolume.setValue((int)(CC.getSamplerModel().getVolume() * 100));                  slVolume.setValue((int)(CC.getSamplerModel().getVolume() * 100));
272          }          }
273                    
274            protected JPanel
275            createVSeparator() {
276                    PixmapPane p = new PixmapPane(Res.gfxVLine);
277                    p.setOpaque(false);
278                    p.setPreferredSize(new Dimension(2, 29));
279                    p.setMinimumSize(p.getPreferredSize());
280                    p.setMaximumSize(p.getPreferredSize());
281                    return p;
282            }
283  }  }

Legend:
Removed from v.1784  
changed lines
  Added in v.1785

  ViewVC Help
Powered by ViewVC