New feature: Convert Selection from TWM to ACIP.

This commit is contained in:
dchandler 2003-11-08 23:22:06 +00:00
parent bab47c4910
commit 8fbd8850f8

View file

@ -425,12 +425,21 @@ public class Jskad extends JPanel implements DocumentListener {
JMenuItem TMWWylieItem = new JMenuItem("Convert Tibetan to Wylie"); JMenuItem TMWWylieItem = new JMenuItem("Convert Tibetan to Wylie");
TMWWylieItem.addActionListener(new ThdlActionListener() { TMWWylieItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) { public void theRealActionPerformed(ActionEvent e) {
toWylie(); toTranslit(true);
} }
}); });
convertSelectionMenu.add(TMWWylieItem); convertSelectionMenu.add(TMWWylieItem);
toolsMenu.add(convertSelectionMenu); toolsMenu.add(convertSelectionMenu);
JMenuItem TMWACIPItem = new JMenuItem("Convert Tibetan to ACIP");
TMWACIPItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
toTranslit(false);
}
});
convertSelectionMenu.add(TMWACIPItem);
toolsMenu.add(convertSelectionMenu);
JMenuItem wylieTMWItem = new JMenuItem("Convert Wylie to Tibetan"); JMenuItem wylieTMWItem = new JMenuItem("Convert Wylie to Tibetan");
wylieTMWItem.addActionListener(new ThdlActionListener() { wylieTMWItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) { public void theRealActionPerformed(ActionEvent e) {
@ -1144,13 +1153,25 @@ public class Jskad extends JPanel implements DocumentListener {
Jskad.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); Jskad.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} }
private void toWylie() { private void toTranslit(boolean toWylieNotACIP) {
Jskad.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Jskad.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
if (!((TibetanDocument)dp.getDocument()).toWylie(dp.getSelectionStart(), if (!(toWylieNotACIP
dp.getSelectionEnd(), ? ((TibetanDocument)dp.getDocument()).toWylie(dp.getSelectionStart(),
new long[] { 0 })) { dp.getSelectionEnd(),
new long[] { 0 })
: ((TibetanDocument)dp.getDocument()).toACIP(dp.getSelectionStart(),
dp.getSelectionEnd(),
new long[] { 0 }))) {
JOptionPane.showMessageDialog(Jskad.this, JOptionPane.showMessageDialog(Jskad.this,
"Though some Extended Wylie has been produced, it\ncontains ugly error messages like\n\"<<[[JSKAD_TMW_TO_WYLIE_ERROR_NO_SUCH_WYLIE:\n Cannot convert DuffCode...\".\nPlease edit the output by hand to replace all such\ncreatures with the correct EWTS transliteration.", "Though some "
+ (toWylieNotACIP
? "Extended Wylie"
: "ACIP")
+ " has been produced, it\ncontains ugly error messages"
+ (toWylieNotACIP
? " like\n\"<<[[JSKAD_TMW_TO_WYLIE_ERROR_NO_SUCH_WYLIE:\n Cannot convert DuffCode...\"."
: ".")
+ "\nPlease edit the output by hand to replace all such\ncreatures with the correct transliteration.",
"Attention Required", "Attention Required",
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }