Updates, including support for

internationalized strings.
This commit is contained in:
eg3p 2002-11-02 22:11:02 +00:00
parent fab76cb82e
commit b4e4decc2e
2 changed files with 241 additions and 171 deletions

View file

@ -22,6 +22,8 @@ import java.awt.Font;
import java.awt.Label; import java.awt.Label;
import java.awt.Color; import java.awt.Color;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Cursor;
import java.awt.Window;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -42,6 +44,7 @@ import java.util.Enumeration;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.ResourceBundle;
import java.io.CharArrayWriter; import java.io.CharArrayWriter;
import java.io.CharArrayReader; import java.io.CharArrayReader;
@ -59,12 +62,14 @@ import javax.swing.*;
import javax.swing.text.*; import javax.swing.text.*;
import javax.swing.text.rtf.RTFEditorKit; import javax.swing.text.rtf.RTFEditorKit;
import org.thdl.media.*;
import org.thdl.util.ThdlDebug; import org.thdl.util.ThdlDebug;
import org.thdl.util.ThdlActionListener; import org.thdl.util.ThdlActionListener;
import org.thdl.util.ThdlI18n;
public class Savant extends JDesktopPane public class Savant extends JDesktopPane
{ {
protected SoundPanel sp = null; protected SmartMoviePanel sp = null;
protected TwoWayTextPlayer tp = null; protected TwoWayTextPlayer tp = null;
protected JInternalFrame videoFrame = null; protected JInternalFrame videoFrame = null;
@ -75,25 +80,47 @@ public class Savant extends JDesktopPane
protected boolean isFullScreen = false; protected boolean isFullScreen = false;
protected Dimension fullScreenSize = null; protected Dimension fullScreenSize = null;
protected JPanel videoPanel = null;
protected JPanel textPanel = null; protected JPanel textPanel = null;
protected JScrollPane vocabPanel = null; protected JScrollPane vocabPanel = null;
protected URL mediaURL = null;
protected URL extras = null; protected URL extras = null;
protected TranscriptView[] transcriptViews;
protected int orientation = 0; protected int orientation = 0;
protected ResourceBundle messages;
public final int TOP_TO_BOTTOM = 1; public final int TOP_TO_BOTTOM = 1;
public final int LEFT_TO_RIGHT = 2; public final int LEFT_TO_RIGHT = 2;
public Savant() public Savant()
{ {
messages = ThdlI18n.getResourceBundle();
setBackground(new JFrame().getBackground()); setBackground(new JFrame().getBackground());
setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
setLayout(new BorderLayout());
String labelString = "Please wait while Savant loads this transcript and media."; //(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable)
JLabel label = new JLabel(labelString, SwingConstants.CENTER); videoFrame = new JInternalFrame(null, false, false, false, false);
label.setFont(new Font("Serif", Font.PLAIN, 14)); videoFrame.setVisible(true);
add("Center", label); videoFrame.setLocation(0,0);
videoFrame.setSize(0,0);
add(videoFrame, JLayeredPane.POPUP_LAYER);
invalidate();
validate();
repaint();
textFrame = new JInternalFrame(messages.getString("Transcript"), false, false, false, true);
textPanel = new JPanel(new BorderLayout());
textFrame.setVisible(true);
textFrame.setLocation(0,0);
textFrame.setSize(0,0);
textFrame.setContentPane(textPanel);
add(textFrame, JLayeredPane.DEFAULT_LAYER);
invalidate();
validate();
repaint();
addComponentListener(new ComponentAdapter() addComponentListener(new ComponentAdapter()
{ {
@ -103,24 +130,13 @@ public class Savant extends JDesktopPane
case TOP_TO_BOTTOM: case TOP_TO_BOTTOM:
videoFrame.setLocation(getSize().width/2 - videoFrame.getSize().width/2, 0); videoFrame.setLocation(getSize().width/2 - videoFrame.getSize().width/2, 0);
textFrame.setLocation(0, videoFrame.getSize().height); textFrame.setLocation(0, videoFrame.getSize().height);
if (vocabFrame != null) textFrame.setSize(getSize().width, getSize().height - videoFrame.getSize().height);
{
textFrame.setSize(getSize().width / 2, getSize().height - videoFrame.getSize().height);
vocabFrame.setLocation(textFrame.getSize().width, videoFrame.getSize().height);
vocabFrame.setSize(getSize().width - textFrame.getSize().width, getSize().height - videoFrame.getSize().height);
} else
textFrame.setSize(getSize().width, getSize().height - videoFrame.getSize().height);
break; break;
case LEFT_TO_RIGHT: case LEFT_TO_RIGHT:
videoFrame.setLocation(0,0); videoFrame.setLocation(0,0);
textFrame.setLocation(videoFrame.getSize().width, 0); textFrame.setLocation(videoFrame.getSize().width, 0);
textFrame.setSize(getSize().width - videoFrame.getSize().width, getSize().height); textFrame.setSize(getSize().width - videoFrame.getSize().width, getSize().height);
if (vocabFrame != null)
{
vocabFrame.setLocation(0, videoFrame.getSize().height);
vocabFrame.setSize(videoFrame.getSize().width, getSize().height - videoFrame.getSize().height);
}
break; break;
default: default:
@ -132,8 +148,13 @@ public class Savant extends JDesktopPane
public void close() public void close()
{ {
if (sp != null) if (sp != null) {
sp.destroy(); try {
sp.destroy();
} catch (SmartMoviePanelException smpe) {
smpe.printStackTrace();
}
}
} }
public void open(TranscriptView[] views, String video, String vocabulary) public void open(TranscriptView[] views, String video, String vocabulary)
@ -149,14 +170,108 @@ public class Savant extends JDesktopPane
} }
} }
public void open(final TranscriptView[] views, final URL video, final URL vocabulary) public void setMediaPlayer(SmartMoviePanel smp) {
{ if (sp == smp)
videoPanel = new JPanel(new GridLayout(1,1)); return;
textPanel = new JPanel(new BorderLayout());
sp = new SoundPanel(this, video, views[0].getT1s(), views[0].getT2s(), views[0].getIDs()); if (sp != null) {
try {
sp.destroy();
videoFrame.getContentPane().removeAll();
} catch (SmartMoviePanelException smpe) {
smpe.printStackTrace();
ThdlDebug.noteIffyCode();
}
}
sp = smp;
sp.setParentContainer(Savant.this);
if (mediaURL != null) {
String t1s = convertTimesForSmartMoviePanel(transcriptViews[0].getT1s());
String t2s = convertTimesForSmartMoviePanel(transcriptViews[0].getT2s());
sp.initForSavant(t1s, t2s, transcriptViews[0].getIDs());
sp.addAnnotationPlayer(tp);
try {
sp.loadMovie(mediaURL);
startTimer();
} catch (SmartMoviePanelException smpe) {
smpe.printStackTrace();
ThdlDebug.noteIffyCode();
}
}
}
private void startTimer() {
final java.util.Timer timer = new java.util.Timer(true);
timer.schedule(new TimerTask() {
public void run()
{
if (sp.isInitialized())
{
System.out.println("initialized");
timer.cancel();
videoFrame.getContentPane().add(sp);
videoFrame.pack();
videoFrame.setMaximumSize(videoFrame.getSize());
if (videoFrame.getSize().height < 100) //must be audio file, so frame top to bottom
{
orientation = TOP_TO_BOTTOM;
videoFrame.setTitle(messages.getString("Audio"));
videoFrame.setLocation(getSize().width/2 - videoFrame.getSize().width/2, 0);
textFrame.setLocation(0, videoFrame.getSize().height);
textFrame.setSize(getSize().width, getSize().height - videoFrame.getSize().height);
} else { //must be video file, so frame left to right
orientation = LEFT_TO_RIGHT;
videoFrame.setTitle(messages.getString("Video"));
videoFrame.setLocation(0,0);
textFrame.setLocation(videoFrame.getSize().width, 0);
textFrame.setSize(getSize().width - videoFrame.getSize().width, getSize().height);
}
invalidate();
validate();
repaint();
Window rootWindow = (Window)SwingUtilities.getAncestorOfClass(Window.class, Savant.this);
rootWindow.setCursor(null);
}
}}, 0, 50);
}
public SmartMoviePanel getMediaPlayer() {
return sp;
}
private String convertTimesForSmartMoviePanel(String s) {
StringBuffer sBuff = new StringBuffer();
StringTokenizer sTok = new StringTokenizer(s, ",");
while (sTok.hasMoreTokens()) {
sBuff.append(String.valueOf(new Float(Float.parseFloat(sTok.nextToken()) * 1000).intValue()));
sBuff.append(',');
}
return sBuff.toString();
}
public void open(TranscriptView[] views, URL video, final URL vocabulary)
{
/* FIXME eventually
w/Savant and SoundPanel times were in seconds. QuillDriver's
SmartMoviePanel uses milliseconds instead, so here I convert
(for the time being anyway - eventually we need the same
time code format for both QD and Savant. */
String t1s = convertTimesForSmartMoviePanel(views[0].getT1s());
String t2s = convertTimesForSmartMoviePanel(views[0].getT2s());
if (sp == null) {
JOptionPane.showConfirmDialog(Savant.this, messages.getString("SupportedMediaError"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
return;
}
sp.initForSavant(t1s, t2s, views[0].getIDs());
tp = new TwoWayTextPlayer(sp, views[0], Color.cyan); tp = new TwoWayTextPlayer(sp, views[0], Color.cyan);
transcriptViews = views;
JPanel jp = new JPanel(); JPanel jp = new JPanel();
String[] viewNames = new String[views.length]; String[] viewNames = new String[views.length];
for (int i=0; i<views.length; i++) for (int i=0; i<views.length; i++)
@ -167,83 +282,41 @@ public class Savant extends JDesktopPane
public void theRealActionPerformed(ActionEvent e) public void theRealActionPerformed(ActionEvent e)
{ {
JComboBox jcb = (JComboBox)e.getSource(); JComboBox jcb = (JComboBox)e.getSource();
setTranscriptView(views[jcb.getSelectedIndex()]); setTranscriptView(transcriptViews[jcb.getSelectedIndex()]);
} }
}); });
jp.add(viewOptions); jp.add(viewOptions);
extras = vocabulary;
textPanel.add("Center", tp); textPanel.add("Center", tp);
textPanel.add("North", jp); textPanel.add("North", jp);
sp.addAnnotationPlayer(tp); sp.addAnnotationPlayer(tp);
sp.start(); try {
final Timer timer = new Timer(true); sp.loadMovie(video);
timer.schedule(new TimerTask() { mediaURL = video;
public void run() startTimer();
{ } catch (SmartMoviePanelException smpe) {
if (sp.cmd_isSized()) smpe.printStackTrace();
{ ThdlDebug.noteIffyCode();
timer.cancel(); }
//(String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable) }
videoFrame = new JInternalFrame(null, false, false, false, false);
textFrame = new JInternalFrame("Transcript", false, false, false, true); public void setTranscriptView(TranscriptView view)
textFrame.setVisible(true); {
videoFrame.setVisible(true); textPanel.invalidate();
if (vocabulary != null) textPanel.remove(tp);
{ tp.reset();
try { tp = new TwoWayTextPlayer(sp, view, Color.cyan);
JTextPane vocabPane = new JTextPane(); sp.addAnnotationPlayer(tp);
MouseListener[] mls = (MouseListener[])(vocabPane.getListeners(MouseListener.class)); if (sp.isPlaying())
for (int i=0; i<mls.length; i++) sp.launchAnnotationTimer();
vocabPane.removeMouseListener(mls[i]); textPanel.add("Center", tp);
vocabPane.setEditable(false); textPanel.validate();
vocabPanel = new JScrollPane(vocabPane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); textPanel.repaint();
InputStream in = extras.openStream(); }
RTFEditorKit rtf = new RTFEditorKit(); }
rtf.read(in, vocabPane.getDocument(), 0);
vocabPane.getCaret().setDot(0); /*
} catch (IOException ioe) {
ioe.printStackTrace();
ThdlDebug.noteIffyCode();
} catch (BadLocationException ble) {
ble.printStackTrace();
ThdlDebug.noteIffyCode();
}
vocabFrame = new JInternalFrame("About the Video", false, false, false, true);
vocabFrame.setContentPane(vocabPanel);
vocabFrame.setVisible(true);
}
videoPanel.add(sp);
videoFrame.setContentPane(videoPanel);
videoFrame.pack();
videoFrame.setMaximumSize(videoFrame.getSize());
textFrame.setContentPane(textPanel);
if (videoFrame.getSize().height < 100) //must be audio file, so frame top to bottom
{
orientation = TOP_TO_BOTTOM;
videoFrame.setTitle("Audio");
videoFrame.setLocation(getSize().width/2 - videoFrame.getSize().width/2, 0);
textFrame.setLocation(0, videoFrame.getSize().height);
if (vocabulary != null)
{
textFrame.setSize(getSize().width / 2, getSize().height - videoFrame.getSize().height);
vocabFrame.setLocation(textFrame.getSize().width, videoFrame.getSize().height);
vocabFrame.setSize(getSize().width - textFrame.getSize().width, getSize().height - videoFrame.getSize().height);
} else
textFrame.setSize(getSize().width, getSize().height - videoFrame.getSize().height);
} else { //must be video file, so frame left to right
orientation = LEFT_TO_RIGHT;
videoFrame.setTitle("Video");
videoFrame.setLocation(0,0);
textFrame.setLocation(videoFrame.getSize().width, 0);
textFrame.setSize(getSize().width - videoFrame.getSize().width, getSize().height);
if (vocabulary != null)
{
vocabFrame.setLocation(0, videoFrame.getSize().height);
vocabFrame.setSize(videoFrame.getSize().width, getSize().height - videoFrame.getSize().height);
}
}
if (sp.getVisualComponent() != null) if (sp.getVisualComponent() != null)
{ //video, so can be full screen { //video, so can be full screen
sp.getVisualComponent().addMouseListener(new MouseAdapter() sp.getVisualComponent().addMouseListener(new MouseAdapter()
@ -256,7 +329,7 @@ public class Savant extends JDesktopPane
{ {
fullScreen = new JFrame(); fullScreen = new JFrame();
/* We don't do anything special if this fails: */ We don't do anything special if this fails:
JdkVersionHacks.undecorateJFrame(fullScreen); JdkVersionHacks.undecorateJFrame(fullScreen);
fullScreen.getContentPane().setBackground(Color.black); fullScreen.getContentPane().setBackground(Color.black);
@ -294,11 +367,11 @@ public class Savant extends JDesktopPane
visual = sp.popVisualComponent(); visual = sp.popVisualComponent();
fullScreen.show(); fullScreen.show();
/* FIXME: In SavantShell, we test FIXME: In SavantShell, we test
to see if MAXIMIZE_BOTH is to see if MAXIMIZE_BOTH is
supported, but we don't supported, but we don't
here. */ here.
/* Ignore failure: */ Ignore failure:
JdkVersionHacks.maximizeJFrameInBothDirections(fullScreen); JdkVersionHacks.maximizeJFrameInBothDirections(fullScreen);
fullScreen.getContentPane().add(visual); fullScreen.getContentPane().add(visual);
@ -312,36 +385,4 @@ public class Savant extends JDesktopPane
} }
}); });
} }
removeAll(); */
setLayout(null);
add(videoFrame, JLayeredPane.POPUP_LAYER);
invalidate();
validate();
repaint();
add(textFrame, JLayeredPane.DEFAULT_LAYER);
invalidate();
validate();
repaint();
if (vocabulary != null)
{
add(vocabFrame, JLayeredPane.DEFAULT_LAYER);
invalidate();
validate();
repaint();
}
}
}}, 0, 50);
}
public void setTranscriptView(TranscriptView view)
{
textPanel.invalidate();
textPanel.remove(tp);
tp.reset();
tp = new TwoWayTextPlayer(sp, view, Color.cyan);
sp.addAnnotationPlayer(tp);
textPanel.add("Center", tp);
textPanel.validate();
textPanel.repaint();
}
}

View file

@ -23,17 +23,21 @@ import java.awt.*;
import java.net.*; import java.net.*;
import java.util.*; import java.util.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.awt.event.*; import java.awt.event.*;
import javax.swing.text.*; import javax.swing.text.*;
import javax.swing.text.rtf.*; import javax.swing.text.rtf.*;
import org.thdl.savant.ucuchi.*; import org.thdl.savant.ucuchi.*;
import org.thdl.savant.tib.*; import org.thdl.savant.tib.*;
import org.thdl.media.*;
import org.thdl.util.TeeStream; import org.thdl.util.TeeStream;
import org.thdl.util.ThdlDebug; import org.thdl.util.ThdlDebug;
import org.thdl.util.ThdlActionListener; import org.thdl.util.ThdlActionListener;
import org.thdl.util.RTFPane; import org.thdl.util.RTFPane;
import org.thdl.util.SimpleFrame; import org.thdl.util.SimpleFrame;
import org.thdl.util.ThdlI18n;
public class SavantShell extends JFrame public class SavantShell extends JFrame
{ {
@ -41,11 +45,13 @@ public class SavantShell extends JFrame
private static JScrollPane helpPane = null; private static JScrollPane helpPane = null;
private static JScrollPane aboutPane = null; private static JScrollPane aboutPane = null;
private static String mediaPath = null; private static String mediaPath = null;
private static JFileChooser fileChooser;
private JFileChooser fileChooser;
private javax.swing.filechooser.FileFilter savantFilter;
private Savant savant = null; private Savant savant = null;
static Locale locale = null;
ResourceBundle messages = null;
public static void main(String[] args) { public static void main(String[] args) {
try { try {
ThdlDebug.attemptToSetUpLogFile("savant", ".log"); ThdlDebug.attemptToSetUpLogFile("savant", ".log");
@ -71,39 +77,34 @@ public class SavantShell extends JFrame
ThdlDebug.noteIffyCode(); ThdlDebug.noteIffyCode();
} }
if (args.length == 2) {
locale = new Locale(new String(args[0]), new String(args[1]));
ThdlI18n.setLocale(locale);
}
initFileChooser();
SavantShell ssh = new SavantShell(); SavantShell ssh = new SavantShell();
ssh.setVisible(true); ssh.setVisible(true);
ssh.initFileChooser();
} catch (NoClassDefFoundError err) { } catch (NoClassDefFoundError err) {
ThdlDebug.handleClasspathError("Savant's CLASSPATH", err); ThdlDebug.handleClasspathError("Savant's CLASSPATH", err);
} }
} }
public void initFileChooser() { public static void initFileChooser() {
fileChooser = new JFileChooser(); fileChooser = new JFileChooser();
fileChooser.setFileView(new SavantFileView()); fileChooser.setFileView(new SavantFileView());
savantFilter = new SavantFilter(); fileChooser.addChoosableFileFilter(new FileFilter() {
fileChooser.addChoosableFileFilter(savantFilter); public boolean accept(File f) {
} if (f.isDirectory()) {
return true;
public void setFileChooser(JFileChooser fc) { }
fileChooser = fc; return f.getName().toLowerCase().endsWith(SavantFileView.getDotSavant());
}
private class SavantFilter extends javax.swing.filechooser.FileFilter {
// accepts all directories and all savant files
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
} }
return f.getName().toLowerCase().endsWith(SavantFileView.getDotSavant()); //the description of this filter
} public String getDescription() {
return "Savant data (.savant)";
//the description of this filter }
public String getDescription() { });
return "Savant data (.savant)";
}
} }
/** Closes one open title, if there is one open. Returns true if /** Closes one open title, if there is one open. Returns true if
@ -136,11 +137,13 @@ public class SavantShell extends JFrame
public SavantShell() public SavantShell()
{ {
setTitle("Savant"); setTitle("Savant");
messages = ThdlI18n.getResourceBundle();
savant = new Savant();
JMenuBar menuBar = new JMenuBar(); JMenuBar menuBar = new JMenuBar();
JMenu fileMenu = new JMenu("File"); JMenu fileMenu = new JMenu(messages.getString("File"));
JMenuItem openItem = new JMenuItem("Open"); JMenuItem openItem = new JMenuItem(messages.getString("Open"));
openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,java.awt.Event.CTRL_MASK)); openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,java.awt.Event.CTRL_MASK));
openItem.addActionListener(new ThdlActionListener() { openItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) { public void theRealActionPerformed(ActionEvent e) {
@ -165,7 +168,8 @@ public class SavantShell extends JFrame
} }
}); });
JMenuItem closeItem = new JMenuItem("Close");
JMenuItem closeItem = new JMenuItem(messages.getString("Close"));
closeItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,java.awt.Event.CTRL_MASK)); closeItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,java.awt.Event.CTRL_MASK));
closeItem.addActionListener(new ThdlActionListener() closeItem.addActionListener(new ThdlActionListener()
{ {
@ -176,7 +180,7 @@ public class SavantShell extends JFrame
} }
}); });
JMenuItem quitItem = new JMenuItem("Quit"); JMenuItem quitItem = new JMenuItem(messages.getString("Quit"));
quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,java.awt.Event.CTRL_MASK)); quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,java.awt.Event.CTRL_MASK));
quitItem.addActionListener(new ThdlActionListener() quitItem.addActionListener(new ThdlActionListener()
{ {
@ -209,21 +213,43 @@ public class SavantShell extends JFrame
fileMenu.addSeparator(); fileMenu.addSeparator();
fileMenu.add(quitItem); fileMenu.add(quitItem);
JMenu infoMenu = new JMenu("Information");
JMenuItem helpItem = new JMenuItem("Help"); JMenu mediaPlayerMenu = new JMenu(messages.getString("MediaPlayer"));
java.util.List moviePlayers = SmartPlayerFactory.getAllAvailableSmartPlayers();
for (int i=0; i<moviePlayers.size(); i++) {
final SmartMoviePanel mPlayer = (SmartMoviePanel)moviePlayers.get(i);
JMenuItem mItem = new JMenuItem(mPlayer.getIdentifyingName());
mItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
savant.setMediaPlayer(mPlayer);
}
});
mediaPlayerMenu.add(mItem);
}
JMenu preferencesMenu = new JMenu(messages.getString("Preferences"));
if (moviePlayers.size() > 0) {
SmartMoviePanel defaultPlayer = (SmartMoviePanel)moviePlayers.get(0);
savant.setMediaPlayer(defaultPlayer); //set savant media player to default
if (moviePlayers.size() > 1)
preferencesMenu.add(mediaPlayerMenu);
}
JMenu infoMenu = new JMenu(messages.getString("InfoShort"));
JMenuItem helpItem = new JMenuItem(messages.getString("Help"));
helpItem.addActionListener(new ThdlActionListener() helpItem.addActionListener(new ThdlActionListener()
{ {
public void theRealActionPerformed(ActionEvent e) public void theRealActionPerformed(ActionEvent e)
{ {
new SimpleFrame("Help", helpPane); new SimpleFrame(messages.getString("Help"), helpPane);
} }
}); });
JMenuItem aboutItem = new JMenuItem("About"); JMenuItem aboutItem = new JMenuItem(messages.getString("About"));
aboutItem.addActionListener(new ThdlActionListener() aboutItem.addActionListener(new ThdlActionListener()
{ {
public void theRealActionPerformed(ActionEvent e) public void theRealActionPerformed(ActionEvent e)
{ {
new SimpleFrame("About", aboutPane); new SimpleFrame(messages.getString("About"), aboutPane);
} }
}); });
infoMenu.add(helpItem); infoMenu.add(helpItem);
@ -235,6 +261,7 @@ public class SavantShell extends JFrame
infoMenu.getPopupMenu().setLightWeightPopupEnabled(false); infoMenu.getPopupMenu().setLightWeightPopupEnabled(false);
menuBar.add(fileMenu); menuBar.add(fileMenu);
menuBar.add(preferencesMenu);
menuBar.add(infoMenu); menuBar.add(infoMenu);
setJMenuBar(menuBar); setJMenuBar(menuBar);
@ -269,13 +296,14 @@ public class SavantShell extends JFrame
public void newSavantWindow(String project, String titleName, URL trn, URL vid, URL abt) public void newSavantWindow(String project, String titleName, URL trn, URL vid, URL abt)
{ {
try { try {
if (numberOfSavantsOpen == 0) if (numberOfSavantsOpen == 0) {
setCursor(new Cursor(Cursor.WAIT_CURSOR));
openSavant(project, titleName, trn, vid, abt); openSavant(project, titleName, trn, vid, abt);
else { } else {
SavantShell scp = new SavantShell(); SavantShell scp = new SavantShell();
scp.setVisible(true); scp.setVisible(true);
setCursor(new Cursor(Cursor.WAIT_CURSOR));
scp.openSavant(project, titleName, trn, vid, abt); scp.openSavant(project, titleName, trn, vid, abt);
scp.setFileChooser(fileChooser);
} }
numberOfSavantsOpen++; numberOfSavantsOpen++;
} catch (NoClassDefFoundError err) { } catch (NoClassDefFoundError err) {
@ -286,7 +314,6 @@ public class SavantShell extends JFrame
public void openSavant(String project, String titleName, URL trn, URL vid, URL abt) public void openSavant(String project, String titleName, URL trn, URL vid, URL abt)
{ {
setTitle(titleName); setTitle(titleName);
savant = new Savant();
setContentPane(savant); setContentPane(savant);
validate(); validate();
savant.paintImmediately(0,0,savant.getWidth(),savant.getHeight()); savant.paintImmediately(0,0,savant.getWidth(),savant.getHeight());
@ -324,11 +351,13 @@ public class SavantShell extends JFrame
if (i!=-1) if (i!=-1)
{ {
/*
JOptionPane.showMessageDialog(this, JOptionPane.showMessageDialog(this,
"If you want to see text in Tibetan script, "+ "If you want to see text in Tibetan script, "+
"please visit www.thdl.org to download and "+ "please visit www.thdl.org to download and "+
"install the Tibetan Machine Web fonts.", "install the Tibetan Machine Web fonts.",
"Note", JOptionPane.INFORMATION_MESSAGE); "Note", JOptionPane.INFORMATION_MESSAGE);
*/
TranscriptView[] views = new TranscriptView[3]; TranscriptView[] views = new TranscriptView[3];
views[0] = new org.thdl.savant.tib.Wylie(isr); views[0] = new org.thdl.savant.tib.Wylie(isr);