/[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 1688 by iliev, Thu Feb 14 16:52:36 2008 UTC revision 2288 by iliev, Wed Nov 23 21:19:44 2011 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-2011 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.JSPrefs.*;
58  import static org.jsampler.view.fantasia.FantasiaI18n.i18n;  import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
59  import static org.jsampler.view.fantasia.FantasiaPrefs.preferences;  import static org.jsampler.view.fantasia.FantasiaPrefs.preferences;
60  import static org.jsampler.view.fantasia.FantasiaUtils.*;  import static org.jsampler.view.fantasia.FantasiaUtils.*;
   
61  import static org.jsampler.view.std.JSVolumeEditorPopup.VolumeType;  import static org.jsampler.view.std.JSVolumeEditorPopup.VolumeType;
 import static org.jsampler.view.std.StdPrefs.*;  
62    
63  /**  /**
64   *   *
# Line 75  public class ChannelsBar extends PixmapP Line 72  public class ChannelsBar extends PixmapP
72          private final JLabel lVoices = createScreenLabel("-- ");          private final JLabel lVoices = createScreenLabel("-- ");
73          private JSVolumeEditorPopup popupVolume;          private JSVolumeEditorPopup popupVolume;
74                    
75            private final FantasiaToggleButtonsPanel buttonsPanel;
76            
77          private static NumberFormat numberFormat = NumberFormat.getInstance();          private static NumberFormat numberFormat = NumberFormat.getInstance();
78                    
79          /** Creates a new instance of <code>ChannelsBar</code> */          /** Creates a new instance of <code>ChannelsBar</code> */
80          public          public
81          ChannelsBar() {          ChannelsBar(FantasiaToggleButtonsPanel buttonsPanel) {
82                  super(Res.gfxCreateChannel);                  super(Res.gfxCreateChannel);
83                                    
84                    this.buttonsPanel = buttonsPanel;
85                    
86                  numberFormat.setMaximumFractionDigits(1);                  numberFormat.setMaximumFractionDigits(1);
87                  popupVolume = new JSVolumeEditorPopup(btnVolume, VolumeType.MASTER);                  popupVolume = new JSVolumeEditorPopup(btnVolume, VolumeType.MASTER);
88                                    
# Line 93  public class ChannelsBar extends PixmapP Line 94  public class ChannelsBar extends PixmapP
94                  JLabel l = new JLabel(Res.iconVolume22);                  JLabel l = new JLabel(Res.iconVolume22);
95                  add(l);                  add(l);
96                                    
97                    slVolume.setUI(new FantasiaFaderUI(slVolume));
98                    slVolume.putClientProperty("Fader.knobSize", new Dimension(15, 22));
99                  slVolume.setOpaque(false);                  slVolume.setOpaque(false);
100                  slVolume.setFocusable(false);                  slVolume.setFocusable(false);
101                  Dimension d = new Dimension(150, 22);                  Dimension d = new Dimension(150, 22);
102                  slVolume.setPreferredSize(d);                  slVolume.setPreferredSize(d);
103                  slVolume.setMaximumSize(d);                  slVolume.setMaximumSize(d);
104                    slVolume.setAlignmentY(CENTER_ALIGNMENT);
105                                    
106                  add(slVolume);                  add(slVolume);
107                  add(Box.createRigidArea(new Dimension(5, 0)));                  add(Box.createRigidArea(new Dimension(5, 0)));
# Line 105  public class ChannelsBar extends PixmapP Line 109  public class ChannelsBar extends PixmapP
109                  PixmapPane p = new PixmapPane(Res.gfxTextField);                  PixmapPane p = new PixmapPane(Res.gfxTextField);
110                  p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));                  p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
111                  p.setPixmapInsets(new Insets(5, 5, 4, 5));                  p.setPixmapInsets(new Insets(5, 5, 4, 5));
112                  p.setBorder(BorderFactory.createEmptyBorder(1, 8, 1, 5));                  p.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 5));
113                                    
114                  lStreams.setFont(Res.fontScreenMono);                  lStreams.setFont(Res.fontScreenMono);
115                  lStreams.setHorizontalAlignment(JLabel.RIGHT);                  lStreams.setHorizontalAlignment(JLabel.RIGHT);
# Line 125  public class ChannelsBar extends PixmapP Line 129  public class ChannelsBar extends PixmapP
129                  lVoices.setToolTipText(i18n.getLabel("ChannelsBar.streamVoiceCount"));                  lVoices.setToolTipText(i18n.getLabel("ChannelsBar.streamVoiceCount"));
130                  p.add(lVoices);                  p.add(lVoices);
131                                    
                 add(Box.createRigidArea(new Dimension(5, 0)));  
                   
132                  btnVolume.setIcon(Res.iconVolume14);                  btnVolume.setIcon(Res.iconVolume14);
133                  btnVolume.setIconTextGap(2);                  btnVolume.setIconTextGap(2);
134                  btnVolume.setHorizontalAlignment(btnVolume.LEFT);                  btnVolume.setHorizontalAlignment(JButton.LEFT);
135                  d = btnVolume.getPreferredSize();                  d = btnVolume.getPreferredSize();
136                  d.width = 59;                  d.width = 65;
137                  btnVolume.setPreferredSize(d);                  btnVolume.setPreferredSize(d);
138                  btnVolume.setMaximumSize(d);                  btnVolume.setMaximumSize(d);
139                  p.add(btnVolume);                  p.add(btnVolume);
140                                    
141                  p.setMaximumSize(p.getPreferredSize());                  p.setMaximumSize(p.getPreferredSize());
142                    p.setAlignmentY(CENTER_ALIGNMENT);
143                                    
144                  add(p);                  add(p);
145                    
146                    add(Box.createRigidArea(new Dimension(2, 0)));
147                    add(createVSeparator());
148                    add(Box.createRigidArea(new Dimension(6, 0)));
149                    
150                    buttonsPanel.setAlignmentY(CENTER_ALIGNMENT);
151                    add(buttonsPanel);
152                  add(Box.createGlue());                  add(Box.createGlue());
153                                    
154                  d = new Dimension(420, 29);                  d = new Dimension(420, 29);
# Line 213  public class ChannelsBar extends PixmapP Line 223  public class ChannelsBar extends PixmapP
223                  });                  });
224          }          }
225                    
226            /*@Override
227            protected void
228            paintComponent(Graphics g) {
229                    if(isOpaque()) super.paintComponent(g);
230                    
231                    double h = getSize().getHeight();
232                    double w = getSize().getWidth();
233                    Graphics2D g2 = (Graphics2D)g;
234                    
235                    FantasiaPainter.paintGradient(g2, 0, 0, w - 1, h - 1);
236                    RoundCorners rc = new RoundCorners(false, true, true, false);
237                    FantasiaPainter.paintOuterBorder(g2, 0, -1, w - 1, h - 1, rc);
238                    
239            }*/
240            
241          private void          private void
242          setVolume() {          setVolume() {
243                  int volume = slVolume.getValue();                  int volume = slVolume.getValue();
# Line 245  public class ChannelsBar extends PixmapP Line 270  public class ChannelsBar extends PixmapP
270                  slVolume.setValue((int)(CC.getSamplerModel().getVolume() * 100));                  slVolume.setValue((int)(CC.getSamplerModel().getVolume() * 100));
271          }          }
272                    
273            protected JPanel
274            createVSeparator() {
275                    PixmapPane p = new PixmapPane(Res.gfxVLine);
276                    p.setOpaque(false);
277                    p.setPreferredSize(new Dimension(2, 29));
278                    p.setMinimumSize(p.getPreferredSize());
279                    p.setMaximumSize(p.getPreferredSize());
280                    return p;
281            }
282  }  }

Legend:
Removed from v.1688  
changed lines
  Added in v.2288

  ViewVC Help
Powered by ViewVC