22 |
|
|
23 |
package org.jsampler.view.fantasia; |
package org.jsampler.view.fantasia; |
24 |
|
|
25 |
|
import java.awt.Color; |
26 |
import java.awt.Dimension; |
import java.awt.Dimension; |
27 |
|
import java.awt.Graphics; |
28 |
|
import java.awt.Graphics2D; |
29 |
import java.awt.Insets; |
import java.awt.Insets; |
30 |
|
|
31 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
51 |
import org.jsampler.event.SamplerChannelListEvent; |
import org.jsampler.event.SamplerChannelListEvent; |
52 |
import org.jsampler.event.SamplerChannelListListener; |
import org.jsampler.event.SamplerChannelListListener; |
53 |
|
|
54 |
|
import org.jsampler.view.fantasia.basic.FantasiaPainter; |
55 |
import org.jsampler.view.fantasia.basic.PixmapButton; |
import org.jsampler.view.fantasia.basic.PixmapButton; |
56 |
import org.jsampler.view.fantasia.basic.PixmapPane; |
import org.jsampler.view.fantasia.basic.PixmapPane; |
57 |
|
|
68 |
* |
* |
69 |
* @author Grigor Iliev |
* @author Grigor Iliev |
70 |
*/ |
*/ |
71 |
public class SmallChannelView extends PixmapPane implements ChannelView { |
public class SmallChannelView extends JPanel implements ChannelView { |
72 |
private final Channel channel; |
private final Channel channel; |
73 |
private ChannelOptionsView channelOptionsView = null; |
private ChannelOptionsView channelOptionsView = null; |
74 |
|
|
84 |
/** Creates a new instance of <code>SmallChannelView</code> */ |
/** Creates a new instance of <code>SmallChannelView</code> */ |
85 |
public |
public |
86 |
SmallChannelView(Channel channel) { |
SmallChannelView(Channel channel) { |
|
super(Res.gfxDeviceBg); |
|
|
setPixmapInsets(new Insets(1, 1, 1, 1)); |
|
|
|
|
87 |
components.add(this); |
components.add(this); |
88 |
|
|
89 |
this.channel = channel; |
this.channel = channel; |
134 |
installView(); |
installView(); |
135 |
} |
} |
136 |
|
|
137 |
|
@Override |
138 |
|
protected void |
139 |
|
paintComponent(Graphics g) { |
140 |
|
if(isOpaque()) super.paintComponent(g); |
141 |
|
|
142 |
|
double h = getSize().getHeight(); |
143 |
|
double w = getSize().getWidth(); |
144 |
|
|
145 |
|
Color c1 = channel.isSelected() ? new Color(0x555555) : new Color(0x888888); |
146 |
|
Color c2 = channel.isSelected() ? new Color(0x606060) : new Color(0x707070); |
147 |
|
|
148 |
|
Graphics2D g2 = (Graphics2D)g; |
149 |
|
FantasiaPainter.paintGradient(g2, 0, 0, w - 1, h - 1, c1, c2); |
150 |
|
FantasiaPainter.paintOuterBorder(g2, 0, 0, w - 1, h - 1, false, 0.27f, 0.11f, 0.64f, 0.20f); |
151 |
|
} |
152 |
|
|
153 |
////////////////////////////////////////////// |
////////////////////////////////////////////// |
154 |
// Implementation of the ChannelView interface |
// Implementation of the ChannelView interface |
155 |
////////////////////////////////////////////// |
////////////////////////////////////////////// |
323 |
|
|
324 |
@Override |
@Override |
325 |
public void |
public void |
326 |
mouseClicked(MouseEvent e) { |
mousePressed(MouseEvent e) { |
|
if(e.getButton() != e.BUTTON1) return; |
|
327 |
// TAG: channel selection system |
// TAG: channel selection system |
328 |
CC.getMainFrame().getSelectedChannelsPane().setSelectedChannel(channel); |
if(e.getButton() == MouseEvent.BUTTON3 && channel.isSelected()) return; |
329 |
|
|
330 |
|
CC.getMainFrame().getSelectedChannelsPane().processChannelSelection ( |
331 |
|
channel, e.isControlDown(), e.isShiftDown() |
332 |
|
); |
333 |
/////// |
/////// |
334 |
} |
} |
335 |
} |
} |