In TCC #1 keyboard, h>cj now works. I may have fixed this in a terrible way, breaking other things even. Hard to say because I don't really understand the code I changed. But DuffPaneTest passes.
If we ever clean up the keyboards, the changes made here to tcc_keyboard.ini should probably be undone.
This commit is contained in:
parent
d7fdacfcdc
commit
129ebccd67
2 changed files with 161 additions and 137 deletions
|
@ -751,13 +751,15 @@ public class DuffPane extends TibetanPane implements FocusListener {
|
||||||
* the gigu will depend on "k", not "'".
|
* the gigu will depend on "k", not "'".
|
||||||
*
|
*
|
||||||
* @param v the vowel (in Wylie) you want to insert
|
* @param v the vowel (in Wylie) you want to insert
|
||||||
|
* @return true if the status bar was updated
|
||||||
*/
|
*/
|
||||||
private void putVowel(String v) {
|
private boolean putVowel(String v) {
|
||||||
|
boolean rv = false;
|
||||||
if (caret.getDot()==0) {
|
if (caret.getDot()==0) {
|
||||||
if (!TibetanMachineWeb.isAChenRequiredBeforeVowel())
|
if (!TibetanMachineWeb.isAChenRequiredBeforeVowel())
|
||||||
printAChenWithVowel(v);
|
return printAChenWithVowel(v);
|
||||||
|
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttributeSet attr = getTibDoc().getCharacterElement(caret.getDot()-1).getAttributes();
|
AttributeSet attr = getTibDoc().getCharacterElement(caret.getDot()-1).getAttributes();
|
||||||
|
@ -770,9 +772,9 @@ public class DuffPane extends TibetanPane implements FocusListener {
|
||||||
int k = (int)c2;
|
int k = (int)c2;
|
||||||
if (k<32 || k>126) { //if previous character is formatting or some other non-character
|
if (k<32 || k>126) { //if previous character is formatting or some other non-character
|
||||||
if (!TibetanMachineWeb.isAChenRequiredBeforeVowel())
|
if (!TibetanMachineWeb.isAChenRequiredBeforeVowel())
|
||||||
printAChenWithVowel(v);
|
return printAChenWithVowel(v);
|
||||||
|
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String wylie
|
String wylie
|
||||||
|
@ -781,8 +783,7 @@ public class DuffPane extends TibetanPane implements FocusListener {
|
||||||
TibTextUtils.weDoNotCareIfThereIsCorrespondingWylieOrNot);
|
TibTextUtils.weDoNotCareIfThereIsCorrespondingWylieOrNot);
|
||||||
if (TibetanMachineWeb.isWyliePunc(wylie)) {
|
if (TibetanMachineWeb.isWyliePunc(wylie)) {
|
||||||
if (charList.isEmpty() && !TibetanMachineWeb.isAChenRequiredBeforeVowel()) {
|
if (charList.isEmpty() && !TibetanMachineWeb.isAChenRequiredBeforeVowel()) {
|
||||||
printAChenWithVowel(v);
|
return printAChenWithVowel(v);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,6 +809,8 @@ public class DuffPane extends TibetanPane implements FocusListener {
|
||||||
TibTextUtils.getVowel(after_vowel, dc_1, dc_2, v);
|
TibTextUtils.getVowel(after_vowel, dc_1, dc_2, v);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// drop this vowel silently.
|
// drop this vowel silently.
|
||||||
|
updateStatus("Dropping vowel as it would displace an existing vowel. [b]");
|
||||||
|
rv = true;
|
||||||
}
|
}
|
||||||
if (after_vowel.size() >= before_vowel.size()) {
|
if (after_vowel.size() >= before_vowel.size()) {
|
||||||
setNumberOfGlyphsForLastVowel(after_vowel.size()
|
setNumberOfGlyphsForLastVowel(after_vowel.size()
|
||||||
|
@ -825,8 +828,9 @@ public class DuffPane extends TibetanPane implements FocusListener {
|
||||||
}
|
}
|
||||||
else { //0 font means not Tibetan font, so begin new Tibetan font section
|
else { //0 font means not Tibetan font, so begin new Tibetan font section
|
||||||
if (!TibetanMachineWeb.isAChenRequiredBeforeVowel())
|
if (!TibetanMachineWeb.isAChenRequiredBeforeVowel())
|
||||||
printAChenWithVowel(v);
|
return printAChenWithVowel(v);
|
||||||
}
|
}
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -849,8 +853,10 @@ public class DuffPane extends TibetanPane implements FocusListener {
|
||||||
* is false, this method is called frequently.
|
* is false, this method is called frequently.
|
||||||
*
|
*
|
||||||
* @param v the vowel (in Wylie) which you want to print with ACHEN
|
* @param v the vowel (in Wylie) which you want to print with ACHEN
|
||||||
|
* @return true if and only if the status bar was updated
|
||||||
*/
|
*/
|
||||||
private void printAChenWithVowel(String v) {
|
private boolean printAChenWithVowel(String v) {
|
||||||
|
boolean rv = false;
|
||||||
DuffCode[] dc_array = (DuffCode[])TibetanMachineWeb.getTibHash().get(TibetanMachineWeb.ACHEN);
|
DuffCode[] dc_array = (DuffCode[])TibetanMachineWeb.getTibHash().get(TibetanMachineWeb.ACHEN);
|
||||||
DuffCode dc = dc_array[TibetanMachineWeb.TMW];
|
DuffCode dc = dc_array[TibetanMachineWeb.TMW];
|
||||||
java.util.List achenlist = new ArrayList();
|
java.util.List achenlist = new ArrayList();
|
||||||
|
@ -858,9 +864,12 @@ public class DuffPane extends TibetanPane implements FocusListener {
|
||||||
TibTextUtils.getVowel(achenlist, dc, v);
|
TibTextUtils.getVowel(achenlist, dc, v);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// drop this vowel silently.
|
// drop this vowel silently.
|
||||||
|
updateStatus("Dropping vowel as it would displace an existing vowel. [a]");
|
||||||
|
rv = true;
|
||||||
}
|
}
|
||||||
DuffData[] dd = TibTextUtils.convertGlyphs(achenlist);
|
DuffData[] dd = TibTextUtils.convertGlyphs(achenlist);
|
||||||
getTibDoc().insertDuff(caret.getDot(), dd);
|
getTibDoc().insertDuff(caret.getDot(), dd);
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1299,15 +1308,17 @@ public void paste(int offset) {
|
||||||
if (TibetanMachineWeb.isVowel(s)) {
|
if (TibetanMachineWeb.isVowel(s)) {
|
||||||
s = TibetanMachineWeb.getWylieForVowel(s);
|
s = TibetanMachineWeb.getWylieForVowel(s);
|
||||||
|
|
||||||
|
int nglv = 0;
|
||||||
if (isTypingVowel) {
|
if (isTypingVowel) {
|
||||||
//note: this takes care of multiple keystroke vowels like 'ai'
|
//note: this takes care of multiple keystroke vowels like 'ai'
|
||||||
backSpace(getNumberOfGlyphsForLastVowel());
|
backSpace(nglv = getNumberOfGlyphsForLastVowel());
|
||||||
}
|
}
|
||||||
|
|
||||||
putVowel(s);
|
|
||||||
isTypingVowel = true;
|
isTypingVowel = true;
|
||||||
changedStatus = true;
|
changedStatus = true;
|
||||||
updateStatus("You typed a vowel (the simple way).");
|
if (!putVowel(s)) {
|
||||||
|
updateStatus("You typed a vowel " + s + " (the simple way). We backspaced " + nglv + " spaces before adding it.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isTypingVowel) {
|
if (isTypingVowel) {
|
||||||
isTypingVowel = false;
|
isTypingVowel = false;
|
||||||
|
@ -1317,10 +1328,11 @@ public void paste(int offset) {
|
||||||
|
|
||||||
if (TibetanMachineWeb.isVowel(s)) {
|
if (TibetanMachineWeb.isVowel(s)) {
|
||||||
s = TibetanMachineWeb.getWylieForVowel(s);
|
s = TibetanMachineWeb.getWylieForVowel(s);
|
||||||
putVowel(s);
|
|
||||||
isTypingVowel = true;
|
isTypingVowel = true;
|
||||||
changedStatus = true;
|
changedStatus = true;
|
||||||
updateStatus("You typed a vowel (the other way).");
|
if (!putVowel(s)) {
|
||||||
|
updateStatus("You typed a vowel (the other way).");
|
||||||
|
}
|
||||||
} else if (TibetanMachineWeb.isChar(s)) {
|
} else if (TibetanMachineWeb.isChar(s)) {
|
||||||
s = TibetanMachineWeb.getWylieForChar(s);
|
s = TibetanMachineWeb.getWylieForChar(s);
|
||||||
charList.add(s);
|
charList.add(s);
|
||||||
|
@ -1368,11 +1380,17 @@ public void paste(int offset) {
|
||||||
|
|
||||||
if (TibetanMachineWeb.isVowel(s)) { //the holding string is a vowel
|
if (TibetanMachineWeb.isVowel(s)) { //the holding string is a vowel
|
||||||
s = TibetanMachineWeb.getWylieForVowel(s);
|
s = TibetanMachineWeb.getWylieForVowel(s);
|
||||||
|
if (isTypingVowel) {
|
||||||
|
//note: this takes care of multiple keystroke vowels like 'h>cj'
|
||||||
|
backSpace(getNumberOfGlyphsForLastVowel());
|
||||||
|
}
|
||||||
|
|
||||||
initKeyboard();
|
initKeyboard();
|
||||||
isTypingVowel = true;
|
isTypingVowel = true;
|
||||||
putVowel(s);
|
|
||||||
changedStatus = true;
|
changedStatus = true;
|
||||||
updateStatus("You typed another vowel, so the first vowel was discarded.");
|
if (!putVowel(s)) {
|
||||||
|
updateStatus("You typed another vowel, so the first vowel was discarded.");
|
||||||
|
}
|
||||||
} else if (TibetanMachineWeb.isChar(s)) { //the holding string is a character
|
} else if (TibetanMachineWeb.isChar(s)) { //the holding string is a character
|
||||||
String s2 = TibetanMachineWeb.getWylieForChar(s);
|
String s2 = TibetanMachineWeb.getWylieForChar(s);
|
||||||
|
|
||||||
|
@ -1399,10 +1417,11 @@ public void paste(int offset) {
|
||||||
changedStatus = true;
|
changedStatus = true;
|
||||||
appendStatus(" (because you weren't stacking, and there was a character already)");
|
appendStatus(" (because you weren't stacking, and there was a character already)");
|
||||||
} else if (TibetanMachineWeb.isAChungConsonant() && s2.equals(TibetanMachineWeb.ACHUNG)) {
|
} else if (TibetanMachineWeb.isAChungConsonant() && s2.equals(TibetanMachineWeb.ACHUNG)) {
|
||||||
putVowel(TibetanMachineWeb.A_VOWEL);
|
|
||||||
initKeyboard();
|
|
||||||
changedStatus = true;
|
changedStatus = true;
|
||||||
appendStatus(" (because you were stacking, and we put a vowel, and there was some achung business)");
|
if (!putVowel(TibetanMachineWeb.A_VOWEL)) {
|
||||||
|
appendStatus(" (because you were stacking, and we put a vowel, and there was some achung business)");
|
||||||
|
}
|
||||||
|
initKeyboard();
|
||||||
break key_block;
|
break key_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1440,10 +1459,13 @@ public void paste(int offset) {
|
||||||
if (!isStackingOn) {
|
if (!isStackingOn) {
|
||||||
initKeyboard();
|
initKeyboard();
|
||||||
} else if (TibetanMachineWeb.isAChungConsonant() && s2.equals(TibetanMachineWeb.ACHUNG)) {
|
} else if (TibetanMachineWeb.isAChungConsonant() && s2.equals(TibetanMachineWeb.ACHUNG)) {
|
||||||
putVowel(TibetanMachineWeb.A_VOWEL);
|
|
||||||
initKeyboard();
|
|
||||||
changedStatus = true;
|
changedStatus = true;
|
||||||
appendStatus(" (because we put a vowel)");
|
if (!putVowel(TibetanMachineWeb.A_VOWEL)) {
|
||||||
|
updateStatus("You typed an a-chung vowel.");
|
||||||
|
}
|
||||||
|
setNumberOfGlyphsForLastVowel(1);
|
||||||
|
holdCurrent = new StringBuffer(s);
|
||||||
|
isTypingVowel = true;
|
||||||
break key_block;
|
break key_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ Tibetan Computer Company Keyboard #1
|
||||||
Apparently the same as the Tibkey keyboard except:
|
Apparently the same as the Tibkey keyboard except:
|
||||||
- 'h' is a pre-post stack key, not a medial stack key
|
- 'h' is a pre-post stack key, not a medial stack key
|
||||||
|
|
||||||
|
DLC FIXME: U=cj and I=cg are hacks; clean up the keyboard code and remove them.
|
||||||
|
|
||||||
<?parameters?>
|
<?parameters?>
|
||||||
has sanskrit stacking=true
|
has sanskrit stacking=true
|
||||||
has tibetan stacking=true
|
has tibetan stacking=true
|
||||||
|
@ -87,8 +89,8 @@ i=g
|
||||||
u=j
|
u=j
|
||||||
e=b
|
e=b
|
||||||
o=n
|
o=n
|
||||||
I=
|
I=cg
|
||||||
U=
|
U=cj
|
||||||
ai=B
|
ai=B
|
||||||
au=N
|
au=N
|
||||||
A=
|
A=
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue