From bbb9728788b647178dac32f4387460a3e0040c94 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 12 Mar 2010 09:03:29 +0000 Subject: [PATCH] *** empty log message *** --- vi-tcvn.mimx | 92 ++++++++++++++++++++++++++++++++++++++++++++++----------- vi-telex.mimx | 64 +++++++++++++++++++++++++++++++++++++++ vi-viqr.mimx | 56 +++++++++++++++++++++++++++++++++++ vi-vni.mimx | 56 +++++++++++++++++++++++++++++++++++ xex.js | 71 ++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 316 insertions(+), 23 deletions(-) diff --git a/vi-tcvn.mimx b/vi-tcvn.mimx index 69026ff..f3f54c9 100644 --- a/vi-tcvn.mimx +++ b/vi-tcvn.mimx @@ -363,7 +363,7 @@ If the value is 1, Backspace key undoes the previous key - A-= + A-= @@ -373,7 +373,7 @@ If the value is 1, Backspace key undoes the previous key - A-\ + A-\ @@ -383,7 +383,7 @@ If the value is 1, Backspace key undoes the previous key - A-[ + A-[ @@ -393,7 +393,7 @@ If the value is 1, Backspace key undoes the previous key - A-] + A-] @@ -403,7 +403,7 @@ If the value is 1, Backspace key undoes the previous key - A-! + A-! @@ -413,7 +413,7 @@ If the value is 1, Backspace key undoes the previous key - A-@ + A-@ @@ -423,7 +423,7 @@ If the value is 1, Backspace key undoes the previous key - A-# + A-# @@ -433,7 +433,7 @@ If the value is 1, Backspace key undoes the previous key - A-$ + A-$ @@ -443,7 +443,7 @@ If the value is 1, Backspace key undoes the previous key - A-% + A-% @@ -453,7 +453,7 @@ If the value is 1, Backspace key undoes the previous key - A-^ + A-^ @@ -463,7 +463,7 @@ If the value is 1, Backspace key undoes the previous key - A-& + A-& @@ -473,7 +473,7 @@ If the value is 1, Backspace key undoes the previous key - A-* + A-* @@ -483,7 +483,7 @@ If the value is 1, Backspace key undoes the previous key - A-( + A-( @@ -493,7 +493,7 @@ If the value is 1, Backspace key undoes the previous key - A-) + A-) @@ -513,7 +513,7 @@ If the value is 1, Backspace key undoes the previous key - A-+ + A-+ @@ -523,7 +523,7 @@ If the value is 1, Backspace key undoes the previous key - A-| + A-| @@ -533,7 +533,7 @@ If the value is 1, Backspace key undoes the previous key - A-{ + A-{ @@ -543,7 +543,7 @@ If the value is 1, Backspace key undoes the previous key - A-} + A-} @@ -689,6 +689,12 @@ If the value is 1, Backspace key undoes the previous key 0 + + + + -2 + + @@ -696,6 +702,14 @@ If the value is 1, Backspace key undoes the previous key @-1 + + + + + state-after-c + + + @@ -703,6 +717,14 @@ If the value is 1, Backspace key undoes the previous key @-1 + + + + + state-after-c + + + @@ -749,6 +771,40 @@ If the value is 1, Backspace key undoes the previous key + + + + M + + + + + + + @-1 + + + + state-after-v + + + + + M + + + + + + + @-1 + + + + state-after-v + + + diff --git a/vi-telex.mimx b/vi-telex.mimx index 1953ce1..2074b24 100644 --- a/vi-telex.mimx +++ b/vi-telex.mimx @@ -897,6 +897,12 @@ If the value is 1, Backspace key undoes the previous key 0 + + + + -2 + + @@ -904,6 +910,14 @@ If the value is 1, Backspace key undoes the previous key @-1 + + + + + state-after-c + + + @@ -911,6 +925,14 @@ If the value is 1, Backspace key undoes the previous key @-1 + + + + + state-after-c + + + @@ -964,6 +986,14 @@ If the value is 1, Backspace key undoes the previous key @-1 + + + + + state-after-c + + + @@ -1011,6 +1041,40 @@ If the value is 1, Backspace key undoes the previous key + + + + M + + + + + + + @-1 + + + + state-after-v + + + + + M + + + + + + + @-1 + + + + state-after-v + + + diff --git a/vi-viqr.mimx b/vi-viqr.mimx index e6f5a29..d7d3e83 100644 --- a/vi-viqr.mimx +++ b/vi-viqr.mimx @@ -374,6 +374,12 @@ If the value is 1, Backspace key undoes the previous key 0 + + + + -2 + + @@ -381,6 +387,14 @@ If the value is 1, Backspace key undoes the previous key @-1 + + + + + state-after-c + + + @@ -388,6 +402,14 @@ If the value is 1, Backspace key undoes the previous key @-1 + + + + + state-after-c + + + @@ -432,6 +454,40 @@ If the value is 1, Backspace key undoes the previous key + + + + M + + + + + + + @-1 + + + + state-after-v + + + + + M + + + + + + + @-1 + + + + state-after-v + + + diff --git a/vi-vni.mimx b/vi-vni.mimx index 96a74cf..fe0d857 100644 --- a/vi-vni.mimx +++ b/vi-vni.mimx @@ -366,6 +366,12 @@ If the value is 1, Backspace key undoes the previous key 0 + + + + -2 + + @@ -373,6 +379,14 @@ If the value is 1, Backspace key undoes the previous key @-1 + + + + + state-after-c + + + @@ -380,6 +394,14 @@ If the value is 1, Backspace key undoes the previous key @-1 + + + + + state-after-c + + + @@ -425,6 +447,40 @@ If the value is 1, Backspace key undoes the previous key + + + + M + + + + + + + @-1 + + + + state-after-v + + + + + M + + + + + + + @-1 + + + + state-after-v + + + diff --git a/xex.js b/xex.js index 556170e..b342683 100644 --- 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"; -- 1.7.10.4