Jskad has a new feature: Convert Selection from ACIP to Tibetan. It uses the ACIP converter to do its work.
Improved some error messages from the ACIP->Tibetan converter.
This commit is contained in:
parent
5ce84d4d9a
commit
4b1395e0ba
8 changed files with 193 additions and 94 deletions
|
@ -1549,7 +1549,7 @@ public void paste(int offset) {
|
|||
ThdlDebug.noteIffyCode();
|
||||
}
|
||||
} else {
|
||||
DuffData[] dd = TibTextUtils.getTibetanMachineWeb(next);
|
||||
DuffData[] dd = TibTextUtils.getTibetanMachineWebForEWTS(next);
|
||||
offset = getTibDoc().insertDuff(offset, dd);
|
||||
}
|
||||
}
|
||||
|
@ -1563,21 +1563,24 @@ public void paste(int offset) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts the currently selected text from Extended Wylie to TibetanMachineWeb.
|
||||
*/
|
||||
public void toTibetanMachineWeb() {
|
||||
* Converts the currently selected text from Roman transliteration to
|
||||
* TibetanMachineWeb.
|
||||
* @param fromACIP true if the selection is ACIP, false if it is EWTS
|
||||
* */
|
||||
public void toTibetanMachineWeb(boolean fromACIP) {
|
||||
int start = getSelectionStart();
|
||||
int end = getSelectionEnd();
|
||||
|
||||
toTibetanMachineWeb(start, end);
|
||||
toTibetanMachineWeb(fromACIP, start, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a stretch of text from Extended Wylie to TibetanMachineWeb.
|
||||
* @param fromACIP true if the selection is ACIP, false if it is EWTS
|
||||
* @param start the begin point for the conversion
|
||||
* @param end the end point for the conversion
|
||||
*/
|
||||
public void toTibetanMachineWeb(int start, int end) {
|
||||
public void toTibetanMachineWeb(boolean fromACIP, int start, int end) {
|
||||
if (start == end)
|
||||
return;
|
||||
|
||||
|
@ -1599,17 +1602,28 @@ public void paste(int offset) {
|
|||
if ((0 != TibetanMachineWeb.getTMWFontNumber(fontName)) || i==endPos.getOffset()) {
|
||||
if (i != start) {
|
||||
try {
|
||||
DuffData[] duffdata = TibTextUtils.getTibetanMachineWeb(sb.toString());
|
||||
getTibDoc().remove(start, i-start);
|
||||
getTibDoc().insertDuff(start, duffdata);
|
||||
}
|
||||
catch (InvalidWylieException iwe) {
|
||||
DuffData[] duffdata = null;
|
||||
if (fromACIP) {
|
||||
getTibDoc().remove(start, i-start);
|
||||
TibTextUtils.insertTibetanMachineWebForACIP(sb.toString(), getTibDoc(), start);
|
||||
}
|
||||
else
|
||||
duffdata = TibTextUtils.getTibetanMachineWebForEWTS(sb.toString());
|
||||
if (!fromACIP) {
|
||||
getTibDoc().remove(start, i-start);
|
||||
getTibDoc().insertDuff(start, duffdata);
|
||||
}
|
||||
} catch (InvalidWylieException iwe) {
|
||||
JOptionPane.showMessageDialog(this,
|
||||
"The Wylie you are trying to convert is invalid, " +
|
||||
"beginning from:\n " + iwe.getCulpritInContext() +
|
||||
"\nThe culprit is probably the character '" +
|
||||
iwe.getCulprit() + "'.");
|
||||
return;
|
||||
} catch (InvalidACIPException iae) {
|
||||
JOptionPane.showMessageDialog(this,
|
||||
"The ACIP you are trying to convert is invalid:\n" + iae.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
start = i+1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue