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 |
* |
* |
23 |
package org.jsampler.view.fantasia; |
package org.jsampler.view.fantasia; |
24 |
|
|
25 |
import java.awt.BorderLayout; |
import java.awt.BorderLayout; |
26 |
|
import java.awt.Color; |
27 |
import java.awt.Container; |
import java.awt.Container; |
28 |
import java.awt.Cursor; |
import java.awt.Cursor; |
29 |
import java.awt.Dimension; |
import java.awt.Dimension; |
30 |
|
import java.awt.Graphics; |
31 |
|
import java.awt.Graphics2D; |
32 |
import java.awt.Insets; |
import java.awt.Insets; |
33 |
import java.awt.Rectangle; |
import java.awt.Rectangle; |
34 |
|
|
48 |
import javax.swing.ListSelectionModel; |
import javax.swing.ListSelectionModel; |
49 |
|
|
50 |
import net.sf.juife.ComponentList; |
import net.sf.juife.ComponentList; |
|
import net.sf.juife.ComponentListModel; |
|
51 |
import net.sf.juife.DefaultComponentListModel; |
import net.sf.juife.DefaultComponentListModel; |
52 |
|
|
53 |
import net.sf.juife.event.TaskEvent; |
import net.sf.juife.event.TaskEvent; |
67 |
|
|
68 |
import org.linuxsampler.lscp.MidiInputDriver; |
import org.linuxsampler.lscp.MidiInputDriver; |
69 |
|
|
|
import static org.jsampler.view.fantasia.A4n.a4n; |
|
70 |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
import static org.jsampler.view.fantasia.FantasiaI18n.i18n; |
71 |
import static org.jsampler.view.fantasia.FantasiaPrefs.*; |
import static org.jsampler.view.fantasia.FantasiaPrefs.*; |
72 |
|
|
131 |
class DeviceListPane extends ComponentList { |
class DeviceListPane extends ComponentList { |
132 |
private Dimension maxSize = new Dimension(); |
private Dimension maxSize = new Dimension(); |
133 |
|
|
134 |
|
@Override |
135 |
public Dimension |
public Dimension |
136 |
getMaximumSize() { |
getMaximumSize() { |
137 |
maxSize.width = Short.MAX_VALUE; |
maxSize.width = Short.MAX_VALUE; |
141 |
} |
} |
142 |
|
|
143 |
|
|
144 |
class NewDevicePane extends JPanel { |
class NewDevicePane extends FantasiaPanel { |
145 |
private final PixmapButton btnNew = new PixmapButton(Res.gfxPowerOff18); |
private final PixmapButton btnNew = new PixmapButton(Res.gfxPowerOff18); |
146 |
private JXCollapsiblePane createDevicePane = null; |
private JXCollapsiblePane createDevicePane = null; |
147 |
private boolean createDevice = false; |
private boolean createDevice = false; |
194 |
setAlignmentX(LEFT_ALIGNMENT); |
setAlignmentX(LEFT_ALIGNMENT); |
195 |
} |
} |
196 |
|
|
197 |
|
/*private Color c1 = new Color(0x888888); |
198 |
|
private Color c2 = new Color(0x707070); |
199 |
|
|
200 |
|
@Override |
201 |
|
protected void |
202 |
|
paintComponent(Graphics g) { |
203 |
|
super.paintComponent(g); |
204 |
|
|
205 |
|
double h = getSize().getHeight(); |
206 |
|
double w = getSize().getWidth(); |
207 |
|
|
208 |
|
FantasiaPainter.paintGradient((Graphics2D)g, 0, 0, w - 1, h - 1, c1, c2); |
209 |
|
|
210 |
|
FantasiaPainter.RoundCorners rc = |
211 |
|
new FantasiaPainter.RoundCorners(true); |
212 |
|
|
213 |
|
FantasiaPainter.paintOuterBorder((Graphics2D)g, 0, 0, w - 1, h - 1, rc); |
214 |
|
}*/ |
215 |
|
|
216 |
private JPanel |
private JPanel |
217 |
createVSeparator() { |
createVSeparator() { |
218 |
PixmapPane p = new PixmapPane(Res.gfxVLine); |
PixmapPane p = new PixmapPane(Res.gfxVLine); |
353 |
getHandler() { return eventHandler; } |
getHandler() { return eventHandler; } |
354 |
|
|
355 |
private class EventHandler implements MidiDeviceListListener { |
private class EventHandler implements MidiDeviceListListener { |
356 |
|
@Override |
357 |
public void |
public void |
358 |
deviceAdded(MidiDeviceListEvent e) { |
deviceAdded(MidiDeviceListEvent e) { |
359 |
addDevice(e.getMidiDeviceModel()); |
addDevice(e.getMidiDeviceModel()); |
360 |
} |
} |
361 |
|
|
362 |
|
@Override |
363 |
public void |
public void |
364 |
deviceRemoved(MidiDeviceListEvent e) { |
deviceRemoved(MidiDeviceListEvent e) { |
365 |
removeDevice(e.getMidiDeviceModel()); |
removeDevice(e.getMidiDeviceModel()); |