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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1734 - (show annotations) (download)
Sun May 4 18:40:13 2008 UTC (15 years, 11 months ago) by iliev
File size: 20149 byte(s)
* bugfix: JSampler took forever to load a configuration with
  too many sampler channels
* Implemented option to show different channel view when
  the mouse pointer is over sampler channel
  (choose Edit/Preferences, then click the `Defaults' tab)

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2008 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.BorderLayout;
26 import java.awt.Dialog;
27 import java.awt.Dimension;
28 import java.awt.Frame;
29 import java.awt.Graphics;
30 import java.awt.GridBagConstraints;
31 import java.awt.GridBagLayout;
32 import java.awt.Insets;
33 import java.awt.Point;
34
35 import java.awt.event.ActionEvent;
36 import java.awt.event.ActionListener;
37 import java.awt.event.KeyEvent;
38 import java.awt.event.MouseAdapter;
39 import java.awt.event.MouseEvent;
40
41 import java.io.BufferedReader;
42 import java.io.File;
43 import java.io.FileNotFoundException;
44 import java.io.FileReader;
45
46 import java.util.Vector;
47 import java.util.logging.Level;
48
49 import javax.swing.BorderFactory;
50 import javax.swing.Box;
51 import javax.swing.BoxLayout;
52 import javax.swing.JCheckBoxMenuItem;
53 import javax.swing.JComponent;
54 import javax.swing.JDialog;
55 import javax.swing.JFileChooser;
56 import javax.swing.JFrame;
57 import javax.swing.JMenu;
58 import javax.swing.JMenuBar;
59 import javax.swing.JMenuItem;
60 import javax.swing.JPanel;
61 import javax.swing.JPopupMenu;
62 import javax.swing.JScrollPane;
63 import javax.swing.JSplitPane;
64 import javax.swing.JToggleButton;
65 import javax.swing.KeyStroke;
66 import javax.swing.SwingUtilities;
67 import javax.swing.Timer;
68 import javax.swing.UIManager;
69
70 import net.sf.juife.TitleBar;
71
72 import org.jsampler.CC;
73 import org.jsampler.HF;
74 import org.jsampler.LSConsoleModel;
75 import org.jsampler.Server;
76
77 import org.jsampler.view.JSChannel;
78 import org.jsampler.view.JSChannelsPane;
79 import org.jsampler.view.JSMainFrame;
80 import org.jsampler.view.LscpFileFilter;
81
82 import org.jsampler.view.std.JSConnectDlg;
83 import org.jsampler.view.std.JSDetailedErrorDlg;
84 import org.jsampler.view.std.JSQuitDlg;
85 import org.jsampler.view.std.JSamplerHomeChooser;
86
87 import static org.jsampler.view.fantasia.A4n.a4n;
88 import static org.jsampler.view.fantasia.FantasiaI18n.i18n;
89 import static org.jsampler.view.fantasia.FantasiaPrefs.preferences;
90 import static org.jsampler.view.std.StdPrefs.*;
91
92
93 /**
94 *
95 * @author Grigor Iliev
96 */
97 public class MainFrame extends JSMainFrame {
98 private final StandardBar standardBar = new StandardBar();
99 private final FantasiaMenuBar menuBar = new FantasiaMenuBar();
100 private final JPanel rootPane = new JPanel();
101 private final MainPane mainPane = new MainPane();
102
103 private final JMenu recentScriptsMenu =
104 new JMenu(i18n.getMenuLabel("actions.recentScripts"));
105
106 private final JSplitPane hSplitPane;
107
108 private final LeftSidePane leftSidePane = new LeftSidePane();
109 private final RightSidePane rightSidePane = new RightSidePane();
110 private final JPanel rightPane;
111
112 private final LSConsoleFrame lsConsoleFrame = new LSConsoleFrame();
113 private final Vector<String> recentScripts = new Vector<String>();
114
115
116 private final JCheckBoxMenuItem cbmiToolBarVisible =
117 new JCheckBoxMenuItem(i18n.getMenuLabel("view.toolBar"));
118
119 private final JCheckBoxMenuItem cbmiLeftSidePaneVisible =
120 new JCheckBoxMenuItem(i18n.getMenuLabel("view.leftSidePane"));
121
122 private final JCheckBoxMenuItem cbmiRightSidePaneVisible =
123 new JCheckBoxMenuItem(i18n.getMenuLabel("view.rightSidePane"));
124
125 private final Timer guiTimer = new Timer(1000, null);
126
127 /** Creates a new instance of <code>MainFrame</code> */
128 public
129 MainFrame() {
130 setTitle(i18n.getLabel("MainFrame.title"));
131
132 if(Res.iconAppIcon != null) setIconImage(Res.iconAppIcon.getImage());
133
134 getContentPane().add(standardBar, BorderLayout.NORTH);
135
136 rightPane = createRightPane();
137
138 hSplitPane = new JSplitPane (
139 JSplitPane.HORIZONTAL_SPLIT,
140 true, // continuousLayout
141 leftSidePane, rightPane
142 );
143 hSplitPane.setResizeWeight(0.5);
144
145 rootPane.setLayout(new BorderLayout());
146 rootPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0));
147 rootPane.setOpaque(false);
148 rootPane.add(hSplitPane);
149
150 addMenu();
151
152 addChannelsPane(mainPane.getChannelsPane());
153
154 getContentPane().add(rootPane);
155
156 int i = preferences().getIntProperty("MainFrame.hSplitDividerLocation", 220);
157 hSplitPane.setDividerLocation(i);
158
159 setSavedSize();
160
161 guiTimer.start();
162 }
163
164 private JPanel
165 createRightPane() {
166 JPanel p = new JPanel();
167 GridBagLayout gridbag = new GridBagLayout();
168 GridBagConstraints c = new GridBagConstraints();
169
170 p.setLayout(gridbag);
171
172 c.fill = GridBagConstraints.BOTH;
173
174 c.gridx = 1;
175 c.gridy = 0;
176 c.weightx = 1.0;
177 c.weighty = 1.0;
178 c.insets = new Insets(0, 3, 0, 0);
179 gridbag.setConstraints(rightSidePane, c);
180 p.add(rightSidePane);
181
182 c.gridx = 0;
183 c.gridy = 0;
184 c.weightx = 0.0;
185 c.weighty = 1.0;
186 c.insets = new Insets(0, 3, 0, 3);
187 c.fill = GridBagConstraints.VERTICAL;
188 gridbag.setConstraints(mainPane, c);
189 p.add(mainPane);
190
191 return p;
192 }
193
194 private void
195 setSavedSize() {
196 String s = preferences().getStringProperty("MainFrame.sizeAndLocation");
197 if(s == null) {
198 setDefaultSizeAndLocation();
199 return;
200 }
201 pack();
202 try {
203 int i = s.indexOf(',');
204 int x = Integer.parseInt(s.substring(0, i));
205
206 s = s.substring(i + 1);
207 i = s.indexOf(',');
208 int y = Integer.parseInt(s.substring(0, i));
209
210 s = s.substring(i + 1);
211 i = s.indexOf(',');
212 int width = Integer.parseInt(s.substring(0, i));
213
214 s = s.substring(i + 1);
215 int height = Integer.parseInt(s);
216
217 setBounds(x, y, width, height);
218 } catch(Exception x) {
219 String msg = "Parsing of window size and location string failed";
220 CC.getLogger().log(Level.INFO, msg, x);
221 setDefaultSizeAndLocation();
222 }
223
224 if(preferences().getBoolProperty("MainFrame.windowMaximized")) {
225 setExtendedState(getExtendedState() | MAXIMIZED_BOTH);
226 }
227 }
228
229 private void
230 setDefaultSizeAndLocation() {
231 setPreferredSize(new Dimension(900, 600));
232 pack();
233 setLocationRelativeTo(null);
234 }
235
236
237 /** Invoked when this window is about to close. */
238 protected void
239 onWindowClose() {
240 boolean b = preferences().getBoolProperty(CONFIRM_APP_QUIT);
241 if(b && CC.getSamplerModel().isModified()) {
242 JSQuitDlg dlg = new JSQuitDlg(Res.iconQuestion32);
243 dlg.setVisible(true);
244 if(dlg.isCancelled()) return;
245 }
246
247 leftSidePane.savePreferences();
248 rightSidePane.savePreferences();
249
250 int i = hSplitPane.getDividerLocation();
251 preferences().setIntProperty("MainFrame.hSplitDividerLocation", i);
252
253 preferences().setBoolProperty (
254 "MainFrame.windowMaximized",
255 (getExtendedState() & MAXIMIZED_BOTH) == MAXIMIZED_BOTH
256 );
257
258 if(preferences().getBoolProperty("MainFrame.windowMaximized")) {
259 super.onWindowClose();
260 return;
261 }
262
263 java.awt.Point p = getLocation();
264 Dimension d = getSize();
265 StringBuffer sb = new StringBuffer();
266 sb.append(p.x).append(',').append(p.y).append(',');
267 sb.append(d.width).append(',').append(d.height);
268 preferences().setStringProperty("MainFrame.sizeAndLocation", sb.toString());
269
270 String[] list = recentScripts.toArray(new String[recentScripts.size()]);
271 preferences().setStringListProperty(RECENT_LSCP_SCRIPTS, list);
272
273 if(preferences().getBoolProperty(SAVE_LS_CONSOLE_HISTORY)) {
274 if(lsConsoleFrame != null) getLSConsolePane().saveConsoleHistory();
275 }
276
277 super.onWindowClose();
278 }
279
280 private void
281 addMenu() {
282 JMenu m;
283 JMenuItem mi;
284
285 setJMenuBar(menuBar);
286
287 // Actions
288 m = new FantasiaMenu(i18n.getMenuLabel("actions"));
289
290 mi = new JMenuItem(a4n.refresh);
291 mi.setIcon(null);
292 mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
293 m.add(mi);
294
295 mi = new JMenuItem(a4n.samplerInfo);
296 mi.setIcon(null);
297 m.add(mi);
298
299 mi = new JMenuItem(a4n.resetSampler);
300 mi.setIcon(null);
301 m.add(mi);
302
303 m.addSeparator();
304
305 JMenu exportMenu = new JMenu(i18n.getMenuLabel("actions.export"));
306 m.add(exportMenu);
307
308 mi = new JMenuItem(a4n.exportSamplerConfig);
309 mi.setIcon(null);
310 mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_MASK));
311 exportMenu.add(mi);
312
313 mi = new JMenuItem(a4n.exportMidiInstrumentMaps);
314 mi.setIcon(null);
315 exportMenu.add(mi);
316
317 m.addSeparator();
318
319 mi = new JMenuItem(a4n.loadScript);
320 mi.setIcon(null);
321 mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, KeyEvent.CTRL_MASK));
322 m.add(mi);
323
324 String[] list = preferences().getStringListProperty(RECENT_LSCP_SCRIPTS);
325 for(String s : list) recentScripts.add(s);
326
327 updateRecentScriptsMenu();
328
329 m.add(recentScriptsMenu);
330
331 m.addSeparator();
332
333 mi = new JMenuItem(a4n.changeBackend);
334 mi.setIcon(null);
335 mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_MASK));
336 m.add(mi);
337
338 m.addSeparator();
339
340 mi = new JMenuItem(i18n.getMenuLabel("actions.exit"));
341 m.add(mi);
342 mi.addActionListener(new ActionListener() {
343 public void
344 actionPerformed(ActionEvent e) { onWindowClose(); }
345 });
346
347 menuBar.add(m);
348
349
350 // Edit
351 m = new FantasiaMenu(i18n.getMenuLabel("edit"));
352 menuBar.add(m);
353
354 mi = new JMenuItem(i18n.getMenuLabel("edit.addChannel"));
355 m.add(mi);
356 mi.addActionListener(new ActionListener() {
357 public void
358 actionPerformed(ActionEvent e) {
359 CC.getSamplerModel().addBackendChannel();
360 }
361 });
362
363 m.addSeparator();
364
365 mi = new JMenuItem(a4n.createMidiDevice);
366 mi.setIcon(null);
367 m.add(mi);
368
369 mi = new JMenuItem(a4n.createAudioDevice);
370 mi.setIcon(null);
371 m.add(mi);
372
373 m.addSeparator();
374
375 mi = new JMenuItem(a4n.editPreferences);
376 mi.setIcon(null);
377 mi.setAccelerator(KeyStroke.getKeyStroke (
378 KeyEvent.VK_P, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK
379 ));
380 m.add(mi);
381
382 // View
383 m = new FantasiaMenu(i18n.getMenuLabel("view"));
384 menuBar.add(m);
385
386 m.add(cbmiToolBarVisible);
387
388 cbmiToolBarVisible.addActionListener(new ActionListener() {
389 public void
390 actionPerformed(ActionEvent e) {
391 showToolBar(cbmiToolBarVisible.getState());
392 }
393 });
394
395 boolean b = preferences().getBoolProperty("toolBar.visible");
396 cbmiToolBarVisible.setSelected(b);
397 showToolBar(b);
398
399 cbmiLeftSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke (
400 KeyEvent.VK_L, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK
401 ));
402 m.add(cbmiLeftSidePaneVisible);
403
404 cbmiLeftSidePaneVisible.addActionListener(new ActionListener() {
405 public void
406 actionPerformed(ActionEvent e) {
407 showSidePane(cbmiLeftSidePaneVisible.getState());
408 }
409 });
410
411 b = preferences().getBoolProperty("leftSidePane.visible");
412 cbmiLeftSidePaneVisible.setSelected(b);
413 showSidePane(b);
414
415 cbmiRightSidePaneVisible.setAccelerator(KeyStroke.getKeyStroke (
416 KeyEvent.VK_R, KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK
417 ));
418 m.add(cbmiRightSidePaneVisible);
419
420 cbmiRightSidePaneVisible.addActionListener(new ActionListener() {
421 public void
422 actionPerformed(ActionEvent e) {
423 showDevicesPane(cbmiRightSidePaneVisible.getState());
424 }
425 });
426
427 b = preferences().getBoolProperty("rightSidePane.visible");
428 cbmiRightSidePaneVisible.setSelected(b);
429 showDevicesPane(b);
430
431
432 // Window
433 m = new FantasiaMenu(i18n.getMenuLabel("window"));
434 menuBar.add(m);
435
436 mi = new JMenuItem(a4n.windowLSConsole);
437 mi.setIcon(null);
438 m.add(mi);
439
440 mi = new JMenuItem(a4n.windowInstrumentsDb);
441 mi.setIcon(null);
442 m.add(mi);
443
444
445 // Help
446 m = new FantasiaMenu(i18n.getMenuLabel("help"));
447
448 mi = new JMenuItem(a4n.browseOnlineTutorial);
449 mi.setIcon(null);
450 m.add(mi);
451
452 m.addSeparator();
453
454 mi = new JMenuItem(a4n.helpAbout);
455 mi.setIcon(null);
456 m.add(mi);
457
458 menuBar.add(m);
459 }
460
461 /**
462 * This method does nothing, because <b>Fantasia</b> has exactly
463 * one pane containing sampler channels, which can not be changed.
464 */
465 public void
466 insertChannelsPane(JSChannelsPane pane, int idx) {
467
468 }
469
470 /**
471 * This method always returns the <code>JSChannelsPane</code> at index 0,
472 * because the <b>Fantasia</b> view has exactly one pane containing sampler channels.
473 * @return The <code>JSChannelsPane</code> at index 0.
474 */
475 public JSChannelsPane
476 getSelectedChannelsPane() { return getChannelsPane(0); }
477
478 /**
479 * This method does nothing because the <b>Fantasia</b> view has
480 * exactly one pane containing sampler channels which is always shown.
481 */
482 public void
483 setSelectedChannelsPane(JSChannelsPane pane) { }
484
485 public void
486 installJSamplerHome() {
487 JSamplerHomeChooser chooser = new JSamplerHomeChooser(this);
488 chooser.setVisible(true);
489 if(chooser.isCancelled()) return;
490
491 CC.changeJSamplerHome(chooser.getJSamplerHome());
492 }
493
494 public void
495 showDetailedErrorMessage(Frame owner, String err, String details) {
496 JSDetailedErrorDlg dlg = new JSDetailedErrorDlg (
497 owner, Res.iconWarning32, i18n.getError("error"), err, details
498 );
499 dlg.setVisible(true);
500 }
501
502 public void
503 showDetailedErrorMessage(Dialog owner, String err, String details) {
504 JSDetailedErrorDlg dlg = new JSDetailedErrorDlg (
505 owner, Res.iconWarning32, i18n.getError("error"), err, details
506 );
507 dlg.setVisible(true);
508 }
509
510 /**
511 * Gets the server address to which to connect. If the server should be
512 * manually selected, a dialog asking the user to choose a server is displayed.
513 */
514 public Server
515 getServer() {
516 boolean b = preferences().getBoolProperty(MANUAL_SERVER_SELECT_ON_STARTUP);
517 return getServer(b);
518 }
519
520 /**
521 * Gets the server address to which to connect. If the server should be
522 * manually selected, a dialog asking the user to choose a server is displayed.
523 * @param manualSelect Determines whether the server should be manually selected.
524 */
525 public Server
526 getServer(boolean manualSelect) {
527 if(manualSelect) {
528 JSConnectDlg dlg = new JSConnectDlg();
529 dlg.setVisible(true);
530 return dlg.getSelectedServer();
531 }
532
533 int i = preferences().getIntProperty(SERVER_INDEX);
534 int size = CC.getServerList().getServerCount();
535 if(size == 0) return null;
536 if(i >= size) return CC.getServerList().getServer(0);
537
538 return CC.getServerList().getServer(i);
539 }
540
541 public Timer
542 getGuiTimer() { return guiTimer; }
543
544 protected LSConsoleModel
545 getLSConsoleModel() { return getLSConsolePane().getModel(); }
546
547 protected LSConsolePane
548 getLSConsolePane() {
549 return getLSConsoleFrame().getLSConsolePane();
550 }
551
552 protected LSConsoleFrame
553 getLSConsoleFrame() { return lsConsoleFrame; }
554
555 protected boolean
556 runScript() {
557 String s = preferences().getStringProperty("lastScriptLocation");
558 JFileChooser fc = new JFileChooser(s);
559 fc.setFileFilter(new LscpFileFilter());
560 int result = fc.showOpenDialog(this);
561 if(result != JFileChooser.APPROVE_OPTION) return false;
562
563 String path = fc.getCurrentDirectory().getAbsolutePath();
564 preferences().setStringProperty("lastScriptLocation", path);
565
566 runScript(fc.getSelectedFile());
567
568 return true;
569 }
570
571 private void
572 runScript(String script) { runScript(new File(script)); }
573
574 private void
575 runScript(File script) {
576 FileReader fr;
577 try { fr = new FileReader(script); }
578 catch(FileNotFoundException e) {
579 HF.showErrorMessage(i18n.getMessage("FileNotFound!"));
580 return;
581 }
582
583 BufferedReader br = new BufferedReader(fr);
584
585 try {
586 String s = br.readLine();
587 while(s != null) {
588 getLSConsoleModel().setCommandLineText(s);
589 getLSConsoleModel().execCommand();
590 s = br.readLine();
591 }
592 } catch(Exception e) {
593 HF.showErrorMessage(e);
594 return;
595 }
596
597 String s = script.getAbsolutePath();
598 recentScripts.remove(s);
599 recentScripts.insertElementAt(s, 0);
600
601 updateRecentScriptsMenu();
602 }
603
604 protected void
605 clearRecentScripts() {
606 recentScripts.removeAllElements();
607 updateRecentScriptsMenu();
608 }
609
610 protected void
611 updateRecentScriptsMenu() {
612 int size = preferences().getIntProperty(RECENT_LSCP_SCRIPTS_SIZE);
613 while(recentScripts.size() > size) {
614 recentScripts.removeElementAt(recentScripts.size() - 1);
615 }
616
617 recentScriptsMenu.removeAll();
618
619 for(String script : recentScripts) {
620 JMenuItem mi = new JMenuItem(script);
621 recentScriptsMenu.add(mi);
622 mi.addActionListener(new RecentScriptHandler(script));
623 }
624
625 recentScriptsMenu.setEnabled(recentScripts.size() != 0);
626 }
627
628 private void
629 showToolBar(boolean b) {
630 preferences().setBoolProperty("toolBar.visible", b);
631 standardBar.setVisible(b);
632 }
633
634 private void
635 showSidePane(boolean b) {
636 preferences().setBoolProperty("leftSidePane.visible", b);
637 rootPane.remove(rightPane);
638 rootPane.remove(hSplitPane);
639
640 if(b) {
641 hSplitPane.setRightComponent(rightPane);
642 rootPane.add(hSplitPane);
643 int i = preferences().getIntProperty("MainFrame.hSplitDividerLocation", 220);
644
645 hSplitPane.setDividerLocation(i);
646 hSplitPane.validate();
647 } else {
648 rootPane.add(rightPane);
649
650 }
651
652 int w = getPreferredSize().width;
653 int h = getSize().height;
654 setSize(new Dimension(w, h));
655
656 rootPane.revalidate();
657 rootPane.validate();
658 rootPane.repaint();
659
660 SwingUtilities.invokeLater(new Runnable() {
661 public void
662 run() { sidePanesVisibilityChanged(); }
663 });
664 }
665
666 private void
667 showDevicesPane(boolean b) {
668 preferences().setBoolProperty("rightSidePane.visible", b);
669
670 int width = leftSidePane.getWidth();
671 int height = leftSidePane.getPreferredSize().height;
672 if(width != 0) leftSidePane.setPreferredSize(new Dimension(width, height));
673
674 if(b) {
675 int w = preferences().getIntProperty("devicesPane.width", 200);
676
677 int h = rightSidePane.getPreferredSize().height;
678 rightSidePane.setPreferredSize(new Dimension(w, h));
679 } else {
680 int w = rightSidePane.getWidth();
681 if(w > 0 && w < 200) w = 200;
682 if(w != 0) preferences().setIntProperty("devicesPane.width", w);
683 }
684
685 hSplitPane.setResizeWeight(0.0);
686 rightSidePane.setVisible(b);
687 hSplitPane.resetToPreferredSizes();
688
689 int w = getPreferredSize().width;
690 int h = getSize().height;
691 setSize(new Dimension(w, h));
692
693 rootPane.validate();
694 rootPane.repaint();
695 //hSplitPane.validate();
696
697 SwingUtilities.invokeLater(new Runnable() {
698 public void
699 run() { sidePanesVisibilityChanged(); }
700 });
701 }
702
703 private void
704 sidePanesVisibilityChanged() {
705 boolean leftSidePaneVisible = cbmiLeftSidePaneVisible.isSelected();
706 boolean rightSidePaneVisible = cbmiRightSidePaneVisible.isSelected();
707
708 if(leftSidePaneVisible && rightSidePaneVisible) {
709 hSplitPane.setResizeWeight(0.5);
710 } else if(leftSidePaneVisible && !rightSidePaneVisible) {
711 hSplitPane.setResizeWeight(1.0);
712 }
713
714 if(!leftSidePaneVisible && !rightSidePaneVisible) {
715 standardBar.showFantasiaLogo(false);
716 if(isResizable()) setResizable(false);
717 } else {
718 standardBar.showFantasiaLogo(true);
719 if(!isResizable()) setResizable(true);
720 }
721 }
722
723 private class RecentScriptHandler implements ActionListener {
724 private String script;
725
726 RecentScriptHandler(String script) { this.script = script; }
727
728 public void
729 actionPerformed(ActionEvent e) {
730 runScript(script);
731 if(preferences().getBoolProperty(SHOW_LS_CONSOLE_WHEN_RUN_SCRIPT)) {
732 a4n.windowLSConsole.actionPerformed(null);
733 }
734 }
735 }
736
737 private static class FantasiaMenu extends JMenu {
738 FantasiaMenu(String s) {
739 super(s);
740 setFont(getFont().deriveFont(java.awt.Font.BOLD));
741 setOpaque(false);
742 }
743 }
744
745 private class FantasiaMenuBar extends JMenuBar {
746 private Insets pixmapInsets = new Insets(6, 6, 0, 6);
747 private Insets pixmapInsets2 = new Insets(6, 6, 6, 6);
748
749 FantasiaMenuBar() {
750 setOpaque(false);
751 }
752
753 protected void
754 paintComponent(Graphics g) {
755 super.paintComponent(g);
756 if(standardBar.isVisible()) {
757 PixmapPane.paintComponent(this, g, Res.gfxMenuBarBg, pixmapInsets);
758 } else {
759 PixmapPane.paintComponent(this, g, Res.gfxRoundBg14, pixmapInsets2);
760 }
761 }
762 }
763 }

  ViewVC Help
Powered by ViewVC