*** empty log message ***
authorhanda <handa>
Fri, 12 Mar 2010 09:03:29 +0000 (09:03 +0000)
committerhanda <handa>
Fri, 12 Mar 2010 09:03:29 +0000 (09:03 +0000)
vi-tcvn.mimx
vi-telex.mimx
vi-viqr.mimx
vi-vni.mimx
xex.js

index 69026ff..f3f54c9 100644 (file)
@@ -363,7 +363,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-=</string>
+            <symbol>A-=</symbol>
           </list>
         </keyseq>
         <insert>
@@ -373,7 +373,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-\</string>
+            <symbol>A-\</symbol>
           </list>
         </keyseq>
         <insert>
@@ -383,7 +383,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-[</string>
+            <symbol>A-[</symbol>
           </list>
         </keyseq>
         <insert>
@@ -393,7 +393,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-]</string>
+            <symbol>A-]</symbol>
           </list>
         </keyseq>
         <insert>
@@ -403,7 +403,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-!</string>
+            <symbol>A-!</symbol>
           </list>
         </keyseq>
         <insert>
@@ -413,7 +413,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-@</string>
+            <symbol>A-@</symbol>
           </list>
         </keyseq>
         <insert>
@@ -423,7 +423,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-#</string>
+            <symbol>A-#</symbol>
           </list>
         </keyseq>
         <insert>
@@ -433,7 +433,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-$</string>
+            <symbol>A-$</symbol>
           </list>
         </keyseq>
         <insert>
@@ -443,7 +443,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-%</string>
+            <symbol>A-%</symbol>
           </list>
         </keyseq>
         <insert>
@@ -453,7 +453,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-^</string>
+            <symbol>A-^</symbol>
           </list>
         </keyseq>
         <insert>
@@ -463,7 +463,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-&amp;</string>
+            <symbol>A-&amp;</symbol>
           </list>
         </keyseq>
         <insert>
@@ -473,7 +473,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-*</string>
+            <symbol>A-*</symbol>
           </list>
         </keyseq>
         <insert>
@@ -483,7 +483,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-(</string>
+            <symbol>A-(</symbol>
           </list>
         </keyseq>
         <insert>
@@ -493,7 +493,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-)</string>
+            <symbol>A-)</symbol>
           </list>
         </keyseq>
         <insert>
@@ -513,7 +513,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-+</string>
+            <symbol>A-+</symbol>
           </list>
         </keyseq>
         <insert>
@@ -523,7 +523,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-|</string>
+            <symbol>A-|</symbol>
           </list>
         </keyseq>
         <insert>
@@ -533,7 +533,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-{</string>
+            <symbol>A-{</symbol>
           </list>
         </keyseq>
         <insert>
@@ -543,7 +543,7 @@ If the value is 1, Backspace key undoes the previous key
       <rule>
         <keyseq>
           <list>
-            <string>A-}</string>
+            <symbol>A-}</symbol>
           </list>
         </keyseq>
         <insert>
@@ -689,6 +689,12 @@ If the value is 1, Backspace key undoes the previous key
         <set vname="SELECT">
           <integer>0</integer>
         </set>
+        <set vname="NST">
+          <eq>
+            <surrounding-text-flag/>
+            <integer>-2</integer>
+          </eq>
+        </set>
       </state-hook>
       <branch mname="map-consonant">
         <set vname="C">
@@ -696,6 +702,14 @@ If the value is 1, Backspace key undoes the previous key
             <marker>@-1</marker>
           </char-at>
         </set>
+        <cond>
+          <list>
+            <varref vname="NST"/>
+            <shift>
+              <symbol>state-after-c</symbol>
+            </shift>
+          </list>
+        </cond>
       </branch>
       <branch mname="map-consonant-ext">
         <set vname="C">
@@ -703,6 +717,14 @@ If the value is 1, Backspace key undoes the previous key
             <marker>@-1</marker>
           </char-at>
         </set>
+        <cond>
+          <list>
+            <varref vname="NST"/>
+            <shift>
+              <symbol>state-after-c</symbol>
+            </shift>
+          </list>
+        </cond>
       </branch>
       <branch mname="map-vowel">
         <mark>
@@ -749,6 +771,40 @@ If the value is 1, Backspace key undoes the previous key
       <branch mname="map-misc"/>
       <branch mname="map-smart-quotes"/>
     </state>
+    <state sname="state-after-c">
+      <branch mname="map-vowel">
+        <mark>
+          <marker>M</marker>
+        </mark>
+        <set vname="V-2">
+          <varref vname="V-1"/>
+        </set>
+        <set vname="V-1">
+          <char-at>
+            <marker>@-1</marker>
+          </char-at>
+        </set>
+        <shift>
+          <symbol>state-after-v</symbol>
+        </shift>
+      </branch>
+      <branch mname="map-vowel-ext">
+        <mark>
+          <marker>M</marker>
+        </mark>
+        <set vname="V-2">
+          <varref vname="V-1"/>
+        </set>
+        <set vname="V-1">
+          <char-at>
+            <marker>@-1</marker>
+          </char-at>
+        </set>
+        <shift>
+          <symbol>state-after-v</symbol>
+        </shift>
+      </branch>
+    </state>
     <state sname="state-after-v">
       <branch mname="map-consonant">
         <shift>
index 1953ce1..2074b24 100644 (file)
@@ -897,6 +897,12 @@ If the value is 1, Backspace key undoes the previous key
         <set vname="SELECT">
           <integer>0</integer>
         </set>
+        <set vname="NST">
+          <eq>
+            <surrounding-text-flag/>
+            <integer>-2</integer>
+          </eq>
+        </set>
       </state-hook>
       <branch mname="map-consonant">
         <set vname="C">
@@ -904,6 +910,14 @@ If the value is 1, Backspace key undoes the previous key
             <marker>@-1</marker>
           </char-at>
         </set>
+        <cond>
+          <list>
+            <varref vname="NST"/>
+            <shift>
+              <symbol>state-after-c</symbol>
+            </shift>
+          </list>
+        </cond>
       </branch>
       <branch mname="map-consonant-ext">
         <set vname="C">
@@ -911,6 +925,14 @@ If the value is 1, Backspace key undoes the previous key
             <marker>@-1</marker>
           </char-at>
         </set>
+        <cond>
+          <list>
+            <varref vname="NST"/>
+            <shift>
+              <symbol>state-after-c</symbol>
+            </shift>
+          </list>
+        </cond>
       </branch>
       <branch mname="map-consonant-or-tone-mark">
         <cond>
@@ -964,6 +986,14 @@ If the value is 1, Backspace key undoes the previous key
                 <marker>@-1</marker>
               </char-at>
             </set>
+            <cond>
+              <list>
+                <varref vname="NST"/>
+                <shift>
+                  <symbol>state-after-c</symbol>
+                </shift>
+              </list>
+            </cond>
           </list>
         </cond>
       </branch>
@@ -1011,6 +1041,40 @@ If the value is 1, Backspace key undoes the previous key
       </branch>
       <branch mname="map-smart-quotes"/>
     </state>
+    <state sname="state-after-c">
+      <branch mname="map-vowel">
+        <mark>
+          <marker>M</marker>
+        </mark>
+        <set vname="V-2">
+          <varref vname="V-1"/>
+        </set>
+        <set vname="V-1">
+          <char-at>
+            <marker>@-1</marker>
+          </char-at>
+        </set>
+        <shift>
+          <symbol>state-after-v</symbol>
+        </shift>
+      </branch>
+      <branch mname="map-vowel-ext">
+        <mark>
+          <marker>M</marker>
+        </mark>
+        <set vname="V-2">
+          <varref vname="V-1"/>
+        </set>
+        <set vname="V-1">
+          <char-at>
+            <marker>@-1</marker>
+          </char-at>
+        </set>
+        <shift>
+          <symbol>state-after-v</symbol>
+        </shift>
+      </branch>
+    </state>
     <state sname="state-after-v">
       <branch mname="map-ending-1st-consonant">
         <funcall fname="macro-handle-mark"/>
index e6f5a29..d7d3e83 100644 (file)
@@ -374,6 +374,12 @@ If the value is 1, Backspace key undoes the previous key
         <set vname="SELECT">
           <integer>0</integer>
         </set>
+        <set vname="NST">
+          <eq>
+            <surrounding-text-flag/>
+            <integer>-2</integer>
+          </eq>
+        </set>
       </state-hook>
       <branch mname="map-consonant">
         <set vname="C">
@@ -381,6 +387,14 @@ If the value is 1, Backspace key undoes the previous key
             <marker>@-1</marker>
           </char-at>
         </set>
+        <cond>
+          <list>
+            <varref vname="NST"/>
+            <shift>
+              <symbol>state-after-c</symbol>
+            </shift>
+          </list>
+        </cond>
       </branch>
       <branch mname="map-consonant-ext">
         <set vname="C">
@@ -388,6 +402,14 @@ If the value is 1, Backspace key undoes the previous key
             <marker>@-1</marker>
           </char-at>
         </set>
+        <cond>
+          <list>
+            <varref vname="NST"/>
+            <shift>
+              <symbol>state-after-c</symbol>
+            </shift>
+          </list>
+        </cond>
       </branch>
       <branch mname="map-vowel">
         <mark>
@@ -432,6 +454,40 @@ If the value is 1, Backspace key undoes the previous key
         </shift>
       </branch>
     </state>
+    <state sname="state-after-c">
+      <branch mname="map-vowel">
+        <mark>
+          <marker>M</marker>
+        </mark>
+        <set vname="V-2">
+          <varref vname="V-1"/>
+        </set>
+        <set vname="V-1">
+          <char-at>
+            <marker>@-1</marker>
+          </char-at>
+        </set>
+        <shift>
+          <symbol>state-after-v</symbol>
+        </shift>
+      </branch>
+      <branch mname="map-vowel-ext">
+        <mark>
+          <marker>M</marker>
+        </mark>
+        <set vname="V-2">
+          <varref vname="V-1"/>
+        </set>
+        <set vname="V-1">
+          <char-at>
+            <marker>@-1</marker>
+          </char-at>
+        </set>
+        <shift>
+          <symbol>state-after-v</symbol>
+        </shift>
+      </branch>
+    </state>
     <state sname="state-after-v">
       <branch mname="map-consonant">
         <shift>
index 96a74cf..fe0d857 100644 (file)
@@ -366,6 +366,12 @@ If the value is 1, Backspace key undoes the previous key
         <set vname="SELECT">
           <integer>0</integer>
         </set>
+        <set vname="NST">
+          <eq>
+            <surrounding-text-flag/>
+            <integer>-2</integer>
+          </eq>
+        </set>
       </state-hook>
       <branch mname="map-consonant">
         <set vname="C">
@@ -373,6 +379,14 @@ If the value is 1, Backspace key undoes the previous key
             <marker>@-1</marker>
           </char-at>
         </set>
+        <cond>
+          <list>
+            <varref vname="NST"/>
+            <shift>
+              <symbol>state-after-c</symbol>
+            </shift>
+          </list>
+        </cond>
       </branch>
       <branch mname="map-consonant-ext">
         <set vname="C">
@@ -380,6 +394,14 @@ If the value is 1, Backspace key undoes the previous key
             <marker>@-1</marker>
           </char-at>
         </set>
+        <cond>
+          <list>
+            <varref vname="NST"/>
+            <shift>
+              <symbol>state-after-c</symbol>
+            </shift>
+          </list>
+        </cond>
       </branch>
       <branch mname="map-vowel">
         <mark>
@@ -425,6 +447,40 @@ If the value is 1, Backspace key undoes the previous key
       </branch>
       <branch mname="map-smart-quotes"/>
     </state>
+    <state sname="state-after-c">
+      <branch mname="map-vowel">
+        <mark>
+          <marker>M</marker>
+        </mark>
+        <set vname="V-2">
+          <varref vname="V-1"/>
+        </set>
+        <set vname="V-1">
+          <char-at>
+            <marker>@-1</marker>
+          </char-at>
+        </set>
+        <shift>
+          <symbol>state-after-v</symbol>
+        </shift>
+      </branch>
+      <branch mname="map-vowel-ext">
+        <mark>
+          <marker>M</marker>
+        </mark>
+        <set vname="V-2">
+          <varref vname="V-1"/>
+        </set>
+        <set vname="V-1">
+          <char-at>
+            <marker>@-1</marker>
+          </char-at>
+        </set>
+        <shift>
+          <symbol>state-after-v</symbol>
+        </shift>
+      </branch>
+    </state>
     <state sname="state-after-v">
       <branch mname="map-consonant">
         <shift>
diff --git a/xex.js b/xex.js
index 556170e..b342683 100644 (file)
--- a/xex.js
+++ b/xex.js
@@ -3116,8 +3116,6 @@ MIM.set_caret = function (target, ic)
     }
 };
 
-MIM.ignore_focus = false;
-
 MIM.update = function (target, ic)
 {
   var text = target.value;
@@ -3130,6 +3128,69 @@ MIM.update = function (target, ic)
   MIM.set_caret (target, ic);
 };
 
+(function () {
+  function capitalize(prop){
+    return prop.replace(/-(.)/g, function(m, m1){ return m1.toUpperCase() })
+  }
+
+  function imitateElement(elmOriginal, elmClone){
+    var styleOriginal = getComputedStyle(elmOriginal,'');
+    var styleClone = getComputedStyle(elmClone,'');
+       
+    elmClone.style.left = elmOriginal.offsetLeft + 'px'; 
+    elmClone.style.top = elmOriginal.offsetTop + 'px';
+               
+    var copyProps = [
+      'width', 'height',
+      'padding-left', 'padding-right', 'padding-top', 'padding-bottom', 
+      'border-left-style', 'border-right-style','border-top-style','border-bottom-style', 
+      'border-left-width', 'border-right-width','border-top-width','border-bottom-width', 
+      'font-family', 'font-size', 'line-height', 'letter-spacing', 'word-spacing'];
+    for(var i in copyProps){
+      elmClone.style[capitalize(copyProps[i])] = 
+       styleOriginal.getPropertyValue(copyProps[i]);
+    }
+       
+    elmClone.style.width = elmOriginal.offsetWidth;
+    elmClone.style.height = elmOriginal.offsetHeight;
+    elmClone.style.visibility="hidden"; // ÄɲÃ
+    elmClone.style.position = "absolute"; //ÄɲÃ
+    //elmClone.style =elmOriginal.style;
+                
+    elmClone.scrollLeft = elmOriginal.scrollLeft;
+    elmClone.scrollTop = elmOriginal.scrollTop;
+  }
+
+  var elm;
+
+  MIM.caret_pos = function (target)
+  {
+    if (! elm)
+      {
+         elm = document.createElement ('div');
+       document.getElementsByTagName ('body')[0].appendChild (elm);
+      }
+
+    imitateElement(target, elm);
+    var selectionEnd = target.selectionEnd;
+    var value = target.value;
+
+    var elmCursor = document.createElement('span');
+    elmCursor.innerHTML = '|';
+
+    //elm = document.createElement ('pre');
+    elm.innerHTML = '';
+    var elmChild = document.createTextNode(value.substr(0,selectionEnd));
+    elm.appendChild(elmChild);
+    elm.appendChild(elmCursor);
+
+    var x = target.offsetLeft + elmCursor.offsetLeft +2;
+    var y = target.offsetTop + elmCursor.offsetTop -2;
+
+    Xex.Log ("x:" + x + "px y:" + y + "px w:" + elm.offsetWidth);
+  }
+}) ();
+
 MIM.focus_in = function (event)
 {
   var target = event.target;
@@ -3170,7 +3231,8 @@ MIM.keydown = function (event)
     return;
   if (! (target.type == "text" || target.type == "textarea"))
     return;
-  document.akey = event;
+
+  MIM.caret_pos (target);
 
   var ic = target.mim_ic;
   if (! ic || ic.im != MIM.current)
@@ -3246,6 +3308,7 @@ MIM.keypress = function (event)
   } finally {
     MIM.debug_print (event, ic);
   }
+
   return;
 };
 
@@ -3267,7 +3330,6 @@ MIM.keypress = function (event)
       sk: { name: 'Slovak' },
       sr: { name: 'Serbian' },
       sv: { name: 'Swedish' },
-      vi: { name: 'Vietnamese' },
       yi: { name: 'Yiddish' } },
     MiddleEast: {
       ar: { name: 'Arabic' },
@@ -3487,7 +3549,6 @@ MIM.keypress = function (event)
            li.appendChild (sub);
            menu.appendChild (li);
          }
-       document.mimmenu = menu;
        lang_category = null;
       }
     menu.style.left = (event.clientX - 10) + "px";