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:
dchandler 2003-10-12 18:16:17 +00:00
parent d7fdacfcdc
commit 129ebccd67
2 changed files with 161 additions and 137 deletions

View file

@ -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;
} }

View file

@ -1,115 +1,117 @@
Tibetan Computer Company Keyboard #1 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
<?parameters?> DLC FIXME: U=cj and I=cg are hacks; clean up the keyboard code and remove them.
has sanskrit stacking=true
has tibetan stacking=true <?parameters?>
is stacking medial=false has sanskrit stacking=true
stack key=h has tibetan stacking=true
has disambiguating key=false is stacking medial=false
disambiguating key= stack key=h
needs achen before vowels=true has disambiguating key=false
has 'a' vowel=false disambiguating key=
is achung consonant=true needs achen before vowels=true
has 'a' vowel=false
<?characters?> is achung consonant=true
k=q
kh=w <?characters?>
g=e k=q
ng=r kh=w
c=t g=e
ch=y ng=r
j=u c=t
ny=i ch=y
t=o j=u
th=p ny=i
d=[ t=o
n=] th=p
p=a d=[
ph=s n=]
b=d p=a
m=f ph=s
ts=k b=d
tsh=l m=f
dz=; ts=k
w=' tsh=l
zh=z dz=;
z=x w='
'=c zh=z
y=v z=x
r=m '=c
l=, y=v
sh=. r=m
s=/ l=,
h=> sh=.
a=? s=/
T=Q h=>
Th=W a=?
D=E T=Q
N=R Th=W
Sh=T D=E
0=0 N=R
1=1 Sh=T
2=2 0=0
3=3 1=1
4=4 2=2
5=5 3=3
6=6 4=4
7=7 5=5
8=8 6=6
9=9 7=7
<0= 8=8
<1= 9=9
<2= <0=
<3= <1=
<4= <2=
<5= <3=
<6= <4=
<7= <5=
<8= <6=
<9= <7=
>0= <8=
>1= <9=
>2= >0=
>3= >1=
>4= >2=
>5= >3=
>6= >4=
>7= >5=
>8= >6=
>9= >7=
>8=
<?vowels?> >9=
a=
i=g <?vowels?>
u=j a=
e=b i=g
o=n u=j
I= e=b
U= o=n
ai=B I=cg
au=N U=cj
A= ai=B
-i=G au=N
-I= A=
-i=G
<?punctuation?> -I=
_=
= <?punctuation?>
/=\ _=
|=+ =
!=| /=\
:=% |=+
;= !=|
@=! :=%
#=@ ;=
$= @=!
%= #=@
(=( $=
)=) %=
H=: (=(
M=* )=)
`=` H=:
&=$ M=*
`=`
&=$