1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2008 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 |
* |
* |
31 |
import javax.swing.Action; |
import javax.swing.Action; |
32 |
|
|
33 |
import org.jsampler.CC; |
import org.jsampler.CC; |
|
import org.jsampler.HF; |
|
34 |
|
|
35 |
import org.jsampler.view.JSChannel; |
import org.jsampler.view.JSChannel; |
36 |
import org.jsampler.view.JSChannelsPane; |
import org.jsampler.view.JSChannelsPane; |
|
import org.jsampler.view.JSMainFrame; |
|
37 |
import org.jsampler.view.std.JSAddMidiInstrumentMapDlg; |
import org.jsampler.view.std.JSAddMidiInstrumentMapDlg; |
38 |
|
|
39 |
import org.jsampler.view.std.JSNewMidiDeviceDlg; |
import org.jsampler.view.std.JSNewMidiDeviceDlg; |
40 |
import org.jsampler.view.std.JSNewAudioDeviceDlg; |
import org.jsampler.view.std.JSNewAudioDeviceDlg; |
41 |
import org.jsampler.view.std.JSNewMidiInstrumentWizard; |
import org.jsampler.view.std.JSNewMidiInstrumentWizard; |
42 |
import org.jsampler.view.std.StdA4n; |
import org.jsampler.view.std.StdA4n; |
43 |
|
import org.jsampler.view.swing.SHF; |
44 |
|
import org.jsampler.view.swing.SwingChannelsPane; |
45 |
|
import org.jsampler.view.swing.SwingMainFrame; |
46 |
|
|
47 |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
import static org.jsampler.view.classic.ClassicI18n.i18n; |
48 |
|
|
68 |
removeChannels.putValue(Action.SMALL_ICON, Res.iconDelete24); |
removeChannels.putValue(Action.SMALL_ICON, Res.iconDelete24); |
69 |
} |
} |
70 |
|
|
71 |
|
@Override |
72 |
protected ClassicPrefs |
protected ClassicPrefs |
73 |
preferences() { |
preferences() { |
74 |
return ClassicPrefs.preferences(); |
return ClassicPrefs.preferences(); |
77 |
private static boolean |
private static boolean |
78 |
verifyConnection() { |
verifyConnection() { |
79 |
if(!CC.getClient().isConnected()) { |
if(!CC.getClient().isConnected()) { |
80 |
HF.showErrorMessage(i18n.getError("notConnected")); |
SHF.showErrorMessage(i18n.getError("notConnected")); |
81 |
return false; |
return false; |
82 |
} |
} |
83 |
|
|
96 |
|
|
97 |
public void |
public void |
98 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
99 |
new SamplerInfoDlg(CC.getMainFrame()).setVisible(true); |
new SamplerInfoDlg(SHF.getMainFrame()).setVisible(true); |
100 |
} |
} |
101 |
} |
} |
102 |
|
|
188 |
|
|
189 |
public void |
public void |
190 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
191 |
((MainFrame)CC.getMainFrame()).runScript(); |
((MainFrame)SHF.getMainFrame()).runScript(); |
192 |
} |
} |
193 |
} |
} |
194 |
|
|
205 |
public void |
public void |
206 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
207 |
if(!verifyConnection()) return; |
if(!verifyConnection()) return; |
208 |
new JSNewMidiDeviceDlg(CC.getMainFrame()).setVisible(true); |
new JSNewMidiDeviceDlg(SHF.getMainFrame()).setVisible(true); |
209 |
} |
} |
210 |
} |
} |
211 |
|
|
222 |
public void |
public void |
223 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
224 |
if(!verifyConnection()) return; |
if(!verifyConnection()) return; |
225 |
new JSNewAudioDeviceDlg(CC.getMainFrame()).setVisible(true); |
new JSNewAudioDeviceDlg(SHF.getMainFrame()).setVisible(true); |
226 |
} |
} |
227 |
} |
} |
228 |
|
|
238 |
} |
} |
239 |
|
|
240 |
public void |
public void |
241 |
actionPerformed(ActionEvent e) { new PrefsDlg(CC.getMainFrame()).setVisible(true); } |
actionPerformed(ActionEvent e) { new PrefsDlg(SHF.getMainFrame()).setVisible(true); } |
242 |
} |
} |
243 |
|
|
244 |
// VIEW |
// VIEW |
280 |
|
|
281 |
public static class |
public static class |
282 |
MoveChannelsTo extends AbstractAction implements PropertyChangeListener { |
MoveChannelsTo extends AbstractAction implements PropertyChangeListener { |
283 |
private final JSChannelsPane pane; |
private final SwingChannelsPane pane; |
284 |
|
|
285 |
MoveChannelsTo(JSChannelsPane pane) { |
MoveChannelsTo(SwingChannelsPane pane) { |
286 |
super(pane.getTitle()); |
super(pane.getTitle()); |
287 |
|
|
288 |
this.pane = pane; |
this.pane = pane; |
340 |
|
|
341 |
public void |
public void |
342 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
343 |
new NewChannelsTabDlg(CC.getMainFrame()).setVisible(true); |
new NewChannelsTabDlg(SHF.getMainFrame()).setVisible(true); |
344 |
} |
} |
345 |
} |
} |
346 |
|
|
354 |
|
|
355 |
public void |
public void |
356 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
357 |
new ChangeTabTitleDlg(CC.getMainFrame()).setVisible(true); |
new ChangeTabTitleDlg(SHF.getMainFrame()).setVisible(true); |
358 |
} |
} |
359 |
} |
} |
360 |
|
|
368 |
|
|
369 |
public void |
public void |
370 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
371 |
((MainFrame)CC.getMainFrame()).moveTab2Beginning(); |
((MainFrame)SHF.getMainFrame()).moveTab2Beginning(); |
372 |
} |
} |
373 |
} |
} |
374 |
|
|
382 |
} |
} |
383 |
|
|
384 |
public void |
public void |
385 |
actionPerformed(ActionEvent e) { ((MainFrame)CC.getMainFrame()).moveTab2Left(); } |
actionPerformed(ActionEvent e) { ((MainFrame)SHF.getMainFrame()).moveTab2Left(); } |
386 |
} |
} |
387 |
|
|
388 |
private static class MoveTab2Right extends AbstractAction { |
private static class MoveTab2Right extends AbstractAction { |
395 |
} |
} |
396 |
|
|
397 |
public void |
public void |
398 |
actionPerformed(ActionEvent e) { ((MainFrame)CC.getMainFrame()).moveTab2Right(); } |
actionPerformed(ActionEvent e) { ((MainFrame)SHF.getMainFrame()).moveTab2Right(); } |
399 |
} |
} |
400 |
|
|
401 |
private static class MoveTab2End extends AbstractAction { |
private static class MoveTab2End extends AbstractAction { |
407 |
} |
} |
408 |
|
|
409 |
public void |
public void |
410 |
actionPerformed(ActionEvent e) { ((MainFrame)CC.getMainFrame()).moveTab2End(); } |
actionPerformed(ActionEvent e) { ((MainFrame)SHF.getMainFrame()).moveTab2End(); } |
411 |
} |
} |
412 |
|
|
413 |
private static class CloseChannelsTab extends AbstractAction { |
private static class CloseChannelsTab extends AbstractAction { |
421 |
|
|
422 |
public void |
public void |
423 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
424 |
JSMainFrame frm = CC.getMainFrame(); |
SwingMainFrame frm = SHF.getMainFrame(); |
425 |
JSChannelsPane chnPane = frm.getSelectedChannelsPane(); |
JSChannelsPane chnPane = frm.getSelectedChannelsPane(); |
426 |
if(chnPane.getChannelCount() > 0) { |
if(chnPane.getChannelCount() > 0) { |
427 |
CloseTabDlg dlg = new CloseTabDlg(frm); |
CloseTabDlg dlg = new CloseTabDlg(frm); |
463 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
464 |
if(!CC.verifyConnection()) return; |
if(!CC.verifyConnection()) return; |
465 |
|
|
466 |
if(CC.getInstrumentsDbTreeModel() == null) { |
if(SHF.getInstrumentsDbTreeModel() == null) { |
467 |
String s = i18n.getMessage("A4n.noInstrumentsDbSupport!"); |
String s = i18n.getMessage("A4n.noInstrumentsDbSupport!"); |
468 |
HF.showErrorMessage(s, CC.getMainFrame()); |
SHF.showErrorMessage(s, SHF.getMainFrame()); |
469 |
return; |
return; |
470 |
} |
} |
471 |
|
|
490 |
|
|
491 |
public void |
public void |
492 |
actionPerformed(ActionEvent e) { |
actionPerformed(ActionEvent e) { |
493 |
new HelpAboutDlg(CC.getMainFrame()).setVisible(true); |
new HelpAboutDlg(SHF.getMainFrame()).setVisible(true); |
494 |
} |
} |
495 |
} |
} |
496 |
} |
} |