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 |
* |
* |
29 |
|
|
30 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionEvent; |
31 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
32 |
|
import java.awt.event.KeyEvent; |
33 |
import java.awt.event.MouseAdapter; |
import java.awt.event.MouseAdapter; |
34 |
import java.awt.event.MouseEvent; |
import java.awt.event.MouseEvent; |
35 |
|
|
36 |
import javax.swing.AbstractAction; |
import javax.swing.AbstractAction; |
37 |
import javax.swing.Action; |
import javax.swing.Action; |
38 |
|
import javax.swing.JComponent; |
39 |
import javax.swing.JMenu; |
import javax.swing.JMenu; |
40 |
import javax.swing.JMenuItem; |
import javax.swing.JMenuItem; |
41 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
42 |
import javax.swing.JPopupMenu; |
import javax.swing.JPopupMenu; |
43 |
import javax.swing.JScrollPane; |
import javax.swing.JScrollPane; |
44 |
|
import javax.swing.KeyStroke; |
45 |
|
|
46 |
import javax.swing.event.ListSelectionEvent; |
import javax.swing.event.ListSelectionEvent; |
47 |
import javax.swing.event.ListSelectionListener; |
import javax.swing.event.ListSelectionListener; |
93 |
public |
public |
94 |
JSOrchestraPane(OrchestraModel orchestra) { |
JSOrchestraPane(OrchestraModel orchestra) { |
95 |
instrumentTable = new InstrumentTable(); |
instrumentTable = new InstrumentTable(); |
96 |
|
instrumentTable.setFillsViewportHeight(true); |
97 |
setOrchestra(orchestra); |
setOrchestra(orchestra); |
98 |
|
|
99 |
setLayout(new BorderLayout()); |
setLayout(new BorderLayout()); |
131 |
|
|
132 |
ContextMenu contextMenu = new ContextMenu(); |
ContextMenu contextMenu = new ContextMenu(); |
133 |
instrumentTable.addMouseListener(contextMenu); |
instrumentTable.addMouseListener(contextMenu); |
134 |
|
|
135 |
|
KeyStroke k = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0); |
136 |
|
instrumentTable.getInputMap(JComponent.WHEN_FOCUSED).put(k, "deleteInstrument"); |
137 |
|
instrumentTable.getActionMap().put("deleteInstrument", actionDeleteInstrument); |
138 |
} |
} |
139 |
|
|
140 |
public void |
public void |
292 |
|
|
293 |
LoadInstrumentAction(SamplerChannelModel model) { |
LoadInstrumentAction(SamplerChannelModel model) { |
294 |
String s = "instrumentsdb.actions.loadInstrument.onChannel"; |
String s = "instrumentsdb.actions.loadInstrument.onChannel"; |
295 |
putValue(Action.NAME, i18n.getMenuLabel(s, model.getChannelId())); |
int i = CC.getSamplerModel().getChannelIndex(model) + 1; |
296 |
|
putValue(Action.NAME, i18n.getMenuLabel(s, i)); |
297 |
channelModel = model; |
channelModel = model; |
298 |
} |
} |
299 |
|
|
434 |
|
|
435 |
public void |
public void |
436 |
channelAdded(SamplerChannelListEvent e) { |
channelAdded(SamplerChannelListEvent e) { |
437 |
|
if(CC.getSamplerModel().getChannelListIsAdjusting()) return; |
438 |
updateLoadInstrumentMenu(mLoadInstrument); |
updateLoadInstrumentMenu(mLoadInstrument); |
439 |
} |
} |
440 |
|
|