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

Contents of /jsampler/trunk/src/org/jsampler/view/fantasia/LSConsoleFrame.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2288 - (show annotations) (download)
Wed Nov 23 21:19:44 2011 UTC (12 years, 5 months ago) by iliev
File size: 3718 byte(s)
* Added option to select a sampler engine in Add/Edit Instrument dialog
* Moved all Swing dependent code outside the JSampler core

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2011 Grigor Iliev <grigor@grigoriliev.com>
5 *
6 * This file is part of JSampler.
7 *
8 * JSampler is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
11 *
12 * JSampler is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with JSampler; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23 package org.jsampler.view.fantasia;
24
25 import java.awt.event.ActionEvent;
26 import java.awt.event.ActionListener;
27
28 import javax.swing.JMenu;
29 import javax.swing.JMenuBar;
30 import javax.swing.JMenuItem;
31
32 import org.jsampler.CC;
33 import org.jsampler.view.std.JSFrame;
34 import org.jsampler.view.std.JSLscpScriptDlg;
35 import org.jsampler.view.swing.SHF;
36
37 import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
38
39 /**
40 *
41 * @author Grigor Iliev
42 */
43 public class LSConsoleFrame extends JSFrame {
44 private final JMenuBar menuBar = new JMenuBar();
45 private final LSConsolePane lsConsolePane = new LSConsolePane(this);
46
47 /**
48 * Creates a new instance of <code>LSConsoleFrame</code>
49 */
50 public
51 LSConsoleFrame() {
52 super(i18n.getLabel("LSConsoleFrame.title"), "LSConsoleFrame");
53 if(Res.iconAppIcon != null) setIconImage(Res.iconLSConsole.getImage());
54
55 add(lsConsolePane);
56 addMenu();
57 }
58
59 private void
60 addMenu() {
61 if(CC.getViewConfig().isUsingScreenMenuBar()) {
62 ((ViewConfig)CC.getViewConfig()).setNativeMenuProperties();
63 }
64
65 JMenu m;
66 JMenuItem mi;
67
68 setJMenuBar(menuBar);
69
70 // Actions
71 m = new JMenu(i18n.getMenuLabel("lsconsole.actions"));
72 m.setFont(m.getFont().deriveFont(java.awt.Font.BOLD));
73 menuBar.add(m);
74
75 JMenu clearMenu = new JMenu(i18n.getMenuLabel("lsconsole.clear"));
76
77 mi = new JMenuItem(i18n.getMenuLabel("lsconsole.clearConsole"));
78 clearMenu.add(mi);
79 mi.addActionListener(lsConsolePane.clearConsoleAction);
80
81 mi = new JMenuItem(i18n.getMenuLabel("lsconsole.clearSessionHistory"));
82 clearMenu.add(mi);
83 mi.addActionListener(lsConsolePane.clearSessionHistoryAction);
84
85 m.add(clearMenu);
86
87 JMenu exportMenu = new JMenu(i18n.getMenuLabel("lsconsole.export"));
88
89 mi = new JMenuItem(i18n.getMenuLabel("lsconsole.export.session"));
90 exportMenu.add(mi);
91 mi.addActionListener(new ActionListener() {
92 public void
93 actionPerformed(ActionEvent e) {
94 JSLscpScriptDlg dlg = new JSLscpScriptDlg();
95 dlg.setCommands(lsConsolePane.getModel().getSessionHistory());
96 dlg.setVisible(true);
97 }
98 });
99
100 mi = new JMenuItem(i18n.getMenuLabel("lsconsole.export.commandHistory"));
101 exportMenu.add(mi);
102 mi.addActionListener(new ActionListener() {
103 public void
104 actionPerformed(ActionEvent e) {
105 JSLscpScriptDlg dlg = new JSLscpScriptDlg();
106 dlg.setCommands(lsConsolePane.getModel().getCommandHistory());
107 dlg.setVisible(true);
108 }
109 });
110
111 m.add(exportMenu);
112
113 m.addSeparator();
114
115 mi = new JMenuItem(i18n.getMenuLabel("lsconsole.runScript"));
116 m.add(mi);
117 mi.addActionListener(new ActionListener() {
118 public void
119 actionPerformed(ActionEvent e) {
120 ((MainFrame)SHF.getMainFrame()).runScript();
121 }
122 });
123
124 if(CC.getViewConfig().isUsingScreenMenuBar()) {
125 ((ViewConfig)CC.getViewConfig()).restoreMenuProperties();
126 }
127 }
128
129 protected LSConsolePane
130 getLSConsolePane() { return lsConsolePane; }
131 }

  ViewVC Help
Powered by ViewVC