Rearranged the Tools menu; made the converter smart about "find some..."

and "find all..." modes.
This commit is contained in:
dchandler 2003-07-05 21:02:46 +00:00
parent 72d2eee503
commit 8c4ab30a52
2 changed files with 142 additions and 108 deletions

View file

@ -89,6 +89,21 @@ public class ConverterGUI implements FontConversion, FontConverterConstants {
"Errors in Conversion",
JOptionPane.ERROR_MESSAGE);
return false;
} else if (1 == returnCode) {
if (FIND_SOME_NON_TMW == whichConversion
|| FIND_ALL_NON_TMW == whichConversion) {
JOptionPane.showMessageDialog(cd,
"Something besides TibetanMachineWeb was found; see output file.",
"Not entirely TMW",
JOptionPane.PLAIN_MESSAGE);
} else if (FIND_SOME_NON_TM == whichConversion
|| FIND_ALL_NON_TM == whichConversion) {
JOptionPane.showMessageDialog(cd,
"Something besides TibetanMachine was found; see output file.",
"Not entirely TM",
JOptionPane.PLAIN_MESSAGE);
}
return false;
} else if (0 != returnCode) {
JOptionPane.showMessageDialog(cd,
"The conversion failed with code " + returnCode + "; please e-mail\ndchandler@users.sourceforge.net to learn what that means if\nyou can't find out from the output.",
@ -96,11 +111,26 @@ public class ConverterGUI implements FontConversion, FontConverterConstants {
JOptionPane.ERROR_MESSAGE);
return false;
} else {
if (!ThdlOptions.getBooleanOption("thdl.skip.conversion.success.message"))
if (!ThdlOptions.getBooleanOption("thdl.skip.conversion.success.message")) {
if (FIND_SOME_NON_TMW == whichConversion
|| FIND_ALL_NON_TMW == whichConversion) {
JOptionPane.showMessageDialog(cd,
"Nothing except TibetanMachineWeb was found.",
"All TMW",
JOptionPane.PLAIN_MESSAGE);
} else if (FIND_SOME_NON_TM == whichConversion
|| FIND_ALL_NON_TM == whichConversion) {
JOptionPane.showMessageDialog(cd,
"Nothing except TibetanMachine was found.",
"All TM",
JOptionPane.PLAIN_MESSAGE);
} else {
JOptionPane.showMessageDialog(cd,
"The conversion went perfectly.",
"Conversion succeeded",
JOptionPane.PLAIN_MESSAGE);
}
}
return true;
}
}

View file

@ -396,13 +396,15 @@ public class Jskad extends JPanel implements DocumentListener {
JMenu toolsMenu = new JMenu("Tools");
JMenu convertSelectionMenu = new JMenu("Convert Selection");
JMenuItem TMWWylieItem = new JMenuItem("Convert Tibetan to Wylie");
TMWWylieItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
toWylie();
}
});
toolsMenu.add(TMWWylieItem);
convertSelectionMenu.add(TMWWylieItem);
toolsMenu.add(convertSelectionMenu);
JMenuItem wylieTMWItem = new JMenuItem("Convert Wylie to Tibetan");
wylieTMWItem.addActionListener(new ThdlActionListener() {
@ -410,29 +412,11 @@ public class Jskad extends JPanel implements DocumentListener {
toTibetan();
}
});
toolsMenu.add(wylieTMWItem);
convertSelectionMenu.add(wylieTMWItem);
if (parentObject instanceof JFrame || parentObject instanceof JInternalFrame) {
JMenuItem openWithItem = new JMenuItem("Open With External Viewer...");
openWithItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
openWithExternalViewer();
}
});
toolsMenu.addSeparator();
toolsMenu.add(openWithItem);
JMenu convertAllMenu = new JMenu("Convert All");
JMenuItem importItem = new JMenuItem("Import Wylie as Tibetan");
importItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
importWylie();
}
});
toolsMenu.addSeparator();
toolsMenu.add(importItem);
JMenuItem toTMItem = new JMenuItem("Convert TMW to TM"); // DLC FIXME: do it just in the selection?
JMenuItem toTMItem = new JMenuItem("Convert Tibetan to TM"); // DLC FIXME: do it just in the selection?
toTMItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
StringBuffer errors = new StringBuffer();
@ -444,7 +428,7 @@ public class Jskad extends JPanel implements DocumentListener {
JOptionPane.showMessageDialog(Jskad.this,
"At least one error occurred while converting Tibetan Machine Web\nto Tibetan Machine. Your document is mostly converted,\nexcept for the following glyphs, which you should replace manually\nbefore retrying:\n"
+ errors.toString(),
"TMW to TM Errors",
"Tibetan to TM Errors",
JOptionPane.PLAIN_MESSAGE);
} else {
if (numAttemptedReplacements[0] > 0) {
@ -462,7 +446,7 @@ public class Jskad extends JPanel implements DocumentListener {
}
});
JMenuItem toTMWItem = new JMenuItem("Convert TM to TMW"); // DLC FIXME: do it just in the selection?
JMenuItem toTMWItem = new JMenuItem("Convert TM to Tibetan"); // DLC FIXME: do it just in the selection?
toTMWItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
StringBuffer errors = new StringBuffer();
@ -474,7 +458,7 @@ public class Jskad extends JPanel implements DocumentListener {
JOptionPane.showMessageDialog(Jskad.this,
"At least one error occurred while converting Tibetan Machine\nto Tibetan Machine Web. Your document is mostly converted,\nexcept for the following glyphs, which you should replace manually\nbefore retrying:\n"
+ errors.toString(),
"TM to TMW Errors", JOptionPane.PLAIN_MESSAGE);
"TM to Tibetan Errors", JOptionPane.PLAIN_MESSAGE);
} else {
if (numAttemptedReplacements[0] > 0) {
JOptionPane.showMessageDialog(Jskad.this,
@ -491,7 +475,7 @@ public class Jskad extends JPanel implements DocumentListener {
}
});
JMenuItem toUnicodeItem = new JMenuItem("Convert TMW to Unicode"); // DLC FIXME: do it just in the selection?
JMenuItem toUnicodeItem = new JMenuItem("Convert Tibetan to Unicode (not perfect yet)"); // DLC FIXME: do it just in the selection?
toUnicodeItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
StringBuffer errors = new StringBuffer();
@ -504,7 +488,7 @@ public class Jskad extends JPanel implements DocumentListener {
JOptionPane.showMessageDialog(Jskad.this,
"At least one error occurred while converting Tibetan Machine Web\nto Unicode. Your document is mostly converted,\nexcept for the following glyphs, which you should replace manually\nbefore retrying:\n"
+ errors.toString(),
"TMW to Unicode Errors", JOptionPane.PLAIN_MESSAGE);
"Tibetan to Unicode Errors", JOptionPane.PLAIN_MESSAGE);
} else {
if (numAttemptedReplacements[0] > 0) {
JOptionPane.showMessageDialog(Jskad.this,
@ -520,7 +504,12 @@ public class Jskad extends JPanel implements DocumentListener {
}
}
});
convertAllMenu.add(toTMItem);
convertAllMenu.add(toTMWItem);
convertAllMenu.add(toUnicodeItem);
toolsMenu.add(convertAllMenu);
if (parentObject instanceof JFrame || parentObject instanceof JInternalFrame) {
JMenuItem converterItem = new JMenuItem("Launch Converter...");
converterItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
@ -532,12 +521,27 @@ public class Jskad extends JPanel implements DocumentListener {
: null));
}
});
toolsMenu.addSeparator();
toolsMenu.add(toTMItem);
toolsMenu.add(toTMWItem);
toolsMenu.add(toUnicodeItem);
toolsMenu.addSeparator();
toolsMenu.add(converterItem);
JMenuItem importItem = new JMenuItem("Import Wylie as Tibetan...");
importItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
importWylie();
}
});
toolsMenu.addSeparator();
toolsMenu.add(importItem);
JMenuItem openWithItem = new JMenuItem("Open With External Viewer...");
openWithItem.addActionListener(new ThdlActionListener() {
public void theRealActionPerformed(ActionEvent e) {
openWithExternalViewer();
}
});
toolsMenu.addSeparator();
toolsMenu.add(openWithItem);
}