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

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

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

revision 1733 by iliev, Sat May 3 01:40:06 2008 UTC revision 1734 by iliev, Sun May 4 18:40:13 2008 UTC
# Line 27  import java.awt.Insets; Line 27  import java.awt.Insets;
27    
28  import java.awt.event.ActionEvent;  import java.awt.event.ActionEvent;
29  import java.awt.event.ActionListener;  import java.awt.event.ActionListener;
30    import java.awt.event.MouseListener;
31    
32  import java.beans.PropertyChangeEvent;  import java.beans.PropertyChangeEvent;
33  import java.beans.PropertyChangeListener;  import java.beans.PropertyChangeListener;
34    
35    import java.util.Vector;
36    
37  import javax.swing.BorderFactory;  import javax.swing.BorderFactory;
38  import javax.swing.Box;  import javax.swing.Box;
39  import javax.swing.BoxLayout;  import javax.swing.BoxLayout;
# Line 64  public class SmallChannelView extends Pi Line 67  public class SmallChannelView extends Pi
67          private final SoloButton btnSolo = new SoloButton();          private final SoloButton btnSolo = new SoloButton();
68          private final Channel.OptionsButton btnOptions;          private final Channel.OptionsButton btnOptions;
69                    
70            private final Vector<JComponent> components = new Vector<JComponent>();
71            
72          /** Creates a new instance of <code>SmallChannelView</code> */          /** Creates a new instance of <code>SmallChannelView</code> */
73          public          public
74          SmallChannelView(Channel channel) {          SmallChannelView(Channel channel) {
# Line 77  public class SmallChannelView extends Pi Line 82  public class SmallChannelView extends Pi
82                                    
83                  setPixmapInsets(new Insets(1, 1, 1, 1));                  setPixmapInsets(new Insets(1, 1, 1, 1));
84                                    
85                    components.add(this);
86                    
87                  this.channel = channel;                  this.channel = channel;
88                  this.channelOptionsView = channelOptionsView;                  this.channelOptionsView = channelOptionsView;
89                                    
90                  addMouseListener(channel.getContextMenu());                  addMouseListener(channel.getContextMenu());
91                                    
92                  screen = new ChannelScreen(channel);                  screen = new ChannelScreen(channel);
93                    
94                  btnPower = new Channel.PowerButton(channel);                  btnPower = new Channel.PowerButton(channel);
95                    components.add(btnPower);
96                    
97                  btnOptions = new Channel.OptionsButton(channel);                  btnOptions = new Channel.OptionsButton(channel);
98                    components.add(btnOptions);
99                                    
100                  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));                  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
101                                    
# Line 105  public class SmallChannelView extends Pi Line 116  public class SmallChannelView extends Pi
116                  add(createVSeparator());                  add(createVSeparator());
117                  add(Box.createRigidArea(new Dimension(1, 0)));                  add(Box.createRigidArea(new Dimension(1, 0)));
118                                    
119                    components.add(btnMute);
120                    components.add(btnSolo);
121                    
122                  add(btnMute);                  add(btnMute);
123                  add(btnSolo);                  add(btnSolo);
124                                    
# Line 125  public class SmallChannelView extends Pi Line 139  public class SmallChannelView extends Pi
139          // Implementation of the ChannelView interface          // Implementation of the ChannelView interface
140          //////////////////////////////////////////////          //////////////////////////////////////////////
141                    
142            public Type
143            getType() { return Type.SMALL; }
144            
145          public JComponent          public JComponent
146          getComponent() { return this; }          getComponent() { return this; }
147                    
# Line 177  public class SmallChannelView extends Pi Line 194  public class SmallChannelView extends Pi
194                  btnOptions.doClick();                  btnOptions.doClick();
195          }          }
196                    
197            public boolean
198            isOptionsButtonSelected() { return btnOptions.isSelected(); }
199            
200            public void
201            setOptionsButtonSelected(boolean b) {
202                    btnOptions.setSelected(b);
203            }
204            
205            public void
206            addEnhancedMouseListener(MouseListener l) {
207                    removeEnhancedMouseListener(l);
208                    
209                    for(JComponent c : components) c.addMouseListener(l);
210                    screen.addEnhancedMouseListener(l);
211            }
212            
213            public void
214            removeEnhancedMouseListener(MouseListener l) {
215                    for(JComponent c : components) c.removeMouseListener(l);
216                    screen.removeEnhancedMouseListener(l);
217            }
218            
219          //////////////////////////////////////////////          //////////////////////////////////////////////
220                    
221                    
# Line 288  public class SmallChannelView extends Pi Line 327  public class SmallChannelView extends Pi
327                    
328                  private static Insets pixmapInsets = new Insets(5, 5, 4, 5);                  private static Insets pixmapInsets = new Insets(5, 5, 4, 5);
329                                    
330                    private final Vector<JComponent> components = new Vector<JComponent>();
331                    
332                  ChannelScreen(final Channel channel) {                  ChannelScreen(final Channel channel) {
333                          super(Res.gfxTextField);                          super(Res.gfxTextField);
334                                                    
335                            components.add(this);
336                            
337                          this.channel = channel;                          this.channel = channel;
338                                                    
339                          addMouseListener(channel.getContextMenu());                          addMouseListener(channel.getContextMenu());
340                                                    
341                          streamVoiceCountPane = new Channel.StreamVoiceCountPane(channel);                          streamVoiceCountPane = new Channel.StreamVoiceCountPane(channel);
342                            components.add(streamVoiceCountPane);
343                                                    
344                          //channelInfoPane = new ChannelInfoPane(channel);                          //channelInfoPane = new ChannelInfoPane(channel);
345                          volumePane = new Channel.VolumePane(channel);                          volumePane = new Channel.VolumePane(channel);
346                            components.add(volumePane);
347                                                    
348                          setPixmapInsets(pixmapInsets);                          setPixmapInsets(pixmapInsets);
349                          setBorder(BorderFactory.createEmptyBorder(4, 3, 3, 4));                          setBorder(BorderFactory.createEmptyBorder(4, 3, 3, 4));
# Line 306  public class SmallChannelView extends Pi Line 351  public class SmallChannelView extends Pi
351                          setLayout(new BoxLayout(this, BoxLayout.X_AXIS));                          setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
352                                                    
353                          JPanel p = new JPanel();                          JPanel p = new JPanel();
354                            components.add(p);
355                          p.setOpaque(false);                          p.setOpaque(false);
356                          p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));                          p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
357                                                    
# Line 320  public class SmallChannelView extends Pi Line 366  public class SmallChannelView extends Pi
366                          btnInstr.setPreferredSize(new Dimension(100, h));                          btnInstr.setPreferredSize(new Dimension(100, h));
367                          btnInstr.setMinimumSize(btnInstr.getPreferredSize());                          btnInstr.setMinimumSize(btnInstr.getPreferredSize());
368                          btnInstr.setMaximumSize(new Dimension(Short.MAX_VALUE, h));                          btnInstr.setMaximumSize(new Dimension(Short.MAX_VALUE, h));
369                            components.add(btnInstr);
370                                                    
371                          p.add(btnInstr);                          p.add(btnInstr);
372                                                    
# Line 344  public class SmallChannelView extends Pi Line 391  public class SmallChannelView extends Pi
391                          });                          });
392                  }                  }
393                                    
394                    public void
395                    addEnhancedMouseListener(MouseListener l) {
396                            removeEnhancedMouseListener(l);
397                            for(JComponent c : components) c.addMouseListener(l);
398                    }
399                    
400                    public void
401                    removeEnhancedMouseListener(MouseListener l) {
402                            for(JComponent c : components) c.removeMouseListener(l);
403                    }
404                    
405                  protected void                  protected void
406                  updateVolumeInfo() {                  updateVolumeInfo() {
407                          float f = channel.getChannelInfo().getVolume() * 100.0f;                          float f = channel.getChannelInfo().getVolume() * 100.0f;

Legend:
Removed from v.1733  
changed lines
  Added in v.1734

  ViewVC Help
Powered by ViewVC