var console_log=function(text){
return;
var flag=true;
if(flag)
console.log(text);return;
if(text.indexOf(">> ")!=0){
console.log(text);
return;}
};
var nv_kbd_lang="kbd_lang";
var nv_kbd_forecast_state="kbd_forecast_state";
var nv_kbd_usb_input_form="kbd_usb_input_form";
var nv_prd_id="home";
var kbd_path=COMMON_PATH+"keyboard/";
var kbd_img_path=kbd_path+"img/";
var kbd_skin_path=kbd_path+"pkg_keyboard_skin.js";











add_package_load_path("pkg_usb_keyboard",kbd_path+"pkg_usb_keyboard.js");
if(ebus&&ebus.kbd&&ebus.kbd.supported){
prepare_package("pkg_usb_keyboard");}
if(ebus&&ebus.kbd&&ebus.kbd.supported){
require("pkg_usb_keyboard");}
if(typeof ebus=="undefined")
ebus={};if(typeof ebus.kbd=="undefined")
ebus.kbd={supported:false};
if(typeof ebus.smartphone=="undefined")
ebus.smartphone={supported:false};
if(typeof ebus.mwnn=="undefined")
ebus.mwnn={supported:false};
if(typeof TXK_SCROLL_UP=="undefined")
TXK_SCROLL_UP=null;
if(typeof TXK_SCROLL_DOWN=="undefined")
TXK_SCROLL_DOWN=null;
var ajaxce_ureg_init=function(){
const MAXLEN=1024;
var isString=function(obj){
if(obj==null)
return false;
return (typeof(obj)=="string"||obj instanceof String);};
var ureg=new Object();
ureg.root=new Object();
ureg.RegisterApp=function(AppName){
ureg.root[AppName]=new String("nodata");};
ureg.read=function(AppName){
try{
return ureg.root[AppName];}catch(e){
return false;}
};
ureg.copy=function(AppName){
try{
var ret=new String(ureg.root[AppName]);
return ret;}catch(e){
return false;}
};
ureg.write=function(AppName,string){
if(isString(string)==false){
return false;}
if(string.length>MAXLEN)
return false;
for(var p in ureg.root){
if(p==AppName){
return ureg.root[AppName]=new String(string);}
}
return false;};
return ureg;};
var ureg=ajaxce_ureg_init();

var loadSystemLanguage=function(){
ureg.RegisterApp("language");
if(!system.locale){
ureg.write("language",system.language.substr(0,5));}else{
if(system.locale.language==null||
system.locale.language==""){
ureg.write("language","en-US");
}else if(system.locale.language=="en-AU"){
ureg.write("language","en-IE");}else{
ureg.write("language",system.locale.language.substr(0,5));}
}
return ureg.read("language");}();

var loadSystemMarket=function(){
ureg.RegisterApp("market");
if(!system.locale){
ureg.write("market","US");}else if(system.locale.country.indexOf("US")==0||
system.locale.country.indexOf("CA")==0||
system.locale.country.indexOf("MX")==0){
ureg.write("market","US");}else if(system.locale.country.indexOf("TW")==0){
ureg.write("market","US");}else if(system.locale.country.indexOf("JP")==0){
ureg.write("market","JP");}else if(system.locale.country==null||
system.locale.country==""){
ureg.write("market","EU");}else{
ureg.write("market","EU");}
return ureg.read("market");}();
var is_us_market=(ureg.read("market")=="US");
COLOR_KEY=null;
var map_color_key=function(){
const RED=[192,0,0,255];const GREEN=[0,128,32,255];const BLUE=[0,0,192,255];const YELLOW=[192,192,0,255];
var COLOR_KEY_TYPE={
"R_G_Y_B":[
{"COLOR":RED,"KEY_CODE":TXK_RED},
{"COLOR":GREEN,"KEY_CODE":TXK_GREEN},
{"COLOR":YELLOW,"KEY_CODE":TXK_YELLOW},
{"COLOR":BLUE,"KEY_CODE":TXK_BLUE}
],
"B_R_G_Y":[
{"COLOR":BLUE,"KEY_CODE":TXK_BLUE},
{"COLOR":RED,"KEY_CODE":TXK_RED},
{"COLOR":GREEN,"KEY_CODE":TXK_GREEN},
{"COLOR":YELLOW,"KEY_CODE":TXK_YELLOW}
]
};
if(system.mdl_cfg){
switch(system.mdl_cfg.color_key_order){
case system.mdl_cfg.COLOR_KEY_R_G_Y_B:
COLOR_KEY=COLOR_KEY_TYPE["R_G_Y_B"];
break;
case system.mdl_cfg.COLOR_KEY_B_R_G_Y:
COLOR_KEY=COLOR_KEY_TYPE["B_R_G_Y"];
break;
default:
COLOR_KEY=COLOR_KEY_TYPE["R_G_Y_B"];
break;}
}else {
COLOR_KEY=COLOR_KEY_TYPE["R_G_Y_B"];}
}();
var common_key={};
common_key.set_cursor=function(o_obj,cobj){
this.old=o_obj.cursor;
if(this.old==cobj){
return;}
if(this.old){
if(this.old.leave_focus){
this.old.leave_focus(this.old);}
if(this.old){
this.old.in_cursor=false;
this.old.toggle_cursor=false;}
}
if(cobj){
if(cobj.enter_focus){
cobj.enter_focus(cobj);}
cobj.in_cursor=true;}
o_obj.cursor=cobj;
this.obj=cobj;};
var TIMER_RESOLUTION=40;
var create=function(param){
param=param||{};
var type=param.type;
var cont=new container({});
var keyboard_cont=new container({});
var mobile_input_obj=new container({});
var keyboard_change_obj=null;
var done_obj=null;
var cancel_obj=null;
var language=null;
var mode=null;
var guide_translate=null;
var hook_func=null;
var usb_kbd=null;
var lang_mode=true;
var callback=null;
var tab_callback=null;
var shift_tab_callback=null;
cont.keyboard_cont=keyboard_cont;
cont.mobile_input_obj=mobile_input_obj;
cont.components.push(keyboard_cont);
cont.components.push(mobile_input_obj);
cont.sphone_input_mode=null;
cont.sphone_kbd_type=null;
cont.sphone_cb=null;
cont.change_keyboard_callback=null;
cont.show_asr_menu_callback=null;
cont.trg_textarea=null;
cont.done_callback=null;
cont.cancel_callback=null;
Animation.free();
var create_keyboard_cont=function(){
if(keyboard_cont.keyboard)return;
var obj=keyboard_cont;
obj.keyboard=new SFT_Keyboard();
obj.components=[obj.keyboard];
obj.translate=[0,0,0];
obj.keyboard.set_keyboard(0);
obj.enter_focus=function (){
common_key.set_cursor(obj,obj.keyboard);
send_enter_event_to_sphone(cont.sphone_input_mode,cont.sphone_kbd_type);};
obj.leave_focus=function (){
common_key.set_cursor(obj,null);
send_leave_event_to_sphone();};
obj.key_hook=function(up_down,key){
return this.cursor.keyhook(up_down,key);};
obj.mouse_hook=function(arg){
if(this.cursor)
return this.cursor.mouse_hook(arg);};};
var create_mobile_input_obj=function(){
if(mobile_input_obj.mobile_input)return;
var obj=mobile_input_obj;
obj.mobile_input=new MobileInput({});
obj.components=[obj.mobile_input];
obj.enter_focus=function (obj){
common_key.set_cursor(obj,obj.mobile_input);
send_enter_event_to_sphone(cont.sphone_input_mode,cont.sphone_kbd_type);};
obj.leave_focus=function (obj){
common_key.set_cursor(obj,null);
send_leave_event_to_sphone();};
obj.enable=function (obj){
obj.visible_p=true;};
obj.disable=function (obj){
obj.visible_p=false;};
obj.key_hook=function(up_down,key){
return this.cursor.keyhook(up_down,key);};};
var get_current_obj=function(){
if(mobile_input_obj.mobile_input&&mobile_input_obj.visible_p)
return mobile_input_obj.mobile_input;
return keyboard_cont.keyboard;};
cont.set_mobile_input_func=function(func){
mobile_input_obj.mobile_input.setHook(func);};
cont.set_keyboard_func=function(func){
keyboard_cont.setHook(func);};
cont.set_hook_func=function(func){
hook_func=func;
get_current_obj().setHook(func);};
cont.getText=function(){
var obj=get_current_obj();
return obj.getText();};
cont.setText=function(str){
var obj=get_current_obj();
return obj.setText(str);};
cont.hide_keyboard_change_obj=function(){
};
cont.set_lang=function(lang){
language=get_software_kbd_support_lang(lang);
var obj=get_current_obj();
obj.set_lang(lang);
set_keyboard_lang(lang);};
cont.set_mode=function(m){
mode=m;
var obj=get_current_obj();
obj.setMode(m);};
cont.set_lang_mode=function(m){
if(m!=null){
if(m==false){
lang_mode=false;
}
else{
lang_mode=true;
}
}
else{
lang_mode=true;
}
};
cont.set_guide_translate=function(translate){
guide_translate=[0,0,0];
guide_translate[0]=translate[0];
guide_translate[1]=translate[1];
guide_translate[2]=translate[2];
var obj=get_current_obj();
obj.set_guide_translate(translate);};
cont.set_translate=function(translate){
this.translate[0]=translate[0];
this.translate[1]=translate[1];
this.translate[2]=translate[2];};
cont.set_change_keyboard_callback=function(callback){
if(callback!=null&&typeof callback=="function")
cont.change_keyboard_callback=callback;
var obj=get_current_obj();
obj.set_change_keyboard_callback(callback);};
cont.set_show_asr_menu_callback=function(callback){
if(callback!=null&&typeof callback=="function")
cont.show_asr_menu_callback=callback;
var obj=get_current_obj();
obj.set_show_asr_menu_callback(callback);};
cont.set_trg_textarea=function(textarea){
if(textarea!=null){
cont.trg_textarea=callback;
var obj=get_current_obj();
obj.set_trg_textarea(textarea);}
};
cont.set_done_callback=function(callback,timing){
if(callback!=null&&typeof callback=="function")
cont.done_callback=callback;
var obj=get_current_obj();
obj.set_done_callback(callback,timing);};
cont.set_cancel_callback=function(callback){
if(callback!=null&&typeof callback=="function")
cont.cancel_callback=callback;
var obj=get_current_obj();
obj.set_cancel_callback(callback);};
cont.reset_cursor=function(){
cont.last_cursor=null;};
cont.reset_lang=function(){
if(get_keyboard_lang())
cont.set_lang(get_keyboard_lang());
else
cont.set_lang(ureg.read("language").toString());};
cont.reset_type=function(){
var last_kb_type=get_keyboard_type();
if(last_kb_type==null||last_kb_type=="mobileinput"){
create_mobile_input_obj();
keyboard_cont.visible_p=false;
mobile_input_obj.visible_p=true;
cont.set_guide_translate(guide_translate);}else {
create_keyboard_cont();
mobile_input_obj.visible_p=false;
keyboard_cont.visible_p=true;
cont.set_guide_translate(guide_translate);}
if(cont.change_keyboard_callback!=null&&
typeof cont.change_keyboard_callback=="function"){
cont.change_keyboard_callback();}
};
cont.mouse_hook=function(arg){
var obj=(function(){
if(mobile_input_obj.mobile_input&&mobile_input_obj.visible_p)
return mobile_input_obj;
return keyboard_cont;})();
return obj.mouse_hook(arg);};
cont.set_enter_key_control=function(){
this.latest_numeral=system.key_control.numeral;
this.latest_color=system.key_control.color;
system.key_control.numeral=true;
system.key_control.color=true;};
cont.set_leave_key_control=function(){
system.key_control.numeral=this.latest_numeral;
system.key_control.color=this.latest_color;};
cont.keyhook=function(up_down,key){
return cont.key_hook(up_down,key);};
cont.key_hook=function(up_down,key){
if(!(this.cursor)){return false;}
if(typeof this.cursor.key_hook=="function"
&&this.cursor.key_hook(up_down,key))
return true;
return false;};
cont.usb_key_hook=function (stage,device,event){
var obj=get_current_obj();
return obj.usb_key_hook(arguments);};
cont.asr_hook=function (arg){
var obj=get_current_obj();
if(arguments.length>1)arg=arguments;
return obj.asr_hook(arg);};
cont.free=function(){
if(keyboard_cont.keyboard)
keyboard_cont.keyboard.free();
if(mobile_input_obj.mobile_input)
mobile_input_obj.mobile_input.MobileInput.free();
};
cont.revive=function(){
if(keyboard_cont.keyboard)
keyboard_cont.keyboard.revive();
if(mobile_input_obj.mobile_input)
mobile_input_obj.mobile_input.MobileInput.revive();
this.reset_lang();};

cont.enter_focus=function(){
if(cont.last_cursor){
common_key.set_cursor(cont,cont.last_cursor);
cont.last_cursor=null;
return;}
var obj=(function(){
if(mobile_input_obj.mobile_input&&mobile_input_obj.visible_p)
return mobile_input_obj;
return keyboard_cont;})();
this.set_enter_key_control();
common_key.set_cursor(cont,obj);};
cont.leave_focus=function(){
common_key.set_cursor(cont,null);
this.set_leave_key_control();};
cont.get_softwarekbd_obj=function (){
return keyboard_cont;};

cont.get_mobileinput_obj=function (){
return mobile_input_obj;};
cont.undisplay_language_switch=function (){
};
cont.set_sphone_state=function (state){
cont.sphone_input_mode=state.input_mode;
cont.sphone_kbd_type=state.kbd_type;
cont.sphone_cb=state.cb;
var obj=get_current_obj();
callback=stage.cb;
obj.setCallBack(state.cb);};
cont.set_tab_cb=function(cb){
tab_callback=cb;
var obj=get_current_obj();
obj.setTabCallBack(cb);};
cont.set_shift_tab_cb=function(cb){
shift_tab_callback=cb;
var obj=get_current_obj();
obj.setShiftTabCallBack(cb);};

var soft_cont=new container({});
cont.get_softwarekbd_container=function (){
return soft_cont;};
cont.set_softwarekbd_translate=function (translate){
keyboard_cont.translate[0]=translate[0];
keyboard_cont.translate[1]=translate[1];
keyboard_cont.translate[2]=translate[2];
return;};
cont.disable_move_kbd=function (){
return;};
cont.enable_move_kbd=function (){
return;};
cont.change_input_char_set=function (arg){
var obj=get_current_obj();
return obj.change_input_char_set(arg);};

cont.disable_change_input_method=function(){
console_log(">> disable_change_input_method()");
};
cont.enable_change_input_method=function(){
};
cont.is_enable_change_input_method=function(){
return true;};
cont.set_sphone_send_after_done=function (bool){
var obj=get_current_obj();
return obj.set_sphone_send_after_done(bool);};
cont.set_move_mode=function(mode){
var obj=get_current_obj();
return obj.set_move_mode(mode);};
cont.get_move_mode=function(){
var obj=get_current_obj();
return obj.get_move_mode();};
cont.force_pointer_visible=function(bool){
var obj=get_current_obj();
return obj.force_pointer_visible();};
cont.get_height=function(){
var obj=get_current_obj();
return obj.get_height();};
cont.get_kbd_width=function(){
var obj=get_current_obj();
return obj.get_kbd_width();};
cont.set_height_change_callback=function(func){
var obj=get_current_obj();
obj.set_height_change_callback(func);};
cont.set_starting_point=function(tran){
var obj=get_current_obj();
obj.set_starting_point(tran);};
cont.set_bg_alpha=function(alpha){
var obj=get_current_obj();
if(obj.set_bg_alpha&&typeof obj.set_bg_alpha=="function")
obj.set_bg_alpha(alpha);};
if(!type)
type=(get_keyboard_type())?get_keyboard_type():"mobileinput";
type="software";
switch(type){
case "software":
create_keyboard_cont();
break;
case "mobileinput":
create_mobile_input_obj();
break;}
MasterObj=cont;
return cont;}
var MasterObj=null;
var set_keyboard_type=function(keyboard){
return true;};
var get_keyboard_type=function(){
return "software";};
var set_keyboard_lang=function(lang){
if(!lang||typeof lang!="string")
return false;
var ret=_apps_nvram_write(nv_kbd_lang,lang);
return ret;};
var get_keyboard_lang=function(){
var ret=_apps_nvram_read(nv_kbd_lang);
return ret;};
var get_default_language=function (){
var lang=ureg.read("language");
if(lang)lang=lang.toString();
var nv_lang=get_keyboard_lang();
if(nv_lang)
lang=nv_lang;
var ret=get_software_kbd_support_lang(lang);
return ret;};
var set_skin_info=function(info){
skin_func.set_skin_info(info);};
var set_kbd_img_path=function(path){
skin_func.custom_kbd_img_path=path;};
var set_kbd_skin_path=function(path){
skin_func.custom_kbd_skin_path=path;};
var _apps_nvram_write=function(fname,data){
try{
apps_nvram_file.write({
product_id:nv_prd_id,filename:fname,data:data,
async:false,finished:function(){}
});}catch(e){
return false;}
return true;};
var _apps_nvram_read=function(fname){
var ret=null;
try{
ret=apps_nvram_file.read({
product_id:nv_prd_id,filename:fname,
async:false,finished:function(){}
});
ret=sysutil.tconv.binary_to_string(ret);}catch(e){
return null;}
return ret;};

var control_key_item={
"en-US":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Space",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Done",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"es-US":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Espacio",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Hecho",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"es-ES":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Espacio",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Hecho",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"fr-CA":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Espace",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Effectué",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"fr-FR":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Espace",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Effectué",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"ja-JP":[
{func:"char_switch",w_type:"NORMAL",text:"文字種切り替え",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NORMAL",img_type:"ARROW_UP"},
{func:"down",w_type:"NORMAL",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NORMAL",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NORMAL",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"WIDE",text:"スペース",bar_color:COLOR_KEY[1].COLOR,
sub_func:"henkan",sub_text:"変換"},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"WIDE",text:"終了",bar_color:COLOR_KEY[3].COLOR,
sub_func:"kakutei",sub_text:"確定"},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"hu-HU":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Szóköz",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Kész",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"hr-HR":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Razmak",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Učinjeno",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"cs-CZ":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Mezerník",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Hotovo",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"ru-RU":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Пробел",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Готово",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"bg-BG":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Интерв.",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Готово",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"mk-MK":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Интерв.",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Готово",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"ro-RO":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Spaţiu",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Efectuat",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"sk-SK":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Medzera",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Hotovo",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"sl-SI":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Presled.",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Končano",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"pl-PL":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Spacja",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Gotowe",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"sr-YU":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Razmak",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Gotovo",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"de-DE":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Leerzeichen",bar_color:COLOR_KEY[1].COLOR,font_size:18},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Fertig",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"nl-NL":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Spatie",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Voltooid",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"no-NO":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Space",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Ferdig",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"fi-FI":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Väli",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Valmis",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"da-DK":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Mellemr.",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Afslut",bar_color:COLOR_KEY[3].COLOR,font_size:24},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"tr-TR":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Boşluk",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Bitti",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"it-IT":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Spazio",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Fatto",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"sv-SE":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Space",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Klar",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"pt-PT":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Espaço",bar_color:COLOR_KEY[1].COLOR,font_size:22},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Concluído",bar_color:COLOR_KEY[3].COLOR,font_size:22},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"el-GR":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Διάστ.",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Τέλος",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"et-EE":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Tühik",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Tehtud",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"lv-LV":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Atstarpe",bar_color:COLOR_KEY[1].COLOR,font_size:22},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Gatavs",bar_color:COLOR_KEY[3].COLOR,font_size:22},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"lt-LT":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"Tarpas",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"Atlikta",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"hi-00":[
{func:"char_switch",w_type:"NORMAL",text:"cba",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NORMAL",img_type:"ARROW_UP"},
{func:"down",w_type:"NORMAL",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NORMAL",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NORMAL",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"WIDE",text:"जगह",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"WIDE",text:"चयन",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"th-00":[
{func:"char_switch",w_type:"NORMAL",text:"cba",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NORMAL",img_type:"ARROW_UP"},
{func:"down",w_type:"NORMAL",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NORMAL",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NORMAL",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"WIDE",text:"วรรค",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"WIDE",text:"เลือก",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"ar-00":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NORMAL",img_type:"ARROW_UP"},
{func:"down",w_type:"NORMAL",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NORMAL",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NORMAL",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"WIDE",text:"مساحة",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"WIDE",text:"أدخل",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"he-IL":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"רווח",bar_color:COLOR_KEY[1].COLOR},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"אישור",bar_color:COLOR_KEY[3].COLOR},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"vi-00":[
{func:"char_switch",w_type:"NORMAL",text:"abc",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"trống",bar_color:COLOR_KEY[1].COLOR,font_size:24},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"thực hiện",bar_color:COLOR_KEY[3].COLOR,font_size:24,
sub_func:"kakutei",sub_text:"Nhập"},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"zh-TW":[
{func:"char_switch",w_type:"NORMAL",text:"文字切替",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NORMAL",img_type:"ARROW_UP"},
{func:"down",w_type:"NORMAL",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NORMAL",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NORMAL",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"WIDE",text:"無聲/空白",bar_color:COLOR_KEY[1].COLOR,
sub_func:"henkan",sub_text:"無聲"},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"WIDE",text:"完成",bar_color:COLOR_KEY[3].COLOR,
sub_func:"kakutei",sub_text:"確定"},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"zh-CN":[
{func:"char_switch",w_type:"NORMAL",text:"文字種切り替え",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"空白",bar_color:COLOR_KEY[1].COLOR,
sub_func:"henkan",sub_text:""},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"完成",bar_color:COLOR_KEY[3].COLOR,
sub_func:"kakutei",sub_text:"確定"},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
"zh-HK":[
{func:"char_switch",w_type:"NORMAL",text:"文字種切り替え",bar_color:COLOR_KEY[0].COLOR},
{func:"setting",w_type:"NORMAL",img_type:"SETTING"},
{func:"up",w_type:"NARROW",img_type:"ARROW_UP"},
{func:"down",w_type:"NARROW",img_type:"ARROW_DOWN"},
{func:"left",w_type:"NARROW",img_type:"ARROW_LEFT"},
{func:"right",w_type:"NARROW",img_type:"ARROW_RIGHT"},
{func:"spc",w_type:"NORMAL",text:"空白",bar_color:COLOR_KEY[1].COLOR,
sub_func:"henkan",sub_text:""},
{func:"allclear",w_type:"NORMAL",img_type:"ALLCLEAR"},
{func:"backspace",w_type:"NORMAL",img_type:"BACKSPACE",bar_color:COLOR_KEY[2].COLOR},
{func:"done",w_type:"NORMAL",text:"完成",bar_color:COLOR_KEY[3].COLOR,
sub_func:"kakutei",sub_text:"確定"},
{func:"lf",w_type:"NORMAL",img_type:"LF"}
],
};
control_key_item.get_setting=function (lang){
if(control_key_item[lang])
return control_key_item[lang];
return control_key_item["en-US"];};
var mark="1234567890-_?;:,.!#$%&@*+=~|(){}[]<>^\"'`";
var key_item_offset={
"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"0":0,
"-":2,"_":4,"?":0,";":2,":":2,",":2,".":2,"!":0,"#":0,"$":0,
"%":0,"&":0,"@":0,"*":0,"+":0,"=":0,"~":0,"|":3,"(":4,")":4,
"{":4,"}":4,"[":4,"]":4,"<":0,">":0,"^":0,"\"":0,"'":0,"`":0,
"/":3,
"a":0,"b":0,"c":0,"d":0,"e":0,"f":0,"g":2,"h":0,"i":0,"j":2,
"k":0,"l":0,"m":0,"n":0,"o":0,"p":2,"q":2,"r":0,"s":0,"t":0,
"u":0,"v":0,"w":0,"x":0,"y":3,"z":0,
"α":0,"β":0,"γ":5,"δ":0,"ε":0,"ζ":0,"η":5,"θ":0,"ι":0,"κ":0,"λ":0,"μ":0,
"ν":0,"ξ":0,"ο":0,"π":0,"ρ":0,"σ":0,"τ":0,"υ":0,"φ":5,"χ":5,"ψ":5,"ω":0
};
var key_item={
"ja-JP":[
{"func":"かな","key":"ーゃぁわらやまはなたさかあ「ゅぃをりゆみひにちしきい」ょぅんるよむふぬつすくう!っぇ、れ゛めへねてせけえ?ゎぉ。ろ°もほのとそこお",
"offset_y":key_item_offset,"alphabet_mode":false,
"dakuten":{"か":"が","き":"ぎ","く":"ぐ","け":"げ","こ":"ご",
"さ":"ざ","し":"じ","す":"ず","せ":"ぜ","そ":"ぞ",
"た":"だ","ち":"ぢ","つ":"づ","て":"で","と":"ど",
"は":"ば","ひ":"び","ふ":"ぶ","へ":"べ","ほ":"ぼ"},
"handakuten":{"は":"ぱ","ひ":"ぴ","ふ":"ぷ","へ":"ぺ","ほ":"ぽ"}
},
{"func":"カナ","key":"ーャァワラヤマハナタサカア「ュィヲリユミヒニチシキイ」ョゥンルヨムフヌツスクウ!ッェ、レ゛メヘネテセケエ?ヮォ。ロ°モホノトソコオ",
"offset_y":key_item_offset,"alphabet_mode":false,
"dakuten":{"ウ":"ヴ",
"カ":"ガ","キ":"ギ","ク":"グ","ケ":"ゲ","コ":"ゴ",
"サ":"ザ","シ":"ジ","ス":"ズ","セ":"ゼ","ソ":"ゾ",
"タ":"ダ","チ":"ヂ","ツ":"ヅ","テ":"デ","ト":"ド",
"ハ":"バ","ヒ":"ビ","フ":"ブ","ヘ":"ベ","ホ":"ボ"},
"handakuten":{"ハ":"パ","ヒ":"ピ","フ":"プ","ヘ":"ペ","ホ":"ポ"}
},
{"func":"abc","key":"ABCDE123abcdeFGHIJ456fghijKLMNO789klmnoPQRST:0.pqrstUVWXYZ/uvwxyz",
"offset_y":key_item_offset,"alphabet_mode":true},
{"func":"#!$","key":"-_?;:,.!#$123%&@*+=~|()456{}[]<>^\"'`789          #0*             ",
"offset_y":key_item_offset,"alphabet_mode":true}
],
"en-US":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"es-US":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"n":["ñ"],"a":["á"],"e":["é"],"i":["í"],
"o":["ó"],"u":["ú","ü"],"c":["ç"],"l":["l·"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"N":["Ñ"],"A":["Á"],"E":["É"],"I":["Í"],
"O":["Ó"],"U":["Ú","Ü"],"C":["Ç"],"L":["L·"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"fr-CA":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["à","â","æ"],"e":["é","è","ê","ë"],"u":["ù","û","ü"],
"i":["î","ï"],"o":["ô","œ"],"c":["ç"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["À","Â","Æ"],"E":["É","È","Ê","Ë"],"U":["Ù","Û","Ü"],
"I":["Î","Ï"],"O":["Ô","Œ"],"C":["Ç"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"hu-HU":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["á"],"e":["é"],"i":["í"],
"o":["ó","ö","ő"],"u":["ú","ü","ű"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Á"],"E":["É"],"I":["Í"],
"O":["Ó","Ö","Ő"],"U":["Ú","Ü","Ű"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"hr-HR":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"c":["ć","č"],"d":["đ"],"s":["š"],"z":["ž"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"C":["Ć","Č"],"D":["Đ"],"S":["Š"],"Z":["Ž"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"cs-CZ":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["á"],"c":["č"],"d":["ď"],"e":["é","ě"],
"i":["í"],"n":["ň"],"o":["ó"],"r":["ř"],
"s":["š"],"t":["ť"],"u":["ú","ů"],"y":["ý"],"z":["ž"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Á"],"C":["Č"],"D":["Ď"],"E":["É","Ě"],
"I":["Í"],"N":["Ň"],"O":["Ó"],"R":["Ř"],
"S":["Š"],"T":["Ť"],"U":["Ú","Ů"],"Y":["Ý"],"Z":["Ž"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"ru-RU":[{"func":"абв","key":"1234567890абвгдежзиклмнопрстуфхцчшъыьэюя",
"token":{"и":["й"],"ш":["щ"]},
"offset_y":key_item_offset},
{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"offset_y":key_item_offset},
{"func":"#!$","key":mark,
"offset_y":key_item_offset}
],
"bg-BG":[{"func":"абв","key":"1234567890абвгдежзиклмнопрстуфхцчшъыьэюя",
"token":{"и":["й"],"ш":["щ"]},
"offset_y":key_item_offset},
{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"mk-MK":[{"func":"абв","key":"абвгдежзѕиклмнопрстуфхцчшъыьэюя         ",
"token":{"и":["й"],"ш":["щ"]},
"offset_y":key_item_offset},
{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"ro-RO":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["â","ă"],"i":["î"],"s":["ș"],"t":["ț"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Â","Ă"],"I":["Î"],"S":["Ș"],"T":["Ț"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"sk-SK":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["á","ä"],"c":["č"],"d":["ď"],"e":["é"],
"i":["í"],"l":["ĺ","ľ"],"n":["ň"],"o":["ó","ô"],
"r":["ŕ"],"s":["š"],"t":["ť"],"u":["ú"],
"y":["ý"],"z":["ž"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Á","Ä"],"C":["Č"],"D":["Ď"],"E":["É"],
"I":["Í"],"L":["Ĺ","Ľ"],"N":["Ň"],"O":["Ó","Ô"],
"R":["Ŕ"],"S":["Š"],"T":["Ť"],"U":["Ú"],
"Y":["Ý"],"Z":["Ž"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"sl-SI":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["ä"],"c":["č","ć"],"d":["đ"],"o":["ö"],
"s":["š"],"u":["ü"],"z":["ž"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Ä"],"C":["Č","Ć"],"D":["Đ"],"O":["Ö"],
"S":["Š"],"U":["Ü"],"Z":["Ž"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"pl-PL":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["ą"],"c":["ć"],"e":["ę"],"l":["ł"],
"n":["ń"],"o":["ó"],"s":["ś"],"z":["ź","ż"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Ą"],"C":["Ć"],"E":["Ę"],"L":["Ł"],
"N":["Ń"],"O":["Ó"],"S":["Ś"],"Z":["Ź","Ż"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"sr-YU":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"c":["ć","č"],"d":["đ"],"s":["š"],"z":["ž"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"C":["Ć","Č"],"D":["Đ"],"S":["Š"],"Z":["Ž"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"de-DE":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["ä","à"],"e":["é"],"o":["ö"],"u":["ü"],"s":["ß"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Ä","À"],"E":["É"],"O":["Ö"],"U":["Ü"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"es-ES":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"n":["ñ"],"a":["á"],"e":["é"],"i":["í"],
"o":["ó"],"u":["ú","ü"],"c":["ç"],"l":["l·"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"N":["Ñ"],"A":["Á"],"E":["É"],"I":["Í"],
"O":["Ó"],"U":["Ú","Ü"],"C":["Ç"],"L":["L·"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"nl-NL":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["á","â","ä"],"e":["è","é","ê","ë"],"i":["í","ï","ĳ"],
"o":["ó","ô","ö"],"u":["ú","û","ü"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Á","Â","Ä"],"E":["È","É","Ê","Ë"],"I":["Í","Ï","Ĳ"],
"O":["Ó","Ô","Ö"],"U":["Ú","Û","Ü"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"no-NO":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["æ","å","à"],"e":["é","ê"],"o":["ø","ó","ò","ô"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Æ","Å","À"],"E":["É","Ê"],"O":["Ø","Ó","Ò","Ô"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"fi-FI":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["ä","å"],"o":["ö"],"s":["š"],"z":["ž"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Ä","Å"],"O":["Ö"],"S":["Š"],"Z":["Ž"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"fr-FR":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["à","â","æ"],"e":["é","è","ê","ë"],"u":["ù","û","ü"],
"i":["î","ï"],"o":["ô","œ"],"c":["ç"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["À","Â","Æ"],"E":["É","È","Ê","Ë"],"U":["Ù","Û","Ü"],
"I":["Î","Ï"],"O":["Ô","Œ"],"C":["Ç"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"da-DK":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["å","æ","á"],"e":["é"],"i":["í"],
"o":["ø","ó"],"u":["ú"],"y":["ý"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Å","Æ","Á"],"E":["É"],"I":["Í"],
"O":["Ø","Ó"],"U":["Ú"],"Y":["Ý"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"tr-TR":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["â"],"c":["ç"],"g":["ğ"],"i":["î","ı"],
"o":["ö"],"s":["ş"],"u":["ü","û"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Â"],"C":["Ç"],"G":["Ğ"],"I":["Î","İ"],
"O":["Ö"],"S":["Ş"],"U":["Ü","Û"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"it-IT":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["à","á"],"e":["è","é"],"i":["ì","í","î","ï"],
"o":["ò","ó"],"u":["ù","ú"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["À","Á"],"E":["È","É"],"I":["Ì","Í","Î","Ï"],
"O":["Ò","Ó"],"U":["Ù","Ú"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"sv-SE":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["ä","å","á","à"],"e":["é","ë"],
"o":["ö"],"u":["ü"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Ä","Å","Á","À"],"E":["É","Ë"],
"O":["Ö"],"U":["Ü"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"pt-PT":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["à","á","â","ã"],"c":["ç"],"e":["é","ê","è"],
"i":["í"],"o":["ó","ô","õ","ò"],"u":["ú","ü"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["À","Á","Â","Ã"],"C":["Ç"],"E":["É","Ê","È"],
"I":["Í"],"O":["Ó","Ô","Õ","Ò"],"U":["Ú","Ü"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"el-GR":[{"func":"αβγ","key":"1234567890αβγδεζηθικλμνξοπρστυφχψω/@:.  ",
"offset_y":key_item_offset},
{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"et-EE":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["ä"],"o":["õ","ö"],"s":["š"],
"u":["ü"],"z":["ž"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Ä"],"O":["Õ","Ö"],"S":["Š"],
"U":["Ü"],"Z":["Ž"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"lv-LV":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["ā"],"c":["č"],"e":["ē"],"g":["ģ"],
"i":["ī"],"k":["ķ"],"l":["ļ"],"n":["ņ"],
"o":["ō"],"r":["ŗ"],"s":["š"],"u":["ū"],"z":["ž"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Ā"],"C":["Č"],"E":["Ē"],"G":["Ģ"],
"I":["Ī"],"K":["Ķ"],"L":["Ļ"],"N":["Ņ"],
"O":["Ō"],"R":["Ŗ"],"S":["Š"],"U":["Ū"],"Z":["Ž"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"lt-LT":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["ą"],"c":["č"],"e":["ę","ė"],"i":["į"],
"s":["š"],"u":["ų","ū"],"z":["ž"]},
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["Ą"],"C":["Č"],"E":["Ę","Ė"],"I":["Į"],
"S":["Š"],"U":["Ų","Ū"],"Z":["Ž"]},
"offset_y":key_item_offset},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"vi-00":[{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"token":{"a":["à","á","ả","ã","ạ","ă","ằ","ắ","ẳ","ẵ","ặ","â","ầ","ấ","ẩ","ẫ","ậ","æ","ā","å"],
"d":["đ"],"e":["è","é","ẻ","ẽ","ẹ","ê","ề","ế","ể","ễ","ệ"],
"i":["ì","í","ỉ","ĩ","ị"],
"o":["ò","ó","ỏ","õ","ọ","ô","ồ","ố","ổ","ỗ","ộ","ơ","ờ","ớ","ở","ỡ","ợ","œ"],
"u":["ù","ú","ủ","ũ","ụ","ư","ừ","ứ","ử","ữ","ự"],"y":["ỳ","ý","ỷ","ỹ","ỵ"]}},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"token":{"A":["À","Á","Ả","Ã","Ạ","Ă","Ằ","Ắ","Ẳ","Ẵ","Ặ","Â","Ầ","Ấ","Ẩ","Ẫ","Ậ","Æ","Ā","Å"],
"D":["Đ"],"E":["È","É","Ẻ","Ẽ","Ẹ","Ê","Ề","Ế","Ể","Ễ","Ệ"],
"I":["Ì","Í","Ỉ","Ĩ","Ị"],
"O":["Ò","Ó","Ỏ","Õ","Ọ","Ô","Ồ","Ố","Ổ","Ỗ","Ộ","Ơ","Ờ","Ớ","Ở","Ỡ","Ợ","Œ"],
"U":["Ù","Ú","Ủ","Ũ","Ụ","Ư","Ừ","Ứ","Ử","Ữ","Ự"],"Y":["Ỳ","Ý","Ỷ","Ỹ","Ỵ"]}},
{"func":"#!$","key":mark,"offset_y":key_item_offset}
],
"hi-00":[{"func":"कलथ","key":"1234567890्ािीुूेैोौकलथगचजटडतदनपवमहछयळशसऔऐआईऊभङञषघधझओएअ़ॅृँ.,@?।!",
"offset_y":key_item_offset},
{"func":"१२३","key":"1234567890$%^१२३४५६७८९०इउफरखढणबठऋ&*()_+`-=[]{}|\/:;“',~/<>!#      ",
"offset_y":key_item_offset}
],
"th-00":[{"func":"กขค","key":"_ๅ/-ภถุึคตจขชๆไำพะัีรนยบลฃ ฟหกดเ้่าสวง  ผปแอิืทมใฝ               ",
"offset_y":key_item_offset},
{"func":"ฆฉซ","key":"%+๑๒๓๔ู฿๕๖๗๘๙๐\"ฎฑธํ๊ณฯญฐ,ฅ ฤฆฏโฌ็๋ษศซ.  ()ฉฮฺ์?ฒฬฦ                  ",
"offset_y":key_item_offset},
{"func":"#!$","key":"-_?;:,.!#$123%&@*+=~|()456{}[]<>^\"'`789          #0*             ",
"offset_y":key_item_offset,"alphabet_mode":true}
],
"ar-00":[{"func":"ل ا ت","key":"شسزرذدخحجثتباهنملكقفغعظطضصآإأؤئىةءيو       .ًٌٍَُِّْ             ",
"token":{"ل":["لآ","لأ","لإ"]},
"offset_y":key_item_offset},
{"func":"123","key":"1234567890-_?١٢٣٤٥٦٧٨٩٠;:,.!#$%&@*+=~|(){}[]<>^“‘`                ",
"offset_y":key_item_offset}
],
"he-IL":[{"func":"אבג","key":"יטחזוהדגבאפעסןנםמלךכ',.תשרקץצף/\\;-=[]?!₪",
"offset_y":key_item_offset,"alphabet_mode":false},
{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"offset_y":key_item_offset},
{"func":"ABC","key":"1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ/@:.",
"offset_y":key_item_offset},
{"func":"#!$","key":"1234567890-_?;:,.!#$%&@*+=~|(){}[]<>^\"'`",
"offset_y":key_item_offset}
],
"zh-TW":[{"func":"ㄅㄆㄇ","key":"ㄅㄉˇˋㄓˊ˙ㄚㄞㄢ123ㄆㄊㄍㄐㄔㄗ一ㄛㄟㄣ456ㄋㄇㄎㄑㄕㄘㄨㄜㄠㄤ789ㄈㄌㄏㄒㄖㄙㄩㄝㄡㄥㄦ0.             ",
"offset_y":key_item_offset,"alphabet_mode":false},
{"func":"abc","key":"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890/:.",
"offset_y":key_item_offset,"alphabet_mode":true},
{"func":"#!$","key":"-_?;:,.!#$123%&@*+=~|()456{}[]<>^\"'`789          #0*             ",
"offset_y":key_item_offset,"alphabet_mode":true}
],
"zh-CN":[{"func":"中文","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"offset_y":key_item_offset,"alphabet_mode":false},
{"func":"#!$","key":mark,
"offset_y":key_item_offset,"alphabet_mode":true},
{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"offset_y":key_item_offset,"alphabet_mode":true},
{"func":"T9","key":"                                        ",
"offset_y":key_item_offset,"alphabet_mode":false}
],
"zh-HK":[{"func":"中文","key":"1234567890手田水口廿卜山戈人心日尸木火土竹十大中;重難金女月弓一,./",
"offset_y":key_item_offset,"alphabet_mode":false},
{"func":"#!$","key":mark,
"offset_y":key_item_offset,"alphabet_mode":true},
{"func":"abc","key":"1234567890abcdefghijklmnopqrstuvwxyz/@:.",
"offset_y":key_item_offset,"alphabet_mode":true}
]
};
key_item["en-IE"]=key_item["en-US"];
var get_software_kbd_support_lang=function(lang){
if(key_item[lang]){
return lang;}
switch(lang){
case "en-GB":
case "en-BR":
return "en-IE";
case "es-BR":
return "es-ES";
case "pt-BR":
return "pt-PT";}
switch(lang.substr(0,2)){
case "de":
return "de-DE";
case "es":
return (is_us_market?"es-US":"es-ES");
case "nl":
return "nl-NL";
case "fi":
return "fi-FI";
case "fr":
return (is_us_market?"fr-CA":"fr-FR");
case "it":
return "it-IT";
case "pt":
return "pt-PT";
case "vi":
return "vi-00";
default:
return (is_us_market?"en-US":"en-IE");}
};
var setting_menu_item={
"en-US":[
{func:"CHANGE_LANG",text:"wwwwwwww",updatable:"CHANGE_LANG"}
]
};
setting_menu_item.get_setting=function (lang){
if(setting_menu_item[lang])
return setting_menu_item[lang];
return setting_menu_item["en-US"];};
var make_LangList=function(is_us_market){
var out=[];
if(is_us_market){
var us=[
{func:"en-US",text:"English"},
{func:"es-US",text:"Español"},
{func:"fr-CA",text:"Français"}
];
out=out.concat(us);}else {
if(ureg.read("language")=="ja-JP"){
var jp=[
{func:"ja-JP",text:"日本語"}
];
out=out.concat(jp);}
var other=[
{func:"en-IE",text:"English"},
{func:"es-ES",text:"Español"},
{func:"fr-FR",text:"Français"}
];
out=out.concat(other);}
var common=[
{func:"hu-HU",text:"Magyar"},
{func:"hr-HR",text:"Hrvatski"},
{func:"cs-CZ",text:"Česky"},
{func:"ru-RU",text:"Русский"},
{func:"bg-BG",text:"Български"},
{func:"mk-MK",text:"македонски"},
{func:"ro-RO",text:"Română"},
{func:"sk-SK",text:"Slovenčina"},
{func:"sl-SI",text:"Slovenščina"},
{func:"pl-PL",text:"Polski"},
{func:"sr-YU",text:"Srpski"},
{func:"de-DE",text:"Deutsch"},
{func:"nl-NL",text:"Nederlands"},
{func:"no-NO",text:"Norsk"},
{func:"fi-FI",text:"Suomi"},
{func:"da-DK",text:"Dansk"},
{func:"tr-TR",text:"Türkçe"},
{func:"it-IT",text:"Italiano"},
{func:"sv-SE",text:"Svenska"},
{func:"pt-PT",text:"Português"},
{func:"el-GR",text:"Ελληνικά"},
{func:"et-EE",text:"Eesti"},
{func:"lv-LV",text:"Latvian"},
{func:"lt-LT",text:"Lietuvių"},
{func:"vi-00",text:"Tiếng Việt"},
{func:"hi-00",text:"हिंदी"},
{func:"th-00",text:"ภาษาไทย"},
{func:"ar-00",text:"العربية"},
{func:"he-IL",text:"עברית"},
];
out=out.concat(common);
if(ureg.read("language")!="ja-JP"){
zh=[
{func:"zh-TW",text:"繁體注音"},
{func:"zh-CN",text:"简体中文"},
{func:"zh-HK",text:"繁體倉頡"}
];
out=out.concat(zh);}
return out;};
var setting_LangList={};
setting_LangList.get_setting=function (lang){
var ret=make_LangList(is_us_market);
return ret;};
var round_menu_item={
"en-US":{
close:{mode:"label",symbol:"close",label:"Close"}
},
"ja-JP":{
close:{mode:"label",symbol:"close",label:"閉じる"}
},

"vi-00":{
close:{mode:"label",symbol:"close",label:"Đóng"}
},
"th-00":{
close:{mode:"label",symbol:"close",label:"ปิด"}
},
"hi-00":{
close:{mode:"label",symbol:"close",label:"बंद करें"}
},
"ar-00":{
close:{mode:"label",symbol:"close",label:"إغلاق"}
},
"he-IL":{
close:{mode:"label",symbol:"close",label:"לסגור"}
},

"zh-CN":{
close:{mode:"label",symbol:"close",label:"关闭"}
},
"zh-TW":{
close:{mode:"label",symbol:"close",label:"關閉"}
},
"zh-HK":{
close:{mode:"label",symbol:"close",label:"關閉"}
}
};
round_menu_item.get_setting=function (lang){
if(round_menu_item[lang])
return round_menu_item[lang];
var real_lang=get_software_kbd_support_lang(lang);
if(round_menu_item[real_lang])
return round_menu_item[real_lang];
var item=round_menu_item["en-US"];
return item;};
var MessageText={
"en-AU":{
"LT_ASR_DONE_KBD":"Done",
"LT_BT_TAP":"Tap",
"LT_CANCEL_KBD":"Cancel",
"LT_CL_BACK":"Return",
"LT_CONTENT_DELETE":"Are you sure you want to delete?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Please use VIERA Touch Pad or a smartphone to input your voice.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Please use a smartphone to input your voice.",
"LT_YES":"Yes",
},
"en-HK":{
"LT_ASR_DONE_KBD":"Done",
"LT_BT_TAP":"Tap",
"LT_CANCEL_KBD":"Cancel",
"LT_CL_BACK":"Return",
"LT_CONTENT_DELETE":"Are you sure you want to delete?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Please use VIERA Touch Pad or a smartphone to input your voice.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Please use a smartphone to input your voice.",
"LT_YES":"Yes",
},
"zh-HK":{
"LT_ASR_DONE_KBD":"完成",
"LT_BT_TAP":"點擊",
"LT_CANCEL_KBD":"取消",
"LT_CL_BACK":"返回",
"LT_CONTENT_DELETE":"確定要刪除？",
"LT_NO":"否",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"請使用VIERA觸控平板或智能手機以輸入聲音。",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"請使用智能手機以輸入聲音。",
"LT_YES":"是",
},
"zh-CN":{
"LT_ASR_DONE_KBD":"完成",
"LT_BT_TAP":"点击",
"LT_CANCEL_KBD":"取消",
"LT_CL_BACK":"返回",
"LT_CONTENT_DELETE":"您确定要删除？",
"LT_NO":"否",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"请使用 VIERA 触摸板或智能手机输入语音。",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"请用智能手机输入您的声音。",
"LT_YES":"是",
},
"id":{
"LT_ASR_DONE_KBD":"Selesai",
"LT_BT_TAP":"Ketuk",
"LT_CANCEL_KBD":"Batal",
"LT_CL_BACK":"Kembali",
"LT_CONTENT_DELETE":"Anda yakin ingin menghapus?",
"LT_NO":"Tidak",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Gunakan Papan Sentuh VIERA atau smartphone untuk memasukkan suara Anda.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Gunakan smartphone untuk memasukkan suara Anda.",
"LT_YES":"Ya",
},
"ar":{
"LT_ASR_DONE_KBD":"أنجز",
"LT_BT_TAP":"انقر",
"LT_CANCEL_KBD":"إلغاء",
"LT_CL_BACK":"رجوع",
"LT_CONTENT_DELETE":"هل أنت متأكد أنك تريد حذف؟",
"LT_NO":"لا",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"يرجى استعمال لوحة اللمس الخاصة ب VIERA أو الهاتف الذكي لإدخال صوتك.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"يرجى استعمال هاتف ذكي لإدخال صوتك.",
"LT_YES":"نعم",
},
"fa":{
"LT_ASR_DONE_KBD":"انجام شد",
"LT_BT_TAP":"ضربه زدن",
"LT_CANCEL_KBD":"لغو",
"LT_CL_BACK":"بازگشت",
"LT_CONTENT_DELETE":"آیا شما مطمئن هستید که می خواهید پاک کنید؟",
"LT_NO":"خیر",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"لطفاً از صفحه لمسی VIERA یا یک تلفن هوشمند برای وارد کردن صدای خود استفاده کنید.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"لطفاً از یک تلفن هوشمند برای وارد کردن صدای خود استفاده کنید.",
"LT_YES":"بله",
},
"he":{
"LT_ASR_DONE_KBD":"Done",
"LT_BT_TAP":"הקש",
"LT_CANCEL_KBD":"ביטול",
"LT_CL_BACK":"Back",
"LT_CONTENT_DELETE":"בטוח שברצונך למחוק?",
"LT_NO":"לא",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"נא להשתמש בלוח המגע של VIERA או ב-smartphone כדי להוסיף קול.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"נא להשתמש בsmartphone כדי להקליט את קולך.",
"LT_YES":"כן",
},
"vi":{
"LT_ASR_DONE_KBD":"Xong",
"LT_BT_TAP":"Gõ vào",
"LT_CANCEL_KBD":"Hủy",
"LT_CL_BACK":"Trở về",
"LT_CONTENT_DELETE":"Bạn có chắc là muốn xóa?",
"LT_NO":"Không",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Hãy sử dụng VIERA Touchpad hoặc smartphone để nhập giọng nói của bạn.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Hãy sử dụng smartphone để nhập giọng nói của bạn.",
"LT_YES":"Có",
},
"th":{
"LT_ASR_DONE_KBD":"เสร็จสิ้น",
"LT_BT_TAP":"เคาะ",
"LT_CANCEL_KBD":"ยกเลิก",
"LT_CL_BACK":"ย้อนกลับ",
"LT_CONTENT_DELETE":"ท่านแน่ใจว่าต้องการลบไฟ?",
"LT_NO":"ไม่ใช่",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"โปรดใช้แผ่นสัมผัส VIERA หรือสมาร์ทโฟนเพื่อป้อนเสียงของคุณ",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"โปรดใช้สมาร์ทโฟนเพื่อป้อนเสียงของคุณ",
"LT_YES":"ใช่",
},
"hi":{
"LT_ASR_DONE_KBD":"पूर्ण हुआ",
"LT_BT_TAP":"टैप",
"LT_CANCEL_KBD":"रद्द करें",
"LT_CL_BACK":"वापस जाएं",
"LT_CONTENT_DELETE":"क्या आप सुनिश्चित करें कि आप हटाना चाहते हैं?",
"LT_NO":"नहीं",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"कृपया अपनी ध्वनि इनपुट करने के लिए VIERA टच पैड या स्मार्टफ़ोन का उपयोग करें।",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"अपनी आवाज दर्ज करने के लिए एक स्मार्टफोन का उपयोग करें।",
"LT_YES":"हां",
},
"fr":{
"LT_ASR_DONE_KBD":"Effectué",
"LT_BT_TAP":"Tapez",
"LT_CANCEL_KBD":"Annuler",
"LT_CL_BACK":"Revenir",
"LT_CONTENT_DELETE":"Êtes-vous sûr de vouloir supprimer ?",
"LT_NO":"Non",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Veuillez utiliser le pavé tactile VIERA ou un smartphone pour entrer votre voix.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Veuillez utiliser un téléphone intelligent pour entrer votre voix.",
"LT_YES":"Oui",
},
"ru":{
"LT_ASR_DONE_KBD":"Готово",
"LT_BT_TAP":"Исп. легкий удар пальцем",
"LT_CANCEL_KBD":"Отмена",
"LT_CL_BACK":"Возврат",
"LT_CONTENT_DELETE":"Действительно удалить?",
"LT_NO":"Нет",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Используйте сенсорную панель VIERA или смартфон для ввода голосовой команды.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Для ввода голосовой команды воспользуйтесь смартфоном.",
"LT_YES":"Дa",
},
"en-TW":{
"LT_ASR_DONE_KBD":"Done",
"LT_BT_TAP":"Tap",
"LT_CANCEL_KBD":"Cancel",
"LT_CL_BACK":"Return",
"LT_CONTENT_DELETE":"Are you sure you want to delete?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Please use VIERA Touch Pad or a smartphone to input your voice.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Please use a smartphone to input your voice.",
"LT_YES":"Yes",
},
"zh-TW":{
"LT_ASR_DONE_KBD":"完成",
"LT_BT_TAP":"點擊",
"LT_CANCEL_KBD":"取消",
"LT_CL_BACK":"返回",
"LT_CONTENT_DELETE":"確定要刪除？",
"LT_NO":"否",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"請使用VIERA觸控板或智慧型手機來進行語音文字輸入。",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"請用智慧型手機來輸入您的語音。",
"LT_YES":"是",
},
"en-JM":{
"LT_ASR_DONE_KBD":"Done",
"LT_BT_TAP":"Tap",
"LT_CANCEL_KBD":"Cancel",
"LT_CL_BACK":"Return",
"LT_CONTENT_DELETE":"Are you sure you want to delete?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Please use VIERA Touch Pad or a smartphone to input your voice.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Please use a smartphone to input your voice.",
"LT_YES":"Yes",
},
"es-AR":{
"LT_ASR_DONE_KBD":"Done",
"LT_BT_TAP":"Tocar",
"LT_CANCEL_KBD":"Cancelar",
"LT_CL_BACK":"Volver",
"LT_CONTENT_DELETE":"¿Desea realmente eliminar?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Utilice el panel táctil VIERA o un teléfono inteligente para ingresar su voz.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Utilice un teléfono inteligente para ingresar su voz.",
"LT_YES":"Sí",
},
"pt-BR":{
"LT_ASR_DONE_KBD":"Done",
"LT_BT_TAP":"Tocar",
"LT_CANCEL_KBD":"Cancelar",
"LT_CL_BACK":"Retornar",
"LT_CONTENT_DELETE":"Tem certeza de que pretende apagar?",
"LT_NO":"Não",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Use o Touch Pad VIERA ou um smartphone para inserir sua voz.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Use um smartphone para inserir sua voz.",
"LT_YES":"Sim",
},
"en-GB":{
"LT_ASR_DONE_KBD":"Done",
"LT_BT_TAP":"Tap",
"LT_CANCEL_KBD":"Cancel",
"LT_CL_BACK":"Return",
"LT_CONTENT_DELETE":"Are you sure you want to delete?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Please use VIERA Touch Pad or a smartphone to input your voice.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Please use a smartphone to input your voice.",
"LT_YES":"Yes",
},
"en-IE":{
"LT_ASR_DONE_KBD":"Done",
"LT_BT_TAP":"Tap",
"LT_CANCEL_KBD":"Cancel",
"LT_CL_BACK":"Return",
"LT_CONTENT_DELETE":"Are you sure you want to delete?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Please use VIERA Touch Pad or a smartphone to input your voice.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Please use a smartphone to input your voice.",
"LT_YES":"Yes",
},
"hu":{
"LT_ASR_DONE_KBD":"Kész",
"LT_BT_TAP":"Érintse meg",
"LT_CANCEL_KBD":"Mégse",
"LT_CL_BACK":"Visszalépni",
"LT_CONTENT_DELETE":"Valóban törölni szeretné?",
"LT_NO":"Nem",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Használja a VIERA Touch Pad-et vagy egy okostelefont a hangjának beviteléhez.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Hangjának beviteléhez használjon okostelefont.",
"LT_YES":"Igen",
},
"hr":{
"LT_ASR_DONE_KBD":"Učinjeno",
"LT_BT_TAP":"Dodirni",
"LT_CANCEL_KBD":"Poništi",
"LT_CL_BACK":"Vraćanje",
"LT_CONTENT_DELETE":"Jeste li sigurni da želite izbrisati?",
"LT_NO":"Ne",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Uporabite VIERA Touch Pad upravljač ili pametni telefon za snimanje vašeg glasa.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Uporabite pametni telefon za snimanje vašeg glasa.",
"LT_YES":"Da",
},
"cs":{
"LT_ASR_DONE_KBD":"Hotovo",
"LT_BT_TAP":"Klepnutí",
"LT_CANCEL_KBD":"Zrušit",
"LT_CL_BACK":"Návrat",
"LT_CONTENT_DELETE":"Určitě chcete provést mazání?",
"LT_NO":"Ne",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"K záznamu svého hlasu použijte dotykový ovladač VIERA nebo chytrý telefon.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"K záznamu svého hlasu použijte chytrý telefon.",
"LT_YES":"Ano",
},
"bg":{
"LT_ASR_DONE_KBD":"Готово",
"LT_BT_TAP":"Докосване",
"LT_CANCEL_KBD":"Отмени",
"LT_CL_BACK":"Връщане",
"LT_CONTENT_DELETE":"Сигурни ли сте, че искате да изтриете?",
"LT_NO":"Нe",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Моля, използвайте тъчпад VIERA или смартфон, за да въведете вашия глас.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Моля, използвайте смартфон за въвеждане на своя глас.",
"LT_YES":"Дa",
},
"mk":{
"LT_ASR_DONE_KBD":"Доне",
"LT_BT_TAP":"Допри",
"LT_CANCEL_KBD":"Откажи",
"LT_CL_BACK":"Return",
"LT_CONTENT_DELETE":"Дали сте сигурни дека сакате да избришете?",
"LT_NO":"Не",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Користете ја VIERA подлогата за допир или паметен телефон за да го внесете в",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Користете паметен телефон за да го внесите вашиот глас.",
"LT_YES":"Да",
},
"ro":{
"LT_ASR_DONE_KBD":"Efectuat",
"LT_BT_TAP":"Atingeţi",
"LT_CANCEL_KBD":"Anulare",
"LT_CL_BACK":"Revenire",
"LT_CONTENT_DELETE":"Sunteţi sigur că doriţi să ştergeţi?",
"LT_NO":"Nu",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Utilizaţi suportul tactil VIERA sau un smartphone pentru comanda vocală.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Vă rugăm să utilizaţi un smartphone pentru a vă introduce vocea.",
"LT_YES":"Da",
},
"sk":{
"LT_ASR_DONE_KBD":"Hotovo",
"LT_BT_TAP":"Klepnite",
"LT_CANCEL_KBD":"Zrušiť",
"LT_CL_BACK":"Návrat",
"LT_CONTENT_DELETE":"Naozaj chcete odstrániť?",
"LT_NO":"Nie",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Na hlasový vstup použite dotykovú klávesnicu VIERA alebo smartfón.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Na zadanie hlasu použite smartfón.",
"LT_YES":"Áno",
},
"sl":{
"LT_ASR_DONE_KBD":"Končano",
"LT_BT_TAP":"Dotakni se",
"LT_CANCEL_KBD":"Prekliči",
"LT_CL_BACK":"Nazaj",
"LT_CONTENT_DELETE":"Ste prepričani, da jih želite izbrisati?",
"LT_NO":"Ne",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Za vnos vašega glasu uporabite konzolo na dotik VIERA ali pametni telefon.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Za vnos svojega gesla uporabite pametni telefon.",
"LT_YES":"Da",
},
"pl":{
"LT_ASR_DONE_KBD":"Gotowe",
"LT_BT_TAP":"Puknij",
"LT_CANCEL_KBD":"Anuluj",
"LT_CL_BACK":"Powrót",
"LT_CONTENT_DELETE":"Czy na pewno chcesz usunąć ?",
"LT_NO":"Nie",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Użyj pilota Touch Pad VIERA lub smarfona aby wprowadzić komunikat głosowy.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Użyj smartfona aby wprowadzić komunikat głosowy.",
"LT_YES":"Tak",
},
"sr":{
"LT_ASR_DONE_KBD":"Gotovo",
"LT_BT_TAP":"Tapnite",
"LT_CANCEL_KBD":"Otkazati",
"LT_CL_BACK":"Vraćanje",
"LT_CONTENT_DELETE":"Da li zaista želite da izbrišete?",
"LT_NO":"Ne",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Upotrebite VIERA senzorsku pločicu ili pametan telefon da unesete glas.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Koristite pametan telefon da unesete glas.",
"LT_YES":"Da",
},
"de":{
"LT_ASR_DONE_KBD":"Fertig",
"LT_BT_TAP":"Tippen",
"LT_CANCEL_KBD":"Abbrechen",
"LT_CL_BACK":"Zurück",
"LT_CONTENT_DELETE":"Wirklich löschen?",
"LT_NO":"Nein",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Bitte benutzen Sie das VIERA Touch Pad oder Ihr Smartphone, um Spracheingaben zu machen.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Bitte nutzen Sie Ihr Smartphone, um Spracheingaben zu machen.",
"LT_YES":"Ja",
},
"es":{
"LT_ASR_DONE_KBD":"Listo",
"LT_BT_TAP":"Pulsar",
"LT_CANCEL_KBD":"Cancelar",
"LT_CL_BACK":"Volver",
"LT_CONTENT_DELETE":"¿Desea realmente eliminar?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Utiliza el Mando con Panel Táctil VIERA o un smartphone para introducir tu voz.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Utilice un smartphone para introducir su voz.",
"LT_YES":"Sí",
},
"nl":{
"LT_ASR_DONE_KBD":"Voltooid",
"LT_BT_TAP":"Tikken",
"LT_CANCEL_KBD":"Annuleren",
"LT_CL_BACK":"Terug naar",
"LT_CONTENT_DELETE":"Weet u zeker dat u wilt verwijderen?",
"LT_NO":"Nee",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Gebruik de VIERA touchpad of een smartphone voor steminvoer.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Gebruik de stemfunctie van uw smartphone.",
"LT_YES":"Ja",
},
"no":{
"LT_ASR_DONE_KBD":"Ferdig",
"LT_BT_TAP":"Trykk",
"LT_CANCEL_KBD":"Avbryt",
"LT_CL_BACK":"Tilbake",
"LT_CONTENT_DELETE":"Er du sikker på at du vil slette?",
"LT_NO":"Nei",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Bruk VIERA pekeplate, eller en smarttelefon for å legge inn din stemme.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Bruk en smarttelefon for å registrere stemmen din.",
"LT_YES":"Ja",
},
"fi":{
"LT_ASR_DONE_KBD":"Valmis",
"LT_BT_TAP":"Näpäytä",
"LT_CANCEL_KBD":"Peruuta",
"LT_CL_BACK":"Takaisin",
"LT_CONTENT_DELETE":"Haluatko varmasti poistaa?",
"LT_NO":"Ei",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Käytä VIERA-kosketuslevyä tai älypuhelinta äänen sisällyttämiseksi.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Käytä älypuhelintasi lisätäksesi äänesi.",
"LT_YES":"Kyllä",
},
"da":{
"LT_ASR_DONE_KBD":"Afslut",
"LT_BT_TAP":"Tap",
"LT_CANCEL_KBD":"Annuller",
"LT_CL_BACK":"Tilbage",
"LT_CONTENT_DELETE":"Er du sikker på at du vil slette?",
"LT_NO":"Nej",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Brug dit VIERA-touchpad eller en smartphone til at optage din stemme.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Brug en smartphone til at optage din stemme.",
"LT_YES":"Ja",
},
"tr":{
"LT_ASR_DONE_KBD":"Bitti",
"LT_BT_TAP":"Dokun",
"LT_CANCEL_KBD":"İptal",
"LT_CL_BACK":"Dönüs",
"LT_CONTENT_DELETE":"Silmek istediğinizden emin misiniz?",
"LT_NO":"Hyr",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Lütfen VIERA Dokunmatik Yüzeyini veya akıllı bir telefon kullanarak ses girişinizi yapın.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Lütfen ses girişinizi yapmak için bir akılı telefon kullanın.",
"LT_YES":"Evet",
},
"it":{
"LT_ASR_DONE_KBD":"Fatto",
"LT_BT_TAP":"Toccare",
"LT_CANCEL_KBD":"Annulla",
"LT_CL_BACK":"Ritorno",
"LT_CONTENT_DELETE":"Continuare con l’eliminazione?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Utilizza il touch pad VIERA o uno smartphone per registrare la tua voce.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Utilizzare uno smartphone per l\'input vocale.",
"LT_YES":"Sì",
},
"sv":{
"LT_ASR_DONE_KBD":"Klar",
"LT_BT_TAP":"Knacka lätt på skärmen",
"LT_CANCEL_KBD":"Avbryt",
"LT_CL_BACK":"Återgå",
"LT_CONTENT_DELETE":"Är de säker på att du vill radera?",
"LT_NO":"Nej",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Använd VIERA-pekplattan eller en smart telefon för att mata in din röst.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Använd en smarttelefon för att lägga in din röst.",
"LT_YES":"Ja",
},
"pt":{
"LT_ASR_DONE_KBD":"Concluído",
"LT_BT_TAP":"Toque leve",
"LT_CANCEL_KBD":"Cancelar",
"LT_CL_BACK":"Regressar",
"LT_CONTENT_DELETE":"Tem a certeza de que pretende apagar?",
"LT_NO":"Não",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Utilize o Touch Pad VIERA ou um smartphone para introduzir a sua voz.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Utilize um smartphone para introduzir a sua voz.",
"LT_YES":"Sim",
},
"el":{
"LT_ASR_DONE_KBD":"Τέλος",
"LT_BT_TAP":"Αγγίξτε",
"LT_CANCEL_KBD":"Ακύρωση",
"LT_CL_BACK":"Επιστροφή",
"LT_CONTENT_DELETE":"Είστε βέβαιοι ότι επιθυμείτε τη διαγραφή;",
"LT_NO":"Όχι",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Χρησιμοποιήστε το Χειριστήριο Αφής VIERA ή ένα smartphone για την καταχ. της φωνής σας.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Χρησιμοποιήστε ένα smartphone για την καταχώριση της φωνής σας.",
"LT_YES":"Ναι",
},
"et":{
"LT_ASR_DONE_KBD":"Tehtud",
"LT_BT_TAP":"Puudutage",
"LT_CANCEL_KBD":"Tühistus",
"LT_CL_BACK":"Tagasi",
"LT_CONTENT_DELETE":"Kas soovite kindlasti kustutada?",
"LT_NO":"Ei",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Palun kasutage oma hääle sisestamiseks kas VIERA puutepatja või nutitelefoni.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Palun kasutage oma hääle sisestamiseks nutitelefoni.",
"LT_YES":"Jah",
},
"lv":{
"LT_ASR_DONE_KBD":"Gatavs",
"LT_BT_TAP":"Pieskarieties",
"LT_CANCEL_KBD":"Atcelt",
"LT_CL_BACK":"Atgriezties",
"LT_CONTENT_DELETE":"Vai tiešām vēlaties dzēst?",
"LT_NO":"Nē",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Balss ievadē, lūdzu, izmantojiet “VIERA” skārienpaliktni vai viedtālruni.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Lai ievadītu balss saturu, lūdzu, izmantojiet viedtālruni.",
"LT_YES":"Jā",
},
"lt":{
"LT_ASR_DONE_KBD":"Atlikta",
"LT_BT_TAP":"Bakstelėti",
"LT_CANCEL_KBD":"Atšaukti",
"LT_CL_BACK":"Grįžti",
"LT_CONTENT_DELETE":"Ar tikrai norite pašalinti?",
"LT_NO":"Ne",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Naudokite „VIERA Touch Pad“ arba išmanųjį telefoną ir įrašykite savo balsą.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Įrašykite savo balsą išmaniuoju telefonu.",
"LT_YES":"Taip",
},
"en-US":{
"LT_ASR_DONE_KBD":"Done",
"LT_BT_TAP":"Tap",
"LT_CANCEL_KBD":"Cancel",
"LT_CL_BACK":"Return",
"LT_CONTENT_DELETE":"Are you sure you want to delete?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Please use VIERA Touch Pad or a smartphone to input your voice.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Please use a smartphone to input your voice.",
"LT_YES":"Yes",
},
"es-US":{
"LT_ASR_DONE_KBD":"Hecho",
"LT_BT_TAP":"Toque",
"LT_CANCEL_KBD":"Cancelar",
"LT_CL_BACK":"Volver",
"LT_CONTENT_DELETE":"¿Desea realmente eliminar?",
"LT_NO":"No",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Utilice el panel táctil VIERA o un teléfono inteligente para ingresar su voz.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Utilice un teléfono inteligente para ingresar su voz.",
"LT_YES":"Sí",
},
"fr-CA":{
"LT_ASR_DONE_KBD":"Terminé",
"LT_BT_TAP":"Taper",
"LT_CANCEL_KBD":"Annuler",
"LT_CL_BACK":"Revenir",
"LT_CONTENT_DELETE":"Êtes-vous sûr de vouloir supprimer ?",
"LT_NO":"Non",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"Veuillez utiliser le pavé tactile VIERA ou un smartphone pour entrer votre voix.",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"Veuillez utiliser un téléphone intelligent pour entrer votre voix.",
"LT_YES":"Oui",
},
"ja-JP":{
"LT_ASR_DONE_KBD":"確定",
"LT_BT_TAP":"タップ",
"LT_CANCEL_KBD":"取消",
"LT_CL_BACK":"戻る",
"LT_CONTENT_DELETE":"消去しますか？",
"LT_NO":"いいえ",
"LT_SOFT_KEYBOARD_VOICE_BUTTON":"音声にて入力するにはタッチパッドリモコン、またはスマートフォンのご利用が必要です。",
"LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE":"音声にて入力するにはスマートフォンのご利用が必要です。",
"LT_YES":"はい",
},
};
var getLangByTable=function(table,lang){
if(!table||!lang)
return "en-US";
if(lang=="zh-00"){
lang="zh-CN";}else if((lang=="en-00")||(lang=="en-CN")){
lang="en-HK";}else if(lang=="en-NZ"){
lang="en-AU";}else if(lang=="en-BR"){
lang="en-JM";}else if(lang=="es-BR"){
lang="es-AR";}
if(table[lang])return lang;
lang=lang.substr(0,2);
if(table[lang])return lang;
else if(table["en-IE"])
return "en-IE";
else
return "en-US";};
var confirm_popup_item={};
confirm_popup_item.get_labels=function (){
var lang=getLangByTable(MessageText,system.locale.language.substr(0,5));
var msg=MessageText[lang]||{};
return {yes:msg["LT_YES"],no:msg["LT_NO"],
msg:[msg["LT_CONTENT_DELETE"]]};};
var asr_menu_item={};
asr_menu_item.get_labels=function (){
var lang=getLangByTable(MessageText,system.locale.language.substr(0,5));
var msg=MessageText[lang]||{};
return [{key:msg["LT_ASR_DONE_KBD"],label:msg["LT_BT_TAP"]},
{key:msg["LT_CANCEL_KBD"],label:msg["LT_CL_BACK"]}];};
var mic_key_message={};
mic_key_message.get_labels=function (){
var lang=getLangByTable(MessageText,system.locale.language.substr(0,5));
var msg=MessageText[lang]||{};
var msg_lt="LT_SOFT_KEYBOARD_VOICE_BUTTON";
if(!system.mdl_cfg.with_touchpad_remote){
msg_lt="LT_SOFT_KEYBOARD_VOICE_BUTTON_SPHONE";}
return {msg:msg[msg_lt]};};
var SKIN={};
var skin_func={};
skin_func.size_rate_list={};
skin_func.custom_kbd_skin_path="";
skin_func.custom_kbd_img_path="";
skin_func.calc_rate=function (){};
skin_func.set_skin_info=function(info){
var skin_path=kbd_skin_path;
var img_path=kbd_img_path;
if(this.custom_kbd_skin_path){
skin_path=this.custom_kbd_skin_path;}
if(this.custom_kbd_img_path){
img_path=this.custom_kbd_img_path;}
add_package_load_path("pkg_keyboard_skin",skin_path);
prepare_package("pkg_keyboard_skin");
require("pkg_keyboard_skin");
pkg_keyboard_skin.set_kbd_img_path(img_path);
pkg_keyboard_skin.set_skin_info(info);};
skin_func.set_skin=function(){
SKIN=pkg_keyboard_skin.get_skin();
this.size_rate_list=pkg_keyboard_skin.size_rate_list;
this.calc_rate=pkg_keyboard_skin.calc_rate;
discard_package("pkg_keyboard_skin");};
function Animation(init){
this.superClass=container;
this.superClass(init);

this.count=0;
this.id=null;};
Animation.prototype=new container({});
Animation._anim_objs=new Array();
Animation._anim_objs_len=0;
Animation._anim_timer={};
Animation._anim_INTERVAL=150.0;
Animation._anim_id_seed=0;
Animation.start_timer=function (){
Animation._start_timer();};
Animation.stop_timer=function (){
Animation._stop_timer();};
Animation.redraw=function (){
for(key in Animation._anim_objs){
if(typeof Animation._anim_objs[key].do_anim=="function"){
Animation._anim_objs[key]._do_anim();}
}
if(Animation._anim_objs_len>0)
force_redraw();};
Animation._start_timer=function (){
if(Animation._anim_objs_len==1){
delete_timer(Animation._anim_timer);
append_timer(Animation._anim_timer,Animation._anim_INTERVAL,Animation.redraw);}
};
Animation._stop_timer=function (){
if(Animation._anim_objs_len<=0){
delete_timer(Animation._anim_timer);
force_redraw();}
};
Animation.free=function(){
delete_timer(Animation._anim_timer);
Animation._anim_objs=new Array();
Animation._anim_objs_len=0;
Animation._anim_timer={};
Animation._anim_INTERVAL=150.0;
Animation._anim_id_seed=0;};
Animation.prototype.anim_start=function (){
if(this.id==null){
this.count=0;
this.id=this._get_id();
Animation._anim_objs[this.id]=this;
Animation._anim_objs_len=Animation._anim_objs_len+1;
Animation._start_timer();}else {
this.count=0;}
};
Animation.prototype.anim_finish=function (){
if(this.id!=null){
Animation._anim_objs[this.id].move_to_end();
delete Animation._anim_objs[this.id];
Animation._anim_objs_len=Animation._anim_objs_len-1;
this.id=null;
this.count=0;}
Animation._stop_timer();};
Animation.prototype.cancel_anim=function (){
if(this.id!=null){
delete Animation._anim_objs[this.id];
Animation._anim_objs_len=Animation._anim_objs_len-1;
this.id=null;
this.count=0;}
Animation._stop_timer();};
Animation.prototype._get_id=function (){
if(Animation._anim_id_seed>10000){
Animation._anim_id_seed=0;}else {
Animation._anim_id_seed=Animation._anim_id_seed+1;}
return ""+Date.parse(new Date())+Animation._anim_id_seed;};
Animation.prototype._do_anim=function (){
if(typeof this.do_anim=="function"){
this.do_anim(this.count);}
this.count=this.count+1;};
Animation.prototype.do_anim=function (){

};
Animation.prototype.move_to_end=function (){

};
Animation.prototype.get_frame_rate=function (anim_speed){
return anim_speed/Animation._anim_INTERVAL;};
Animation.prototype.delta_to_integer=function (input){
if(input>=0)
return Math.ceil(input);
else
return Math.floor(input);};
function StencilManager(){
this.superClass={};};
StencilManager.prototype={};
StencilManager.prototype.create=function(){
this._last_mouse_button=null;
this._last_mouse_hit_obj=null;
this.table=[];
this._mouse_callback_symbols={
"click":"action",
"mousedown":"mousedown",
"mouseup":"mouseup",
"middle_click":"middle_click",
"middle_mousedown":"middle_mousedown",
"middle_mouseup":"middle_mouseup",
"right_click":"right_click",
"right_mousedown":"right_mousedown",
"right_mouseup":"right_mouseup",
"mouseover":"mouseover",
"mousemove":"mousemove",
"mouseout":"mouseout"
};};
StencilManager.prototype.free=function(){
this._last_mouse_button=null;
this._last_mouse_hit_obj=null;
this.table=[];};
StencilManager.prototype.do_callback_by_symbol=function (obj,symbol){
var sym=this.mouse_get_callback_symbol(symbol);
if(obj[sym] instanceof Function){
obj[sym](obj);}
};
StencilManager.prototype.mouse_get_callback_symbol=function (ev_symbol){
return this._mouse_callback_symbols[ev_symbol];};
StencilManager.prototype.mouse_do_click=function (obj,button){
this.do_callback_by_symbol(obj,"click");};
StencilManager.prototype.mouse_do_mousedown=function (obj,button){
this.do_callback_by_symbol(obj,"mousedown");};
StencilManager.prototype.mouse_do_mouseup=function (obj,button){
this.do_callback_by_symbol(obj,"mouseup");};
StencilManager.prototype.mouse_do_mouseover=function (obj,button){
this.do_callback_by_symbol(obj,"mouseover");};
StencilManager.prototype.mouse_do_mouseout=function (obj,button){
this.do_callback_by_symbol(obj,"mouseout");};
StencilManager.prototype.mouse_do_cleanup=function (obj){
obj.__mouse_last_button=0;
obj.__mouseover_button=0;};
StencilManager.prototype.mouse_check_button_ev=function (obj,button){
var lmsk=ebus.mouse.DOWN_LEFT_BUTTON;


if((obj.__mouse_last_button&lmsk)&&(button&lmsk)==0){
this.mouse_do_mouseup(obj,button);
if((obj.__mouseover_button&lmsk)==0)
this.mouse_do_click(obj,button);
obj.__mouseover_button&=~lmsk;}else if((button&lmsk)&&(obj.__mouse_last_button&lmsk)==0){
this.mouse_do_mousedown(obj,button);}
obj.__mouse_last_button=button;};
StencilManager.prototype.mouse_hook=function(arg){
var ret=false;
var button=arg[3];
var x=arg[4];
var y=arg[5];
var hit_obj=this.get_pointer_hit_obj(x,y);
if(hit_obj){
if(!this._last_mouse_hit_obj){
this.mouse_do_mouseover(hit_obj,button);
this.mouse_check_button_ev(hit_obj,button);}else if(this._last_mouse_hit_obj!=hit_obj){
this.mouse_do_mouseout(this._last_mouse_hit_obj,button);
this.mouse_do_cleanup(this._last_mouse_hit_obj);
this._last_mouse_hit_obj=null;
this.mouse_do_mouseover(hit_obj,button);
this.mouse_check_button_ev(hit_obj,button);}else {
this.mouse_check_button_ev(hit_obj,button);}
this._last_mouse_hit_obj=hit_obj;}else {
if(this._last_mouse_hit_obj){
this.mouse_do_mouseout(this._last_mouse_hit_obj,button);
this.mouse_do_cleanup(this._last_mouse_hit_obj);
this._last_mouse_hit_obj=null;}
}
this._last_mouse_button=button;};
StencilManager.prototype.set_table=function(table){
this.table=table;};
StencilManager.prototype.get_table=function(){
return this.table;};
StencilManager.prototype.get_pointer_hit_obj=function(x,y){
var hit_obj=null;
var table=this.table;
var trg_cont_n=-1;
for(var i=0;i<table.length;i++){
if(table[i].active){
trg_cont_n=i;
if(table[i].through_check){var stencil_list=table[i].stencil_list;
hit_obj=this.get_stencil_range_obj_by_list(x,y,stencil_list);
if(hit_obj)
return hit_obj;
else continue;}
break;}
if(!table[i].lt_point.y)
continue;
var cont_lt_p=table[i].lt_point;
var cont_rb_p=table[i].rb_point;
if(y<cont_rb_p.y||cont_lt_p.y<y)
continue;
if(cont_lt_p.x<=x&&x<=cont_rb_p.x){
trg_cont_n=i;
break;}
}
if(trg_cont_n==-1)
return hit_obj;
var stencil_list=table[trg_cont_n].stencil_list;
hit_obj=this.get_stencil_range_obj_by_list(x,y,stencil_list);
return hit_obj;};
StencilManager.prototype.get_stencil_range_obj_by_list=function(x,y,stencil_list){
var hit_obj=null;
for(i=0;i<stencil_list.length;i++){
if(!stencil_list[i].visible_p)
continue;
var stencil_lt_p=stencil_list[i].lt_point;
var stencil_rb_p=stencil_list[i].rb_point;
if(stencil_lt_p.x<=x&&x<=stencil_rb_p.x){
if(y<=stencil_lt_p.y&&stencil_rb_p.y<=y){
hit_obj=stencil_list[i];
break;}
}
}
return hit_obj;};
function Pointer(init){
this.superClass=Animation;
this.superClass(init);
var pointer_skin=SKIN.pointer;
this.size=pointer_skin.size;
this.width=this.size;
this.height=this.size;
this.force_visible=true;
this.pointer_icon=new gimage({width:this.width,height:this.height,
src:pointer_skin.icon});
this.components=[this.pointer_icon];}
Pointer.prototype=new Animation({});
Pointer.prototype.free=function(){
this.pointer_icon.src="";
this.components=[];};
Pointer.prototype.set_translate=function(trans){
this.translate[0]=trans[0];
this.translate[1]=trans[1];
this.translate[2]=trans[2];};
Pointer.prototype.set_pointer_position=function(x,y){
x+=Math.floor(this.width/2);
y-=Math.floor(this.height/2);
this.set_translate([x,y,0]);};
Pointer.prototype.set_visible=function(visible){
if(this.visible_p!=visible)
this.visible_p=visible;};
Pointer.prototype.set_force_visible=function (bool){
this.force_visible=bool;
if(bool){
this.components=[this.pointer_icon];}else {
this.components=[];}
};
Pointer.prototype.get_force_visible=function (){
return this.force_visible;};
var SFT_BGFrame=function(param){
this.superClass=Animation;
this.superClass({});
this.anim_speed=1.5;
this.trg_width=0;
this.trg_height=0;
this.translate=[0,0,0];
this.bg={};
this.frame={};
this.frame_size=0;
this.anim_end_hook=function(){};
this.components=[];};
SFT_BGFrame.prototype=new Animation({});
SFT_BGFrame.prototype.create=function(param){
this.bg=param.bg;
this.bg_box=new gbox({color:this.bg.color.slice(),round_enable:true});
if(this.bg.alpha!=null)
this.bg_box.color[3]=this.bg.alpha;
this.frame=param.list;
this.frame_size=param.frame_size;
this.frame_t=new gimage({height:this.frame_size,draw_type:DIRECT,src:this.frame.t});
this.frame_b=new gimage({height:this.frame_size,draw_type:DIRECT,src:this.frame.b});
this.frame_l=new gimage({width:this.frame_size,draw_type:DIRECT,src:this.frame.l});
this.frame_r=new gimage({width:this.frame_size,draw_type:DIRECT,src:this.frame.r});
this.frame_tl=new gimage({width:this.frame_size,height:this.frame_size,
draw_type:DIRECT,src:this.frame.tl});
this.frame_tr=new gimage({width:this.frame_size,height:this.frame_size,
draw_type:DIRECT,src:this.frame.tr});
this.frame_bl=new gimage({width:this.frame_size,height:this.frame_size,
draw_type:DIRECT,src:this.frame.bl});
this.frame_br=new gimage({width:this.frame_size,height:this.frame_size,
draw_type:DIRECT,src:this.frame.br});
this.resize(param);
this.components=[this.bg_box,this.frame_tl,this.frame_t,this.frame_tr,
this.frame_l,this.frame_r,this.frame_bl,this.frame_b,this.frame_br];};
SFT_BGFrame.prototype.resize=function(param){
param=param||{};
this.base_w=param.width;
this.base_h=param.height;
this.bg_box.width=this.base_w+(this.frame_size-this.bg.padding_w)*2;
this.bg_box.height=this.base_h+(this.frame_size-this.bg.padding_h)*2;
this.bg_box.round_width=this.bg.round;
this.bg_box.round_height=this.bg.round;
this.frame_t.width=this.base_w;
this.frame_t.translate[1]=(this.base_h+this.frame_size)/2;
this.frame_b.width=this.base_w;
this.frame_b.translate[1]=-(this.base_h+this.frame_size)/2;
this.frame_l.height=this.base_h;
this.frame_l.translate[0]=-(this.base_w+this.frame_size)/2;
this.frame_r.height=this.base_h;
this.frame_r.translate[0]=(this.base_w+this.frame_size)/2;
this.frame_tl.translate=[-(this.base_w+this.frame_size)/2,(this.base_h+this.frame_size)/2,0];
this.frame_tr.translate=[(this.base_w+this.frame_size)/2,(this.base_h+this.frame_size)/2,0];
this.frame_bl.translate=[-(this.base_w+this.frame_size)/2,-(this.base_h+this.frame_size)/2,0];
this.frame_br.translate=[(this.base_w+this.frame_size)/2,-(this.base_h+this.frame_size)/2,0];};
SFT_BGFrame.prototype.set_translate=function (translate){
this.translate=translate;};
SFT_BGFrame.prototype.set_bg_height=function(height){
if(height!=null&&isFinite(height)){
this.resize({
width:this.base_w,height:height
});};};
SFT_BGFrame.prototype.set_bg_alpha=function(alpha){
if(alpha!=null&&isFinite(alpha))
this.bg_box.color[3]=alpha;};
SFT_BGFrame.prototype.get_bg_width=function(){
return this.bg_box.width;};
SFT_BGFrame.prototype.get_bg_height=function(){
return this.bg_box.height;};
SFT_BGFrame.prototype.free=function (){
this.cancel_anim();
for(var i=0;i<this.components.length;i++){
if(this.components[i].src)
this.components[i].src="";
this.components[i]=null;}
this.components=[];};
SFT_BGFrame.prototype.do_resize_anim=function (param){
this.trg_width=param.width;
this.trg_height=param.height;
if(typeof param.anim_end_hook=="function")
this.anim_end_hook=param.anim_end_hook;
this.anim_start();};
SFT_BGFrame.prototype.do_anim=function(count){
var delta_w=calcDelta(this.trg_width,this.base_w,this.anim_speed);
var delta_h=calcDelta(this.trg_height,this.base_h,this.anim_speed);
this.resize({width:this.base_w+delta_w,height:this.base_h+delta_h});
if(Math.abs(delta_w)<1)
this.anim_finish();};
SFT_BGFrame.prototype.move_to_end=function(count){
this.resize({width:this.trg_width,height:this.trg_height});
this.anim_end_hook();};
function IME_TextBox(init){
this.superClass=container;
this.superClass(init);
var tbox_skin=SKIN.tbox;
this.height=skin_func.calc_rate(40);
this.width_limit=init.width;
if(typeof init.char_length_limit=="undefined"||init.char_length_limit<0){
this.char_length_limit=null;}else {
this.char_length_limit=init.char_length_limit;}

this.background=new gbox(
{
height:this.height,
color:init.bg_color
}
);

this.text_box=new gtext(
{
width:init.width,
text:init.text,
align:LEFT,
color:init.color,
font_size:skin_func.calc_rate(32)
});

this.cursor_obj=new gbox(
{
width:skin_func.calc_rate(10),
height:skin_func.calc_rate(40),
color:tbox_skin.cursor_c,
visible_p:false
});

this.cursor_text=new gtext(
{
width:this.height,
text:"",
color:tbox_skin.cursor_text_c,
visible_p:false,
font_size:skin_func.calc_rate(32)
});
this.under_bar=new gbox(
{
translate:[0,skin_func.calc_rate(-20),0],
width:100,
height:skin_func.calc_rate(2),
color:tbox_skin.ubar_c,
visible_p:false
});

this.end_cursor_obj=new gbox(
{
width:skin_func.calc_rate(8),
height:skin_func.calc_rate(40),
color:tbox_skin.end_cursor_c,
visible_p:false
});
this.components=[
this.background,
this.text_box,
this.under_bar,
this.cursor_obj,
this.cursor_text,
this.end_cursor_obj
];

this.init();
this.cursor_on=true;
this.under_bar_on=true;
this.background_on=true;
this.empty_hook=null;
this.change_text_hook=null;
if(typeof init.support_5stroke!="undefined"
&&init.support_5stroke==true){
this.SUPPORT_5STROKE=true;}else {
this.SUPPORT_5STROKE=false;}
this.password_mode=false;

this.rightToLeftToggle=false;};

IME_TextBox.prototype=new container({});
IME_TextBox.prototype.init=function (){
this.input_array=[];
this.password_array=[];
this.cursor_pos=0;
this.cursor_pos_bias=0;
this.no_appear_text_width=0;
this.no_appear_text=[];
this.no_appear_latter_text=[];
this.latter_half=[];
this.latter_pos=0;
this.firsthalf_pos=0;
this.appear_width=0;
this.cursor_left_pos=0;
this.insert_mode=false;
this.insert_to_next_mode=false;
this.pending_p=false;
this.under_bar.width=0;
this.bias_width=0;};
IME_TextBox.prototype.set_from_right_mode=function (){
this.rightToLeftToggle=true;};
IME_TextBox.prototype.set_from_left_mode=function (){
this.rightToLeftToggle=false;};
IME_TextBox.prototype.get_height=function (){
return this.height;};
IME_TextBox.prototype._get_char_width=function (character){
return get_text_width(this.cursor_text,character);};
IME_TextBox.prototype.get_text=function (){
var ret=null;
if(this.password_mode){
ret=this.password_array.join("");}else {
ret=this.input_array.join("");}
return ret;};
IME_TextBox.prototype.get_text_array=function (){
var ret=null;
if(this.password_mode){
ret=this.password_array.slice(0);}else {
ret=this.input_array.slice(0);}
return ret;}
IME_TextBox.prototype.get_text_array_left=function (){
var ret=null;
var current_pos=this.cursor_pos;
if(this.insert_mode){
current_pos--;}
if(this.password_mode){
ret=this.password_array.slice(0,current_pos);}else {
ret=this.input_array.slice(0,current_pos);}
return ret;}
IME_TextBox.prototype.get_text_array_right=function (){
var ret=null;
var current_pos=this.cursor_pos;
if(this.insert_mode){
current_pos--;}
if(this.password_mode){
ret=this.password_array.slice(current_pos);}else {
ret=this.input_array.slice(current_pos);}
return ret;}

IME_TextBox.prototype.get_cursor_position=function (){
if(this.is_end_cursor_mode()){
return this.cursor_left_pos+this.cursor_obj.width;}else {
return this.cursor_left_pos;}
}

IME_TextBox.prototype.get_cursor_width=function (){
return this.cursor_obj.width;}

IME_TextBox.prototype.get_text_width=function (){
return this.under_bar.width;}
IME_TextBox.prototype.set_text=function (text,cursor_pos){
this.init();
for(var i=0;i<text.length;i++){
if(this.password_mode){
this.password_array.push(text[i]);}else {
this.input_array.push(text[i]);}
}
if(this.password_mode){
var len=this.password_array.length;
this.input_array=this._fill_asterisk(len);}
if(cursor_pos>0&&cursor_pos<=this.input_array.length){
this.cursor_pos=cursor_pos;}else {
this.cursor_pos=this.input_array.length;}
this._update_view();};
IME_TextBox.prototype._change_under_bar_view=function (){
if(this.input_array.length>0){
this.under_bar.width=this.appear_width;
this.under_bar.translate[0]=this.appear_width/2-this.text_box.width/2;
if(this.under_bar_on){
this.under_bar.visible_p=true;}
}else {
this.under_bar.visible_p=false;}
};
IME_TextBox.prototype._change_background_view=function (){
if(this.input_array.length>0){
this.background.width=this.appear_width;
this.background.translate[0]=this.appear_width/2-this.text_box.width/2;
if(this.background_on){
this.background.visible_p=true;}
}else {
this.background.visible_p=false;}
};
IME_TextBox.prototype._change_cursor_pos=function (){
if(this.input_array.length>0){
var c_array=this.input_array.slice(0,this.cursor_pos);
var c_array_width=this._get_char_width(c_array.join(""));
var c_char=this.input_array[this.cursor_pos-1];
var c_char_width=this._get_char_width(c_char);

this.cursor_left_pos=c_array_width-this.no_appear_text_width-c_char_width;
var cursor_x_pos=0;
if(!this.rightToLeftToggle){
cursor_x_pos=c_array_width-c_char_width/2
-this.text_box.width/2-this.no_appear_text_width;}else {
cursor_x_pos=-c_array_width+c_char_width/2
+this.text_box.width/2+this.no_appear_text_width;}
this.cursor_obj.translate[0]=cursor_x_pos;
this.cursor_obj.width=c_char_width;
this.cursor_text.translate[0]=cursor_x_pos;
this.cursor_text.width=c_char_width;
setf_text(this.cursor_text,c_char);
if(!this.rightToLeftToggle){
this.end_cursor_obj.translate[0]=-this.text_box.width/2+this.appear_width
+this.end_cursor_obj.width/2;}else {
this.end_cursor_obj.translate[0]=this.text_box.width/2-this.appear_width
-this.end_cursor_obj.width/2;}
}else {
this.cursor_obj.translate[0]=0;
this.cursor_text.translate[0]=0;
this.cursor_obj.width=0;
this.cursor_text.width=0;
setf_text(this.cursor_text,"");
if(!this.rightToLeftToggle){
this.end_cursor_obj.translate[0]=-this.text_box.width/2+this.appear_width
+this.end_cursor_obj.width/2;}else {
this.end_cursor_obj.translate[0]=this.text_box.width/2-this.appear_width
-this.end_cursor_obj.width/2;}
}
this._change_cursor_visible();}
IME_TextBox.prototype.enable_password_mode=function (){
if(this.password_mode==true){
return;}
this.password_mode=true;
this.password_array=this.input_array.slice(0);
var len=this.password_array.length;
this.input_array=this._fill_asterisk(len);
this._update_view();}
IME_TextBox.prototype.disable_password_mode=function (){
if(this.password_mode==false){
return;}
this.password_mode=false;
this.input_array=this.password_array.slice(0);
this.password_array=[];
this._update_view();}
IME_TextBox.prototype.get_password_mode=function (){
return this.password_mode;};
IME_TextBox.prototype.get_cursor_visible=function (){
return this.cursor_on;}
IME_TextBox.prototype.get_end_cursor_visible=function (){
return this.end_cursor_obj.visible_p;}
IME_TextBox.prototype.is_end_cursor_mode=function (){
return !this.insert_mode;}
IME_TextBox.prototype._appear_end_cursor=function (){
this.end_cursor_obj.visible_p=true;};
IME_TextBox.prototype._disappear_end_cursor=function (){
this.end_cursor_obj.visible_p=false;};
IME_TextBox.prototype._appear_cursor=function (){
this.cursor_obj.visible_p=true;
this.cursor_text.visible_p=true;};
IME_TextBox.prototype._disappear_cursor=function (){
this.cursor_obj.visible_p=false;
this.cursor_text.visible_p=false;};
IME_TextBox.prototype.enable_cursor=function (){
this.cursor_on=true;
this._change_cursor_visible();};
IME_TextBox.prototype.disable_cursor=function (){
this.cursor_on=false;
this._change_cursor_visible();};
IME_TextBox.prototype.enable_under_bar=function (){
this.under_bar_on=true;
this.under_bar.visible_p=true;};
IME_TextBox.prototype.disable_under_bar=function (){
this.under_bar_on=false;
this.under_bar.visible_p=false;};
IME_TextBox.prototype.enable_background=function (){
this.background_on=true;
this.background.visible_p=true;};
IME_TextBox.prototype.disable_background=function (){
this.background_on=false;
this.background.visible_p=false;};
IME_TextBox.prototype.is_end=function (){
if(this.cursor_pos==this.input_array.length){
return true;}else {
return false;}
};

IME_TextBox.prototype.is_empty=function (){
console_log("[END][IME_TextBox.is_empty]length:"+this.input_array.length);
if(this.input_array.length==0){
return true;}else {
return false;}
};

IME_TextBox.prototype.is_first=function (){
if(this.cursor_pos==1){
return true;}else {
return false;}
};
IME_TextBox.prototype._adjust_text_as_firsthalf=function (){
var tmp_text="";
var tmp_array=[];
var bw=0;

this.appear_width=this._get_char_width(this.input_array.join(""));
this.no_appear_text=[];
this.no_appear_latter_text=[];
this.latter_half=[];
this.no_appear_text_width=0;
this.latter_half=this.input_array.slice(0);

for(var i=0;i<(this.firsthalf_pos-1);i++){
tmp_text=this.latter_half.shift();
this.no_appear_text.push(tmp_text);}
while(bw<this.bias_width){
tmp_text=this.latter_half.shift();
if(typeof tmp_text=="undefined"){
break;}
tmp_array.push(tmp_text);
this.no_appear_text.push(tmp_text);
this.firsthalf_pos++;
bw=this._get_char_width(tmp_array.join(""));
}

this.appear_width=this._get_char_width(this.latter_half.join(""));
while(this.appear_width>this.width_limit){
tmp_text=this.latter_half.pop();
this.no_appear_latter_text.unshift(tmp_text);
this.appear_width=this._get_char_width(this.latter_half.join(""));}
}
IME_TextBox.prototype._adjust_text_init=function (){
this.appear_width=this._get_char_width(this.input_array.join(""));
this.no_appear_text=[];
this.no_appear_latter_text=[];
this.latter_half=[];
this.no_appear_text_width=0;
this.latter_half=this.input_array.slice(0);}
IME_TextBox.prototype._adjust_text_as_latterhalf=function (){
var tmp_text="";
var tmp_array=[];
var bw=0;
while(this.latter_half.length>this.latter_pos){
tmp_text=this.latter_half.pop();
this.no_appear_latter_text.unshift(tmp_text);}

this.appear_width=this._get_char_width(this.latter_half.join(""));
while(this.appear_width>this.width_limit){
tmp_text=this.latter_half.shift();
this.no_appear_text.push(tmp_text);
this.appear_width=this._get_char_width(this.latter_half.join(""));}
}
IME_TextBox.prototype._update_text_box=function (){
this._adjust_text_init();
if(!this.rightToLeftToggle){
this.text_box.align=LEFT;}else {
this.text_box.align=RIGHT;}
if(this.appear_width>=this.width_limit
||this.bias_width>0){
if(this.firsthalf_pos>0){
this._adjust_text_as_firsthalf();}else {this._adjust_text_as_latterhalf();
if(this.bias_width>0){
var l_len=this.latter_half.length;
this.firsthalf_pos=this.latter_pos-(l_len-1);
this.latter_pos=0;
this._adjust_text_init();
this._adjust_text_as_firsthalf();}
}
setf_text(this.text_box,this.latter_half.join(""));
this.no_appear_text_width=this._get_char_width(this.no_appear_text.join(""));}else {
setf_text(this.text_box,this.input_array.join(""));}

this.bias_width=0;};

IME_TextBox.prototype.set_bias_width=function (width){
this.bias_width=width;
this._update_view();};
IME_TextBox.prototype._update_view=function (){
if(this.bias_width==0){
if(this.cursor_pos<=this.no_appear_text.length){
this.firsthalf_pos=this.cursor_pos;
this.latter_pos=0;}else if(this.cursor_pos
>=(this.input_array.length-this.no_appear_latter_text.length)){
this.firsthalf_pos=0;
this.latter_pos=this.cursor_pos;}else if(this.insert_to_next_mode){
if(this.cursor_pos
>=(this.input_array.length-this.no_appear_latter_text.length)){
this.firsthalf_pos=0;
this.latter_pos=this.cursor_pos;}
}
}

if(this.password_mode){
var len=this.password_array.length;
this.input_array=this._fill_asterisk(len);}
this._update_text_box();
this._change_cursor_pos();
this._change_under_bar_view();
this._change_background_view();};
IME_TextBox.prototype._insert_to_next_of_cursor_pos=function (array_in,text){
var array=array_in;
var latter_half=array.slice(0);
var len=array.length;
array.splice(this.cursor_pos,len-this.cursor_pos);
latter_half.splice(0,this.cursor_pos);
latter_half.unshift(text);
array=array.concat(latter_half);
return array;};
IME_TextBox.prototype._insert_to_cursor_pos=function (array_in,text){
var array=array_in;
var latter_half=array.slice(0);
var len=array.length;
array.splice(this.cursor_pos-1,len-this.cursor_pos+1);
latter_half.splice(0,this.cursor_pos-1);
latter_half.unshift(text);
array=array.concat(latter_half);
return array;};
IME_TextBox.prototype.fix_char=function (len){
var ret=false;
if(this.pending_p&&this.SUPPORT_5STROKE){
this.cursor_right();
ret=true;}
this.pending_p=false;
this._update_view();
return ret;};
IME_TextBox.prototype._fill_asterisk=function (len){
var tmp=[];
for(var i=0;i<len;i++){
tmp.push("*");}
if(this.pending_p&&this.SUPPORT_5STROKE){
tmp[this.cursor_pos-1]=this.password_array[this.cursor_pos-1];}
return tmp;};
IME_TextBox.prototype.set_5stroke_mode=function (bool){
if(bool==true){
this.SUPPORT_5STROKE=true;}else {
this.SUPPORT_5STROKE=false;
this.insert_to_next_mode=false;}
};
IME_TextBox.prototype.get_5stroke_mode=function (){
return this.SUPPORT_5STROKE;};
IME_TextBox.prototype.add_text=function (text,add_text_hook){
if(text==""||text==null||typeof text!="string"){
console.log("[ERROR] Add invalid object to IME_TextBox!");}
if(text.length>1){
for(var i=0;i<text.length;i++){
this.add_text(text[i],add_text_hook);}
return;}
if(this.char_length_limit!=null&&this.char_length_limit>0){
if(this.input_array.length>=this.char_length_limit){
console.log("[ERROR] Over char length limit!");
this.pending_p=false;
return;}
}
this.pending_p=true;
if(this.input_array.length==this.cursor_pos
&&this.insert_mode==false){
this.cursor_pos++;
if(this.password_mode){
this.password_array.push(text);}else {
this.input_array.push(text);}
if(this.SUPPORT_5STROKE){
this.insert_mode=true;
this.insert_to_next_mode=true;}
}else if(this.insert_to_next_mode==true){
if(this.password_mode){
this.password_array
=this._insert_to_next_of_cursor_pos(this.password_array,text);}else {
this.input_array
=this._insert_to_next_of_cursor_pos(this.input_array,text);}
this.cursor_pos++;}else {
if(this.password_mode){
this.password_array
=this._insert_to_cursor_pos(this.password_array,text);}else {
this.input_array
=this._insert_to_cursor_pos(this.input_array,text);}
if(this.SUPPORT_5STROKE){
this.insert_to_next_mode=true;}else {
this.cursor_pos++;}
}
if(this.change_text_hook!=null&&typeof this.change_text_hook=="function"){
this.change_text_hook();}

if(add_text_hook&&typeof add_text_hook=="function"){
add_text_hook();}
this._update_view();
return;};

IME_TextBox.prototype.replace_text=function (text){
if(this.pending_p==false){
return;}

if(text==""||text==null||typeof text!="string"){
console.log("[ERROR] Replace char of TextBox with invalid object!");}
if(this.input_array.length==this.cursor_pos){
if(this.password_mode){
this.password_array.pop();
this.password_array.push(text);}else {
this.input_array.pop();
this.input_array.push(text);}
}else {
var replace_cursor_pos=0;
if(this.SUPPORT_5STROKE){
replace_cursor_pos=this.cursor_pos-1;}else {
replace_cursor_pos=this.cursor_pos-2;}
if(this.password_mode){
this.password_array.splice(replace_cursor_pos,1,text);}else {
this.input_array.splice(replace_cursor_pos,1,text);}
}
if(this.change_text_hook!=null&&typeof this.change_text_hook=="function"){
this.change_text_hook();}
this._update_view();};
IME_TextBox.prototype.replace_romaji_text=function (rep_text,fixed_size){
var i=0;
var del_num=fixed_size;
var rep_num=rep_text.length;
var dif_num=rep_num-del_num;
var left_array=[];
var right_array=[];
var rep_array=[];
for(i=0;i<rep_num;i++){
rep_array[i]=rep_text.charAt(i);}
left_array=this.get_text_array_left();
for(i=0;i<del_num;i++){
left_array.pop();}
if(this.input_array.length==this.cursor_pos
&&this.insert_mode==false){
if(this.password_mode){
this.password_array=left_array.concat(rep_array);}else {
this.input_array=left_array.concat(rep_array);}
}else {
right_array=this.get_text_array_right();
if(this.password_mode){
this.password_array=left_array.concat(rep_array,right_array);}else {
this.input_array=left_array.concat(rep_array,right_array);}
}
this.cursor_pos+=dif_num;
if(this.change_text_hook!=null&&typeof this.change_text_hook=="function"){
this.change_text_hook();}
this._update_view();};

IME_TextBox.prototype.set_empty_hook=function (func){
this.empty_hook=func;}
IME_TextBox.prototype.set_change_text_hook=function (func){
this.change_text_hook=func;}

IME_TextBox.prototype.backspace_text=function (){
if(this.input_array.length==0){
return;}

this.pending_p=false;
if(this.cursor_pos==this.input_array.length){
if(this.password_mode){
if(this.insert_mode&&this.password_array[this.cursor_pos-2]){this.password_array.splice(this.cursor_pos-2,1);}else {this.password_array.pop();
this.insert_mode=false;}
}else {
if(this.insert_mode&&this.input_array[this.cursor_pos-2]){this.input_array.splice(this.cursor_pos-2,1);}else {this.input_array.pop();
this.insert_mode=false;}
}
this.cursor_pos--;
if(this.cursor_pos<=0){
this.cursor_pos=0;
if(this.empty_hook!=null&&typeof this.empty_hook=="function"){
append_timer(this.empty_hook,1,function(obj,count){
delete_timer(obj);
obj();});}
}
}else {
if(this.password_mode){
if(this.password_array[this.cursor_pos-2]){this.password_array.splice(this.cursor_pos-2,1);
this.cursor_pos--;}else {this.password_array.splice(this.cursor_pos-1,1);}
}else {
if(this.input_array[this.cursor_pos-2]){this.input_array.splice(this.cursor_pos-2,1);
this.cursor_pos--;}else {this.input_array.splice(this.cursor_pos-1,1);}
}
}
if(this.change_text_hook!=null&&typeof this.change_text_hook=="function"){
this.change_text_hook();}
this._update_view();
};
IME_TextBox.prototype.delete_left_text=function (){
if(this.input_array.length==0){
return;}
this.pending_p=false;
if(this.cursor_pos==this.input_array.length&&
this.insert_mode==false){
if(this.password_mode){
this.password_array.pop();}else {
this.input_array.pop();}
this.cursor_pos--;
if(this.cursor_pos<=0){
this.cursor_pos=0;
if(this.empty_hook!=null&&typeof this.empty_hook=="function"){
append_timer(this.empty_hook,1,function(obj,count){
delete_timer(obj);
obj();});}
}
}else {
if(this.cursor_pos>1){
if(this.password_mode){
this.password_array.splice(this.cursor_pos-2,1);}else {
this.input_array.splice(this.cursor_pos-2,1);}
this.cursor_pos--;}else {
this.cursor_pos=1;}
}
if(this.change_text_hook!=null&&typeof this.change_text_hook=="function"){
this.change_text_hook();}
this._update_view();};
IME_TextBox.prototype.delete_right_text=function (){
if(this.input_array.length==0){
return;}
this.pending_p=false;
if(this.cursor_pos<this.input_array.length){
if(this.password_mode){
this.password_array.splice(this.cursor_pos-1,1);}else {
this.input_array.splice(this.cursor_pos-1,1);}
this._update_view();}else if(this.cursor_pos==this.input_array.length&&
this.insert_mode==true){
this.insert_mode=false;
if(this.password_mode){
this.password_array.pop();}else {
this.input_array.pop();}
this.cursor_pos--;
if(this.cursor_pos<=0){
this.cursor_pos=0;
if(this.empty_hook!=null&&typeof this.empty_hook=="function"){
append_timer(this.empty_hook,1,function(obj,count){
delete_timer(obj);
obj();});}
}
this._update_view();
this.cursor_right();}else {
return false;}
if(this.change_text_hook!=null&&typeof this.change_text_hook=="function"){
this.change_text_hook();}
};

IME_TextBox.prototype.clear=function (){
this.cursor_obj.visible_p=false;
this.cursor_text.visible_p=false;
this.under_bar.visible_p=false;
this.background.visible_p=false;
this.init();
setf_text(this.text_box,this.input_array.join(""));};
IME_TextBox.prototype.cursor_left=function (){
if(!this.rightToLeftToggle){
return this._cursor_left();}else {
return this._cursor_right();}
};
IME_TextBox.prototype._cursor_left=function (){
this.insert_to_next_mode=false;
this.pending_p=false;
var ret=true;
if(this.insert_mode==true){
this.cursor_pos-=1;
if(this.cursor_pos<=0){
this.cursor_pos=1;
ret=false;}
}else if(this.input_array.length==0){
ret=false;}else {
this.insert_mode=true;}
this._update_view();
return ret;}
IME_TextBox.prototype.cursor_right=function (){
if(!this.rightToLeftToggle){
return this._cursor_right(true);}else {
return this._cursor_left(true);}
};
IME_TextBox.prototype._cursor_right=function (){
this.insert_to_next_mode=false;
this.pending_p=false;
var text_len=this.input_array.length;
this.cursor_pos+=1;
var ret=true;
if(this.cursor_pos>text_len){
this.cursor_pos=text_len;
if(this.insert_mode==true){
this.insert_mode=false;}else {
ret=false;}
}
this._update_view();

return ret;}
IME_TextBox.prototype._change_cursor_visible=function (obj,target_x,end_func){
if(this.cursor_on){
if(this.insert_mode){
this.cursor_obj.visible_p=true;
this.cursor_text.visible_p=true;
this.end_cursor_obj.visible_p=false;}else {
this.cursor_obj.visible_p=false;
this.cursor_text.visible_p=false;
this.end_cursor_obj.visible_p=true;}
}else {
this.cursor_obj.visible_p=false;
this.cursor_text.visible_p=false;
this.end_cursor_obj.visible_p=false;}
};
IME_TextBox.prototype._move=function (obj,target_x,end_func){
delete_timer(obj);
var delta=0;
var func=end_func;
append_timer(obj,TIMER_RESOLUTION,
function (obj,count){
delta=(target_x-obj.translate[0])/2;
if(count>=7){
delete_timer(obj);
obj.translate[0]=target_x;
if(func){
func();}
}else {
obj.translate[0]+=delta;}
force_redraw();});}
IME_TextBox.prototype.free=function (){
this.set_text("");
return;};
IME_TextBox.prototype.revive=function (){
return;};
IME_TextBox.prototype.get_text_length=function (){
return this.input_array.length;};
IME_TextBox.prototype.set_visible=function (visible){
if(this.visible_p!=visible)
this.visible_p=visible;};
IME_TextBox.prototype.get_cursor_pos=function (){
return this.cursor_pos;};
function calcDelta(to_val,from_val,anim_speed){
if(from_val>=to_val){
return Math.floor((to_val-from_val)/anim_speed);}else {
return Math.ceil((to_val-from_val)/anim_speed);}
};
function RoundItem(param){
param=param||{};
this.superClass=Animation;
this.superClass({});
this.round_item_skin=SKIN.round_item;
this.anim_speed=2;
this.mode=null;
this.trg_alpha=0;
this.translate=[0,0,0];
this.base_slope=param.slope;
this.pull_height=param.pull_height;
this.item_width=skin_func.calc_rate(this.round_item_skin.item_w);
this.item_height=skin_func.calc_rate(this.round_item_skin.item_h);
this.neon_width=skin_func.calc_rate(this.round_item_skin.neon_w);
this.neon_height=skin_func.calc_rate(this.round_item_skin.neon_h);
this.text_color=this.round_item_skin.text_c;
this.neon_color=this.round_item_skin.neon_c.slice();
this.max_neon_alpha=this.neon_color[3];
this.neon_color[3]=0;
this.NEON_BG_IMG=this.round_item_skin.neon_bg;
this.components=[];
this.neon_bg=new gimage({
width:this.neon_width,height:this.neon_height,
src:this.NEON_BG_IMG,color:this.neon_color.slice(),visible_p:false
});
this.items=new container({});
this.items.free=function (){
for(var i=0;i<this.components.length;i++){
this.components[i]=null;}
};
var free_func=function (){
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&
typeof this.components[i].free=="function"){
this.components[i].free();}
}
};
this.pull_cont=this._create_pull_cont(free_func);
this.slope_cont=new container({});
this.slope_cont.translate=[0,0,0];
this.slope_cont.rotation=[this.base_slope,0,0,-1];
this.slope_cont.components=[this.pull_cont];
this.slope_cont.free=free_func;
this.components.push(this.slope_cont);};
RoundItem.prototype=new Animation({});
RoundItem.prototype._create_pull_cont=function (free_func){
var pull_cont=new Animation({});
pull_cont.superClass=Animation;
pull_cont.superClass({});
pull_cont.anim_speed=1.5;
pull_cont.trg_height=this.pull_height;
pull_cont.translate=[0,Math.floor(pull_cont.trg_height*0.4),0];
pull_cont.rotation=[this.base_slope,0,0,1];
pull_cont.components=[this.items];
pull_cont.free=free_func;
pull_cont.do_move_height=function (){
this.anim_start();};
pull_cont.do_anim=function(count){
var delta=calcDelta(this.trg_height,this.translate[1],this.anim_speed);
this.translate[1]=this.translate[1]+delta;
if(Math.abs(delta)<1)
this.anim_finish();};
pull_cont.move_to_end=function(count){
this.translate[1]=this.trg_height;};
return pull_cont;};
RoundItem.prototype.init=function (){
this.pull_cont.do_move_height();};
RoundItem.prototype.free=function (){
this.pull_cont.cancel_anim();
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&
typeof this.components[i].free=="function"){
this.components[i].free();}
this.components[i]=null;}
this.components=null;};
RoundItem.prototype.set_cont_slope=function(slope){
this.pull_cont.rotation[0]=slope;};
RoundItem.prototype.set_item=function(param){
param=param||{};
var items_comp=[];
this.mode=param.item_data.mode;
switch(this.mode){
case "label":
items_comp=this.set_label_item(param.item_data);
break;
case "icon":
items_comp=this.set_icon_item(param.item_data);
break;
case "abc":
items_comp=this.set_abc_item(param.item_data);
break;
default:
break;}
for(i=0;i<items_comp.length;i++){
this.items.components.push(items_comp[i]);}
};
RoundItem.prototype.set_label_item=function(item_data){
var ret_array=[];
this.reset_item();
ret_array.push(this.neon_bg);
var label=item_data.label;
var s_fsize=this.calc_max_font_size({
max_w:this.item_width,base_fsize:skin_func.calc_rate(32),trg_text:label
});
this.label=new gtextbox({
width:this.item_width,height:this.item_height,
translate:[0,skin_func.calc_rate(2),0],font_size:s_fsize,
align:CENTER,valign:MIDDLE,color:this.text_color.slice(),text:label
});
ret_array.push(this.label);
return ret_array;};
RoundItem.prototype.set_icon_item=function(item_data){
var ret_array=[];
this.reset_item();
ret_array.push(this.neon_bg);
this.icon=new gimage({
width:item_data.icon_size.w,height:item_data.icon_size.h,
translate:[0,0,0],src:item_data.icon,
color:this.text_color.slice(),visible_p:false,
onload:function(obj,http_status,err_state){
this.visible_p=true;
force_redraw();}
});
ret_array.push(this.icon);
return ret_array;};
RoundItem.prototype.set_abc_item=function(item_data){
var ret_array=[];
this.reset_item();
ret_array.push(this.neon_bg);
var s_fsize=skin_func.calc_rate(24);
var s_trans_y=Math.floor(this.item_height/3/2);
this.label_up=new gtext({
width:this.item_width/2,translate:[0,s_trans_y,0],
font_size:s_fsize,align:LEFT,text:item_data.label,
color:this.text_color.slice()
});
this.label_down=new gtext({
width:this.item_width/2,translate:[0,-s_trans_y+skin_func.calc_rate(3),0],
font_size:s_fsize,align:RIGHT,text:item_data.label_next,
color:this.text_color.slice()
});
var arrow_w=skin_func.calc_rate(this.round_item_skin.arrow_w);
var arrow_h=skin_func.calc_rate(this.round_item_skin.arrow_h);
this.arrow=new gimage({
width:arrow_w,height:arrow_h,src:item_data.arrow,
translate:[Math.floor(this.label_down.width/2)
-(get_text_width(this.label_down,this.label_down.text))
-Math.floor(arrow_w*0.7),
this.label_down.translate[1],
0],
color:this.text_color.slice()});
ret_array.push(this.label_up,this.label_down,this.arrow);
return ret_array;};
RoundItem.prototype.calc_max_font_size=function(param){
var tmp_gtext=new gtext({width:1920,font_size:param.base_fsize});
var text_w=get_text_width(tmp_gtext,param.trg_text);
var size_scale=param.max_w/text_w*0.7;
var ret_fsize=param.base_fsize;
if(size_scale<1){
ret_fsize=Math.floor(param.base_fsize*size_scale);}
return ret_fsize;};
RoundItem.prototype.reset_item=function(){
var i;
if(this.items.components.length>1){
for(i=2;i<this.items.components.length;i++){
this.items.components[i]=null;}
this.items.components=[];}
this.neon_bg.width=this.neon_width;
this.neon_bg.height=this.neon_height;
this.neon_bg.visible_p=false;
this.neon_bg.color=this.neon_color.slice();};
RoundItem.prototype.do_show_neon_fast=function(){
this.neon_bg.visible_p=true;
this.move_to_end();};
RoundItem.prototype.do_show_neon_anim=function(){
this.move(this.max_neon_alpha);};
RoundItem.prototype.do_hide_neon_anim=function(){
this.move(0);};
RoundItem.prototype.move=function(alpha){
this.trg_alpha=alpha;
if(!this.neon_bg.visible_p)
this.neon_bg.visible_p=true;
this.anim_start();};
RoundItem.prototype.do_anim=function(count){
var neon_comp_alpha=this.neon_bg.color[3];
var delta=calcDelta(this.trg_alpha,neon_comp_alpha,this.anim_speed);
neon_comp_alpha=neon_comp_alpha+delta;
this.neon_bg.color[3]=neon_comp_alpha;
if(Math.abs(delta)<1)
this.anim_finish();};
RoundItem.prototype.move_to_end=function(count){
this.neon_bg.color[3]=this.trg_alpha;
if(this.trg_alpha==0){
this.neon_bg.visible_p=true;}
};
function RoundGuide(){
this.superClass=Animation;
this.superClass({});
this.round_guide_skin=SKIN.round_guide;
this.anim_speed=2;
this.trg_angle=0;
this.prev_angle=0;
this.round_count=0;
this.touchpad_counter=0;
this.touchpad_anim_margin=5;
this.touchpad_reset_timer={};};
RoundGuide.prototype=new Animation({});
RoundGuide.prototype.enter_focus=function(){
};
RoundGuide.prototype.leave_focus=function(){
};
RoundGuide.prototype.create=function(param){
param=param||{};
this.items_data=param.items_data;
this.item_max_num=param.item_max_num;
this.angle_table=[0,70,110,180,250,290];
this.round_start_func=param.round_start_hook||null;
this.round_end_func=param.round_end_hook||null;
this.bg_size=skin_func.calc_rate(this.round_guide_skin.round_bg_size);
this.ROUND_BG_IMG=this.round_guide_skin.round_bg;
this.item_pull_h_base=this.round_guide_skin.pull_h;
this.language=param.language;
this.components=[];
this.round_bg=this._create_round_bg({src:this.ROUND_BG_IMG,rotation:[0,0,0,1]});
this.components.push(this.round_bg);
this.items=[];
for(var i=0;i<this.item_max_num;i++){
var pull_height=skin_func.calc_rate(this.item_pull_h_base);
if(this.angle_table[i]!=0&&this.angle_table[i]!=180){
pull_height=Math.floor(pull_height*1.3);}
var tmp_item=new RoundItem({slope:this.angle_table[i],pull_height:pull_height});
tmp_item.set_item({item_data:this.items_data[i]});
this.items.push(tmp_item);
this.components.push(tmp_item);}
this.items[this.get_index()].do_show_neon_anim();};
RoundGuide.prototype._create_round_bg=function (param){
var round_bg=new Animation({});
round_bg.superClass=Animation;
round_bg.superClass({});
round_bg.anim_speed=1.5;
round_bg.trg_size=this.bg_size;
var init_bg_size=skin_func.calc_rate(round_bg.trg_size*0.3);
round_bg.translate=[0,0,0];
round_bg.rotation=param.rotation.slice();
round_bg.components=[
new gimage({width:init_bg_size,height:init_bg_size,src:param.src})
];
round_bg.do_resize_anim=function (){
this.anim_start();};
round_bg.do_anim=function(count){
var delta=calcDelta(this.trg_size,this.components[0].width,this.anim_speed);
this.components[0].width=this.components[0].width+delta;
this.components[0].height=this.components[0].width;
if(Math.abs(delta)<1)
this.anim_finish();};
round_bg.move_to_end=function(count){
this.components[0].width=this.trg_size;
this.components[0].height=this.trg_size;};
return round_bg;};
RoundGuide.prototype.free=function (){
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&
typeof this.components[i].free=="function"){
this.components[i].free();}
this.components[i]=null;}
this.components=null;};
RoundGuide.prototype.init=function (){
this.round_bg.do_resize_anim();
for(var i=0;i<this.items.length;i++){
this.items[i].init();}
};
RoundGuide.prototype.get_index=function(){
var tmp_index=Math.abs(this.round_count%this.item_max_num);
if(this.round_count>=0)
return tmp_index;
tmp_index=this.item_max_num-tmp_index;
if(tmp_index==this.item_max_num)
tmp_index=0;
return tmp_index;};
RoundGuide.prototype.change_item=function(item_data,trg_symbol){
var trg_index=-1;
for(var i=0;i<this.items.length;i++){
if(this.items_data[i].symbol==trg_symbol){
trg_index=i;
break;}
}
if(trg_index==-1)return;

this.items[trg_index].set_item({item_data:item_data});
if(trg_index==this.get_index()){
this.items[trg_index].do_show_neon_fast();}
};
RoundGuide.prototype.do_touchpad_anim=function(direction){
this.touchpad_counter+=direction;
delete_timer(this.touchpad_reset_timer);
if((this.touchpad_counter%this.touchpad_anim_margin)==0){
if(direction>=0){
this.clockwise_anim();}
else {
this.reverse_anim();}
}
else {
var self=this;
append_timer(this.touchpad_reset_timer,4000,function(obj,count){
delete_timer(obj);
self.touchpad_counter=0;});}
};
RoundGuide.prototype.do_round_start_func=function(){
if(typeof this.round_start_func!="function")return;
this.round_start_func();};
RoundGuide.prototype.do_round_end_func=function(){
if(typeof this.round_end_func!="function")return;
this.round_end_func();};
RoundGuide.prototype.clockwise_anim=function(){
var last_index=this.get_index();
this.round_count++;
var current_index=this.get_index();
var move_angle=this.angle_table[current_index]-this.angle_table[last_index];
if(move_angle<0)
move_angle=360+move_angle;
this.items[last_index].do_hide_neon_anim();
this.items[current_index].do_show_neon_anim();
this.move(-move_angle);};
RoundGuide.prototype.reverse_anim=function(){
var last_index=this.get_index();
this.round_count--;
var current_index=this.get_index();
var move_angle=-(this.angle_table[current_index]-this.angle_table[last_index]);
if(move_angle<0)
move_angle=360+move_angle;
this.items[last_index].do_hide_neon_anim();
this.items[current_index].do_show_neon_anim();
this.move(move_angle);};
RoundGuide.prototype.move=function(angle){
this.do_round_start_func();
this.trg_angle=this.trg_angle+angle;
this.prev_angle=this.trg_angle;
this.anim_start();};
RoundGuide.prototype.do_anim=function(count){
var delta=calcDelta(this.trg_angle,this.round_bg.rotation[0],
this.anim_speed);
this.round_bg.rotation[0]=this.round_bg.rotation[0]+delta;
if(Math.abs(delta)<1||this.prev_angle==delta)
this.anim_finish();
this.prev_angle=delta;};
RoundGuide.prototype.move_to_end=function(count){
this.round_bg.rotation[0]=this.trg_angle;
this.do_round_end_func();};
function RoundMenu(param){
this.superClass=Animation;
this.superClass({});
this.round_menu_skin=SKIN.round_menu;
var ctrl_key_skin=SKIN.ctrl_key;
var ctrl_keytop_skin=SKIN.ctrl_keytop;
this.BACKSPACE_IMG=ctrl_key_skin.backspace;
this.SETTING_IMG=ctrl_key_skin.setting;
this.ARROW_IMG=ctrl_keytop_skin.arrow_round;
this.width=param.width;
this.height=param.height;
this.kbd_bg_max_w=skin_func.calc_rate(this.round_menu_skin.bg_w);
this.kbd_bg_max_h=skin_func.calc_rate(this.round_menu_skin.bg_h);
this.kbd_bg_color=this.round_menu_skin.kbd_bg_c;
this.update_stencil_hook=function (){};
this.language=param.language;};
RoundMenu.prototype=new Animation({});
RoundMenu.prototype.create=function(param){
param=param||{};
var self=this;
this.components=[];
this.mask=new gbox({width:this.width,height:this.height,
color:[0,0,0,0],translate:[0,0,0]});
this.mask.action=function(obj){
self.select_menu_item();};
this.mask.mouseover=function(obj){};
this.mask.mouseout=function(obj){};
this.components.push(this.mask);

this._create_bg();

this.select_hook=
(param.select_hook&&typeof param.select_hook=="function")
?param.select_hook:function(){};
this.get_setting_hook=
(param.get_setting_hook&&typeof param.get_setting_hook=="function")
?param.get_setting_hook:function(){};

var setting=this.generate_setting(param.items_data);
this.items_data=setting.slice();
this.round_guide=new RoundGuide({language:this.language});
this.round_guide.create({
items_data:this.items_data,item_max_num:this.items_data.length,
round_start_hook:function(){self.round_start_hook();},
round_end_hook:function(){self.round_end_hook();}
});
this.components.push(this.round_guide);
this.init();};
RoundMenu.prototype._create_bg=function(){
var self=this;
var stg_mb_skin=SKIN.stg_menubase;
var round_guide_skin=SKIN.round_guide;
var kbd_bg_init_size=skin_func.calc_rate(round_guide_skin.round_bg_size);
var kbd_bg_frame_size=skin_func.calc_rate(stg_mb_skin.line_size);
var kbd_bg_padding=skin_func.calc_rate(stg_mb_skin.bg_padding);
this.kbd_bg=new SFT_BGFrame({});
this.kbd_bg.create({
width:kbd_bg_init_size,height:kbd_bg_init_size,frame_size:kbd_bg_frame_size,
bg:{color:this.kbd_bg_color.slice(),round:skin_func.calc_rate(stg_mb_skin.bg_round),
padding_w:kbd_bg_padding,padding_h:kbd_bg_padding},
list:{tl:stg_mb_skin.angle_tl,t:stg_mb_skin.line_t,tr:stg_mb_skin.angle_tr,
l:stg_mb_skin.line_l,r:stg_mb_skin.line_r,
bl:stg_mb_skin.angle_bl,b:stg_mb_skin.line_b,br:stg_mb_skin.angle_br}
});
this.kbd_bg.action=function (){
self.select_menu_item();};
this.components.push(this.kbd_bg);};
RoundMenu.prototype.init=function(){
this.kbd_bg.do_resize_anim({width:this.kbd_bg_max_w,height:this.kbd_bg_max_h});
this.round_guide.init();};
RoundMenu.prototype.is_open=function(){
if(this.components){
return (this.components.length>0);}
return false;};
RoundMenu.prototype.free=function (){
if(this.components==null)
return;
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&
typeof this.components[i].free=="function"){
this.components[i].free();}
this.components[i]=null;}
this.components=null;};
RoundMenu.prototype.set_translate=function (translate){
this.translate=translate;};
RoundMenu.prototype.get_translate=function (){
return this.translate.slice();};
RoundMenu.prototype.generate_setting=function (items_data){
var ret_setting=[];
var ctrl_info=this.get_setting_hook();
if(ctrl_info){
var base_setting_data=items_data.get_setting(this.language);
if(ctrl_info["backspace"]){
var tmp={mode:"icon",symbol:ctrl_info["backspace"].func,icon:this.BACKSPACE_IMG,
icon_size:ctrl_info["backspace"].icon_size};
ret_setting.push(tmp);}
if(ctrl_info["spc"]){
var tmp={mode:"label",symbol:ctrl_info["spc"].func,label:ctrl_info["spc"].text};
ret_setting.push(tmp);}
if(ctrl_info["henkan"]){
var tmp={mode:"label",symbol:ctrl_info["henkan"].func,label:ctrl_info["henkan"].text};
ret_setting.push(tmp);}
if(ctrl_info["done"]){
var tmp={mode:"label",symbol:ctrl_info["done"].func,label:ctrl_info["done"].text};
ret_setting.push(tmp);}
if(ctrl_info["kakutei"]){
var tmp={mode:"label",symbol:ctrl_info["kakutei"].func,label:ctrl_info["kakutei"].text};
ret_setting.push(tmp);}
var stg_tmp={mode:"icon",symbol:"setting",icon:this.SETTING_IMG,
icon_size:ctrl_info["setting"].icon_size};
ret_setting.push(stg_tmp);
if(base_setting_data.close){
var cls=base_setting_data.close;
var tmp={mode:cls.mode,symbol:cls.symbol,label:cls.label};
ret_setting.push(tmp);}
if(ctrl_info["char_switch"]){
var tmp={
mode:"abc",symbol:ctrl_info["char_switch"].func,label:ctrl_info["char_switch"].text,
label_next:ctrl_info["char_switch"].text_next,arrow:this.ARROW_IMG
};
ret_setting.push(tmp);}
}
return ret_setting;};
RoundMenu.prototype.set_language=function (lang){
this.language=lang;};
RoundMenu.prototype.update_keytop=function (){
console.log("[WARNING] RoundMenu.prototype.update_keytop!! (Not Implementation)");};
RoundMenu.prototype.open_menu=function (param){
this.create(param);
this.update_stencil_hook();};
RoundMenu.prototype.send_touchpad_z=function (direction){
this.round_guide.do_touchpad_anim(direction);};
RoundMenu.prototype.select_menu_item=function (){
var item_data=this.items_data[this.round_guide.get_index()];
this.select_hook(item_data.symbol);};
RoundMenu.prototype.change_char_switch_label=function (item_data,trg_symbol){
if(item_data){
var ex_item_data={
mode:"abc",symbol:item_data.func,label:item_data.text,
label_next:item_data.text_next,arrow:this.ARROW_IMG
};
this.round_guide.change_item(ex_item_data,trg_symbol);}
};
RoundMenu.prototype.change_spc_label=function (item_data,trg_symbol){
if(item_data){
var ex_item_data={mode:"label",symbol:item_data.func,
label:item_data.text};
this.round_guide.change_item(ex_item_data,trg_symbol);}
};
RoundMenu.prototype.change_done_label=function (item_data,trg_symbol){
if(item_data){
var ex_item_data={mode:"label",symbol:item_data.func,
label:item_data.text};
this.round_guide.change_item(ex_item_data,trg_symbol);}
};
RoundMenu.prototype.close_menu=function (){
this.free();
this.update_stencil_hook();};
RoundMenu.prototype.round_start_hook=function (){
};
RoundMenu.prototype.round_end_hook=function (){
};
RoundMenu.prototype.set_update_stencil_hook=function (hook){
if(typeof hook=="function")
this.update_stencil_hook=hook;};
RoundMenu.prototype.enter_focus=function (){
};
RoundMenu.prototype.leave_focus=function (){
this.close_menu();};
RoundMenu.prototype.gen_stencil_list=function(c_point){
var list=[];
if(this.is_open()){
list.push(this.gen_mask_stencil(c_point));}
return list;};
RoundMenu.prototype.gen_mask_stencil=function(c_point){
var stencil=this.mask;
var mask_c_point=c_point.slice();
var mask_tran=stencil.translate;
for(var i=0;i<mask_c_point.length;i++){
mask_c_point[i]+=mask_tran[i];}
stencil.c_point=mask_c_point;
var mask_w=stencil.width;
var mask_h=stencil.height;
var lt_point={x:mask_c_point[0]-mask_w/2,y:mask_c_point[1]+mask_h/2};
var rb_point={x:mask_c_point[0]+mask_w/2,y:mask_c_point[1]-mask_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
return stencil;};
RoundMenu.prototype.key_hook=function(up_down,key){
if(up_down!=KEY_PRESS)return true;
return false;};
function ConfirmItem(){
this.superClass=Animation;
this.superClass({});
this.round_item_skin=SKIN.round_item;
this.anim_speed=2;
this.trg_alpha=0;
this.index=0;
this.translate=[0,0,0];
this.item_width=skin_func.calc_rate(this.round_item_skin.item_w);
this.item_height=skin_func.calc_rate(this.round_item_skin.item_h);
this.neon_width=skin_func.calc_rate(this.round_item_skin.neon_w);
this.neon_height=skin_func.calc_rate(this.round_item_skin.neon_h);
this.text_color=this.round_item_skin.text_c;
this.neon_color=this.round_item_skin.neon_c.slice();
this.max_neon_alpha=this.neon_color[3];
this.neon_color[3]=0;
this.NEON_BG_IMG=this.round_item_skin.neon_bg;
this.width=this.neon_width;
this.height=this.neon_height;
this.components=[];
this.action_hook=function(){};
this.mouseover_hook=function(){};
this.pointer_control_hook=function(){};};
ConfirmItem.prototype=new Animation({});
ConfirmItem.prototype.create=function (param){
if(this.components.length>0)return;
var self=this;
this.index=param.index;
if(typeof param.action_hook=="function")
this.action_hook=param.action_hook;
if(typeof param.mouseover_hook=="function")
this.mouseover_hook=param.mouseover_hook;
if(typeof param.pointer_control_hook=="function")
this.pointer_control_hook=param.pointer_control_hook;

if(param.translate)this.translate=param.translate.slice();
this.neon_bg=new gimage({
width:this.neon_width,height:this.neon_height,
src:this.NEON_BG_IMG,color:this.neon_color.slice(),visible_p:false
});
var label=param.label||"";
var s_fsize=this.calc_max_font_size({
max_w:this.item_width,base_fsize:skin_func.calc_rate(42),trg_text:label
});
this.label=new gtextbox({
width:this.item_width,height:this.item_height,
translate:[0,skin_func.calc_rate(2),0],font_size:s_fsize,
align:CENTER,valign:MIDDLE,color:this.text_color.slice(),text:label
});
this.mouse_stencil=new gbox({
width:this.width,height:this.height,color:[0,0,0,0]
});
this.mouse_stencil.action=function(obj){
self._action();};
this.mouse_stencil.mouseover=function(obj){
self.mouseover_func();
self.enter_focus();};
this.mouse_stencil.mouseout=function(obj){
self.leave_focus();};
this.components=[this.neon_bg,this.label,this.mouse_stencil];};
ConfirmItem.prototype.free=function (){
this.neon_bg.src="";
setf_text(this.label,"");
this.components.splice(0,this.components.length);};
ConfirmItem.prototype.calc_max_font_size=function(param){
var tmp_gtext=new gtext({width:1920,font_size:param.base_fsize});
var text_w=get_text_width(tmp_gtext,param.trg_text);
var size_scale=param.max_w/text_w*0.7;
var ret_fsize=param.base_fsize;
if(size_scale<1){
ret_fsize=Math.floor(param.base_fsize*size_scale);}
return ret_fsize;};
ConfirmItem.prototype.enter_focus=function(){
this.move(this.max_neon_alpha);
this.pointer_control_func();};
ConfirmItem.prototype.leave_focus=function(){
this.move(0);};
ConfirmItem.prototype.move=function(alpha){
this.trg_alpha=alpha;
if(!this.neon_bg.visible_p)
this.neon_bg.visible_p=true;
this.anim_start();};
ConfirmItem.prototype.do_anim=function(count){
var neon_comp_alpha=this.neon_bg.color[3];
var delta=calcDelta(this.trg_alpha,neon_comp_alpha,this.anim_speed);
neon_comp_alpha=neon_comp_alpha+delta;
this.neon_bg.color[3]=neon_comp_alpha;
if(Math.abs(delta)<1)
this.anim_finish();};
ConfirmItem.prototype.move_to_end=function(count){
this.neon_bg.color[3]=this.trg_alpha;
if(this.trg_alpha==0){
this.neon_bg.visible_p=true;}
};
ConfirmItem.prototype.set_visible=function(bool){
if(this.visible_p!=bool)
this.visible_p=bool;
if(this.mouse_stencil.visible_p!=bool)
this.mouse_stencil.visible_p=bool;};
ConfirmItem.prototype.get_visible=function(){
return this.visible_p;};
ConfirmItem.prototype.set_translate=function (translate){
this.translate=translate;};
ConfirmItem.prototype.get_translate=function (){
return this.translate.slice();};
ConfirmItem.prototype.get_width=function(){
return this.width;};
ConfirmItem.prototype._action=function(){
if(typeof this.action_hook=="function")
this.action_hook();};
ConfirmItem.prototype.mouseover_func=function (){
if(typeof this.mouseover_hook=="function")
this.mouseover_hook(this.index);};
ConfirmItem.prototype.pointer_control_func=function (){
if(typeof this.pointer_control_hook=="function"){
var position=this.calc_pointer_position();
this.pointer_control_hook(position.x,position.y);}
};
ConfirmItem.prototype.calc_pointer_position=function (){
var position={};
position.x=this.translate[0]+Math.floor(this.width/5);
position.y=this.translate[1]+ -(Math.floor(this.height*0.2));
return position;};
ConfirmItem.prototype.enter_action=function(){
this._action();};
ConfirmItem.prototype.key_hook=function(up_down,key){
switch(key){
case TXK_ENTER:
this.enter_action();
return true;}
return false;};
function ConfirmPopup(param){
this.superClass=Animation;
this.superClass({});
this.confirm_popup_item=confirm_popup_item;
this.round_menu_skin=SKIN.round_menu;
this.round_item_skin=SKIN.round_item;
this.width=param.width;
this.height=param.height;
this.kbd_bg_max_w=param.bg_w;
this.kbd_bg_max_h=param.bg_h;
this.kbd_bg_color=this.round_menu_skin.kbd_bg_c;
this.message_fsize=skin_func.calc_rate(46);
this.message_align=param.message_align;
this.text_color=this.round_item_skin.text_c;
this.neon_color=this.round_item_skin.neon_c;
this.index=1;
this.type=0;this.type_list=["allclear"];
this.done_hook=function(){};
this.cancel_hook=function(){};
this.update_stencil_hook=function (){};
this.open_anim_end_hook=function(){};
this.pointer_control_hook=function(){};
this.language=param.language;};
ConfirmPopup.prototype=new Animation({});
ConfirmPopup.prototype.create=function(param){
if(this.components.length>0)return;
param=param||{};
var self=this;
this.components=[];
var labels=this.confirm_popup_item.get_labels();
var done_action=function(){
self.done_hook();};
var cancel_action=function(){
self.cancel_hook();};
var mouseover=function(index){
self.adjust_cursor(index);};
var pointer_control=function (x,y){
x=self.translate[0]+x;
y=self.translate[1]+y;
self.pointer_control_hook(x,y);};

if(param.confirm_type!=undefined){
for(var i in this.type_list){
if(this.type_list[i]==param.confirm_type){
this.mode=i;
break;}
}
}
if(param.done_hook||typeof param.done_hook=="function")
this.done_hook=param.done_hook;
if(param.cancel_hook||typeof param.cancel_hook=="function")
this.cancel_hook=param.cancel_hook;

this.mask=new gbox({width:this.width,height:this.height,
color:[0,0,0,0],translate:[0,0,0]});
this.mask.action=function(obj){};
this.mask.mouseover=function(obj){};
this.components.push(this.mask);

this._create_bg();
var message_w=Math.floor(this.kbd_bg_max_w/10*9);
var message_h=Math.floor(this.kbd_bg_max_h/5*3);
this.message=new gtextbox({
width:message_w,height:message_h,translate:[0,message_h/4,0],
font_size:this.message_fsize,text:labels.msg[this.type],
align:this.message_align,color:this.text_color,visible_p:false
});
this.components.push(this.message);
this.done_btn=new ConfirmItem();
this.cancel_btn=new ConfirmItem();
this.item_list=[this.done_btn,this.cancel_btn];
this.done_btn.create({
index:0,label:labels.yes,
action_hook:done_action,mouseover_hook:mouseover,
pointer_control_hook:pointer_control
});
this.done_btn.set_visible(false);
this.cancel_btn.create({
index:1,label:labels.no,
action_hook:cancel_action,mouseover_hook:mouseover,
pointer_control_hook:pointer_control
});
var btn_w=this.done_btn.get_width();
var btn_space=skin_func.calc_rate(20);
this.done_btn.set_translate([-(btn_w/ 2 + btn_space), -(message_h /2),0]);
this.cancel_btn.set_translate([btn_w/ 2 + btn_space, -(message_h /2),0]);

this.cancel_btn.set_visible(false);
this.components.push(this.done_btn,this.cancel_btn);

this.init();};
ConfirmPopup.prototype._create_bg=function(){
var self=this;
var stg_mb_skin=SKIN.stg_menubase;
var kbd_bg_init_w=Math.floor(this.kbd_bg_max_w/20*19);
var kbd_bg_init_h=Math.floor(this.kbd_bg_max_h/20*19);
var kbd_bg_frame_size=skin_func.calc_rate(stg_mb_skin.line_size);
var kbd_bg_padding=skin_func.calc_rate(stg_mb_skin.bg_padding);
this.kbd_bg=new SFT_BGFrame({});
this.kbd_bg.create({
width:kbd_bg_init_w,height:kbd_bg_init_h,frame_size:kbd_bg_frame_size,
bg:{color:this.kbd_bg_color.slice(),round:skin_func.calc_rate(stg_mb_skin.bg_round),
padding_w:kbd_bg_padding,padding_h:kbd_bg_padding},
list:{tl:stg_mb_skin.angle_tl,t:stg_mb_skin.line_t,tr:stg_mb_skin.angle_tr,
l:stg_mb_skin.line_l,r:stg_mb_skin.line_r,
bl:stg_mb_skin.angle_bl,b:stg_mb_skin.line_b,br:stg_mb_skin.angle_br}
});
this.components.push(this.kbd_bg);};
ConfirmPopup.prototype.init=function(){
var self=this;
var show_func=function(){
self.open_anim_end_hook();
self.message.visible_p=true;
self.done_btn.set_visible(true);
self.cancel_btn.set_visible(true);
common_key.set_cursor(self,self.item_list[self.index]);};
this.kbd_bg.do_resize_anim({
width:this.kbd_bg_max_w,height:this.kbd_bg_max_h,
anim_end_hook:show_func
});};
ConfirmPopup.prototype.is_open=function(){
if(this.components){
return (this.components.length>0);}
return false;};
ConfirmPopup.prototype.free=function (){
if(this.components==null)
return;
this.index=1;
this.type=0;
this.done_hook=function(){};
this.cancel_hook=function(){};

for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&
typeof this.components[i].free=="function"){
this.components[i].free();}
this.components[i]=null;}
this.components=[];};
ConfirmPopup.prototype.set_translate=function (translate){
this.translate=translate;};
ConfirmPopup.prototype.get_translate=function (){
return this.translate.slice();};
ConfirmPopup.prototype.set_language=function (lang){
this.language=lang;};
ConfirmPopup.prototype.open=function (param){
this.create(param);
this.update_stencil_hook();};
ConfirmPopup.prototype.close=function (){
this.free();
this.update_stencil_hook();};
ConfirmPopup.prototype.round_start_hook=function (){};
ConfirmPopup.prototype.round_end_hook=function (){};
ConfirmPopup.prototype.set_update_stencil_hook=function (hook){
if(typeof hook=="function")
this.update_stencil_hook=hook;};
ConfirmPopup.prototype.adjust_cursor=function (index){
this.index=index;
common_key.set_cursor(this,this.item_list[this.index]);
for(var i=0;i<this.item_list.length;i++){if(i!=this.index)
this.item_list[i].leave_focus();}
};
ConfirmPopup.prototype.enter_focus=function (){
};
ConfirmPopup.prototype.leave_focus=function (){
this.close();};
ConfirmPopup.prototype.left_action=function(){
if(0<this.index){
this.index--;
common_key.set_cursor(this,this.item_list[this.index]);
return true;};
return false;};
ConfirmPopup.prototype.right_action=function(){
if(this.index<this.item_list.length-1){
this.index++;
common_key.set_cursor(this,this.item_list[this.index]);
return true;};
return false;};
ConfirmPopup.prototype.set_open_anim_end_hook=function(hook){
if(typeof hook=="function")
this.open_anim_end_hook=hook;};
ConfirmPopup.prototype.set_pointer_control_hook=function(hook){
if(typeof hook=="function")
this.pointer_control_hook=hook;};
ConfirmPopup.prototype.gen_stencil_list=function(c_point){
var list=[];
if(this.is_open()){
list.push(this.gen_mask_stencil(c_point));
var item_list=this.gen_items_stencil(c_point);
list=item_list.concat(list);}
return list;};
ConfirmPopup.prototype.gen_mask_stencil=function(c_point){
var stencil=this.mask;
var mask_c_point=c_point.slice();
var mask_tran=stencil.translate;
for(var i=0;i<mask_c_point.length;i++){
mask_c_point[i]+=mask_tran[i];}
stencil.c_point=mask_c_point;
var mask_w=stencil.width;
var mask_h=stencil.height;
var lt_point={x:mask_c_point[0]-mask_w/2,y:mask_c_point[1]+mask_h/2};
var rb_point={x:mask_c_point[0]+mask_w/2,y:mask_c_point[1]-mask_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
return stencil;};
ConfirmPopup.prototype.gen_items_stencil=function(c_point){
var list=[];
var item_list=this.item_list;
for(var i=0;i<item_list.length;i++){
var stencil=item_list[i].mouse_stencil;
var stencil_c_point=c_point.slice();
var stencil_tran=item_list[i].get_translate();
for(var k=0;k<stencil_c_point.length;k++)
stencil_c_point[k]+=stencil_tran[k];
stencil.c_point=stencil_c_point;
var item_w=stencil.width;
var item_h=stencil.height;
var lt_point={x:stencil.c_point[0]-item_w/2,y:stencil.c_point[1]+item_h/2};
var rb_point={x:stencil.c_point[0]+item_w/2,y:stencil.c_point[1]-item_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
list.push(stencil);}
return list;};
ConfirmPopup.prototype.key_hook=function(up_down,key){
if(up_down!=KEY_PRESS)return true;
var ret=false;
if(!this.message.visible_p)return false;

if(this.cursor&&typeof this.cursor.key_hook=="function"){
ret=this.cursor.key_hook(up_down,key);
if(ret)return true;}
switch(key){
case TXK_LEFT:
return this.left_action();
case TXK_RIGHT:
return this.right_action();}
return false;};
function UnderMask(param){
this.superClass=container;
this.superClass({});
this.width=param.width;
this.height=param.height;
this.color=param.color.slice();
this.translate=[0,0,0];
this.action_hook=function(){};};
UnderMask.prototype=new container({});
UnderMask.prototype.create=function(action_hook){
if(this.components.length>0)return;
var self=this;
this.components=[];
this.mouse_stencil=new gbox({
width:this.width,height:this.height,color:this.color});
this.mouse_stencil.action=function(obj){self.action_hook();};
this.mouse_stencil.mouseover=function(obj){};
this.mouse_stencil.mouseout=function(obj){};
this.components.push(this.mouse_stencil);
this.action_hook=action_hook;
this.init();};
UnderMask.prototype.init=function(){};
UnderMask.prototype.free=function (){
if(this.components==null)
return;
for(var i=0;i<this.components.length;i++){
this.components[i]=null;}
this.components=[];};
UnderMask.prototype.get_width=function (){
return this.width;};
UnderMask.prototype.get_height=function (){
return this.height;};
UnderMask.prototype.get_translate=function (){
return this.translate.slice();};
UnderMask.prototype.gen_stencil_list=function(c_point){
var list=[];
var stencil=this.mouse_stencil;
var ktop_c_point=c_point.slice();
var ktop_tran=stencil.translate;
for(var k=0;k<ktop_c_point.length;k++){
ktop_c_point[k]+=ktop_tran[k];}
stencil.c_point=ktop_c_point;
var ktop_w=stencil.width;
var ktop_h=stencil.height;
var lt_point={x:ktop_c_point[0]-ktop_w/2,y:ktop_c_point[1]+ktop_h/2};
var rb_point={x:ktop_c_point[0]+ktop_w/2,y:ktop_c_point[1]-ktop_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
list.push(stencil);
return list;};
UnderMask.prototype.key_hook=function(up_down,key){
return false;};
function ASRMenu(param){
this.superClass=container;
this.superClass({});
this.asr_menu_item=asr_menu_item;
this.round_menu_skin=SKIN.round_menu;
this.round_item_skin=SKIN.round_item;
this.stg_mb_skin=SKIN.stg_menubase;
this.width=param.width;
this.max_height=(typeof param.max_height=="number")
?param.max_height:skin_func.calc_rate(200);
this.translate=[0,0,0];
this.tl_pos=param.tl_pos;
this.text_fsize=skin_func.calc_rate(32);
this.text_align=param.message_align||LEFT;
this.text_color=this.round_item_skin.text_c;
this.text_span=skin_func.calc_rate(10);
this.menu_w=0;
this.menu_h=0;
this.bg_color=this.round_menu_skin.kbd_bg_c;
this.bg_frame_size=skin_func.calc_rate(this.stg_mb_skin.line_size);
this.is_done_timing_key_up=false;
this.select_box=null;
this.asr_list=[];
this.auto_timer={};
this.auto_timer_s=4000;
this.show_menu_hook=function(){};
this.action_hook=function(){};
this.set_colorkey_grayout_hook=function(){};
this.update_stencil_hook=function (){};
this.pointer_control_hook=function(){};
this.language=param.language;};
ASRMenu.prototype=new Animation({});
ASRMenu.prototype.create=function(param){
if(this.components.length>0)return;
param=param||{};
if(!param.asr_list||!(param.asr_list instanceof Array))return;
var self=this;
this.components=[];
this.labels=this.asr_menu_item.get_labels();
var mouseover=function(index){
self.adjust_cursor(index);};
var pointer_control=function (x,y){
x=self.translate[0]+x;
y=self.translate[1]+y;
self.pointer_control_hook(x,y);};
this.asr_list=param.asr_list;
this.mask_array=[];
this.mask=new gbox({color:[0,0,0,0]});
this.mask.action=function(obj){};
this.mask.mouseover=function(obj){};
this.mask_complement=new gbox({color:[0,0,0,0]});
this.mask_complement.action=function(obj){};
this.mask_complement.mouseover=function(obj){};
this.components.push(this.mask,this.mask_complement);
this.mask_array.push(this.mask,this.mask_complement);
this.menu=this._create_menu();
var comp_w=this.width-(this.menu_w+this.bg_frame_size*4);
var comp_tran=[this.width/2,0,0]
this.complement=this._create_complement({width:comp_w,translate:comp_tran});
this.components.push(this.menu,this.complement);
this.mask.width=this.menu.bg.get_bg_width();
this.mask.height=this.menu.bg.get_bg_height();
this.mask_complement.width=this.complement.bg.get_bg_width();
this.mask_complement.height=this.complement.bg.get_bg_height();
this.mask_complement.translate=comp_tran.slice();
this.translate[0]=this.tl_pos[0]+this.menu_w/2+this.bg_frame_size;
this.translate[1]=this.tl_pos[1]-this.menu_h/2-this.bg_frame_size;
this.init();};
ASRMenu.prototype._create_menu=function(){
var label_cont=this._create_label_cont();
var bg=this._create_bg(this.menu_w,this.menu_h);
var menu=new container({components:[bg,label_cont]});
menu.label_cont=label_cont;
menu.bg=bg;
menu.free=function(){
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&
typeof this.components[i].free=="function"){
this.components[i].free();}
}
};
return menu;};
ASRMenu.prototype._create_label_cont=function(){
var fsize=this.text_fsize;
var h=fsize+skin_func.calc_rate(8);
var dummy_tbox=new gtextbox({width:1920,height:fsize,font_size:fsize});
var max_w=0;
var labels=this.labels;
var len=labels.length;
var label_cont=new container({components:[]});
label_cont.free=function(){
for(var i=0;i<this.components.length;i++){
if(typeof this.components[i]=="string"){
setf_text(this.components[i],"");}
}
};
var text_list=[];
for(var i=0;i<len;i++){
var text="";
if(this.text_align==RIGHT)
text=labels[i].label+" : "+labels[i].key;
else
text=labels[i].key+" : "+labels[i].label;
text_list.push(text);
var w=get_text_width(dummy_tbox,text);
if(max_w<w)
max_w=w;};
max_w+=skin_func.calc_rate(10);
for(i=0;i<len;i++){
var label=new gtextbox({
width:max_w,height:h,align:this.text_align,valign:MIDDLE,
color:this.text_color.slice(),font_size:fsize,text:text_list[i],
translate:[0,-((fsize+this.text_span)*i),0]
});
label_cont.components.push(label);}
this.menu_w=max_w;
this.menu_h=fsize*len+this.text_span*(len-1);
label_cont.translate=[0,(this.menu_h-fsize)/2,0];
return label_cont;};
ASRMenu.prototype._create_complement=function(param){
param=param||{};
if(typeof param.width!="number")param.width=0;
var self=this;
var comp_cont=this._create_complement_cont(param);
var bg=this._create_bg(param.width,100);
var complement=new container({components:[bg,comp_cont],translate:param.translate||[0,0,0]});
complement.comp_cont=comp_cont;
complement.bg=bg;
complement.set_fit_height_by_text=function(text){
if(typeof text=="string"){
this.comp_cont.tbox.height=self.max_height;
var height=get_text_font_height(this.comp_cont.tbox,text);
if(height>self.max_height)height=self.max_height;
this.comp_cont.tbox.height=height;
this.bg.set_bg_height(height);
this.height=this.bg.get_bg_height();}
};
complement.set_text=function(text){
if(typeof text=="string")
setf_text(comp_cont.tbox,text);};
complement.set_pos_y=function(y){
this.translate[1]=y;};
complement.free=function(){
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&
typeof this.components[i].free=="function"){
this.components[i].free();}
}
};
return complement;};
ASRMenu.prototype._create_complement_cont=function(param){
var tbox=new gtextbox({
width:param.width,height:100,align:this.text_align,
color:this.text_color.slice(),font_size:this.text_fsize
});
var comp_cont=new container({components:[tbox]});
comp_cont.tbox=tbox;
comp_cont.free=function(){
for(var i=0;i<this.components.length;i++){
if(typeof this.components[i]=="string"){
setf_text(this.components[i],"");}
}
};
return comp_cont;};
ASRMenu.prototype._create_bg=function(width,height){
var skin=this.stg_mb_skin;
var bg_padding=skin_func.calc_rate(skin.bg_padding);
var bg=new SFT_BGFrame({});
bg.create({
width:width||0,height:height||0,frame_size:this.bg_frame_size,
bg:{color:this.bg_color.slice(),round:skin_func.calc_rate(skin.bg_round),
padding_w:bg_padding,padding_h:bg_padding},
list:{tl:skin.angle_tl,t:skin.line_t,tr:skin.angle_tr,
l:skin.line_l,r:skin.line_r,
bl:skin.angle_bl,b:skin.line_b,br:skin.angle_br}
});
return bg;};
ASRMenu.prototype.init=function(){
this.select_box.clear();
this.select_box.show(this.asr_list,null,true);
this.select_box.enter_focus();
this.update_asr_text();
this.start_auto_timer();};
ASRMenu.prototype.is_open=function(){
if(this.components){
return (this.components.length>0);}
return false;};
ASRMenu.prototype.free=function (){
if(this.components==null)
return;
this.stop_auto_timer();
this.select_box=null;
this.asr_list=[];
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&
typeof this.components[i].free=="function"){
this.components[i].free();}
this.components[i]=null;}
this.components=[];};
ASRMenu.prototype.set_translate=function (translate){
this.translate=translate;};
ASRMenu.prototype.get_translate=function (){
return this.translate.slice();};
ASRMenu.prototype.set_language=function (lang){
this.language=lang;};
ASRMenu.prototype.get_position=function (){
return this.select_box.get_position();};
ASRMenu.prototype.in_current_cursor=function (){
this.select_box.in_current_cursor();};
ASRMenu.prototype.out_current_cursor=function (){
this.select_box.out_current_cursor();};
ASRMenu.prototype.set_select_box=function (obj){
this.select_box=obj;};
ASRMenu.prototype.open=function (param){
this.create(param);
this.set_colorkey_grayout(true);
this.update_stencil_hook();
this.show_menu_hook(true);};
ASRMenu.prototype.close=function (){
this.show_menu_hook(false);
this.select_box.clear();
this.in_current_cursor();
this.set_colorkey_grayout(false);
this.free();
this.update_stencil_hook();};
ASRMenu.prototype.round_start_hook=function (){};
ASRMenu.prototype.round_end_hook=function (){};
ASRMenu.prototype.set_show_menu_hook=function (hook){
if(typeof hook=="function")
this.show_menu_hook=hook;};
ASRMenu.prototype.set_action_hook=function (hook){
if(typeof hook=="function")
this.action_hook=hook;};
ASRMenu.prototype.set_asr_set_colorkey_grayout_hook=function (hook){
if(typeof hook=="function")
this.set_colorkey_grayout_hook=hook;};
ASRMenu.prototype.set_update_stencil_hook=function (hook){
if(typeof hook=="function")
this.update_stencil_hook=hook;};
ASRMenu.prototype.adjust_cursor=function (index){};
ASRMenu.prototype.enter_focus=function (){
this.in_current_cursor();};
ASRMenu.prototype.leave_focus=function (){
this.out_current_cursor();};
ASRMenu.prototype.update_asr_text=function(){
this.stop_auto_timer();
var text=this.asr_list[this.get_position()];
this.complement.set_fit_height_by_text(text);
this.complement.set_text(text);
var pos_y=(this.mask.height-this.complement.height)/2;
this.complement.set_pos_y(pos_y);
this.mask_complement.translate[1]=pos_y;
this.mask_complement.height=this.complement.height;};
ASRMenu.prototype.set_colorkey_grayout=function(bool){
this.set_colorkey_grayout_hook(bool);};
ASRMenu.prototype.left_action=function(){
this.select_box.slide_left();
this.update_asr_text();
return true;};
ASRMenu.prototype.right_action=function(){
this.select_box.slide_right();
this.update_asr_text();
return true;};
ASRMenu.prototype.enter_action=function(){
this.action_hook(this.asr_list[this.get_position()]);
return true;};
ASRMenu.prototype.gen_stencil_list=function(c_point){
var list=[];
if(this.is_open()){
list=list.concat(this.gen_mask_stencil(c_point));}
return list;};
ASRMenu.prototype.gen_mask_stencil=function(c_point){
var list=[];
for(var i=0;i<this.mask_array.length;i++){
var stencil=this.mask_array[i];
var mask_c_point=c_point.slice();
var mask_tran=stencil.translate;
for(var k=0;k<mask_c_point.length;k++){
mask_c_point[k]+=mask_tran[k]+this.translate[k];}
stencil.c_point=mask_c_point;
var mask_w=stencil.width;
var mask_h=stencil.height;
var lt_point={x:mask_c_point[0]-mask_w/2,y:mask_c_point[1]+mask_h/2};
var rb_point={x:mask_c_point[0]+mask_w/2,y:mask_c_point[1]-mask_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
list.push(stencil);}
return list;};
ASRMenu.prototype.send_touchpad_z=function(direction){
var last_pos=this.get_position();
this.select_box.send_touchpad_z(direction);
if(last_pos!=this.get_position())
this.update_asr_text();};
ASRMenu.prototype.start_auto_timer=function(){
var self=this;
append_timer(this.auto_timer,this.auto_timer_s,function(obj,count){
delete_timer(obj);
self.auto_timer_func();});};
ASRMenu.prototype.stop_auto_timer=function(){
delete_timer(this.auto_timer);};
ASRMenu.prototype.auto_timer_func=function(){
this.enter_action();};
ASRMenu.prototype.set_done_timing=function (timing){
if(timing&&timing=="UP"){
this.is_done_timing_key_up=true;}else {
this.is_done_timing_key_up=false;}
};
ASRMenu.prototype.key_hook=function(up_down,key){
if(key==TXK_ENTER){
if(up_down==KEY_DOWN)return true;
if(this.is_done_timing_key_up){
if(up_down==KEY_PRESS)return true;}else {
if(up_down==KEY_UP)return true;}
}else {
if(up_down!=KEY_PRESS)return true;}
var ret=false;
if(this.cursor&&typeof this.cursor.key_hook=="function"){
ret=this.cursor.key_hook(up_down,key);
if(ret)return true;}
switch(key){
case TXK_LEFT:
return this.left_action();
case TXK_RIGHT:
return this.right_action();
case TXK_ENTER:
return this.enter_action();}
return false;};
function KeyItem(param){
if(!param)return;
this.superClass=Animation;
this.superClass({});
this.sel_bar_btn_skin=SKIN.sel_bar_btn||{};
this.BTN_IMG_PATH=this.sel_bar_btn_skin.btn;
this.IMG_PATH=param.icon_path||"";
this.spring_constant=2.0;
this.frame_rate=this.get_frame_rate(100.0);
this.display=(param.display!=undefined)?param.display:true;
this.width=(this.display)?skin_func.calc_rate(this.sel_bar_btn_skin.btn_w):0;
this.height=(this.display)?skin_func.calc_rate(this.sel_bar_btn_skin.btn_h):0;
this.color_w=0;
this.color_h=0;
this.translate=[0,0,0];
this.COLOR_LABEL=this.sel_bar_btn_skin.btn_arrow_c;
this.color_padding=this.sel_bar_btn_skin.padding;
this.def_alpha=0;
this.sel_alpha=0;
this.COLOR_DEF=this.sel_bar_btn_skin.btn_def_c;
this.COLOR_SEL=this.sel_bar_btn_skin.btn_sel_c;
this.icon_size=skin_func.calc_rate(30);
this.action_hook=function(){};
this.mouseover_hook=function(){};
this.pointer_control_hook=function(){};
this.language=param.language;
this.labels={};
if(param.menu_item_obj&&typeof param.menu_item_obj.get_labels=="function")
this.labels=param.menu_item_obj.get_labels();};
KeyItem.prototype=new Animation({});
KeyItem.prototype.create=function(action_hook,
mouseover_hook,
pointer_control_hook){
if(this.components.length>0)return;
var self=this;
this.components=[];
if(!this.display)return;
var pointer_control=function (x,y){
x=self.translate[0]+x;
y=self.translate[1]+y;
self.pointer_control_hook(x,y);};
this.base=this._create_base();
this.components.push(this.base);
this.mouse_stencil=new gbox({
width:this.width,height:this.height,color:[0,0,0,0]});
this.mouse_stencil.action=function(obj){
self.action_hook();};
this.mouse_stencil.mouseover=function(obj){
self.mouseover_hook();
self.enter_focus();};
this.mouse_stencil.mouseout=function(obj){
self.leave_focus();};
this.components.push(this.mouse_stencil);
this.action_hook=action_hook;
this.mouseover_hook=mouseover_hook;
this.pointer_control_hook=pointer_control_hook;
this.init();};
KeyItem.prototype._create_base=function(){
var base=new container({});
this.color_w=this.width-skin_func.calc_rate(this.color_padding*2);
this.color_h=this.height-skin_func.calc_rate(this.color_padding*2);
var color_round=skin_func.calc_rate(this.sel_bar_btn_skin.round);
this.color_bg=new gbox({
width:this.color_w,height:this.color_h,round_enable:true,round_width:color_round,
round_height:color_round,color:this.COLOR_DEF.slice()
});
this.color_neon=new gbox({
width:this.color_w,height:this.color_h,round_enable:true,round_width:color_round,
round_height:color_round,color:this.COLOR_SEL.slice(),visible_p:false
});
this.btn_obj=new gimage({
width:this.width,height:this.height,src:this.BTN_IMG_PATH
});
this.icon=new gimage({
width:this.icon_size,height:this.mic_icon_size,src:this.IMG_PATH,
color:this.COLOR_LABEL.slice()
});
base.components.push(this.color_bg,this.color_neon,this.btn_obj,this.icon);
base.free=function(){
for(var i=0;i<this.components.length;i++)
if(this.components[i] instanceof gimage)
this.components[i].src="";};
return base;};
KeyItem.prototype.init=function(){};
KeyItem.prototype.free=function (){
if(this.components==null)
return;
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&
typeof this.components[i].free=="function"){
this.components[i].free();}
this.components[i]=null;}
this.components=[];};
KeyItem.prototype.get_width=function (){
return this.width;};
KeyItem.prototype.get_height=function (){
return this.height;};
KeyItem.prototype.set_translate=function (translate){
this.translate=translate;};
KeyItem.prototype.get_translate=function (){
return this.translate.slice();};
KeyItem.prototype.set_language=function (lang){
this.language=lang;};
KeyItem.prototype.is_display=function (){
return this.display;};
KeyItem.prototype.set_action_hook=function (hook){
if(typeof hook=="function")
this.action_hook=hook;};
KeyItem.prototype.set_update_stencil_hook=function (hook){
if(typeof hook=="function")
this.update_stencil_hook=hook;};
KeyItem.prototype.enter_focus=function (){
if(!this.color_neon.visible_p)
this.color_neon.visible_p=true;
this.def_alpha=0;
this.sel_alpha=this.COLOR_SEL[3];
this.pointer_control_func();
this.anim_start();};
KeyItem.prototype.leave_focus=function (){
this.color_bg.visible_p=true;
this.def_alpha=this.COLOR_DEF[3];
this.sel_alpha=0;
this.anim_start();};
KeyItem.prototype.do_anim=function (){
var delta_def_alpha=((this.def_alpha-this.color_bg.color[3])/this.spring_constant)/this.frame_rate;
this.color_bg.color[3]=this.color_bg.color[3]+this.delta_to_integer(delta_def_alpha);
var delta_sel_alpha=((this.sel_alpha-this.color_neon.color[3])/this.spring_constant)/this.frame_rate;
this.color_neon.color[3]=this.color_neon.color[3]+this.delta_to_integer(delta_sel_alpha);
if(Math.abs(delta_def_alpha)<0.1)
this.anim_finish();};
KeyItem.prototype.move_to_end=function (){
this.color_bg.color[3]=this.def_alpha;
this.color_neon.color[3]=this.sel_alpha;
if(this.def_alpha==0){
this.color_bg.visible_p=false;}
else if(this.sel_alpha==0){
this.color_neon.visible_p=false;}
};
KeyItem.prototype.pointer_control_func=function (){
if(typeof this.pointer_control_hook=="function"){
var position=this.calc_pointer_position();
this.pointer_control_hook(position.x,position.y);}
};
KeyItem.prototype.calc_pointer_position=function (){
var position={};
position.x=this.translate[0]+Math.floor(this.width/2)-20;
position.y=this.translate[1]+ -(Math.floor(this.height*0.2));
return position;};
KeyItem.prototype.enter_action=function(){return false;};
KeyItem.prototype.return_action=function(){return false;};
KeyItem.prototype.gen_stencil_list=function(c_point){
var list=[];
if(!this.display)
return list;
var stencil=this.mouse_stencil;
var ktop_c_point=c_point.slice();
var ktop_tran=stencil.translate;
for(var k=0;k<ktop_c_point.length;k++){
ktop_c_point[k]+=ktop_tran[k];}
stencil.c_point=ktop_c_point;
var ktop_w=stencil.width;
var ktop_h=stencil.height;
var lt_point={x:ktop_c_point[0]-ktop_w/2,y:ktop_c_point[1]+ktop_h/2};
var rb_point={x:ktop_c_point[0]+ktop_w/2,y:ktop_c_point[1]-ktop_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
list.push(stencil);
return list;};
KeyItem.prototype.key_hook=function(up_down,key){
if(up_down!=KEY_PRESS)return true;
var ret=false;
if(this.cursor&&typeof this.cursor.key_hook=="function"){
ret=this.cursor.key_hook(up_down,key);
if(ret)return true;}
switch(key){
case TXK_ENTER:
return this.enter_action();
case TXK_RETURN:
return this.return_action();}
return false;};
function MicKey(param){
this.superClass=KeyItem;
this.superClass(param);
this.msg_width=param.msg_width;
this.msg_span=param.msg_span;
this.msg_align=param.msg_align||LEFT;
this.show_timer={};
this.show_timer_s=3000;};
MicKey.prototype=new KeyItem();
MicKey.prototype.init=function(){
this.msg_label={};
this.msg_bg={};
this.msg_cont=this._create_msg_cont();
this.components.push(this.msg_cont);};
MicKey.prototype._create_msg_cont=function(){
var msg_cont=new container({});
msg_cont.free=function(){
for(var i=0;i<this.components.length;i++){
if(this.components[i] instanceof gimage)
this.components[i].src="";
if(this.components[i] instanceof gtextbox)
setf_text(this.components[i],"");}
this.components=[];};
msg_cont.set_visible=function(visible){
if(this.visible_p!=visible)
this.visible_p=visible;};
msg_cont.is_show=function(){
return this.visible_p;};
msg_cont.set_visible(false);
return msg_cont;};
MicKey.prototype.enter_focus=function (){
if(!this.color_neon.visible_p)
this.color_neon.visible_p=true;
this.def_alpha=0;
this.sel_alpha=this.COLOR_SEL[3];
this.pointer_control_func();
this.anim_start();};
MicKey.prototype.leave_focus=function (){
this.finish_show_timer();
this.color_bg.visible_p=true;
this.def_alpha=this.COLOR_DEF[3];
this.sel_alpha=0;
this.anim_start();};
MicKey.prototype.gen_msg=function(){
if(this.msg_cont.components.length>0)return;
var stg_mb_skin=SKIN.stg_menubase;
var bg_padding=skin_func.calc_rate(stg_mb_skin.bg_padding/2);
var bg_frame_size=skin_func.calc_rate(stg_mb_skin.line_size/2);
var label_t=this.labels.msg||"";
var label_w=this.msg_width-bg_frame_size*2;
var label_h=0;
var fsize=skin_func.calc_rate(32);
var dummy_tbox=new gtextbox({
width:label_w,height:1080,align:this.msg_align,size:fsize,text:label_t
});
var label_dim=get_dimension_textbox(dummy_tbox);
label_w=label_dim[0];
label_h=label_dim[1];
this.msg_label=new gtextbox({
width:label_w,height:label_h,color:this.COLOR_LABEL.slice(),
algin:this.msg_align,size:fsize,text:label_t
});
this.msg_bg=new SFT_BGFrame({});
this.msg_bg.create({
width:label_w,height:label_h,frame_size:bg_frame_size,
bg:{color:this.COLOR_DEF.slice(),round:skin_func.calc_rate(stg_mb_skin.bg_round),
padding_w:bg_padding,padding_h:bg_padding},
list:{tl:stg_mb_skin.angle_tl,t:stg_mb_skin.line_t,tr:stg_mb_skin.angle_tr,
l:stg_mb_skin.line_l,r:stg_mb_skin.line_r,
bl:stg_mb_skin.angle_bl,b:stg_mb_skin.line_b,br:stg_mb_skin.angle_br}
});
this.msg_cont.components=[this.msg_bg,this.msg_label];
var bg_w=this.msg_bg.get_bg_width();
var bg_h=this.msg_bg.get_bg_height();
var bg_x=-(bg_w-this.color_w)/2;
var bg_y=(bg_h+this.color_h)/2+this.msg_span;
this.msg_cont.translate=[bg_x,bg_y,0];
this.msg_cont.set_visible(true);};
MicKey.prototype.free_msg=function(){
this.msg_cont.free();
this.msg_cont.set_visible(false);
force_redraw();};
MicKey.prototype.is_show_msg_cont=function(){
return this.msg_cont.is_show();};
MicKey.prototype.enter_action=function(){
if(!this.is_show_msg_cont()){
this.gen_msg();
this.start_show_timer();}else {
this.finish_show_timer();}
return true;};
MicKey.prototype.return_action=function(){
if(this.is_show_msg_cont()){
this.finish_show_timer();
return true;}
return false;};
MicKey.prototype.start_show_timer=function(){
var self=this;
append_timer(this.show_timer,this.show_timer_s,function(obj,count){
self.finish_show_timer();});};
MicKey.prototype.stop_show_timer=function(){
delete_timer(this.show_timer);};
MicKey.prototype.finish_show_timer=function(){
this.stop_show_timer();
this.free_msg();};
function CloseKey(param){
this.superClass=KeyItem;
this.superClass(param);};
CloseKey.prototype=new KeyItem();
CloseKey.prototype.enter_action=function(){
this.action_hook();
return true;};
function SFT_KeyTop(){
this.superClass=Animation;
this.superClass({});

this.keytop_skin=SKIN.keytop;
this.width=skin_func.calc_rate(this.keytop_skin.width);
this.height=skin_func.calc_rate(this.keytop_skin.height);
this.spring_constant=2.0;
this.frame_rate=this.get_frame_rate(100.0);
this.def_alpha=0;
this.sel_alpha=0;
this.COLOR_DEF=this.keytop_skin.def_c;
this.COLOR_SEL=this.keytop_skin.sel_c;
this.col=0;
this.row=0;
this.COLOR_TEXT=this.keytop_skin.text_c;
this.font_size=skin_func.calc_rate(32);
this.action_hook=function(){};
this.mouseover_hook=function(){};
this.pointer_control_hook=function(){};};
SFT_KeyTop.prototype=new Animation({});
SFT_KeyTop.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_KeyTop.prototype.create=function (text,key_border_obj,col,row){
var this_obj=this;
this.col=col;
this.row=row;
var color_w=this.width-skin_func.calc_rate(this.keytop_skin.color_padding_w*2);
var color_h=this.height-skin_func.calc_rate(this.keytop_skin.color_padding_h*2);
var color_round=skin_func.calc_rate(this.keytop_skin.round);
this.color_bg=new gbox({width:color_w,height:color_h,
round_enable:true,round_width:color_round,round_height:color_round,
color:this.COLOR_DEF.slice()});
this.color_neon=new gbox({width:color_w,height:color_h,
round_enable:true,round_width:color_round,round_height:color_round,
color:this.COLOR_SEL.slice(),visible_p:false});
this.color_neon.color[3]=0;
this.components.push(this.color_bg,this.color_neon);
this.key_border_cont=new container({
components:[key_border_obj]
});
this.components.push(this.key_border_cont);
this.text=new gtextbox({width:color_w,height:color_h,text:text,
color:this.COLOR_TEXT.slice(),
align:CENTER,valign:MIDDLE,font_size:this.font_size});
this.components.push(this.text);
this.mouse_stencil=new gbox({width:this.width,height:this.height,
color:[0,0,0,0]
});
this.mouse_stencil.action=function(obj){
this_obj._action();};
this.mouse_stencil.mouseover=function(obj){
this_obj.mouseover_func();
this_obj.enter();};
this.mouse_stencil.mouseout=function(obj){
this_obj.leave();};
this.components.push(this.mouse_stencil);
this.components.push(this.allow_cursor);};
SFT_KeyTop.prototype.free=function (){
setf_text(this.text,"");
this.key_border_cont=null;
this.components=[];};
SFT_KeyTop.prototype.update_keytop=function (text){
if(this.text.text!=text)
setf_text(this.text,text);
this.text.translate[0]=0;
this.text.translate[1]=0;
this.text.translate[2]=0;};
SFT_KeyTop.prototype.set_text_pos_offset=function (pos){
if(pos[0])
this.text.translate[0]=pos[0];
if(pos[1])
this.text.translate[1]=pos[1];
if(pos[2])
this.text.translate[2]=pos[2];};
SFT_KeyTop.prototype.enter=function (){
if(!this.color_neon.visible_p)
this.color_neon.visible_p=true;
this.def_alpha=0;
this.sel_alpha=this.COLOR_SEL[3];
this.pointer_control_func();
this.anim_start();};
SFT_KeyTop.prototype.leave=function (){
this.color_bg.visible_p=true;
this.def_alpha=this.COLOR_DEF[3];
this.sel_alpha=0;
this.anim_start();};
SFT_KeyTop.prototype.do_anim=function (){
var delta_def_alpha=((this.def_alpha-this.color_bg.color[3])/this.spring_constant)/this.frame_rate;
this.color_bg.color[3]=this.color_bg.color[3]+this.delta_to_integer(delta_def_alpha);
var delta_sel_alpha=((this.sel_alpha-this.color_neon.color[3])/this.spring_constant)/this.frame_rate;
this.color_neon.color[3]=this.color_neon.color[3]+this.delta_to_integer(delta_sel_alpha);
if(Math.abs(delta_def_alpha)<0.1)
this.anim_finish();};
SFT_KeyTop.prototype.move_to_end=function (){
this.color_bg.color[3]=this.def_alpha;
this.color_neon.color[3]=this.sel_alpha;
if(this.def_alpha==0){
this.color_bg.visible_p=false;}
else if(this.sel_alpha==0){
this.color_neon.visible_p=false;}
};
SFT_KeyTop.prototype.is_enter=function (){
return (this.color_neon.color[3]==this.COLOR_SEL[3]
||(this.def_alpha==0&&this.sel_alpha==this.COLOR_SEL[3]));};
SFT_KeyTop.prototype._action=function (){
if(typeof this.action_hook=="function"){
this.action_hook(this.text.text);}else {
console.log("[WARNING] action_hook is not function type.");}
};
SFT_KeyTop.prototype.mouseover_func=function (){
if(typeof this.mouseover_hook=="function"){
this.mouseover_hook(this.col,this.row);}
};
SFT_KeyTop.prototype.pointer_control_func=function (){
if(typeof this.pointer_control_hook=="function"){
var position=this.calc_pointer_position();
this.pointer_control_hook(position.x,position.y);}
};
SFT_KeyTop.prototype.add_action_hook=function (hook){
this.action_hook=hook;};
SFT_KeyTop.prototype.add_mouseover_hook=function (hook){
this.mouseover_hook=hook;};
SFT_KeyTop.prototype.add_pointer_control_hook=function (hook){
this.pointer_control_hook=hook;};
SFT_KeyTop.prototype.get_col=function (){
return this.col;};
SFT_KeyTop.prototype.get_row=function (){
return this.row;};
SFT_KeyTop.prototype.calc_pointer_position=function (){
var position={};
position.x=this.translate[0]+Math.floor(this.width/2)-20;
position.y=this.translate[1]+ -(Math.floor(this.height*0.2));
return position;};
SFT_KeyTop.prototype.enable_stencil=function (){
this.mouse_stencil.visible_p=true;};
SFT_KeyTop.prototype.disable_stencil=function (){
this.mouse_stencil.visible_p=false;};
function SFT_SoftKeyboard(param){
param=param||{};
this.superClass=Animation;
this.superClass({});
this.soft_kbd_skin=SKIN.soft_kbd;
this.keytop_skin=SKIN.keytop;
this.key_width=skin_func.calc_rate(this.keytop_skin.width);
this.key_height=skin_func.calc_rate(this.keytop_skin.height);
this.key_margin_width=skin_func.calc_rate(this.soft_kbd_skin.margin_w);
this.key_margin_height=skin_func.calc_rate(this.soft_kbd_skin.margin_h);
this.language=param.language;
this.keytop_action=function(){};
this.keytop_mouseover=function(){};
this.key_item=key_item;
if(this.language=="zh-TW"){
this.bpmf_list=null;
this.bpmf_init();}
if(this.language=="zh-CN"){
this.ZHCN_MODE_LEFT=0;
this.ZHCN_MODE_RIGHT=1;
this.ZHCN_ARROW_KEY={left:"<-",right:"->"};
this.ZHCN_KEYS=[
["","","abc","def","","","@.,1","abc2","def3",""],
["","ghi","jkl","mno","","","ghi4","jkl5","mno6",""],
["","pqrs","tuv","wxyz","<-","->","pqrs7","tuv8","wxyz9",""],
["","","","","","","","0","",""]
];
this.ZHCN_NUM_TABLE=[
["","","2","3","","","1","2","3",""],["","4","5","6","","","4","5","6",""],
["","7","8","9","","","7","8","9",""],["","","","","","","","0","",""]
];
this.ZHCN_SMALL_ITEMS=[
["0"],
["@",".",",","1","!","?",";",":","-","_","'","\"","(",")","/","~","=","#","$","%","&","|","{","}","[","]"],
["a","b","c","2"],
["d","e","f","3"],
["g","h","i","4"],
["j","k","l","5"],
["m","n","o","6"],
["p","q","r","s","7"],
["t","u","v","8"],
["w","x","y","z","9"],
[]
];
this.ZHCN_L_ARROW_POS={col:2,row:4};
this.ZHCN_R_ARROW_POS={col:2,row:5};
this.zhcn_mode=this.ZHCN_MODE_LEFT;}
};
SFT_SoftKeyboard.prototype=new Animation({});
SFT_SoftKeyboard.prototype.init=function (){
this.keytop_array=[];
this.keytop_block_array=[];
this.current_col=0;
this.current_row=0;
this.mode_number=0;
this.components=[];};
SFT_SoftKeyboard.prototype._create_keyboard_param=function (){
var ret=this.calc_col_row(this.key_item[this.language][0].key);
this.NUM_ROW=ret.row;
this.NUM_COL=ret.col;
this.width=(this.key_width*this.NUM_ROW)
+(this.key_margin_width*(this.NUM_ROW-1));
this.height=(this.key_height*this.NUM_COL)
+(this.key_margin_height*(this.NUM_COL-1));
this.key_border=new gimage({
width:this.key_width,height:this.key_height,translate:[0,0,0],
src:this.soft_kbd_skin.key_border
});
this.set_init_cursor(this.language);};
SFT_SoftKeyboard.prototype.SUPPORTED_COL_ROW=[
{col_row:[4,10]},{col_row:[5,13]}
];
SFT_SoftKeyboard.prototype.calc_col_row=function (text){
var ret={col:4,row:10};
var len=this.SUPPORTED_COL_ROW.length;
var text_len=text.length;
var result=0;
for(var i=0;i<len;i++){
var col=this.SUPPORTED_COL_ROW[i].col_row[0];
var row=this.SUPPORTED_COL_ROW[i].col_row[1];
if(text_len<=col*row){
ret.col=col;
ret.row=row;
return ret;}
}

console.log("[ERROR] No supported size.");
return ret;};
SFT_SoftKeyboard.prototype.get_width=function (){
return this.width;};
SFT_SoftKeyboard.prototype.get_height=function (){
return this.height;};
SFT_SoftKeyboard.prototype.enter_focus=function (){
this.enter_key(this.current_col,this.current_row);};
SFT_SoftKeyboard.prototype.leave_focus=function (){
this.leave_key(this.current_col,this.current_row);};
SFT_SoftKeyboard.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_SoftKeyboard.prototype.get_translate=function (){
return this.translate;};
SFT_SoftKeyboard.prototype.create=function (mode_number,keytop_action_hook,
keytop_mouseover_hook,
pointer_control_hook){
this.init();
this.keytop_action=keytop_action_hook;
this.keytop_mouseover=keytop_mouseover_hook;
this.keytop_pointer_control=pointer_control_hook;
this._create_keyboard_param();
this._create(mode_number);};
SFT_SoftKeyboard.prototype._create=function (mode_number){
var self=this;
this.mode_number=mode_number?mode_number:0;
if(this.language=="zh-CN"){
this.zhcn_mode=this.ZHCN_MODE_LEFT;
this.zhcn_bg=this._create_zhcn_bg();
this.zhcn_bg.set_visible(false);
this.components.push(this.zhcn_bg);}
var keytop_mouseover=function (col,row){
self.force_leave_nonactive_keytop(col,row);
self.keytop_mouseover(col,row);};
var keytop_pointer_control=function (x,y){
x=self.translate[0]+x;
y=self.translate[1]+y;
self.keytop_pointer_control(x,y);};
var base_x_pos=-this.width/2+this.key_width/2;
var base_y_pos=this.height/2-this.key_height/2;
var keytop_width=this.key_width+this.key_margin_width;
var keytop_height=this.key_height+this.key_margin_height;
for(var i=0;i<this.NUM_COL;i++){
for(var j=0;j<this.NUM_ROW;j++){
var ktop=new SFT_KeyTop();
var ktop_x=base_x_pos+keytop_width*j;
var ktop_y=base_y_pos-keytop_height*i;
var item=this.key_item[this.language][this.mode_number];
var text=item["key"][i*this.NUM_ROW+j];
if(text==" ")text="";
ktop.create(text,this.key_border,i,j);
ktop.add_action_hook(this.keytop_action);
ktop.add_mouseover_hook(keytop_mouseover);
ktop.add_pointer_control_hook(keytop_pointer_control);
ktop.set_translate([ktop_x,ktop_y,0]);
if(item.offset_y){
var offset_y=item["offset_y"][text];
ktop.set_text_pos_offset([0,offset_y,0]);}
this.keytop_array.push(ktop);
this.components.push(ktop);
this.keytop_block_array.push(1);}
}
};
SFT_SoftKeyboard.prototype.free=function (){
for(var i=0;i<this.keytop_array.length;i++){
if(this.keytop_array[i].free&&typeof this.keytop_array[i].free=="function"){
this.keytop_array[i].free();}
}
this.key_border.src="";
this.components=[];};
SFT_SoftKeyboard.prototype._create_zhcn_bg=function (){
var bg_cont_w=skin_func.calc_rate(this.soft_kbd_skin.zhcn_bg_w);
var bg_cont_h=skin_func.calc_rate(this.soft_kbd_skin.zhcn_bg_h);
var bg_cont_r=skin_func.calc_rate(this.soft_kbd_skin.zhcn_bg_r);
var bg_cont_margin=skin_func.calc_rate(6);
var bg_cont=new container({});
bg_cont.def_tran_x=skin_func.calc_rate(280);
bg_cont.translate=[-bg_cont.def_tran_x,0,0];
bg_cont.bg_out=new gbox({
width:bg_cont_w,height:bg_cont_h,
round_enable:true,round_width:bg_cont_r,round_height:bg_cont_r,
color:this.soft_kbd_skin.zhcn_bg_out_c.slice()
});
bg_cont.bg_in=new gbox({
width:bg_cont_w-bg_cont_margin,height:bg_cont_h-bg_cont_margin,
round_enable:true,round_width:bg_cont_r,round_height:bg_cont_r,
color:this.soft_kbd_skin.zhcn_bg_in_c.slice()
});
bg_cont.components=[bg_cont.bg_out,bg_cont.bg_in];
bg_cont.set_visible=function(visible){
if(this.visible_p!=visible)
this.visible_p=visible;};
bg_cont.set_translate_by_pos=function(pos){
if(!pos)return;
if(pos=="LEFT")
this.translate=[-this.def_tran_x,0,0];
else if(pos=="RIGHT")
this.translate=[this.def_tran_x,0,0];};
return bg_cont;};
SFT_SoftKeyboard.prototype.set_language=function (lang){
this.language=lang;};
SFT_SoftKeyboard.prototype.get_current_mode=function (){
return this.mode_number;};
SFT_SoftKeyboard.prototype.get_keytop_block_array=function (){
return this.keytop_block_array.slice();};
SFT_SoftKeyboard.prototype.get_token=function (text){
var item=this.key_item[this.language][this.mode_number];
if(item.token)
return item.token[text];
return null;};
SFT_SoftKeyboard.prototype.get_dakuten=function (text){
var item=this.key_item[this.language][this.mode_number];
if(item.dakuten)
return item.dakuten[text];
return null;};
SFT_SoftKeyboard.prototype.get_handakuten=function (text){
var item=this.key_item[this.language][this.mode_number];
if(item.handakuten)
return item.handakuten[text];
return null;};
SFT_SoftKeyboard.prototype.update_keytop=function (mode_number){
this.mode_number=mode_number?mode_number:0;
if(this.zhcn_bg){
if(this.is_zhcn_kbd_mode()){
this.zhcn_mode=this.ZHCN_MODE_LEFT;
this.zhcn_bg.set_visible(true);
this.zhcn_bg.set_translate_by_pos("LEFT");
if(this.keytop_array[(this.current_col*this.NUM_ROW+this.current_row)].is_enter()){
this.leave_key(this.current_col,this.current_row);
this.set_position(this.ZHCN_L_ARROW_POS);
this.enter_key(this.current_col,this.current_row);}
}else {
this.zhcn_bg.set_visible(false);}
}
for(var i=0;i<this.NUM_COL;i++){
for(var j=0;j<this.NUM_ROW;j++){
var item=this.key_item[this.language][this.mode_number];
var text;
if(this.is_zhcn_kbd_mode()){
text=this.ZHCN_KEYS[i][j];}else {
text=item["key"][i*this.NUM_ROW+j];
if(text==" "){
text="";}
}
this.keytop_array[this.NUM_ROW*i+j].update_keytop(text);
if(item.offset_y){
var offset_y=item["offset_y"][text];
this.keytop_array[this.NUM_ROW*i+j].set_text_pos_offset([0,offset_y,0]);}
}
}
};
SFT_SoftKeyboard.prototype.force_leave_nonactive_keytop=function (col,row){
var len=this.keytop_array.length;
for(var i=0;i<len;i++){
var target=this.keytop_array[i];
var tcol=target.get_col();
var trow=target.get_row();
if(target.is_enter()
&&!(tcol==col&&trow==row)){
target.leave();}
}
};
SFT_SoftKeyboard.prototype.is_mouse_over=function (x,y){
var left_limit=this.translate[0]-(this.width/2);
var right_limit=this.translate[0]+(this.width/2);
var top_limit=this.translate[1]+(this.height/2);
var bottom_limit=this.translate[1]-(this.height/2);
if(x<left_limit||x>right_limit)
return false;
if(y>top_limit||y<bottom_limit)
return false;
return true;};
SFT_SoftKeyboard.prototype.enter_key=function (col,row){
var obj=this.keytop_array[(col*this.NUM_ROW+row)];
obj.enter();};
SFT_SoftKeyboard.prototype.leave_key=function (col,row){
var obj=this.keytop_array[(col*this.NUM_ROW+row)];
obj.leave();};
SFT_SoftKeyboard.prototype.enable_stencil=function (){
var len=this.keytop_array.length;
for(var i=0;i<len;i++){
this.keytop_array[i].enable_stencil();}
};
SFT_SoftKeyboard.prototype.disable_stencil=function (){
var len=this.keytop_array.length;
for(var i=0;i<len;i++){
this.keytop_array[i].disable_stencil();}
};
SFT_SoftKeyboard.prototype.add_keytop_action=function (hook){
this.keytop_action=hook;};

SFT_SoftKeyboard.prototype.set_init_cursor=function (lang){
var pos={};
switch(lang){
case "ja-JP":
pos.col=0;
pos.row=this.NUM_ROW-1;
break;
default:
pos.col=0;
pos.row=0;
break;}
this.set_position(pos);};
SFT_SoftKeyboard.prototype.set_position=function (pos){
if(!pos||pos.col==null||pos.row==null)
return;
this.current_col=pos.col;
this.current_row=pos.row;};
SFT_SoftKeyboard.prototype.get_current_column=function (){
return this.current_col;};
SFT_SoftKeyboard.prototype.get_current_row=function (){
return this.current_row;};
SFT_SoftKeyboard.prototype.is_position_tl=function (){
if(this.current_col==0&&this.current_row==0)
return true;
return false;};
SFT_SoftKeyboard.prototype.is_position_tr=function (){
if(this.current_col==0&&this.current_row==this.NUM_ROW-1)
return true;
return false;};
SFT_SoftKeyboard.prototype.is_position_zhcn_left=function (){
var zhcn_l=this.ZHCN_L_ARROW_POS;
if(this.current_col==zhcn_l.col&&this.current_row==zhcn_l.row)
return true;
return false;};
SFT_SoftKeyboard.prototype.is_position_zhcn_right=function (){
var zhcn_r=this.ZHCN_R_ARROW_POS;
if(this.current_col==zhcn_r.col&&this.current_row==zhcn_r.row)
return true;
return false;};
SFT_SoftKeyboard.prototype.set_position_to_top_col=function (){
this.set_position({col:0,row:this.current_row});};
SFT_SoftKeyboard.prototype.do_keytop_action_by_pos=function (col,row){
var obj=this.keytop_array[(col*this.NUM_ROW+row)];
obj._action();};
SFT_SoftKeyboard.prototype.check_init_enterd=function (){
if(this.keytop_array[0].is_enter()){
this.leave_key(0,0);}
};
SFT_SoftKeyboard.prototype.get_zhcn_arrow_key=function (){
return this.ZHCN_ARROW_KEY;};
SFT_SoftKeyboard.prototype.get_zhcn_mode=function (){
return this.zhcn_mode;};
SFT_SoftKeyboard.prototype.set_zhcn_t9_mode=function (){
this.zhcn_bg.set_translate_by_pos("LEFT");
this.zhcn_mode=this.ZHCN_MODE_LEFT;
force_redraw();};
SFT_SoftKeyboard.prototype.set_zhcn_mobileinput_mode=function (){
this.zhcn_bg.set_translate_by_pos("RIGHT");
this.zhcn_mode=this.ZHCN_MODE_RIGHT;
force_redraw();};
SFT_SoftKeyboard.prototype.character_input=function (ch){
if(this.is_zhcn_kbd_mode())
this.keytop_action(ch);};
SFT_SoftKeyboard.prototype.set_cursor_by_num=function (num,ch){
this.leave_key(this.current_col,this.current_row);
var cur_pos=this.convert_num_to_pos(num);
if(cur_pos)
this.set_position(cur_pos);
if(this.zhcn_mode==this.ZHCN_MODE_RIGHT){
var trg_ktop=this.keytop_array[this.NUM_ROW*this.current_col+this.current_row];
trg_ktop.update_keytop(ch);}
this.enter_key(this.current_col,this.current_row);};
SFT_SoftKeyboard.prototype.set_cursor_back=function (trg_pos){
if(!this.is_zhcn_kbd_mode())return;
if(!trg_pos||trg_pos.col==null||trg_pos.row==null)return;
var text=this.ZHCN_KEYS[trg_pos.col][trg_pos.row];
var trg_ktop=this.keytop_array[this.NUM_ROW*trg_pos.col+trg_pos.row];
trg_ktop.update_keytop(text);
var self=this;
var set_pos=function(){
if(self.zhcn_mode==self.ZHCN_MODE_RIGHT)
self.set_position(self.ZHCN_R_ARROW_POS);
else
self.set_position(self.ZHCN_L_ARROW_POS);};
this.leave_key(this.current_col,this.current_row);
set_pos();
this.enter_key(this.current_col,this.current_row);};
SFT_SoftKeyboard.prototype.convert_num_to_pos=function (num){
if(!this.is_zhcn_kbd_mode())
return null;
var searched=false;
var range_num=this.NUM_ROW/2;
var start_pos=this.zhcn_mode*range_num;
var cur_pos={col:0,row:0};
for(var i=0;i<this.NUM_COL;i++){
for(var k=start_pos;k<start_pos+range_num;k++){
var trg=this.ZHCN_NUM_TABLE[i][k].toString();
if(trg=="")continue;
if(trg==num){
cur_pos.col=i;
cur_pos.row=k;
searched=true;
break;}
}
if(searched)break;}
return searched?cur_pos:null;};
SFT_SoftKeyboard.prototype.convert_text_to_num=function (text){
if(!this.is_zhcn_kbd_mode())
return null;
if(this.zhcn_mode==this.ZHCN_MODE_RIGHT){
return this.convert_text_to_num_mobileinput(text);}else {
if(text=="1"||text=="0"){
return parseInt(text);}
return this.convert_text_to_num_t9(text);}
};
SFT_SoftKeyboard.prototype.convert_text_to_num_t9=function (text){
var range_num=this.NUM_ROW/2;
var start_pos=this.zhcn_mode*range_num;
var t_len=text.length;
for(var i=0;i<this.NUM_COL;i++){
for(var k=start_pos;k<start_pos+range_num;k++){
var trg=this.ZHCN_KEYS[i][k].toString();
if(trg=="")continue;
if(t_len>1){if(trg==text){
return parseInt(this.ZHCN_NUM_TABLE[i][k]);}
}else {if(trg==this.ZHCN_ARROW_KEY.left)continue;
if(trg.indexOf(text)>-1||this.ZHCN_NUM_TABLE[i][k].indexOf(text)>-1){
return parseInt(this.ZHCN_NUM_TABLE[i][k]);}
}
}
}
return null;};
SFT_SoftKeyboard.prototype.convert_text_to_num_mobileinput=function (text){
if(text.length>1){var range_num=this.NUM_ROW/2;
var start_pos=this.zhcn_mode*range_num;
for(var i=0;i<this.NUM_COL;i++){
for(var k=start_pos;k<start_pos+range_num;k++){
var trg=this.ZHCN_KEYS[i][k].toString();
if(trg=="")continue;
if(trg==text){
return parseInt(this.ZHCN_NUM_TABLE[i][k]);}
}
}
}else {var SMALL_ITEMS=this.ZHCN_SMALL_ITEMS;
for(var i=0;i<SMALL_ITEMS.length;i++){
for(var k=0;k<SMALL_ITEMS[i].length;k++){
if(SMALL_ITEMS[i][k]==text)
return i;}
}
}
return null;};
SFT_SoftKeyboard.prototype.is_zhcn_kbd_mode=function(){
if((this.language=="zh-CN")&&(this.mode_number==3))
return true;
return false;};
SFT_SoftKeyboard.prototype.gen_stencil_list=function(c_point){
var list=[];
var ktop_array=this.keytop_array;
for(var i=0;i<ktop_array.length;i++){
if(ktop_array[i].mouse_stencil){
var stencil=ktop_array[i].mouse_stencil;
var ktop_c_point=c_point.slice();
var ktop_tran=ktop_array[i].translate;
for(var k=0;k<ktop_c_point.length;k++){
ktop_c_point[k]+=ktop_tran[k];}
stencil.c_point=ktop_c_point;
var ktop_w=stencil.width;
var ktop_h=stencil.height;
var lt_point={x:ktop_c_point[0]-ktop_w/2,y:ktop_c_point[1]+ktop_h/2};
var rb_point={x:ktop_c_point[0]+ktop_w/2,y:ktop_c_point[1]-ktop_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
list.push(stencil);}
}
return list;};
SFT_SoftKeyboard.prototype.key_hook=function (up_down,key){
if(this.is_zhcn_kbd_mode())return this.key_hook_zhcn_key_mode(up_down,key);
if(up_down!=KEY_PRESS)return true;
switch(key){
case TXK_RETURN:
return false;
case TXK_ENTER:
this.do_keytop_action_by_pos(this.current_col,this.current_row);
return true;
case TXK_UP:
if(this.current_col-1>=0){
this.leave_key(this.current_col,this.current_row);
this.current_col--;
this.enter_key(this.current_col,this.current_row);
return true;}else {
return false;}
case TXK_DOWN:
if(this.current_col+1<this.NUM_COL){
this.leave_key(this.current_col,this.current_row);
this.current_col++;
this.enter_key(this.current_col,this.current_row);
return true;}else {
return false;}
case TXK_LEFT:
this.leave_key(this.current_col,this.current_row);
if(this.current_row-1>=0)
this.current_row--;
else
this.current_row=this.NUM_ROW-1;
this.enter_key(this.current_col,this.current_row);
return true;
case TXK_RIGHT:
this.leave_key(this.current_col,this.current_row);
if(this.current_row+1<this.NUM_ROW)
this.current_row++;
else
this.current_row=0;
this.enter_key(this.current_col,this.current_row);
return true;}
return false;};
SFT_SoftKeyboard.prototype.key_hook_zhcn_key_mode=function (up_down,key){
if(up_down!=KEY_PRESS)return true;
switch(key){
case TXK_RETURN:
return false;
case TXK_ENTER:
this.do_keytop_action_by_pos(this.current_col,this.current_row);
return true;
case TXK_UP:
if((this.current_row==this.ZHCN_L_ARROW_POS.row)
||(this.current_row==this.ZHCN_R_ARROW_POS.row))
return false;
return true;
case TXK_DOWN:
if((this.current_row==this.ZHCN_L_ARROW_POS.row)
||(this.current_row==this.ZHCN_R_ARROW_POS.row))
return false;
return true;
case TXK_LEFT:
if(this.current_row==this.ZHCN_R_ARROW_POS.row){
this.leave_key(this.current_col,this.current_row);
this.current_row--;
this.enter_key(this.current_col,this.current_row);}
return true;
case TXK_RIGHT:
if(this.current_row==this.ZHCN_L_ARROW_POS.row){
this.leave_key(this.current_col,this.current_row);
this.current_row++;
this.enter_key(this.current_col,this.current_row);}
return true;
case TXK_D1:
this.character_input(1);
return true;
case TXK_D2:
this.character_input(2);
return true;
case TXK_D3:
this.character_input(3);
return true;
case TXK_D4:
this.character_input(4);
return true;
case TXK_D5:
this.character_input(5);
return true;
case TXK_D6:
this.character_input(6);
return true;
case TXK_D7:
this.character_input(7);
return true;
case TXK_D8:
this.character_input(8);
return true;
case TXK_D9:
this.character_input(9);
return true;
case TXK_D0:
this.character_input(0);
return true;}
return false;};
function SFT_SelectBarKeyTop(){
this.superClass=Animation;
this.superClass({});
this.sel_bar_keytop=SKIN.sel_bar_keytop;
this.NEON_CENTER_IMG_PATH=this.sel_bar_keytop.neon.c;
this.NEON_SIDE_IMG_PATH=this.sel_bar_keytop.neon.s;
this.NEON_SIDE_WIDTH=skin_func.calc_rate(this.sel_bar_keytop.neon_side_w);
if(this.NEON_SIDE_WIDTH%2==1){
this.NEON_SIDE_WIDTH=this.NEON_SIDE_WIDTH-1;}
this.width=0;
this.height=skin_func.calc_rate(this.sel_bar_keytop.height);
this.font_size=skin_func.calc_rate(32);
this.spring_constant=2.0;
this.frame_rate=this.get_frame_rate(100.0);
this.t_alpha=0;
this.index=0;
this.COLOR_TEXT=this.sel_bar_keytop.text_c;
this.COLOR_NEON=this.sel_bar_keytop.neon_c.slice();
this.max_alpha=this.COLOR_NEON[3];
this.COLOR_NEON[3]=0;
this.rest_mouseover=false;
this.action_hook=function(){};
this.mouseover_hook=function(){};
this.pointer_control_hook=function(){};};
SFT_SelectBarKeyTop.prototype=new Animation({});
SFT_SelectBarKeyTop.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_SelectBarKeyTop.prototype.create=function (text,index,rest_mouseover){
var this_obj=this;
this.visible_p=false;
this.index=index;
this.rest_mouseover=rest_mouseover;
this.base_c=new gimage({width:1,height:this.height,
src:this.NEON_CENTER_IMG_PATH,draw_type:DIRECT,
translate:[0,0,0],color:this.COLOR_NEON.slice()});
this.base_l=new gimage({width:this.NEON_SIDE_WIDTH,height:this.height,
src:this.NEON_SIDE_IMG_PATH,draw_type:DIRECT,
translate:[0,0,0],color:this.COLOR_NEON.slice()});
this.base_r=new gimage({width:this.NEON_SIDE_WIDTH,height:this.height,
src:this.NEON_SIDE_IMG_PATH,draw_type:DIRECT,
translate:[0,0,0],rotation:[180,0,0,1],
color:this.COLOR_NEON.slice()});
this.base=new container({visible_p:false});
this.base.components.push(this.base_c,this.base_l,this.base_r);
this.components.push(this.base);
var dummy_text=new gtext({width:1000,font_size:this.font_size});
var tmp_text_w=get_text_width(dummy_text,text);
dummy_text=null;
if(tmp_text_w>skin_func.calc_rate(400)){
tmp_text_w=skin_func.calc_rate(400);}
this.text=new gtext({width:tmp_text_w+skin_func.calc_rate(10),text:text,
color:this.COLOR_TEXT,align:CENTER,omitter:"...",
font_size:this.font_size});
this.components.push(this.text);
this.width=tmp_text_w+(this.NEON_SIDE_WIDTH*2)/2;
if(this.width%2==1)
this.width=this.width+1;
this.base_c.width=this.width;
this.base_l.translate[0]=-Math.floor((this.base_c.width+this.NEON_SIDE_WIDTH)/2);
this.base_r.translate[0]=Math.floor((this.base_c.width+this.NEON_SIDE_WIDTH)/2);
this.width=this.width+(this.NEON_SIDE_WIDTH*2)/2;
this.mouse_stencil=new gbox({width:this.width,height:this.height,
color:[0,0,0,0]});
this.mouse_stencil.action=function(obj){
if(!this_obj.rest_mouseover)
this_obj.action();};
this.mouse_stencil.mouseover=function(obj){
if(!this_obj.rest_mouseover){
this_obj.mouseover_func();
this_obj.enter();}
};
this.mouse_stencil.mouseout=function(obj){
if(!this_obj.rest_mouseover)
this_obj.leave();};
this.components.push(this.mouse_stencil);};
SFT_SelectBarKeyTop.prototype.free=function (){
this.base_c.src="";
this.base_l.src="";
this.base_r.src="";
this.base.components=[];
setf_text(this.text,"");
this.components=[];};
SFT_SelectBarKeyTop.prototype.clear=function (){
this.visible_p=false;
this.base_c.src="";
this.base_l.src="";
this.base_r.src="";
this.base.components=[];
setf_text(this.text,"");
this.components=[];};
SFT_SelectBarKeyTop.prototype.mouseover_func=function (){
if(typeof this.action_hook=="function"){
this.mouseover_hook(this.index);}else {
console.log("[WARNING] action_hook is not function type.");}
};
SFT_SelectBarKeyTop.prototype.enter=function (){
this.t_alpha=this.max_alpha;
this.base.visible_p=true;
this.pointer_control();
this.anim_start();};
SFT_SelectBarKeyTop.prototype.leave=function (){
if(this.t_alpha>0){
this.t_alpha=0;
this.anim_start();}
};
SFT_SelectBarKeyTop.prototype.is_active=function (){
return this.base.visible_p;};
SFT_SelectBarKeyTop.prototype.do_anim=function (){
var tmp_alpha=this.base_c.color[3];
var delta_alpha=((this.t_alpha-tmp_alpha)/this.spring_constant)/this.frame_rate;;
tmp_alpha=Math.floor(tmp_alpha+delta_alpha);
this.base_c.color[3]=tmp_alpha;
this.base_l.color[3]=tmp_alpha;
this.base_r.color[3]=tmp_alpha;
if(Math.abs(delta_alpha)<1)
this.anim_finish();};
SFT_SelectBarKeyTop.prototype.move_to_end=function (){
this.base_c.color[3]=this.t_alpha;
this.base_l.color[3]=this.t_alpha;
this.base_r.color[3]=this.t_alpha;
if(this.t_alpha==0){
this.base.visible_p=false;}
};
SFT_SelectBarKeyTop.prototype.action=function (){
if(typeof this.action_hook=="function"){
this.action_hook(this.text.text);}else {
console.log("[WARNING] action_hook is not function type.");}
};
SFT_SelectBarKeyTop.prototype.pointer_control=function (){
if(typeof this.pointer_control_hook=="function"){
var position=this.calc_pointer_position();
this.pointer_control_hook(position.x,position.y);}
};
SFT_SelectBarKeyTop.prototype.add_action_hook=function (hook){
this.action_hook=hook;};
SFT_SelectBarKeyTop.prototype.add_mouseover_hook=function (hook){
this.mouseover_hook=hook;};
SFT_SelectBarKeyTop.prototype.add_pointer_control_hook=function (hook){
this.pointer_control_hook=hook;};
SFT_SelectBarKeyTop.prototype.calc_pointer_position=function (){
var position={};
position.x=this.translate[0]+Math.floor(this.width/2)-20;
position.y=this.translate[1]+ -(Math.floor(this.height*0.2));
return position;};
SFT_SelectBarKeyTop.prototype.get_pointer_position=function (){
return this.calc_pointer_position();};

SFT_SelectBarKeyTop.prototype.get_width=function (){
return this.width;};

SFT_SelectBarKeyTop.prototype.get_translate=function (){
return this.translate;};
SFT_SelectBarKeyTop.prototype.get_text=function (){
return this.text.text;};
SFT_SelectBarKeyTop.prototype.set_visible=function (visible){
if(this.visible_p!=visible){
this.visible_p=visible;}
};
function SFT_SelectBarSlide(param){
param=param||{};
this.superClass=Animation;
this.superClass({});
this.anim_speed=1.1;
this.trg_trans_x=0;

this.width=0;
this.height=0;
this.base_trans_x=0;
this.key_margin_width=skin_func.calc_rate(16);
this.font_size=skin_func.calc_rate(32);
this.keytop_array=[];
this.old_keytop_table=[];
this.keytop_table=[];
this.pos=0;
this.num=0;
this.ALIGN_LEFT=0;
this.ALIGN_RIGHT=1;
this.inner_pos=0;
this.inner_num=0;
this.list=[];
this.surplus_w=0;
this.dummy_align=this.ALIGN_LEFT;
this.dummy_trg_pos=0;
this.is_out=param.is_out||false;
this.cut_slide_anim=param.cut_slide_anim;
this.touchpad_counter=0;
this.touchpad_slide_margin=3;
this.touchpad_reset_timer={};
this.keytop_action=function(){};
this.keytop_mouseover=function(){};
this.keytop_pointer_control=function(){};
this.slide_anim_start=function(){};
this.slide_anim_end=function(){};
this.slide_lr=function(){};
this.update_stencil=function(){};};
SFT_SelectBarSlide.prototype=new Animation({});
SFT_SelectBarSlide.prototype.init=function (tra){
};
SFT_SelectBarSlide.prototype.get_position=function (){
return this.pos;};

SFT_SelectBarSlide.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_SelectBarSlide.prototype.create=function (keytop_action_hook,
keytop_pointer_control_hook,
slide_anim_start_hook,
slide_anim_end_hook,
slide_lr_hook,
mouseover_hook,
update_stencil_hook){
this.keytop_action=keytop_action_hook;
this.keytop_mouseover=mouseover_hook;
this.keytop_pointer_control=keytop_pointer_control_hook;
this.slide_anim_start=slide_anim_start_hook;
this.slide_anim_end=slide_anim_end_hook;
this.slide_lr=slide_lr_hook;
this.update_stencil=update_stencil_hook;};
SFT_SelectBarSlide.prototype.free=function (){
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&typeof this.components[i].free=="function"){
this.components[i].free();}
}
this.components=[];};
SFT_SelectBarSlide.prototype.show=function (arg){
arg=arg||{};
var self=this;
if(this.keytop_array.length>0)this.clear();
if(arg.list==null)return;
var keytop_action_hook=function (arg){
self.keytop_action(arg);};
var keytop_mouseover_hook=function (index){
self.mouseover_action(index);};
var keytop_pointer_control_hook=function (x,y){
x=self.translate[0]+x;
y=self.translate[1]+y;
self.keytop_pointer_control(x,y);};
this.dummy_cont=new container({});
this.dummy_cont.components=[];
this.components.push(this.dummy_cont);
this.is_slide_mode=false;
this.width=arg.width;
this.base_trans_x=-Math.floor(this.width/2);
this.translate[0]=this.base_trans_x;
this.list=arg.list.slice(0);
this.num=this.list.length;
var base_x_pos=0;
var last_ktop_w=0;
for(var i=0;i<this.num;i++){
var ktop=new SFT_SelectBarKeyTop();
var func=arg.list[i];
ktop.create(func,i,arg.rest_mouseover);
ktop.add_action_hook(keytop_action_hook);
ktop.add_mouseover_hook(keytop_mouseover_hook);
ktop.add_pointer_control_hook(keytop_pointer_control_hook);
var ktop_w=ktop.get_width();
var ktop_x=Math.floor(base_x_pos+(ktop_w+last_ktop_w)/2+this.key_margin_width);
ktop.set_translate([ktop_x,0,0]);
last_ktop_w=ktop_w;
base_x_pos=ktop_x;
this.keytop_array.push(ktop);
this.keytop_table.push(false);
this.components.push(ktop);}
this.set_keytop_table({row:this.pos,align:this.ALIGN_LEFT});
this.set_keytop_visible();
this.set_is_slide_mode();
this.set_dummy_cont();};
SFT_SelectBarSlide.prototype.mouseover_action=function (index){
var len=this.keytop_array.length;
for(var i=0;i<len;i++){
var target=this.keytop_array[i];
if(target.is_active()
&&index!=this.pos){
target.leave();}
}
var delta=index-this.pos;
this.inner_pos=this.inner_pos+delta;
this.pos=index;
this.keytop_mouseover(index);};
SFT_SelectBarSlide.prototype.clear=function (){
for(var i=0;i<this.keytop_array.length;i++)
this.keytop_array[i].clear();
this.keytop_array.splice(0,this.keytop_array.length);
this.components.splice(this.components.length-this.num,
this.num);
this.reset_dummy_cont();
this.is_slide_mode=false;
this.pos=0;
this.num=0;
this.inner_pos=0;
this.inner_num=0;
this.list=[];
this.surplus_w=0;
this.dummy_align=this.ALIGN_LEFT;
this.dummy_trg_pos=0;
this.old_keytop_table=[];
this.keytop_table=[];
this.touchpad_counter=0;};
SFT_SelectBarSlide.prototype.enter_action=function (){
var c=this.list[this.pos];
this.keytop_action(c);};
SFT_SelectBarSlide.prototype.enter_focus=function (){
this.init();
if(!this.is_out){
this.keytop_array[this.pos].enter();}
};
SFT_SelectBarSlide.prototype.leave_focus=function (){

};
SFT_SelectBarSlide.prototype.release_focus=function (){
this.keytop_array[this.pos].leave();};
SFT_SelectBarSlide.prototype.in_current_cursor=function (){
if((this.language!="zh-CN")&&(this.language!="zh-HK"))
this.keytop_array[this.pos].enter();
this.is_out=false;};
SFT_SelectBarSlide.prototype.out_current_cursor=function (){
this.keytop_array[this.pos].leave();
this.is_out=true;};
SFT_SelectBarSlide.prototype.set_keytop_table=function (arg){
arg=arg||{};
this.set_keytop_visible_trg_only(true);
this.old_keytop_table=this.keytop_table.slice();
this.reset_keytop_table();
var row=(arg.row!=undefined)?arg.row:0;
var align=(arg.align!=undefined)?arg.align:this.ALIGN_LEFT;
var max_w=this.width;
var cal_w=this.key_margin_width;
if(align==this.ALIGN_LEFT){
for(var i=row;i<this.keytop_array.length;i++){
var key_w=this.keytop_array[i].get_width();
cal_w=cal_w+key_w+this.key_margin_width;
if(cal_w>max_w){
this.inner_pos=0;
this.surplus_w=max_w-(cal_w-key_w);
this.dummy_trg_pos=i;
break;}
this.keytop_table[i]=true;
this.inner_num++;}
}
else if(align==this.ALIGN_RIGHT){
for(var i=row;i>=0;i--){
var key_w=this.keytop_array[i].get_width();
cal_w=cal_w+key_w+this.key_margin_width;
if(cal_w>max_w){
this.inner_pos=this.inner_num-1;
this.surplus_w=max_w-(cal_w-key_w);
this.dummy_trg_pos=i;
break;}
this.keytop_table[i]=true;
this.inner_num++;}
}
};
SFT_SelectBarSlide.prototype.reset_keytop_table=function (){
for(var i=0;i<this.keytop_table.length;i++){
this.keytop_table[i]=false;}
this.inner_num=0;
this.inner_pos=0;};
SFT_SelectBarSlide.prototype.set_dummy_cont=function (){
var surplus_w=this.surplus_w;
if(surplus_w<=0)
return;
this.reset_dummy_cont();
var dummy_align=this.dummy_align;
var dummy_trg_pos=this.dummy_trg_pos;
var trg_keytop_trans=this.keytop_array[dummy_trg_pos].get_translate();
var trg_keytop_width=this.keytop_array[dummy_trg_pos].get_width();
var trans_x=trg_keytop_trans[0];
var label_color=this.keytop_array[dummy_trg_pos].COLOR_TEXT.slice();
var label_text=this.keytop_array[dummy_trg_pos].get_text();
var label_align=LEFT;
if(dummy_align==this.ALIGN_LEFT){
trans_x=trans_x-Math.floor((trg_keytop_width-surplus_w)/2-this.key_margin_width);
label_align=LEFT;}
else if(dummy_align==this.ALIGN_RIGHT){
trans_x=trans_x+Math.floor((trg_keytop_width-surplus_w)/2-this.key_margin_width);
label_align=RIGHT;}
var dummy_label=new gtext({width:surplus_w,translate:[trans_x,0,0],
color:label_color,align:label_align,text:label_text,
font_size:this.font_size});
this.dummy_cont.components=[dummy_label];};
SFT_SelectBarSlide.prototype.reset_dummy_cont=function (){
if(this.dummy_cont.components.length>0){
this.dummy_cont.components.splice(0);}
};
SFT_SelectBarSlide.prototype.set_keytop_visible=function (){
for(var i=0;i<this.keytop_table.length;i++){
if(this.old_keytop_table[i]!=this.keytop_table[i]){
this.keytop_array[i].set_visible(this.keytop_table[i]);}
}
};
SFT_SelectBarSlide.prototype.set_keytop_visible_trg_only=function (visible){
for(var i=0;i<this.keytop_table.length;i++){
if(this.old_keytop_table[i]!=visible&&this.keytop_table[i]==visible){
this.keytop_array[i].set_visible(visible);}
}
};
SFT_SelectBarSlide.prototype.set_is_slide_mode=function (){
for(var i=0;i<this.keytop_table.length;i++){
if(!this.keytop_table[i]){
this.is_slide_mode=true;
return;}
}
this.is_slide_mode=false;};
SFT_SelectBarSlide.prototype.do_slide_anim_start=function (){
this.slide_anim_start();};
SFT_SelectBarSlide.prototype.do_slide_anim_end=function (){
if(this.keytop_array&&this.pos>=0&&this.keytop_array[this.pos]){
var position=this.keytop_array[this.pos].get_pointer_position();
position.x=this.translate[0]+position.x;
position.y=this.translate[1]+position.y;
this.slide_anim_end(position.x,position.y);}
};
SFT_SelectBarSlide.prototype.do_touchpad_slide=function (direction){
this.touchpad_counter+=direction;
delete_timer(this.touchpad_reset_timer);
if(Math.abs(this.touchpad_counter)==this.touchpad_slide_margin){
if(this.touchpad_counter>=0){
this.right();}
else {
this.left();}
this.touchpad_counter=0;}
else {
var self=this;
append_timer(this.touchpad_reset_timer,4000,function(obj,count){
delete_timer(obj);
self.touchpad_counter=0;});}
};
SFT_SelectBarSlide.prototype.right=function (){
var last=this.pos;
this.pos++;
this.inner_pos++;
if(this.is_slide_mode){if(this.pos>=this.num){
this.pos=0;
this.set_keytop_table({row:this.pos,align:this.ALIGN_LEFT});
this.set_keytop_visible_trg_only(false);
this.translate[0]=this.calc_to_translate({row:this.pos,align:this.ALIGN_LEFT});
this.move({row:this.pos,align:this.ALIGN_LEFT});}
else if(this.inner_pos>=this.inner_num){
this.set_keytop_table({row:this.pos,align:this.ALIGN_RIGHT});
this.set_keytop_visible_trg_only(false);
if(this.trg_trans_x&&this.translate[0]!=this.trg_trans_x){
this.cancel_anim();
this.translate[0]=this.trg_trans_x;}
this.move({row:this.pos,align:this.ALIGN_RIGHT});}
}else {if(this.pos>=this.num){
this.pos=0;}
if(this.inner_pos>=this.inner_num){
this.inner_pos=this.inner_num-1;}
}
if(last!=this.pos)
this.keytop_array[last].leave();
this.keytop_array[this.pos].enter();
this.slide_lr();};
SFT_SelectBarSlide.prototype.left=function (){
var last=this.pos;
this.pos--;
this.inner_pos--;
if(this.is_slide_mode){if(this.pos<0){
this.pos=this.num-1;
this.set_keytop_table({row:this.pos,align:this.ALIGN_RIGHT});
this.set_keytop_visible_trg_only(false);
this.translate[0]=this.calc_to_translate({row:this.pos,align:this.ALIGN_RIGHT});
this.move({row:this.pos,align:this.ALIGN_RIGHT});}
else if(this.inner_pos<0){
this.set_keytop_table({row:this.pos,align:this.ALIGN_LEFT});
this.set_keytop_visible_trg_only(false);
if(this.trg_trans_x&&this.translate[0]!=this.trg_trans_x){
this.cancel_anim();
this.translate[0]=this.trg_trans_x;}
this.move({row:this.pos,align:this.ALIGN_LEFT});}
}else {if(this.pos<0){
this.pos=this.num-1;}
if(this.inner_pos<0){
this.inner_pos=0;}
}
if(last!=this.pos)
this.keytop_array[last].leave();
this.keytop_array[this.pos].enter();
this.slide_lr();};
SFT_SelectBarSlide.prototype.calc_to_translate=function (arg){
arg=arg||{};
var row=(arg.row!=undefined)?arg.row:0;
var align=(arg.align!=undefined)?arg.align:this.ALIGN_LEFT;
this.dummy_align=align;
var tmp_x=this.base_trans_x;
if(align==this.ALIGN_LEFT){
for(var i=0;i<row;i++){
tmp_x=tmp_x-(this.keytop_array[i].get_width()+this.key_margin_width);};}
else if(align==this.ALIGN_RIGHT){
tmp_x=tmp_x+this.width-(this.keytop_array[row].get_width()+this.key_margin_width*2);
for(var i=0;i<row;i++){
tmp_x=tmp_x-(this.keytop_array[i].get_width()+this.key_margin_width);};}
return tmp_x;};
SFT_SelectBarSlide.prototype.move=function (arg){
this.do_slide_anim_start();
this.trg_trans_x=this.calc_to_translate(arg);
this.reset_dummy_cont();
this.anim_start();};
SFT_SelectBarSlide.prototype.do_anim=function (count){
if(this.cut_slide_anim)
this.anim_finish();
var delta_trans_x=calcDelta(this.trg_trans_x,this.translate[0],this.anim_speed);
this.translate[0]=this.translate[0]+delta_trans_x;
if(Math.abs(delta_trans_x)<1)
this.anim_finish();};
SFT_SelectBarSlide.prototype.move_to_end=function (count){
this.translate[0]=this.trg_trans_x;
this.do_slide_anim_end();
this.set_keytop_visible_trg_only(true);
this.set_dummy_cont();
this.update_stencil();};
SFT_SelectBarSlide.prototype.key_hook=function (up_down,key){
if(up_down!=KEY_PRESS)return true;
switch(key){
case TXK_RETURN:
return false;
case TXK_ENTER:
this.enter_action();
return false;
case TXK_LEFT:
this.left();
return true;
case TXK_RIGHT:
this.right();
return true;}
return false;};
function SFT_SelectBarBtn(init){
this.superClass=Animation;
this.superClass({});
this.sel_bar_btn_skin=SKIN.sel_bar_btn;
this.spring_constant=2.0;
this.frame_rate=this.get_frame_rate(100.0);
this.width=skin_func.calc_rate(this.sel_bar_btn_skin.btn_w);
this.height=skin_func.calc_rate(this.sel_bar_btn_skin.btn_h);
this.color_padding=this.sel_bar_btn_skin.padding;
this.def_alpha=0;
this.sel_alpha=0;
this.COLOR_DEF=this.sel_bar_btn_skin.btn_def_c;
this.COLOR_SEL=this.sel_bar_btn_skin.btn_sel_c;
this.MODE="";
this.rest_mouseover=false;
this.action_hook=function(){};
this.pointer_control_hook=function(){};};
SFT_SelectBarBtn.prototype=new Animation({});
SFT_SelectBarBtn.prototype.init=function (tra){
};
SFT_SelectBarBtn.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_SelectBarBtn.prototype.create=function (param){
var self=this;
this.MODE=param.mode||"LEFT";
if(param.action_hook)
this.action_hook=param.action_hook;
if(param.pointer_control_hook)
this.pointer_control_hook=param.pointer_control_hook;
var color_w=this.width-skin_func.calc_rate(this.color_padding*2);
var color_h=this.height-skin_func.calc_rate(this.color_padding*2);
var color_round=skin_func.calc_rate(this.sel_bar_btn_skin.round);
this.color_bg=new gbox({width:color_w,height:color_h,round_enable:true,
round_width:color_round,round_height:color_round,
color:this.COLOR_DEF.slice()});
this.color_neon=new gbox({width:color_w,height:color_h,round_enable:true,
round_width:color_round,round_height:color_round,
color:this.COLOR_SEL.slice(),visible_p:false});
this.components.push(this.color_bg,this.color_neon);
this.btn=new container({
components:[param.btn_obj]
});
this.components.push(this.btn);
this.arrow=new container({
components:[param.btn_arrow_obj]
});
if(this.MODE=="RIGHT"){
this.arrow.rotation=[180,0,0,1];}
this.components.push(this.arrow);
this.mouse_stencil=new gbox({width:this.width,height:this.height,
color:[0,0,0,0]});
this.mouse_stencil.action=function(obj){
if(!self.rest_mouseover)
self._action();};
this.mouse_stencil.mouseover=function(obj){
if(!self.rest_mouseover)
self.enter();};
this.mouse_stencil.mouseout=function(obj){
if(!self.rest_mouseover)
self.leave();};
this.components.push(this.mouse_stencil);};
SFT_SelectBarBtn.prototype.free=function (){
this.components=[];};
SFT_SelectBarBtn.prototype.keytop_action=function (arg){
console_log("SFT_SelectBarBtn.prototype.keytop_action: arg = "+arg);};
SFT_SelectBarBtn.prototype.mouseover_action=function (arg){
console_log("SFT_SelectBarBtn.prototype.mouseover_action: arg = "+arg);
this.keytop_mouseover(arg);};
SFT_SelectBarBtn.prototype.enter=function (){
if(!this.color_neon.visible_p)
this.color_neon.visible_p=true;
this.def_alpha=0;
this.sel_alpha=this.COLOR_SEL[3];
this.anim_start();};
SFT_SelectBarBtn.prototype.leave=function (){
this.color_bg.visible_p=true;
this.def_alpha=this.COLOR_DEF[3];
this.sel_alpha=0;
this.anim_start();};
SFT_SelectBarBtn.prototype.do_anim=function (){
var delta_def_alpha=((this.def_alpha-this.color_bg.color[3])/this.spring_constant)/this.frame_rate;
this.color_bg.color[3]=this.color_bg.color[3]+this.delta_to_integer(delta_def_alpha);
var delta_sel_alpha=((this.sel_alpha-this.color_neon.color[3])/this.spring_constant)/this.frame_rate;
this.color_neon.color[3]=this.color_neon.color[3]+this.delta_to_integer(delta_sel_alpha);
if(Math.abs(delta_def_alpha)<0.1)
this.anim_finish();};
SFT_SelectBarBtn.prototype.move_to_end=function (){
this.color_bg.color[3]=this.def_alpha;
this.color_neon.color[3]=this.sel_alpha;
if(this.def_alpha==0){
this.color_bg.visible_p=false;}
else if(this.sel_alpha==0){
this.color_neon.visible_p=false;}
};
SFT_SelectBarBtn.prototype._action=function (){
if(typeof this.action_hook=="function"){
this.action_hook();}else {
console.log("[WARNING] action_hook is not function type.");}
};
SFT_SelectBarBtn.prototype.pointer_control_func=function (){
if(typeof this.pointer_control_hook=="function"){
var position=this.calc_pointer_position();
this.pointer_control_hook(position.x,position.y);}
};
SFT_SelectBarBtn.prototype.calc_pointer_position=function (){
var position={};
position.x=this.translate[0]+Math.floor(this.width/2)-20;
position.y=this.translate[1]+ -(Math.floor(this.height*0.2));
return position;};
SFT_SelectBarBtn.prototype.set_rest_mouseover=function (rest_mouseover){
this.rest_mouseover=rest_mouseover;};
SFT_SelectBarBtn.prototype.get_rest_mouseover=function (){
return this.rest_mouseover;};
SFT_SelectBarBtn.prototype.release_focus=function (){
this.leave();};
function SFT_SelectBar(init){
this.superClass=Animation;
this.superClass({});
this.sel_bar_skin=SKIN.sel_bar;
this.sel_bar_btn_skin=SKIN.sel_bar_btn;
this.BG_CENTER_IMG_PATH=this.sel_bar_skin.bg.c;
this.BG_LEFT_IMG_PATH=this.sel_bar_skin.bg.l;
this.BG_RIGHT_IMG_PATH=this.sel_bar_skin.bg.r;
this.BTN_IMG_PATH=this.sel_bar_btn_skin.btn;
this.BTN_ARROW_IMG_PATH=this.sel_bar_btn_skin.btn_arrow;
this.width=init.width;
this.height=skin_func.calc_rate(this.sel_bar_skin.height);
this.bg_padding=this.sel_bar_skin.bg_padding;
this.bg_color=this.sel_bar_skin.bg_c;
this.btn_space=skin_func.calc_rate(this.sel_bar_skin.btn_space);
this.btn_width=skin_func.calc_rate(this.sel_bar_btn_skin.btn_w);
this.btn_height=skin_func.calc_rate(this.sel_bar_btn_skin.btn_h);
this.COLOR_ARROW_DEF=this.sel_bar_btn_skin.btn_arrow_c;
this.COLOR_ARROW_GRAY=this.sel_bar_btn_skin.btn_arrow_gray_c||[200,200,200,255];
this.is_cursor_out=false;

this.keytop_array=[];
this.slide={};
this.arrows={};
this.list=[];
this.keytop_action=function(){};
this.keytop_mouseover=function(){};
this.keytop_pointer_control=function(){};
this.arrows_action=function(){};
this.slide_anim_start=function(){};
this.slide_anim_end=function(){};};
SFT_SelectBar.prototype=new Animation({});
SFT_SelectBar.prototype.init=function (tra){
};
SFT_SelectBar.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_SelectBar.prototype.get_translate=function (){
return this.translate;};
SFT_SelectBar.prototype.create=function (keytop_action_hook,
keytop_pointer_control_hook,
arrows_action_hook,
slide_anim_start_hook,
slide_anim_end_hook,
slide_lr_hook,
mouseover_hook,
update_stencil_hook){
var this_obj=this;
this.btn_obj=new gimage({width:this.btn_width,height:this.btn_height,
src:this.BTN_IMG_PATH});
this.btn_arrow_obj=new gimage({
width:skin_func.calc_rate(this.sel_bar_btn_skin.arrow_w),
height:skin_func.calc_rate(this.sel_bar_btn_skin.arrow_h),
src:this.BTN_ARROW_IMG_PATH,color:this.COLOR_ARROW_GRAY.slice()
});
var btn_left_action_hook=function(){
this_obj.arrows_action("LEFT");};
var btn_right_action_hook=function(){
this_obj.arrows_action("RIGHT");};
var btn_pointer_control_hook=function (x,y){
x=this_obj.translate[0]+x;
y=this_obj.translate[1]+y;
this_obj.keytop_pointer_control(x,y);};
this.arrow_l=new SFT_SelectBarBtn({});
this.arrow_l.create({mode:"LEFT",btn_obj:this.btn_obj,btn_arrow_obj:this.btn_arrow_obj,
action_hook:btn_left_action_hook,
pointer_control_hook:btn_pointer_control_hook});
this.arrow_l.set_translate([-(this.width-this.btn_width)/2,0,0]);
this.arrow_l.set_rest_mouseover(true);
this.arrow_r=new SFT_SelectBarBtn({});
this.arrow_r.create({mode:"RIGHT",btn_obj:this.btn_obj,btn_arrow_obj:this.btn_arrow_obj,
action_hook:btn_right_action_hook,
pointer_control_hook:btn_pointer_control_hook});
this.arrow_r.set_translate([(this.width-this.btn_width)/2,0,0]);
this.arrow_r.set_rest_mouseover(true);

this.arrows=new container({});
this.arrows.components=[this.arrow_l,this.arrow_r];
this.components.push(this.arrows);
var bg_width=this.width-(this.btn_width+this.btn_space)*2;
this.slide_bg=this._create_bg({width:bg_width});
this.components.push(this.slide_bg);
this.keytop_action=keytop_action_hook;
this.keytop_pointer_control=keytop_pointer_control_hook;
this.keytop_mouseover=mouseover_hook;
this.arrows_action=arrows_action_hook;
this.slide_anim_start=slide_anim_start_hook;
this.slide_anim_end=slide_anim_end_hook;
this.slide_lr=slide_lr_hook;
this.update_stencil=update_stencil_hook;};
SFT_SelectBar.prototype.free=function (){
this.arrow_l.free();
this.arrow_r.free();
this.btn_obj.src="";
this.btn_arrow_obj.src="";
for(var i=0;i<this.slide_bg.length;i++){
if(this.slide_bg[i] instanceof "gimage"){
this.slide_bg[i].src="";}
}
if(this.slide&&this.slide.free&&typeof this.slide.free=="function"){
this.slide.free();}
this.components=[];};
SFT_SelectBar.prototype.keytop_action=function (arg){
console_log("SFT_SelectBar.prototype.keytop_action: arg = "+arg);};
SFT_SelectBar.prototype.mouseover_action=function (arg){
console_log("SFT_SelectBar.prototype.mouseover_action: arg = "+arg);
this.keytop_mouseover(arg);};
SFT_SelectBar.prototype.show=function (list,rest_mouseover,cut_slide_anim){
var self=this;
if(list.length>0)this.clear();
if(this.keytop_array.length>0)this.clear();
if(list==null)return;
var keytop_action_hook=function (arg){
self.keytop_action(arg);};
var keytop_mouseover_hook=function (index){
self.mouseover_action(index);};
var keytop_pointer_control_hook=function (x,y){
x=self.translate[0]+x;
y=self.translate[1]+y;
self.keytop_pointer_control(x,y);};
var slide_anim_start_hook=function (){
self.slide_anim_start();};
var slide_anim_end_hook=function (x,y){
x=self.translate[0]+x;
y=self.translate[1]+y;
self.slide_anim_end(x,y);};
var slide_lr_hook=function (){
self.slide_lr();};
var update_stencil_hook=function(){
self.update_stencil();};
rest_mouseover=
(rest_mouseover!=undefined&&rest_mouseover==true)?true:false;
if(rest_mouseover)
this.btn_arrow_obj.color=this.COLOR_ARROW_GRAY.slice();
else
this.btn_arrow_obj.color=this.COLOR_ARROW_DEF.slice();
cut_slide_anim=(cut_slide_anim!=undefined&&cut_slide_anim==true)?true:false;
var slide_width=this.width-(this.btn_width+this.btn_space+this.bg_padding)*2;
this.slide=new SFT_SelectBarSlide({is_out:this.is_cursor_out,cut_slide_anim:cut_slide_anim});
this.slide.create(keytop_action_hook,keytop_pointer_control_hook,
slide_anim_start_hook,slide_anim_end_hook,
slide_lr_hook,keytop_mouseover_hook,update_stencil_hook);
this.slide.set_translate([0,0,0]);
this.slide.show({list:list,width:slide_width,height:this.height,
rest_mouseover:rest_mouseover});
this.arrow_l.set_rest_mouseover(rest_mouseover);
this.arrow_r.set_rest_mouseover(rest_mouseover);
this.components.push(this.slide);
this.update_stencil();};
SFT_SelectBar.prototype.clear=function (){
if(!this.is_active())
return;
this.slide.clear();
this.btn_arrow_obj.color=this.COLOR_ARROW_GRAY.slice();
var len=this.components.length;
this.components.splice(2,len-1);
this.release_arrows_focus();
this.arrow_l.set_rest_mouseover(true);
this.arrow_r.set_rest_mouseover(true);
this.update_stencil();};
SFT_SelectBar.prototype._create_bg=function(param){
var bg_cont=new container({});
var width=param.width||0;
var height=this.height;
var side_width=skin_func.calc_rate(this.sel_bar_skin.bg_side_w);
var padding=skin_func.calc_rate(this.bg_padding*2);
var round=skin_func.calc_rate(this.sel_bar_skin.bg_round);
if(side_width%2==1)
side_width=side_width+1;
var color_bg=new gbox({width:width-padding,height:height-padding,
color:this.bg_color.slice(),round_enable:true,
round_width:round,round_height:round});
var img_c=new gimage({
width:width-side_width*2,height:height,translate:[0,0,0],
draw_type:DIRECT,src:this.BG_CENTER_IMG_PATH
});
var img_l=new gimage({
width:side_width,height:height,draw_type:DIRECT,
translate:[-(width-side_width)/2,0,0],src:this.BG_LEFT_IMG_PATH
});
var img_r=new gimage({
width:side_width,height:height,draw_type:DIRECT,
translate:[(width-side_width)/2,0,0],src:this.BG_RIGHT_IMG_PATH
});
bg_cont.components=[color_bg,img_c,img_l,img_r];
return bg_cont;};
SFT_SelectBar.prototype.is_active=function (){
return (this.components.length>2);};
SFT_SelectBar.prototype.get_width=function (){
return this.width;};
SFT_SelectBar.prototype.get_height=function (){
return this.height;};
SFT_SelectBar.prototype.get_inner_height=function (){
return this.height-this.bg_padding*2;};
SFT_SelectBar.prototype.enter_focus=function (){
this.init();
common_key.set_cursor(this,this.slide);};
SFT_SelectBar.prototype.leave_focus=function (){
common_key.set_cursor(this,null);};
SFT_SelectBar.prototype.send_touchpad_z=function (direction){
this.slide.do_touchpad_slide(direction);};
SFT_SelectBar.prototype.in_current_cursor=function (){
this.is_cursor_out=false;
if(this.is_active())
this.slide.in_current_cursor();};
SFT_SelectBar.prototype.out_current_cursor=function (){
this.is_cursor_out=true;
if(this.is_active())
this.slide.out_current_cursor();};
SFT_SelectBar.prototype.get_is_cursor_out=function (){
return this.is_cursor_out;};
SFT_SelectBar.prototype.slide_right=function (){
if(!this.is_active())
return;
this.slide.right();};
SFT_SelectBar.prototype.slide_left=function (){
if(!this.is_active())
return;
this.slide.left();};
SFT_SelectBar.prototype.get_position=function (){
return this.slide.get_position();};
SFT_SelectBar.prototype.release_focus=function (){
if(this.is_active())
this.slide.release_focus();};
SFT_SelectBar.prototype.release_arrows_focus=function (){
this.arrow_l.release_focus();
this.arrow_r.release_focus();};
SFT_SelectBar.prototype.get_rest_mouseover=function (){
return this.arrow_l.get_rest_mouseover();};
SFT_SelectBar.prototype.gen_stencil_list=function(c_point){
var list=[];
var arrow_list=this.gen_arrow_stencil_list(c_point);
list=arrow_list.slice();
if(this.is_active()){var slide_list=this.gen_slide_stencil_list(c_point);
list=list.concat(slide_list);}
return list;};
SFT_SelectBar.prototype.gen_arrow_stencil_list=function(c_point){
var list=[];
var arrows=this.arrows.components;
for(var i=0;i<arrows.length;i++){
if(arrows[i].mouse_stencil){
var stencil=arrows[i].mouse_stencil;
var arrow_c_point=c_point.slice();
var arrow_tran=arrows[i].translate;
for(var k=0;k<arrow_c_point.length;k++){
arrow_c_point[k]+=arrow_tran[k];}
stencil.c_point=arrow_c_point;
var arrow_w=stencil.width;
var arrow_h=stencil.height;
var lt_point={x:arrow_c_point[0]-arrow_w/2,y:arrow_c_point[1]+arrow_h/2};
var rb_point={x:arrow_c_point[0]+arrow_w/2,y:arrow_c_point[1]-arrow_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
list.push(stencil);}
}
return list;};
SFT_SelectBar.prototype.gen_slide_stencil_list=function(c_point){
var list=[];
var slide=this.slide;
var slide_c_point=c_point.slice();
var slide_tran=slide.translate;
slide_c_point[1]+=slide_tran[1];
slide_c_point[2]+=slide_tran[2];
var ktop_array=slide.keytop_array;
var ktop_table=slide.keytop_table;
var align=slide.dummy_align;
var max_w=slide.width;
var key_margin_w=slide.key_margin_width;
var center_x=0;
for(var i=0;i<ktop_array.length;i++){
var stencil=ktop_array[i].stencil;
if(!stencil)
continue;
stencil.c_point=null;
stencil.lt_point=null;
stencil.rb_point=null;}
if(!slide.is_slide_mode||align==slide.ALIGN_LEFT){
center_x=-(max_w/2-key_margin_w);
for(i=0;i<ktop_array.length;i++){
if(!ktop_table[i])
continue;
var stencil=ktop_array[i].mouse_stencil;
var stencil_c_point=slide_c_point.slice();
var ktop_w=stencil.width;
var ktop_h=stencil.height;
center_x+=ktop_w/2;
stencil_c_point[0]+=center_x;
stencil.c_point=stencil_c_point;
var lt_point={x:stencil_c_point[0]-ktop_w/2,y:stencil_c_point[1]+ktop_h/2};
var rb_point={x:stencil_c_point[0]+ktop_w/2,y:stencil_c_point[1]-ktop_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
center_x+=ktop_w/2+key_margin_w;
list.push(stencil);}
}else {
center_x=max_w/2-key_margin_w;
for(i=ktop_array.length-1;0<=i;i--){
if(!ktop_table[i])
continue;
var stencil=ktop_array[i].mouse_stencil;
var stencil_c_point=slide_c_point.slice();
var ktop_w=stencil.width;
var ktop_h=stencil.height;
center_x-=ktop_w/2;
stencil_c_point[0]+=center_x;
stencil.c_point=stencil_c_point;
var lt_point={x:stencil_c_point[0]-ktop_w/2,y:stencil_c_point[1]+ktop_h/2};
var rb_point={x:stencil_c_point[0]+ktop_w/2,y:stencil_c_point[1]-ktop_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
center_x-=ktop_w/2+key_margin_w;
list.push(stencil);}
}
return list;};
SFT_SelectBar.prototype.key_hook=function (up_down,key){
if(up_down!=KEY_PRESS)return true;
var ret=false;
if(this.cursor&&typeof this.cursor.key_hook=="function"){
ret=this.cursor.key_hook(up_down,key);
if(ret)return true;}else {
console.log("[ERROR] this.cursor.key_hook is not function.");
return false;}
return false;};
function SFT_ControlKeyTop(param){
param=param||{};
this.superClass=Animation;
this.superClass({});

this.ctrl_keytop_skin=SKIN.ctrl_keytop;
this.ARROW_IMG_PATH=this.ctrl_keytop_skin.arrow_round;
this.width=skin_func.calc_rate(this.ctrl_keytop_skin.width);
this.wide_w=skin_func.calc_rate(this.ctrl_keytop_skin.wide_w);
this.height=skin_func.calc_rate(this.ctrl_keytop_skin.height);
this.arrow_w=skin_func.calc_rate(this.ctrl_keytop_skin.arrow_w);
this.arrow_h=skin_func.calc_rate(this.ctrl_keytop_skin.arrow_h);
this.spring_constant=2.0;
this.frame_rate=this.get_frame_rate(100.0);
this.t_alpha=0;
this.def_alpha=0;
this.sel_alpha=0;
this.COLOR_DEF=this.ctrl_keytop_skin.def_c;
this.COLOR_SEL=this.ctrl_keytop_skin.sel_c;
this.col=0;
this.row=0;
this.COLOR_TEXT=this.ctrl_keytop_skin.text_c;
this.COLOR_GRAY=this.ctrl_keytop_skin.gray_c;
this.BAR_SETTING={};
this.BAR_SETTING.visible_p=false;
this.BAR_SETTING.color=[0,0,0,0];
this.BAR_SETTING.width=0;
this.action_hook=function(){};
this.mouseover_hook=function(){};
this.pointer_control_hook=function(){};
this.language=param.language;
this.current_mode=0;
this.key_item=key_item;
this.CHAR_TYPE={};
this.CHAR_TYPE.MODE_MAX=this._create_mode_max(this.key_item[this.language]);
this.alphabet_mode=false;};
SFT_ControlKeyTop.prototype=new Animation({});
SFT_ControlKeyTop.prototype.enable_alphabet_mode=function (){
this.alphabet_mode=true;
var obj=this.key_item[this.language][this.current_mode];
if(obj.alphabet_mode=="undefined")
return;
if(!obj.alphabet_mode){
this.current_mode=this._get_alphabet_mode_head();};};
SFT_ControlKeyTop.prototype.disable_alphabet_mode=function (){
this.alphabet_mode=false;};
SFT_ControlKeyTop.prototype._get_alphabet_mode_head=function (){
var item=this.key_item[this.language];
var len=item.length;
for(var i=0;i<len;i++){
if(typeof item[i].alphabet_mode=="undefined")
continue;
if(!item[i].alphabet_mode){
continue;}else {
return i;}
}

return 0;};
SFT_ControlKeyTop.prototype._get_next_alphabet_mode=function (mode_num){
var org_item=this.key_item[this.language].slice(0);
var org_len=org_item.length;
var item=this.key_item[this.language].concat(org_item).slice(0);
var len=item.length;
var result=null;
for(var i=mode_num+1;i<len;i++){
if(typeof item[i].alphabet_mode=="undefined")
continue;
if(!item[i].alphabet_mode){
continue;}else {
result=i;
break;}
}

if(result){
return result%org_len;}else {
result=mode_num+1;
if(result>this.CHAR_TYPE.MODE_MAX)
result=0;
return result;}
};
SFT_ControlKeyTop.prototype.get_alphabet_mode_status=function (){
return this.alphabet_mode;};
SFT_ControlKeyTop.prototype._create_mode_max=function (item){
var len=item.length;
return len-1;};
SFT_ControlKeyTop.prototype.set_language=function (lang){
this.language=lang;};
SFT_ControlKeyTop.prototype.get_mode_text=function (mode){
var size=skin_func.calc_rate(26);
var min_size=skin_func.calc_rate(20);
var text=this.key_item[this.language][mode].func;
return {text:text,size:size,min_size:min_size};};
SFT_ControlKeyTop.prototype.get_next_mode_number=function (mode){
var next_mode_number=null;
if(!this.alphabet_mode){
next_mode_number=mode+1;
if(next_mode_number>this.CHAR_TYPE.MODE_MAX)
next_mode_number=0;}else {
next_mode_number=this._get_next_alphabet_mode(mode);}
return next_mode_number;};
SFT_ControlKeyTop.prototype.get_current_mode=function (mode){
return this.current_mode;};
SFT_ControlKeyTop.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_ControlKeyTop.prototype.set_width=function (w){
this.width=w;};
SFT_ControlKeyTop.prototype._create_char_switch_top_single=function (param){
var w=this.width+6;
var mode_text=this.get_mode_text(this.current_mode);

this.img={};
if(param.img){
this.img=new gimage({width:this.width,height:this.height,color:this.COLOR_TEXT.slice(),
src:param.img});
this.components.push(this.img);}

this.text=new gtext({width:Math.floor(w/2),text:mode_text.text,
color:this.COLOR_TEXT.slice(),
font_size:skin_func.calc_rate(20),
translate:[-w/5,this.height/4,0],
align:CENTER,visible_p:false});
this.components.push(this.text);
if(param.text){
this.text.visible_p=true;}

this.arrow=new gimage({width:this.arrow_w,height:this.arrow_h,
src:this.ARROW_IMG_PATH,
translate:[-w/5,-this.height/4+skin_func.calc_rate(3),0],
color:this.COLOR_TEXT.slice()});
this.components.push(this.arrow);

var next_mode=this.get_next_mode_number(this.current_mode);
var next_mode_text=this.get_mode_text(next_mode);
this.text_next=new gtext({width:Math.floor(w/2),text:next_mode_text.text,
color:this.COLOR_TEXT.slice(),
font_size:next_mode_text.size,
translate:[w/6,-this.height/4+skin_func.calc_rate(7),0],
align:CENTER});
this.components.push(this.text_next);
if(this.BAR_SETTING.visible_p){
var up_y=skin_func.calc_rate(5);
this.text_next.translate[1]=this.text_next.translate[1]+up_y;
this.arrow.translate[1]=this.arrow.translate[1]+up_y;}
};
SFT_ControlKeyTop.prototype._create_char_switch_top_double=function (param){
var w=this.width+6;
var mode_text=this.get_mode_text(this.current_mode);

this.img={};
if(param.img){
this.img=new gimage({width:this.width,height:this.height,color:this.COLOR_TEXT.slice(),
src:param.img});
this.components.push(this.img);}

this.text=new gtext({width:Math.floor(w/2),text:mode_text.text,
color:this.COLOR_TEXT.slice(),
font_size:skin_func.calc_rate(26),
translate:[-w/4,0,0],
align:CENTER,visible_p:false});
if(this.BAR_SETTING.visible_p){
this.text.translate[1]=skin_func.calc_rate(5);}
this.components.push(this.text);
if(param.text){
this.text.visible_p=true;}

this.arrow=new gimage({width:this.arrow_w,height:this.arrow_h,
src:this.ARROW_IMG_PATH,
translate:[0,skin_func.calc_rate(-3),0],
color:this.COLOR_TEXT.slice()});
if(this.BAR_SETTING.visible_p){
this.arrow.translate[1]=this.arrow.translate[1]+skin_func.calc_rate(6);}
this.components.push(this.arrow);

var next_mode=this.get_next_mode_number(this.current_mode);
var next_mode_text=this.get_mode_text(next_mode);
this.text_next=new gtext({width:Math.floor(w/2),text:next_mode_text.text,
color:this.COLOR_TEXT.slice(),
font_size:next_mode_text.size,
translate:[w/4,0,0],
align:CENTER});
if(this.BAR_SETTING.visible_p){
this.text_next.translate[1]=skin_func.calc_rate(5);}
this.components.push(this.text_next);};
SFT_ControlKeyTop.prototype._create_color_bar=function(param){
var color_bar=new container({translate:param.translate});
var width=skin_func.calc_rate(this.ctrl_keytop_skin.color_bar_w);
var height=skin_func.calc_rate(this.ctrl_keytop_skin.color_bar_h);
color_bar.color=param.color.slice();
var round=skin_func.calc_rate(this.ctrl_keytop_skin.color_bar_bg_round);
var bg=new gbox({width:width,height:height,color:color_bar.color.slice(),
round_enable:true,round_width:round,round_height:round});
color_bar.components=[bg,param.bar_cont];
return color_bar;};
SFT_ControlKeyTop.prototype.create=function (param,key_bg,col,row){
var self=this;
this.col=col;
this.row=row;
this.func=param.func;
this.current_mode=param.mode?param.mode:0;
var tmp_width=param.width?param.width:this.width;
this.set_width(tmp_width);
var color_w=this.width-skin_func.calc_rate(this.ctrl_keytop_skin.color_padding_w*2);
var color_h=this.height-skin_func.calc_rate(this.ctrl_keytop_skin.color_padding_h*2);
var color_round=skin_func.calc_rate(this.ctrl_keytop_skin.round);
this.color_bg=new gbox({
width:color_w,height:color_h,round_enable:true,round_width:color_round,
round_height:color_round,color:this.COLOR_DEF.slice()});
this.color_neon=new gbox({
width:color_w,height:color_h,round_enable:true,round_width:color_round,
round_height:color_round,color:this.COLOR_SEL.slice(),visible_p:false});
this.color_neon.color[3]=0;
this.components.push(this.color_bg,this.color_neon);
this.key_bg=new container({
components:[key_bg]
});
this.components.push(this.key_bg);

if(this.func=="no_action")this.COLOR_TEXT=this.COLOR_GRAY.slice();
if(this.BAR_SETTING.visible_p){
this.color_bar=this._create_color_bar({
translate:[0,
-this.height/2
+skin_func.calc_rate(this.ctrl_keytop_skin.color_bar_h
+this.ctrl_keytop_skin.color_padding_h),
0],
color:this.BAR_SETTING.color,bar_cont:this.BAR_SETTING.bar_cont});
this.components.push(this.color_bar);}
if(this.func=="char_switch"){
if(this.width>=this.wide_w){
this._create_char_switch_top_double(param);}else {
this._create_char_switch_top_single(param);}
}else {
this.img=new gimage({color:this.COLOR_TEXT.slice(),visible_p:false,
onload:function(obj,http_status,err_state){
this.visible_p=true;
force_redraw();}});
var font_size=param.font_size?param.font_size:32;
this.text=new gtext({width:this.width,text:param.text,
color:this.COLOR_TEXT.slice(),
align:CENTER,visible_p:false,
font_size:skin_func.calc_rate(font_size)});
if(this.BAR_SETTING.visible_p){
this.img.translate=[0,skin_func.calc_rate(3),0];
this.text.translate=[0,skin_func.calc_rate(7),0];}
if(param.img){
this.img.src=param.img;
if(param.img_size){
this.img.img_size=param.img_size;
this.img.width=param.img_size.w;
this.img.height=param.img_size.h;}
this.components.push(this.img);}
if(param.text){
this.text.visible_p=true;
this.components.push(this.text);}
this.arrow=null;
this.text_next=null;}

if(param.sub_func&&param.sub_text){
this.main_func=param.func;
this.main_text=param.text;
this.sub_func=param.sub_func;
this.sub_text=param.sub_text;}
this.mouse_stencil=new gbox({width:this.width,height:this.height,
color:[0,0,0,0]});
this.mouse_stencil.action=function(obj){
self._action();};
this.mouse_stencil.mouseover=function(obj){
self.mouseover_func();
self.enter();};
this.mouse_stencil.mouseout=function(obj){
self.leave();};
this.components.push(this.mouse_stencil);};
SFT_ControlKeyTop.prototype.free=function (){
if(this.is_colorkey()){
for(var i=0;i<this.color_bar.components.length;i++){
if(this.color_bar.components[i] instanceof container){
for(var j=0;j<this.color_bar.components[i].components.length;j++){
if(this.color_bar.components[i].components[j]
&&this.color_bar.components[i].components[j] instanceof gimage)
this.color_bar.components[i].components[j].src="";}
}
}
}
for(var i=0;i<this.components.length;i++){
if(this.components[i] instanceof gimage)
this.components[i].src="";
else if(this.components[i] instanceof gtext)
setf_text(this.components[i],"");}
this.components=[];};
SFT_ControlKeyTop.prototype.preset_bar_color=function (arg){
if(!arg.width||!(arg.color&&arg.color.length==4)){
this.BAR_SETTING.visible_p=false;
this.BAR_SETTING.width=0;
this.BAR_SETTING.color=[];
this.BAR_SETTING.bar_cont={};}else {
this.BAR_SETTING.visible_p=true;
this.BAR_SETTING.width=arg.width;
this.BAR_SETTING.color[0]=arg.color[0];
this.BAR_SETTING.color[1]=arg.color[1];
this.BAR_SETTING.color[2]=arg.color[2];
this.BAR_SETTING.color[3]=arg.color[3];
this.BAR_SETTING.bar_cont=arg.bar;}
};
SFT_ControlKeyTop.prototype.update_keytop=function (){
if(this.func!="char_switch")
return;
var mode_text=this.get_mode_text(this.current_mode);
setf_text(this.text,mode_text.text);
var next_mode=this.get_next_mode_number(this.current_mode);
var next_mode_text=this.get_mode_text(next_mode);
var next_fsize=next_mode_text.size;
var next_min_fsize=next_mode_text.min_size;
this.text_next.font_size=next_fsize;
while(this.text_next.width<get_text_width(this.text_next,next_mode_text.text)){
next_fsize--;
this.text_next.font_size=next_fsize;
if(next_fsize<=next_min_fsize)
break;}
setf_text(this.text_next,next_mode_text.text);};
SFT_ControlKeyTop.prototype.enter=function (){
if(!this.color_neon.visible_p)
this.color_neon.visible_p=true;
this.def_alpha=0;
this.sel_alpha=this.COLOR_SEL[3];
this.pointer_control_func();
this.anim_start();};
SFT_ControlKeyTop.prototype.leave=function (){
this.color_bg.visible_p=true;
this.def_alpha=this.COLOR_DEF[3];
this.sel_alpha=0;
this.anim_start();};
SFT_ControlKeyTop.prototype.is_enter=function (){
return this.color_neon.visible_p;};
SFT_ControlKeyTop.prototype.do_anim=function (){
var delta_def_alpha=((this.def_alpha-this.color_bg.color[3])/this.spring_constant)/this.frame_rate;
this.color_bg.color[3]=this.color_bg.color[3]+this.delta_to_integer(delta_def_alpha);
var delta_sel_alpha=((this.sel_alpha-this.color_neon.color[3])/this.spring_constant)/this.frame_rate;
this.color_neon.color[3]=this.color_neon.color[3]+this.delta_to_integer(delta_sel_alpha);
if(Math.abs(delta_def_alpha)<0.1)
this.anim_finish();};
SFT_ControlKeyTop.prototype.move_to_end=function (){
this.color_bg.color[3]=this.def_alpha;
this.color_neon.color[3]=this.sel_alpha;
if(this.def_alpha==0){
this.color_bg.visible_p=false;}
else if(this.sel_alpha==0){
this.color_neon.visible_p=false;}
};
SFT_ControlKeyTop.prototype._action=function (){
this.current_mode=this.get_next_mode_number(this.current_mode);
this.update_keytop();
if(typeof this.action_hook=="function"){
this.action_hook(this.func,this.index);}else {
console.log("[WARNING] action_hook is not function type.");}
};
SFT_ControlKeyTop.prototype.mouseover_func=function (){
if(typeof this.mouseover_hook=="function"){
this.mouseover_hook(this.col,this.row);}
};
SFT_ControlKeyTop.prototype.pointer_control_func=function (){
if(typeof this.pointer_control_hook=="function"){
var position=this.calc_pointer_position();
this.pointer_control_hook(position.x,position.y);}
};
SFT_ControlKeyTop.prototype.add_action_hook=function (hook){
this.action_hook=hook;};
SFT_ControlKeyTop.prototype.add_mouseover_hook=function (hook){
this.mouseover_hook=hook;};
SFT_ControlKeyTop.prototype.add_pointer_control_hook=function (hook){
this.pointer_control_hook=hook;};
SFT_ControlKeyTop.prototype.get_col=function (){
return this.col;};
SFT_ControlKeyTop.prototype.get_row=function (){
return this.row;};
SFT_ControlKeyTop.prototype.is_colorkey=function (){
if(this.color_bar!=undefined)
return true;
return false;};
SFT_ControlKeyTop.prototype.is_arrowkey=function (){
switch(this.func){
case "up":
case "down":
case "left":
case "right":
return true;}
return false;};
SFT_ControlKeyTop.prototype.do_action_by_color=function (color){
if(!this.is_colorkey())
return false;
for(var i=0;i<color.length;i++){
if(this.color_bar.color[i]!=color[i]){
return false;}
}
this._action();
return true;};
SFT_ControlKeyTop.prototype.get_func=function (){
return this.func;};
SFT_ControlKeyTop.prototype.get_translate=function (){
return this.translate;};
SFT_ControlKeyTop.prototype.calc_pointer_position=function (){
var position={};
position.x=this.translate[0]+Math.floor(this.width/2)-20;
position.y=this.translate[1]+ -(Math.floor(this.height*0.2));
return position;};
SFT_ControlKeyTop.prototype.switch_func_top=function (arg){
if(!arg||!arg.func)
return;
if(!this.main_func||!this.main_text||
!this.sub_func||!this.sub_text)
return;
if(this.func==arg.func)
return;
if(arg.func==this.main_func){
this.func=this.main_func;
setf_text(this.text,this.main_text);}else if(arg.func==this.sub_func){
this.func=this.sub_func;
setf_text(this.text,this.sub_text);}
};
SFT_ControlKeyTop.prototype.set_grayout_top=function (){
if(this.text.text)
this.text.color=this.COLOR_GRAY.slice();
if(this.img.src)
this.img.color=this.COLOR_GRAY.slice();
if(this.func=="char_switch"){
this.text_next.color=this.COLOR_GRAY.slice();
this.arrow.color=this.COLOR_GRAY.slice();}
};
SFT_ControlKeyTop.prototype.reset_grayout_top=function (){
if(this.text.text)
this.text.color=this.COLOR_TEXT.slice();
if(this.img.src)
this.img.color=this.COLOR_TEXT.slice();
if(this.func=="char_switch"){
this.text_next.color=this.COLOR_TEXT.slice();
this.arrow.color=this.COLOR_TEXT.slice();}
};
SFT_ControlKeyTop.prototype.get_key_info_by_func=function (func){
var info=null;
if(func==this.func){
info={};
info.func=this.func;
info.text=this.text.text;
if(this.func=="char_switch")
info.text_next=this.text_next.text;
if(this.img.img_size)
info.icon_size=this.img.img_size;}
return info;};
SFT_ControlKeyTop.prototype.is_grayout=function (){
var check_c=null;
if(this.text.text)check_c=this.text.color;
else if(this.img.src)check_c=this.img.color;
else return false;
if(check_c.length!=this.COLOR_GRAY.length)return false;
for(var i=0;i<check_c.length;i++)
if(check_c[i]!=this.COLOR_GRAY[i])return false;
return true;};
function SFT_ControlKey(init){
this.superClass=Animation;
this.superClass({});
this.ctrl_key_skin=SKIN.ctrl_key;
this.ctrl_keytop_skin=SKIN.ctrl_keytop;
this.key_width=skin_func.calc_rate(this.ctrl_keytop_skin.width);
this.key_height=skin_func.calc_rate(this.ctrl_keytop_skin.height);
this.key_narrow_w=skin_func.calc_rate(this.ctrl_keytop_skin.narrow_w)
||skin_func.calc_rate(84);this.key_wide_w=skin_func.calc_rate(this.ctrl_keytop_skin.wide_w);
this.key_margin_width=skin_func.calc_rate(this.ctrl_key_skin.margin_w);
this.key_margin_height=skin_func.calc_rate(this.ctrl_key_skin.margin_h);
this.NUM_ROW=init.num_row;
this.NUM_COL=init.num_col;
this.width=init.width;
this.height=(this.key_height*this.NUM_COL)
+(this.key_margin_height*(this.NUM_COL-1));
this.color_bar_w=skin_func.calc_rate(this.ctrl_keytop_skin.color_bar_w);
this.keytop_array=[];
this.keytop_block_array=[];
this.is_done_timing_key_up=false;
this.COLOR_BAR_CENTER_IMG_PATH=this.ctrl_key_skin.color_bar.c;
this.COLOR_BAR_LEFT_IMG_PATH=this.ctrl_key_skin.color_bar.l;
this.COLOR_BAR_RIGHT_IMG_PATH=this.ctrl_key_skin.color_bar.r;
this.img_type={
ARROW_UP:this.ctrl_key_skin.arrow.u,ARROW_DOWN:this.ctrl_key_skin.arrow.d,
ARROW_LEFT:this.ctrl_key_skin.arrow.l,ARROW_RIGHT:this.ctrl_key_skin.arrow.r,
BACKSPACE:this.ctrl_key_skin.backspace,LF:this.ctrl_key_skin.lf,
ALLCLEAR:this.ctrl_key_skin.allclear||kbd_img_path+"allclear.png",SETTING:this.ctrl_key_skin.setting
};
this.img_size={
ARROW_UP:{w:32,h:32},ARROW_DOWN:{w:32,h:32},ARROW_LEFT:{w:32,h:32},
ARROW_RIGHT:{w:32,h:32},BACKSPACE:{w:55,h:21},LF:{w:46,h:30},
ALLCLEAR:{w:38,h:38},SETTING:{w:37,h:38}
};
this.current_col=0;
this.current_row=0;
this.keytop_action=function(){};
this.keytop_mouseover=function(){};
this.keytop_pointer_control=function(){};
this.language=init.language;
this.control_key_item=control_key_item;
this.char_change_obj=null;
this.temp_arrow_grayout=false;};
SFT_ControlKey.prototype=new Animation({});
SFT_ControlKey.prototype.get_width=function (){
return this.width;};
SFT_ControlKey.prototype.get_height=function (){
return this.key_height;};
SFT_ControlKey.prototype.enter_focus=function (){
this.enter_key(this.current_col,this.current_row);};
SFT_ControlKey.prototype.leave_focus=function (){
this.leave_key(this.current_col,this.current_row);};
SFT_ControlKey.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_ControlKey.prototype.get_translate=function (){
return this.translate;};
SFT_ControlKey.prototype.set_language=function (lang){
this.language=lang;
var len=this.keytop_array.length;
for(var i=0;i<len;i++){
this.keytop_array[i].set_language(this.language);}
};
SFT_ControlKey.prototype.enable_alphabet_mode=function (){
this.char_change_obj.enable_alphabet_mode();};
SFT_ControlKey.prototype.disable_alphabet_mode=function (){
this.char_change_obj.disable_alphabet_mode();};
SFT_ControlKey.prototype.update_keytop=function (){
var len=this.keytop_array.length;
for(var i=0;i<len;i++){
this.keytop_array[i].update_keytop();}
};
SFT_ControlKey.prototype.create=function (keytop_action_hook,keytop_mouseover_hook,
keytop_pointer_control_hook,char_mode){
var self=this;
this.keytop_block_array=[];
this.key_edge=new gimage({width:this.key_width,height:this.key_height,
translate:[0,0,0],src:this.ctrl_key_skin.key_edge});
this.key_edge_n=new gimage({width:this.key_narrow_w,height:this.key_height,
translate:[0,0,0],
src:this.ctrl_key_skin.key_edge_n||kbd_img_path+"key_edge_n.png"});this.key_edge_w=new gimage({width:this.key_wide_w,height:this.key_height,
translate:[0,0,0],src:this.ctrl_key_skin.key_edge_w});
this.keytop_action=keytop_action_hook||function(){};
this.keytop_mouseover=keytop_mouseover_hook||function(){};
this.keytop_pointer_control=keytop_pointer_control_hook||function(){};

var keytop_mouseover=function (col,row){
self.force_leave_nonactive_keytop(col,row);
self.keytop_mouseover(col,row);};
var keytop_pointer_control=function (x,y){
x=self.translate[0]+x;
y=self.translate[1]+y;
self.keytop_pointer_control(x,y);};
var setting=this.control_key_item.get_setting(this.language);
var left_edge_x=-(this.width/2);
var ktop_w=this.key_width+this.key_margin_width;
var ktop_n_w=this.key_narrow_w+this.key_margin_width;
var ktop_w_w=this.key_wide_w+this.key_margin_width;
var item_info_list=[];
var color_bar=this._create_color_bar_cont();
var get_btn_w=function(w_type){
var btn_w=ktop_w;
switch(item["w_type"]){
case "NARROW":
btn_w=ktop_n_w;
break;
case "WIDE":
btn_w=ktop_w_w;
break;}
return btn_w;};
for(var i=0;i<this.NUM_ROW;i++){
var item=setting[i];
var item_info={};
item_info.w=get_btn_w(item["w_type"]);
left_edge_x+=item_info.w/2;
item_info.x=left_edge_x;
item_info_list.push(item_info);
left_edge_x+=item_info.w/2;}
for(i=0;i<this.NUM_ROW;i++){
var item=setting[i];
var img="";
var img_size={w:0,h:0};
if(item["img_type"]){
img=this.img_type[item["img_type"]]?this.img_type[item["img_type"]]:"";
if(this.img_size[item["img_type"]])img_size=this.img_size[item["img_type"]];}
var func=item["func"];
var text=item["text"]?item["text"]:"";
var sub_func=item["sub_func"]?item["sub_func"]:"";
var sub_text=item["sub_text"]?item["sub_text"]:"";
var font_size=item["font_size"]?item["font_size"]:0;
var ktop=new SFT_ControlKeyTop({language:this.language});
if(item["bar_color"]){
ktop.preset_bar_color({color:item["bar_color"],width:this.color_bar_w,bar:color_bar});}else {
ktop.preset_bar_color({color:[],width:0,bar:{}});}
var key_bg=this.key_edge;
this.keytop_block_array[i]=1;
if(item["w_type"]=="WIDE"){
key_bg=this.key_edge_w;
this.keytop_block_array[i]=ktop_w_w/ ktop_w; //2/1
}else if(item["w_type"]=="NARROW"){
key_bg=this.key_edge_n;
this.keytop_block_array[i]=ktop_n_w/ ktop_w; //0.75/1
}

var tmp_arg={func:func,text:text,img:img,img_size:img_size,
width:item_info_list[i].w,font_size:font_size};
if(func=="spc"&&(sub_func&&sub_text)){
tmp_arg.sub_func=sub_func;
tmp_arg.sub_text=sub_text;
this.spc_obj=ktop;}else if(func=="done"&&(sub_func&&sub_text)){
tmp_arg.sub_func=sub_func;
tmp_arg.sub_text=sub_text;
this.done_obj=ktop;}else if(func=="char_switch"){
tmp_arg.mode=char_mode;
this.char_change_obj=ktop;}
ktop.create(tmp_arg,key_bg,0,i);
ktop.add_action_hook(this.keytop_action);
ktop.add_mouseover_hook(keytop_mouseover);
ktop.add_pointer_control_hook(keytop_pointer_control);
ktop.set_translate([item_info_list[i].x,0,0]);
this.keytop_array.push(ktop);
this.components.push(ktop);}
};
SFT_ControlKey.prototype.free=function(){
this.key_edge.src="";
this.key_edge_n.src="";
this.key_edge_w.src="";
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&typeof this.components[i].free=="function"){
this.components[i].free();}
}
this.components=[];};
SFT_ControlKey.prototype._create_color_bar_cont=function(){
var color_bar=new container({});
var width=this.color_bar_w;
var height=skin_func.calc_rate(this.ctrl_keytop_skin.color_bar_h);
var side_width=skin_func.calc_rate(this.ctrl_keytop_skin.color_bar_side_w);
if(side_width%2==1)
side_width=side_width+1;
var img_c=new gimage({
width:width-side_width*2,height:height,translate:[0,0,0],
draw_type:DIRECT,src:this.COLOR_BAR_CENTER_IMG_PATH
});
var img_l=new gimage({
width:side_width,height:height,draw_type:DIRECT,
translate:[-(width-side_width)/2,0,0],src:this.COLOR_BAR_LEFT_IMG_PATH
});
var img_r=new gimage({
width:side_width,height:height,draw_type:DIRECT,
translate:[(width-side_width)/2,0,0],src:this.COLOR_BAR_RIGHT_IMG_PATH
});
color_bar.components=[img_c,img_l,img_r];
return color_bar;};
SFT_ControlKey.prototype.force_leave_nonactive_keytop=function (col,row){
var len=this.keytop_array.length;
for(var i=0;i<len;i++){
var target=this.keytop_array[i];
var tcol=target.get_col();
var trow=target.get_row();
if(target.is_enter()
&&!(tcol==col&&trow==row)){
target.leave();}
}
}
;
SFT_ControlKey.prototype.get_current_char_mode=function (pos){
return this.char_change_obj.get_current_mode();};
SFT_ControlKey.prototype.change_character_set=function (){
this.char_change_obj._action();};
SFT_ControlKey.prototype.get_keytop_block_array=function (){
return this.keytop_block_array.slice();};
SFT_ControlKey.prototype.switch_spc_top=function (arg){
if(!this.spc_obj)
return;
this.spc_obj.switch_func_top(arg);};
SFT_ControlKey.prototype.switch_done_top=function (arg){
if(!this.done_obj)
return;
this.done_obj.switch_func_top(arg);};
SFT_ControlKey.prototype.set_grayout_henkan_top=function (){
if(!this.spc_obj)
return;
this.spc_obj.set_grayout_top();};
SFT_ControlKey.prototype.reset_grayout_henkan_top=function (){
if(!this.spc_obj)
return;
this.spc_obj.reset_grayout_top();};
SFT_ControlKey.prototype.set_grayout_all_colorkey=function (){
var res=false;
for(var i=0;i<this.keytop_array.length;i++){
if(this.keytop_array[i].is_colorkey()){
this.keytop_array[i].set_grayout_top();}
}
};
SFT_ControlKey.prototype.reset_grayout_all_colorkey=function (){
var res=false;
for(var i=0;i<this.keytop_array.length;i++){
if(this.keytop_array[i].is_colorkey()){
this.keytop_array[i].reset_grayout_top();}
}
};
SFT_ControlKey.prototype.set_grayout_all_arrowkey=function (bool){
for(var i=0;i<this.keytop_array.length;i++){
if(this.keytop_array[i].is_arrowkey()){
if(bool)
this.keytop_array[i].reset_grayout_top();
else
this.keytop_array[i].set_grayout_top();}
}
};
SFT_ControlKey.prototype.store_temp_grayout_all_arrowkey=function (){
if(this.temp_arrow_grayout)return;
if(this.is_grayout_by_func("up")){
this.temp_arrow_grayout=true;
this.set_grayout_all_arrowkey(true);}
};
SFT_ControlKey.prototype.restore_temp_grayout_all_arrowkey=function (){
if(this.temp_arrow_grayout){
this.set_grayout_all_arrowkey(false);
this.temp_arrow_grayout=false;}
};
SFT_ControlKey.prototype.is_grayout_by_func=function (func){
var pos=this.get_key_pos_by_func(func);
return this.keytop_array[pos.row].is_grayout();};
SFT_ControlKey.prototype.set_position=function (pos){
if(!pos||pos.col==null||pos.row==null)
return;
this.current_col=pos.col;
this.current_row=pos.row;};
SFT_ControlKey.prototype.get_current_column=function (){
return this.current_col;};
SFT_ControlKey.prototype.get_current_row=function (){
return this.current_row;};
SFT_ControlKey.prototype.enter_key=function (col,row){
var obj=this.keytop_array[(col*this.NUM_ROW+row)];
obj.enter();};
SFT_ControlKey.prototype.leave_key=function (col,row){
var obj=this.keytop_array[(col*this.NUM_ROW+row)];
obj.leave();};
SFT_ControlKey.prototype.do_keytop_action_by_pos=function (col,row){
var obj=this.keytop_array[(col*this.NUM_ROW+row)];
obj._action();};
SFT_ControlKey.prototype.do_current_key_action=function (){
this.do_keytop_action_by_pos(this.current_col,this.current_row);};
SFT_ControlKey.prototype.get_setting_key_translate=function (){
var setting_key_trans=[0,0,0];
for(var i=0;i<this.keytop_array.length;i++){
if(this.keytop_array[i].get_func()=="setting"){
setting_key_trans=this.keytop_array[i].get_translate();
break;}
}
return setting_key_trans;};
SFT_ControlKey.prototype.get_key_pos_by_func=function (func){
var ret_pos=null;
for(var i=0;i<this.keytop_array.length;i++){
if(this.keytop_array[i].get_func()==func){
ret_pos={};
ret_pos.col=0;
ret_pos.row=i;
break;}
}
return ret_pos;};
SFT_ControlKey.prototype.is_done_kakutei_key_by_pos=function (col,row){
var obj=this.keytop_array[(col*this.NUM_ROW+row)];
if(obj.get_func()=="done"
||obj.get_func()=="kakutei"){
return true;}
return false;};
SFT_ControlKey.prototype.is_done_enable=function (){
if(!this.on_done_btn())
return false;
var done_obj=this.keytop_array[(this.current_col*this.NUM_ROW+this.current_row)];
if(done_obj.get_func()!="done")
return false;
if(done_obj.is_enter())
return true;
return false;};
SFT_ControlKey.prototype.do_action_by_color=function (color){
var res=false;
for(var i=0;i<this.keytop_array.length;i++){
res=this.keytop_array[i].do_action_by_color(color);
if(res){
break;}
}
return res;};
SFT_ControlKey.prototype.is_leftmost=function (row){
if(row>=this.NUM_ROW)
return true;
return false;};
SFT_ControlKey.prototype.get_setting_info=function (){
var ret_info=null;
var round_func_list=["char_switch","spc","backspace","done","henkan","kakutei","setting"];
for(var i=0;i<this.NUM_ROW;i++){
for(var k=0;k<round_func_list.length;k++){
var tmp_keytop_info=this.keytop_array[i].get_key_info_by_func(round_func_list[k]);
if(tmp_keytop_info){
if(!ret_info)
ret_info={};
ret_info[tmp_keytop_info.func]=tmp_keytop_info;
break;}
}
}
return ret_info;};
SFT_ControlKey.prototype.get_char_change_label_data=function (){
var ret_data=null;
if(this.char_change_obj)
ret_data=this.char_change_obj.get_key_info_by_func(this.char_change_obj.get_func());
return ret_data;};
SFT_ControlKey.prototype.get_spc_label_data=function (){
var ret_data=null;
if(this.spc_obj)
ret_data=this.spc_obj.get_key_info_by_func(this.spc_obj.get_func());
return ret_data;};
SFT_ControlKey.prototype.get_done_label_data=function (){
var ret_data=null;
if(this.done_obj)
ret_data=this.done_obj.get_key_info_by_func(this.done_obj.get_func());
return ret_data;};
SFT_ControlKey.prototype.get_done_timing=function (timing){
if(this.is_done_timing_key_up){
return "UP";}
return "";};
SFT_ControlKey.prototype.set_done_timing=function (timing){
if(timing&&timing=="UP"){
this.is_done_timing_key_up=true;}else {
this.is_done_timing_key_up=false;}
};
SFT_ControlKey.prototype.on_done_btn=function (){
return this.is_done_kakutei_key_by_pos(this.current_col,this.current_row);};
SFT_ControlKey.prototype.gen_stencil_list=function(c_point){
var list=[];
var ktop_array=this.keytop_array;
for(var i=0;i<ktop_array.length;i++){
if(ktop_array[i].mouse_stencil){
var stencil=ktop_array[i].mouse_stencil;
var ktop_c_point=c_point.slice();
var ktop_tran=ktop_array[i].translate;
for(var k=0;k<ktop_c_point.length;k++){
ktop_c_point[k]+=ktop_tran[k];}
stencil.c_point=ktop_c_point;
var ktop_w=stencil.width;
var ktop_h=stencil.height;
var lt_point={x:ktop_c_point[0]-ktop_w/2,y:ktop_c_point[1]+ktop_h/2};
var rb_point={x:ktop_c_point[0]+ktop_w/2,y:ktop_c_point[1]-ktop_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
list.push(stencil);}
}
return list;};
SFT_ControlKey.prototype.key_hook=function (up_down,key){
if(up_down==KEY_DOWN)return true;
if(key==TXK_ENTER){
if(this.on_done_btn()&&this.is_done_timing_key_up){
if(up_down==KEY_PRESS)return true;}else {
if(up_down==KEY_UP)return true;}
this.do_keytop_action_by_pos(this.current_col,this.current_row);
if(this.is_leftmost(this.current_row)){
return false;}else {
return true;}
}
if(up_down==KEY_UP)return true;
switch(key){
case TXK_RETURN:
return false;
case TXK_UP:
if(this.current_col-1>=0){
this.leave_key(this.current_col,this.current_row);
this.current_col--;
this.enter_key(this.current_col,this.current_row);
return true;}
break;
case TXK_DOWN:
if(this.current_col+1<this.NUM_COL){
this.leave_key(this.current_col,this.current_row);
this.current_col++;
this.enter_key(this.current_col,this.current_row);
return true;}
break;
case TXK_LEFT:
this.leave_key(this.current_col,this.current_row);
if(this.current_row-1>=0)
this.current_row--;
else
this.current_row=this.NUM_ROW-1;
this.enter_key(this.current_col,this.current_row);
return true;
case TXK_RIGHT:
this.leave_key(this.current_col,this.current_row);
if(this.current_row+1<this.NUM_ROW)
this.current_row++;
else 
this.current_row=0;
this.enter_key(this.current_col,this.current_row);
return true;}
return false;};
function SFT_SettingMenuBase(width,height,direction){
this.superClass=Animation;
this.superClass({});
this.stg_menubase_skin=SKIN.stg_menubase;
this.width=width;
this.height=height;
this.visible_p=false;
this.spring_constant=3.0;
this.frame_rate=this.get_frame_rate(70.0);
this.t_width=0;
this.t_height=0;
this.b_width=width;
this.b_height=height;
this.b_trans=[0,0,0];
this.called_anim_doing_hook=false;
this.anim_doing_hook=function(){};
this.LINE_SIZE=skin_func.calc_rate(this.stg_menubase_skin.line_size);
this.MENU_LINE_T_IMG_PATH=this.stg_menubase_skin.line_t;
this.MENU_LINE_B_IMG_PATH=this.stg_menubase_skin.line_b;
this.MENU_LINE_L_IMG_PATH=this.stg_menubase_skin.line_l;
this.MENU_LINE_R_IMG_PATH=this.stg_menubase_skin.line_r;
this.MENU_ANGLE_TL_IMG_PATH=this.stg_menubase_skin.angle_tl;
this.MENU_ANGLE_TR_IMG_PATH=this.stg_menubase_skin.angle_tr;
this.MENU_ANGLE_BL_IMG_PATH=this.stg_menubase_skin.angle_bl;
this.MENU_ANGLE_BR_IMG_PATH=this.stg_menubase_skin.angle_br;
this.bg_padding=skin_func.calc_rate(this.stg_menubase_skin.bg_padding);
this.direction=direction;};
SFT_SettingMenuBase.prototype=new Animation({});
const NULL_FUNCTION=function(){return null;};
SFT_SettingMenuBase.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_SettingMenuBase.prototype.create=function (){
if(this.direction=="VERTICAL"){
this.base=new gbox({width:this.width,height:0});}else {
this.base=new gbox({width:0,height:this.height});}

var size=this.LINE_SIZE;
this.line0=new gimage({width:0,height:size,src:this.MENU_LINE_T_IMG_PATH,
draw_type:DIRECT,onload:NULL_FUNCTION});
this.line1=new gimage({width:size,height:0,src:this.MENU_LINE_L_IMG_PATH,
draw_type:DIRECT,onload:NULL_FUNCTION});
this.line2=new gimage({width:0,height:size,src:this.MENU_LINE_B_IMG_PATH,
draw_type:DIRECT,onload:NULL_FUNCTION});
this.line3=new gimage({width:size,height:0,src:this.MENU_LINE_R_IMG_PATH,
draw_type:DIRECT,onload:NULL_FUNCTION});
this.angle0=new gimage({width:size,height:size,src:this.MENU_ANGLE_TR_IMG_PATH,
draw_type:DIRECT,onload:NULL_FUNCTION});
this.angle1=new gimage({width:size,height:size,src:this.MENU_ANGLE_TL_IMG_PATH,
draw_type:DIRECT,onload:NULL_FUNCTION});
this.angle2=new gimage({width:size,height:size,src:this.MENU_ANGLE_BL_IMG_PATH,
draw_type:DIRECT,onload:NULL_FUNCTION});
this.angle3=new gimage({width:size,height:size,src:this.MENU_ANGLE_BR_IMG_PATH,
draw_type:DIRECT,onload:NULL_FUNCTION});
var bg_round=skin_func.calc_rate(this.stg_menubase_skin.bg_round);
this.bg=new gbox({width:0,height:0,translate:[0,0,0],
color:this.stg_menubase_skin.bg_c.slice(),
round_enable:true,round_width:bg_round,round_height:bg_round});
this.components.push(
this.bg,this.line0,this.line1,this.line2,this.line3,
this.angle0,this.angle1,this.angle2,this.angle3,this.angle4);};
SFT_SettingMenuBase.prototype.free=function(){
for(var i=0;i<this.components.length;i++){
if(this.components[i] instanceof gimage){
this.components[i].src="";}
}
this.components=[];};
SFT_SettingMenuBase.prototype.setSize=function(w,h,angle){
w=Math.round(w);
h=Math.round(h);
this.width=w;
this.height=h;
var size=this.LINE_SIZE;
this.line0.width=w-size;
this.line2.width=w-size;
this.line1.height=h-size;
this.line3.height=h-size;
this.bg.width=w+size-this.bg_padding*2;
this.bg.height=h+size-this.bg_padding*2;
this.line0.translate[1]=h/2;
this.line2.translate[1]=-h/2;
this.line1.translate[0]=-w/2;
this.line3.translate[0]=w/2;
this.angle0.translate[1]=h/2;
this.angle2.translate[1]=-h/2;
this.angle1.translate[0]=-w/2;
this.angle3.translate[0]=w/2;
this.angle0.translate[0]=w/2;
this.angle2.translate[0]=-w/2;
this.angle1.translate[1]=h/2;
this.angle3.translate[1]=-h/2;

if(typeof angle=="number"){
this.rotation[0]=angle;}
};
SFT_SettingMenuBase.prototype.add_anim_doing_hook=function (hook){
if(typeof hook=="function")
this.anim_doing_hook=hook;};
SFT_SettingMenuBase.prototype.do_anim_doing_hook=function (){
this.anim_doing_hook();};
SFT_SettingMenuBase.prototype.do_anim=function (count){
if(this.direction=="VERTICAL"){
this.do_anim_vertical(count);}else {
this.do_anim_horizontal(count);}
};
SFT_SettingMenuBase.prototype.move_to_end=function (){
if(this.direction=="VERTICAL"){
this.move_to_end_vertical();}else {
this.move_to_end_horizontal();}
};
SFT_SettingMenuBase.prototype.do_anim_vertical=function (count){
var delta=((this.t_height-this.base.height)/this.spring_constant)/this.frame_rate;
this.base.height=this.base.height+delta;
this.base.translate[1]=this.base.translate[1]+delta/2;
this.translate[1]=this.translate[1]+delta/2;
this.setSize(this.width,this.base.height,0);
if(count==0){
this.visible_p=true;}
if(!this.called_anim_doing_hook&&Math.abs(delta)<2){
this.do_anim_doing_hook();
this.called_anim_doing_hook=true;}

if(Math.abs(delta)<0.1){
this.anim_finish();}
};
SFT_SettingMenuBase.prototype.move_to_end_vertical=function (){
this.base.height=this.t_height;
this.base.translate[1]=this.t_height/2;};
SFT_SettingMenuBase.prototype.extend_vertical=function (){
this.t_height=this.b_height;
this.b_trans=this.translate.slice();
this.called_anim_doing_hook=false;};
SFT_SettingMenuBase.prototype.do_anim_horizontal=function (count){
var delta=((this.t_width-this.base.width)/this.spring_constant)/this.frame_rate;
this.base.width=this.base.width+delta;
this.base.translate[0]=this.base.translate[0]+Math.floor(delta/2);
this.translate[0]=this.translate[0]+Math.floor(delta/2);
this.setSize(this.base.width,this.height,0);
if(count==0){
this.visible_p=true;}
if(!this.called_anim_doing_hook&&Math.abs(delta)<2){
this.do_anim_doing_hook();
this.called_anim_doing_hook=true;}

if(Math.abs(delta)<0.1){
this.anim_finish();}
};
SFT_SettingMenuBase.prototype.move_to_end_horizontal=function (){
this.base.width=this.t_width;
this.base.translate[0]=-this.t_width/2;};
SFT_SettingMenuBase.prototype.extend_horizontal=function (){
this.t_width=this.b_width;
this.b_trans=this.translate.slice();
this.called_anim_doing_hook=false;};
SFT_SettingMenuBase.prototype.extend=function (){
if(this.direction=="VERTICAL"){
this.extend_vertical();}else {
this.extend_horizontal();}
this.anim_start();};
SFT_SettingMenuBase.prototype.open=function (){
this.extend();};
SFT_SettingMenuBase.prototype.close=function (){
this.visible_p=false;
this.reset_direction_size();};
SFT_SettingMenuBase.prototype.reset_direction_size=function (){
if(this.id!=null){
this.anim_finish();}
if(this.direction=="VERTICAL"){
this.base.height=0;}else {
this.base.width=0;}
this.base.translate=[0,0,0];
this.translate=this.b_trans.slice();
this.line0.width=0;
this.line2.width=0;
this.line1.height=0;
this.line3.height=0;
this.line0.translate[1]=0;
this.line2.translate[1]=0;
this.line1.translate[0]=0;
this.line3.translate[0]=0;
this.angle0.translate=[0,0,0];
this.angle1.translate=[0,0,0];
this.angle2.translate=[0,0,0];
this.angle3.translate=[0,0,0];};
function SFT_MenuItem(param){
this.superClass=Animation;
this.superClass({});
this.menu_item_skin=SKIN.menu_item;
this.width=param.width?param.width:96;
this.height=param.height?param.height:48;
this.spring_constant=2.0;
this.frame_rate=this.get_frame_rate(100.0);
this.t_alpha=0;
this.func="";
this.index=0;
this.COLOR_TEXT=this.menu_item_skin.text_c;
this.action_hook=function(){};
this.mouseover_hook=function(){};
this.mouseover_after_hook=function(){};
this.pointer_control_hook=function(){};};
SFT_MenuItem.prototype=new Animation({});
SFT_MenuItem.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_MenuItem.prototype.set_index=function (index){
this.index=index;};
SFT_MenuItem.prototype.set_func=function (func){
this.func=func;};
SFT_MenuItem.prototype.get_index=function (){
return this.index;};
SFT_MenuItem.prototype.get_func=function (){
return this.func;};
SFT_MenuItem.prototype.get_text=function (){
return this.text.text;};
SFT_MenuItem.prototype.get_width=function (){
return this.width;};
SFT_MenuItem.prototype.get_height=function (){
return this.height;};
SFT_MenuItem.prototype.create=function (param){
var this_obj=this;
var line_obj=param.line;
var cursor_obj=param.cursor;
this.func="";
if(cursor_obj){
this.cursor=new container({components:[cursor_obj],visible_p:false});
this.components.push(this.cursor);}
if(line_obj){
var line=new container({translate:[0,-Math.floor(this.height/2),0],
components:[line_obj]});
this.components.push(line);}
this.text=new gtext({width:this.width,text:"",
color:this.COLOR_TEXT.slice(),
align:CENTER,
font_size:skin_func.calc_rate(32)});
this.components.push(this.text);
this.mouse_stencil=new gbox({width:this.width,height:this.height,
color:[0,0,0,0]});
this.mouse_stencil.action=function(obj){
this_obj.action();};
this.mouse_stencil.mouseover=function(obj){
this_obj.mouseover_func();
this_obj.enter();
this_obj.mouseover_after_func();};
this.mouse_stencil.mouseout=function(obj){
this_obj.leave();};
this.components.push(this.mouse_stencil);};
SFT_MenuItem.prototype.free=function (){
for(var i=0;i<this.components.length;i++){
if(this.components[i] instanceof gtext){
setf_text(this.components[i],"");}
}
};
SFT_MenuItem.prototype.update_keytop=function (text){
if(!this.text)
console.log("[WARNING] not created(SFT_MenuItem)");
setf_text(this.text,text);};
SFT_MenuItem.prototype.update_text=function (text,number){
this.update_keytop(text);
if(number)
this.set_index(number);};
SFT_MenuItem.prototype.update_property=function (obj,number){
this.update_keytop(obj.text);
this.set_func(obj.func);
this.set_index(number);};
SFT_MenuItem.prototype.enable_mouse_stencil=function (text){
this.mouse_stencil.visible_p=true;};
SFT_MenuItem.prototype.disable_mouse_stencil=function (text){
this.mouse_stencil.visible_p=false;};
SFT_MenuItem.prototype.enter=function (){
if(this.cursor&&!this.cursor.visible_p){
this.cursor.visible_p=true;}
this.pointer_control_func();};
SFT_MenuItem.prototype.leave=function (){
if(this.cursor&&this.cursor.visible_p){
this.cursor.visible_p=false;}
};
SFT_MenuItem.prototype.is_enter=function (){
return (this.t_alpha==255);};
SFT_MenuItem.prototype.action=function (){
if(typeof this.action_hook=="function"){
this.action_hook(this.func,this.index);}else {
console.log("[WARNING] action_hook is not function type.");}
};
SFT_MenuItem.prototype.mouseover_func=function (){
if(typeof this.mouseover_hook=="function"){
this.mouseover_hook(this.index);}
};
SFT_MenuItem.prototype.mouseover_after_func=function (){
if(typeof this.mouseover_after_hook=="function"){
this.mouseover_after_hook(this.index);}
};
SFT_MenuItem.prototype.pointer_control_func=function (){
if(typeof this.pointer_control_hook=="function"){
this.pointer_control_hook();}
};
SFT_MenuItem.prototype.add_action_hook=function (hook){
if(typeof hook=="function")
this.action_hook=hook;};
SFT_MenuItem.prototype.add_mouseover_hook=function (hook){
this.mouseover_hook=hook;};
SFT_MenuItem.prototype.add_mouseover_after_hook=function (hook){
this.mouseover_after_hook=hook;};
SFT_MenuItem.prototype.add_pointer_control_hook=function (hook){
this.pointer_control_hook=hook;};
function SFT_ScrollBtn(){
this.superClass=Animation;
this.superClass({});
this.scr_btn_skin=SKIN.scr_btn;
this.ARROW_IMG_PATH=this.scr_btn_skin.arrow;
this.width=skin_func.calc_rate(this.scr_btn_skin.width);
this.height=skin_func.calc_rate(this.scr_btn_skin.height);
this.stencil_w=skin_func.calc_rate(this.scr_btn_skin.stencil_w);
this.stencil_h=skin_func.calc_rate(this.scr_btn_skin.stencil_h);
this.spring_constant=2.0;
this.frame_rate=this.get_frame_rate(100.0);
this.t_alpha=0;
this.active_flag=false;
this.enter_flag=false;
this.COLOR_NEON=this.scr_btn_skin.neon_c;
this.COLOR_ON=this.scr_btn_skin.on_c;
this.COLOR_OFF=this.scr_btn_skin.off_c;
this.action_hook=function(){};};
SFT_ScrollBtn.prototype=new Animation({});
SFT_ScrollBtn.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_ScrollBtn.prototype.get_translate=function (){
return this.translate;};
SFT_ScrollBtn.prototype.create=function (arg){
var this_obj=this;
var direction=arg.direction?arg.direction:"up";
var img_rotate=[0,0,0,1];
if(direction!="UP"){
img_rotate[0]=180;}

this.base=new gimage({
width:this.width,height:this.height,src:this.ARROW_IMG_PATH,
color:this.COLOR_OFF.slice(),rotation:img_rotate
});
this.components.push(this.base);

this.mouse_stencil=new gbox({width:this.stencil_w,height:this.stencil_h,
color:[0,0,0,0]});
this.mouse_stencil.action=function(obj){
this_obj.action();};
this.mouse_stencil.mouseover=function(obj){
this_obj.enter();};
this.mouse_stencil.mouseout=function(obj){
this_obj.leave();};
this.components.push(this.mouse_stencil);};
SFT_ScrollBtn.prototype.free=function (){
for(var i=0;i<this.components.length;i++){
if(this.components[i] instanceof gimage){
this.components[i].src="";}
}
this.components=[];};
SFT_ScrollBtn.prototype.enter=function (){
this.t_alpha=255;
this.enter_flag=true;
this.base.color=this.COLOR_NEON.slice();
this.anim_start();};
SFT_ScrollBtn.prototype.leave=function (){
this.t_alpha=255;
this.enter_flag=false;
this.change_base_color();
this.anim_start();};
SFT_ScrollBtn.prototype.change_base_color=function (){
if(this.enter_flag){
this.base.color=this.COLOR_NEON.slice();
return;}
if(this.active_flag){
this.base.color=this.COLOR_ON.slice();}else {
this.base.color=this.COLOR_OFF.slice();}
};
SFT_ScrollBtn.prototype.do_anim=function (){
var delta_alpha=((this.t_alpha-this.base.color[3])/this.spring_constant)/this.frame_rate;;
this.base.color[3]=this.base.color[3]+this.delta_to_integer(delta_alpha);
if(Math.abs(delta_alpha)<0.1)
this.anim_finish();};
SFT_ScrollBtn.prototype.move_to_end=function (){
this.base.color[3]=this.t_alpha;};
SFT_ScrollBtn.prototype.action=function (){
if(typeof this.action_hook=="function"){
this.action_hook();}else {
console.log("[WARNING] action_hook is not function type.");}
};
SFT_ScrollBtn.prototype.add_action_hook=function (hook){
this.action_hook=hook;};
SFT_ScrollBtn.prototype.on=function (hook){
this.active_flag=true;
this.change_base_color();};
SFT_ScrollBtn.prototype.off=function (hook){
this.active_flag=false;
this.change_base_color();};
SFT_ScrollBtn.prototype.release=function (){
this.leave();};
function SFT_SettingMenuBody(param){
this.superClass=Animation;
this.superClass({});
this.stg_menubody_skin=SKIN.stg_menubody;
var len=param.len?param.len:5;
this.pointer_bias_y=param.pointer_bias_y||0;
this.BAR_WIDTH=30;
this.T_LIST_MAX=len+2;
this.T_LIST_NUM=len;
this.OFFSET=Math.floor((this.T_LIST_MAX-this.T_LIST_NUM)/2);
this.PITCH=skin_func.calc_rate(this.stg_menubody_skin.pitch);
this.touchpad_counter=0;
this.touchpad_anim_margin=3;
this.touchpad_reset_timer={};
this.NULL_OBJ={func:"",text:""};
this.init();};

SFT_SettingMenuBody.prototype=new Animation({});
SFT_SettingMenuBody.prototype.init=function (){
this.cand_text=[];
this.cursor_position=0;
this.position=0;
this.last_position=0;
this.cand_len=0;
this.t_translate=0;
this.c_translate=this.PITCH*2;
this.line_items_def_y=0;
if(this.cursor_obj!=null){
delete_timer(this.cursor_obj);
this.cursor_obj.translate[1]=this.PITCH*2;}
if(this.t_list_cont!=null){
delete_timer(this.t_list_cont);
this.t_list_cont.translate[1]=0;}
this.max_char_width=0;
this.action_hook=function(){};
this.mousemove_hook=function(){};
this.mousemove_after_hook=function(){};
this.pointer_control_hook=function(){};
this.scroll_anim_end_cb=function(){};
this.updatable_item={};};
SFT_SettingMenuBody.prototype.reset_data=function (){
this.cand_text=[];
this.cursor_position=0;
this.position=0;
this.last_position=0;
this.cand_len=0;
this.t_translate=0;
this.c_translate=this.PITCH*2;
if(this.cursor_obj!=null){
delete_timer(this.cursor_obj);
this.cursor_obj.translate[1]=this.PITCH*2;}
if(this.t_list_cont!=null){
delete_timer(this.t_list_cont);
this.t_list_cont.translate[1]=0;}
this.max_char_width=0;
this.updatable_item={};
this.touchpad_counter=0;
this.touchpad_anim_margin=3;
this.touchpad_reset_timer={};};
SFT_SettingMenuBody.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_SettingMenuBody.prototype.get_translate=function (){
return this.translate.slice();};
SFT_SettingMenuBody.prototype._get_keytop_text=function (obj){
if(obj.text)
return obj.text;
return "";};
SFT_SettingMenuBody.prototype._calc_window_width=function (list){
var len=list.length;
var max_width=0;

var text="";
var width=0;
for(var i=0;i<len;i++){
text=this._get_keytop_text(list[i]);
width=get_text_width(this.standard_gtext_obj,text);
if(width>max_width)
max_width=width;}
return max_width;};
SFT_SettingMenuBody.prototype.create=function (){
var this_obj=this;
this.base=new gbox(
{
});
this.cursor_obj=new gbox(
{
});

this.standard_gtext_obj=new gtext(
{
font_size:skin_func.calc_rate(36),
visible_p:false
});
var action_hook=function (func,number){
var d_pos=number-this_obj.cursor_position;
this_obj.position+=d_pos;
this_obj.do_action_hook(func);};
var mouseover_hook=function (){
this_obj.set_all_leave_cursor();
force_redraw();
};
var mouseover_after_hook=function (){
};
var pointer_control_hook=function (){
var position=this_obj.calc_pointer_position();
var bias_y=this_obj.pointer_bias_y;
position.x+=this_obj.translate[0]+this_obj.pos_control_cont.translate[0];
position.y+=this_obj.translate[1]+this_obj.pos_control_cont.translate[1]
+bias_y;
this_obj.do_pointer_control_hook(position.x,position.y);};
this.t_list=[];
var tmp_w=skin_func.calc_rate(180);
if(tmp_w%2==1)
tmp_w=tmp_w+1;
var line_side_w=skin_func.calc_rate(this.stg_menubody_skin.line_side_w);
if(line_side_w%2==1)
line_side_w=line_side_w+1;
var line_h=skin_func.calc_rate(this.stg_menubody_skin.line_h);
this.item_line=new container({});
var item_line_c=new gimage({
width:tmp_w-line_side_w*2,height:line_h,draw_type:DIRECT,
src:this.stg_menubody_skin.line.c});
var item_line_l=new gimage({
width:line_side_w,height:line_h,translate:[-Math.floor((tmp_w-line_side_w)/2),0,0],
draw_type:DIRECT,src:this.stg_menubody_skin.line.s});
var item_line_r=new gimage({
width:line_side_w,height:line_h,translate:[Math.floor((tmp_w-line_side_w)/2),0,0],
draw_type:DIRECT,flip:FLIP_HORIZONTAL,src:this.stg_menubody_skin.line.s});
this.item_line.components=[item_line_l,item_line_r,item_line_c];
var cursor_side_w=skin_func.calc_rate(this.stg_menubody_skin.cursor_side_w);
if(cursor_side_w%2==1)
cursor_side_w=cursor_side_w+1;
var cursor_h=this.PITCH+line_h;
var cursor_color=this.stg_menubody_skin.cursor_c.slice();
this.item_cursor=new container({});
var item_cursor_c=new gimage({
width:tmp_w-cursor_side_w*2,height:cursor_h,color:cursor_color.slice(),
draw_type:DIRECT,src:this.stg_menubody_skin.cursor.c});
var item_cursor_l=new gimage({
width:cursor_side_w,height:cursor_h,translate:[-Math.floor((tmp_w-cursor_side_w)/2),0,0],
color:cursor_color.slice(),draw_type:DIRECT,src:this.stg_menubody_skin.cursor.s});
var item_cursor_r=new gimage({
width:cursor_side_w,height:cursor_h,translate:[Math.floor((tmp_w-cursor_side_w)/2),0,0],
color:cursor_color.slice(),flip:FLIP_HORIZONTAL,
draw_type:DIRECT,src:this.stg_menubody_skin.cursor.s});
this.item_cursor.components=[item_cursor_c,item_cursor_l,item_cursor_r];

for(var j=0;j<this.T_LIST_MAX;j++){
var item=new SFT_MenuItem({width:tmp_w,height:this.PITCH});
item.create({cursor:this.item_cursor});
item.add_action_hook(action_hook);
item.add_mouseover_hook(mouseover_hook);
item.add_mouseover_after_hook(mouseover_after_hook);
item.add_pointer_control_hook(pointer_control_hook);
this.t_list.push(item);}
this.t_list_cont=new container({});
this.t_list_cont.components=this.t_list;
var list_len=this.t_list_cont.components.length;
list_len=(list_len>this.T_LIST_NUM)?this.T_LIST_NUM:list_len;
var line_top_y=this.PITCH*2+this.PITCH/2;
this.line_items=new container({components:[]});
this.line_items_def_y=0;
for(var i=0;i<list_len+1;i++){
this.line_items.components.push(
new container({
translate:[0,line_top_y-i*this.PITCH,0],
components:[this.item_line]})
);}
var scr_btn_skin=SKIN.scr_btn;
var ar_top_action=function (arg){
this_obj.up();};
this.ar_top=new SFT_ScrollBtn();
this.ar_top.create({direction:"UP"});
this.ar_top.set_translate([0,skin_func.calc_rate(scr_btn_skin.trans_y),0]);
this.ar_top.add_action_hook(ar_top_action);
var ar_bottom_action=function (arg){
this_obj.down();};
this.ar_bottom=new SFT_ScrollBtn();
this.ar_bottom.create({direction:"DOWN"});
this.ar_bottom.set_translate([0,skin_func.calc_rate(-scr_btn_skin.trans_y),0]);
this.ar_bottom.add_action_hook(ar_bottom_action);
this.bar=new gbox(
{
translate:[0,0,0],
width:skin_func.calc_rate(22),height:skin_func.calc_rate(100),
color:[34,66,102,255]
});
this.s_bar=new container({});
this.s_bar.translate=[0,0,0];
this.s_bar.components=[
this.ar_top,
this.ar_bottom
];
this.s_bar.appear=function (){
this.visible_p=true;};
this.s_bar.hide=function (){
this.visible_p=false;};
this.pos_control_cont=new container(
{
translate:[0,0,0],
components:[
this.line_items,
this.cursor_obj,
this.t_list_cont,
this.s_bar
]
});

this.components=[
this.pos_control_cont
];
this.set_visible(false);};
SFT_SettingMenuBody.prototype.free=function (){
delete_timer(this.touchpad_reset_timer);
for(var i=0;i<this.item_line.components.length;i++){
if(this.item_line.components[i] instanceof gimage){
this.item_line.components[i].src="";}
}
this.item_line.components=[];
for(i=0;i<this.t_list_cont.components.length;i++){
if(this.t_list_cont.components[i].free
&&typeof this.t_list_cont.components[i].free=="function"){
this.t_list_cont.components[i].free();}
}
this.t_list_cont.components=[];
this.t_list=[];
for(i=0;i<this.s_bar.components.length;i++){
if(this.s_bar.components[i].free
&&typeof this.s_bar.components[i].free=="function"){
this.s_bar.components[i].free();}
}
this.s_bar.components=[];
this.components=[];};
SFT_SettingMenuBody.prototype.set_visible=function (visible){
if(this.visible_p!=visible)
this.visible_p=visible;};
SFT_SettingMenuBody.prototype.get_visible=function (){
return this.visible_p;};
SFT_SettingMenuBody.prototype.add_action_hook=function (hook){
if(typeof hook=="function")
this.action_hook=hook;};
SFT_SettingMenuBody.prototype.do_action_hook=function (arg){
this.action_hook(arg);};
SFT_SettingMenuBody.prototype.add_mouseover_hook=function (hook){
if(typeof hook=="function")
this.mouseover_hook=hook;};
SFT_SettingMenuBody.prototype.do_mouseover_hook=function (){
};
SFT_SettingMenuBody.prototype.add_mouseover_after_hook=function (hook){
if(typeof hook=="function")
this.mouseover_after_hook=hook;};
SFT_SettingMenuBody.prototype.do_mouseover_after_hook=function (){
};
SFT_SettingMenuBody.prototype.add_pointer_control_hook=function (hook){
if(typeof hook=="function")
this.pointer_control_hook=hook;};
SFT_SettingMenuBody.prototype.do_pointer_control_hook=function (x,y){
this.pointer_control_hook(x,y);};
SFT_SettingMenuBody.prototype.add_scroll_anim_end_cb=function (hook){
if(typeof hook=="function")
this.scroll_anim_end_cb=hook;};
SFT_SettingMenuBody.prototype.do_scroll_anim_end_cb=function (){
this.scroll_anim_end_cb();};
SFT_SettingMenuBody.prototype.set_candidate=function (array){
this.reset_data();
this.cand_text=array.slice(0);
this.cand_len=this.cand_text.length;
this.max_char_width=this._calc_window_width(this.cand_text);
if(this.cand_len<=this.T_LIST_NUM)
this.s_bar.hide();};
SFT_SettingMenuBody.prototype.get_width=function (){
if(this.max_char_width==0){
console.log("[ERROR] Should be called after set_candidate().");}
return this.max_char_width;};
SFT_SettingMenuBody.prototype.get_height=function (){
var height=0;
if(this.cand_len<=this.T_LIST_NUM){
height=this.T_LIST_NUM*this.PITCH+skin_func.calc_rate(20);}else {
height=this.T_LIST_NUM*this.PITCH+skin_func.calc_rate(75);}
return height;};

SFT_SettingMenuBody.prototype.appear=function (){
if(this.cand_text.length==0){
console.log("[ERROR] No candidate!!!");
return null;}
this._element_init_view();
};
SFT_SettingMenuBody.prototype.appear_without_cursor=function (){
if(this.cand_text.length==0){
console.log("[ERROR] No candidate!!!");
return null;}
this._element_init_view();
this.disappear_cursor();
};
SFT_SettingMenuBody.prototype.appear_cursor=function (){
this.cursor_obj.visible_p=true;};
SFT_SettingMenuBody.prototype.disappear_cursor=function (){
this.cursor_obj.visible_p=false;};
SFT_SettingMenuBody.prototype.appear_item_line=function (){
this.item_line.visible_p=true;};
SFT_SettingMenuBody.prototype.disappear_item_line=function (){
this.item_line.visible_p=false;};
SFT_SettingMenuBody.prototype.appear_item_cursor=function (){
this.item_cursor.visible_p=true;};
SFT_SettingMenuBody.prototype.disappear_item_cursor=function (){
this.item_cursor.visible_p=false;};
SFT_SettingMenuBody.prototype.update_item=function (symbol,text){
var item=this.updatable_item[symbol];
item.update_text(text);};
SFT_SettingMenuBody.prototype._element_init_view=function (){
var w_width=this.max_char_width;
this.base.width=w_width;
this.cursor_obj.width=w_width-this.BAR_WIDTH;
this.pos_control_cont.translate[0]=w_width/2;

this.updatable_item={};
var target=0;
for(var i=0;i<this.T_LIST_MAX;i++){
target=i+this.position-this.OFFSET;

this.t_list[i].width=w_width-this.BAR_WIDTH;
if(this.cand_text[target]){
this.t_list[i].update_property(this.cand_text[target],target);
var updatable=this.cand_text[target].updatable;
if(updatable){
this.updatable_item[updatable]=this.t_list[i];}
}else {
this.t_list[i].update_property(this.NULL_OBJ,-1);}
this.t_list[i].translate[1]=this.PITCH*(Math.floor(this.T_LIST_MAX/2)-i);
if(i<this.OFFSET){
this.t_list[i].visible_p=false;}else if(i>=(this.T_LIST_NUM+this.OFFSET)){
this.t_list[i].visible_p=false;}else if(i>=this.cand_len+this.OFFSET){
this.t_list[i].visible_p=false;}else {
this.t_list[i].visible_p=true;}
}
this._update_scrollbar();};
SFT_SettingMenuBody.prototype._element_final_view=function (){
var target=0;
var top_pos=this.cand_len-this.T_LIST_NUM;
if(top_pos<0){
top_pos=0;}
for(var i=0;i<this.T_LIST_MAX;i++){
target=i+top_pos-this.OFFSET;
if(i<this.OFFSET){
if(this.cand_text[target]){
this.t_list[i].update_property(this.cand_text[target],target);}else {
this.t_list[i].update_property(this.NULL_OBJ,-1);}
this.t_list[i].visible_p=false;}else if(i>=(this.T_LIST_NUM+this.OFFSET)){
this.t_list[i].update_property(this.NULL_OBJ,-1);
this.t_list[i].visible_p=false;}else if(i>=this.cand_len+this.OFFSET){
this.t_list[i].update_property(this.NULL_OBJ,-1);
this.t_list[i].visible_p=false;}else {
if(this.cand_text[target]){
this.t_list[i].update_property(this.cand_text[target],target);}else {
this.t_list[i].update_property(this.NULL_OBJ,-1);}
this.t_list[i].visible_p=true;}
this.t_list[i].translate[1]=this.PITCH*(Math.floor(this.T_LIST_MAX/2)-i);}
this._update_scrollbar();};
SFT_SettingMenuBody.prototype.disappear=function (){
this.release_arrows_focus();
this.set_visible(false);
for(var i=0;i<this.T_LIST_MAX;i++){
if(this.t_list[i].get_text()!=""){
this.t_list[i].update_property(this.NULL_OBJ,-1);}
}
};
SFT_SettingMenuBody.prototype.plus=function (val,max){
var ret=val+1;
if(ret>=max)
ret=max;
return ret;};
SFT_SettingMenuBody.prototype.minus=function (val,min){
var ret=val-1;
if(ret<min)
ret=min;
return ret;};
SFT_SettingMenuBody.prototype._update_scrollbar=function (){
var max_height=180;
var bias=5;
if(this.cand_text.length>5){
var pos=this.t_list[1].number;
var par=5/(this.cand_text.length);
this.bar.height=(max_height*par);
this.bar.translate[1]=max_height/2-this.bar.height/2
-(((max_height-this.bar.height)/(this.cand_text.length-5))*pos);
if(this.t_list[5].number==(this.cand_text.length-1)){
this.ar_top.on();
this.ar_bottom.off();}else if(this.t_list[1].number==0){
this.ar_top.off();
this.ar_bottom.on();}else {
this.ar_top.on();
this.ar_bottom.on();}
}else {
this.bar.height=max_height;
this.bar.translate[1]=0;
this.ar_top.off();
this.ar_bottom.off();}
};
SFT_SettingMenuBody.prototype.up=function (){
var this_obj=this;
var anim_end_callback=function(){
this_obj.do_scroll_anim_end_cb();};
this.position=this.minus(this.position,0);
this.set_all_leave_cursor();
if(this.cursor_up()
&&this.last_position!=this.position){
this.t_translate-=this.PITCH;
this.list_up();
this._move(this.t_list_cont,this.t_translate,anim_end_callback);
this.line_items.translate[1]=this.line_items.translate[1]+this.PITCH;
this._move(this.line_items,this.line_items_def_y,null);}else if(this.last_position!=this.position){}else {if(this.cand_len<this.T_LIST_NUM){
this.cursor_position=this.cand_len-1;
this.c_translate=this.PITCH*(Math.floor(this.T_LIST_NUM/2)-(this.cand_len-1));}else {
this.cursor_position=this.T_LIST_NUM-1;
this.c_translate=-this.PITCH*Math.floor(this.T_LIST_NUM/2);}
this._move(this.cursor_obj,this.c_translate,null);
this.position=this.cand_len-1;
this.t_translate=0;
this._element_final_view();
delete_timer(this.t_list_cont);
this.t_list_cont.translate[1]=this.t_translate;
anim_end_callback();}
this.set_enter_cursor(this.cursor_position+1);
this.last_position=this.position;
this._update_scrollbar();};

SFT_SettingMenuBody.prototype.down=function (){
var this_obj=this;
var anim_end_callback=function(){
this_obj.do_scroll_anim_end_cb();};
this.position=this.plus(this.position,this.cand_len-1);
this.set_all_leave_cursor();
if(this.cursor_down()
&&this.last_position!=this.position){
this.t_translate+=this.PITCH;
this.list_down();
this._move(this.t_list_cont,this.t_translate,anim_end_callback);
this.line_items.translate[1]=this.line_items.translate[1]-this.PITCH;
this._move(this.line_items,this.line_items_def_y,null);}else if(this.last_position!=this.position){}else {this.cursor_position=0;
this.c_translate=this.PITCH*2;
this._move(this.cursor_obj,this.c_translate,null);
this.t_translate=0;
delete_timer(this.t_list_cont);
this.t_list_cont.translate[1]=this.t_translate;
this.position=0;
this._element_init_view();
anim_end_callback();}
this.set_enter_cursor(this.cursor_position+1);
this.last_position=this.position;
this._update_scrollbar();};
SFT_SettingMenuBody.prototype.list_up=function (){
this.t_list[this.T_LIST_NUM+this.OFFSET-1].visible_p=false;
var tmp=this.t_list.pop();
tmp.translate[1]=this.t_list[0].translate[1]+this.PITCH;
var pos=this.position-this.OFFSET;
if(this.cand_text[pos]){
tmp.update_property(this.cand_text[pos],pos);}else {
tmp.update_property(this.NULL_OBJ,-1);}
this.t_list.unshift(tmp);
this.t_list[this.OFFSET].visible_p=true;};
SFT_SettingMenuBody.prototype.list_down=function (){
var hoge=0;
this.t_list[this.OFFSET].visible_p=false;
var tmp=this.t_list.shift();
tmp.translate[1]=this.t_list[this.T_LIST_MAX-2].translate[1]
-this.PITCH;
var pos=this.position+this.OFFSET;
if(this.cand_text[pos]){
tmp.update_property(this.cand_text[pos],pos);}else {
tmp.update_property(this.NULL_OBJ,-1);}
this.t_list.push(tmp);
this.t_list[this.T_LIST_NUM+this.OFFSET-1].visible_p=true;};
SFT_SettingMenuBody.prototype.cursor_up=function (){
var edge=false;
this.cursor_position-=1;
if(this.cursor_position<0){
this.cursor_position=0;
edge=true;}else {
this.c_translate+=this.PITCH;
this._move(this.cursor_obj,this.c_translate,null);}
return edge;};
SFT_SettingMenuBody.prototype.cursor_down=function (){
var edge=false;
this.cursor_position+=1;
if(this.cursor_position>=this.T_LIST_NUM){
this.cursor_position=this.T_LIST_NUM-1;
edge=true;}else if(this.cursor_position>=this.cand_len){
this.cursor_position=this.cand_len-1;
edge=false;}else {
this.c_translate-=this.PITCH;
this._move(this.cursor_obj,this.c_translate,null);}
return edge;};
SFT_SettingMenuBody.prototype.scroll_up=function (){
for(var i=0;i<5;i++){
if(this.position<=0){
if(i>=1){break;}
else {this.up();}
}
this.up();}
};
SFT_SettingMenuBody.prototype.scroll_down=function (){
for(var i=0;i<5;i++){
if(this.position>=this.cand_len-1){
if(i>=1){break;}
else {this.down();}
}
this.down();}
};
SFT_SettingMenuBody.prototype._move=function (obj,target_y,end_func,end_func_for_cancel){
if(obj.__end_func_done!=true){
if(obj.__end_func_for_cancel){
obj.__end_func_for_cancel();
obj.__end_func_done=true;}
}
delete_timer(obj);
var delta=0;
obj.__end_func=end_func;
obj.__end_func_for_cancel=end_func_for_cancel;
obj.__end_func_done=false;
delta=(target_y-obj.translate[1])*0.8;
obj.translate[1]+=delta;
append_timer(obj,TIMER_RESOLUTION,
function (obj,count){
delta=(target_y-obj.translate[1])/2;
if(count>=7){
delete_timer(obj);
obj.translate[1]=target_y;
if(obj.__end_func){
obj.__end_func();
obj.__end_func_done=true;}
}else {
obj.translate[1]+=delta;}
force_redraw();});};
SFT_SettingMenuBody.prototype.get_cursor_position=function (){
return this.position;};
SFT_SettingMenuBody.prototype.enter_action=function (){
var target=this.cand_text[this.position];
var func=target.func;
this.do_action_hook(func);};
SFT_SettingMenuBody.prototype.set_enter_cursor=function (trg_cursor_pos){
this.t_list[trg_cursor_pos].enter();};
SFT_SettingMenuBody.prototype.set_leave_cursor=function (trg_cursor_pos){
this.t_list[trg_cursor_pos].leave();};
SFT_SettingMenuBody.prototype.set_all_leave_cursor=function (){
for(var i=0;i<this.t_list.length;i++){
this.set_leave_cursor(i);}
};
SFT_SettingMenuBody.prototype.set_cursor_position_by_state=function (){
for(var i=0;i<this.t_list.length;i++){
if(this.t_list[i].is_enter()){
this.cursor_position=i-1;
return;}
}
this.cursor_position=0;};
SFT_SettingMenuBody.prototype.calc_pointer_position=function (){
var trg_obj=this.t_list[this.cursor_position+1];
var trg_w=trg_obj.get_width();
var trg_h=trg_obj.get_height();
var base_pos_y=this.PITCH*2;
var position={};
position.x=Math.floor(trg_w/2)-skin_func.calc_rate(40);
position.y=base_pos_y-(this.PITCH*this.cursor_position)
+ -(Math.floor(trg_h/2)-14);
return position;};
SFT_SettingMenuBody.prototype.enter_focus=function (){
this.set_enter_cursor(this.cursor_position+1);};
SFT_SettingMenuBody.prototype.leave_focus=function (){
this.set_all_leave_cursor();};
SFT_SettingMenuBody.prototype.release_arrows_focus=function (){
this.ar_top.release();
this.ar_bottom.release();};
SFT_SettingMenuBody.prototype.do_touchpad_anim=function(direction){
this.touchpad_counter+=direction;
delete_timer(this.touchpad_reset_timer);
if((this.touchpad_counter%this.touchpad_anim_margin)==0){
if(direction>=0){
this.down();}
else {
this.up();}
}
else {
var self=this;
append_timer(this.touchpad_reset_timer,4000,function(obj,count){
delete_timer(obj);
self.touchpad_counter=0;});}
};
SFT_SettingMenuBody.prototype.key_hook=function (up_down,keysym){
if(up_down!=KEY_PRESS)return true;
switch(keysym){
case TXK_UP:
this.up();
return true;
break;
case TXK_DOWN:
this.down();
return true;
break;
case TXK_ENTER:
this.enter_action();
return true;
break;}
return false;};
function SFT_SettingMenu(init){
this.superClass=Animation;
this.superClass({});
this.stg_menu_skin=SKIN.stg_menu;
this.language=init.language;
this.menu_item=init.menu_item;
this.lang_menu_item=setting_LangList;
this.visible_p=false;
this.width=init.width;
this.height=init.height;
this.setting_key_x=init.setting_key_x;
this.setting_img_size=init.setting_img_size;
this.mask_y=init.mask_y;

this.action_hook=function (){};
this.close_action_hook=function (){};
this.pointer_control_hook=function (){};};
SFT_SettingMenu.prototype=new Animation({});
SFT_SettingMenu.prototype.find_lang_text=function (target){
var list=this.lang_menu_item.get_setting(this.language);
var len=list.length;
for(var i=0;i<len;i++){
if(list[i].func==target){
return list[i].text;}
}
return "";};
SFT_SettingMenu.prototype._create_setting_key=function (){
var self=this;
var ctrl_keytop_skin=SKIN.ctrl_keytop;
var ctrl_key_skin=SKIN.ctrl_key;
var setting_key=new container({translate:[this.setting_key_x,0,0]});
var key_width=skin_func.calc_rate(ctrl_keytop_skin.width);
var key_height=skin_func.calc_rate(ctrl_keytop_skin.height);
var color_round=skin_func.calc_rate(ctrl_keytop_skin.round);
var key_color=new gbox({
width:key_width-ctrl_keytop_skin.color_padding_w*2,
height:key_height-ctrl_keytop_skin.color_padding_h*2,
round_enable:true,round_width:color_round,round_height:color_round,
color:this.stg_menu_skin.key_c.slice()});
var key_edge=new gimage({
width:key_width,height:key_height,src:ctrl_key_skin.key_edge,
action:function(obj){
self.close_action_hook();},
mouseover:function(obj){},mouseout:function(obj){}
});
var key_icon=new gimage({
width:this.setting_img_size.w,height:this.setting_img_size.h,
src:ctrl_key_skin.setting,color:ctrl_keytop_skin.text_c.slice(),visible_p:false,
onload:function(obj,http_status,err_state){
this.visible_p=true;
force_redraw();}});
setting_key.components=[key_color,key_edge,key_icon];
return setting_key;};
SFT_SettingMenu.prototype.create=function (anim_all_end_hook,
close_action_hook,
update_stencil_hook,
pointer_control_hook){
var self=this;
this.pointer_control_hook=pointer_control_hook;
this.anim_all_end_hook=anim_all_end_hook;
this.update_stencil_hook=update_stencil_hook;
this.close_action_hook=close_action_hook;
this.mask=new gbox({width:this.width,height:this.height,
color:[0,0,0,0],translate:[0,this.mask_y,0]
});
this.mask.action=function(obj){
self.close_action_hook();};
this.mask.mouseover=function(obj){};
this.mask.mouseout=function(obj){};
this.components.push(this.mask);
this.setting_key=this._create_setting_key();
this.components.push(this.setting_key);
var main_menu_hook=function (arg){
self.main_menu_action_hook(arg);};
this.main_menu_body=new SFT_SettingMenuBody({len:1});
this.main_menu_body.create();
var setting=this.menu_item.get_setting(this.language);
this.main_menu_body.set_candidate(setting);
this.main_menu_body.add_action_hook(main_menu_hook);
this.main_menu_body.disappear_cursor();
this.main_menu_body.disappear_item_line();
this.main_menu_body.disappear_item_cursor();
this.main_menu_body.appear();
var text=this.find_lang_text(this.language);
this.main_menu_body.update_item("CHANGE_LANG",text);
var main_body_width=this.main_menu_body.get_width();
var main_body_height=this.main_menu_body.get_height();
var main_center_bottom_x=this.setting_key_x+main_body_width/2;
var main_center_bottom_y=skin_func.calc_rate(40);
var main_body_center_x=main_center_bottom_x-main_body_width;
var main_body_center_y=main_center_bottom_y+main_body_height/2;
var main_width=main_body_width;
var main_height=main_body_height;
var main_center_x=main_center_bottom_x-main_width/2;
var main_center_y=main_center_bottom_y;
var main_anim_doing_hook=function (){
self.main_anim_doing_action_hook();};
this.main_menu_base=new SFT_SettingMenuBase(main_width,main_height,
"VERTICAL");
this.main_menu_base.create();
this.main_menu_base.set_translate([main_center_x,main_center_y,0]);
this.main_menu_base.add_anim_doing_hook(main_anim_doing_hook);
this.components.push(this.main_menu_base,this.main_menu_body);
this.main_menu_body.set_translate([main_body_center_x,main_body_center_y,0]);
var change_lang_hook=function (arg){
self.change_lang_body.disappear();
self.change_lang_base.close();
self.change_lang_action_hook(arg);};
var lang_pointer_control_hook=function (x,y){
x=x+skin_func.calc_rate(30);
self.pointer_control_hook(x,y);};
var scroll_anim_end_cb=function(){
self.scroll_anim_end_callback();};
this.change_lang_body=new SFT_SettingMenuBody({
pointer_bias_y:-(this.height-skin_func.calc_rate(116))
});
this.change_lang_body.create();
var list=this.lang_menu_item.get_setting(this.language);
this.change_lang_body.set_candidate(list);
this.change_lang_body.add_action_hook(change_lang_hook);
this.change_lang_body.add_pointer_control_hook(lang_pointer_control_hook);
this.change_lang_body.add_scroll_anim_end_cb(scroll_anim_end_cb);
this.change_lang_body.disappear_cursor();
var lang_center_bottom_x=main_center_bottom_x+skin_func.calc_rate(30);
var lang_center_bottom_y=main_center_bottom_y;
var lang_body_width=this.change_lang_body.get_width();
var lang_body_height=this.change_lang_body.get_height();
var lang_body_center_x=lang_center_bottom_x-skin_func.calc_rate(3);
var lang_body_center_y=lang_center_bottom_y+lang_body_height/2;
var lang_width=lang_body_width;
var lang_height=lang_body_height;
var lang_center_x=lang_center_bottom_x;
var lang_center_y=lang_center_bottom_y+lang_height/2;
var lang_anim_doing_hook=function (){
self.lang_anim_doing_action_hook();};
this.change_lang_base=new SFT_SettingMenuBase(lang_width,lang_height,
"HORIZONTAL");
this.change_lang_base.create();
this.change_lang_base.set_translate([lang_center_x,lang_center_y,0]);
this.change_lang_base.add_anim_doing_hook(lang_anim_doing_hook);
this.components.push(this.change_lang_base,this.change_lang_body);
this.change_lang_body.set_translate([lang_body_center_x,lang_body_center_y,0]);};
SFT_SettingMenu.prototype.free=function(){
for(var i=0;i<this.setting_key.components.length;i++){
if(this.setting_key.components[i] instanceof gimage){
this.setting_key.components[i].src="";}
}
for(i=0;i<this.components.length;i++){
if(this.components[i].free&&typeof this.components[i].free=="function"){
this.components[i].free();}
}
this.components=[];};
SFT_SettingMenu.prototype.set_translate=function(trans){
this.translate[0]=trans[0];
this.translate[1]=trans[1];
this.translate[2]=trans[2];};
SFT_SettingMenu.prototype.get_translate=function (){
return this.translate;};
SFT_SettingMenu.prototype.main_menu_action_hook=function (arg){
};
SFT_SettingMenu.prototype.main_anim_doing_action_hook=function (){
this.main_menu_body.set_visible(true);
this.change_lang_base.open();};
SFT_SettingMenu.prototype.lang_anim_doing_action_hook=function (){
this.change_lang_body.set_visible(true);
this.enter_to_change_lang_body();
this.update_stencil_hook();
if(typeof this.anim_all_end_hook=="function"){
this.anim_all_end_hook();}
};
SFT_SettingMenu.prototype.change_lang_action_hook=function (lang){
var text=this.find_lang_text(lang);
this.main_menu_body.update_item("CHANGE_LANG",text);
if(typeof this.action_hook=="function"){
this.action_hook(lang);}
};
SFT_SettingMenu.prototype.scroll_anim_end_callback=function (){
this.update_stencil_hook();};
SFT_SettingMenu.prototype.open=function (){
this.visible_p=true;
var setting=this.lang_menu_item.get_setting(this.language);
this.change_lang_body.set_candidate(setting);
this.change_lang_body.appear_without_cursor();
this.update_stencil_hook();
this.main_menu_base.open();};
SFT_SettingMenu.prototype.close=function (){
this.visible_p=false;
this.main_menu_body.set_visible(false);
this.change_lang_body.set_visible(false);
this.main_menu_base.close();
this.change_lang_base.close();
this.update_stencil_hook();};
SFT_SettingMenu.prototype.set_action_hook=function (hook){
if(typeof hook=="function")
this.action_hook=hook;};
SFT_SettingMenu.prototype.enter_focus=function (obj){
};
SFT_SettingMenu.prototype.leave_focus=function (obj){
common_key.set_cursor(this,null);
this.close();};
SFT_SettingMenu.prototype.is_active=function (){
return this.visible_p;};
SFT_SettingMenu.prototype.enter_to_change_lang_body=function (){
common_key.set_cursor(this,this.change_lang_body);};
SFT_SettingMenu.prototype.reset_change_lang_focus=function (){
if(!this.is_active())
return;
this.release_arrows_focus();
this.change_lang_body.leave_focus();
this.change_lang_body.enter_focus();};
SFT_SettingMenu.prototype.release_arrows_focus=function (){
this.change_lang_body.release_arrows_focus();};
SFT_SettingMenu.prototype.gen_stencil_list=function(c_point){
var list=[];
if(this.is_active()){
list.push(this.gen_mask_stencil(c_point));if(this.change_lang_body.get_visible()){
var main_menu_list=this.gen_main_menu_stencil(c_point);var change_lang_list=this.gen_change_lang_stencil(c_point);list=change_lang_list.concat(main_menu_list,list);}
}
return list;};
SFT_SettingMenu.prototype.gen_mask_stencil=function(c_point){
var stencil=this.mask;
var mask_c_point=c_point.slice();
var mask_tran=stencil.translate;
for(var i=0;i<mask_c_point.length;i++){
mask_c_point[i]+=mask_tran[i];}
stencil.c_point=mask_c_point;
var mask_w=stencil.width;
var mask_h=stencil.height;
var lt_point={x:mask_c_point[0]-mask_w/2,y:mask_c_point[1]+mask_h/2};
var rb_point={x:mask_c_point[0]+mask_w/2,y:mask_c_point[1]-mask_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
return stencil;};
SFT_SettingMenu.prototype.gen_main_menu_stencil=function(c_point){
var list=[];
var stencil_c_point=c_point.slice();
var main_menu=this.main_menu_body;
var main_menu_tran=main_menu.get_translate();
var menu_item_w=main_menu.max_char_width;
main_menu_tran[0]+=menu_item_w/2;for(var i=0;i<stencil_c_point.length;i++){
stencil_c_point[i]+=main_menu_tran[i];}
var stencil=main_menu.t_list[0].mouse_stencil;stencil.c_point=stencil_c_point;
var stencil_w=stencil.width;
var stencil_h=stencil.height;
var lt_point={x:stencil_c_point[0]-stencil_w/2,y:stencil_c_point[1]+stencil_h/2};
var rb_point={x:stencil_c_point[0]+stencil_w/2,y:stencil_c_point[1]-stencil_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
list.push(stencil);
return list;};
SFT_SettingMenu.prototype.gen_change_lang_stencil=function(c_point){
var list=[];
var change_lang=this.change_lang_body;
var change_lang_tran=change_lang.get_translate();
var arrow_list=change_lang.s_bar.components;
var lang_item_w=change_lang.get_width();
change_lang_tran[0]+=lang_item_w/2;
var t_list=change_lang.t_list;
var reset_items=arrow_list.concat(t_list);
for(var i=0;i<reset_items.length;i++){
var stencil=reset_items[i].mouse_stencil;
if(!stencil)continue;
stencil.c_point=null;
stencil.lt_point=null;
stencil.rb_point=null;}
for(i=0;i<arrow_list.length;i++){
var stencil=arrow_list[i].mouse_stencil;
if(!stencil)continue;
var stencil_c_point=c_point.slice();
var arrow_tran=arrow_list[i].get_translate();
for(var k=0;k<stencil_c_point.length;k++){
stencil_c_point[k]+=change_lang_tran[k];
stencil_c_point[k]+=arrow_tran[k];}
stencil.c_point=stencil_c_point;
var arrow_w=stencil.width;
var arrow_h=stencil.height;
var lt_point={x:stencil.c_point[0]-arrow_w/2,y:stencil.c_point[1]+arrow_h/2};
var rb_point={x:stencil.c_point[0]+arrow_w/2,y:stencil.c_point[1]-arrow_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
list.push(stencil);}
var lang_item_h=change_lang.PITCH;
var lang_item_num=change_lang.T_LIST_NUM;
change_lang_tran[1]+=lang_item_h*lang_item_num/ 2; //setlistheady
for(i=1;i<=lang_item_num;i++){
var stencil=t_list[i].mouse_stencil;
if(!stencil)continue;
change_lang_tran[1]-=lang_item_h/2;
var stencil_c_point=c_point.slice();
for(var k=0;k<stencil_c_point.length;k++){
stencil_c_point[k]+=change_lang_tran[k];}
stencil.c_point=stencil_c_point;
var lt_point={x:stencil.c_point[0]-lang_item_w/2,y:stencil.c_point[1]+lang_item_h/2};
var rb_point={x:stencil.c_point[0]+lang_item_w/2,y:stencil.c_point[1]-lang_item_h/2};
stencil.lt_point=lt_point;
stencil.rb_point=rb_point;
list.push(stencil);
change_lang_tran[1]-=lang_item_h/2;}
return list;};
SFT_SettingMenu.prototype.send_touchpad_z=function (direction){
if(this.cursor&&typeof this.cursor.do_touchpad_anim
&&typeof this.cursor.do_touchpad_anim=="function")
this.cursor.do_touchpad_anim(direction);};
SFT_SettingMenu.prototype.key_hook=function (up_down,keysym){
if(up_down!=KEY_PRESS)return true;
var ret=false;
if(this.cursor&&typeof this.cursor.key_hook=="function"){
ret=this.cursor.key_hook(up_down,keysym);
if(ret)return true;}else {
console.log("[ERROR] this.cursor.key_hook is not function.");
return false;}
return false;};
var SFT_TextboxBG=function(param){
param=param||{};
this.tbox_bg_skin=SKIN.tbox_bg;
this.BG_CENTER_IMG_PATH="";
this.BG_LEFT_IMG_PATH="";
this.BG_RIGHT_IMG_PATH="";
this.spring_constant=2.0;
this.frame_rate=this.get_frame_rate(100.0);
this.width=param.width;
this.height=param.height;
this.SIDE_WIDTH=this.tbox_bg_skin.bg_side_w;
this.def_alpha=0;
this.sel_alpha=0;
this.COLOR_DEF=this.tbox_bg_skin.def_c;
this.COLOR_SEL=this.tbox_bg_skin.sel_c;
this.pointer_control_hook=param.pointer;
this.leave_focus_hook=param.leave;
this.left_action_hook=param.left;
this.right_action_hook=param.right;
this.down_action_hook=param.down;};
SFT_TextboxBG.prototype=new Animation({});
SFT_TextboxBG.prototype.create=function(){
var color_w=this.width-this.tbox_bg_skin.color_padding_w*2;
var color_h=this.height-this.tbox_bg_skin.color_padding_h*2;
var color_round=skin_func.calc_rate(this.tbox_bg_skin.round);
this.color_bg=new gbox({width:color_w,height:color_h,round_enable:true,
round_width:color_round,round_height:color_round,
color:this.COLOR_DEF.slice()});
this.color_neon=new gbox({width:color_w,height:color_h,round_enable:true,
round_width:color_round,round_height:color_round,
color:this.COLOR_SEL.slice(),visible_p:false});
this.color_neon.color[3]=0;
this.base_c=new gimage({
width:this.width-this.SIDE_WIDTH*2,height:this.height,
translate:[0,0,0],draw_type:DIRECT,src:this.BG_CENTER_IMG_PATH
});
this.base_l=new gimage({
width:this.SIDE_WIDTH,height:this.height,draw_type:DIRECT,
translate:[-(this.width-this.SIDE_WIDTH)/2,0,0],src:this.BG_LEFT_IMG_PATH
});
this.base_r=new gimage({
width:this.SIDE_WIDTH,height:this.height,draw_type:DIRECT,
translate:[(this.width-this.SIDE_WIDTH)/2,0,0],src:this.BG_RIGHT_IMG_PATH
});
this.components=[this.color_bg,this.color_neon,
this.base_c,this.base_l,this.base_r];};
SFT_TextboxBG.prototype.free=function (){
for(var i=0;i<this.components.length;i++){
if(this.components[i] instanceof gimage){
this.components[i].src="";}
}
this.components=[];};
SFT_TextboxBG.prototype.enter_focus=function (){
if(!this.color_neon.visible_p)
this.color_neon.visible_p=true;
this.def_alpha=0;
this.sel_alpha=this.COLOR_SEL[3];
this.pointer_control();
this.anim_start();};
SFT_TextboxBG.prototype.leave_focus=function (){
if(typeof this.leave_focus_hook=="function"){
this.leave_focus_hook();}
this.color_bg.visible_p=true;
this.def_alpha=this.COLOR_DEF[3];
this.sel_alpha=0;
this.anim_start();};
SFT_TextboxBG.prototype.set_translate=function (trans){
this.translate=trans;};
SFT_TextboxBG.prototype.is_enter=function (){
return this.color_neon.visible_p;};
SFT_TextboxBG.prototype.pointer_control=function (){
if(typeof this.pointer_control_hook=="function"){
var position=this.calc_pointer_position();
this.pointer_control_hook(position.x,position.y);}
};
SFT_TextboxBG.prototype.calc_pointer_position=function (){
var position={};
position.x=this.translate[0]+Math.floor(this.width*0.47);
position.y=this.translate[1]+ -(Math.floor(this.height*0.2));
return position;};
SFT_TextboxBG.prototype.get_height=function (){
return this.height;};
SFT_TextboxBG.prototype.do_anim=function (){
var delta_def_alpha=((this.def_alpha-this.color_bg.color[3])/this.spring_constant)/this.frame_rate;
this.color_bg.color[3]=this.color_bg.color[3]+this.delta_to_integer(delta_def_alpha);
var delta_sel_alpha=((this.sel_alpha-this.color_neon.color[3])/this.spring_constant)/this.frame_rate;
this.color_neon.color[3]=this.color_neon.color[3]+this.delta_to_integer(delta_sel_alpha);
if(Math.abs(delta_def_alpha)<0.1)
this.anim_finish();};
SFT_TextboxBG.prototype.move_to_end=function (){
this.color_bg.color[3]=this.def_alpha;
this.color_neon.color[3]=this.sel_alpha;
if(this.def_alpha==0){
this.color_bg.visible_p=false;}
else if(this.sel_alpha==0){
this.color_neon.visible_p=false;}
};
SFT_TextboxBG.prototype.release_focus=function(){
this.down_action_hook();};
SFT_TextboxBG.prototype.set_visible=function(visible){
if(this.visible_p!=visible)
this.visible_p=visible;};
SFT_TextboxBG.prototype.key_hook=function(up_down,keysym){
if(up_down!=KEY_PRESS)return true;
switch(keysym){
case TXK_LEFT:
this.left_action_hook();
return true;
break;
case TXK_RIGHT:
this.right_action_hook();
return true;
break;
case TXK_RETURN:
case TXK_DOWN:
this.down_action_hook();
return true;
break;}
return false;};
function SFT_DummySoftKBDInput(){
this.superClass=container;
this.superClass({});

this.text_box=null;};
SFT_DummySoftKBDInput.prototype=new container({});
SFT_DummySoftKBDInput.prototype.set_unconverted_textbox=function (obj){
console_log(">> SFT_DummySoftKBDInput.prototype.set_unconverted_textbox");
this.text_box=obj;};
SFT_DummySoftKBDInput.prototype.create_obj=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.create_obj");
return this.text_box;};
SFT_DummySoftKBDInput.prototype.init=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.init");};

SFT_DummySoftKBDInput.prototype._set_cursor_pos=function (x,y){
console_log(">> SFT_DummySoftKBDInput.prototype._set_cursor_pos");};

SFT_DummySoftKBDInput.prototype._create_forecast_obj=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._create_forecast_obj");};
SFT_DummySoftKBDInput.prototype.set_expand_direction=function (d){
console_log(">> SFT_DummySoftKBDInput.prototype.set_expand_direction");};
SFT_DummySoftKBDInput.prototype.get_expand_direction=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.get_expand_direction");};
SFT_DummySoftKBDInput.prototype.set_forecast_state=function (state){
console_log(">> SFT_DummySoftKBDInput.prototype.set_forecast_state");};
SFT_DummySoftKBDInput.prototype.control_forecast_obj=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.control_forecast_obj");};
SFT_DummySoftKBDInput.prototype.undisplay_forecast_obj=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.undisplay_forecast_obj");};
SFT_DummySoftKBDInput.prototype._is_display_forecast=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._is_displaty_forecast");};
SFT_DummySoftKBDInput.prototype._exist_forecast_obj=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._exist_forecast_obj");};
SFT_DummySoftKBDInput.prototype._is_cursor_in_forecast=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._is_cursor_in_forecast");};
SFT_DummySoftKBDInput.prototype._forecast_key_move=function (key){
console_log(">> SFT_DummySoftKBDInput.prototype._forecast_key_move");};
SFT_DummySoftKBDInput.prototype._enter_move_cursor_mode=function (mode){
console_log(">> SFT_DummySoftKBDInput.prototype._enter_move_cursor_mode");};
SFT_DummySoftKBDInput.prototype._leave_move_cursor_mode=function (mode){
console_log(">> SFT_DummySoftKBDInput.prototype._leave_move_cursor_mode");};
SFT_DummySoftKBDInput.prototype.is_move_cursor_mode=function (mode){
console_log(">> SFT_DummySoftKBDInput.prototype.is_move_cursor_mode");};

SFT_DummySoftKBDInput.prototype.leave_move_cursor_mode=function (mode){
console_log(">> SFT_DummySoftKBDInput.prototype.leave_move_cursor_mode");};
SFT_DummySoftKBDInput.prototype.change_color_guide_mode=function (mode){
console_log(">> SFT_DummySoftKBDInput.prototype.change_color_guide_mode");};
SFT_DummySoftKBDInput.prototype.change_input_char_set=function (obj){
console_log(">> SFT_DummySoftKBDInput.prototype.change_input_char_set");};

SFT_DummySoftKBDInput.prototype.toggle_input_mode=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.toggle_input_mode");};
SFT_DummySoftKBDInput.prototype.get_input_mode=function (mode){
console_log(">> SFT_DummySoftKBDInput.prototype.get_input_mode");};
SFT_DummySoftKBDInput.prototype.set_input_mode=function (mode){
console_log(">> SFT_DummySoftKBDInput.prototype.set_input_mode");};
SFT_DummySoftKBDInput.prototype.set_key_top=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.set_key_top");};
SFT_DummySoftKBDInput.prototype._set_key_top=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._set_key_top");};
SFT_DummySoftKBDInput.prototype.set_candidate_info=function (can){
console_log(">> SFT_DummySoftKBDInput.prototype.set_candidate_info");};
SFT_DummySoftKBDInput.prototype.clear=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.clear");};
SFT_DummySoftKBDInput.prototype.clear_keyboard_only=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.clear_keyboard_only");
this.text_box.clear();};
SFT_DummySoftKBDInput.prototype.get_text=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.get_text");
return this.text_box.get_text();};
SFT_DummySoftKBDInput.prototype.get_text_array=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.get_text_array");
return this.text_box.get_text_array();};
SFT_DummySoftKBDInput.prototype.set_empty_hook=function (func){
console_log(">> SFT_DummySoftKBDInput.prototype.set_emply_hook");};
SFT_DummySoftKBDInput.prototype.set_change_text_hook=function (func){
console_log(">> SFT_DummySoftKBDInput.prototype.set_change_text_hook");};
SFT_DummySoftKBDInput.prototype.set_select_forecast_hook=function (func){
console_log(">> SFT_DummySoftKBDInput.prototype.set_select_forecast_hook");};
SFT_DummySoftKBDInput.prototype.set_text=function (text,cursor_pos){
console_log(">> SFT_DummySoftKBDInput.prototype.set_text");
return this.text_box.set_text(text);};
SFT_DummySoftKBDInput.prototype.get_cursor_position=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.get_cursor_position");};
SFT_DummySoftKBDInput.prototype.get_cursor_width=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.get_cursor_width");};
SFT_DummySoftKBDInput.prototype.get_text_width=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.get_text_width");};
SFT_DummySoftKBDInput.prototype.appear=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.appear");
};
SFT_DummySoftKBDInput.prototype.disappear=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.disappear");
this.text_box.visible_p=false;
this.text_box.set_text("");};
SFT_DummySoftKBDInput.prototype.appear_kbd=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.appear_kdb");};
SFT_DummySoftKBDInput.prototype.disappear_kbd=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.disappear_kbd");};
SFT_DummySoftKBDInput.prototype.disable_move_kbd=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.disable_move_kbd");};

SFT_DummySoftKBDInput.prototype.enable_move_kbd=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.enable_move_kbd");};

SFT_DummySoftKBDInput.prototype._move_focus=function (anim){
console_log(">> SFT_DummySoftKBDInput.prototype._move_focus");};
SFT_DummySoftKBDInput.prototype._move_forecast_focus=function (anim){
console_log(">> SFT_DummySoftKBDInput.prototype._move_forecast_focus");};

SFT_DummySoftKBDInput.prototype._cursor_exception_move=function (direction){
console_log(">> SFT_DummySoftKBDInput.prototype._cursor_exception_move");};

SFT_DummySoftKBDInput.prototype._cursor_up=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._cursor_up");};
SFT_DummySoftKBDInput.prototype._cursor_down=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._cursor_down");};
SFT_DummySoftKBDInput.prototype._cursor_left=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._cursor_left");};
SFT_DummySoftKBDInput.prototype._cursor_right=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._cursor_right");};
SFT_DummySoftKBDInput.prototype._move_keyboard=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._move_keyboard");};
SFT_DummySoftKBDInput.prototype.adjust_translate=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.adjust_translate");};
SFT_DummySoftKBDInput.prototype._is_handaku_action=function (x,y){
console_log(">> SFT_DummySoftKBDInput.prototype._is_handaku_action");};

SFT_DummySoftKBDInput.prototype._is_dakuten_action=function (x,y){
console_log(">> SFT_DummySoftKBDInput.prototype._is_dakuten_action");};

SFT_DummySoftKBDInput.prototype._cursor_ok=function (){
console_log(">> SFT_DummySoftKBDInput.prototype._cursor_ok");};
SFT_DummySoftKBDInput.prototype._drive_fast_move=function (up_down,keysym){
console_log(">> SFT_DummySoftKBDInput.prototype._drive_fast_move");};
SFT_DummySoftKBDInput.prototype.key_hook=function (up_down,keysym){
console_log(">> SFT_DummySoftKBDInput.prototype.key_hook");
console_log("## keysym.code = "+keysym.code);};
SFT_DummySoftKBDInput.prototype.free=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.free");};
SFT_DummySoftKBDInput.prototype.revive=function (){
console_log(">> SFT_DummySoftKBDInput.prototype.revive");};
function SFT_DummyScrollSelection(){
this.superClass=container;
this.superClass({});
this.select_box=null;};

SFT_DummyScrollSelection.prototype=new container({});
SFT_DummyScrollSelection.prototype.set_select_box=function (obj){
this.select_box=obj;};
SFT_DummyScrollSelection.prototype.set_translate=function (tra){
console_log(">> SFT_DummyScrollSelection.prototype.set_translate");
};
SFT_DummyScrollSelection.prototype.init=function (){
console_log(">> SFT_DummyScrollSelection.prototype.init");};
SFT_DummyScrollSelection.prototype._calc_window_width=function (num){
console_log(">> SFT_DummyScrollSelection.prototype._calc_window_width");};
SFT_DummyScrollSelection.prototype.create_obj=function (){
console_log(">> SFT_DummyScrollSelection.prototype.create_obj");};
SFT_DummyScrollSelection.prototype.free=function (){
console_log(">> SFT_DummyScrollSelection.prototype.free");};
SFT_DummyScrollSelection.prototype.set_candidate=function (array){
console_log(">> SFT_DummyScrollSelection.prototype.set_candidate: array = "+array);
this.select_box.clear();
this.select_box.show(array);
this.select_box.enter_focus();};
SFT_DummyScrollSelection.prototype.get_width=function (){
console_log(">> SFT_DummyScrollSelection.prototype.get_width");};

SFT_DummyScrollSelection.prototype.appear=function (){
console_log(">> SFT_DummyScrollSelection.prototype.appear");};
SFT_DummyScrollSelection.prototype.appear_without_cursor=function (){
console_log(">> SFT_DummyScrollSelection.prototype.appear_without_cursor");};
SFT_DummyScrollSelection.prototype.appear_cursor=function (){
console_log(">> SFT_DummyScrollSelection.prototype.appear_cursor");};
SFT_DummyScrollSelection.prototype.disappear_cursor=function (){
console_log(">> SFT_DummyScrollSelection.prototype.disappear_cursor");};
SFT_DummyScrollSelection.prototype._element_init_view=function (){
console_log(">> SFT_DummyScrollSelection.prototype._element_init_view");};
SFT_DummyScrollSelection.prototype._element_final_view=function (){
console_log(">> SFT_DummyScrollSelection.prototype._element_final_view");};
SFT_DummyScrollSelection.prototype.disappear=function (){
console_log(">> SFT_DummyScrollSelection.prototype.disappear");
this.select_box.clear();
this.select_box.leave_focus();};
SFT_DummyScrollSelection.prototype.plus=function (val,max){
console_log(">> SFT_DummyScrollSelection.prototype.plus");};
SFT_DummyScrollSelection.prototype.minus=function (val,min){
console_log(">> SFT_DummyScrollSelection.prototype.minus");};
SFT_DummyScrollSelection.prototype._update_scrollbar=function (){
console_log(">> SFT_DummyScrollSelection.prototype._update_scrollbar");};
SFT_DummyScrollSelection.prototype.up=function (){
console_log(">> SFT_DummyScrollSelection.prototype.up");
this.select_box.slide_left();};

SFT_DummyScrollSelection.prototype.down=function (){
console_log(">> SFT_DummyScrollSelection.prototype.down");
this.select_box.slide_right();};
SFT_DummyScrollSelection.prototype.list_up=function (){
console_log(">> SFT_DummyScrollSelection.prototype.list_up");};
SFT_DummyScrollSelection.prototype.list_down=function (){
console_log(">> SFT_DummyScrollSelection.prototype.list_down");};
SFT_DummyScrollSelection.prototype.cursor_up=function (){
console_log(">> SFT_DummyScrollSelection.prototype.cursor_up");};
SFT_DummyScrollSelection.prototype.cursor_down=function (){
console_log(">> SFT_DummyScrollSelection.prototype.cursor_down");};
SFT_DummyScrollSelection.prototype.scroll_up=function (){
console_log(">> SFT_DummyScrollSelection.prototype.scroll_up");};
SFT_DummyScrollSelection.prototype.scroll_down=function (){
console_log(">> SFT_DummyScrollSelection.prototype.scroll_down");};
SFT_DummyScrollSelection.prototype._move=function (obj,target_y,end_func,end_func_for_cancel){
console_log(">> SFT_DummyScrollSelection.prototype._move");};
SFT_DummyScrollSelection.prototype.get_cursor_position=function (){
console_log(">> SFT_DummyScrollSelection.prototype.get_cursor_position");
return this.select_box.get_position();};
function SFT_IME(){
this.superClass=Animation;
this.superClass({});
this.ime_on=false;
this.mode_change_event_hook=function (){};
this.method_from_usbkbd_change_event_hook=function(){};
this.method_add_text_hook=function(){};
this.method_enter_backspace_hook=function(){};
this.method_translate_cancel_hook=function(){};
this.method_to_NO_TRANSLATE_hook=function(){};
this.method_converter_updated_hook=function(){};
this.method_show_text_usb_NO_TRANSLATE_hook=function(){};
this.select_box=null;
this.unconverted_textbox=null;};
SFT_IME.prototype=new Animation({});
SFT_IME.prototype.set_unconverted_textbox=function (obj){
console_log(">> SFT_IME.prototype.set_unconverted_textbox");
this.unconverted_textbox=obj;};
SFT_IME.prototype.set_select_box=function (obj){
console_log(">> SFT_IME.prototype.set_select_box");
this.select_box=obj;};
SFT_IME.prototype.create=function (arg){
console_log(">> SFT_IME.prototype.create");
if(!this.ime_on)
return;
var self=this;
this.dummy_kbd=new SFT_DummySoftKBDInput();
this.dummy_kbd.set_unconverted_textbox(this.unconverted_textbox);
this.dummy_scroll_menu=new SFT_DummyScrollSelection();
this.dummy_scroll_menu.set_select_box(this.select_box);
var mode_change_event_hook=function (mode){
self.handle_mode_change_event(mode);};
var method_from_usbkbd_change_event_hook=function (){
self.handle_method_from_usbkbd_change_event();};
var method_add_text_hook=function (text){
self.handle_method_add_text_hook(text);};
var method_enter_backspace_hook=function (){
self.handle_method_enter_backspace_hook();};
var method_translate_cancel_hook=function (){
self.handle_method_translate_cancel_hook();};
var method_cancel_to_NO_TRANSLATE_hook=function (text){
self.handle_method_cancel_to_NO_TRANSLATE_hook(text);};
var method_converter_updated_hook=function (){
self.handle_method_converter_updated_hook();};
var method_show_text_usb_NO_TRANSLATE_hook=function (text,cur_pos){
self.handle_method_show_text_usb_NO_TRANSLATE_hook(text,cur_pos);};
this.master=new IME_Master({});
this.master.text_box_width=arg.width?arg.width:500;
this.master.overwrite_softkbd_obj(this.dummy_kbd);
this.master.overwrite_scroll_menu_obj(this.dummy_scroll_menu);
this.master.create_obj(arg);
this.master.set_hook_func(function(){});
this.master.set_mode_change_event_hook(mode_change_event_hook);
this.master.set_method_from_usbkbd_change_event_hook(method_from_usbkbd_change_event_hook);
this.master.set_method_add_text_hook(method_add_text_hook);
this.master.set_method_enter_backspace_hook(method_enter_backspace_hook);
this.master.set_method_translate_cancel_hook(method_translate_cancel_hook);
this.master.set_method_cancel_to_NO_TRANSLATE_hook(method_cancel_to_NO_TRANSLATE_hook);
this.master.set_method_converter_updated_hook(method_converter_updated_hook);
common_key.set_cursor(this,this.master);
this.components=[this.master];};
SFT_IME.prototype.free=function (){
if(!this.ime_on)
return;
this.dummy_kbd.free();
this.dummy_scroll_menu.free();
common_key.set_cursor(this,null);
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&typeof this.components[i].free=="function"){
this.components[i].free();}
}
this.components=[];};
SFT_IME.prototype.set_mode_change_event_hook=function (hook){
console_log(">> SFT_IME.prototype.set_mode_change_event_hook");
if(typeof hook=="function")
this.mode_change_event_hook=hook;};
SFT_IME.prototype.handle_mode_change_event=function (mode){
console_log(">> SFT_IME.prototype.handle_mode_change_event");
if(typeof this.mode_change_event_hook=="function")
this.mode_change_event_hook(mode);};
SFT_IME.prototype.set_method_from_usbkbd_change_event_hook=function (hook){
console_log(">> SFT_IME.prototype.set_method_from_usbkbd_change_event_hook");
if(typeof hook=="function")
this.method_from_usbkbd_change_event_hook=hook;};
SFT_IME.prototype.handle_method_from_usbkbd_change_event=function (){
console_log(">> SFT_IME.prototype.handle_method_from_usbkbd_change_event");
if(typeof this.method_from_usbkbd_change_event_hook=="function")
this.method_from_usbkbd_change_event_hook();};
SFT_IME.prototype.set_method_add_text_hook=function (hook){
console_log(">> SFT_IME.prototype.set_method_add_text_hook");
if(typeof hook=="function")
this.method_add_text_hook=hook;};
SFT_IME.prototype.handle_method_add_text_hook=function (text){
console_log(">> SFT_IME.prototype.handle_method_add_text_hook");
if(typeof this.method_add_text_hook=="function")
this.method_add_text_hook(text);};
SFT_IME.prototype.set_method_enter_backspace_hook=function (hook){
console_log(">> SFT_IME.prototype.set_method_enter_backspace_hook");
if(typeof hook=="function")
this.method_enter_backspace_hook=hook;};
SFT_IME.prototype.handle_method_enter_backspace_hook=function (){
console_log(">> SFT_IME.prototype.handle_method_enter_backspace_hook");
if(typeof this.method_enter_backspace_hook=="function")
this.method_enter_backspace_hook();};
SFT_IME.prototype.set_method_translate_cancel_hook=function (hook){
console_log(">> SFT_IME.prototype.set_method_translate_cancel_hook");
if(typeof hook=="function")
this.method_translate_cancel_hook=hook;};
SFT_IME.prototype.handle_method_translate_cancel_hook=function (){
console_log(">> SFT_IME.prototype.handle_method_translate_cancel_hook");
if(typeof this.method_translate_cancel_hook=="function")
this.method_translate_cancel_hook();};
SFT_IME.prototype.set_method_cancel_to_NO_TRANSLATE_hook=function (hook){
console_log(">> SFT_IME.prototype.set_method_cancel_to_NO_TRANSLATE_hook");
if(typeof hook=="function")
this.method_cancel_to_NO_TRANSLATE_hook=hook;};
SFT_IME.prototype.handle_method_cancel_to_NO_TRANSLATE_hook=function (text){
console_log(">> SFT_IME.prototype.handle_method_cancel_to_NO_TRANSLATE_hook");
if(typeof this.method_cancel_to_NO_TRANSLATE_hook=="function")
this.method_cancel_to_NO_TRANSLATE_hook(text);};
SFT_IME.prototype.set_method_converter_updated_hook=function (hook){
console_log(">> SFT_IME.prototype.set_method_converter_updated_hook");
if(typeof hook=="function")
this.master.set_method_converter_updated_hook(hook);};
SFT_IME.prototype.handle_method_converter_updated_hook=function (){
console_log(">> SFT_IME.prototype.handle_method_converter_updated_hook");
if(typeof this.method_converter_updated_hook=="function")
this.method_converter_updated_hook();};
SFT_IME.prototype.set_method_show_text_usb_NO_TRANSLATE_hook=function (hook){
console_log(">> SFT_IME.prototype.set_method_show_text_usb_NO_TRANSLATE_hook");
if(typeof hook=="function")
this.master.set_method_show_text_usb_NO_TRANSLATE_hook(hook);};
SFT_IME.prototype.handle_method_show_text_usb_NO_TRANSLATE_hook=function (text,cur_pos){
console_log(">> SFT_IME.prototype.handle_method_show_text_usb_NO_TRANSLATE_hook");
if(typeof this.method_show_text_usb_NO_TRANSLATE_hook=="function")
this.method_show_text_usb_NO_TRANSLATE_hook(text,cur_pos);};
SFT_IME.prototype.change_mode=function (mode){
console_log(">> SFT_IME.prototype.change_mode: mode = "+mode);
this.master.change_mode(mode);};
SFT_IME.prototype.set_translate=function (translate){
console_log(">> SFT_IME.prototype.set_translate");
this.translate[0]=translate[0];
this.translate[1]=translate[1];
this.translate[2]=translate[2];
return;};
SFT_IME.prototype.enable_ime=function (){
console_log(">> SFT_IME.prototype.enable_ime");
this.ime_on=true;};
SFT_IME.prototype.disable_ime=function (){
console_log(">> SFT_IME.prototype.disable_ime");
this.ime_on=false;};
SFT_IME.prototype.is_ime_supported=function (){
console_log(">> SFT_IME.prototype.is_ime_supported");
return this.ime_on;};
SFT_IME.prototype.get_mode=function (){
console_log(">> SFT_IME.prototype.get_mode");
return this.master.get_mode();};
SFT_IME.prototype.addText=function (text){
console_log(">> SFT_IME.prototype.addText");
this.master.addText(text);};
SFT_IME.prototype.setText=function (text){
console_log(">> SFT_IME.prototype.setText");
this.master.setText(text);};
SFT_IME.prototype.getText=function (){
console_log(">> SFT_IME.prototype.getText");
return this.master.getText();};
SFT_IME.prototype.backspace_text=function (){
console_log(">> SFT_IME.prototype.backspace_text");
return this.master.backspace_text();};
SFT_IME.prototype.setMode=function (mode){
this.master.set_mode(mode);};
SFT_IME.prototype.getMode=function (){
return this.master.get_password_mode();};
SFT_IME.prototype.cursor_left=function (){
console_log(">> SFT_IME.prototype.cursor_letf");
return this.master.cursor_left();};
SFT_IME.prototype.cursor_right=function (){
console_log(">> SFT_IME.prototype.cursor_right");
return this.master.cursor_right();};
SFT_IME.prototype.enter_translate_mode=function (){
console_log(">> SFT_IME.prototype.enter_translate_mode");
this.master.enter_translate_mode();};
SFT_IME.prototype.enter_focus=function (text){
console_log(">> SFT_IME.prototype.enter_focus");};
SFT_IME.prototype.leave_focus=function (text){
console_log(">> SFT_IME.prototype.leave_focus");
};
SFT_IME.prototype.keyhook=function (up_down,keysym){
console_log(">> SFT_IME.prototype.keyhook");
return this.usb_key_hook(up_down,keysym);};
SFT_IME.prototype.usb_key_hook=function (up_down,keysym){
console_log(">> SFT_IME.prototype.usb_key_hook");
return this.master.keyhook(up_down,keysym);};
SFT_IME.prototype.key_hook=function (up_down,keysym){
console_log(">> SFT_IME.prototype.key_hook");
if(keysym==TXK_EXIT||keysym==TXK_HOME)
return false;
if(up_down!=KEY_PRESS)
return true;
if(!this.cursor||typeof this.cursor.key_hook!="function")
return false;

var i_method=this.get_input_method();
if(i_method==IME_USBKBD){
return this.cursor.key_hook(up_down,keysym);}else {
var new_keysym=keysym;
switch(keysym){
case TXK_UP:
new_keysym=false;
break;
case TXK_DOWN:
new_keysym=false;
break;
case TXK_LEFT:
new_keysym=TXK_UP;
break;
case TXK_RIGHT:
new_keysym=TXK_DOWN;
break;
case TXK_ENTER:
new_keysym=TXK_ENTER;
break;}
if(new_keysym)
return this.cursor.key_hook(up_down,new_keysym);}
return false;};
SFT_IME.prototype.decide_no_input=function (){
this.master.decide_no_input();};
SFT_IME.prototype.decide_no_translate=function (){
console_log(">> SFT_IME.prototype.decide_no_translate");
this.master.decide_no_translate();};
SFT_IME.prototype.decide_translate=function (){
console_log(">> SFT_IME.prototype.decide_translate");
this.master.decide_translate();};
SFT_IME.prototype.decide_adjust=function (){
console_log(">> SFT_IME.prototype.decide_adjust");
this.master.decide_adjust();};
SFT_IME.prototype.update_current_candidate=function (){
console_log(">> SFT_IME.prototype.update_current_candidate");
this.master.update_kouho();};
SFT_IME.prototype._change_method_to_usbkbd=function (){
console_log(">> SFT_IME.prototype._change_method_to_usbkbd");
this.master._change_method_to_usbkbd();};
SFT_IME.prototype.set_txkb_keysym=function (txkb_keysym){
console_log(">> SFT_IME.prototype.set_txkb_keysym");
this.master.txkb_keysym=txkb_keysym;};
SFT_IME.prototype.set_pre_method=function (pre_method){
console_log(">> SFT_IME.prototype.set_pre_method");
this.master.pre_method=pre_method;};
SFT_IME.prototype.get_pre_method=function (pre_method){
console_log(">> SFT_IME.prototype.get_pre_method");
return this.master.pre_method;};
SFT_IME.prototype.set_input_method=function (input_method){
console_log(">> SFT_IME.prototype.set_input_method");
this.master.input_method=input_method;};
SFT_IME.prototype.get_input_method=function (input_method){
console_log(">> SFT_IME.prototype.get_input_method");
return this.master.input_method;};
SFT_IME.prototype.set_5stroke_mode=function (arg){
console_log(">> SFT_IME.prototype.get_input_method");
return this.master.text_box.set_5stroke_mode(arg);};
SFT_IME.prototype.get_5stroke_mode=function (){
console_log(">> SFT_IME.prototype.get_input_method");
return this.master.text_box.get_5stroke_mode();};
SFT_IME.prototype.prepare_sphone_input=function (){
this.master._prepare_sphone_input();};
SFT_IME.prototype.finish_sphone_input=function (){
this.master._finish_sphone_input();
this.master.follow_pos();};
SFT_IME.prototype.change_method_from_usbkbd=function (){
this.master._change_method_from_usbkbd();};
SFT_IME.prototype.cancel=function (){
this.master.converter.cancel();
this.master._cancel();};
SFT_IME.prototype.follow_pos=function (){
this.master.follow_pos();};
SFT_IME.prototype.get_convert_info=function (){
return this.master.get_convert_info();};
function SFT_Keyboard(){
this.superClass=Animation;
this.superClass({});
this.last_asr_listener_mode=0;
this.TEXT_BOX_WIDTH=0;
this.TEXT_BOX_HEIGHT=0;
this.language=get_default_language();
this.round_menu_item=round_menu_item;
this.setting_menu_item=setting_menu_item;
this.bg_frame_alpha=null;
this.last_cursor=null;
this.cursor=null;
this.height=0;
this.last_input_text=null;
this.last_input_text_global="";
this.height_change_callback=function (){};
this.sphone_send_after_done=true;
this.move_mode="key";this.usb_kbd=null;
this.input_char_set="";
this.py_input_a="";
this.py_search_a="";
this.py_flag=false;
this.zhcn_timer={};
this.zhcn_timer.flag=true;
this.zhcn_timer.count=-1;
this.zhcn_timer.index=0;
this.zhcn_timer.waiting_key_pos={col:null,row:null};
this.key_wait=true;
this.key_wait_timer={};
this.key_wait_s=400;
this.trg_textarea={};};
SFT_Keyboard.prototype=new Animation({});
SFT_Keyboard.prototype.create=function (mode_number){
this.prepare_lang_specific_pkg(this.language);
this.set_skin();
this.set_cache();
this._create(mode_number);
send_init_event_to_sphone();};
SFT_Keyboard.prototype._create=function (mode_number){
var self=this;
var common_skin=SKIN.common;
var keytop_skin=SKIN.keytop;
var textbox_padding_w=skin_func.calc_rate((keytop_skin.color_padding_w-1)*2);
var ymargin=skin_func.calc_rate(common_skin.ymargin);
var message_align=(this.is_write_from_right_lang())?RIGHT:LEFT;
this.starting_point=[0,0,0];
this.stencil_man=new StencilManager({});
this.stencil_man.create();
this.ime=new SFT_IME();
if(this.is_ime_enable())
this.ime.enable_ime();
var pointer_control_hook=function (x,y){
self.pointer_control_hook(x,y);};
var under_action_hook=function (){self.under_action_hook();};
this.under_mask=new UnderMask({width:1920*2,height:1080*2,color:[0,0,0,0]});
this.under_mask.create(under_action_hook);
var char_keytop_action_hook=function (text){
self.char_keytop_action_hook(text);};
var softkbd_keytop_mouseover_hook=function (col,row){
self.softkbd_keytop_mouseover_hook(col,row);};
this.soft_keyboard=new SFT_SoftKeyboard({language:this.language});
this.soft_keyboard.create(mode_number,char_keytop_action_hook,
softkbd_keytop_mouseover_hook,pointer_control_hook);
this.TEXT_BOX_WIDTH=this.soft_keyboard.get_width();
var IME_WIDTH=this.TEXT_BOX_WIDTH
-skin_func.calc_rate(common_skin.ime_padding_w)-textbox_padding_w;

var tbox_bg_skin=SKIN.tbox_bg;
this.TEXT_BOX_HEIGHT=skin_func.calc_rate(tbox_bg_skin.height);
var textbox_leave_focus_hook=function(){
self.select_bar.in_current_cursor();};
var textbox_left_action_hook=function(){
self.left_action();};
var textbox_right_action_hook=function(){
self.right_action();};
var textbox_down_action_hook=function(){
if(self.ime.get_mode()=="TRANSLATE"
||self.ime.get_mode()=="ADJUST"){
self.select_bar.in_current_cursor();
common_key.set_cursor(self,self.ime);
self.pointer.set_visible(true);}
};
this.text_box_back=new SFT_TextboxBG({
width:this.TEXT_BOX_WIDTH-textbox_padding_w,height:this.TEXT_BOX_HEIGHT,
pointer:pointer_control_hook,leave:textbox_leave_focus_hook,
left:textbox_left_action_hook,right:textbox_right_action_hook,
down:textbox_down_action_hook
});
this.text_box_back.create({});
this.text_box_back.set_translate([0,0,0]);
this.text_box_back.set_visible(false);
var tbox_skin=SKIN.tbox;
var text_box_bg_color=this.is_ime_enable()?tbox_skin.bg_ime_c:tbox_skin.bg_c;
var text_box_len_limit=this.is_ime_enable()?60:100;
this.text_box=new IME_TextBox(
{
width:IME_WIDTH-skin_func.calc_rate(10),
text:"",color:tbox_skin.text_c.slice(),
bg_color:text_box_bg_color.slice(),
support_5stroke:false,
char_length_limit:text_box_len_limit
});
this.text_box.disable_under_bar();
this.text_box.set_visible(false);
var mickey_action_hook=function (arg){
self.mickey_action_hook(arg);};
var mickey_mouseover_hook=function (){
self.mickey_mouseover_hook();};
this.mic_key=new MicKey({
msg_width:this.TEXT_BOX_WIDTH,msg_span:ymargin,
msg_align:message_align,icon_path:kbd_img_path+"mic_icon.png",
language:this.language,menu_item_obj:mic_key_message,
display:(ebus.asr&&ebus.asr.supported)
});
this.mic_key.create(mickey_action_hook,mickey_mouseover_hook,
pointer_control_hook);
var closekey_action_hook=function (){
self.closekey_action_hook();};
var closekey_mouseover_hook=function (){
self.closekey_mouseover_hook();};
this.close_key=new CloseKey({
icon_path:kbd_img_path+"close.png",language:this.language
});
this.close_key.create(closekey_action_hook,closekey_mouseover_hook,
pointer_control_hook);
var select_bar_action_hook=function (text){
self.select_bar_action_hook(text);};
var select_bar_mouseover_hook=function (text){
self.select_bar_mouseover_hook(text);};
var select_bar_arrows_action_hook=function (mode){
self.select_bar_arrows_action_hook(mode);};
var select_bar_slide_start_hook=function (){
self.select_bar_slide_start_hook();};
var select_bar_slide_end_hook=function (x,y){
self.select_bar_slide_end_hook(x,y);};
var select_bar_slide_lr_hook=function (){
self.select_bar_slide_lr_hook();};
var select_bar_update_stencil_hook=function (){
self.select_bar_update_stencil_hook();};
var sel_bar_skin=SKIN.sel_bar;
var sel_bar_width=this.TEXT_BOX_WIDTH-this.mic_key.get_width()-
this.close_key.get_width()-sel_bar_skin.btn_space;
this.select_bar=new SFT_SelectBar({
width:sel_bar_width,language:this.language
});
this.select_bar.create(select_bar_action_hook,pointer_control_hook,
select_bar_arrows_action_hook,select_bar_slide_start_hook,
select_bar_slide_end_hook,select_bar_slide_lr_hook,
select_bar_mouseover_hook,select_bar_update_stencil_hook);
if(this.ime.is_ime_supported()){
var mode_change_event_hook=function (mode){
self.handle_ime_mode_change_event(mode);};
var method_from_usbkbd_change_event_hook=function(){
self.handle_ime_method_from_usbkbd_event();};
var add_text_hook=function(text){
self.add_text_ja_JP_ime(text);};
var enter_backspace_hook=function(){
self.do_enter_backspace();};
var translate_cancel_hook=function(){
self.do_cancel_composition();};
var cancel_to_NO_TRANSLATE_hook=function(){
self.cancel_ime_to_NO_TRANSLATE();};
var converter_updated_hook=function(){
self.show_convert_TRANSLATE();};
var show_text_usb_NO_TRANSLATE_hook=function(text,cur_pos){
self.show_text_usb_NO_TRANSLATE(text,cur_pos);};
this.text_box.enable_under_bar();
this.ime.set_unconverted_textbox(this.text_box);
this.ime.set_select_box(this.select_bar);
this.ime.create({width:IME_WIDTH,indicator_pos_x_range:this.TEXT_BOX_WIDTH});
this.ime.set_mode_change_event_hook(mode_change_event_hook);
this.ime.set_method_from_usbkbd_change_event_hook(method_from_usbkbd_change_event_hook);
this.ime.set_method_add_text_hook(add_text_hook);
this.ime.set_method_enter_backspace_hook(enter_backspace_hook);
this.ime.set_method_translate_cancel_hook(translate_cancel_hook);
this.ime.set_method_cancel_to_NO_TRANSLATE_hook(cancel_to_NO_TRANSLATE_hook);
this.ime.set_method_converter_updated_hook(converter_updated_hook);
this.ime.set_method_show_text_usb_NO_TRANSLATE_hook(show_text_usb_NO_TRANSLATE_hook);}
var ctrl_keytop_action_hook=function (arg){
self.ctrl_keytop_action_hook(arg);};
var ctrlkey_keytop_mouseover_hook=function (col,row){
self.ctrlkey_keytop_mouseover_hook(col,row);};
this.control_key=new SFT_ControlKey({
width:this.TEXT_BOX_WIDTH,num_row:11,num_col:1,language:this.language
});
this.control_key.create(ctrl_keytop_action_hook,ctrlkey_keytop_mouseover_hook,
pointer_control_hook);
this._adjust_parts_position(ymargin);
if(this.is_write_from_right_lang()){
this.text_box.set_from_right_mode();
this.do_set_from_right_mode();}else {
this.text_box.set_from_left_mode();
this.do_set_from_left_mode();};
this.switch_unconf_bg();
var ctrl_keys_pos=this.control_key.get_translate();
var bg_skin=SKIN.bg_frame;
var bg_width=this.TEXT_BOX_WIDTH;
var bg_height=this.height;
this.bg_frame=new SFT_BGFrame({});
this.bg_frame.create({
width:bg_width,height:bg_height,frame_size:skin_func.calc_rate(bg_skin.frame_size),
bg:{color:bg_skin.bg_c,round:skin_func.calc_rate(bg_skin.round),
alpha:this.bg_frame_alpha,
padding_w:skin_func.calc_rate(bg_skin.padding_w),
padding_h:skin_func.calc_rate(bg_skin.padding_h)},
list:{tl:bg_skin.list.tl,t:bg_skin.list.t,tr:bg_skin.list.tr,
l:bg_skin.list.l,r:bg_skin.list.r,
bl:bg_skin.list.bl,b:bg_skin.list.b,br:bg_skin.list.br}
});
var bg_pos_y=Math.floor((this.select_bar.get_height()/2
+ctrl_keys_pos[1]
-this.control_key.get_height()/2)/2);
this.bg_frame.set_translate([0,bg_pos_y,0]);

var setting_action_hook=function (arg){
self.setting_action_hook(arg);};
var setting_close_action_hook=function (){
self.setting_close_action_hook();};

var setting_anim_all_end_hook=function (){
self.setting_anim_all_end_hook();};
var setting_update_stencil_hook=function (){
self.setting_update_stencil_hook();};
var setting_width=bg_width+skin_func.calc_rate((bg_skin.frame_size-bg_skin.padding_w)*2)+2;
var setting_height=bg_height+skin_func.calc_rate((bg_skin.frame_size-bg_skin.padding_h)*2+2);
var setting_pos_y=ctrl_keys_pos[1];
var setting_key_pos=this.control_key.get_setting_key_translate();
var setting_mask_y=Math.floor((-this.control_key.get_height()+bg_height)/2);
var setting_img_size=this.control_key.img_size["SETTING"]||{w:0,h:0};
this.setting_menu=new SFT_SettingMenu({
menu_item:this.setting_menu_item,width:setting_width,height:setting_height,
mask_y:setting_mask_y,setting_key_x:setting_key_pos[0],
setting_img_size:setting_img_size,language:this.language
});
this.setting_menu.create(setting_anim_all_end_hook,setting_close_action_hook,
setting_update_stencil_hook,pointer_control_hook);
this.setting_menu.set_action_hook(setting_action_hook);
this.setting_menu.set_translate([0,setting_pos_y,0]);
var round_update_stencil_hook=function (){
self.round_update_stencil_hook();};
var round_menu_width=setting_width;
var round_menu_height=setting_height;
this.round_menu=new RoundMenu({
width:round_menu_width,height:round_menu_height,language:this.language
});
this.round_menu.set_translate([0,bg_pos_y,0]);
this.round_menu.set_update_stencil_hook(round_update_stencil_hook);
var confirm_open_anim_end_hook=function(){
self.confirm_open_anim_end_hook();};
var confirm_update_stencil_hook=function (){
self.confirm_update_stencil_hook();};
var round_menu_skin=SKIN.round_menu;
var confirm_bg_w=skin_func.calc_rate(round_menu_skin.bg_w/4*5);
var confirm_bg_h=skin_func.calc_rate(round_menu_skin.bg_h/3*2);
this.confirm=new ConfirmPopup({width:round_menu_width,height:round_menu_height,
bg_w:confirm_bg_w,bg_h:confirm_bg_h,language:this.language,
message_align:message_align
});
this.confirm.set_translate([0,bg_pos_y,0]);
this.confirm.set_open_anim_end_hook(confirm_open_anim_end_hook);
this.confirm.set_pointer_control_hook(pointer_control_hook);
this.confirm.set_update_stencil_hook(confirm_update_stencil_hook);
this.pointer=new Pointer({});
this.pointer.set_visible(false);
var asr_show_menu_hook=function (bool){
if(self.show_asr_menu_callback&&typeof self.show_asr_menu_callback=="function")
self.show_asr_menu_callback(bool);};
var asr_menu_action_hook=function (text){
self.asr_menu_action_hook(text);};
var asr_set_colorkey_grayout_hook=function (bool){
self.asr_set_colorkey_grayout_hook(bool);};
var asr_update_stencil_hook=function (){
self.asr_update_stencil_hook();};
var select_bar_tran=this.select_bar.get_translate();
var asr_menu_tl_pos=[0,0,0];
asr_menu_tl_pos[0]=-this.TEXT_BOX_WIDTH/2+select_bar_tran[0];
asr_menu_tl_pos[1]=-this.select_bar.get_inner_height()/2+select_bar_tran[1];
this.asr_menu=new ASRMenu({
width:this.TEXT_BOX_WIDTH,max_height:this.soft_keyboard.get_height(),tl_pos:asr_menu_tl_pos,
language:this.language,message_align:message_align
});
this.asr_menu.set_show_menu_hook(asr_show_menu_hook);
this.asr_menu.set_action_hook(asr_menu_action_hook);
this.asr_menu.set_asr_set_colorkey_grayout_hook(asr_set_colorkey_grayout_hook);
this.asr_menu.set_update_stencil_hook(asr_update_stencil_hook);
this.components=[
this.under_mask,
this.bg_frame,
this.text_box_back,
this.soft_keyboard,
this.text_box,
this.mic_key,
this.close_key,
this.select_bar,
this.control_key,
this.ime,
this.setting_menu,
this.round_menu,
this.confirm,
this.asr_menu,
this.pointer
];
this.height=bg_height+skin_func.calc_rate((bg_skin.frame_size)*2);
if(typeof this.height_change_callback=="function")
this.height_change_callback(this.height);
this.translate=[0,-(Math.floor(this.TEXT_BOX_HEIGHT/2
+skin_func.calc_rate(bg_skin.frame_size))),0];};
SFT_Keyboard.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
SFT_Keyboard.prototype._adjust_parts_position=function (ymargin){
var top_ypos=0;
var select_bar_xpos;
if(!this.mic_key.is_display()){
select_bar_xpos=(this.TEXT_BOX_WIDTH-this.select_bar.get_width())/2;}else {
select_bar_xpos=this.mic_key.get_width()-this.close_key.get_width();}
var mic_key_xpos=(this.TEXT_BOX_WIDTH-this.mic_key.get_width())/2;
var close_key_xpos=-(this.TEXT_BOX_WIDTH-this.close_key.get_width())/2;
var select_bar_height=this.select_bar.get_height();
top_ypos=select_bar_height/2-ymargin;
this.select_bar.set_translate([select_bar_xpos,0,0]);
this.mic_key.set_translate([mic_key_xpos,0,0]);
this.close_key.set_translate([close_key_xpos,0,0]);
top_ypos=top_ypos-select_bar_height-ymargin;
var soft_keyboard_height=this.soft_keyboard.get_height();
var soft_keyboard_ypos=top_ypos-soft_keyboard_height/2;
this.soft_keyboard.set_translate([0,soft_keyboard_ypos,0]);
top_ypos=top_ypos-soft_keyboard_height-ymargin;
var control_key_height=this.control_key.get_height();
var control_key_ypos=top_ypos-control_key_height/2;
this.control_key.set_translate([0,control_key_ypos,0]);
this.height=select_bar_height+soft_keyboard_height
+control_key_height+ymargin*2;};
SFT_Keyboard.prototype.get_kbd_width=function (){
return this.TEXT_BOX_WIDTH;};
SFT_Keyboard.prototype.get_height=function (){
return this.height;};
SFT_Keyboard.prototype.set_height_change_callback=function (func){
if(typeof func=="function"){
this.height_change_callback=func;}else {
console_log("[ERROR] Arg is not a function. (set_height_change_callback)");}
};
SFT_Keyboard.prototype.set_starting_point=function (tran){
this.starting_point=tran.slice();
this.gen_stencil_table();};
SFT_Keyboard.prototype.set_bg_alpha=function (alpha){
if(alpha!=null&&isFinite(alpha)){
this.bg_frame_alpha=alpha;
this.bg_frame.set_bg_alpha(alpha);}
};
SFT_Keyboard.prototype.handle_ime_method_from_usbkbd_event=function (){
this.control_key.reset_grayout_all_colorkey();
common_key.set_cursor(this,this.last_cursor);
this.last_cursor=null;
this.pointer.set_visible(true);};
SFT_Keyboard.prototype._char_keytop_action_hook_zh_CN=function (text){
var zhcn_mode=this.soft_keyboard.get_zhcn_mode();
switch(this.soft_keyboard.mode_number){
case 1:
case 2:
this.py_flag=false;
if(text=="backspace")text="";
this.add_text(text);
return;
case 0:
zhcn_mode=this.soft_keyboard.ZHCN_MODE_RIGHT;if(text=="backspace")text="";
if(((text.toString()<"a")||(text.toString()>"z"))
&&(text.toString()!="")){
this.py_input_a="";
this.py_search_a="";
this.add_text(text);
this.py_flag=false;
return;}
break;
case 3:
if(text=="backspace"){text="";break;}
if(typeof text=="string"){
var converted_num=this.soft_keyboard.convert_text_to_num(text);
if(converted_num==null)return;
if(converted_num>=0){
this.soft_keyboard.character_input(converted_num);
return;};}
var self=this;
var timer=this.zhcn_timer;
if(zhcn_mode==this.soft_keyboard.ZHCN_MODE_RIGHT){
var SMALL_ITEMS=this.soft_keyboard.ZHCN_SMALL_ITEMS;
var index=text;
if(timer.flag){
if(index==timer.index){
timer.count++;
if(timer.count>=SMALL_ITEMS[index].length)timer.count=0;}else {
if(timer.count!=-1)this.add_text(SMALL_ITEMS[timer.index][timer.count]);
timer.index=index;
timer.count=0;}
this.soft_keyboard.set_cursor_back(timer.waiting_key_pos);}else {
timer.index=index;
timer.count=0;
timer.flag=true;}
this.soft_keyboard.set_cursor_by_num(index,SMALL_ITEMS[timer.index][timer.count]);
timer.waiting_key_pos.col=this.soft_keyboard.get_current_column();
timer.waiting_key_pos.row=this.soft_keyboard.get_current_row();
delete_timer(timer);
var callback=function(obj,count){
if(count>1500/50){
delete_timer(obj);
timer.flag=false;
self.soft_keyboard.set_cursor_back(timer.waiting_key_pos);
timer.waiting_key_pos.col=null;
timer.waiting_key_pos.row=null;
self.add_text(SMALL_ITEMS[timer.index][timer.count]);}
};
append_timer(timer,50,function(obj,count){callback(obj,count);});
return;}else {if(this.soft_keyboard.convert_text_to_num_t9(text)==null)break;
this.soft_keyboard.set_cursor_by_num(text,"");
timer.waiting_key_pos.col=this.soft_keyboard.get_current_column();
timer.waiting_key_pos.row=this.soft_keyboard.get_current_row();
delete_timer(timer);
var callback=function(obj,count){
if(count>1000/50){
delete_timer(obj);
self.soft_keyboard.set_cursor_back(timer.waiting_key_pos);
timer.waiting_key_pos.col=null;
timer.waiting_key_pos.row=null;}
};
append_timer(timer,50,function(obj,count){callback(obj,count);});}
break;}

this.py_input_a+=text.toString();

var py_search_a_back=new Array();
if(this.py_input_a.length<7){
for(i=0;i<py_index.py_index_tb.length;i++){
if(this.py_input_a==py_index.py_index_tb[i][zhcn_mode].slice(0,this.py_input_a.length)){
py_search_a_back.push(py_index.py_index_tb[i]);}
}
}

if(py_search_a_back.length!=0){
this.py_search_a=new Array();
this.py_search_a=py_search_a_back;}else {
this.py_input_a=this.py_input_a.slice(0,this.py_input_a.length-1);}

this.list=new Array();
for(var i=0;i<this.py_search_a.length;i++){
this.list.push(this.py_search_a[i][1]);};

if(this.list.length>0){
this.select_bar.show(this.list);}
this.py_flag=true;
return;};
SFT_Keyboard.prototype._char_keytop_action_hook_zh_HK=function (text){
const CJ_TEXT_ARRAY=[
["q","手"],["w","田"],["e","水"],["r","口"],["t","廿"],["y","卜"],["u","山"],["i","戈"],["o","人"],["p","心"],
["a","日"],["s","尸"],["d","木"],["f","火"],["g","土"],["h","竹"],["j","十"],["k","大"],["l","中"],
["z","重"],["x","難"],["c","金"],["v","女"],["b","月"],["n","弓"],["m","一"]
];
switch(this.soft_keyboard.mode_number){
case 1:
case 2:
this.py_flag=false;
if(text=="backspace")text="";
this.add_text(text);
return;
case 0:
if(text=="backspace")text="";
for(var i=0;i<CJ_TEXT_ARRAY.length;i++){
if(text==CJ_TEXT_ARRAY[i][1]){
text=CJ_TEXT_ARRAY[i][0];
break;}
}
if(((text.toString()<"a")||(text.toString()>"z"))
&&(text.toString()!="")){
this.py_input_a="";
this.py_search_a="";
this.add_text(text);
this.py_flag=false;
return;}
break;}
this.py_input_a+=text.toString();
var py_search_a_back=new Array();
if(this.py_input_a.length<7){
for(i=0;i<cj_cn.cj_cn_tb.length;i++){
if(this.py_input_a==cj_cn.cj_cn_tb[i][0].slice(0,this.py_input_a.length)){
py_search_a_back.push(cj_cn.cj_cn_tb[i]);
if(py_search_a_back.length==10)break;}
}
}
if(py_search_a_back.length!=0){
this.py_search_a=new Array();
this.py_search_a=py_search_a_back;}else {
this.py_input_a=this.py_input_a.slice(0,this.py_input_a.length-1);}
this.list=new Array();
for(var i=0;i<this.py_search_a.length;i++){
var str=this.py_search_a[i][1][0];
while(str.length>0){
this.list.push(str.slice(0,1));
str=str.slice(1);}
};
if(this.list.length>0){
this.select_bar.show(this.list);}
this.py_flag=true;
return;};
SFT_Keyboard.prototype._char_keytop_action_hook_direct=function (text){
var token=this.soft_keyboard.get_token(text);
if(token){
var list=new Array(text);
this.select_bar.show(list.concat(token));
common_key.set_cursor(this,null);
common_key.set_cursor(this,this.select_bar);}else {
this.add_text(text);}
};
SFT_Keyboard.prototype._char_keytop_action_hook_ja_JP=function (text){
if(this.ime.get_mode()=="TRANSLATE"
||this.ime.get_mode()=="ADJUST"){
this.ime.cancel();
this.control_key.reset_grayout_henkan_top();
this.show_text_NO_TRANSLATE();
this._to_NO_TRANSLATE();}

if(text=="゛"){
var dakuten=this.soft_keyboard.get_dakuten(this.last_input_text);
if(dakuten){
this.text_box.replace_text(dakuten);
this.show_text_NO_TRANSLATE();}
}else if(text=="°"){
var handakuten=this.soft_keyboard.get_handakuten(this.last_input_text);
if(handakuten){
this.text_box.replace_text(handakuten);
this.show_text_NO_TRANSLATE();}
}else {
this.add_text_ja_JP(text);
if(this.text_box.get_text_length()>0)
this._to_NO_TRANSLATE();}
if(this.input_char_set=="ALPHABET")
this.kakutei_action();
this.last_input_text=text;
return;};
SFT_Keyboard.prototype.char_keytop_action_hook=function (text){
console_log(">> SFT_Keyboard.char_keytop_action_hook: text = "+text);
if(typeof text=="string"&&text=="")return;
var ret=null;
if(this.asr_menu.is_open())
this.asr_menu_done_func();
this.select_bar.clear();
if(this.language=="zh-CN"){
if(this.soft_keyboard.is_zhcn_kbd_mode()){
var arrow_key=this.soft_keyboard.get_zhcn_arrow_key();
if(text==arrow_key.left){
this.soft_keyboard.set_zhcn_t9_mode();
this.py_input_a="";
this.py_search_a="";
return;}else if(text==arrow_key.right){
this.soft_keyboard.set_zhcn_mobileinput_mode();
this.py_input_a="";
this.py_search_a="";
return;}
}
ret=this._char_keytop_action_hook_zh_CN(text);
return;}
if(this.language=="zh-TW"){
if(this.soft_keyboard.get_current_mode()==0){
this.process_tra_ch(text);
if(this.round_menu.is_open()||this.setting_menu.is_active()
||this.confirm.is_open()){
common_key.set_cursor(this,this.last_cursor);
this.last_cursor=null;
this.pointer.set_visible(true);}
return;}else {
this.soft_keyboard.bpmf_list_clear();}
}
if(this.language=="zh-HK"){
ret=this._char_keytop_action_hook_zh_HK(text);
return;}
if(this.ime.is_ime_supported()){
ret=this._char_keytop_action_hook_ja_JP(text);
return;}
this._char_keytop_action_hook_direct(text);};
SFT_Keyboard.prototype.search_word=function(wd_arg){
var input_wd=wd_arg;
var word_tab=word_lib.word_tab[0].s;
var i=0;
for(i=0;i<word_tab.length;i++){
if(input_wd==word_tab[i]){
break;}
}
if(i!=word_tab.length){
this.wd_search_flag=true;
this.py_search_a=word_lib.word_tab[i+1].s;
this.select_bar.show(this.py_search_a);
force_redraw();}else {
this.wd_search_flag=false;
common_key.set_cursor(this,null);
common_key.set_cursor(this,this.soft_keyboard);
this.py_input_a="";
this.py_search_a="";
this.select_bar.clear();
this.pointer.set_visible(true);
return true;}
};
SFT_Keyboard.prototype.select_bar_action_hook=function (text){
console_log(">> SFT_Keyboard.select_bar_action_hook: text = "+text);
if(this.asr_menu.is_open()){
this.asr_menu.enter_action();
return;}
if(this.ime.is_ime_supported()){
switch(this.ime.get_mode()){
case "TRANSLATE":
this.ime.decide_translate();
break;
case "ADJUST":
this.ime.decide_adjust();
break;}
return;}
if(this.language=="zh-CN"){
this.py_input_a="";
if(this.py_flag){
this.select_bar.show(this.py_search_a[this.select_bar.slide.pos][2][0]);
this.py_search_a="";
this.py_flag=false;
common_key.set_cursor(this,null);
common_key.set_cursor(this,this.select_bar);
return;}
this.py_search_a="";
if(this.soft_keyboard.is_zhcn_kbd_mode()){
this.soft_keyboard.set_position(this.soft_keyboard.ZHCN_L_ARROW_POS);}
if(text){
this.add_text(text);
this.search_word(text);}
}else if(this.language=="zh-HK"){
this.py_input_a="";
this.py_search_a="";
if(text){
this.add_text(text);}
common_key.set_cursor(this,null);
common_key.set_cursor(this,this.soft_keyboard);
this.pointer.set_visible(true);
this.select_bar.clear();}else {
if(text){
this.add_text(text);}
this.select_bar.clear();}
};
SFT_Keyboard.prototype.select_bar_slide_start_hook=function (){
this.pointer.set_visible(false);};
SFT_Keyboard.prototype.select_bar_slide_end_hook=function (x,y){
this.pointer.set_visible(true);
this.pointer_control_hook(x,y);};
SFT_Keyboard.prototype.select_bar_slide_lr_hook=function (){
this.select_bar_mouseover_hook();};
SFT_Keyboard.prototype.select_bar_arrows_action_hook=function (mode){
if(this.asr_menu.is_open()){
if(mode=="LEFT")
this.asr_menu.left_action();
else if(mode=="RIGHT")
this.asr_menu.right_action();}else {
if(mode=="LEFT")
this.select_bar.slide_left();
else if(mode=="RIGHT")
this.select_bar.slide_right();}
};
SFT_Keyboard.prototype.ctrl_keytop_action_hook=function (arg){
if(this.control_key.is_grayout_by_func(arg))
return;
switch(arg){
case "up":
this.up_action();
break;
case "down":
this.down_action();
break;
case "left":
this.left_action();
break;
case "right":
this.right_action();
break;
case "char_switch":
this.update_char_switch_top();
break;
case "spc":
this.space_action();
break;
case "henkan":
this.henkan_action();
break;
case "backspace":
this.backspace_action();
break;
case "done":
this.done_action();
break;
case "kakutei":
this.kakutei_action();
break;
case "setting":
this.setting_action();
break;
case "lf":
this.lf_action();
break;
case "allclear":
this.allclear_action();
break;
default:
console.log("[WARNING] Not Supported event.");
break;}
};
SFT_Keyboard.prototype.under_action_hook=function (){
if(this.asr_menu.is_open()){this.asr_menu.enter_action();
return;}
if(this.round_menu.is_open()){this.round_menu.select_menu_item();
return;}
if(this.cursor==this.control_key){
if(this.control_key.is_done_enable())this.control_key.do_current_key_action();
return;}
};
SFT_Keyboard.prototype.mickey_action_hook=function (){
if(this.asr_menu.is_open())
this.asr_menu_done_func();
if(this.language=="zh-TW"){
this.delete_bpmf_timer();
this.soft_keyboard.bpmf_list_clear();}else if(this.language=="zh-CN"||this.language=="zh-HK"){
this.py_input_a="";
this.py_search_a="";
this.py_flag=false;}else if(this.is_ime_enable()){
if(this.ime.get_input_method()==IME_SOFTKBD){
switch(this.ime.get_mode()){
case "TRANSLATE":
case "ADJUST":
this.ime.cancel();
this.control_key.reset_grayout_henkan_top();
this._to_NO_TRANSLATE();
this.ime.decide_no_input();
this.do_cancel_composition();
break;
case "NO_TRANSLATE":
this.ime.decide_no_input();
this.do_cancel_composition();
break;}
}else if(this.ime.get_input_method()==IME_USBKBD){
this.ime.change_method_from_usbkbd();}
}
if(this.select_bar.is_active()){
this.select_bar.clear();}
this.mic_key.enter_action();};
SFT_Keyboard.prototype.closekey_action_hook=function (){
if(this.cancel_callback)
this.cancel_callback();};
SFT_Keyboard.prototype.setting_action_hook=function (arg){
this.setting_menu.close();
this.pointer.set_visible(true);
this.set_lang(arg);};
SFT_Keyboard.prototype.setting_anim_all_end_hook=function (){
this.pointer.set_visible(true);};
SFT_Keyboard.prototype.setting_close_action_hook=function (){
this.setting_menu.close();
this.last_cursor=null;
this.pointer.set_visible(true);
common_key.set_cursor(this,this.control_key);};
SFT_Keyboard.prototype.confirm_open_func=function (type,done_hook){
var self=this;
var _done_hook=function(){};
if(done_hook&&typeof done_hook=="function"){
_done_hook=done_hook;}
done_hook=function(){
_done_hook();
self.confirm_close_hook();};
var cancel_hook=function(){
self.confirm_close_hook();};
this.last_cursor=this.cursor;
common_key.set_cursor(this,this.confirm);
this.pointer.set_visible(false);
this.confirm.open({
confirm_type:type,done_hook:done_hook,cancel_hook:cancel_hook
});};
SFT_Keyboard.prototype.confirm_close_hook=function (){
this.confirm.close();
this.pointer.set_visible(true);
if(this.last_cursor)
common_key.set_cursor(this,this.last_cursor);
this.last_cursor=null;};
SFT_Keyboard.prototype.confirm_open_anim_end_hook=function (){
this.pointer.set_visible(true);};
SFT_Keyboard.prototype.asr_menu_action_hook=function (text){
if(text){
this.add_asr_text(text);}
common_key.set_cursor(this,null);
if(this.last_cursor){
this.last_cursor=null;
common_key.set_cursor(this,this.soft_keyboard);}
this.move_cursor_to_done_lf();
this.asr_menu.close();};
SFT_Keyboard.prototype.asr_set_colorkey_grayout_hook=function (bool){
if(bool)
this.control_key.set_grayout_all_colorkey();
else
this.control_key.reset_grayout_all_colorkey();};
SFT_Keyboard.prototype.softkbd_keytop_mouseover_hook=function (col,row){
this.soft_keyboard.check_init_enterd();
this.soft_keyboard.set_position({col:col,row:row});
if(this.cursor!=this.soft_keyboard)
common_key.set_cursor(this,this.soft_keyboard);
this.select_bar.release_focus();};
SFT_Keyboard.prototype.ctrlkey_keytop_mouseover_hook=function (col,row){
this.soft_keyboard.check_init_enterd();
this.control_key.set_position({col:col,row:row});
if(this.cursor!=this.control_key)
common_key.set_cursor(this,this.control_key);
this.select_bar.release_focus();};
SFT_Keyboard.prototype.mickey_mouseover_hook=function (){
this.soft_keyboard.check_init_enterd();
if(this.cursor!=this.mic_key)
common_key.set_cursor(this,this.mic_key);
this.select_bar.release_focus();};
SFT_Keyboard.prototype.closekey_mouseover_hook=function (){
this.soft_keyboard.check_init_enterd();
if(this.cursor!=this.close_key)
common_key.set_cursor(this,this.close_key);
this.select_bar.release_focus();};
SFT_Keyboard.prototype.select_bar_mouseover_hook=function (arg){
if(this.asr_menu.is_open()){common_key.set_cursor(this,this.asr_menu);
this.asr_menu.update_asr_text();
return;}
if(this.ime.is_ime_supported()){
if(!this.select_bar.get_is_cursor_out()){
this.select_bar.in_current_cursor();
common_key.set_cursor(this,this.ime);
this.ime.update_current_candidate();}
}
};
SFT_Keyboard.prototype.done_action=function (arg){
if(this.done_callback!=null&&
typeof this.done_callback=="function"){
this.done_callback();}
};
SFT_Keyboard.prototype.update_char_switch_top=function (){
if(this.asr_menu.is_open())
this.asr_menu_done_func();
if(this.soft_keyboard.is_zhcn_kbd_mode()){
delete_timer(this.zhcn_timer);}
var current_mode=this.control_key.get_current_char_mode();
this.soft_keyboard.update_keytop(current_mode);
this.control_key.update_keytop();
if(this.select_bar.is_active()){
if(((this.language=="zh-CN")||(this.language=="zh-HK"))&&this.py_flag){
this.py_input_a="";
this.py_search_a="";}else if(this.language=="zh-TW"){
this.soft_keyboard.bpmf_list_clear();}
if(this.cursor==this.select_bar){
common_key.set_cursor(this,this.soft_keyboard);}else if(this.cursor==this.text_box_back){
this.text_box_back.release_focus();}
this.select_bar.clear();
if(this.ime.is_ime_supported()){
if(this.cursor==this.text_box_back){
this.text_box_back.down_action_hook();}else {
this.select_bar.clear();
this.ime.cancel();
this.ime.change_mode("NO_TRANSLATE");
this.cancel_ime_to_NO_TRANSLATE();
this.control_key.reset_grayout_henkan_top();
if(this.cursor==this.ime||this.cursor==this.soft_keyboard
||this.cursor==this.control_key){
if(this.last_cursor)
common_key.set_cursor(this,this.last_cursor);
this.last_cursor=null;}else if(this.cursor==this.round_menu){
this.last_cursor=this.soft_keyboard;}
}
}
}
};
SFT_Keyboard.prototype.char_switch_action=function (){
this.control_key.change_character_set();
this.update_char_switch_top();
this.change_round_menu_char_switch_label();};
SFT_Keyboard.prototype._control_target_is_ime=function (arg){
var mode=this.ime.get_mode();
switch(mode){
case "TRANSLATE":
case "ADJUST":
case "NO_INPUT":
return true;}
return false;};
SFT_Keyboard.prototype._backspace_action_ja_JP=function (arg){
if(this.ime.get_mode()=="TRANSLATE"
||this.ime.get_mode()=="ADJUST"){
this.ime.cancel();
this.control_key.reset_grayout_henkan_top();
this._to_NO_TRANSLATE();
if(this.last_cursor)
common_key.set_cursor(this,this.last_cursor);
else
common_key.set_cursor(this,this.control_key);
this.last_cursor=null;
return;}
if(this._control_target_is_ime()){
this.backspace_text_ja_JP_ime();
return;}
this.backspace_text_ja_JP();
if(this.text_box.get_text_length()==0)
this._to_NO_INPUT();
return;};
SFT_Keyboard.prototype.backspace_action=function (arg){
var ret=null;
var self=this;
var cancel_func=function(){
common_key.set_cursor(self,null);
common_key.set_cursor(self,self.soft_keyboard);
self.select_bar.clear();
self.pointer.set_visible(true);};
if(this.asr_menu.is_open()){
this.asr_menu_close_func();
return;}
if(this.language=="zh-TW"&&this.soft_keyboard.get_current_mode()==0){
if(this.select_bar.is_active()&&this.soft_keyboard.is_bpmf_complete()){
if(this.round_menu.is_open()){
this.reset_select_bar();
this.last_cursor=this.soft_keyboard;}else {
cancel_func();}
return;}
this.backspace_tra_ch();
return;}
if(((this.language=="zh-CN")||(this.language=="zh-HK"))&&this.select_bar.is_active()){
if(this.py_input_a.length!=0)
this.py_input_a=this.py_input_a.slice(0,this.py_input_a.length-1);
if(this.py_input_a==""){
this.select_bar.clear();
this.py_search_a="";
switch(this.cursor){
case this.select_bar:
if(this.soft_keyboard.is_zhcn_kbd_mode()){
this.soft_keyboard.set_position(this.soft_keyboard.ZHCN_L_ARROW_POS);}
common_key.set_cursor(this,this.soft_keyboard);
break;
case this.round_menu:
if(this.last_cursor==this.select_bar)
this.last_cursor=this.soft_keyboard;
force_redraw();
break;
default:
var curt_cursor=this.cursor;
common_key.set_cursor(this,null);
common_key.set_cursor(this,curt_cursor);}
}else {
this.char_keytop_action_hook("backspace");
if(this.cursor==this.select_bar){
common_key.set_cursor(this,null);
common_key.set_cursor(this,this.select_bar);}
}
return;}
if(this.language=="vi-00"&&this.last_input_text_global.length>0){
this.last_input_text_global=this.last_input_text_global.slice(0,-1);
if(this.last_input_text_global.length==0){
this.switch_done_top({func:"done"});
this.select_bar.clear();}else {
this.select_bar.show([this.last_input_text_global],true);}
return;}
if(this.ime.is_ime_supported()){
ret=this._backspace_action_ja_JP(arg);
return;}
if(this.select_bar.is_active()&&!this.ime.is_ime_supported()
&&this.language!="zh-CN"&&this.language!="zh-TW"&&this.language!="zh-HK"){
if(this.round_menu.is_open()){
this.reset_select_bar();
if(this.last_cursor==this.select_bar)
this.last_cursor=this.soft_keyboard;}else {
cancel_func();}
return;}

this.backspace_text();
force_redraw();};
SFT_Keyboard.prototype.up_action=function (){
if(this.asr_menu.is_open())
this.asr_menu_done_func();
if(this.ime.is_ime_supported()){
this.up_action_ja_JP();
return;}
this.do_move_caret(TXK_UP);};
SFT_Keyboard.prototype.up_action_ja_JP=function (){
var mode=this.ime.get_mode();
switch(mode){
case "NO_INPUT":
this.do_move_caret(TXK_UP);
break;}
};
SFT_Keyboard.prototype.down_action=function (){
if(this.asr_menu.is_open())
this.asr_menu_done_func();
if(this.ime.is_ime_supported()){
this.down_action_ja_JP();
return;}
this.do_move_caret(TXK_DOWN);};
SFT_Keyboard.prototype.down_action_ja_JP=function (){
var mode=this.ime.get_mode();
switch(mode){
case "NO_INPUT":
this.do_move_caret(TXK_DOWN);
break;}
};
SFT_Keyboard.prototype.left_action=function (arg){
if(this.asr_menu.is_open())
this.asr_menu_done_func();
if(this.ime.is_ime_supported()){
this.left_action_ja_JP(TXK_LEFT);
return;}
this.text_box.cursor_left();
this.do_move_caret(TXK_LEFT);};
SFT_Keyboard.prototype.left_action_ja_JP=function (){
var mode=this.ime.get_mode();
switch(mode){
case "NO_INPUT":
this.ime.cursor_left();
this.do_move_caret(TXK_LEFT);
break;
case "NO_TRANSLATE":
this.text_box.cursor_left();
this.move_caret_NO_TRANSLATE();
break;
case "TRANSLATE":
case "ADJUST":
this.ime.cursor_left();
break;}
};
SFT_Keyboard.prototype.right_action=function (arg){
if(this.asr_menu.is_open())
this.asr_menu_done_func();
if(this.ime.is_ime_supported()){
this.right_action_ja_JP();
return;}

this.text_box.cursor_right();
this.do_move_caret(TXK_RIGHT);};
SFT_Keyboard.prototype.right_action_ja_JP=function (){
var mode=this.ime.get_mode();
switch(mode){
case "NO_INPUT":
this.ime.cursor_right();
this.do_move_caret(TXK_RIGHT);
break;
case "NO_TRANSLATE":
this.text_box.cursor_right();
this.move_caret_NO_TRANSLATE();
break;
case "TRANSLATE":
case "ADJUST":
this.ime.cursor_right();
break;}
};
SFT_Keyboard.prototype.space_action=function (arg){
if(this.asr_menu.is_open())
this.asr_menu_done_func();
if(this.language=="zh-TW"&&this.soft_keyboard.get_current_mode()==0
&&!this.soft_keyboard.is_bpmf_complete()){
this.process_tra_ch(" ");
return;}
if(this.ime.is_ime_supported()){
this.ime.addText(" ");
return;}
if(((this.language=="zh-CN")||(this.language=="zh-HK"))&&this.select_bar.is_active()){
this.py_input_a="";
this.py_search_a="";
this.select_bar.clear();
common_key.set_cursor(this,this.soft_keyboard);}
this.add_text(" ");};
SFT_Keyboard.prototype.henkan_action=function (arg){
if(this.ime.is_ime_supported()){
if(this.ime.get_mode()=="TRANSLATE"
||this.ime.get_mode()=="ADJUST"){
return;}
}
this.last_cursor=this.cursor;
this.control_key.set_grayout_henkan_top();
this.select_bar.in_current_cursor();
common_key.set_cursor(this,this.ime);
this.ime.enter_translate_mode();};
SFT_Keyboard.prototype.kakutei_action=function (arg){
if(this.ime.is_ime_supported()){
switch(this.ime.get_mode()){
case "NO_TRANSLATE":
this.ime.decide_no_translate();
this.control_key.reset_grayout_henkan_top();
this.control_key.restore_temp_grayout_all_arrowkey();
this.switch_spc_top({func:"spc"});
this.switch_done_top({func:"done"});
break;
case "NO_INPUT":
this.control_key.reset_grayout_henkan_top();
this.control_key.restore_temp_grayout_all_arrowkey();
this.switch_spc_top({func:"spc"});
this.switch_done_top({func:"done"});
break;
case "TRANSLATE":
this.ime.decide_translate();
break;
case "ADJUST":
this.ime.decide_adjust();
break;}
return;}else if(this.language=="vi-00"){
this.add_text(this.last_input_text_global);
this.last_input_text_global="";
this.select_bar.clear();
this.switch_done_top({func:"done"});}
};
SFT_Keyboard.prototype.lf_action=function (){
if(this.asr_menu.is_open())
this.asr_menu_done_func();
this.do_enter_linefeed();};
SFT_Keyboard.prototype.allclear_action=function (){
var self=this;
var done_hook=function(){
self.do_enter_allclear();};
if(this.asr_menu.is_open())
this.asr_menu_done_func();
this.confirm_open_func("allclear",done_hook);};
SFT_Keyboard.prototype.setting_action=function (arg){
if(this.asr_menu.is_open())
this.asr_menu_done_func();
this.reset_select_bar();
this.setting_menu.open();
if(this.cursor!=this.round_menu)
this.last_cursor=this.cursor;
this.pointer.set_visible(false);
common_key.set_cursor(this,this.setting_menu);};
SFT_Keyboard.prototype.change_round_menu_char_switch_label=function (){
if(!this.round_menu.is_open())
return;
var item_data=this.control_key.get_char_change_label_data();
this.round_menu.change_char_switch_label(item_data,item_data.func);};
SFT_Keyboard.prototype.change_round_menu_spc_label=function (trg_func){
if(!this.round_menu.is_open())
return;
var item_data=this.control_key.get_spc_label_data();
if(!item_data)
return;
this.round_menu.change_spc_label(item_data,(trg_func=="spc")?"henkan":"spc");};
SFT_Keyboard.prototype.change_round_menu_done_label=function (trg_func){
if(!this.round_menu.is_open())
return;
var item_data=this.control_key.get_done_label_data();
if(!item_data)
return;
this.round_menu.change_done_label(item_data,(trg_func=="done")?"kakutei":"done");};
SFT_Keyboard.prototype.switch_spc_top=function (arg){this.control_key.switch_spc_top(arg);
this.change_round_menu_spc_label(arg.func);};
SFT_Keyboard.prototype.switch_done_top=function (arg){this.control_key.switch_done_top(arg);
this.change_round_menu_done_label(arg.func);};
SFT_Keyboard.prototype.set_grayout_arrows=function(bool){
this.control_key.set_grayout_all_arrowkey(bool);};
SFT_Keyboard.prototype.select_bar_update_stencil_hook=function (){
this.update_stencil_table("select_bar");};
SFT_Keyboard.prototype.setting_update_stencil_hook=function (){
this.update_stencil_table("setting_menu");};
SFT_Keyboard.prototype.round_update_stencil_hook=function (){
this.update_stencil_table("round_menu");};
SFT_Keyboard.prototype.confirm_update_stencil_hook=function (){
this.update_stencil_table("confirm");};
SFT_Keyboard.prototype.asr_update_stencil_hook=function (){
this.update_stencil_table("asr_menu");};
SFT_Keyboard.prototype.round_menu_action_hook=function (arg){
switch(arg){
case "backspace":
this.backspace_action();
break;
case "spc":
this.space_action();
break;
case "henkan":
common_key.set_cursor(this,this.last_cursor);
this.round_menu.close_menu();
this.pointer.set_visible(true);
this.henkan_action();
break;
case "done":
common_key.set_cursor(this,this.last_cursor);
this.round_menu.close_menu();
this.pointer.set_visible(true);
this.done_action();
break;
case "kakutei":
this.pointer.set_visible(true);
this.round_menu.close_menu();
this.kakutei_action();
break;
case "setting":
this.round_menu.close_menu();
this.pointer.set_visible(true);
this.control_key.set_position(this.control_key.get_key_pos_by_func("setting"));
this.setting_action();
break;
case "close":
if(this.soft_keyboard.is_zhcn_kbd_mode()){
if(this.last_cursor==this.soft_keyboard){
this.soft_keyboard.set_position(this.soft_keyboard.ZHCN_L_ARROW_POS);}
}
common_key.set_cursor(this,this.last_cursor);
this.round_menu.close_menu();
this.pointer.set_visible(true);
break;
case "char_switch":
this.char_switch_action();
break;}
};
SFT_Keyboard.prototype.asr_menu_done_func=function(){
this.asr_menu_action_hook();};
SFT_Keyboard.prototype.asr_menu_close_func=function(){
common_key.set_cursor(this,null);
if(this.last_cursor){
if(this.last_cursor==this.select_bar)
common_key.set_cursor(this,this.soft_keyboard);
else
common_key.set_cursor(this,this.last_cursor);
this.last_cursor=null;}else {
common_key.set_cursor(this,this.soft_keyboard);}
this.asr_menu.close();};
SFT_Keyboard.prototype.softkbd_cursor_over_hook=function(keysym){
switch(keysym){
case TXK_UP:
if(((this.language=="zh-CN")||(this.language=="zh-HK"))&&this.select_bar.is_active()){
common_key.set_cursor(this,this.select_bar);
return true;}
if(this.soft_keyboard.is_zhcn_kbd_mode()){
if(this.soft_keyboard.is_position_zhcn_left()){
common_key.set_cursor(this,this.close_key);
return true;}else if(this.soft_keyboard.is_position_zhcn_right()){
if(this.mic_key.is_display()){
common_key.set_cursor(this,this.mic_key);
return true;}
}
}
if(this.is_ime_enable()&&this.select_bar.is_active()){
this.last_cursor=this.cursor;
common_key.set_cursor(this,this.ime);
this.select_bar.in_current_cursor();
return true;}
if(!this.select_bar.is_active()){
if(this.soft_keyboard.is_position_tr()){
if(this.mic_key.is_display()){
common_key.set_cursor(this,this.mic_key);
return true;}
}else if(this.soft_keyboard.is_position_tl()){
common_key.set_cursor(this,this.close_key);
return true;}
}
break;
case TXK_DOWN:
var to_pos={};
to_pos.col=0;
to_pos.row=0;
var current_row=this.soft_keyboard.get_current_row();
var soft_blocks=this.soft_keyboard.get_keytop_block_array();
var ctrl_blocks=this.control_key.get_keytop_block_array();
var exact_row=0;
for(var i=0;i<current_row;i++){
exact_row+=soft_blocks[i];}
var to_block=0;
for(i=0;i<ctrl_blocks.length;i++){
to_block+=ctrl_blocks[i];
if(to_block>exact_row){
if(to_block%1>0&&to_block%1<0.5)continue;
to_pos.row=i;
break;}
}
this.control_key.set_position(to_pos);
common_key.set_cursor(this,this.control_key);
return true;
break;}
if(this.asr_menu.is_open()){
switch(keysym){
case TXK_RETURN:
this.asr_menu_close_func();
return true;}
}


if(this.ime.is_ime_supported()&&this.select_bar.is_active()
&&(this.ime.get_mode()=="TRANSLATE"
||this.ime.get_mode()=="ADJUST")){
switch(keysym){
case TXK_RETURN:
var ret=false;
ret=this.ime.key_hook(KEY_PRESS,keysym);
if(ret)
return ret;
ret=this.ime_cursor_over_hook(keysym);
common_key.set_cursor(this,this.soft_keyboard);
return ret;}
}

return false;};
SFT_Keyboard.prototype.ctrlkey_cursor_over_hook=function(keysym){
switch(keysym){
case TXK_UP:
var to_pos={};
to_pos.col=this.soft_keyboard.NUM_COL-1;
to_pos.row=0;
var current_row=this.control_key.get_current_row();
var soft_blocks=this.soft_keyboard.get_keytop_block_array();
var ctrl_blocks=this.control_key.get_keytop_block_array();
var exact_row=0;
for(var i=0;i<=current_row;i++){
exact_row+=ctrl_blocks[i];}
var to_block=0;
for(i=0;i<soft_blocks.length;i++){
to_block+=soft_blocks[i];
if(to_block>=exact_row){
if(exact_row%1>0&&exact_row%1<0.5){to_pos.row=i-1;
break;}
to_pos.row=i;
if(ctrl_blocks[current_row]>1)
to_pos.row-=1;
break;}
}
if(this.soft_keyboard.is_zhcn_kbd_mode()){
var zhcn_trg_pos=this.soft_keyboard.ZHCN_L_ARROW_POS;
to_pos.col=zhcn_trg_pos.col;
to_pos.row=zhcn_trg_pos.row;}
this.soft_keyboard.set_position(to_pos);
common_key.set_cursor(this,this.soft_keyboard);
return true;}
if(this.asr_menu.is_open()){
switch(keysym){
case TXK_RETURN:
this.asr_menu_close_func();
return true;}
}
if(this.ime.is_ime_supported()){
if(this.ime.get_mode()=="TRANSLATE"
||this.ime.get_mode()=="ADJUST"){
if(this.select_bar.is_active()){
switch(keysym){
case TXK_RETURN:
var ret=false;
ret=this.ime.key_hook(KEY_PRESS,keysym);
if(ret)
return ret;
ret=this.ime_cursor_over_hook(keysym);
common_key.set_cursor(this,this.control_key);
return ret;}
}
}
}

return false;};
SFT_Keyboard.prototype.mickey_cursor_over_hook=function(keysym){
switch(keysym){
case TXK_DOWN:
if(this.soft_keyboard.is_zhcn_kbd_mode()){
this.soft_keyboard.set_position(this.soft_keyboard.ZHCN_R_ARROW_POS);}else {
var to_pos={};
to_pos.col=0;
to_pos.row=this.soft_keyboard.NUM_ROW-1;
this.soft_keyboard.set_position(to_pos);}
common_key.set_cursor(this,this.soft_keyboard);
return true;}
if(this.asr_menu.is_open()){
switch(keysym){
case TXK_RETURN:
this.asr_menu_close_func();
return true;}
}
if(this.ime.is_ime_supported()){
if(this.ime.get_mode()=="TRANSLATE"
||this.ime.get_mode()=="ADJUST"){
if(this.select_bar.is_active()){
switch(keysym){
case TXK_RETURN:
var ret=false;
ret=this.ime.key_hook(KEY_PRESS,keysym);
if(ret)
return ret;
ret=this.ime_cursor_over_hook(keysym);
common_key.set_cursor(this,this.mic_key);
return ret;}
}
}
}
return false;};
SFT_Keyboard.prototype.closekey_cursor_over_hook=function(keysym){
switch(keysym){
case TXK_DOWN:
if(this.soft_keyboard.is_zhcn_kbd_mode()){
this.soft_keyboard.set_position(this.soft_keyboard.ZHCN_L_ARROW_POS);}else {
var to_pos={};
to_pos.col=0;
to_pos.row=0;
this.soft_keyboard.set_position(to_pos);}
common_key.set_cursor(this,this.soft_keyboard);
return true;}
if(this.asr_menu.is_open()){
switch(keysym){
case TXK_RETURN:
this.asr_menu_close_func();
return true;}
}
if(this.ime.is_ime_supported()){
if(this.ime.get_mode()=="TRANSLATE"
||this.ime.get_mode()=="ADJUST"){
if(this.select_bar.is_active()){
switch(keysym){
case TXK_RETURN:
var ret=false;
ret=this.ime.key_hook(KEY_PRESS,keysym);
if(ret)
return ret;
ret=this.ime_cursor_over_hook(keysym);
common_key.set_cursor(this,this.close_key);
return ret;}
}
}
}
return false;};
SFT_Keyboard.prototype.confirm_cursor_over_hook=function(keysym){
switch(keysym){
case TXK_RETURN:
this.confirm_close_hook();
return true;
break;}
return false;};
SFT_Keyboard.prototype.setting_cursor_over_hook=function(keysym){
switch(keysym){
case TXK_RETURN:
this.setting_close_action_hook();
return true;
break;}
return false;};
SFT_Keyboard.prototype.round_cursor_over_hook=function(keysym){
switch(keysym){
case TXK_ENTER:
this.round_menu.select_menu_item();
return true;
case TXK_LEFT:
case TXK_RIGHT:
case TXK_UP:
case TXK_DOWN:
case TXK_RETURN:
if(this.soft_keyboard.is_zhcn_kbd_mode()){
if(this.last_cursor==this.soft_keyboard){
this.soft_keyboard.set_position(this.soft_keyboard.ZHCN_L_ARROW_POS);}
}
common_key.set_cursor(this,this.last_cursor);
this.round_menu.close_menu();
this.pointer.set_visible(true);
return true;}
return false;};
SFT_Keyboard.prototype.select_cursor_over_hook=function(keysym){
switch(keysym){
case TXK_RETURN:
case TXK_ENTER:
case TXK_DOWN:
if((this.cursor==this.select_bar)&&((keysym==TXK_DOWN)||(keysym==TXK_RETURN))){
common_key.set_cursor(this,null);
if(this.soft_keyboard.is_zhcn_kbd_mode()){
this.soft_keyboard.set_position(this.soft_keyboard.ZHCN_L_ARROW_POS);}
common_key.set_cursor(this,this.soft_keyboard);
this.py_input_a="";
this.py_search_a="";
this.select_bar.clear();
this.pointer.set_visible(true);
return true;}
if((this.py_flag)&&(keysym==TXK_ENTER)){
common_key.set_cursor(this,null);
common_key.set_cursor(this,this.select_bar);
this.py_flag=false;
return true;}
this.py_input_a="";
this.py_search_a="";
if((this.language=="zh-CN")||(this.language=="zh-HK")){
common_key.set_cursor(this,this.null);
common_key.set_cursor(this,this.select_bar);}else {
common_key.set_cursor(this,this.soft_keyboard);
this.select_bar.clear();}
this.pointer.set_visible(true);
return true;
break;}
return false;};
SFT_Keyboard.prototype.ime_cursor_over_hook=function(keysym){
var ime_method=this.ime.get_input_method();
if(ime_method!=IME_USBKBD){
switch(keysym){
case TXK_DOWN:
this.last_cursor=null;
this.soft_keyboard.set_position_to_top_col();
common_key.set_cursor(this,this.soft_keyboard);
this.select_bar.out_current_cursor();
return true;
case TXK_RETURN:
common_key.set_cursor(this,this.last_cursor);
this.control_key.reset_grayout_henkan_top();
this.last_cursor=null;
this.pointer.set_visible(true);
return true;}
return false;}
switch(keysym){
case TXK_DOWN:
this.ime.change_method_from_usbkbd();
return true;
case TXK_ENTER:
if(!this.select_bar.is_active()){
this.ime.change_method_from_usbkbd();
this.move_cursor_to_done_lf();
return true;}
}
return false;};
SFT_Keyboard.prototype.asr_cursor_over_hook=function(keysym){
switch(keysym){
case TXK_DOWN:
this.last_cursor=null;
if(this.soft_keyboard.is_zhcn_kbd_mode())
this.soft_keyboard.set_position(this.soft_keyboard.ZHCN_L_ARROW_POS);
else
this.soft_keyboard.set_position_to_top_col();
common_key.set_cursor(this,this.soft_keyboard);
this.asr_menu.close();
return true;
case TXK_RETURN:
this.asr_menu_close_func();
return true;}
return false;};
SFT_Keyboard.prototype.mouse_hook=function (arg){
if(arg[6]){var button=arg[3];
var modifier1=(button&ebus.mouse.DOWN_MODIFIER1_BUTTON);
if(!modifier1){
var diff_z=arg[6];
var keysym=TXK_SCROLL_UP;
if(diff_z==1)
keysym=TXK_SCROLL_DOWN;
return this.scroll_handler(KEY_PRESS,keysym);}
}
if(this.stencil_man&&typeof this.stencil_man.mouse_hook=="function")
return this.stencil_man.mouse_hook(arg);
return false;};
SFT_Keyboard.prototype.set_keyboard=function (mode_number){
console_log(">> SFT_Keyboard.prototype.set_keyboard() mode_number = "+mode_number);
this.create(mode_number);};
SFT_Keyboard.prototype.free=function (){
console_log(">> SFT_Keyboard.prototype.free()");
discard_package("word_lib");
discard_package("py_index");
discard_package("py_ch");
discard_package("pkg_bpmf_data");
discard_package("cj_cn");
discard_package("pkg_romkan");
this.stencil_man.free();
for(var i=0;i<this.components.length;i++){
if(this.components[i].free&&typeof this.components[i].free=="function"){
this.components[i].free();}
}
this.components=[];};
SFT_Keyboard.prototype.revive=function (){
console_log(">> SFT_Keyboard.prototype.revive()");};
SFT_Keyboard.prototype.init=function (){
console_log(">> SFT_Keyboard.prototype.init()");};
SFT_Keyboard.prototype.getText=function (){
console_log(">> SFT_Keyboard.prototype.getText()");
if(this.ime.is_ime_supported()){
return this.ime.getText();}else {
return this.text_box.get_text();}
};
SFT_Keyboard.prototype.setText=function (arg){
return false;};
SFT_Keyboard.prototype.setCursorToEnd=function (){
console_log(">> SFT_Keyboard.prototype.setCursorToEnd()");};
SFT_Keyboard.prototype.setHook=function (func){
console_log(">> SFT_Keyboard.prototype.setHook()");};
SFT_Keyboard.prototype.setCallBack=function (db){
console_log(">> SFT_Keyboard.prototype.setCallBack()");};
SFT_Keyboard.prototype.setTabCallBack=function (db){
console_log(">> SFT_Keyboard.prototype.setTabCallBack()");};
SFT_Keyboard.prototype.setShiftTabCallBack=function (db){
console_log(">> SFT_Keyboard.prototype.setTabCallBack()");};
SFT_Keyboard.prototype.setMode=function (arg){
console_log(">> SFT_Keyboard.prototype.setMode() arg = "+arg);
if(arg=="PASSWD"){
this.text_box.enable_password_mode();
this.change_input_char_set({type:"ALPHABET"});}else{
this.text_box.disable_password_mode();}
if(this.ime.is_ime_supported()){
this.ime.setMode(arg);}
};
SFT_Keyboard.prototype.getMode=function (){
if(this.ime.is_ime_supported()){
return this.ime.getMode();}
else {
return this.text_box.get_password_mode();}
};
SFT_Keyboard.prototype.is_write_from_right_lang=function (){
return (this.language=='ar-00'||this.language=='he-IL')?true:false;};
SFT_Keyboard.prototype.prepare_lang_specific_pkg=function (lang){
if(lang=="zh-TW"){
add_package_load_path("pkg_bpmf_data",kbd_path+"pkg_bpmf_data.js");
require("pkg_bpmf_data");}
if(lang.indexOf("CN")==3){
add_package_load_path("py_index",kbd_path+"py_index.js");
add_package_load_path("py_ch",kbd_path+"py_ch.js");
add_package_load_path("word_lib",kbd_path+"word_lib.js");
prepare_package("py_index");
prepare_package("py_ch");
require("word_lib");
require("py_index");require("py_ch");}
if(lang=="zh-HK"){
add_package_load_path("cj_cn",kbd_path+"cj_cn.js");
require("cj_cn");}
};
SFT_Keyboard.prototype.set_skin=function(){
skin_func.set_skin();};
SFT_Keyboard.prototype.set_cache=function(){
var NULL_FUNC=function(){};
this.cache=[];
this.cache.push(new gimage({src:SKIN.sel_bar_keytop.neon.c,onload:NULL_FUNC}));
this.cache.push(new gimage({src:SKIN.sel_bar_keytop.neon.s,onload:NULL_FUNC}));};
SFT_Keyboard.prototype.clear_cache=function(){
if(this.cache)
for(var i=0;i<this.cache.length;i++)
this.cache[i].src="";
this.cache=null;};
SFT_Keyboard.prototype.set_lang=function (lang){
console_log(">> SFT_Keyboard.prototype.set_lang() lang = "+lang);
this.language=lang;
this.prepare_lang_specific_pkg(this.language);
if(typeof set_keyboard_lang=="function"){
set_keyboard_lang(this.language);}else {
console.log("[WARNING] Does not define set_keyboard_lang");}
var inputed_text=this.getText();
var password_mode=this.getMode();
var pointer_force_visible=this.pointer.get_force_visible();
var done_timing=this.control_key.get_done_timing();
this.do_cancel_composition();
this._create();
this.enter_focus();
this.last_cursor=null;
this.py_flag=false;
if(password_mode){
this.setMode("PASSWD");}
if(inputed_text){
this.setText(inputed_text);}
this._set_input_char_set();
this.force_pointer_visible(pointer_force_visible);
this.control_key.set_done_timing(done_timing);};
SFT_Keyboard.prototype.set_change_keyboard_callback=function(callback){
if(callback!=null&&typeof callback=="function")
this.change_keyboard_callback=callback;};
SFT_Keyboard.prototype.set_show_asr_menu_callback=function(callback){
if(callback!=null&&typeof callback=="function")
this.show_asr_menu_callback=callback;};
SFT_Keyboard.prototype.set_trg_textarea=function(textarea){
var self=this;
if(textarea){
this.trg_textarea=textarea;
this.set_toggle_force_caret_tail_cb(
function(bool){
self.set_grayout_arrows(bool);}
);
if(this.is_write_from_right_lang()){
this.do_set_from_right_mode();}else {
this.do_set_from_left_mode();};
this.switch_unconf_bg();}
};
SFT_Keyboard.prototype.set_done_callback=function(callback,timing){
if(callback!=null&&typeof callback=="function")
this.done_callback=callback;
if(timing!=null&&typeof timing=="string"){
this.control_key.set_done_timing(timing);
this.asr_menu.set_done_timing(timing);}
};
SFT_Keyboard.prototype.set_cancel_callback=function(callback){
if(callback!=null&&typeof callback=="function")
this.cancel_callback=callback;};
SFT_Keyboard.prototype.get_in_cursor=function (){
console_log(">> SFT_Keyboard.prototype.get_in_cursor()");
if(this.cursor==null)
return false;
return true;};
SFT_Keyboard.prototype.change_input_char_set=function (arg){
if(typeof arg.type=="undefined")
return;
this.input_char_set=arg.type;
this._set_input_char_set();
return;};
SFT_Keyboard.prototype._set_input_char_set=function (){
switch(this.input_char_set){
case "ALL":
this.control_key.disable_alphabet_mode();
break;
case "ALPHABET":
this.control_key.enable_alphabet_mode();
this.update_char_switch_top();
break;}
return;};
SFT_Keyboard.prototype.move_cursor_to_done_lf=function (){
if(this.cursor==this.control_key){
common_key.set_cursor(this,this.soft_keyboard);}
var to_func="lf";if(this.is_textarea_singleline())to_func="done";
this.control_key.set_position(this.control_key.get_key_pos_by_func(to_func));
common_key.set_cursor(this,this.control_key);};
SFT_Keyboard.prototype.start_key_wait=function(){
var self=this;
this.stop_key_wait();
if(!this.key_wait)
this.key_wait=true;
append_timer(
this.key_wait_timer,this.key_wait_s,
function(){
self.stop_key_wait();
self.key_wait=false;});};
SFT_Keyboard.prototype.stop_key_wait=function(){
delete_timer(this.key_wait_timer);};
SFT_Keyboard.prototype.class_name="__INPUT_OBJECT__";
SFT_Keyboard.prototype.usb_keyboard_hook=function (key){
if(key.type==key.CHAR){
var char=key.code;
var len=char.length;
if(this.asr_menu.is_open()){
this.asr_menu_done_func();}
if(char==" "){
this.space_action();
return true;}
if(this.language=="zh-TW"&&this.soft_keyboard.get_current_mode()==0
&&key.__event_type==ebus.kbd.KEYSYM_EV){
var bpmf_char=this.soft_keyboard.asc2bopomo(char);
this.char_keytop_action_hook(bpmf_char);
return true;}else if(((this.language=="zh-CN")||(this.language=="zh-HK"))&&key.__event_type==ebus.kbd.KEYSYM_EV){
if(this.soft_keyboard.get_current_mode()==0){
this.char_keytop_action_hook(char);
if(this.py_flag){
if(this.py_input_a!=""){
common_key.set_cursor(this,null);
common_key.set_cursor(this,this.select_bar);}
}else {
this.move_cursor_to_done_lf();}
return true;}else if(this.soft_keyboard.get_current_mode()==3
&&this.soft_keyboard.get_zhcn_mode()==this.soft_keyboard.ZHCN_MODE_LEFT){
if(this.cursor!=this.soft_keyboard){
if(this.setting_menu.is_active()){
this.soft_keyboard.enable_stencil();
this.setting_menu.close();}
if(this.confirm.is_open()){
this.confirm_close_hook();}
common_key.set_cursor(this,this.soft_keyboard);}
this.char_keytop_action_hook(char);
return true;}
}
for(var i=0;i<len;i++){
this.add_text(char[i]);}
if(key.__event_type==ebus.kbd.STRING_EV){if(this.sphone_send_after_done)
this.done_action();}
return true;}else if(key.type==key.CONT){
switch(key.code){
case TXKB_BackSpace:
if(this.asr_menu.is_open()){
this.asr_menu_close_func();
break;}else if(this.confirm.is_open()){
this.confirm_close_hook();}
this.backspace_action();
force_redraw();
break;}
return true;}else {

}
return false;};
SFT_Keyboard.prototype.asr_hook=function (arg){
var event=arg[2];
var str=arg[3];
if(event==ebus.asr.ASR_RESULT_EV){

if(this.language=="zh-TW"){
this.delete_bpmf_timer();
this.soft_keyboard.bpmf_list_clear();}else if(this.language=="zh-CN"||this.language=="zh-HK"){
this.py_input_a="";
this.py_search_a="";
this.py_flag=false;}else if(this.is_ime_enable()){
if(this.ime.get_input_method()==IME_SOFTKBD){
switch(this.ime.get_mode()){
case "TRANSLATE":
case "ADJUST":
this.ime.cancel();
this.control_key.reset_grayout_henkan_top();
this._to_NO_TRANSLATE();
this.ime.decide_no_input();
this.do_cancel_composition();
break;
case "NO_TRANSLATE":
this.ime.decide_no_input();
this.do_cancel_composition();
break;}
}else if(this.ime.get_input_method()==IME_USBKBD){
this.ime.change_method_from_usbkbd();}
}else {
if(this.select_bar.is_active()){
this.select_bar.clear();
if(this.cursor==this.select_bar)
common_key.set_cursor(this,this.sft_keyboard);}
}
this.pointer.set_visible(true);
var asr_list;
if(ebus.asr&&ebus.asr.supported_multi_word){asr_list=this.extract_ast_list_by_csv(str);}else {asr_list=[str];}
if(this.asr_menu.is_open())
this.asr_menu_close_func();
this.asr_menu.set_select_box(this.select_bar);
this.asr_menu.open({
asr_list:asr_list
});
if(!this.last_cursor)
this.last_cursor=this.cursor;
common_key.set_cursor(this,this.asr_menu);}
};
SFT_Keyboard.prototype.keyhook=function (up_down,keysym){
console_log(">> SFT_Keyboard.prototype.keyhook");
if(this.key_wait)
return true;

var ret=false;
if(ebus.asr&&ebus.asr.supported&&(up_down==KEY_PRESS)&&
(keysym==TXK_MIC_TP||keysym==TXK_MIC_NRC||keysym==TXK_MIC_EMB)){
this.start_asr_input(keysym);
return true;}
if(ebus.kbd.supported&&typeof keysym=="object"){
if(up_down!=KEY_PRESS)
return true;
ret=this.usb_keyboard_hook(keysym);
if(ret)return true;}
if(keysym==TXK_SCROLL_UP||keysym==TXK_SCROLL_DOWN){
if(up_down!=KEY_PRESS)
return true;
this.scroll_handler(up_down,keysym);
if(ret)return true;}
if(this.cursor&&typeof this.cursor.key_hook=="function"){
ret=this.cursor.key_hook(up_down,keysym);
if(ret)return true;}else {
console.log("[ERROR] this.cursor.key_hook is not function.");
return false;}
if(up_down!=KEY_PRESS)
return true;
switch(this.cursor){
case this.mic_key:
ret=this.mickey_cursor_over_hook(keysym);break;
case this.close_key:
ret=this.closekey_cursor_over_hook(keysym);break;
case this.control_key:
ret=this.ctrlkey_cursor_over_hook(keysym);break;
case this.soft_keyboard:
ret=this.softkbd_cursor_over_hook(keysym);break;
case this.confirm:
ret=this.confirm_cursor_over_hook(keysym);break;
case this.setting_menu:
ret=this.setting_cursor_over_hook(keysym);break;
case this.round_menu:
ret=this.round_cursor_over_hook(keysym);break;
case this.select_bar:
ret=this.select_cursor_over_hook(keysym);break;
case this.ime:
ret=this.ime_cursor_over_hook(keysym);break;
case this.asr_menu:
ret=this.asr_cursor_over_hook(keysym);break;
default:
break;}
if(ret)return true;
ret=this.color_key_hook(up_down,keysym);
if(ret)return true;
switch(keysym){
case TXK_RETURN:
if(this.cancel_callback)this.cancel_callback();
return true;}

return false;};
SFT_Keyboard.prototype.color_key_hook=function (up_down,keysym){
var res=false;
if(this.round_menu.is_open()||this.confirm.is_open()
||this.asr_menu.is_open()){
return false;}
switch(keysym){
case COLOR_KEY[0].KEY_CODE:
res=this.control_key.do_action_by_color(COLOR_KEY[0].COLOR);
break;
case COLOR_KEY[1].KEY_CODE:
res=this.control_key.do_action_by_color(COLOR_KEY[1].COLOR);
break;
case COLOR_KEY[2].KEY_CODE:
res=this.control_key.do_action_by_color(COLOR_KEY[2].COLOR);
break;
case COLOR_KEY[3].KEY_CODE:
res=this.control_key.do_action_by_color(COLOR_KEY[3].COLOR);
break;}
return res;};
SFT_Keyboard.prototype.usb_key_hook=function (arguments){
if(this.key_wait)
return false;
var stage=arguments[0];
var event=arguments[2];


if(!this.ime.is_ime_supported()){
return this.usb_key_hook_global(arguments);}else {
var keysym=0;
if(event==ebus.kbd.KEYSYM_EV)
keysym=arguments[4];
if(event!=ebus.kbd.STRING_EV
&&this.cursor!=this.ime&&this.is_usbkbd_valid(keysym)){
if(this.asr_menu.is_open())
this.asr_menu_done_func();
if(this.cursor!=this.text_box_back
&&this.cursor!=this.setting_menu
&&this.cursor!=this.round_menu
&&this.cursor!=this.confirm){
this.last_cursor=this.cursor;}
if(pkg_usb_keyboard._convert_up_down_TXKB_to_TXK(arguments[3])==KEY_PRESS)
common_key.set_cursor(this,this.ime);}
var txk_code=pkg_usb_keyboard._convert_TXKB_to_TXK(null,keysym);
if(txk_code!=TXK_UP&&txk_code!=TXK_DOWN
&&txk_code!=TXK_LEFT&&txk_code!=TXK_RIGHT&&txk_code!=TXK_ENTER
&&txk_code!=COLOR_KEY[0].KEY_CODE&&txk_code!=COLOR_KEY[1].KEY_CODE
&&txk_code!=COLOR_KEY[2].KEY_CODE&&txk_code!=COLOR_KEY[3].KEY_CODE){
if(event==ebus.kbd.KEYSYM_EV
&&pkg_usb_keyboard._convert_up_down_TXKB_to_TXK(arguments[3])==KEY_DOWN){
this.control_key.set_grayout_all_colorkey();
this.control_key.restore_temp_grayout_all_arrowkey();
this.switch_spc_top({func:"spc"});
this.switch_done_top({func:"done"});
this.pointer.set_visible(false);}
}
return this.usb_key_hook_ime(arguments);}
};
SFT_Keyboard.prototype.is_usbkbd_valid=function (keysym){
var txk_code=pkg_usb_keyboard._convert_TXKB_to_TXK(null,keysym);
if(!pkg_usb_keyboard._is_TXK(txk_code))
return true;
return false;};
SFT_Keyboard.prototype.usb_key_hook_global=function (arguments){
var stage=arguments[0];
var device=arguments[1];
var event=arguments[2];
if(!this.usb_kbd){
require("pkg_usb_keyboard");
this.usb_kbd=new pkg_usb_keyboard.USB_Keyboard();}
var kbd=this;
var ret=this.usb_kbd.key_hook(arguments);
if(!ret)return true;
var up_down=ret.up_down;
ret.__event_type=arguments[2];
var convert_func=function (code){
switch(code){
case TXKB_BackSpace:
return TXK_RETURN;
default:
return code;}
};
var key=this.usb_kbd.get_key_or_char(
{key:ret,
convert_func:convert_func
});
if(typeof key=="string"){
switch(ret.code){
case 'ﻻ':ret.code='ل'+'ا';break;case 'ﻹ':ret.code='ل'+'إ';break;case 'ﻷ':ret.code='ل'+'أ';break;case 'ﻵ':ret.code='ل'+'آ';break;}
if(ret.up_down==KEY_PRESS&&this.language=="vi-00"){
if(this.telex_check(ret.code)){
ret.code="";}
if(ret.code==" "){this.add_text(this.last_input_text_global);
this.last_input_text_global="";}else {
this.last_input_text_global+=ret.code;
ret.code="";}
this.select_bar.show([this.last_input_text_global],true);
this.switch_done_top({func:"kakutei"});}
if(kbd.get_in_cursor()){
if((this.language!="zh-TW")&&(this.language!="zh-CN")&&(this.language!="zh-HK")&&(this.language!="vi-00")){
if(this.select_bar.is_active())
this.select_bar.clear();
this.move_cursor_to_done_lf();}
if(this.language=="vi-00"){
this.move_cursor_to_done_lf();}
return kbd.keyhook(up_down,ret);}
return false;}else {
switch(ret.code){
case TXKB_Delete:
case TXKB_BackSpace:
if(kbd.get_in_cursor()){
return kbd.keyhook(up_down,ret);}
break;}
}
return false;};
SFT_Keyboard.prototype.usb_key_hook_ime=function (arguments){
console_log(">> SFT_Keyboard.prototype.usb_key_hook_ime");
var stage=arguments[0];
var device=arguments[1];
var event=arguments[2];
var keysym=arguments[4];
if(!this.ime.usb_kbd){
require("pkg_usb_keyboard");
this.ime.usb_kbd=new pkg_usb_keyboard.USB_Keyboard();}
if(event==ebus.kbd.STRING_EV){
var stroke_mode=this.ime.get_5stroke_mode();
this.ime.prepare_sphone_input();
this.ime.change_mode("DIRECT_INPUT");
var ret=this.ime.usb_kbd.key_hook(arguments);
this.ime.set_5stroke_mode(false);
var text=ret.code;
for(var i=0;i<text.length;i++){
this.ime.addText(text.charAt(i));}
this.ime.set_5stroke_mode(stroke_mode);
this.ime.finish_sphone_input();
if(this.sphone_send_after_done)
this.done_action();
return true;}

var ret=this.ime.usb_kbd.key_hook(arguments);
if(!ret)return true;
var up_down=ret.up_down;

var convert_func=function (code){
switch(code){
case TXKB_BackSpace:
return TXK_RETURN;
default:
return code;}
};

var key=this.ime.usb_kbd.get_key_or_char(
{key:ret,
convert_func:convert_func
});

if(this.is_usbkbd_valid(keysym)){
if(up_down!=KEY_PRESS){
return false;}
var tmp_method=this.ime.get_input_method();
this.ime.set_pre_method(tmp_method);
this.ime.set_input_method(IME_USBKBD);
if(this.ime.get_pre_method()!=IME_USBKBD){
this.ime._change_method_to_usbkbd();
if(ret.type==ret.CONT
&&!pkg_usb_keyboard._is_CROSS_KEY(ret.code)){
if(key==TXK_RETURN)
return true;
return false;}
}
}

var res=false;
this.ime.set_txkb_keysym(arguments[4]);
if(typeof key=="string"){
if(up_down!=KEY_PRESS){
return true;}
this.ime.keyhook(up_down,ret);
key=pkg_usb_keyboard._convert_CHAR_to_TXK(null,key);
if(pkg_usb_keyboard._is_TXK(key))
res=this.keyhook(up_down,key);}else {
if(!pkg_usb_keyboard._is_TXK(ret.code)){
res=this.ime.keyhook(up_down,ret);}else {
res=this.keyhook(up_down,key);}
}

if(this.ime.is_ime_supported()){
this.ime.set_txkb_keysym(null);}
return res;};
SFT_Keyboard.prototype.scroll_handler=function (up_down,keysym){
var self=this;
var action_hook=function (arg){
self.round_menu_action_hook(arg);};
var get_setting_hook=function (){
return self.control_key.get_setting_info();};
var direction=0;
if(keysym==TXK_SCROLL_UP){
direction=-1;}else {
direction=1;}
if(this.select_bar.is_active()){
if(this.asr_menu.is_open()){
this.asr_menu.send_touchpad_z(direction);
return true;}
if(this.cursor!=this.ime)
return false;
this.select_bar.send_touchpad_z(direction);
return true;}
if(this.setting_menu.is_active()){
this.setting_menu.send_touchpad_z(direction);
return true;}
if(this.round_menu.is_open()){
if(this.cursor!=this.round_menu)
return false;
this.round_menu.send_touchpad_z(direction);
return true;}else {
return false;}

return false;};
SFT_Keyboard.prototype.set_sphone_send_after_done=function (bool){
if(this.sphone_send_after_done!=bool)
this.sphone_send_after_done=bool;};
SFT_Keyboard.prototype.start_asr_input=function (keysym){
var dic_type=ebus.asr.DIC_TYPE_DICTATION;
var device=keysym;ebus.asr.req_recog(dic_type,device,0);};
SFT_Keyboard.prototype.telex_check=function (code){
var word=this.last_input_text_global;
var caret=word.length;
var trg_text=word;
var current=0;
var tmp="";
var ret=false;
var QN={
unmarkedVowels:'AaĂăÂâEeÊêIiOoÔôƠơUuƯưYy',
markedVowels:[
'ÁáẮắẤấÉéẾếÍíÓóỐốỚớÚúỨứÝý','ÀàẰằẦầÈèỀềÌìÒòỒồỜờÙùỪừỲỳ','ẢảẲẳẨẩẺẻỂểỈỉỎỏỔổỞởỦủỬửỶỷ','ÃãẴẵẪẫẼẽỄễĨĩÕõỖỗỠỡŨũỮữỸỹ','ẠạẶặẬậẸẹỆệỊịỌọỘộỢợỤụỰựỴỵ'],
c_markedVowels:
'(Ă|ă|Â|â|Ê|ê|Ô|ô|'+'Á|á|Ắ|ắ|Ấ|ấ|É|é|Ế|ế|Í|í|Ó|ó|Ố|ố|Ớ|ớ|Ú|ú|Ứ|ứ|Ý|ý|'+'À|à|Ằ|ằ|Ầ|ầ|È|è|Ề|ề|Ì|ì|Ò|ò|Ồ|ồ|Ờ|ờ|Ù|ù|Ừ|ừ|Ỳ|ỳ|'+'Ả|ả|Ẳ|ẳ|Ẩ|ẩ|Ẻ|ẻ|Ể|ể|Ỉ|ỉ|Ỏ|ỏ|Ổ|ổ|Ở|ở|Ủ|ủ|Ử|ử|Ỷ|ỷ|'+'Ã|ã|Ẵ|ẵ|Ẫ|ẫ|Ẽ|ẽ|Ễ|ễ|Ĩ|ĩ|Õ|õ|Ỗ|ỗ|Ỡ|ỡ|Ũ|ũ|Ữ|ữ|Ỹ|ỹ|'+'Ạ|ạ|Ặ|ặ|Ậ|ậ|Ẹ|ẹ|Ệ|ệ|Ị|ị|Ọ|ọ|Ộ|ộ|Ợ|ợ|Ụ|ụ|Ự|ự|Ỵ|ỵ)',
initialsNotQ:'(b|c|ch|d|đ|g|gh|gi|h|k|kh|l|m|n|'+
'ng|ngh|nh|p|ph|r|s|t|th|tr|v|x|)',
initialQ:'(q)',
finals:'(c|ch|m|n|ng|nh|p|t)',
nucleusOpen:'(a|ă|â|e|ê|i|y|o|ô|ơ|u|ư|'+'ai|ay|ăy|oi|ơi|ôi|ui|ưi|'+'ao|au|âu|eo|êu|iu|ưu|'+'ia|ua|ưa|'+'uơi|ươi|'+'iêu|yêu|ươu|uôi|'+'oa|oe|uê|uy|uơ|'+'uya|'+'oai|oay|uây)',
nucleusClosed:'(a|ă|â|e|ê|i|o|ô|ơ|u|ư|'+'iê|yê|uơ|ươ|'+'oa|oă|uâ|oe|uê|uy|uơ|'+'uyê|'+'oo)',
nucleusOpenAfterQ:'(ua|ue|uê|ui|uy|uơ|'+'uya|'+'uai|uay|uây)',
nucleusClosedAfterQ:'(ua|uă|uâ|ue|uê|ui|uy|uơ|'+'uyê)'};
var p1=new RegExp('^'+QN.initialsNotQ+QN.nucleusOpen+'$');
var p2=new RegExp('^'+QN.initialsNotQ+QN.nucleusClosed+QN.finals+'$');
var p3=new RegExp('^'+QN.initialQ+QN.nucleusOpenAfterQ+'$');
var p4=new RegExp('^'+QN.initialQ+QN.nucleusClosedAfterQ+QN.finals+'$');
current=trg_text.lastIndexOf(" ",caret);
current++;
if(caret==trg_text.length){
word=trg_text.substring(current,caret);}else if(caret<trg_text.length){
word=trg_text.substring(current,caret);
return false;}
var w=word.toLowerCase();
var m_check=word.search(QN.c_markedVowels);
if(m_check!=-1){
switch(code.toLowerCase()){
case 'a':
case 'e':
case 'o':
case 'z':
var replaceWord="";
for(var i=0;i<w.length;i++){
if(i==m_check){
replaceWord+=this.telex_conv(word.substr(i,1),code);
if(word.substr(i,1)==replaceWord){
ret=false;}
}else {
replaceWord+=word.substr(i,1);}
}
word=replaceWord;
tmp=trg_text.substr(0,current);
tmp+=word;
tmp+=trg_text.substr(caret,trg_text.length);
this.last_input_text_global=tmp;
if(code.toLowerCase()=='z'){
return ret;}else {
return false;}
}
}else {
switch(code.toLowerCase()){
case 'a':
case 'e':
case 'o':
case 'z':
if(word.indexOf(code.toLowerCase())!=word.lastIndexOf(code.toLowerCase())){
return false;}
break;}
}
switch(w.substr(w.length-1,1)+code.toLowerCase()){
case 'dd':
case 'aa':
case 'ee':
case 'oo':
case 'aw':
case 'uw':
case 'ow':
case 'w':
word=word.substring(0,word.length-1)+this.telex_conv(word.substr(word.length-1,1),code);
tmp=trg_text.substr(0,current);
tmp+=word;
tmp+=trg_text.substr(caret,trg_text.length);
this.last_input_text_global=tmp;
return true;
default:
break;}
var array=w.match(p1)||w.match(p2)||
w.match(p3)||w.match(p4);

switch(code.toLowerCase()){
case 's':
case 'f':
case 'r':
case 'x':
case 'j':
case 'w':
if(!array){
break;}

tmp=trg_text.substr(0,current);
var w_array=new Array();
for(var i=1;i<array.length;i++){
w_array.push(word.substr(w.indexOf(array[i]),array[i].length));}
var initCluster=array[1];
var vowelCluster=w_array[1];
for(var i=0;i<w_array.length;i++){
if(i==1)if(w_array.length==3){if(vowelCluster.length==3){vowelCluster=vowelCluster.substr(0,2)+this.telex_conv(vowelCluster.substr(2,1),code);}else if(vowelCluster.length==2){vowelCluster=vowelCluster.substr(0,1)+this.telex_conv(vowelCluster.substr(1,1),code);}else {vowelCluster=this.telex_conv(vowelCluster,code);}
w_array[i]=vowelCluster;}else {if(vowelCluster.length==3){vowelCluster=vowelCluster.substr(0,1)+this.telex_conv(vowelCluster.substr(1,1),code)+vowelCluster.substr(2,1);}else if(vowelCluster.length==2){if(initCluster=='q'||initCluster=='g'){
vowelCluster=vowelCluster.substr(0,1)+this.telex_conv(vowelCluster.substr(1,1),code);}else {
vowelCluster=this.telex_conv(vowelCluster.substr(0,1),code)+vowelCluster.substr(1,1);}
}else {vowelCluster=this.telex_conv(vowelCluster,code);}
w_array[i]=vowelCluster;}
tmp+=w_array[i];}
this.last_input_text_global=tmp;
tmp+=trg_text.substr(caret,trg_text.length);
this.last_input_text_global+=trg_text.substr(caret,trg_text.length);
return true;}
return ret;};
SFT_Keyboard.prototype.telex_conv=function (c1,c2){
switch(c1+c2){
case "W":return "Ư";
case "w":return "ư";}
switch(c1+c2.toLowerCase()){
case "Âa":return "A";
case "âa":return "a";
case "Êe":return "E";
case "êe":return "e";
case "Ôo":return "O";
case "ôo":return "o";
case "Đd":return "D";
case "đd":return "d";
case "Aa":return "Â";
case "aa":return "â";
case "Ee":return "Ê";
case "ee":return "ê";
case "Oo":return "Ô";
case "oo":return "ô";
case "Dd":return "Đ";
case "dd":return "đ";
case "Aw":return "Ă";
case "aw":return "ă";
case "Ow":return "Ơ";
case "ow":return "ơ";
case "Uw":return "Ư";
case "uw":return "ư";
case "Af":return "À";
case "af":return "à";
case "Ăf":return "Ằ";
case "ăf":return "ằ";
case "Âf":return "Ầ";
case "âf":return "ầ";
case "Ef":return "È";
case "ef":return "è";
case "Êf":return "Ề";
case "êf":return "ề";
case "If":return "Ì";
case "if":return "ì";
case "Of":return "Ò";
case "of":return "ò";
case "Ơf":return "Ờ";
case "ơf":return "ờ";
case "Ôf":return "Ồ";
case "ôf":return "ồ";
case "Uf":return "Ù";
case "uf":return "ù";
case "Ưf":return "Ừ";
case "ưf":return "ừ";
case "Yf":return "Ỳ";
case "yf":return "ỳ";
case "As":return "Á";
case "as":return "á";
case "Ăs":return "Ắ";
case "ăs":return "ắ";
case "Âs":return "Ấ";
case "âs":return "ấ";
case "Es":return "É";
case "es":return "é";
case "Ês":return "Ế";
case "ês":return "ế";
case "Is":return "Í";
case "is":return "í";
case "Os":return "Ó";
case "os":return "ó";
case "Ôs":return "Ố";
case "ôs":return "ố";
case "Ơs":return "Ớ";
case "ơs":return "ớ";
case "Us":return "Ú";
case "us":return "ú";
case "Ưs":return "Ứ";
case "ưs":return "ứ";
case "Ys":return "Ý";
case "ys":return "ý";
case "Ar":return "Ả";
case "ar":return "ả";
case "Ăr":return "Ẳ";
case "ăr":return "ẳ";
case "Âr":return "Ẩ";
case "âr":return "ẩ";
case "Er":return "Ẻ";
case "er":return "ẻ";
case "Êr":return "Ể";
case "êr":return "ể";
case "Ir":return "Ỉ";
case "ir":return "ỉ";
case "Or":return "Ỏ";
case "or":return "ỏ";
case "Ôr":return "Ổ";
case "ôr":return "ổ";
case "Ơr":return "Ở";
case "ơr":return "ở";
case "Ur":return "Ủ";
case "ur":return "ủ";
case "Ưr":return "Ử";
case "ưr":return "ử";
case "Yr":return "Ỷ";
case "yr":return "ỷ";
case "Ax":return "Ã";
case "ax":return "ã";
case "Ăx":return "Ẵ";
case "ăx":return "ẵ";
case "Âx":return "Ẫ";
case "âx":return "ẫ";
case "Ex":return "Ẽ";
case "ex":return "ẽ";
case "Êx":return "Ễ";
case "êx":return "ễ";
case "Ix":return "Ĩ";
case "ix":return "ĩ";
case "Ox":return "Õ";
case "ox":return "õ";
case "Ôx":return "Ỗ";
case "ôx":return "ỗ";
case "Ơx":return "Ỡ";
case "ơx":return "ỡ";
case "Ux":return "Ũ";
case "ux":return "ũ";
case "Ưx":return "Ữ";
case "ưx":return "ữ";
case "Yx":return "Ỹ";
case "yx":return "ỹ";
case "Aj":return "Ạ";
case "aj":return "ạ";
case "Ăj":return "Ặ";
case "ăj":return "ặ";
case "Âj":return "Ậ";
case "âj":return "ậ";
case "Ej":return "Ẹ";
case "ej":return "ẹ";
case "Êj":return "Ệ";
case "êj":return "ệ";
case "Ij":return "Ị";
case "ij":return "ị";
case "Oj":return "Ọ";
case "oj":return "ọ";
case "Ôj":return "Ộ";
case "ôj":return "ộ";
case "Ơj":return "Ợ";
case "ơj":return "ợ";
case "Uj":return "Ụ";
case "uj":return "ụ";
case "Ưj":return "Ự";
case "ưj":return "ự";
case "Yj":return "Ỵ";
case "yj":return "ỵ";
case "Àz":return "A";
case "àz":return "a";
case "Ằz":return "Ă";
case "ằz":return "ă";
case "Ầz":return "Â";
case "ầz":return "â";
case "Èz":return "E";
case "èz":return "e";
case "Ềz":return "Ê";
case "ềz":return "ê";
case "Ìz":return "I";
case "ìz":return "i";
case "Òz":return "O";
case "òz":return "o";
case "Ờz":return "Ơ";
case "ờz":return "ơ";
case "Ồz":return "Ô";
case "ồz":return "ô";
case "Ùz":return "U";
case "ùz":return "u";
case "Ừz":return "Ư";
case "ừz":return "ư";
case "Ỳz":return "Y";
case "ỳz":return "y";
case "Áz":return "A";
case "áz":return "a";
case "Ắz":return "Ă";
case "ắz":return "ă";
case "Ấz":return "Â";
case "ấz":return "â";
case "Éz":return "E";
case "éz":return "e";
case "Ếz":return "Ê";
case "ếz":return "ê";
case "Íz":return "I";
case "íz":return "i";
case "Óz":return "O";
case "óz":return "o";
case "Ốz":return "Ô";
case "ốz":return "ô";
case "Ớz":return "Ơ";
case "ớz":return "ơ";
case "Úz":return "U";
case "úz":return "u";
case "Ứz":return "Ư";
case "ứz":return "ư";
case "Ýz":return "Y";
case "ýz":return "y";
case "Ảz":return "A";
case "ảz":return "a";
case "Ẳz":return "Ă";
case "ẳz":return "ă";
case "Ẩz":return "Â";
case "ẩz":return "â";
case "Ẻz":return "E";
case "ẻz":return "e";
case "Ểz":return "Ê";
case "ểz":return "ê";
case "Ỉz":return "I";
case "ỉz":return "i";
case "Ỏz":return "O";
case "ỏz":return "o";
case "Ổz":return "Ô";
case "ổz":return "ô";
case "Ởz":return "Ơ";
case "ởz":return "ơ";
case "Ủz":return "U";
case "ủz":return "u";
case "Ửz":return "Ư";
case "ửz":return "ư";
case "Ỷz":return "Y";
case "ỷz":return "y";
case "Ãz":return "A";
case "ãz":return "a";
case "Ẵz":return "Ă";
case "ẵz":return "ă";
case "Ẫz":return "Â";
case "ẫz":return "â";
case "Ẽz":return "E";
case "ẽz":return "e";
case "Ễz":return "Ê";
case "ễz":return "ê";
case "Ĩz":return "I";
case "ĩz":return "i";
case "Õz":return "O";
case "õz":return "o";
case "Ỗz":return "Ô";
case "ỗz":return "ô";
case "Ỡz":return "Ơ";
case "ỡz":return "ơ";
case "Ũz":return "U";
case "ũz":return "u";
case "Ữz":return "Ư";
case "ữz":return "ư";
case "Ỹz":return "Y";
case "ỹz":return "y";
case "Ạz":return "A";
case "ạz":return "a";
case "Ặz":return "Ă";
case "ặz":return "ă";
case "Ậz":return "Â";
case "ậz":return "â";
case "Ẹz":return "E";
case "ẹz":return "e";
case "Ệz":return "Ê";
case "ệz":return "ê";
case "Ịz":return "I";
case "ịz":return "i";
case "Ọz":return "O";
case "ọz":return "o";
case "Ộz":return "Ô";
case "ộz":return "ô";
case "Ợz":return "Ơ";
case "ợz":return "ơ";
case "Ụz":return "U";
case "ụz":return "u";
case "Ựz":return "Ư";
case "ựz":return "ư";
case "Ỵz":return "Y";
case "ỵz":return "y";
default:return c1;}
};
SFT_Keyboard.prototype.set_move_mode=function (move_mode){
if(move_mode!="free"&&move_mode!="key")
return;
if(this.move_mode==move_mode)
return;
this.move_mode=move_mode;
if(this.move_mode=="free"){this.pointer.set_force_visible(false);
switch(this.cursor){
case this.ime:
if(this.ime.get_input_method()==IME_USBKBD){this.ime.change_method_from_usbkbd();
this.do_cancel_composition();}
break;
case this.text_box_back:
this.text_box_back.release_focus();
break;}
}else {this.pointer.set_force_visible(true);
this.select_bar.release_arrows_focus();
this.setting_menu.reset_change_lang_focus();
switch(this.cursor){
case this.soft_keyboard:
case this.control_key:
case this.mic_key:
case this.close_key:
if(!this.round_menu.is_open()&&this.select_bar.is_active()){
if(this.is_ime_enable()){
this.select_bar.in_current_cursor();
common_key.set_cursor(this,this.ime);
break;}
if(this.language=="zh-TW"&&this.select_bar.get_rest_mouseover())
break;
if(((this.language=="zh-CN")||(this.language=="zh-HK"))&&this.py_flag){
if(this.soft_keyboard.is_zhcn_kbd_mode()){
delete_timer(this.zhcn_timer);
if(this.cursor==this.soft_keyboard){
common_key.set_cursor(this,null);
this.soft_keyboard.set_position(this.soft_keyboard.ZHCN_L_ARROW_POS);
common_key.set_cursor(this,this.soft_keyboard);}
this.select_bar.release_focus();
break;}
common_key.set_cursor(this,null);
common_key.set_cursor(this,this.soft_keyboard);
this.select_bar.release_focus();
break;}
common_key.set_cursor(this,this.select_bar);}else {
if(this.soft_keyboard.is_zhcn_kbd_mode()){
if(this.cursor==this.soft_keyboard){
common_key.set_cursor(this,null);
this.soft_keyboard.set_position(this.soft_keyboard.ZHCN_L_ARROW_POS);
common_key.set_cursor(this,this.soft_keyboard);}
this.select_bar.release_focus();
break;}
}
break;}
}
};
SFT_Keyboard.prototype.get_move_mode=function (){
return this.move_mode;};
SFT_Keyboard.prototype.reset_select_bar=function (){
if(this.select_bar.is_active()){
if(this.is_ime_enable()){
if(this.ime.get_mode()=="TRANSLATE"
||this.ime.get_mode()=="ADJUST"){
this.ime.cancel();
this.control_key.reset_grayout_henkan_top();
this._to_NO_TRANSLATE();}
}
if((this.language=="zh-CN")||(this.language=="zh-HK")){
this.py_input_a="";
this.py_search_a="";}else if(this.language=="zh-TW"){
this.soft_keyboard.bpmf_list_clear();}
this.select_bar.release_arrows_focus();
this.select_bar.clear();}
};
SFT_Keyboard.prototype.gen_stencil_table=function (){
if(!this.stencil_man)return;
var table=[];
var bg_skin=SKIN.bg_frame;
var c_point=this.starting_point;
c_point[1]-=Math.floor(this.TEXT_BOX_HEIGHT/2+skin_func.calc_rate(bg_skin.frame_size));
var cont_list=[
{name:"asr_menu",obj:this.asr_menu,active_check:true,through_check:true},
{name:"confirm",obj:this.confirm,active_check:true,through_check:false},
{name:"round_menu",obj:this.round_menu,active_check:true,through_check:true},
{name:"setting_menu",obj:this.setting_menu,active_check:true,through_check:false},
{name:"select_bar",obj:this.select_bar,active_check:false,through_check:false},
{name:"sft_keyboard",obj:this.soft_keyboard,active_check:false,through_check:false},
{name:"control_key",obj:this.control_key,active_check:false,through_check:false},
{name:"mic_key",obj:this.mic_key,active_check:false,through_check:false},
{name:"close_key",obj:this.close_key,active_check:false,through_check:false},
{name:"under_mask",obj:this.under_mask,active_check:false,through_check:false}
];
for(var i=0;i<cont_list.length;i++){
table.push({});
table[i].name=cont_list[i].name;
table[i].obj=cont_list[i].obj;
table[i].active_check=cont_list[i].active_check;
table[i].through_check=cont_list[i].through_check;
var obj=table[i].obj;
var cont_c_point=c_point.slice();
var cont_tran=obj.get_translate();
for(var k=0;k<cont_c_point.length;k++){
cont_c_point[k]+=cont_tran[k];}
table[i].c_point=cont_c_point.slice();
var lt_point={x:null,y:null};
var rb_point={x:null,y:null};
if(obj.get_width&&typeof obj.get_width=="function"){
var cont_w=obj.get_width();
lt_point.x=cont_c_point[0]-cont_w/2;
rb_point.x=cont_c_point[0]+cont_w/2;}
if(obj.get_height&&typeof obj.get_height=="function"){
var cont_h=obj.get_height();
lt_point.y=cont_c_point[1]+cont_h/2;
rb_point.y=cont_c_point[1]-cont_h/2;}
table[i].lt_point=lt_point;
table[i].rb_point=rb_point;
table[i].active=null;
if(table[i].active_check){
if(obj.is_active&&typeof obj.is_active=="function"){
table[i].active=obj.is_active();}
else if(obj.is_open&&typeof obj.is_open=="function"){
table[i].active=obj.is_open();}
}
var stencil_list=[];
if(obj.gen_stencil_list&&typeof obj.gen_stencil_list=="function"){
stencil_list=obj.gen_stencil_list(cont_c_point);}
table[i].stencil_list=stencil_list;}
this.stencil_man.set_table(table);};
SFT_Keyboard.prototype.update_stencil_table=function (trg_name){
var table=this.stencil_man.get_table();
for(var i=0;i<table.length;i++){
if(table[i].name!=trg_name)
continue;
var obj=table[i].obj;
var c_point=table[i].c_point;
var stencil_list=[];
if(obj.gen_stencil_list&&typeof obj.gen_stencil_list=="function"){
stencil_list=obj.gen_stencil_list(c_point);}
table[i].stencil_list=stencil_list;
table[i].active=false;
if(table[i].active_check){
if(obj.is_active&&typeof obj.is_active=="function"){
table[i].active=obj.is_active();}
else if(obj.is_open&&typeof obj.is_open=="function"){
table[i].active=obj.is_open();}
}
this.stencil_man.set_table(table);}
};
SFT_Keyboard.prototype.force_pointer_visible=function (bool){
this.pointer.set_force_visible(bool);};
SFT_Keyboard.prototype.pointer_control_hook=function(x,y){
this.pointer.set_pointer_position(x,y);};
SFT_Keyboard.prototype.enter_focus=function (obj){
console_log(">> SFT_Keyboard.prototype.enter_focus()");
common_key.set_cursor(this,this.soft_keyboard);
if(ebus.asr&&ebus.asr.supported){
this.last_asr_listener_mode=ebus.asr.get_listener();
ebus.asr.set_listener(1);}
this.pointer.set_visible(true);
this.enable_textarea_cursor();
this.switch_unconf_bg();
this.start_key_wait();
force_redraw();};
SFT_Keyboard.prototype.leave_focus=function (obj){
console_log(">> SFT_Keyboard.prototype.leave_focus()");
this.reset_keyboard_cursor_state();
this.do_cancel_composition();
this.hide_unconf_bg();
this.disable_textarea_cursor();
this.pointer.set_visible(false);
if(ebus.asr&&ebus.asr.supported){
ebus.asr.set_listener(this.last_asr_listener_mode);}
};
SFT_Keyboard.prototype.reset_keyboard_cursor_state=function(){
if(this.round_menu.is_open()||this.setting_menu.is_active()
||this.confirm.is_open()){
if(this.last_cursor){
common_key.set_cursor(this,this.last_cursor);
this.last_cursor=null;};
this.pointer.set_visible(true);}
if(this.asr_menu.is_open())
this.asr_menu_close_func();
if(this.language=="zh-TW"){
this.delete_bpmf_timer();
this.soft_keyboard.bpmf_list_clear();}else if(this.language=="zh-CN"||this.language=="zh-HK"){
this.py_input_a="";
this.py_search_a="";
this.py_flag=false;}else if(this.is_ime_enable()){
if(this.ime.get_input_method()==IME_SOFTKBD){
switch(this.ime.get_mode()){
case "TRANSLATE":
case "ADJUST":
this.ime.cancel();
this.control_key.reset_grayout_henkan_top();
this._to_NO_TRANSLATE();
this.ime.decide_no_input();
this.do_cancel_composition();
break;
case "NO_TRANSLATE":
this.ime.decide_no_input();
this.do_cancel_composition();
break;}
}else if(this.ime.get_input_method()==IME_USBKBD){
this.ime.change_method_from_usbkbd();}
}
if(this.select_bar.is_active()){
this.select_bar.clear();}
if(this.cursor&&this.cursor.leave_focus&&typeof this.cursor.leave_focus=="function"){
this.cursor.leave_focus();}
this.cursor=null;
if(this.soft_keyboard.is_zhcn_kbd_mode()){
delete_timer(this.zhcn_timer);
var zhcn_trg_pos=this.soft_keyboard.ZHCN_L_ARROW_POS;
this.soft_keyboard.set_position(zhcn_trg_pos);}else {
this.soft_keyboard.set_init_cursor(this.language);}
};
SFT_Keyboard.prototype.is_ime_enable=function (){

if(this.language!="ja-JP")
return false;
return true;};
SFT_Keyboard.prototype.handle_ime_mode_change_event=function (mode){
console_log(">> SFT_Keyboard.prototype.handle_ime_mode_change_event: mode ="+mode);
switch(mode){
case "NO_INPUT":
if(this.last_cursor){
common_key.set_cursor(this,this.last_cursor);
this.last_cursor=null;}
this._to_NO_INPUT();
break;
case "NO_TRANSLATE":
break;
case "TRANSLATE":
break;
case "ADJUST":
break;
case "SELECT_CHAR_TYPE":
break;
case "DIRECT_INPUT":

break;}
};
SFT_Keyboard.prototype._to_NO_TRANSLATE=function (){
console_log(">> SFT_Keyboard.prototype._ime_to_NO_TRANSLATE");
if(this.ime.is_ime_supported()){
this.ime.change_mode("NO_TRANSLATE");
this.ime.follow_pos();
this.switch_spc_top({func:"henkan"});
this.switch_done_top({func:"kakutei"});
this.control_key.store_temp_grayout_all_arrowkey();
this.show_text_NO_TRANSLATE();}
};
SFT_Keyboard.prototype._to_NO_INPUT=function (){
if(this.ime.is_ime_supported()){
this.kakutei_action();};};
SFT_SoftKeyboard.prototype.bpmf_init=function (){
this.bpmf_list=new Array();};
SFT_SoftKeyboard.prototype.is_bpmf_tone_zero=function (text){
var tmark=pkg_bpmf_data.tone.indexOf(text);
if(tmark!=0)
return false;
return true;};
SFT_SoftKeyboard.prototype.is_bpmf_tone=function (text){
var tmark=pkg_bpmf_data.tone.indexOf(text);
if(tmark>-1)
return true;
return false;};
SFT_SoftKeyboard.prototype.get_bpmf_list=function (){
return this.bpmf_list;};
SFT_SoftKeyboard.prototype.concat_bpmf_list=function (text){
if(text)
this.bpmf_list=this.bpmf_list.concat(text);};
SFT_SoftKeyboard.prototype.delete_bpmf_list=function (t){
if(this.bpmf_list.length>0)
this.bpmf_list.splice(this.bpmf_list.length-1,1);};
SFT_SoftKeyboard.prototype.bpmf_list_clear=function (text){
this.bpmf_list=[];};
SFT_SoftKeyboard.prototype.is_bpmf_char=function (text){
if(pkg_bpmf_data.punct.indexOf(text)>=0)
return false;
return true;};
SFT_SoftKeyboard.prototype.is_bpmf_complete=function (text){
if(this.bpmf_list.length>0)
return false;
return true;};
SFT_SoftKeyboard.prototype.get_kanzi_candidate=function (){
var kanzi_candidate=[];
if(this.bpmf_list.length>0){
var seq=this.xbpmf(this.bpmf_list);
kanzi_candidate=this.cbpmf(seq);}
return kanzi_candidate;};
SFT_SoftKeyboard.prototype.xbpmf=function (str){

var key="";
for(var i=0;i<str.length;i++){
key+=pkg_bpmf_data.bpmf[str[i]];}
return key;};
SFT_SoftKeyboard.prototype.cbpmf=function(key){

var pattern=new RegExp("\\n"+key+" \.","g");
var list=new Array();
var pos=key.length+2;
var ars=pkg_bpmf_data.cin.match(pattern);
if(ars==null){
return list;}

for(var i=0;i<ars.length;i++)
list[i]=ars[i].charAt(pos);
return list;};
SFT_SoftKeyboard.prototype.asc2bopomo=function(key_in){
var asc2bopomo_tables={
",":"ㄝ","-":"ㄦ",".":"ㄡ","/":"ㄥ","0":"ㄢ",
"1":"ㄅ","2":"ㄉ","3":"ˇ","4":"ˋ","5":"ㄓ",
"6":"ˊ","7":"˙","8":"ㄚ","9":"ㄞ",";":"ㄤ",
"a":"ㄇ","b":"ㄖ","c":"ㄏ","d":"ㄎ","e":"ㄍ",
"f":"ㄑ","g":"ㄕ","h":"ㄘ","i":"ㄛ","j":"ㄨ",
"k":"ㄜ","l":"ㄠ","m":"ㄩ","n":"ㄙ","o":"ㄟ",
"p":"ㄣ","q":"ㄆ","r":"ㄐ","s":"ㄋ","t":"ㄔ",
"u":"一","v":"ㄒ","w":"ㄊ","x":"ㄌ","y":"ㄗ",
"z":"ㄈ"
};
return asc2bopomo_tables[key_in];};
SFT_Keyboard.prototype.delete_bpmf_timer=function (){
delete_timer(this);};
SFT_Keyboard.prototype.backspace_tra_ch=function (){
if(!this.soft_keyboard.is_bpmf_complete()){
this.soft_keyboard.delete_bpmf_list();
var list=this.soft_keyboard.get_bpmf_list();
if(list.length>0){
this.select_bar.show(list,true);}else{
this.select_bar.clear();}
}else{
this.backspace_text();}
force_redraw();};
SFT_Keyboard.prototype.process_tra_ch=function (text){
if(this.soft_keyboard.is_bpmf_char(text)){
this.delete_bpmf_timer();
if(!this.soft_keyboard.is_bpmf_tone_zero(text)){
if(this.cursor==this.select_bar)common_key.set_cursor(this,this.soft_keyboard);
this.soft_keyboard.concat_bpmf_list(text);
var list=this.soft_keyboard.get_bpmf_list();
this.select_bar.show(list,true);}
if(this.soft_keyboard.is_bpmf_tone(text)){
var kanzi_candidate=this.soft_keyboard.get_kanzi_candidate();
if(kanzi_candidate.length>0){
this.select_bar.clear();
this.select_bar.show(kanzi_candidate);
common_key.set_cursor(this,null);
common_key.set_cursor(this,this.select_bar);
this.soft_keyboard.bpmf_list_clear();}else{
this.soft_keyboard.bpmf_list_clear();
this.select_bar.show("無此中文字!",true);
append_timer(this,1000,function(obj,count){
if(count>1){
obj.select_bar.clear();
delete_timer(obj);
force_redraw();}
});}
}
}else {
this.add_text(text);}
};
SFT_Keyboard.prototype.add_text=function(text){
var self=this;
if(!text&&typeof text!="string"&&text.length==0)return;
if(text.length==1)
self.do_confirm_composition(text);
else
for(var i=0;i<text.length;i++)
self.do_confirm_composition(text[i]);};
SFT_Keyboard.prototype.add_text_ja_JP=function(text){
this.text_box.add_text(text);};
SFT_Keyboard.prototype.add_text_ja_JP_ime=function(text){
this.do_confirm_composition(text);};
SFT_Keyboard.prototype.backspace_text=function(){
this.do_enter_backspace();};
SFT_Keyboard.prototype.backspace_text_ja_JP=function(){
this.text_box.backspace_text();
this.show_text_NO_TRANSLATE();};
SFT_Keyboard.prototype.backspace_text_ja_JP_ime=function(){
this.ime.backspace_text();
this.do_enter_backspace();};
SFT_Keyboard.prototype.show_text_NO_TRANSLATE=function(){
var text=this.text_box.get_text();
var cur_pos=this.text_box.get_cursor_pos();
this.do_set_composition([text,{h:cur_pos,t:cur_pos},1,{h:0,t:text.length}]);};
SFT_Keyboard.prototype.show_text_usb_NO_TRANSLATE=function(text,cur_pos){
this.do_set_composition([text,{h:cur_pos,t:cur_pos},1,{h:0,t:text.length}]);};
SFT_Keyboard.prototype.move_caret_NO_TRANSLATE=function(){
var text=this.text_box.get_text();
var cur_pos=0;
if(this.text_box.is_end_cursor_mode())
cur_pos=this.text_box.get_cursor_pos();
else
cur_pos=this.text_box.get_cursor_pos()-1;
this.do_set_composition([text,{h:cur_pos,t:cur_pos},1,{h:0,t:text.length}]);};
SFT_Keyboard.prototype.cancel_ime_to_NO_TRANSLATE=function(){
this.show_text_NO_TRANSLATE();};
SFT_Keyboard.prototype.show_convert_TRANSLATE=function(){
this.do_set_composition(this.ime.get_convert_info());};
SFT_Keyboard.prototype.byte2strLen=function (byteLen,str){
var len=0;
var tbl=[0,1,1,1,2,3,2,3,4,3];
for(var i=0;i<str.length;i++){
len+=tbl[encodeURIComponent(str.charAt(i)).length];
if(len==byteLen)
break;}
return (i+1);};
SFT_Keyboard.prototype.extract_ast_list_by_csv=function(str){
var asr_list=[];
if(typeof str!="string")return asr_list;
var strLen=str.length;
var start=0;
var end;
var byteLen;
var len;
var type=[];
var i=0;
end=str.indexOf(",",start);
if(end<0)return asr_list;
byteLen=parseInt(str.substring(start,end));
if(isNaN(byteLen))return asr_list;
start=end+1;
len=this.byte2strLen(byteLen,str.substring(start));
start+=len;
while(start<strLen){
end=str.indexOf(",",start);
if(end<0)break;
type[i]=parseInt(str.substring(start,end));
if(isNaN(type[i]))break;
start=end+1;
end=str.indexOf(",",start);
if(end<0)break;
byteLen=parseInt(str.substring(start,end));
if(isNaN(byteLen))break;
start=end+1;
len=this.byte2strLen(byteLen,str.substring(start));
start=end+1;
if(type[i]==9){
asr_list.push(str.substr(start,len));}
start+=len;
i++;}
return asr_list;};
SFT_Keyboard.prototype.do_set_asr_text=function(text){
var cur_pos=text.length;
this.do_set_composition([text,{h:cur_pos,t:cur_pos},2,{h:0,t:cur_pos},{h:cur_pos,t:cur_pos}]);};
SFT_Keyboard.prototype.do_cancel_asr_text=function(text){
this.do_cancel_composition();};
SFT_Keyboard.prototype.add_asr_text=function(text){
this.add_text(text);};
SFT_Keyboard.prototype.switch_unconf_bg=function(){
if(this.is_ime_enable())
this.show_unconf_bg();
else
this.hide_unconf_bg();};
SFT_Keyboard.prototype.do_confirm_composition=function(text){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.do_confirm_composition
&&typeof this.trg_textarea.do_confirm_composition=="function")
this.trg_textarea.do_confirm_composition(text);};
SFT_Keyboard.prototype.do_set_composition=function(convert_info){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.do_set_composition
&&typeof this.trg_textarea.do_set_composition=="function")
this.trg_textarea.do_set_composition(convert_info);};
SFT_Keyboard.prototype.do_cancel_composition=function(){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.do_cancel_composition
&&typeof this.trg_textarea.do_cancel_composition=="function")
this.trg_textarea.do_cancel_composition();};
SFT_Keyboard.prototype.do_move_caret=function(key){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.do_move_caret
&&typeof this.trg_textarea.do_move_caret=="function")
this.trg_textarea.do_move_caret(key);};
SFT_Keyboard.prototype.do_enter_backspace=function(){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.do_move_caret
&&typeof this.trg_textarea.do_move_caret=="function")
this.trg_textarea.do_enter_backspace();};
SFT_Keyboard.prototype.do_enter_linefeed=function(){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.do_enter_linefeed
&&typeof this.trg_textarea.do_enter_linefeed=="function")
this.trg_textarea.do_enter_linefeed();};
SFT_Keyboard.prototype.do_enter_allclear=function(){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.do_enter_allclear
&&typeof this.trg_textarea.do_enter_allclear=="function")
this.trg_textarea.do_enter_allclear();};
SFT_Keyboard.prototype.do_set_from_left_mode=function(){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.do_set_from_left_mode
&&typeof this.trg_textarea.do_set_from_left_mode=="function")
this.trg_textarea.do_set_from_left_mode();};
SFT_Keyboard.prototype.do_set_from_right_mode=function(){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.do_set_from_right_mode
&&typeof this.trg_textarea.do_set_from_right_mode=="function")
this.trg_textarea.do_set_from_right_mode();};
SFT_Keyboard.prototype.enable_textarea_cursor=function(){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.enable_cursor
&&typeof this.trg_textarea.enable_cursor=="function")
this.trg_textarea.enable_cursor();};
SFT_Keyboard.prototype.disable_textarea_cursor=function(){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.disable_cursor
&&typeof this.trg_textarea.disable_cursor=="function")
this.trg_textarea.disable_cursor();};
SFT_Keyboard.prototype.show_unconf_bg=function(){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.show_unconf_bg
&&typeof this.trg_textarea.show_unconf_bg=="function")
this.trg_textarea.show_unconf_bg();};
SFT_Keyboard.prototype.hide_unconf_bg=function(){
if(!this.is_exist_textarea())return;
if(this.trg_textarea.hide_unconf_bg
&&typeof this.trg_textarea.hide_unconf_bg=="function")
this.trg_textarea.hide_unconf_bg();};
SFT_Keyboard.prototype.set_toggle_force_caret_tail_cb=function(func){
if(!this.is_exist_textarea())return;
if(!this.trg_textarea.set_toggle_force_caret_tail_cb
||typeof this.trg_textarea.set_toggle_force_caret_tail_cb!="function")
return;
if(func&&typeof func=="function")
this.trg_textarea.set_toggle_force_caret_tail_cb(func);};
SFT_Keyboard.prototype.is_textarea_singleline=function(){
if(!this.is_exist_textarea())return false;
if(this.trg_textarea.is_singleline
&&typeof this.trg_textarea.is_singleline=="function")
return this.trg_textarea.is_singleline();
return false;};
SFT_Keyboard.prototype.is_exist_textarea=function(){
if(!this.trg_textarea)
return false;
return true;};
add_package_load_path("pkg_romkan",kbd_path+"pkg_keyboard_romkan.js");
const MASTER_POSITION_X=0;
const MASTER_POSITION_Y=0;
const MASTER_POSITION_Z=0;
const IME_5STROKE=0;
const IME_SOFTKBD=1;
const IME_USBKBD=2;
const ROMA_INPUT=0;
const KANA_INPUT=1;
const HIRA_TYPE=0;
const KATA_TYPE=1;
const EISU_TYPE=2;
const NUM_TYPE=3;
const FORECAST_ON=0;
const FORECAST_OFF=1;
const TXKB_SC_Space=44;
const TXKB_SC_Henkan=138;
const TXKB_SC_Muhenkan=139;
function IME_ColorKeyGuide(init){
this.superClass=container;
this.superClass(init);};
IME_ColorKeyGuide.prototype=new container({});
IME_ColorKeyGuide.prototype.create_obj=function (){
var base=new gbox(
{
width:248,
height:92,
color:[187,206,238,255],
});
var base_shadow=new gbox(
{
translate:[10,-10,0],
width:248,
height:92,
color:[0,0,0,255],
});
var button_top=new gbox(
{
translate:[-248/2+40/2+10,92/2-40/2-2-1,0],
width:40,
height:40,
round_enable:true,
round_width:2,
round_height:2,
round_level:2,
color:[85,255,170,255],
});
var button_bottom=new gbox(
{
translate:[-248/2+40/2+10,-92/2+40/2+4-1,0],
width:40,
height:40,
round_enable:true,
round_width:2,
round_height:2,
round_level:2,
color:[255,255,85,255],
});
this.button_text_top=new gtext(
{
translate:[-248/2+40/2+10,92/2-40/2-2+1,0],
width:40,
text:"緑",
font_size:40,
color:[0,0,0,255],
align:CENTER,
});
this.text_top=new gtext(
{
translate:[30,92/2-40/2-2+1,0],
width:190,
text:"文字切換",
font_size:40,
color:[0,0,0,255],
align:LEFT,
});
this.button_text_bottom=new gtext(
{
translate:[-248/2+40/2+10,-92/2+40/2+4+1,0],
width:40,
text:"黄",
font_size:40,
color:[0,0,0,255],
align:CENTER,
});
this.text_bottom=new gtext(
{
translate:[30,-92/2+40/2+4+1,0],
width:190,
text:"キャンセル",
font_size:40,
color:[0,0,0,255],
align:LEFT,
});
this.components=[
base_shadow,
base,
button_top,
this.button_text_top,
this.text_top,
button_bottom,
this.button_text_bottom,
this.text_bottom,
];};
IME_ColorKeyGuide.prototype.init=function (mode){
this.change_mode("NO_INPUT");};
IME_ColorKeyGuide.prototype.set_text_translate=function (is_forecast){
setf_text(this.text_top,"変換");};
IME_ColorKeyGuide.prototype.set_text_cancel=function (){
setf_text(this.text_bottom,"キャンセル");};
IME_ColorKeyGuide.prototype.change_mode=function (mode){
this.mode=mode;

switch(mode){
case "NO_INPUT":
setf_text(this.text_top,"文字切換");
setf_text(this.text_bottom,"文字クリア");
break;
case "NO_TRANSLATE":
setf_text(this.text_top,"");
setf_text(this.text_bottom,"文字クリア");
break;
case "TRANSLATE":
setf_text(this.text_top,"");
setf_text(this.text_bottom,"キャンセル");
break;
case "SELECT_CHAR_TYPE":
setf_text(this.text_top,"文字切換");
setf_text(this.text_bottom,"キャンセル");
break;}
}
IME_ColorKeyGuide.prototype.free=function (){
setf_text(this.button_text_top,"");
setf_text(this.button_text_bottom,"");
setf_text(this.text_top,"");
setf_text(this.text_bottom,"");
return;};
IME_ColorKeyGuide.prototype.revive=function (){
setf_text(this.button_text_top,"緑");
setf_text(this.button_text_bottom,"黄");
this.change_mode(this.mode);
return;};
function IME_FKeyGuide(init){
this.superClass=container;
this.superClass(init);};
IME_FKeyGuide.prototype=new container({});
IME_FKeyGuide.prototype.create_obj=function (){
var w=248;
var h=106;
var base=new gbox(
{
width:w,
height:h,
color:[187,206,238,255],
});
var base_shadow=new gbox(
{
translate:[10,-10,0],
width:w,
height:h,
color:[0,0,0,255],
});
this.button_top_obj=new container({
translate:[-w/2+35,h/2-25,0],
components:[
new gbox({
translate:[0,-2,0],
width:47,
height:47,
round_enable:true,
round_width:4,
round_height:4,
round_level:4,
color:[0,0,0,255]
}),
new gbox({
translate:[0,-2,0],
width:43,
height:43,
round_enable:true,
round_width:4,
round_height:4,
round_level:4,
}),
this.button_text_top=new gtext({
width:45,
text:"F11",
font_size:24,
color:[0,0,0,255],
align:CENTER,
})
],
})
this.text_top=new gtext(
{
translate:[40,h/2-27,0],
width:190,
text:"",
font_size:40,
color:[0,0,0,255],
align:LEFT,
});
this.button_bottom_obj=new container({
translate:[-w/2+35,-h/2+29,0],
components:[
new gbox({
translate:[0,-2,0],
width:47,
height:47,
round_enable:true,
round_width:4,
round_height:4,
round_level:4,
color:[0,0,0,255]
}),
new gbox({
translate:[0,-2,0],
width:43,
height:43,
round_enable:true,
round_width:4,
round_height:4,
round_level:4,
}),
this.button_text_top=new gtext({
width:45,
text:"F12",
font_size:24,
color:[0,0,0,255],
align:CENTER,
})
],
})
this.text_bottom=new gtext(
{
translate:[40,-h/2+28,0],
width:190,
text:"キャンセル",
font_size:40,
color:[0,0,0,255],
align:LEFT,
});
this.components=[
base_shadow,
base,
this.button_top_obj,
this.text_top,
this.button_bottom_obj,
this.text_bottom,
];};
IME_FKeyGuide.prototype.init=function (){
this.change_mode("NO_TRANSLATE");};
IME_FKeyGuide.prototype.set_text_translate=function (){
setf_text(this.text_top,"変換");};
IME_FKeyGuide.prototype.set_text_cancel=function (){
setf_text(this.text_bottom,"キャンセル");};
IME_FKeyGuide.prototype.appear=function (){
this.visible_p=true;};
IME_FKeyGuide.prototype.disappear=function (){
this.visible_p=false;};
IME_FKeyGuide.prototype.change_mode=function (mode){
this.mode=mode;
switch(mode){
case "NO_TRANSLATE":
setf_text(this.text_top,"");
setf_text(this.text_bottom,"文字クリア");
break;
case "TRANSLATE":
setf_text(this.text_top,"");
setf_text(this.text_bottom,"キャンセル");
break;}
}
IME_FKeyGuide.prototype.free=function (){
setf_text(this.button_text_top,"");
setf_text(this.button_text_bottom,"");
setf_text(this.text_top,"");
setf_text(this.text_bottom,"");
return;};
IME_FKeyGuide.prototype.revive=function (){
setf_text(this.button_text_top,"F11:");
setf_text(this.button_text_bottom,"BS  :");
this.change_mode(this.mode);
return;};
function IME_SwitchMenu(init){
this.superClass=container;
this.superClass(init);};
IME_SwitchMenu.prototype=new container({});
IME_SwitchMenu.prototype.create_obj=function (){
this.height=169;
this.base=new gbox(
{
translate:[0,86-Math.floor(this.height/2),0],
width:92,
height:this.height,
color:[187,206,238,255],
});
this.base.org_pos=[this.base.translate[0],
this.base.translate[1],
this.base.translate[2]];
this.base.org_width=this.base.width;
this.base.org_height=this.base.height;
this.shadow=new gbox(
{
translate:[this.base.org_pos[0]+10,
this.base.org_pos[1]-10,
this.base.org_pos[2]+0],
width:92,
height:this.height,
color:[0,0,0,255],
});
this.shadow.org_pos=[this.shadow.translate[0],
this.shadow.translate[1],
this.shadow.translate[2]];
this.shadow.org_width=this.shadow.width;
this.shadow.org_height=this.shadow.height;
this.cursor_box=new gbox(
{
translate:[0,43*1.5,0],
width:92,
height:40,
color:[255,255,0,255],
});
this.ele=[
{text:"かな"},
{text:"カナ"},
{text:"英数"},
{text:"数字"}
];

this.len=this.ele.length;
for(var i=0;i<this.len;i++){
this.ele[i].pos=[0,43*(1.5-i)+4,0];
this.ele[i].obj=new gtext(
{
width:92,
text:this.ele[i].text,
font_size:40,
color:[0,0,0,255],
align:CENTER,
});
this.ele[i].obj.translate[0]=this.ele[i].pos[0];
this.ele[i].obj.translate[1]=this.ele[i].pos[1];
this.ele[i].obj.translate[2]=this.ele[i].pos[2];}
this.components=[
this.shadow,
this.base,
this.cursor_box
];
for(var j=0;j<this.len;j++){
this.components.push(this.ele[j].obj);}

};
IME_SwitchMenu.prototype.init=function (){
this.position=0;
this.pre_position=0;
this.change_mode("SELECT");}
IME_SwitchMenu.prototype.get_width=function (){
return this.base.width+10;};

IME_SwitchMenu.prototype.up=function (){
if(this.mode=="INPUT")
return null;
this.position-=1;

if(this.position<0)
this.position=this.len-1;
while(this.ele[this.position].text==""){
this.position-=1;}
this._move_cursor(this.ele[this.position].obj.translate[0],
this.ele[this.position].obj.translate[1],
this.ele[this.position].obj.translate[2]);

return this.ele[this.position].text;};
IME_SwitchMenu.prototype.down=function (){
if(this.mode=="INPUT")
return null;
this.position+=1;

if(this.ele[this.position]==null||this.ele[this.position].text=="")
this.position=0;

this._move_cursor(this.ele[this.position].obj.translate[0],
this.ele[this.position].obj.translate[1],
this.ele[this.position].obj.translate[2]);

return this.ele[this.position].text;};
IME_SwitchMenu.prototype._move_cursor=function (x,y,z){
this.cursor_box.translate[0]=x;
this.cursor_box.translate[1]=y-2;
this.cursor_box.translate[2]=z;}
IME_SwitchMenu.prototype.get_current_position=function (){
return this.position;}
IME_SwitchMenu.prototype.change_mode=function (mode){
switch(mode){
case "SELECT":
this.pre_position=this.position;
this.base.translate[1]=86-Math.floor(this.height/2);
this.base.width=this.base.org_width;
this.base.height=this.height;
this.shadow.translate[1]=this.base.translate[1]-10;
this.shadow.width=this.shadow.org_width;
this.shadow.height=this.height;
for(var i=0;i<this.len;i++){
this.ele[i].obj.visible_p=true;
this.ele[i].obj.translate[1]=this.ele[i].pos[1];}
this._move_cursor(this.ele[this.position].obj.translate[0],
this.ele[this.position].obj.translate[1],
this.ele[this.position].obj.translate[2]);
this.cursor_box.visible_p=true;

break;
case "INPUT":
var h=42;
this.base.translate[1]=172/2-h/2;
this.base.width=92;
this.base.height=h;
this.shadow.translate[1]=172/2-h/2-10;
this.shadow.width=92
this.shadow.height=h
for(var i=0;i<this.len;i++){
this.ele[i].obj.visible_p=false;}
this.ele[this.position].obj.translate[1]=43*1.5+4;
this.ele[this.position].obj.visible_p=true;
this.cursor_box.visible_p=false;
break;}
this.mode=mode;}
IME_SwitchMenu.prototype.revert_pos_to_selected=function (){
this.position=this.pre_position;
this.change_mode("INPUT");}
IME_SwitchMenu.prototype.change_input_char_set=function (obj){
if(obj==null||typeof obj.type=="undefined"){
console.log("[ERROR] Invalid argument.");
return;};
switch(obj.type){
case "ALL":
this.height=169;
this.ele[0].text="かな";
this.ele[1].text="カナ";
this.ele[2].text="英数";
this.ele[3].text="数字";
break;
case "ALPHABET":
this.height=86-4;
this.ele[0].text="英数";
this.ele[1].text="数字";
this.ele[2].text="";
this.ele[3].text="";
break;
default:
console.log("[ERROR] Invalid type");
break;};
for(var i=0;i<this.len;i++){
setf_text(this.ele[i].obj,this.ele[i].text);}
this.position=0;
this.pre_position=0;
this.change_mode("INPUT");};
IME_SwitchMenu.prototype.free=function (){
for(var i=0;i<this.len;i++){
this.ele[i].text="";
setf_text(this.ele[i].obj,this.ele[i].text);}
return;};
IME_SwitchMenu.prototype.revive=function (){
return;};
function IME_ScrollSelection(init){
this.superClass=container;
this.superClass(init);
this.CHAR_WIDTH=38;
this.BAR_WIDTH=30;
this.MIN_CHAR=3;
this.MAX_CHAR=15;
this.T_LIST_MAX=7;
this.T_LIST_NUM=5;
this.OFFSET=Math.floor((this.T_LIST_MAX-this.T_LIST_NUM)/2);
this.PITCH=40;
this.init();};

IME_ScrollSelection.prototype=new container({});
IME_ScrollSelection.prototype.set_translate=function (tra){
this.translate[0]=tra[0];
this.translate[1]=tra[1];
this.translate[2]=tra[2];};
IME_ScrollSelection.prototype.init=function (){
this.cand_text=[];
this.cursor_position=0;
this.position=0;
this.last_position=0;
this.cand_len=0;
this.t_translate=0;
this.c_translate=this.PITCH*2;
if(this.cursor_obj!=null){
delete_timer(this.cursor_obj);
this.cursor_obj.translate[1]=this.PITCH*2;}
if(this.t_list_cont!=null){
delete_timer(this.t_list_cont);
this.t_list_cont.translate[1]=0;}
}
IME_ScrollSelection.prototype._calc_window_width=function (num){
var ret=0;
if(num<this.MIN_CHAR){
ret=(this.MIN_CHAR*this.CHAR_WIDTH)+this.BAR_WIDTH;}else if(num<this.MAX_CHAR){
ret=(num*this.CHAR_WIDTH)+this.BAR_WIDTH;}else {
ret=(this.MAX_CHAR*this.CHAR_WIDTH)+this.BAR_WIDTH;}

return ret;};
IME_ScrollSelection.prototype.create_obj=function (){
this.base=new gbox(
{
height:220,
color:[187,206,238,255],
});
this.shadow=new gbox(
{
translate:[10,-10,0],
height:220,
color:[0,0,0,255],
});
this.cursor_obj=new gbox(
{
translate:[-(158-128)/2,0,0],
height:40,
color:[255,255,0,255],
});

this.t_list=[];

for(var j=0;j<this.T_LIST_MAX;j++){
var t_obj=new gtext(
{
translate:[-(158-128)/2+4,0,0],
font_size:36,
color:[0,0,0,255],
omitter:"...",
align:LEFT,
});
t_obj.number=0;
t_obj.update_text=function (text,number){
var tmp=text;
if(tmp==null||typeof tmp!="string")
tmp="";
setf_text(this,tmp);
this.number=number;}
this.t_list.push(t_obj);}

this.t_list_cont=new container({});
this.t_list_cont.components=this.t_list;

this.s_bar=new container({});
this.s_bar.translate=[64,0,0];

this.ar_top=new gpolygon(
{
vertex:[
-10,-10,0,
10,-10,0,
0,0,0,
],
color:[36,66,102,255],
translate:[0,105,0],
});
this.ar_top.on=function (){
this.color=[255,255,0,255];}
this.ar_top.off=function (){
this.color=[36,66,102,255];}
this.ar_bottom=new gpolygon(
{
vertex:[
-10,10,0,
0,0,0,
10,10,0,
],
color:[34,66,102,255],
translate:[0,-105,0],
});
this.ar_bottom.on=function (){
this.color=[255,255,0,255];}
this.ar_bottom.off=function (){
this.color=[36,66,102,255];}
this.bar=new gbox(
{
translate:[0,0,0],
width:22,
height:100,
color:[34,66,102,255],
});
this.s_bar.components=[
this.ar_top,
this.ar_bottom,
this.bar
];
this.pos_control_cont=new container(
{
translate:[0,-220/2,0],
components:[
this.shadow,
this.base,
this.cursor_obj,
this.t_list_cont,
this.s_bar
]
});

this.components=[
this.pos_control_cont
];
this.visible_p=false;};
IME_ScrollSelection.prototype.set_candidate=function (array){
this.init();
this.cand_text=array.slice(0);
this.cand_len=this.cand_text.length;}
IME_ScrollSelection.prototype.get_width=function (){
return this.base.width+10;}

IME_ScrollSelection.prototype.appear=function (){
if(this.cand_text.length==0){
console.log("[ERROR] No candidate!!!");
return null;}
this._element_init_view();
this.appear_cursor();
this.visible_p=true;}
IME_ScrollSelection.prototype.appear_without_cursor=function (){
if(this.cand_text.length==0){
console.log("[ERROR] No candidate!!!");
return null;}
this._element_init_view();
this.disappear_cursor();
this.visible_p=true;}
IME_ScrollSelection.prototype.appear_cursor=function (){
this.cursor_obj.visible_p=true;}
IME_ScrollSelection.prototype.disappear_cursor=function (){
this.cursor_obj.visible_p=false;}
IME_ScrollSelection.prototype._element_init_view=function (){
var max_char_num=0;
for(var j=0;j<this.cand_len;j++){
if(max_char_num<this.cand_text[j].length){
max_char_num=this.cand_text[j].length;}
}
var w_width=this._calc_window_width(max_char_num);
this.base.width=w_width;
this.shadow.width=w_width;
this.cursor_obj.width=w_width-this.BAR_WIDTH;
this.s_bar.translate[0]=w_width/2-this.BAR_WIDTH/2;
this.pos_control_cont.translate[0]=w_width/2;

var target=0;
for(var i=0;i<this.T_LIST_MAX;i++){
target=i+this.position-this.OFFSET;
this.t_list[i].width=w_width-this.BAR_WIDTH;
if(this.cand_text[target]){
this.t_list[i].update_text(this.cand_text[target],target);}else {
this.t_list[i].update_text("",-1);}
this.t_list[i].translate[1]=this.PITCH*(Math.floor(this.T_LIST_MAX/2)-i);
if(i<this.OFFSET){
this.t_list[i].visible_p=false;}else if(i>=(this.T_LIST_NUM+this.OFFSET)){
this.t_list[i].visible_p=false;}else if(i>=this.cand_len+this.OFFSET){
this.t_list[i].visible_p=false;}else {
this.t_list[i].visible_p=true;}
}
this._update_scrollbar();}
IME_ScrollSelection.prototype._element_final_view=function (){
var target=0;
var top_pos=this.cand_len-this.T_LIST_NUM;
if(top_pos<0){
top_pos=0;}
for(var i=0;i<this.T_LIST_MAX;i++){
target=i+top_pos-this.OFFSET;
if(i<this.OFFSET){
if(this.cand_text[target]){
this.t_list[i].update_text(this.cand_text[target],target);}else {
this.t_list[i].update_text("",-1);}
this.t_list[i].visible_p=false;}else if(i>=(this.T_LIST_NUM+this.OFFSET)){
this.t_list[i].update_text("",-1);
this.t_list[i].visible_p=false;}else if(i>=this.cand_len+this.OFFSET){
this.t_list[i].update_text("",-1);
this.t_list[i].visible_p=false;}else {
if(this.cand_text[target]){
this.t_list[i].update_text(this.cand_text[target],target);}else {
this.t_list[i].update_text("",-1);}
this.t_list[i].visible_p=true;}
this.t_list[i].translate[1]=this.PITCH*(Math.floor(this.T_LIST_MAX/2)-i);}
this._update_scrollbar();}
IME_ScrollSelection.prototype.disappear=function (){
this.visible_p=false;
for(var i=0;i<this.T_LIST_MAX;i++){
if(this.t_list[i].text!=""){
this.t_list[i].update_text("",-1);}
}
}
IME_ScrollSelection.prototype.plus=function (val,max){
var ret=val+1;
if(ret>=max)
ret=max;
return ret;};
IME_ScrollSelection.prototype.minus=function (val,min){
var ret=val-1;
if(ret<min)
ret=min;
return ret;};
IME_ScrollSelection.prototype._update_scrollbar=function (){
var max_height=180;
var bias=5;
if(this.cand_text.length>5){
var pos=this.t_list[1].number;
var par=5/(this.cand_text.length);
this.bar.height=(max_height*par);
this.bar.translate[1]=max_height/2-this.bar.height/2
-(((max_height-this.bar.height)/(this.cand_text.length-5))*pos);
if(this.t_list[5].number==(this.cand_text.length-1)){
this.ar_top.on();
this.ar_bottom.off();}else if(this.t_list[1].number==0){
this.ar_top.off();
this.ar_bottom.on();}else {
this.ar_top.on();
this.ar_bottom.on();}
}else {
this.bar.height=max_height;
this.bar.translate[1]=0;
this.ar_top.off();
this.ar_bottom.off();}
};
IME_ScrollSelection.prototype.up=function (){
var this_obj=this;
this.position=this.minus(this.position,0);
if(this.cursor_up()
&&this.last_position!=this.position){
this.t_translate-=this.PITCH;
this.list_up();
this._move(this.t_list_cont,this.t_translate,null);}else if(this.last_position!=this.position){}else {if(this.cand_len<this.T_LIST_NUM){
this.cursor_position=this.cand_len-1;
this.c_translate=this.PITCH*(Math.floor(this.T_LIST_NUM/2)-(this.cand_len-1));}else {
this.cursor_position=this.T_LIST_NUM-1;
this.c_translate=-this.PITCH*Math.floor(this.T_LIST_NUM/2);}
this._move(this.cursor_obj,this.c_translate,null);
this.position=this.cand_len-1;
this.t_translate=0;
this._element_final_view();
delete_timer(this.t_list_cont);
this.t_list_cont.translate[1]=this.t_translate;}
this.last_position=this.position;
this._update_scrollbar();};

IME_ScrollSelection.prototype.down=function (){
var this_obj=this;
this.position=this.plus(this.position,this.cand_len-1);
if(this.cursor_down()
&&this.last_position!=this.position){
this.t_translate+=this.PITCH;
this.list_down();
this._move(this.t_list_cont,this.t_translate,null);}else if(this.last_position!=this.position){}else {this.cursor_position=0;
this.c_translate=this.PITCH*2;
this._move(this.cursor_obj,this.c_translate,null);
this.t_translate=0;
delete_timer(this.t_list_cont);
this.t_list_cont.translate[1]=this.t_translate;
this.position=0;
this._element_init_view();}
this.last_position=this.position;
this._update_scrollbar();};
IME_ScrollSelection.prototype.list_up=function (){
this.t_list[this.T_LIST_NUM+this.OFFSET-1].visible_p=false;
var tmp=this.t_list.pop();
tmp.translate[1]=this.t_list[0].translate[1]+this.PITCH;
var pos=this.position-this.OFFSET;
if(this.cand_text[pos]){
tmp.update_text(this.cand_text[pos],pos);}else {
tmp.update_text("",-1);}
this.t_list.unshift(tmp);
this.t_list[this.OFFSET].visible_p=true;};
IME_ScrollSelection.prototype.list_down=function (){
this.t_list[this.OFFSET].visible_p=false;
var tmp=this.t_list.shift();
tmp.translate[1]=this.t_list[this.T_LIST_MAX-2].translate[1]
-this.PITCH;
var pos=this.position+this.OFFSET;
if(this.cand_text[pos]){
tmp.update_text(this.cand_text[pos],pos);}else {
tmp.update_text("",-1);}
this.t_list.push(tmp);
this.t_list[this.T_LIST_NUM+this.OFFSET-1].visible_p=true;};
IME_ScrollSelection.prototype.cursor_up=function (){
var edge=false;
this.cursor_position-=1;
if(this.cursor_position<0){
this.cursor_position=0;
edge=true;}else {
this.c_translate+=this.PITCH;
this._move(this.cursor_obj,this.c_translate,null);}
return edge;}
IME_ScrollSelection.prototype.cursor_down=function (){
var edge=false;
this.cursor_position+=1;
if(this.cursor_position>=this.T_LIST_NUM){
this.cursor_position=this.T_LIST_NUM-1;
edge=true;}else if(this.cursor_position>=this.cand_len){
this.cursor_position=this.cand_len-1;
edge=false;}else {
this.c_translate-=this.PITCH;
this._move(this.cursor_obj,this.c_translate,null);}
return edge;}
IME_ScrollSelection.prototype.scroll_up=function (){
for(var i=0;i<4;i++){
if(this.position<=0){
if(i>=1){break;}
else {this.up();}
}
this.up();}
};
IME_ScrollSelection.prototype.scroll_down=function (){
for(var i=0;i<4;i++){
if(this.position>=this.cand_len-1){
if(i>=1){break;}
else {this.down();}
}
this.down();}
};
IME_ScrollSelection.prototype._move=function (obj,target_y,end_func,end_func_for_cancel){
if(obj.__end_func_done!=true){
if(obj.__end_func_for_cancel){
obj.__end_func_for_cancel();
obj.__end_func_done=true;}
}
delete_timer(obj);
var delta=0;
obj.__end_func=end_func;
obj.__end_func_for_cancel=end_func_for_cancel;
obj.__end_func_done=false;
delta=(target_y-obj.translate[1])*0.8;
obj.translate[1]+=delta;
append_timer(obj,50,
function (obj,count){
delta=(target_y-obj.translate[1])/2;
if(count>=7){
delete_timer(obj);
obj.translate[1]=target_y;
if(obj.__end_func){
obj.__end_func();
obj.__end_func_done=true;}
}else {
obj.translate[1]+=delta;}
force_redraw();});}
IME_ScrollSelection.prototype.get_cursor_position=function (){
return this.position;}
function IME_USBIndicator(init){
this.superClass=container;
this.superClass(init);
this.pos_x_range=init.pos_x_range;
this.call_setting_hook=null;};
IME_USBIndicator.prototype=new container({});
IME_USBIndicator.prototype.create_obj=function (){
this.width=356;
this.height=103;
this.base=new gbox(
{
translate:[-22,86-Math.floor(this.height/2),0],
width:this.width,
height:this.height,
color:[187,206,238,255],
});
this.base.org_pos=[this.base.translate[0],
this.base.translate[1],
this.base.translate[2]];
this.base.org_width=this.base.width;
this.base.org_height=this.base.height;
this.shadow=new gbox(
{
translate:[this.base.org_pos[0]+10,
this.base.org_pos[1]-10,
this.base.org_pos[2]+0],
width:this.width,
height:this.height,
color:[0,0,0,255],
});
this.shadow.org_pos=[this.shadow.translate[0],
this.shadow.translate[1],
this.shadow.translate[2]];
this.shadow.org_width=this.shadow.width;
this.shadow.org_height=this.shadow.height;
this.mode_text=new gtext({
translate:[-87,43*(1.5-0)-6,0],
width:200,
text:"ひらがな",
font_size:40,
color:[0,0,0,255],
});
this.input_text=new gtext({
translate:[-87,43*(1.5-1)-5,0],
width:200,
text:"ローマ字入力",
font_size:40,
color:[0,0,0,255],
});
this.guide_obj=new container({
translate:[125,43*(1.5-0)-5,0],
components:[
new gbox({
translate:[-80,-2,0],
width:47,
height:47,
round_enable:true,
round_width:4,
round_height:4,
round_level:4,
color:[0,0,0,255]
}),
new gbox({
translate:[-80,-2,0],
width:43,
height:43,
round_enable:true,
round_width:4,
round_height:4,
round_level:4,
}),
new gtext({
width:45,
text:"F9",
font_size:24,
color:[0,0,0,255],
translate:[-80,0,0],
align:CENTER
}),
new gtext({
translate:[25,0,0],
width:150,
text:"設定",
font_size:40,
color:[0,0,0,255],
align:LEFT
})
]
});
this.components=[
this.shadow,
this.base,
this.mode_text,
this.input_text,
this.guide_obj
];
this.disappear();};
IME_USBIndicator.prototype.init=function (){
this.position=0;
this.pre_position=0;
this.init_char_type(HIRA_TYPE);
var form=this.call_setting_hook("usb_input_form");
this.init_input_form(form);}
IME_USBIndicator.prototype.init_char_type=function (value){
switch(value){
case KATA_TYPE:
setf_text(this.mode_text,"カタカナ");
break;
case EISU_TYPE:
setf_text(this.mode_text,"英数");
break;
case NUM_TYPE:
setf_text(this.mode_text,"直接");
break;
default:
setf_text(this.mode_text,"ひらがな");
break;}
}
IME_USBIndicator.prototype.init_input_form=function (value){
switch(value){
case KANA_INPUT:
setf_text(this.input_text,"かな入力");
break;
default:
setf_text(this.input_text,"ローマ字入力");
break;}
}
IME_USBIndicator.prototype.appear=function (){
this.visible_p=true;}
IME_USBIndicator.prototype.disappear=function (){
this.visible_p=false;}
IME_USBIndicator.prototype.get_width=function (){
return this.base.width+10;};
IME_USBIndicator.prototype.set_draw_state_hook=function (hook){
this.call_setting_hook=hook
}
IME_USBIndicator.prototype.calc_pos_x_limit=function (trg_pos_x){
var ret=trg_pos_x;
var limit=Math.floor((this.pos_x_range-this.width)/2);
if(trg_pos_x>limit){
ret=limit;}
return ret;};
function IME_USBSetting(init){
this.superClass=container;
this.superClass(init);
this.item_element=[
{
"symbol":"usb_char_type",
"title":"入力モード",
"choice":["ひらがな","カタカナ","英数","直接"],
"value":[HIRA_TYPE,KATA_TYPE,EISU_TYPE,NUM_TYPE],
"position":0,
"length":4,
},
{
"symbol":"usb_input_form",
"title":"入力方式",
"choice":["ローマ字入力","かな入力"],
"value":[ROMA_INPUT,KANA_INPUT],
"position":0,
"length":2,
},
{
"symbol":"forecast_state",
"title":"変換方式",
"choice":["通常変換","予測変換"],
"value":[FORECAST_OFF,FORECAST_ON],
"position":0,
"length":2,
},
];
this.cursor_image={
"menu_blue":kbd_img_path+"usb_kbd_blue_bar.png",
"menu_yellow":kbd_img_path+"usb_kbd_yellow_bar.png",
"menu_gray":kbd_img_path+"usb_kbd_gray_bar.png",
};
this.input_form=ROMA_INPUT;
this.char_type=HIRA_TYPE;
this.forecast_state=FORECAST_ON;
this.cursor_pos=0;
this.item_num=this.item_element.length;
this.memory_setting_hook=null;
this.call_setting_hook=null;
this.valid_forecast_hook=null;
this.invalid_forecast_hook=null;
this.is_direct_input=false;};
IME_USBSetting.prototype=new container({});
IME_USBSetting.prototype.create_obj=function (){
var this_obj=this;
var base_height=242;
this.list_translate=[0,base_height/2-75,0];
this.translate=[0,-base_height/2-45,0];
var base=new gbox({
width:528,
height:260,
color:[68,82,102,128]
})
var obj_title=new gtext({
translate:[0,base_height/2-16,0],
width:500,
text:"USBキーボード設定",
margin:[0,0,8,0],
font_size:40
});
this.list=new container({translate:this.list_translate});
function gen_item_list(){
var array=[];
for(var i=0;i<3;i++){
var s="menu_blue";
var item_list=new gimage({
width:484,height:57,
translate:[0,-65*i,0],
src:this_obj.cursor_image[s],
});
array.push(item_list);}
return array;}
this.list.components=gen_item_list();
this.item_title=new container({translate:this.list_translate});
function gen_item_title(){
var array=[];
for(var i=0;i<3;i++){
var te=this_obj.item_element[i].title;
var tra_x=-100;
var item_title=new gtext({
translate:[tra_x,-65*i,0],
width:(500-16)/2,
font_size:40,
text:te,
});
array.push(item_title);}
return array;}
this.item_title.components=gen_item_title();
this.item_choice=new container({translate:this.list_translate});
function gen_item_choice(){
var array=[];
for(var i=0;i<3;i++){
var item_choice=new gtext({
translate:[121,-65*i,0],
width:(500-16)/2,
font_size:40,
align:CENTER,
text:this_obj.item_element[i].choice[0]
});
array.push(item_choice);}
return array;}
this.item_choice.components=gen_item_choice();
this.arrow=new container({translate:this.list_translate});
function gen_item_arrow(){
var array=[];
for(var i=0;i<3;i++){
var item_arrow=new container({
translate:[0,-2-65*i,0],
visible_p:false,
components:[
new gpolygon(
{
vertex:[
6,6,0,
-6,0,0,
6,-6,0,
],
color:[255,214,0,255],
translate:[12,0,0]
}),
new gpolygon(
{
vertex:[
-6,6,0,
-6,-6,0,
6,0,0,
],
color:[255,214,0,255],
translate:[232,0,0]
}),
]
});
array.push(item_arrow);}
return array;}
this.arrow.components=gen_item_arrow();
this.cursor_obj=new gimage({
width:484,height:57,
translate:[0,base_height/2-65,0],
src:this.cursor_image["menu_yellow"],
});
this.components=[
base,
obj_title,
this.list,
this.cursor_obj,
this.item_title,
this.item_choice,
this.arrow,
];}
IME_USBSetting.prototype.init=function (){
var i=0;
this.cursor_pos=0;
for(i=0;i<this.item_num;i++){
if(i==0){
this._enter_cursor(i);}else {
this._leave_cursor(i);}
}
for(i=0;i<this.item_num;i++){
var symbol=this.item_element[i].symbol;
if(symbol=="usb_char_type"){
var value=this.char_type;}else {
var value=this.call_setting_hook(symbol);}
this.init_item_choice(symbol,value);}
var char_item=this.item_element[0];
if(char_item.value[this.char_type]==HIRA_TYPE){
this.valid_item("forecast_state");}else {
this.invalid_item("forecast_state");}
}
IME_USBSetting.prototype.change_input_char_set=function (obj){
var type=obj.type;
switch(type){
case "ALL":
this.is_direct_input=false;
break;
case "ALPHABET":
this.is_direct_input=true;
this.init_item_choice("usb_char_type",NUM_TYPE);
this.invalid_item("forecast_state");
break;}
}
IME_USBSetting.prototype.valid_item=function (symbol){
var ele=null;
var item=null;
var title=null;
var choice=null;
for(var i=0;i<this.item_num;i++){
if(this.item_element[i].symbol==symbol){
ele=this.item_element[i];
item=this.list.components[i];
title=this.item_title.components[i];
choice=this.item_choice.components[i];
if(item.src!=this.cursor_image["menu_blue"]){
item.src=this.cursor_image["menu_blue"];}
title.color[0]=255;
title.color[1]=255;
title.color[2]=255;
choice.color[0]=255;
choice.color[1]=255;
choice.color[2]=255;
if(symbol=="forecast_state"){
setf_text(choice,ele.choice[ele.position]);
this.valid_forecast_hook();}
break;}
}
}
IME_USBSetting.prototype.invalid_item=function (symbol){
var ele=null;
var item=null;
var title=null;
var choice=null;
for(var i=0;i<this.item_num;i++){
if(this.item_element[i].symbol==symbol){
ele=this.item_element[i];
item=this.list.components[i];
title=this.item_title.components[i];
choice=this.item_choice.components[i];
if(item.src!=this.cursor_image["menu_gray"]){
item.src=this.cursor_image["menu_gray"];}
title.color[0]=136;
title.color[1]=132;
title.color[2]=136;
choice.color[0]=136;
choice.color[1]=132;
choice.color[2]=136;
if(symbol=="forecast_state"){
setf_text(choice,ele.choice[0]);
this.invalid_forecast_hook();}
break;}
}
}
IME_USBSetting.prototype.init_item_choice=function (symbol,value){
var num=0;
for(var i=0;i<this.item_num;i++){
if(this.item_element[i].symbol==symbol){
num=i;
break;}
}
switch(symbol){
case "usb_input_form":
this.init_input_form(value,num);
break;
case "usb_char_type":
this.init_char_type(value,num);
break;
case "forecast_state":
this.init_forecast_state(value,num);
break;}
}
IME_USBSetting.prototype.init_input_form=function (value,n){
var ele=this.item_element[n];
switch(value){
case ROMA_INPUT:
ele.position=0;
break;
case KANA_INPUT:
ele.position=1;
break;
default:
ele.position=0;
console.log("[ERROR] Illegal input_form!");
break;}
var pos=ele.position;
this.input_form=ele.value[pos];
setf_text(this.item_choice.components[n],
ele.choice[pos]);}
IME_USBSetting.prototype.init_char_type=function (value,n){
var ele=this.item_element[n];
switch(value){
case HIRA_TYPE:
ele.position=0;
break;
case KATA_TYPE:
ele.position=1;
break;
case EISU_TYPE:
ele.position=2;
break;
case NUM_TYPE:
ele.position=3;
break;
default:
ele.position=0;
this.char_type=HIRA_TYPE;
console.log("[ERROR] Illegal char_type!");
break;}
var pos=ele.position;
this.char_type=ele.value[pos];
setf_text(this.item_choice.components[n],
ele.choice[pos]);}
IME_USBSetting.prototype.init_forecast_state=function (value,n){
var ele=this.item_element[n];
switch(value){
case "forecast":
ele.position=1;
break;
case "normal":
ele.position=0;
break;
default:
ele.position=0;
console.log("[ERROR] Illegal forecast_state!");
break;}
var pos=ele.position;
this.forecast_state=ele.value[pos];
setf_text(this.item_choice.components[n],
ele.choice[pos]);}
IME_USBSetting.prototype.appear=function (){
this.visible_p=true;}
IME_USBSetting.prototype.disappear=function (){
this.visible_p=false;}
IME_USBSetting.prototype.key_hook=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
if(keysym.type!=keysym.CHAR){
switch(keysym.code){
case TXKB_Up:
ret=this.up();
break;
case TXKB_Down:
ret=this.down();
break;
case TXKB_Left:
ret=this.prev_choice();
break;
case TXKB_Right:
ret=this.next_choice();
break;
case TXKB_F9:
case TXKB_F10:
case TXKB_F11:
case TXKB_F12:
ret=true;
break;
default:
break;}
}
return ret;}
IME_USBSetting.prototype.up=function (){
var pre_pos=this.cursor_pos;
this.cursor_pos--;
if(this.cursor_pos<0){
this.cursor_pos=this.item_num-1;}
var cur_pos=this.cursor_pos;
this._move_cursor(cur_pos,pre_pos);
return true;}
IME_USBSetting.prototype.down=function (){
var pre_pos=this.cursor_pos;
this.cursor_pos++;
if(this.cursor_pos>this.item_num-1){
this.cursor_pos=0;}
var cur_pos=this.cursor_pos;
this._move_cursor(cur_pos,pre_pos);
return true;}
IME_USBSetting.prototype._move_cursor=function (c,p){
this._enter_cursor(c);
this._leave_cursor(p);}
IME_USBSetting.prototype._enter_cursor=function (pos){
var item=this.list.components[pos];
var arrow=this.arrow.components[pos];
var title=this.item_title.components[pos];
var choice=this.item_choice.components[pos];
var cursor=this.cursor_obj;
switch(item.src){
case this.cursor_image["menu_blue"]:
arrow.visible_p=true;
title.color[0]=0;
title.color[1]=0;
title.color[2]=0;
choice.color[0]=0;
choice.color[1]=0;
choice.color[2]=0;
break;}
cursor.translate[1]=this.list_translate[1]-65*pos;}
IME_USBSetting.prototype._leave_cursor=function (pos){
var item=this.list.components[pos];
var arrow=this.arrow.components[pos];
var title=this.item_title.components[pos];
var choice=this.item_choice.components[pos];
switch(item.src){
case this.cursor_image["menu_blue"]:
arrow.visible_p=false;
title.color[0]=255;
title.color[1]=255;
title.color[2]=255;
choice.color[0]=255;
choice.color[1]=255;
choice.color[2]=255;
break;}
}
IME_USBSetting.prototype.prev_choice=function (){
if(this.cursor_pos==this.item_num){
return true;}
var item=this.list.components[this.cursor_pos];
if(item.src!=this.cursor_image["menu_blue"]){
return true;}
var ele=this.item_element[this.cursor_pos];
if(this.is_direct_input&&ele.symbol=="usb_char_type"){
return true;}
var max_choice_num=ele.length;
var choice_num=ele.position;
choice_num--;
if(choice_num<0){
choice_num=max_choice_num-1;}
this._change_choice(item,ele,choice_num);
return true;}
IME_USBSetting.prototype.next_choice=function (){
if(this.cursor_pos==this.item_num){
return true;}
var item=this.list.components[this.cursor_pos];
if(item.src!=this.cursor_image["menu_blue"]){
return true;}
var ele=this.item_element[this.cursor_pos];
if(this.is_direct_input&&ele.symbol=="usb_char_type"){
return true;}
var max_choice_num=ele.length;
var choice_num=ele.position;
choice_num++;
if(choice_num>=max_choice_num){
choice_num=0;}
this._change_choice(item,ele,choice_num);
return true;}
IME_USBSetting.prototype._change_choice=function (item,ele,choice_num){
setf_text(this.item_choice.components[this.cursor_pos],
ele.choice[choice_num]);
ele.position=choice_num;
this.set_choice_num(ele.symbol,ele.value[choice_num]);
switch(ele.symbol){
case "usb_char_type":
if(ele.value[choice_num]==HIRA_TYPE){
this.valid_item("forecast_state");}else {
this.invalid_item("forecast_state");}
break;
case "usb_input_form":
this.memory_setting_hook(ele.value[choice_num],"usb_input_form");
break;
case "forecast_state":
var v=ele.value[choice_num];
this.switch_convert_hook(v);
if(v==FORECAST_ON){
this.memory_setting_hook("forecast","forecast_state");}else if(v==FORECAST_OFF){
this.memory_setting_hook("normal","forecast_state");}
break;
default:
break;}
}
IME_USBSetting.prototype.set_choice_num=function (symbol,value){
switch(symbol){
case "usb_input_form":
this.input_form=value;
break;
case "usb_char_type":
this.char_type=value;
break;
case "forecast_state":
this.forecast_state=value;
break;}
}
IME_USBSetting.prototype.set_change_setting_hook=function (hook){
this.memory_setting_hook=hook
}
IME_USBSetting.prototype.set_call_setting_hook=function (hook){
this.call_setting_hook=hook
}
IME_USBSetting.prototype.set_change_forecast_state_hook=function (hook){
this.switch_convert_hook=hook
}
IME_USBSetting.prototype.set_valid_forecast_hook=function (hook){
this.valid_forecast_hook=hook;};
IME_USBSetting.prototype.set_invalid_forecast_hook=function (hook){
this.invalid_forecast_hook=hook
}
IME_USBSetting.prototype.get_char_type=function (){
return this.char_type;}
IME_USBSetting.prototype.set_char_type=function (type){
this.char_type=type;}
function IME_5StrokeInput(init){
this.superClass=container;
this.superClass(init);
this.DH={
TXK_D1:{text:["あ","い","う","え","お",
"ぁ","ぃ","ぅ","ぇ","ぉ","１"],
roop_num:10},
TXK_D2:{text:["か","き","く","け","こ","２"],
daku_text:["が","ぎ","ぐ","げ","ご"],
roop_num:5},
TXK_D3:{text:["さ","し","す","せ","そ","３"],
daku_text:["ざ","じ","ず","ぜ","ぞ"],
roop_num:5},
TXK_D4:{text:["た","ち","つ","て","と","っ","４"],
daku_text:["だ","ぢ","づ","で","ど"],
roop_num:6},
TXK_D5:{text:["な","に","ぬ","ね","の","５"],
roop_num:5},
TXK_D6:{text:["は","ひ","ふ","へ","ほ","６"],
daku_text:["ば","び","ぶ","べ","ぼ"],
handaku_text:["ぱ","ぴ","ぷ","ぺ","ぽ"],
roop_num:5},
TXK_D7:{text:["ま","み","む","め","も","７"],
roop_num:5},
TXK_D8:{text:["や","ゆ","よ","ゃ","ゅ","ょ","８"],
roop_num:6},
TXK_D9:{text:["ら","り","る","れ","ろ","９"],
roop_num:5},
TXK_D0:{text:["、","。","？","！","・","（","）","０"],
roop_num:7},
TXK_ASTERISK:{text:["わ","を","ん","ゎ","ー","　"],
roop_num:5},
TXK_SHARP:{text:["Reverse"],
roop_num:0}
};
this.DK={
TXK_D1:{text:["ア","イ","ウ","エ","オ",
"ァ","ィ","ゥ","ェ","ォ","１"],
daku_text:["","","ヴ","",""],
roop_num:10},
TXK_D2:{text:["カ","キ","ク","ケ","コ","２"],
daku_text:["ガ","ギ","グ","ゲ","ゴ"],
roop_num:5},
TXK_D3:{text:["サ","シ","ス","セ","ソ","３"],
daku_text:["ザ","ジ","ズ","ゼ","ゾ"],
roop_num:5},
TXK_D4:{text:["タ","チ","ツ","テ","ト","ッ","４"],
daku_text:["ダ","ヂ","ヅ","デ","ド"],
roop_num:6},
TXK_D5:{text:["ナ","ニ","ヌ","ネ","ノ","５"],
roop_num:5},
TXK_D6:{text:["ハ","ヒ","フ","ヘ","ホ","６"],
daku_text:["バ","ビ","ブ","ベ","ボ"],
handaku_text:["パ","ピ","プ","ペ","ポ"],
roop_num:5},
TXK_D7:{text:["マ","ミ","ム","メ","モ","７"],
roop_num:5},
TXK_D8:{text:["ヤ","ユ","ヨ","ャ","ュ","ョ","８"],
roop_num:6},
TXK_D9:{text:["ラ","リ","ル","レ","ロ","９"],
roop_num:5},
TXK_D0:{text:["、","。","？","！","・","（","）","０"],
roop_num:7},
TXK_ASTERISK:{text:["ワ","ヲ","ン","ヮ","ー","　"],
roop_num:5},
TXK_SHARP:{text:["Reverse"],
roop_num:0}
};
this.DA={
TXK_D1:{text:["@",".","/",":","~","_","#","$","%","*","+","=","^","`","1"],
roop_num:14},
TXK_D2:{text:["a","b","c","A","B","C","2"],
roop_num:6},
TXK_D3:{text:["d","e","f","D","E","F","3"],
roop_num:6},
TXK_D4:{text:["g","h","i","G","H","I","4"],
roop_num:6},
TXK_D5:{text:["j","k","l","J","K","L","5"],
roop_num:6},
TXK_D6:{text:["m","n","o","M","N","O","6"],
roop_num:6},
TXK_D7:{text:["p","q","r","s","P","Q","R","S","7"],
roop_num:8},
TXK_D8:{text:["t","u","v","T","U","V","8"],
roop_num:6},
TXK_D9:{text:["w","x","y","z","W","X","Y","Z","9"],
roop_num:8},
TXK_D0:{text:["-",",",";","'","\"","?","!","&","\\","|","(",")","<",">","[","]","{","}","0"],
roop_num:18},
TXK_ASTERISK:{text:[" "],roop_num:0},
TXK_SHARP:{text:["Reverse"],
roop_num:0}
};
this.DN={
TXK_D1:{text:["1"],
roop_num:0},
TXK_D2:{text:["2"],
roop_num:0},
TXK_D3:{text:["3"],
roop_num:0},
TXK_D4:{text:["4"],
roop_num:0},
TXK_D5:{text:["5"],
roop_num:0},
TXK_D6:{text:["6"],
roop_num:0},
TXK_D7:{text:["7"],
roop_num:0},
TXK_D8:{text:["8"],
roop_num:0},
TXK_D9:{text:["9"],
roop_num:0},
TXK_D0:{text:["0"],
roop_num:0},
TXK_ASTERISK:{text:["*"],
roop_num:0},
TXK_SHARP:{text:["#"],
roop_num:0}
};
if(typeof init.width=="undefined"){
this.text_box_width=500;}else {
this.text_box_width=init.width;}

this.mode="HIRAGANA";
this.add_text_hook=null;
this.replace_text_hook=null;
this.init();};
IME_5StrokeInput.prototype=new container({});
IME_5StrokeInput.prototype.init=function (){
this.push_num=0;
this.last_key=null;
this.last_key_r=null;
this.dakuten_mode=false;
this.handaku_mode=false;
this.dakuten_key="";
this.dakuten_num=0;}
IME_5StrokeInput.prototype.create_obj=function (){
this.text_box=new IME_TextBox(
{
width:this.text_box_width,
text:"",
color:[0,0,0,255],
support_5stroke:true,
char_length_limit:100,
});


this.components=[
this.text_box
];};
IME_5StrokeInput.prototype.set_add_text_hook=function (func){
this.add_text_hook=func;}
IME_5StrokeInput.prototype.set_replace_text_hook=function (func){
this.replace_text_hook=func;}
IME_5StrokeInput.prototype.change_mode=function (mode){
this.mode=mode;};
IME_5StrokeInput.prototype._input_char=function (keysym){
var ret=null;
var data=null;

switch(this.mode){
case "HIRAGANA":
data=this.DH;
ret=this._char_input(keysym,data);
break;
case "KATAKANA":
data=this.DK;
ret=this._char_input(keysym,data);
break;
case "ALPHABET":
data=this.DA;
ret=this._char_input(keysym,data);
break;
case "NUMBER":
data=this.DN;
ret=this._num_input(keysym,data);
break;
default:
console.log("[ERROR] Illegal input mode!");
break;}

return ret;};
IME_5StrokeInput.prototype.keysym_to_char=function (keysym){
switch(keysym){
case TXK_D1:return "TXK_D1";
case TXK_D2:return "TXK_D2";
case TXK_D3:return "TXK_D3";
case TXK_D4:return "TXK_D4";
case TXK_D5:return "TXK_D5";
case TXK_D6:return "TXK_D6";
case TXK_D7:return "TXK_D7";
case TXK_D8:return "TXK_D8";
case TXK_D9:return "TXK_D9";
case TXK_D0:return "TXK_D0";
case TXK_ASTERISK:return "TXK_ASTERISK";
case TXK_SHARP:return "TXK_SHARP";
default:return null;}
};
IME_5StrokeInput.prototype._num_input=function (keysym,data){
var ret=null;

var char_sym=this.keysym_to_char(keysym);
if(char_sym!=null){
switch(char_sym){
case "TXK_D1":
case "TXK_D2":
case "TXK_D3":
case "TXK_D4":
case "TXK_D5":
case "TXK_D6":
case "TXK_D7":
case "TXK_D8":
case "TXK_D9":
case "TXK_D0":
case "TXK_ASTERISK":
case "TXK_SHARP":
ret=data[char_sym].text[0];
this.text_box.add_text(ret);
break;
default:
ret=null;
break;}
}

return ret;};
IME_5StrokeInput.prototype._is_dakuten=function (keysym,last_char_sym){
if((this.mode=="HIRAGANA"
||this.mode=="KATAKANA")
&&keysym==TXK_D0){
if(this.handaku_mode==true){
return false;}
var last="";
if(this.dakuten_key!=""){
last=this.dakuten_key;}else {
last=last_char_sym;}

if(this.dakuten_mode==false){
switch(last){
case "TXK_D2":
case "TXK_D3":
case "TXK_D4":
case "TXK_D6":
return true;
break;}
}
}
return false;}
IME_5StrokeInput.prototype._is_handakuten=function (keysym,last_char_sym){
if((this.mode=="HIRAGANA"
||this.mode=="KATAKANA")
&&keysym==TXK_D0){
if(this.handaku_mode==false){
if(this.last_key==TXK_D0
&&this.dakuten_key=="TXK_D6"){
return true;}
}

}

return false;}
IME_5StrokeInput.prototype._is_ret_normal=function (keysym,last_char_sym){
if((this.mode=="HIRAGANA"
||this.mode=="KATAKANA")
&&keysym==TXK_D0){

if(this.dakuten_mode==true
||this.handaku_mode==true){
return true;}

}

return false;};
IME_5StrokeInput.prototype._is_space=function (keysym){
if(this.mode=="ALPHABET"){
if(keysym==TXK_ASTERISK){
return true;}
}

return false;}
IME_5StrokeInput.prototype._is_vu=function (keysym,last_char_sym,
last_push_num){
if(this.mode=="KATAKANA"&&keysym==TXK_D0){
if(this.handaku_mode==true){
return false;}
var last="";
var last_num=0;
if(this.dakuten_key!=""){
last=this.dakuten_key;
last_num=this.dakuten_num;}else {
last=last_char_sym;
last_num=last_push_num-1;}

if(this.dakuten_mode==false){
if(last=="TXK_D1"&&last_num==2)
return true;}
}
return false;}
IME_5StrokeInput.prototype._char_input=function (keysym,data){
var ret=null;
var consume=false;
var roop_num=0;
var replace_p=false;
var last_push_num=this.push_num;

var char_sym=this.keysym_to_char(keysym);
var last_char_sym=this.keysym_to_char(this.last_key);
if(char_sym!=null){
switch(char_sym){
case "TXK_SHARP":
if(this.last_key!=TXK_SHARP){
this.last_key_r=this.keysym_to_char(this.last_key);
this.push_num-=1;}
if(this.last_key_r!=null){
this.push_num-=1;
if(this.push_num<0){
this.push_num=data[this.last_key_r].roop_num;}
ret=data[this.last_key_r].text[this.push_num];
this.text_box.replace_text(ret);
if(this.replace_text_hook!=null&&typeof this.replace_text_hook=="function")
this.replace_text_hook();}
consume=true;
break;
case "TXK_D1":
case "TXK_D2":
case "TXK_D3":
case "TXK_D4":
case "TXK_D5":
case "TXK_D6":
case "TXK_D7":
case "TXK_D8":
case "TXK_D9":
case "TXK_D0":
case "TXK_ASTERISK":
switch(this.last_key){
case TXK_SHARP:
if(this.last_key_r!=this.keysym_to_char(keysym)){
this.push_num=0;
replace_p=false;}else {
this.push_num+=1;
replace_p=true;}
break;
case TXK_D0:
if(this.last_key!=keysym){
this.push_num=0;
replace_p=false;}else {
replace_p=true;}
break;
default:
this.dakuten_mode=false;
this.handaku_mode=false;
this.dakuten_key="";
this.dakuten_num=0;
if(this.last_key!=keysym){
this.push_num=0;
replace_p=false;}else {
replace_p=true;}
break;};
if(this._is_dakuten(keysym,last_char_sym)){
if(this.dakuten_key==""){
this.dakuten_key=last_char_sym;
if((last_push_num-1)<0){
this.dakuten_num=data[this.dakuten_key].daku_text.length;}else {
this.dakuten_num=last_push_num-1;}
}
ret=data[this.dakuten_key].daku_text[this.dakuten_num];
this.dakuten_mode=true;
this.handaku_mode=false;
replace_p=true;}else if(this._is_vu(keysym,last_char_sym,last_push_num)){
if(this.dakuten_key==""){
this.dakuten_key=last_char_sym;
if((last_push_num-1)<0){
this.dakuten_num=data[this.dakuten_key].daku_text.length;}else {
this.dakuten_num=last_push_num-1;}
}
ret=data[this.dakuten_key].daku_text[this.dakuten_num];
this.dakuten_mode=true;
this.handaku_mode=false;
replace_p=true;}else if(this._is_handakuten(keysym,last_char_sym)){
ret=data[this.dakuten_key].handaku_text[this.dakuten_num];
this.dakuten_mode=false;
this.handaku_mode=true;
replace_p=true;}else if(this._is_ret_normal(keysym,last_char_sym)){
ret=data[this.dakuten_key].text[this.dakuten_num];
this.dakuten_mode=false;
this.handaku_mode=false;}else if(this._is_space(keysym)){
ret=data[char_sym].text[this.push_num];
replace_p=false;}else {
ret=data[char_sym].text[this.push_num];}
roop_num=data[char_sym].roop_num;
this.push_num+=1;
if(this.push_num>roop_num){
this.push_num=0;}

if(ret!=null&&ret!=""){
if(replace_p==true){
this.text_box.replace_text(ret);
if(this.replace_text_hook!=null&&typeof this.replace_text_hook=="function")
this.replace_text_hook();}else {
this.text_box.add_text(ret);
if(this.add_text_hook!=null&&typeof this.add_text_hook=="function")
this.add_text_hook();}
}
consume=true;
break;
default:
ret=null;
break;}
}

return consume;};
IME_5StrokeInput.prototype.clear=function (){
this.text_box.clear();};
IME_5StrokeInput.prototype.get_text=function (){
return this.text_box.get_text();};
IME_5StrokeInput.prototype.get_text_array=function (){
return this.text_box.get_text_array();};
IME_5StrokeInput.prototype.set_empty_hook=function (func){
return this.text_box.set_empty_hook(func);};
IME_5StrokeInput.prototype.set_change_text_hook=function (func){
return this.text_box.set_change_text_hook(func);};
IME_5StrokeInput.prototype.set_text=function (text,cursor_pos){
this.text_box.set_text(text,cursor_pos);};
IME_5StrokeInput.prototype.appear=function (){
this.visible_p=true;
this.init();};
IME_5StrokeInput.prototype.disappear=function (){
this.visible_p=false;
this.init();
this.text_box.set_text("");};
IME_5StrokeInput.prototype.get_cursor_position=function (){
return this.text_box.get_cursor_position();};
IME_5StrokeInput.prototype.get_cursor_width=function (){
return this.text_box.get_cursor_width();};
IME_5StrokeInput.prototype.get_text_width=function (){
return this.text_box.get_text_width();};
IME_5StrokeInput.prototype.key_hook=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
switch(keysym){
case TXK_YELLOW:
this.text_box.backspace_text();
ret=true;
break;
case TXK_LEFT:
this.text_box.cursor_left();
ret=true;
break;
case TXK_RIGHT:
this.text_box.cursor_right();
ret=true;
break;
case TXK_D1:
case TXK_D2:
case TXK_D3:
case TXK_D4:
case TXK_D5:
case TXK_D6:
case TXK_D7:
case TXK_D8:
case TXK_D9:
case TXK_D0:
case TXK_ASTERISK:
case TXK_SHARP:
this._input_char(keysym);
ret=true;
break;}
this.last_key=keysym;
return ret;};
IME_5StrokeInput.prototype.free=function (){
this.text_box.free();
return;};
IME_5StrokeInput.prototype.revive=function (){
this.text_box.revive();
return;};
function IME_SoftKBDInput(init){
this.superClass=container;
this.superClass(init);

var BIAS_X=1260/2-260-48/2;
var BIAS_Y=286/2-11-48/2;
this.PITCH=54;
var PITCH=this.PITCH;
var i=0;
var j=0;

function set_param(obj){
for(i=0;i<14;i++){
for(j=0;j<5;j++){
if(typeof obj[i][j].x=="undefined")
obj[i][j].x=-i*PITCH+BIAS_X;
if(typeof obj[i][j].y=="undefined")
obj[i][j].y=-j*PITCH+BIAS_Y;
if(typeof obj[i][j].w=="undefined")
obj[i][j].w=48;
if(typeof obj[i][j].h=="undefined")
obj[i][j].h=48;}
}
}
var ext_pos_x=-(PITCH*13-PITCH/2+3+288/2)+BIAS_X;
var ext_pos_y=-(PITCH*3+PITCH/2)+BIAS_Y;

this.DH=[
[{v:"あ"},{v:"い"},{v:"う"},{v:"え"},{v:"お"}],
[{v:"か",daku:"が"},{v:"き",daku:"ぎ"},{v:"く",daku:"ぐ"},{v:"け",daku:"げ"},{v:"こ",daku:"ご"}],
[{v:"さ",daku:"ざ"},{v:"し",daku:"じ"},{v:"す",daku:"ず"},{v:"せ",daku:"ぜ"},{v:"そ",daku:"ぞ"}],
[{v:"た",daku:"だ"},{v:"ち",daku:"ぢ"},{v:"つ",daku:"づ"},{v:"て",daku:"で"},{v:"と",daku:"ど"}],
[{v:"な"},{v:"に"},{v:"ぬ"},{v:"ね"},{v:"の"}],
[{v:"は",daku:"ば",handaku:"ぱ"},{v:"ひ",daku:"び",handaku:"ぴ"},{v:"ふ",daku:"ぶ",handaku:"ぷ"},{v:"へ",daku:"べ",handaku:"ぺ"},{v:"ほ",daku:"ぼ",handaku:"ぽ"}],
[{v:"ま"},{v:"み"},{v:"む"},{v:"め"},{v:"も"}],
[{v:"や"},{v:"ゆ"},{v:"よ"},{v:"\u309b"},{v:"\u309c"}],
[{v:"ら"},{v:"り"},{v:"る"},{v:"れ"},{v:"ろ"}],
[{v:"わ"},{v:"を"},{v:"ん"},{v:"、"},{v:"。"}],
[{v:"ぁ"},{v:"ぃ"},{v:"ぅ"},{v:"ぇ"},{v:"ぉ"}],
[{v:"ゃ"},{v:"ゅ"},{v:"ょ"},{v:"っ"},{v:"ゎ"}],
[{v:"ー"},{v:"「"},{v:"」"},{v:"！"},{v:"？"}],
[{v:"改行",w:288,x:ext_pos_x,f:"no_action"},{v:"空白",i:"　",w:288,x:ext_pos_x},
{v:"キーボード移動",f:"move_kbd",w:288,x:ext_pos_x},
{v:"入力位置移動",f:"move_cursor",w:288,h:102,x:ext_pos_x,y:ext_pos_y},
{v:null}],
];
set_param(this.DH);
this.DK=[
[{v:"ア"},{v:"イ"},{v:"ウ"},{v:"エ"},{v:"オ"}],
[{v:"カ",daku:"ガ"},{v:"キ",daku:"ギ"},{v:"ク",daku:"グ"},{v:"ケ",daku:"ゲ"},{v:"コ",daku:"ゴ"}],
[{v:"サ",daku:"ザ"},{v:"シ",daku:"ジ"},{v:"ス",daku:"ズ"},{v:"セ",daku:"ゼ"},{v:"ソ",daku:"ゾ"}],
[{v:"タ",daku:"ダ"},{v:"チ",daku:"ヂ"},{v:"ツ",daku:"ヅ"},{v:"テ",daku:"デ"},{v:"ト",daku:"ド"}],
[{v:"ナ"},{v:"ニ"},{v:"ヌ"},{v:"ネ"},{v:"ノ"}],
[{v:"ハ",daku:"バ",handaku:"パ"},{v:"ヒ",daku:"ビ",handaku:"ピ"},{v:"フ",daku:"ブ",handaku:"プ"},{v:"ヘ",daku:"ベ",handaku:"ペ"},{v:"ホ",daku:"ボ",handaku:"ポ"}],
[{v:"マ"},{v:"ミ"},{v:"ム"},{v:"メ"},{v:"モ"}],
[{v:"ヤ"},{v:"ユ"},{v:"ヨ"},{v:"\u309b"},{v:"\u309c"}],
[{v:"ラ"},{v:"リ"},{v:"ル"},{v:"レ"},{v:"ロ"}],
[{v:"ワ"},{v:"ヲ"},{v:"ン"},{v:"、"},{v:"。"}],
[{v:"ァ"},{v:"ィ"},{v:"ゥ"},{v:"ェ"},{v:"ォ"}],
[{v:"ャ"},{v:"ュ"},{v:"ョ"},{v:"ッ"},{v:"ヮ"}],
[{v:"ー"},{v:"「"},{v:"」"},{v:"！"},{v:"？"}],
[{v:"改行",w:288,x:ext_pos_x,f:"no_action"},{v:"空白",i:"　",w:288,x:ext_pos_x},
{v:"キーボード移動",f:"move_kbd",w:288,x:ext_pos_x},
{v:"入力位置移動",f:"move_cursor",w:288,h:102,x:ext_pos_x,y:ext_pos_y},
{v:null}],
];
set_param(this.DK);
this.DA_L=[
[{v:"３",i:"3"},{v:"６",i:"6"},{v:"９",i:"9"},{v:"＃",i:"#"},{v:""}],
[{v:"２",i:"2"},{v:"５",i:"5"},{v:"８",i:"8"},{v:"０",i:"0"},{v:""}],
[{v:"１",i:"1"},{v:"４",i:"4"},{v:"７",i:"7"},{v:"＊",i:"*"},{v:""}],
[{v:"Ｊ",i:"J"},{v:"Ｔ",i:"T"},{v:"：",i:":"},{v:"￥",i:"\\"},{v:""}],
[{v:"Ｉ",i:"I"},{v:"Ｓ",i:"S"},{v:"／",i:"/"},{v:"＆",i:"&"},{v:""}],
[{v:"Ｈ",i:"H"},{v:"Ｒ",i:"R"},{v:"＠",i:"@"},{v:"？",i:"?"},{v:""}],
[{v:"Ｇ",i:"G"},{v:"Ｑ",i:"Q"},{v:"．",i:"."},{v:"”",i:"\""},{v:""}],
[{v:"Ｆ",i:"F"},{v:"Ｐ",i:"P"},{v:"Ｚ",i:"Z"},{v:"’",i:"\'"},{v:"！",i:"!"}],
[{v:"Ｅ",i:"E"},{v:"Ｏ",i:"O"},{v:"Ｙ",i:"Y"},{v:"；",i:";"},{v:"）",i:")"}],
[{v:"Ｄ",i:"D"},{v:"Ｎ",i:"N"},{v:"Ｘ",i:"X"},{v:"，",i:","},{v:"（",i:"("}],
[{v:"Ｃ",i:"C"},{v:"Ｍ",i:"M"},{v:"Ｗ",i:"W"},{v:"ー",i:"-"},{v:"小文字",i:null,w:156,x:-248,f:"change2S"}],
[{v:"Ｂ",i:"B"},{v:"Ｌ",i:"L"},{v:"Ｖ",i:"V"},{v:"＿",i:"_"},{v:"小文字",i:null,w:156,x:-248,f:"change2S"}],
[{v:"Ａ",i:"A"},{v:"Ｋ",i:"K"},{v:"Ｕ",i:"U"},{v:"〜",i:"~"},{v:"小文字",i:null,w:156,x:-248,f:"change2S"}],
[{v:"改行",w:288,x:ext_pos_x,f:"no_action"},{v:"空白",i:" ",w:288,x:ext_pos_x},
{v:"キーボード移動",f:"move_kbd",w:288,x:ext_pos_x},
{v:"入力位置移動",f:"move_cursor",w:288,h:102,x:ext_pos_x,y:ext_pos_y},
{v:null}],
];
set_param(this.DA_L);
this.DA_S=[
[{v:"３",i:"3"},{v:"６",i:"6"},{v:"９",i:"9"},{v:"＃",i:"#"},{v:""}],
[{v:"２",i:"2"},{v:"５",i:"5"},{v:"８",i:"8"},{v:"０",i:"0"},{v:""}],
[{v:"１",i:"1"},{v:"４",i:"4"},{v:"７",i:"7"},{v:"＊",i:"*"},{v:""}],
[{v:"ｊ",i:"j"},{v:"ｔ",i:"t"},{v:"：",i:":"},{v:"￥",i:"\\"},{v:""}],
[{v:"ｉ",i:"i"},{v:"ｓ",i:"s"},{v:"／",i:"/"},{v:"＆",i:"&"},{v:""}],
[{v:"ｈ",i:"h"},{v:"ｒ",i:"r"},{v:"＠",i:"@"},{v:"？",i:"?"},{v:""}],
[{v:"ｇ",i:"g"},{v:"ｑ",i:"q"},{v:"．",i:"."},{v:"”",i:"\""},{v:""}],
[{v:"ｆ",i:"f"},{v:"ｐ",i:"p"},{v:"ｚ",i:"z"},{v:"’",i:"'"},{v:"！",i:"!"}],
[{v:"ｅ",i:"e"},{v:"ｏ",i:"o"},{v:"ｙ",i:"y"},{v:"；",i:";"},{v:"）",i:")"}],
[{v:"ｄ",i:"d"},{v:"ｎ",i:"n"},{v:"ｘ",i:"x"},{v:"，",i:","},{v:"（",i:"("}],
[{v:"ｃ",i:"c"},{v:"ｍ",i:"m"},{v:"ｗ",i:"w"},{v:"ー",i:"-"},{v:"小文字",i:null,w:156,x:-248,f:"change2L"}],
[{v:"ｂ",i:"b"},{v:"ｌ",i:"l"},{v:"ｖ",i:"v"},{v:"＿",i:"_"},{v:"小文字",i:null,w:156,x:-248,f:"change2L"}],
[{v:"ａ",i:"a"},{v:"ｋ",i:"k"},{v:"ｕ",i:"u"},{v:"〜",i:"~"},{v:"小文字",i:null,w:156,x:-248,f:"change2L"}],
[{v:"改行",w:288,x:ext_pos_x,f:"no_action"},{v:"空白",i:" ",w:288,x:ext_pos_x},
{v:"キーボード移動",f:"move_kbd",w:288,x:ext_pos_x},
{v:"入力位置移動",f:"move_cursor",w:288,h:102,x:ext_pos_x,y:ext_pos_y},
{v:null}],
];
set_param(this.DA_S);
if(typeof init.width=="undefined"){
this.text_box_width=500;}else {
this.text_box_width=init.width;}
this.color_guide_mode="NO_INPUT";
this.input_mode="HIRAGANA";
this.input_data=this.DH;
this.move_cursor_mode=false;
this._set_cursor_pos(0,0);
this.input_char_set="ALL";
this.softkbd_move_p=true;
this.forecast_state=FORECAST_ON;
this.is_forecast_move=false;
this.temp_hook=null;
this.expand_direction="UP";};
IME_SoftKBDInput.prototype=new container({});
IME_SoftKBDInput.prototype.init=function (){
this.last_pos_x=0;
this.last_pos_y=0;}

IME_SoftKBDInput.prototype._set_cursor_pos=function (x,y){
this.pos_x=x;
this.pos_y=y;
this.last_pos_x=0;
this.last_pos_y=0;};

IME_SoftKBDInput.prototype.create_obj=function (){
var this_obj=this;
this.back_img=new gimage(
{
});
this.back_img.free=function (){
this.src="";};
this.back_img.revive=function (){
};
this.text_box=new IME_TextBox(
{
width:this.text_box_width,
text:"",
color:[0,0,0,255],
char_length_limit:100,
});
this.focus=new gbox(
{
translate:[-31,0,0],
width:48,
height:48,
color:[255,255,0,255],
});
this.focus.RATE=0.6;
this.focus.max_count=9;
this.focus.draw_flag=true;
this.focus.dx=0;
this.focus.dy=0;
this.focus.dz=0;
this.focus.dw=0;
this.focus.dh=0;
this.focus.appear=function (){
this.visible_p=true;}

this.focus.disappear=function (){
this.visible_p=false;}

this.focus.setSize=function(w,h,angle){
this.width=w;
this.height=h;}
this.focus.setPosition=function(x,y,z){
this.translate[0]=x;
this.translate[1]=y;
this.translate[2]=z;}
this.focus.moveTo=function(x,y,z,w,h,
end_func){
delete_timer(this);
this.dx=x-this.translate[0];
this.dy=y-this.translate[1];
this.dz=z-this.translate[2];
this.translate[0]+=this.dx*this.RATE;
this.translate[1]+=this.dy*this.RATE;
this.translate[2]+=this.dz*this.RATE;
this.dw=w-this.width;
this.dh=h-this.height;
this.setSize(
this.width+Math.floor(this.dw*this.RATE),
this.height+Math.floor(this.dh*this.RATE)
);
if(this.draw_flag)force_redraw();
append_timer(this,50,function(obj,count){
if(obj.draw_flag)force_redraw();
obj.dx=x-obj.translate[0];
obj.dy=y-obj.translate[1];
obj.dz=z-obj.translate[2];
obj.translate[0]+=obj.dx*obj.RATE;
obj.translate[1]+=obj.dy*obj.RATE;
obj.translate[2]+=obj.dz*obj.RATE;
obj.dw=w-obj.width;
obj.dh=h-obj.height;
obj.setSize(
obj.width+Math.floor(obj.dw*obj.RATE),
obj.height+Math.floor(obj.dh*obj.RATE)
);
if(count>=obj.max_count){
delete_timer(obj);
obj.translate[0]=x;
obj.translate[1]=y;
obj.translate[2]=z;
obj.setSize(w,h);
if(obj.draw_flag)force_redraw();
if(typeof end_func=="function"){
end_func();}
}
});}
this.key_top_cont=new container({});

var obj=this.input_data;
var gtext_gen=function (j,r,g,b){
return new gtext(
{
width:obj[13][j].w,
text:obj[13][j].v,
translate:[obj[13][j].x,obj[13][j].y+2,0],
align:CENTER,
color:[r,g,b,255],
font_size:42
});}

var t_obj=null;
for(var j=0;j<4;j++){
if(j==0){
t_obj=gtext_gen(j,255,255,255);}else {
t_obj=gtext_gen(j,0,0,0);}
this.key_top_cont.components.push(t_obj);}
this.key_top_cont.disable=function (){
for(var j=0;j<4;j++){
this.components[j].color[0]=255;
this.components[j].color[1]=255;
this.components[j].color[2]=255;
setf_text(this.components[j],this.components[j].text);}
};
this.key_top_cont.enable=function (){
this.components[0].color[0]=255;
this.components[0].color[1]=255;
this.components[0].color[2]=255;
setf_text(this.components[0],this.components[0].text);
this.components[1].color[0]=0;
this.components[1].color[1]=0;
this.components[1].color[2]=0;
setf_text(this.components[1],this.components[1].text);
if(this_obj.softkbd_move_p)
this.enable_move_button();
else
this.disable_move_button();
this.components[3].color[0]=0;
this.components[3].color[1]=0;
this.components[3].color[2]=0;
setf_text(this.components[3],this.components[3].text);};
this.key_top_cont.enable_move_button=function (){
this.components[2].color[0]=0;
this.components[2].color[1]=0;
this.components[2].color[2]=0;
setf_text(this.components[2],this.components[2].text);};

this.key_top_cont.disable_move_button=function (){
this.components[2].color[0]=255;
this.components[2].color[1]=255;
this.components[2].color[2]=255;
setf_text(this.components[2],this.components[2].text);};

this.key_top_img=new container(
{
components:[
new gimage(
{
translate:[22,0,0],
}),
new gimage(
{
translate:[22,0,0],
visible_p:false,
}),
new gimage(
{
translate:[22,0,0],
visible_p:false,
}),
new gimage(
{
translate:[22,0,0],
visible_p:false,
}),
]
});
this.key_top_img.set_hiragana=function (){
this.components[0].visible_p=true;
this.components[1].visible_p=false;
this.components[2].visible_p=false;
this.components[3].visible_p=false;};
this.key_top_img.set_katakana=function (){
this.components[0].visible_p=false;
this.components[1].visible_p=true;
this.components[2].visible_p=false;
this.components[3].visible_p=false;};
this.key_top_img.set_alphabet_s=function (){
this.components[0].visible_p=false;
this.components[1].visible_p=false;
this.components[2].visible_p=true;
this.components[3].visible_p=false;};
this.key_top_img.set_alphabet_l=function (){
this.components[0].visible_p=false;
this.components[1].visible_p=false;
this.components[2].visible_p=false;
this.components[3].visible_p=true;};
this.key_top_img.free=function (){
for(var i=0;i<4;i++){
if(this.components[i].visible_p==false){
this.components[i].src="";}
}
}

this.key_top_img.revive=function (){
}

this.key_top_cont.components.push(this.key_top_img);


this.key_move_guide=new container({visible_p:false});

this.key_move_guide.components=[
new gbox(
{
translate:[22,0,0],
color:[170,173,170,255],
width:696,
height:264,
}),
new gtext(
{
translate:[175,50,0],
width:696,
color:[0,0,0,255],
text:"",
align:LEFT,
font_size:42
}),
new gtext(
{
translate:[50,0,0],
width:696,
color:[0,0,0,255],
text:"",
align:LEFT,
font_size:42
}),
new gtext(
{
translate:[50,-50,0],
width:696,
color:[0,0,0,255],
text:"",
align:LEFT,
font_size:42
}),
new gimage(
{
translate:[-240,50,0],
width:125,
height:40,
}),
];
this.key_move_guide.appear=function (){
this.visible_p=true;
this.revive();};
this.key_move_guide.disappear=function (){
this.visible_p=false;
this.free();};
this.key_move_guide.free=function (){
for(var i=1;i<4;i++){
setf_text(this.components[i],"");}
};
this.key_move_guide.revive=function (){
setf_text(this.components[1],"ボタンを操作して");
setf_text(this.components[2],"文字入力位置を変更してください");
setf_text(this.components[3],"決定ボタンで文字入力に戻ります");};

this.key_top_cont.components.push(this.key_move_guide);

var ind_x_pos=1260/2-18-230/2;
var ind_y_pos=284/2-22-48/2+4;
this.mode_indicator=new gtext(
{
width:200,
text:"かな",
translate:[ind_x_pos,ind_y_pos,0],
align:CENTER,
color:[255,255,255,255],
font_size:42
});

var guide_x_pos=1260/2-95;
var guide_y_pos=284/2-22-48/2-2;
var guide_pitch=49;
this.henkan_text=new gtext(
{
width:200,
text:"変換",
translate:[guide_x_pos,guide_y_pos-guide_pitch+2,0],
align:LEFT,
color:[255,255,255,255],
font_size:42,
visible_p:false,
});

this.kakutei_text=new gtext(
{
width:200,
text:"終了",
translate:[guide_x_pos,guide_y_pos-guide_pitch*2,0],
align:LEFT,
color:[255,255,255,255],
font_size:42
});

this.change_text=new gtext(
{
width:200,
text:"文字切換",
translate:[guide_x_pos,guide_y_pos-guide_pitch*3,0],
align:LEFT,
color:[255,255,255,255],
font_size:42
});

this.clear_text=new gtext(
{
width:200,
text:"文字クリア",
translate:[guide_x_pos,guide_y_pos-guide_pitch*4,0],
align:LEFT,
color:[255,255,255,255],
font_size:42
});

var s_mask_pos_x=-248;
var s_mask2_pos_x=-248+this.PITCH*8;
var s_mask_pos_y=this.PITCH*-2;
this.switch_mask=new container(
{
components:[
new gbox(
{
translate:[s_mask_pos_x,s_mask_pos_y,0],
width:156,
height:48,
color:[187,206,238,255]
}),
new gbox(
{
translate:[s_mask2_pos_x,s_mask_pos_y,0],
width:372,
height:50,
color:[68,74,68,255]
})
]
});
this.switch_mask.visible_p=false;

this.wrapper_cont=new container(
{
components:[
this.back_img,
this.switch_mask,
this.focus,
this.key_top_cont,
this.mode_indicator,
this.henkan_text,
this.kakutei_text,
this.change_text,
this.clear_text
]
});

this.components=[
this.wrapper_cont
];
return this.text_box;};
IME_SoftKBDInput.prototype._create_forecast_obj=function (){
if(!this.forecast_base_obj){
this.forecast_base_obj=new container({
translate:[0,205,0],
components:[
new gtext({
width:250,
text:"予測変換",
translate:[555,-5,0],
font_size:42,
})
]
});}
if(!this.forecast_text_obj){
this.forecast_text_obj=new IME_SoftKBDForecastText({translate:[0,205,0]});
this.forecast_text_obj.create_obj();}
this.wrapper_cont.components.unshift(this.forecast_base_obj);
this.wrapper_cont.components.push(this.forecast_text_obj);
this.forecast_text_obj.set_select_forecast_hook(this.temp_hook);}
IME_SoftKBDInput.prototype.set_expand_direction=function (d){
this.expand_direction=d;}
IME_SoftKBDInput.prototype.get_expand_direction=function (){
return this.expand_direction;}
IME_SoftKBDInput.prototype.set_forecast_state=function (state){
this.forecast_state=state;}
IME_SoftKBDInput.prototype.control_forecast_obj=function (){
if(this._is_display_forecast()){
if(!this._exist_forecast_obj()){
this._create_forecast_obj();}
this.forecast_text_obj.init();
this.forecast_base_obj.visible_p=true;
this.forecast_text_obj.display();}else {
this.undisplay_forecast_obj();}
}
IME_SoftKBDInput.prototype.undisplay_forecast_obj=function (){
if(this._exist_forecast_obj()){
this.forecast_base_obj.visible_p=false;
this.forecast_text_obj.undisplay();
this.is_forecast_move=false;}
}
IME_SoftKBDInput.prototype._is_display_forecast=function (){
if(this.forecast_state==FORECAST_ON&&
this.input_mode=="HIRAGANA"){
return true;}else {
return false;}
}
IME_SoftKBDInput.prototype._exist_forecast_obj=function (){
if(this.forecast_base_obj&&
this.forecast_text_obj){
return true;}else {
return false;}
}
IME_SoftKBDInput.prototype._is_cursor_in_forecast=function (){
if(this._is_display_forecast()&&
this._exist_forecast_obj()&&
this.is_forecast_move){
return true;}else {
return false;}
}
IME_SoftKBDInput.prototype._forecast_key_move=function (key){
var ret=this.forecast_text_obj.set_destination(key);
if(!ret){
var pos=
this.forecast_text_obj.cursor_out(key);
this.pos_x=pos[0];
this.pos_y=pos[1];
this.is_forecast_move=false;}
}
IME_SoftKBDInput.prototype._enter_move_cursor_mode=function (mode){
this.key_move_guide.appear();
this.move_cursor_mode=true;
this.focus.disappear();
this.key_top_cont.disable();};
IME_SoftKBDInput.prototype._leave_move_cursor_mode=function (mode){
this.key_move_guide.disappear();
this.move_cursor_mode=false;
this.focus.appear();
this.key_top_cont.enable();};
IME_SoftKBDInput.prototype.is_move_cursor_mode=function (mode){
return this.move_cursor_mode;};

IME_SoftKBDInput.prototype.leave_move_cursor_mode=function (mode){
return this._leave_move_cursor_mode();};
IME_SoftKBDInput.prototype.change_color_guide_mode=function (mode){
if(this.color_guide_mode==mode){
return;}
this.color_guide_mode=mode;

switch(mode){
case "NO_INPUT":
this.henkan_text.visible_p=false;
setf_text(this.kakutei_text,"終了");
this.kakutei_text.visible_p=true;
if(this.input_char_set=="ALL"){
this.change_text.visible_p=true;}else {
this.change_text.visible_p=false;}
this.clear_text.visible_p=true;
break;
case "NO_TRANSLATE":
if(this.input_char_set=="ALL"){
this.henkan_text.visible_p=true;}else {
this.henkan_text.visible_p=false;}
setf_text(this.kakutei_text,"確定");
this.kakutei_text.visible_p=true;
this.change_text.visible_p=false;
this.clear_text.visible_p=true;
break;
case "CURSOR_MOVE":
this.henkan_text.visible_p=false;
this.kakutei_text.visible_p=false;
this.change_text.visible_p=false;
this.clear_text.visible_p=true;
break;}
}
IME_SoftKBDInput.prototype.change_input_char_set=function (obj){
if(obj==null||typeof obj.type=="undefined"){
console.log("[ERROR] Invalid argument.");
return;};
this.input_char_set=obj.type;
switch(this.input_char_set){
case "ALL":
this.set_input_mode("HIRAGANA");
this.change_text.visible_p=true;
break;
case "ALPHABET":
this.set_input_mode("ALPHABET_S");
this.change_text.visible_p=false;
break;
default:
console.log("[ERROR] Invalid type");
break;};}

IME_SoftKBDInput.prototype.toggle_input_mode=function (){
if(this.input_char_set=="ALPHABET"){
switch(this.input_mode){
case "ALPHABET_L":
this.set_input_mode("ALPHABET_S");
break;
case "ALPHABET_S":
this.set_input_mode("ALPHABET_L");
break;
default:
console.log("ERROR: undefined input_mode!");
break;}
}else {
switch(this.input_mode){
case "HIRAGANA":
this.set_input_mode("KATAKANA");
break;
case "KATAKANA":
this.set_input_mode("ALPHABET_S");
break;
case "ALPHABET_L":
this.set_input_mode("HIRAGANA");
break;
case "ALPHABET_S":
this.set_input_mode("HIRAGANA");
break;
default:
console.log("ERROR: undefined input_mode!");
break;}
}
this._set_key_top();};
IME_SoftKBDInput.prototype.get_input_mode=function (mode){
return this.input_mode;};
IME_SoftKBDInput.prototype.set_input_mode=function (mode){
this.input_mode=mode;
switch(mode){
case "HIRAGANA":
this.input_data=this.DH;
break;
case "KATAKANA":
this.input_data=this.DK;
break;
case "ALPHABET_L":
this.input_data=this.DA_L;
break;
case "ALPHABET_S":
this.input_data=this.DA_S;
break;
default:
console.log("ERROR: undefined input_mode!");
break;}
this.control_forecast_obj();
this.adjust_translate();
this._set_key_top();};
IME_SoftKBDInput.prototype.set_key_top=function (){
this._set_key_top();}
IME_SoftKBDInput.prototype._set_key_top=function (){
switch(this.input_mode){
case "HIRAGANA":
setf_text(this.mode_indicator,"かな");
this.switch_mask.visible_p=false;
break;
case "KATAKANA":
setf_text(this.mode_indicator,"カナ");
this.switch_mask.visible_p=false;
break;
case "ALPHABET_S":
case "ALPHABET_L":
this.switch_mask.visible_p=true;
setf_text(this.mode_indicator,"英数");
break;
default:
console.log("ERROR: undefined input_mode!");
break;}
var img_path="";
switch(this.input_mode){
case "HIRAGANA":
this._set_cursor_pos(0,0);
this.key_top_img.set_hiragana();
break;
case "KATAKANA":
this._set_cursor_pos(0,0);
this.key_top_img.set_katakana();
break;
case "ALPHABET_S":
this._set_cursor_pos(12,0);
this.key_top_img.set_alphabet_s();
break;
case "ALPHABET_L":
this._set_cursor_pos(12,0);
this.key_top_img.set_alphabet_l();
break;
default:
console.log("ERROR: undefined input_mode!");
break;}
if(this._is_cursor_in_forecast()){
this._move_forecast_focus(false);}else {
this._move_focus(false);}
};
IME_SoftKBDInput.prototype.set_candidate_info=function (can){
this.forecast_text_obj.set_candidate_info(can);}
IME_SoftKBDInput.prototype.clear=function (){
this.init();
this.text_box.clear();
if(this._is_display_forecast()&&
this._exist_forecast_obj()){
this.forecast_text_obj.init();}
};
IME_SoftKBDInput.prototype.clear_keyboard_only=function (){
this.init();
this.text_box.clear();};
IME_SoftKBDInput.prototype.get_text=function (){
return this.text_box.get_text();};
IME_SoftKBDInput.prototype.get_text_array=function (){
return this.text_box.get_text_array();};
IME_SoftKBDInput.prototype.set_empty_hook=function (func){
return this.text_box.set_empty_hook(func);};
IME_SoftKBDInput.prototype.set_change_text_hook=function (func){
return this.text_box.set_change_text_hook(func);};
IME_SoftKBDInput.prototype.set_select_forecast_hook=function (func){
this.temp_hook=func;};
IME_SoftKBDInput.prototype.set_text=function (text,cursor_pos){
this.text_box.set_text(text,cursor_pos);};
IME_SoftKBDInput.prototype.get_cursor_position=function (){
return this.text_box.get_cursor_position();};
IME_SoftKBDInput.prototype.get_cursor_width=function (){
return this.text_box.get_cursor_width();};
IME_SoftKBDInput.prototype.get_text_width=function (){
return this.text_box.get_text_width();};
IME_SoftKBDInput.prototype.appear=function (){
this.text_box.visible_p=true;};
IME_SoftKBDInput.prototype.disappear=function (){
this.text_box.visible_p=false;
this.text_box.set_text("");};
IME_SoftKBDInput.prototype.appear_kbd=function (){
if(this._is_cursor_in_forecast()){
this._move_forecast_focus(false);}else {
this._move_focus(false);}
this.wrapper_cont.visible_p=true;
this.key_top_img.revive();};
IME_SoftKBDInput.prototype.disappear_kbd=function (){
this.wrapper_cont.visible_p=false;
this.key_top_img.free();};
IME_SoftKBDInput.prototype.disable_move_kbd=function (){
this.softkbd_move_p=false;
this.key_top_cont.disable_move_button();};

IME_SoftKBDInput.prototype.enable_move_kbd=function (){
this.softkbd_move_p=true;
this.key_top_cont.enable_move_button();};

IME_SoftKBDInput.prototype._move_focus=function (anim){
var obj=this.input_data;

if(anim==true){
this.focus.moveTo(
obj[this.pos_x][this.pos_y].x,
obj[this.pos_x][this.pos_y].y,
0,
obj[this.pos_x][this.pos_y].w,
obj[this.pos_x][this.pos_y].h,
null
);}else {
delete_timer(this.focus);
this.focus.setPosition(obj[this.pos_x][this.pos_y].x,
obj[this.pos_x][this.pos_y].y,
0);
this.focus.setSize(obj[this.pos_x][this.pos_y].w,
obj[this.pos_x][this.pos_y].h);}
}
IME_SoftKBDInput.prototype._move_forecast_focus=function (anim){
var obj=this.forecast_text_obj.destination;
if(anim==true){
this.focus.moveTo(
obj.x,
obj.y,
0,
obj.w,
obj.h,
null
);}else {
delete_timer(this.focus);
this.focus.setPosition(obj.x,
obj.y,
0);
this.focus.setSize(obj.w,
obj.h);}
}

IME_SoftKBDInput.prototype._cursor_exception_move=function (direction){
if(this.pos_x==13&&this.pos_y==4){
if(direction=="DOWN"){
this.pos_y=0;
if(this._is_display_forecast()){
this.is_forecast_move=true;
this.forecast_text_obj.cursor_in(this.pos_x,direction);}
}else {
this.pos_y=3;
if(direction=="UP"
&&this._is_display_forecast()){
this.is_forecast_move=true;
this.forecast_text_obj.cursor_in(this.pos_x,direction);}
}
return;}
if(this._is_display_forecast()&&
((direction=="UP"&&this.pos_y==4)
||(direction=="DOWN"&&this.pos_y==0))){
this.is_forecast_move=true;
this.forecast_text_obj.cursor_in(this.pos_x,direction);}
if(this.input_mode=="ALPHABET_S"
||this.input_mode=="ALPHABET_L"){
if(this.pos_y==4){
if(this.pos_x<=6){
if(direction=="RIGHT"){
this.pos_x=13;
this.pos_y=3;}else if(direction=="UP"){
this.pos_y=3;}else {
this.pos_y=0;}
}else if(this.pos_x>=10&&this.pos_x<=12){
if(direction=="RIGHT"&&this.pos_x==10){
this.pos_x=9;}else if(direction=="LEFT"&&this.pos_x==12){
this.pos_x=13;
this.pos_y=3;}else {
this.pos_x=11;}
}
}
}
}

IME_SoftKBDInput.prototype._cursor_up=function (){
this.pos_y--;
if(this.pos_y<0){
this.pos_y=4;}
this._cursor_exception_move("UP");
return true;};
IME_SoftKBDInput.prototype._cursor_down=function (){
this.pos_y++;
if(this.pos_y>4){
this.pos_y=0;}
this._cursor_exception_move("DOWN");
return true;};
IME_SoftKBDInput.prototype._cursor_left=function (){
this.pos_x++;
if(this.pos_x>13){
this.pos_x=0;}
this._cursor_exception_move("LEFT");
return true;};
IME_SoftKBDInput.prototype._cursor_right=function (){
this.pos_x--;
if(this.pos_x<0){
this.pos_x=13;}
this._cursor_exception_move("RIGHT");
return true;};
IME_SoftKBDInput.prototype._move_keyboard=function (){
var tra=this.wrapper_cont.translate;
var _is_forecast=this._is_display_forecast();
var direction=this.get_expand_direction();
if(direction=="DOWN"){
tra[1]=(_is_forecast)?-126:0;}else {
tra[1]=0;}
if(this.softkbd_move_p==false)
return;
if(tra[0]>0){
tra[0]=0;}else {
tra[0]=525;
tra[1]=(_is_forecast)?534:660;}
};
IME_SoftKBDInput.prototype.adjust_translate=function (){
var tra=this.wrapper_cont.translate;
var _is_forecast=this._is_display_forecast();
var direction=this.get_expand_direction();
if(direction=="DOWN"){
tra[1]=(_is_forecast)?-126:0;}else {
tra[1]=0;}
if(this.softkbd_move_p==false)
return;
if(tra[0]>0){
tra[1]=(_is_forecast)?534:660;}
};
IME_SoftKBDInput.prototype._is_handaku_action=function (x,y){
var lx=this.last_pos_x;
var ly=this.last_pos_y;
if((x==7&&y==4)
&&(lx==5)){
return true;}else {
return false;}
};

IME_SoftKBDInput.prototype._is_dakuten_action=function (x,y){
var lx=this.last_pos_x;
var ly=this.last_pos_y;
if((x==7&&y==3)
&&((lx>=1&&lx<=3)||lx==5)){
return true;}else {
return false;}
};

IME_SoftKBDInput.prototype._cursor_ok=function (){
var obj=this.input_data;
var t="";
var x=this.pos_x;
var y=this.pos_y;
var replace_p=false;

if(typeof obj[x][y].f!="undefined"){
switch(obj[x][y].f){
case "move_kbd":
this._move_keyboard();
break;
case "move_cursor":
this._enter_move_cursor_mode();
break;
case "change2S":
this.set_input_mode("ALPHABET_S")
break;
case "change2L":
this.set_input_mode("ALPHABET_L")
break;
case "no_action":
break;}
}else if(this._is_dakuten_action(x,y)){
t=obj[this.last_pos_x][this.last_pos_y].daku;
replace_p=true;}else if(this._is_handaku_action(x,y)){
t=obj[this.last_pos_x][this.last_pos_y].handaku;
replace_p=true;}else if(typeof obj[x][y].i!="undefined"){
t=obj[x][y].i;}else {
t=obj[x][y].v;}

if(t!=null&&t!=""){
if(replace_p==true){
this.text_box.replace_text(t);}else {
this.text_box.add_text(t);}
}

this.last_pos_x=x;
this.last_pos_y=y;

return true;};
IME_SoftKBDInput.prototype._drive_fast_move=function (up_down,keysym){
var keysym_local=keysym;
var this_obj=this;
function do_key(key){
if(this_obj._is_cursor_in_forecast()){
this_obj._forecast_key_move(key);}else {
switch(key){
case TXK_UP:
this_obj._cursor_up();
break;
case TXK_DOWN:
this_obj._cursor_down();
break;
case TXK_LEFT:
this_obj._cursor_left();
break;
case TXK_RIGHT:
this_obj._cursor_right();
break;}
}
}
if(up_down==KEY_DOWN){
this.press_count=0;
do_key(keysym_local);
if(this._is_cursor_in_forecast()){
this._move_forecast_focus(true);}else {
this._move_focus(true);}
}else if(up_down==KEY_UP){
delete_timer(this);}else {this.press_count++;
if(this.press_count==2){
var interval=100;
if(keysym_local==TXK_UP||keysym_local==TXK_DOWN){
interval=150;}
append_timer(this,interval,function (obj,count){
do_key(keysym_local);
if(this._is_cursor_in_forecast()){
this._move_forecast_focus(false);}else {
this._move_focus(false);}
force_redraw();});}
}
};
IME_SoftKBDInput.prototype.key_hook=function (up_down,keysym){
var ret=false;
if(!this.is_move_cursor_mode()
&&(keysym==TXK_UP||keysym==TXK_DOWN
||keysym==TXK_LEFT||keysym==TXK_RIGHT)){
this._drive_fast_move(up_down,keysym);
return true;}

if(up_down!=KEY_PRESS)
return true;
if(this.is_move_cursor_mode()){
switch(keysym){
case TXK_ENTER:
this._leave_move_cursor_mode();
ret=true;
break;
case TXK_LEFT:
if(!this.text_box.is_empty()){
this.text_box.cursor_left();
ret=true;}
break;
case TXK_RIGHT:
if(!this.text_box.is_empty()){
this.text_box.cursor_right();
ret=true;}
break;
case TXK_UP:
case TXK_DOWN:
if(!this.text_box.is_empty()){
ret=true;}
break;
case TXK_YELLOW:
if(!this.text_box.is_empty()){
this.text_box.backspace_text();
ret=true;}
break;};}else {
switch(keysym){
case TXK_ENTER:
if(this._is_cursor_in_forecast()){
ret=this.forecast_text_obj.cursor_ok_forecast();}else {
ret=this._cursor_ok();}
break;
case TXK_RED:
if(this._is_display_forecast()){
this.forecast_text_obj.init();}
break;
case TXK_YELLOW:
if(!this.text_box.is_empty()){
this.text_box.backspace_text();
ret=true;}
break;};}
return ret;};
IME_SoftKBDInput.prototype.free=function (){
this.text_box.free();
this.back_img.free();
this.key_top_img.free();
this.key_move_guide.free();
return;};
IME_SoftKBDInput.prototype.revive=function (){
this.text_box.revive();
this.back_img.revive();
this.key_top_img.revive();
this.key_move_guide.revive();
return;};
function IME_SoftKBDForecastText(init){
this.superClass=container;
this.superClass(init);
this.FC={
"word_0":{n:"word_0",x:-340,y:228,z:0,w:432,h:48,i:0},
"word_1":{n:"word_1",x:-340,y:174,z:0,w:432,h:48,i:1},
"word_2":{n:"word_2",x:98,y:228,z:0,w:432,h:48,i:2},
"word_3":{n:"word_3",x:98,y:174,z:0,w:432,h:48,i:3},
"left_arrow":{n:"left_arrow",x:-586,y:200,z:0,w:48,h:102,i:null},
"right_arrow":{n:"right_arrow",x:346,y:200,z:0,w:48,h:102,i:null}
}
this.step="UPPER";
this.candidate=[];
this.page=0;
this.max_page_num=0;
this.last_pos_x=null;
this.select_forecast_hook=null;}
IME_SoftKBDForecastText.prototype=new container({});
IME_SoftKBDForecastText.prototype.create_obj=function (){
this.forecast_word=new container({});
function gen_word_list(){
var array=[];
for(var i=0;i<4;i++){
var x=0;
var y=0;
if((i%2)==0){
y=25;}else {
y=-29;}
if(i>=2){
x=100;}else {
x=-340;}
var candidate_text=new gtext({
width:374,
translate:[x,y,0],
color:[0,0,0,255],
text:"",
omitter:"...",
font_size:42,
align:CENTER
});
array.push(candidate_text);}
return array;}
this.forecast_word.components=gen_word_list();
this.arrow_img=new container(
{
translate:[-120,-5,0],
components:[
new gimage({
translate:[467,0,0],
}),
new gimage({
translate:[-467,0,0],
rotation:[180,0,0,1],
})
]
});
this.components=[
this.forecast_word,
this.arrow_img,
];}
IME_SoftKBDForecastText.prototype.cursor_in=function (pos_x,direction){
var json_name=this.FC;
var json={};
switch(pos_x){
case 0:
json=json_name["right_arrow"];
break;
case 1:case 2:case 3:case 4:
case 5:case 6:case 7:case 8:
if(direction=="UP"){
json=json_name["word_3"];
this.step="LOWER";}else {
json=json_name["word_2"];
this.step="UPPER";}
this.last_pos_x=pos_x;
break;
case 9:case 10:case 11:case 12:
if(direction=="UP"){
json=json_name["word_1"];
this.step="LOWER";}else {
json=json_name["word_0"];
this.step="UPPER";}
this.last_pos_x=pos_x;
break;
case 13:
json=json_name["left_arrow"];
break;}
this.destination=json;
this.last_obj_name=json.n;}
IME_SoftKBDForecastText.prototype.cursor_out=function (key){
var last_obj=this.last_obj_name;
var x=0;
var y=0;
switch(last_obj){
case "word_0":
if(this.last_pos_x){
x=this.last_pos_x;}else {
x=12;}
y=4;
break;
case "word_1":
if(this.last_pos_x){
x=this.last_pos_x;}else {
x=12;}
y=0;
break;
case "word_2":
if(this.last_pos_x){
x=this.last_pos_x;}else {
x=4;}
y=4;
break;
case "word_3":
if(this.last_pos_x){
x=this.last_pos_x;}else {
x=4;}
y=0;
break;
case "left_arrow":
if(key==TXK_UP){
x=13;y=3;}else {
x=13;y=0;}
break;
case "right_arrow":
x=0;
if(key==TXK_UP){
y=4;}else {
y=0;}
break;}
this.last_pos_x=null;
return [x,y];}
IME_SoftKBDForecastText.prototype.set_destination=function (key){
var last_obj=this.last_obj_name;
var json_name=this.FC;
var json={};
if(key==TXK_LEFT||key==TXK_RIGHT){
this.last_pos_x=null;}
switch(last_obj){
case "word_0":
switch(key){
case TXK_DOWN:
json=json_name["word_1"];
this.step="LOWER";
break;
case TXK_LEFT:
json=json_name["left_arrow"];
break;
case TXK_RIGHT:
json=json_name["word_2"];
break;
default:
return false;}
break;
case "word_1":
switch(key){
case TXK_UP:
json=json_name["word_0"];
this.step="UPPER";
break;
case TXK_LEFT:
json=json_name["left_arrow"];
break;
case TXK_RIGHT:
json=json_name["word_3"];
break;
default:
return false;}
break;
case "word_2":
switch(key){
case TXK_DOWN:
json=json_name["word_3"];
this.step="LOWER";
break;
case TXK_LEFT:
json=json_name["word_0"];
break;
case TXK_RIGHT:
json=json_name["right_arrow"];
break;
default:
return false;}
break;
case "word_3":
switch(key){
case TXK_UP:
json=json_name["word_2"];
this.step="UPPER";
break;
case TXK_LEFT:
json=json_name["word_1"];
break;
case TXK_RIGHT:
json=json_name["right_arrow"];
break;
default:
return false;}
break;
case "left_arrow":
switch(key){
case TXK_LEFT:
json=json_name["right_arrow"];
break;
case TXK_RIGHT:
if(this.step=="LOWER"){
json=json_name["word_1"];}else {
json=json_name["word_0"];}
break;
default:
return false;}
break;
case "right_arrow":
switch(key){
case TXK_LEFT:
if(this.step=="LOWER"){
json=json_name["word_3"];}else {
json=json_name["word_2"];}
break;
case TXK_RIGHT:
json=json_name["left_arrow"];
break;
default:
return false;}
break;}
this.destination=json;
this.last_obj_name=this.destination.n;
return true;}
IME_SoftKBDForecastText.prototype.display=function (){
this.visible_p=true;}
IME_SoftKBDForecastText.prototype.undisplay=function (){
this.visible_p=false;}
IME_SoftKBDForecastText.prototype.init=function (){
this._clear_word_list();
this.candidate=[];
this.page=0;
this.max_page_num=0;}
IME_SoftKBDForecastText.prototype.set_candidate_info=function (candidate){
if(candidate==""){
this.init();
return;}
var max_word_num=candidate.length;
this.candidate=candidate;
this.page=0;
this.max_page_num=Math.ceil(max_word_num/4);
this._set_word_list();}
IME_SoftKBDForecastText.prototype._set_word_list=function (){
for(var i=0;i<4;i++){
if(this.candidate[this.page*4+i]){
var str=this.candidate[this.page*4+i];
setf_text(this.forecast_word.components[i],str);}else {
setf_text(this.forecast_word.components[i],"");}
}
}
IME_SoftKBDForecastText.prototype._clear_word_list=function (){
for(var i=0;i<4;i++){
setf_text(this.forecast_word.components[i],"");}
}
IME_SoftKBDForecastText.prototype._page_next=function (){
this.page++;
if(this.page>=this.max_page_num){
this.page=0;}
this._set_word_list();}
IME_SoftKBDForecastText.prototype._page_prev=function (){
this.page--;
if(this.page<0){
this.page=this.max_page_num-1;}
this._set_word_list();}
IME_SoftKBDForecastText.prototype.cursor_ok_forecast=function (){
var ret=false;
var obj_name=this.last_obj_name;
switch(obj_name){
case "left_arrow":
this._page_prev();
ret=true;
break;
case "right_arrow":
this._page_next();
ret=true;
break;
case "word_0":
case "word_1":
case "word_2":
case "word_3":
var json=this.FC;
this.word_num=this.page*4+json[obj_name].i;
this._set_decide_word();
ret=true;
break;
default:
console.log("[ERROR] last_obj_name is wrong.");
ret=true;
break;}
return ret;}
IME_SoftKBDForecastText.prototype._set_decide_word=function (){
if(this.candidate[this.word_num]){
var word=this.candidate[this.word_num];
this.select_forecast_hook(word,this.word_num);}
}
IME_SoftKBDForecastText.prototype.set_select_forecast_hook=function (func){
this.select_forecast_hook=func;}
function IME_USBKBDInput(init){
this.superClass=container;
this.superClass(init);
if(typeof init.width=="undefined"){
this.text_box_width=500;}else {
this.text_box_width=init.width;}
this.mode=HIRA_TYPE;
this.form=ROMA_INPUT;
this.class_name="__INPUT_OBJECT__";
this._make_obj=false;
this.call_setting_hook=null;
this.method_show_text_NO_TRANSLATE_hook=function (){};
this.romkan_converter=null;}
IME_USBKBDInput.prototype=new container({});
IME_USBKBDInput.prototype.create_obj=function (){
console_log(">> IME_USBKBDInput.prototype.create_obj");
var tbox_skin=SKIN.tbox;
this.text_box=new IME_TextBox(
{
width:this.text_box_width,
text:"",
color:[255,255,255,255],
bg_color:tbox_skin.bg_ime_c.slice(),
support_5stroke:false,
char_length_limit:60
});
this.components=[
this.text_box
];
require("pkg_romkan");
this.romkan_converter=new pkg_romkan.IME_RomKan({});
this._make_obj=true;};
IME_USBKBDInput.prototype.init=function (){
console_log(">> IME_USBKBDInput.prototype.init");
this.mode=HIRA_TYPE;
this.form=this.call_setting_hook("usb_input_form");
if(this.form==null){
this.form=ROMA_INPUT;}
this.clear_text();};
IME_USBKBDInput.prototype.init_stack=function (){
console_log(">> IME_USBKBDInput.prototype.init_stack");
this.romkan_converter.init();};
IME_USBKBDInput.prototype.appear=function (){
console_log(">> IME_USBKBDInput.prototype.appear");
this.visible_p=true;};
IME_USBKBDInput.prototype.disappear=function (){
console_log(">> IME_USBKBDInput.prototype.disappear");
this.visible_p=false;};
IME_USBKBDInput.prototype.clear=function (){
console_log(">> IME_USBKBDInput.prototype.clear");
this.text_box.clear();};
IME_USBKBDInput.prototype.clear_text=function (){
console_log(">> IME_USBKBDInput.prototype.clear_text");
this.text_box.set_text("");
this.init_stack();};
IME_USBKBDInput.prototype.get_text=function (){
console_log(">> IME_USBKBDInput.prototype.get_text");
return this.text_box.get_text();};
IME_USBKBDInput.prototype.get_text_array=function (){
console_log(">> IME_USBKBDInput.prototype.get_text_array");
return this.text_box.get_text_array();};
IME_USBKBDInput.prototype.get_text_width=function (){
console_log(">> IME_USBKBDInput.prototype.get_text_width");
return this.text_box.get_text_width();};
IME_USBKBDInput.prototype.get_make_obj=function (){
console_log(">> IME_USBKBDInput.prototype.get_make_obj");
return this._make_obj;};
IME_USBKBDInput.prototype.get_char_type=function (){
console_log(">> IME_USBKBDInput.prototype.get_char_type");
return this.mode;};
IME_USBKBDInput.prototype.set_char_type=function (type){
console_log(">> IME_USBKBDInput.prototype.set_char_type");
this.mode=type;};
IME_USBKBDInput.prototype.set_text=function (text,cursor_pos){
console_log(">> IME_USBKBDInput.prototype.set_text");
return this.text_box.set_text(text,cursor_pos);};
IME_USBKBDInput.prototype.set_empty_hook=function (func){
console_log(">> IME_USBKBDInput.prototype.set_empty_hook");
return this.text_box.set_empty_hook(func);};
IME_USBKBDInput.prototype.set_change_text_hook=function (func){
console_log(">> IME_USBKBDInput.prototype.set_change_text_hook");
return this.text_box.set_change_text_hook(func);};
IME_USBKBDInput.prototype.set_call_setting_hook=function (hook){
console_log(">> IME_USBKBDInput.prototype.set_call_setting_hook");
this.call_setting_hook=hook
};
IME_USBKBDInput.prototype.set_method_show_text_NO_TRANSLATE_hook=function (hook){
if(typeof hook=="function"){
this.method_show_text_NO_TRANSLATE_hook=hook;}
};
IME_USBKBDInput.prototype.is_alphabet_only=function (){
console_log(">> IME_USBKBDInput.prototype.is_alphabet_only");
var text=this.text_box.get_text();
var regexp=/[^a-zA-Z]/;
if(text.match(regexp)){
return false;}else {
return true;}
};
IME_USBKBDInput.prototype.key_hook=function (up_down,keysym){
console_log(">>> IME_USBKBDInput.prototype.key_hook");
var self=this;
var ret=false;
if(up_down!=KEY_PRESS)
return true;
if(keysym.type==keysym.CHAR){
switch(keysym.code){
case " ":
if(this.mode==HIRA_TYPE||
this.mode==KATA_TYPE){
this.text_box.add_text("　");
this.show_text_NO_TRANSLATE();}else if(this.mode==EISU_TYPE||
this.mode==NUM_TYPE){
this.text_box.add_text(" ");
this.show_text_NO_TRANSLATE();}
ret=true;
break;
default:
ret=this._input_char(keysym);
break;}
}else {
switch(keysym.code){
case TXKB_Left:
case TXKB_Right:
if(keysym.code==TXKB_Left){
this.text_box.cursor_left();}else {
this.text_box.cursor_right();}
var a=this.text_box.get_text_array_left();
this.romkan_converter.set_array_left(a,this.form);
this.show_text_NO_TRANSLATE();
ret=true;
break;
case TXKB_BackSpace:
ret=this.backspace_action();
break;
case TXKB_Delete:
this.text_box.delete_right_text();
this.show_text_NO_TRANSLATE();
ret=true;
break;
case TXKB_Shift_L:
case TXKB_Shift_R:
ret=true;
break;
default:
break;}
}
return ret;};
IME_USBKBDInput.prototype._input_char=function (keysym){
console_log(">> IME_USBKBDInput.prototype._input_char");
var ret=false;
if(typeof keysym.code!="string")
return true;
if(this._is_tenkey(keysym)){
this._char_direct_input(keysym.code);
return true;}
switch(this.form){
case ROMA_INPUT:
ret=this._roma_input_char(keysym);
break;
case KANA_INPUT:
ret=this._kana_input_char(keysym);
break;
default:
console.log("[ERROR] Illegal input form!");
break;}
return ret;};
IME_USBKBDInput.prototype._roma_input_char=function (keysym){
console_log(">> IME_USBKBDInput.prototype._roma_input_char");
var ret=false;
switch(this.mode){
case HIRA_TYPE:
case KATA_TYPE:
ret=this._char_roma_input(keysym);
break;
case EISU_TYPE:
case NUM_TYPE:
ret=this._char_direct_input(keysym);
break;
default:
console.log("[ERROR] Illegal input mode!");
break;}
return ret;};
IME_USBKBDInput.prototype._kana_input_char=function (keysym){
console_log(">> IME_USBKBDInput.prototype._kana_input_char");
var ret=false;
switch(this.mode){
case HIRA_TYPE:
case KATA_TYPE:
ret=this._char_kana_input(keysym);
break;
case EISU_TYPE:
case NUM_TYPE:
ret=this._char_direct_input(keysym);
break;
default:
console.log("[ERROR] Illegal input mode!");
break;}
return ret;};
IME_USBKBDInput.prototype._char_roma_input=function (keysym){
console_log(">> IME_USBKBDInput.prototype._char_roma_input");
this.text_box.add_text(keysym.code);
var r=this.romkan_converter.romkan_conv(keysym,this.form,this.mode);
if(r){
var kana=r.kana;
var len=r.length;
if(len<=0){
console.log("[ERROR] Fatal convert!");
return false;}
this.text_box.replace_romaji_text(kana,len);}
this.show_text_NO_TRANSLATE();
return true;};
IME_USBKBDInput.prototype._char_kana_input=function (keysym){
console_log(">> IME_USBKBDInput.prototype._char_kana_input");
var r=this.romkan_converter.romkan_conv(keysym,this.form,this.mode);
if(r){
var kana=r.kana;
var len=r.length;
if(len<=0){
console_log("[ERROR] Fatal convert!");
return false;}
var chara=keysym.code;
if(((chara=="@"||chara=="`")&&kana!="゛")||
(chara=="["&&kana!="゜")){
this.text_box.replace_romaji_text(kana,len);}else {
this.text_box.add_text(kana);}
}
this.show_text_NO_TRANSLATE();

return true;};
IME_USBKBDInput.prototype._char_direct_input=function (keysym){
console_log(">> IME_USBKBDInput.prototype._char_direct_input");
var chara="";
if(typeof keysym=="object"){
chara=keysym.code;}else if(typeof keysym=="string"){
chara=keysym;}
this.text_box.add_text(chara);
this.show_text_NO_TRANSLATE();
return true;};
IME_USBKBDInput.prototype.backspace_action=function (){
console_log(">> IME_USBKBDInput.prototype.backspace_action");
this.text_box.delete_left_text();
var a=this.text_box.get_text_array_left();
this.romkan_converter.set_array_left(a,this.form);
this.show_text_NO_TRANSLATE();
return true;};
IME_USBKBDInput.prototype._is_tenkey=function (keysym){
console_log(">> IME_USBKBDInput.prototype._is_tenkey");
var ret=false;
switch(keysym.scancode){
case 84:case 85:case 86:case 87:case 89:case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:ret=true;}
return ret;};
IME_USBKBDInput.prototype.show_text_NO_TRANSLATE=function (){
this.method_show_text_NO_TRANSLATE_hook(
this.text_box.get_text(),this.text_box.get_cursor_pos());};
function IME_Converter(init){
this.superClass=container;
this.superClass(init);
if(typeof init.width=="undefined"){
this.text_box_width=500;}else {
this.text_box_width=init.width;}
this.scroll_menu=null;
this.method_converter_updated_hook=function(){};};
IME_Converter.prototype=new container({});
IME_Converter.prototype.overwrite_scroll_menu_obj=function (obj){
this.scroll_menu=obj;};
IME_Converter.prototype.set_method_converter_updated_hook=function (hook){
this.method_converter_updated_hook=hook;};
IME_Converter.prototype.create_obj=function (){
var cvt_skin=SKIN.converter;
var bg_height=skin_func.calc_rate(40);
this.base=new gbox(
{
translate:[0,0,0],
width:0,
height:bg_height,
color:cvt_skin.base_c
});

this.input_l=new gtext(
{
width:this.text_box_width,
translate:[0,0,0],
text:"",
color:cvt_skin.input_l_c,
align:LEFT,
font_size:skin_func.calc_rate(32)
});
this.input_r=new gtext(
{
width:this.text_box_width,
translate:[0,0,0],
text:"",
color:cvt_skin.input_r_c,
align:LEFT,
font_size:skin_func.calc_rate(32),
omitter:"..."
});
this.bg_l=new gbox(
{
width:0,
translate:[0,0,0],
color:cvt_skin.bg_l_c,
height:bg_height
});

this.u_bar_l=new gbox(
{
width:0,
translate:[0,skin_func.calc_rate(-20),0],
height:skin_func.calc_rate(2),
color:cvt_skin.u_bar_l_c
});
this.u_bar_r=new gbox(
{
width:0,
translate:[0,skin_func.calc_rate(-20),0],
height:skin_func.calc_rate(2),
color:cvt_skin.u_bar_r_c
});
if(!this.scroll_menu)
this.scroll_menu=new IME_ScrollSelection({});
this.scroll_menu.create_obj();
this.scroll_menu.set_translate([-Math.floor(this.text_box_width/2),-40,0]);
this.min_width=this.scroll_menu.MIN_CHAR*this.scroll_menu.CHAR_WIDTH+this.scroll_menu.BAR_WIDTH+10;
this.components=[
this.base,
this.scroll_menu,
this.bg_l,
this.input_l,
this.input_r,
this.u_bar_l,
this.u_bar_r,
];
this.mode="NO_INPUT";
this.do_forecast=null;
this.char_type=HIRA_TYPE;
this.visible_p=false;};
IME_Converter.prototype.set_str=function (stroke){
this.disable_do_forecast();
this.init();
this.str=stroke;
this.conv();};
IME_Converter.prototype.do_forecast_again=function (stroke){
var candidate=this.get_forecast_result("");
if(candidate==""){
this.disable_do_forecast();
return false;}else {
this.enable_do_forecast();
this.init();
this.str="";
this.mwnn={
candidate:[candidate[0]],
stroke:[this.str]
};
this.zenkouho=candidate.slice(0);
this.update(1);
this.scroll_menu.set_candidate(candidate);
this.scroll_menu.appear_without_cursor();
return true;}
}
IME_Converter.prototype.get_forecast_result=function (stroke){
var candidate=ebus.mwnn.forecast(stroke);
return candidate;}
IME_Converter.prototype.set_forecast_candidate=function (num){
ebus.mwnn.set_forecast(num);}
IME_Converter.prototype.is_now_forecast=function (){
if(this.do_forecast){
return true;}else {
return false;}
}
IME_Converter.prototype.enable_do_forecast=function (){
this.do_forecast=true;}
IME_Converter.prototype.disable_do_forecast=function (){
this.do_forecast=false;}
IME_Converter.prototype.display_forecast_list=function (stroke){
var candidate=null;
this.init();
this.str=stroke;
candidate=this.get_forecast_result(this.str);
if(candidate==""||
stroke==""){
this.finish();
this.disable_do_forecast();
return false;}
this.enable_do_forecast();
this.mwnn={
candidate:[candidate[0]],
stroke:[this.str]
};
this.zenkouho=candidate.slice(0);
this._move_caret(stroke,stroke.length);
this.scroll_menu.set_candidate(candidate);
this.scroll_menu.appear_without_cursor();
return true;};
IME_Converter.prototype.select_forecast_candidate=function (){
this.kouho_no=0;
this._move_caret(this.mwnn.candidate.join(""),this.mwnn.candidate[0].length);
this.scroll_menu.appear();}
IME_Converter.prototype.init=function (){
this.mwnn=null;
this.ret_str=null;
this.caret=0;
this.visible_p=true;};
IME_Converter.prototype.finish=function (){
this.str=null;
this.str_l="";
this.str_r="";
this.caret=0;
this.scroll_menu.disappear();
this.visible_p=false;
this.mwnn=null;};
IME_Converter.prototype.change_mode=function (mode){
if(this.mode==mode)
return;
this.pre_mode=this.mode;
this.mode=mode;
switch(mode){
case "NO_INPUT":
case "NO_TRANSLATE":
case "TRANSLATE":
break;
case "ADJUST":
this.scroll_menu.disappear();
break;};};
IME_Converter.prototype.change_char_type=function (type){
this.char_type=type;}
IME_Converter.prototype.update=function (pos){
var str_l=this.str.substring(0,pos);
var str_r=this.str.substring(pos);
var margin=1;
var text_l_width=get_text_width(this.input_l,str_l);
var text_r_width=get_text_width(this.input_r,str_r);
if(text_r_width!=0)
text_r_width+=margin;
if(text_l_width>this.text_box_width){
if(this.char_type!=HIRA_TYPE){
this.input_l.omitter="...";
this.str_l=str_l;
this.input_l.width=this.text_box_width;
setf_text(this.input_l,this.str_l);
this.u_bar_l.width=this.input_l.width;
this.u_bar_l.translate[0]=Math.floor(-this.text_box_width/2+this.input_l.width/2);
this.input_l.translate[0]=this.u_bar_l.translate[0];
this.bg_l.width=this.input_l.width;
this.bg_l.translate[0]=this.u_bar_l.translate[0];}
this.input_l.omitter="";
return false;}
if(text_l_width+text_r_width>this.text_box_width)
text_r_width=this.text_box_width-text_l_width;
this.str_l=str_l;
this.str_r=str_r;
this.input_l.width=text_l_width;
this.input_r.width=text_r_width;
setf_text(this.input_l,this.str_l);
setf_text(this.input_r,this.str_r);
this.u_bar_l.width=text_l_width;
this.u_bar_l.translate[0]=Math.floor(-this.text_box_width/2+text_l_width/2);
this.input_l.translate[0]=this.u_bar_l.translate[0];
this.bg_l.width=text_l_width;
this.bg_l.translate[0]=this.u_bar_l.translate[0];
this.u_bar_r.width=text_r_width;
this.u_bar_r.translate[0]=Math.floor(-this.text_box_width/2+text_r_width/2)+text_l_width;
this.input_r.translate[0]=this.u_bar_r.translate[0];
this.base.width=text_l_width+text_r_width;
this.base.translate[0]=Math.floor(-this.text_box_width/2+this.base.width/2);
return true;}
IME_Converter.prototype._move_caret=function (str,pos){
var ret=false;
this.str=str;
if(pos<1){
ret=false;}else if(pos>str.length){
ret=false;}else {
ret=this.update(pos);}
if(ret==true)
this.caret=pos;
return ret;};
IME_Converter.prototype.move_caret=function (num){
var ret=false;
switch(this.mode){
case "TRANSLATE":
if(this.char_type==HIRA_TYPE){
if(this.mwnn==null)
ret=this._move_caret(this.str,this.caret+num);
else
ret=this._move_caret(this.mwnn.stroke.join(""),this.mwnn.stroke[0].length+num);}else{
ret=false;}
break;
case "ADJUST":
ret=this._move_caret(this.str,this.caret+num);
break;}
return ret;}
IME_Converter.prototype.decide=function(){
switch(this.mode){
case "TRANSLATE":
if(this.char_type==HIRA_TYPE){
if(this.is_now_forecast()){
this.set_forecast_candidate(this.kouho_no);}else {
ebus.mwnn.set_jikouho(0,this.kouho_no);
ebus.mwnn.update_hindo(1);}
}
this.ret_str=this.zenkouho[this.kouho_no];
this.mwnn.candidate.shift();
this.mwnn.stroke.shift();
if(this.mwnn.candidate.length==0){
this.finish();}else{
this.kouho_no=0;
this._move_caret(this.mwnn.candidate.join(""),this.mwnn.candidate[0].length);
this.zenkouho=ebus.mwnn.zenkouho(0);
this.scroll_menu.set_candidate(this.zenkouho);
this.scroll_menu.appear();}
break;
case "ADJUST":
this.ret_str=this.str_l;
if(this.str.length==this.caret){
this.finish();}else{
this.str=this.str_r;
this._ren_conv_to_hira();}
break;}
};
IME_Converter.prototype.conv=function(){
this.kouho_no=0;
switch(this.char_type){
case HIRA_TYPE:
this._hira_conv();
break;
case KATA_TYPE:
this._kata_conv();
break;
case EISU_TYPE:
this._eisu_conv();
break;
case NUM_TYPE:
default:
console.log("[ERROR] Illegal input mode!",this.char_type);
break;}
this.scroll_menu.set_candidate(this.zenkouho);
this.scroll_menu.appear();
this.method_converter_updated_hook();};
IME_Converter.prototype._hira_conv=function (){
switch(this.mode){
case "TRANSLATE":
this._ren_conv();
break;
case "ADJUST":
if(this.mwnn!=null)
this._nobi_conv();
else
this._ren_conv();
break;
default:
console.log("[ERROR] Illegal mode!",this.mode);
break;}
this.zenkouho=ebus.mwnn.zenkouho(0);};
IME_Converter.prototype._ren_conv=function (){
if(this.str.length>100){
console.log("[ERROR] too long strings to convert.");
return;}
this.mwnn=ebus.mwnn.ren_conv(this.str);
this._move_caret(this.mwnn.candidate.join(""),this.mwnn.candidate[0].length);};
IME_Converter.prototype._ren_conv_to_hira=function (){
if(this.str.length>100){
console.log("[ERROR] too long strings to convert.");
return;}
this.mwnn=ebus.mwnn.ren_conv(this.str);
this._move_caret(this.mwnn.stroke.join(""),this.mwnn.stroke[0].length);};
IME_Converter.prototype._nobi_conv=function (){
if(this.str.length>100){
console.log("[ERROR] too long strings to convert.");
return;}
this.mwnn=ebus.mwnn.nobi_conv(0,this.caret);
this._move_caret(this.mwnn.candidate.join(""),this.mwnn.candidate[0].length);};
IME_Converter.prototype._kata_conv=function (){
this.mwnn=new Object;
this.mwnn.stroke=[this.str.slice(0)];
this.mwnn.candidate=[this.str.slice(0)];
this._move_caret(this.mwnn.candidate[0],this.mwnn.candidate[0].length);
this.zenkouho=ebus.mwnn.kata_conv(this.str);};
IME_Converter.prototype._eisu_conv=function (){
this.mwnn=new Object;
this.mwnn.stroke=[this.str.slice(0)];
this.mwnn.candidate=[this.str.slice(0)];
this._move_caret(this.mwnn.candidate[0],this.mwnn.candidate[0].length);
this.zenkouho=ebus.mwnn.eisu_conv(this.str);};
IME_Converter.prototype.update_kouho=function (){
console_log(">> IME_Converter.prototype.update_kouho");
this.kouho_no=this.scroll_menu.get_cursor_position();
console_log(">>> this.kouho_no = "+this.kouho_no);
this._move_caret(this.zenkouho[this.kouho_no]+this.str_r,
this.zenkouho[this.kouho_no].length);
this.method_converter_updated_hook();};
IME_Converter.prototype.cancel=function (){
if(this.mwnn==null)
this.ret_str=this.str;
else
this.ret_str=this.mwnn.stroke.join("");
this.finish();};
IME_Converter.prototype.get_width=function (){
return this.scroll_menu.get_width();};
IME_Converter.prototype.get_text_width=function (){
return this.u_bar_r.width+this.u_bar_l.width;};
IME_Converter.prototype.get_text=function (){
return this.str;};
IME_Converter.prototype.get_convert_info=function (){
var convert_info=[];
var str=this.str?this.str:"";
var h_pos=0;
var c_pos=this.input_l.text.length;
var t_pos=str.length;
convert_info.push(str,{h:c_pos,t:c_pos},2,{h:h_pos,t:c_pos},{h:c_pos,t:t_pos});
return convert_info;};
IME_Converter.prototype.up=function (){
switch(this.mode){
case "TRANSLATE":
if(this.mwnn==null){
this.conv();}else{
this.scroll_menu.up();
this.update_kouho();}
break;
case "ADJUST":
this.conv();
break;}
};
IME_Converter.prototype.down=function (){
switch(this.mode){
case "TRANSLATE":
if(this.mwnn==null){
this.conv();}else{
this.scroll_menu.down();
this.update_kouho();}
break;
case "ADJUST":
this.conv();
break;}
};
IME_Converter.prototype.scroll_up=function (){
this.scroll_menu.scroll_up();
this.update_kouho();};
IME_Converter.prototype.scroll_down=function (){
this.scroll_menu.scroll_down();
this.update_kouho();};
IME_Converter.prototype.key_hook=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
if(ebus.kbd.supported&&((typeof keysym)=="object")){
if(keysym.type==keysym.CHAR){
switch(keysym.code){
case " ":
if(keysym.scancode==TXKB_SC_Muhenkan){
this.cancel();}else {
this.down();}
ret=true;
break;
default:
break;}
}else {
switch(keysym.code){
case TXKB_Up:
this.up();
ret=true;
break;
case TXKB_Down:
this.down();
ret=true;
break;
case TXKB_Return:
this.decide();
this.method_converter_updated_hook();
ret=true;
break;
case TXKB_Left:
ret=this.move_caret(-1);
if(ret)
this.method_converter_updated_hook();
break;
case TXKB_Right:
ret=this.move_caret(+1);
if(ret)
this.method_converter_updated_hook();
break;
case TXKB_F12:
this.cancel();
this.method_converter_updated_hook();
ret=true;
break;
case TXKB_Page_Up:
this.scroll_up();
ret=true;
break;
case TXKB_Page_Down:
this.scroll_down();
ret=true;
break;
case TXKB_BackSpace:
this.cancel();
ret=true;
break;
default:
break;}
}
return ret;}
switch(keysym){
case TXK_UP:
this.up();
ret=true;
break;
case TXK_DOWN:
this.down();
ret=true;
break;
case TXK_LEFT:
ret=this.move_caret(-1);
break;
case TXK_RIGHT:
ret=this.move_caret(+1);
break;
case TXK_ENTER:
this.decide();
ret=true;
break;
case TXK_RETURN:
case TXK_YELLOW:
this.cancel();
ret=false;
break;
default:
break;}
return ret;};
IME_Converter.prototype.free=function (){
this.finish();
return;};
IME_Converter.prototype.revive=function (){
return;};
function IME_Master(init){
this.superClass=container;
this.superClass(init);
this.input_softkbd=null;
this.scroll_menu_obj=null;
this.mode_change_event_hook=function (){};
this.method_from_usbkbd_change_event_hook=function (){};
this.method_add_text_hook=function (){};
this.method_enter_backspace_hook=function (){};
this.method_translate_cancel_hook=function (){};
this.method_cancel_to_NO_TRANSLATE_hook=function(){};
this.method_converter_updated_hook=function (){};
this.method_show_text_usb_NO_TRANSLATE_hook=function(){};};
IME_Master.prototype=new container({});
IME_Master.prototype.overwrite_softkbd_obj=function (obj){
this.input_softkbd=obj;};
IME_Master.prototype.overwrite_scroll_menu_obj=function (obj){
this.scroll_menu_obj=obj;};
IME_Master.prototype.create_obj=function (arg){
var this_obj=this;
this.last_cursor=null;
this.pre_mode="NO_INPUT";
this.mode="NO_INPUT";
this.char_type=HIRA_TYPE;
this.pre_char_type=HIRA_TYPE;
this.is_direct_input=false;
this.is_softkbd_finished=false;
this.is_enable_move_kbd=true;
this.pre_method=null;
this.stage=null;
this.txkb_keysym=null;
this.usb_kbd=null;
this.sphone_input_mode=null;
this.sphone_kbd_type=null;
this.expand_direction_softkbd="UP";
var last_input_method=this.get_keyboard_type();
if(last_input_method=="software")
this.input_method=IME_SOFTKBD;
else
this.input_method=IME_5STROKE;
var last_forecast_state=this.get_forecast_state();
if(last_forecast_state=="forecast"){
this.forecast_state=FORECAST_ON;}else {
this.forecast_state=FORECAST_OFF;}
this.UserHookFunc=function(){};
var base=new gbox({
translate:[0,0,0],
height:50,
width:this.text_box_width+20,
color:[255,255,255,255]
});
this.area_actor=new actor({
base_col_width:0,
cursor_width:0,
in_cursor:false,
enter_focus:function (obj){
try{
ebus.mwnn.disconnect();}catch(x){
}
ebus.mwnn.connect();
if(this_obj.is_direct_input||this_obj.char_type==NUM_TYPE)
this_obj.change_mode("DIRECT_INPUT");
else
this_obj.change_mode("NO_INPUT");
this_obj.switch_menu.change_mode("INPUT");
this_obj.color_key_guide.change_mode("NO_INPUT");
this_obj.text_box.enable_cursor();
switch(this_obj.input_method){
case IME_5STROKE:
this_obj.switch_menu.visible_p=true;
this_obj.color_key_guide.visible_p=true;
break;
case IME_SOFTKBD:
this_obj.is_softkbd_finished=false;
this_obj.input_softkbd.appear_kbd();
if(this_obj.input_softkbd.is_move_cursor_mode()){
this_obj.input_softkbd.leave_move_cursor_mode();
this_obj.input_softkbd.change_color_guide_mode("NO_INPUT");}
break;
case IME_USBKBD:
this_obj._change_method_from_usbkbd();
break;
default:
console.log("[ERROR] Invalid argument.");
break;}
this_obj.follow_pos();},
leave_focus:function (obj){
if(this_obj.input_method==IME_USBKBD){
this_obj._change_method_from_usbkbd();}
try{
ebus.mwnn.disconnect();}catch(x){
}
this_obj.converter.finish();
this_obj.text_box.disable_cursor();
this_obj.text_box.fix_char();
switch(this_obj.input_method){
case IME_5STROKE:
this_obj.switch_menu.visible_p=false;
this_obj.color_key_guide.visible_p=false;
this_obj.converter.disable_do_forecast();
this_obj.input_5stroke.clear();
this_obj.input_5stroke.disappear();
break;
case IME_SOFTKBD:
this_obj.is_softkbd_finished=true;
this_obj.input_softkbd.clear();
this_obj.input_softkbd.disappear();
this_obj.input_softkbd.disappear_kbd();
break;
default:
console.log("[ERROR] Invalid argument.");
break;}
},
});
this.converter=new IME_Converter(
{
width:this.text_box_width
});
if(this.scroll_menu_obj)
this.converter.overwrite_scroll_menu_obj(this.scroll_menu_obj);
this.converter.create_obj();
this.converter.set_method_converter_updated_hook(this.method_converter_updated_hook);
this.converter.init();
this.text_box=new IME_TextBox(
{
width:this.text_box_width,
text:"",
translate:base.translate,
color:[255,255,255,255],
char_length_limit:100
});

this.text_box.init();
this.text_box.disable_under_bar();
this.text_box.disable_background();
this.text_box.enable_cursor();
this.text_box.set_text("");
this.switch_menu_pos=[-Math.floor(base.width/2)+54,-126,0];
this.switch_menu=new IME_SwitchMenu({});
this.switch_menu.create_obj();
this.switch_menu.init();
this.switch_menu.change_mode("INPUT");
this.switch_menu.translate[0]=this.switch_menu_pos[0];
this.switch_menu.translate[1]=this.switch_menu_pos[1];
this.switch_menu.translate[2]=this.switch_menu_pos[2];
this.usb_indicator_pos=[-Math.floor(base.width/2)+208,-126,0];
this.usb_indicator=new IME_USBIndicator({pos_x_range:arg.indicator_pos_x_range});
this.usb_indicator.create_obj();
function draw_state_hook(symbol){
return this_obj.get_usbkbd_state(symbol);}
this.usb_indicator.set_draw_state_hook(draw_state_hook);
this.usb_indicator.init();
this.usb_indicator.translate[0]=this.usb_indicator_pos[0];
this.usb_indicator.translate[1]=this.usb_indicator_pos[1];
this.usb_indicator.translate[2]=this.usb_indicator_pos[2];
this.color_key_guide_pos=[-Math.floor(base.width/2)+150,-86,0];
this.color_key_guide=new IME_ColorKeyGuide({});
this.color_key_guide.create_obj();
this.color_key_guide.init();
this.color_key_guide.translate[0]=this.color_key_guide_pos[0]+this.switch_menu.get_width();
this.color_key_guide.translate[1]=this.color_key_guide_pos[1];
this.color_key_guide.translate[2]=this.color_key_guide_pos[2];
this.f_key_guide_pos=[-Math.floor(base.width/2)+150,-93,0];
this.f_key_guide=new IME_FKeyGuide({});
this.f_key_guide.create_obj();
this.f_key_guide.init();
this.f_key_guide.translate[0]=this.f_key_guide_pos[0]+this.switch_menu.get_width();
this.f_key_guide.translate[1]=this.f_key_guide_pos[1];
this.f_key_guide.translate[2]=this.f_key_guide_pos[2];
this.f_key_guide.disappear();
this.keyboard_change_obj=new actor(
{
base_col_width:4,
base_col:[[144,144,144,255],[98,98,98,255]],
cursor_width:4,
translate:[-base.width/4-5,60,0],
bg_image:[
new gbox({
width:base.width/2-10,
height:40,
color:[57,56,56,255],
}),
new gtext({
width:base.width/2-10,
height:40,
align:CENTER,
text:"入力方法切換",
font_size:30,
color:[255,255,255,255],
}),
],
action:function (obj){
this_obj.change_input_method();
this_obj.set_cursor(this_obj.area_actor);},
});
this.keyboard_change_obj.free=function (){
setf_text(this.bg_image[1],"");}
this.keyboard_change_obj.revive=function (){
setf_text(this.bg_image[1],"入力方法切換");}
this.forecast_switch_obj=new actor(
{
base_col_width:4,
base_col:[[144,144,144,255],[98,98,98,255]],
cursor_width:4,
translate:[base.width/4+5,60,0],
bg_image:[
new gbox({
width:base.width/2-10,
height:40,
color:[57,56,56,255],
}),
new gtext({
translate:[40,0,0],
width:base.width/2-10,
height:40,
align:LEFT,
text:"",
font_size:30,
color:[255,255,255,255],
}),
],
action:function (obj){
this_obj._toggle_forecast_state();
this_obj.set_cursor(this_obj.area_actor);},
});
this.forecast_switch_obj.set_state=function (state){
this.is_forecast_state=state;
this.draw_state();}
this.forecast_switch_obj.draw_state=function (){
if(this.is_forecast_state==FORECAST_ON){
setf_text(this.bg_image[1],"予測変換：ON");}else {
setf_text(this.bg_image[1],"予測変換：OFF");}
}
this.forecast_switch_obj.valid=function (){
if(this.is_valid()){
return;}
this.bg_image[1].color[3]=255;
this.draw_state();}
this.forecast_switch_obj.invalid=function (){
if(!this.is_valid()){
return;}
this.bg_image[1].color[3]=30;
setf_text(this.bg_image[1],"予測変換：OFF");}
this.forecast_switch_obj.is_valid=function (){
if(this.bg_image[1].color[3]==255){
return true;}else {
return false;}
}
this.forecast_switch_obj.free=function (){
setf_text(this.bg_image[1],"");}
this.forecast_switch_obj.revive=function (){
this.forecast_switch_obj.draw_state();}
this.forecast_switch_obj.set_state(this.forecast_state);
this.master_components=new container({
translate:[MASTER_POSITION_X,MASTER_POSITION_Y,MASTER_POSITION_Z],
components:[
this.area_actor,
this.text_box,
this.converter,
this.f_key_guide,
this.usb_indicator,
],
});
this.necessary_components=new container({
components:[
this.usb_indicator
]
});

this.softkbd=new container({});
this.softkbd_pos=[0,100,0];
this.softkbd.translate[0]=this.softkbd_pos[0];
this.softkbd.translate[1]=this.softkbd_pos[1];
this.softkbd.translate[2]=this.softkbd_pos[2];
this.components=[
this.necessary_components,
this.softkbd
];
if(ebus.kbd.supported){
this.input_usbkbd=new IME_USBKBDInput({
width:this.text_box_width
});
this.get_mwnn_obj=function (){
return this_obj.input_usbkbd;};
this.input_usbkbd.set_method_show_text_NO_TRANSLATE_hook(this.method_show_text_usb_NO_TRANSLATE_hook);
this._create_obj_usbkbd();}
switch(this.input_method){
case IME_5STROKE:
this.switch_menu.visible_p=true;
this.color_key_guide.visible_p=true;
this._create_obj_5stroke();
break;
case IME_SOFTKBD:
this.switch_menu.visible_p=false;
this.color_key_guide.visible_p=false;
this._create_obj_softkbd();
break;
default:
console.log("[ERROR] Illegal input_method!",this.input_method);
break;}
this._control_forecast_mode();};
IME_Master.prototype._create_obj_5stroke=function (){
this.input_5stroke=new IME_5StrokeInput(
{
width:this.text_box_width,
});
this.input_5stroke.create_obj();
this.input_5stroke.init();
this.input_5stroke.translate=[0,0,0];
var this_obj=this;
function input_empty_hook(){
if(this_obj._use_forecast_mode()){
this_obj.converter.disable_do_forecast();}
this_obj.change_mode("NO_INPUT");};
this.input_5stroke.set_empty_hook(input_empty_hook);
function change_text_hook(){
this_obj._display_forecast_list_5stroke();};
this.input_5stroke.set_change_text_hook(change_text_hook);
function add_text_hook(){
if(this_obj.is_direct_input){
var str=this_obj.input_5stroke.get_text_array();
this_obj.text_box.add_text(str[str.length-1]);
this_obj.UserHookFunc();}
};
this.input_5stroke.set_add_text_hook(add_text_hook);
function replace_text_hook(){
if(this_obj.is_direct_input){
var str=this_obj.input_5stroke.get_text_array();
this_obj.text_box.replace_text(str[str.length-1]);}
};
this.input_5stroke.set_replace_text_hook(replace_text_hook);
this.master_components.components.push(this.input_5stroke);};
IME_Master.prototype._create_obj_softkbd=function (){
if(!this.input_softkbd){
this.input_softkbd=new IME_SoftKBDInput(
{
width:this.text_box_width,
});}
this.input_softkbd.set_forecast_state(this.forecast_state);
this.text_box_softkbd=this.input_softkbd.create_obj();
this.input_softkbd.init();
this.input_softkbd.set_expand_direction(this.expand_direction_softkbd);
var this_obj=this;
function input_empty_hook(){
if(this_obj._use_forecast_mode()){
this_obj.input_softkbd.clear();}
this_obj.change_mode("NO_INPUT");};
this.input_softkbd.set_empty_hook(input_empty_hook);
function change_text_hook(){
this_obj._forecast_softkbd();};
this.input_softkbd.set_change_text_hook(change_text_hook);
function select_forecast_hook(word,num){
if(this_obj._use_forecast_mode()){
this_obj._decide_translate_text_only(word);
this_obj.converter.set_forecast_candidate(num);
this_obj.UserHookFunc();
this_obj._continuous_forecast();
this_obj.change_mode("NO_INPUT");}
};
this.input_softkbd.set_select_forecast_hook(select_forecast_hook);
this.input_softkbd.appear_kbd();
if(this.is_enable_move_kbd)
this.input_softkbd.enable_move_kbd();
else
this.input_softkbd.disable_move_kbd();
this.master_components.components.push(this.text_box_softkbd);
this.softkbd.components=[this.input_softkbd];};
IME_Master.prototype._create_obj_usbkbd=function (){
if(!this.input_usbkbd.get_make_obj()){
this.input_usbkbd.create_obj();
var this_obj=this;
function input_empty_hook(){
if(this_obj._use_forecast_mode()){
this_obj.converter.disable_do_forecast();}
this_obj.change_mode("NO_INPUT");};
this.input_usbkbd.set_empty_hook(input_empty_hook);
function change_text_hook(){
this_obj._display_forecast_list_usbkbd();};
this.input_usbkbd.set_change_text_hook(change_text_hook);
function call_setting_hook(symbol){
return this_obj.get_usbkbd_state(symbol);}
this.input_usbkbd.set_call_setting_hook(call_setting_hook);
this.master_components.components.push(this.input_usbkbd);}
this.input_usbkbd.init();
this.input_usbkbd.disappear();};
IME_Master.prototype.change_input_method=function (){
var ret=false;
switch(this.mode){
case "NO_INPUT":
case "NO_TRANSLATE":
case "DIRECT_INPUT":
switch(this.input_method){
case IME_5STROKE:
this._change_input_method_5stroke_to_softkbd();
this.init();
ret=true;
break;
case IME_SOFTKBD:
this._change_input_method_softkbd_to_5stroke();
this.init();
ret=true;
break;
case IME_USBKBD:
if(this.pre_method==IME_SOFTKBD){
this._change_input_method_softkbd_to_5stroke();}else {
this._change_input_method_5stroke_to_softkbd();}
this.init();
ret=true;
break;
default:
break;}
break;
case "TRANSLATE":
case "ADJUST":
case "SELECT_CHAR_TYPE":
default:
break;}
if(this.is_direct_input){
this.change_input_char_set({
type:"ALPHABET",
});}else {
this.change_input_char_set({
type:"ALL",
});}
this.follow_pos();return ret;}
IME_Master.prototype._change_input_method_5stroke_to_softkbd=function (){
this.input_5stroke.disappear();
if(this.text_box_softkbd==null){
this._create_obj_softkbd();}else {
this.input_softkbd.appear_kbd();}
this.input_method=IME_SOFTKBD;
this.set_keyboard_type("software");}
IME_Master.prototype._change_input_method_softkbd_to_5stroke=function (){
this.input_softkbd.disappear();
this.input_softkbd.disappear_kbd();
if(this.input_5stroke==null)
this._create_obj_5stroke();
this.input_method=IME_5STROKE;
this.set_keyboard_type("mobileinput");}
IME_Master.prototype._is_usbkbd_method=function (up_down,keysym){
var chg_mtd_ret=false;
if(!ebus.kbd.supported)
return false;
if(this.input_method!=IME_USBKBD)
return false;
if(up_down!=KEY_PRESS)
return false;
if(this.check_txkb_keysym())
return false;
chg_mtd_ret=this._change_method_from_usbkbd();
if(pkg_usb_keyboard._is_CROSS_KEY(keysym)){
if(this.input_method==IME_SOFTKBD){
if(!this.input_softkbd.is_move_cursor_mode()){
this.input_softkbd.disappear();
this.input_softkbd.disappear_kbd();
send_leave_event_to_sphone();
this.is_softkbd_finished=true;
if(chg_mtd_ret)return true;}
}
return false;}
if(pkg_usb_keyboard._is_DIGIT_KEY(keysym)){
return false;}else {
return true;}
};
IME_Master.prototype._change_method_to_usbkbd=function (){
switch(this.pre_method){
case IME_5STROKE:
this.input_5stroke.disappear();
break;
case IME_SOFTKBD:
this.input_softkbd.disappear();
this.input_softkbd.disappear_kbd();
break;}
this.method_translate_cancel_hook();
this.converter.disable_do_forecast();
this.converter.finish();
this.usb_indicator.appear();
this.init();
this.follow_pos();
if(this.is_direct_input){
this.change_input_char_set({
type:"ALPHABET"
});}else {
this.change_input_char_set({
type:"ALL"
});}
};
IME_Master.prototype._change_method_from_usbkbd=function (){
var ret=false;
if(this.input_method!=IME_USBKBD)
return ret;
send_enter_event_to_sphone(this.sphone_input_mode,this.sphone_kbd_type);
this.text_box.enable_cursor();
var last_kbd=this.get_keyboard_type();
switch(last_kbd){
case "software":
this.is_softkbd_finished=false;
this.input_softkbd.appear_kbd();
this.input_method=IME_SOFTKBD;
this.method_from_usbkbd_change_event_hook();
ret=true;
break;
default:
this.input_method=IME_5STROKE;
break;}
this.converter.disable_do_forecast();
this.converter.finish();
this.usb_indicator.disappear();
if(this.usb_setting)
this.usb_setting.disappear();
if(this.f_key_guide)
this.f_key_guide.disappear();
this.input_usbkbd.disappear();
this.init();
this.follow_pos();
if(this.is_direct_input){
this.change_input_char_set({
type:"ALPHABET"
});}else {
this.change_input_char_set({
type:"ALL"
});}
return ret;};
IME_Master.prototype._display_usb_setting=function (){
var this_obj=this;
if(this.usb_setting){
this.usb_setting.appear();}else {
this.usb_setting=new IME_USBSetting({})
this.usb_setting.create_obj();
function call_setting_hook(symbol){
return this_obj.get_usbkbd_state(symbol);}
this.usb_setting.set_call_setting_hook(call_setting_hook);
function change_setting_hook(state,symbol){
this_obj.set_usbkbd_state(state,symbol);}
this.usb_setting.set_change_setting_hook(change_setting_hook);
function change_forecast_state_hook(state){
this_obj.forecast_state=state;
this_obj._control_forecast_mode();
this_obj.forecast_switch_obj.set_state(this_obj.forecast_state);}
this.usb_setting.set_change_forecast_state_hook(change_forecast_state_hook);
function valid_forecast_hook(){
this_obj.forecast_switch_obj.valid();};
this.usb_setting.set_valid_forecast_hook(valid_forecast_hook);
function invalid_forecast_hook(){
this_obj.forecast_switch_obj.invalid();};
this.usb_setting.set_invalid_forecast_hook(invalid_forecast_hook);
this.master_components.components.push(this.usb_setting);
this.necessary_components.components.push(this.usb_setting);}
this.usb_setting.init();};
IME_Master.prototype._toggle_forecast_state=function (){
if(this.forecast_state==FORECAST_ON){
this.forecast_state=FORECAST_OFF;
this.set_forecast_state("normal");}else {
this.forecast_state=FORECAST_ON;
this.set_forecast_state("forecast");}
this._control_forecast_mode();
this.forecast_switch_obj.set_state(this.forecast_state);};
IME_Master.prototype._control_forecast_mode=function (){
if(this.forecast_state==FORECAST_ON){
this._share_forecast_state(FORECAST_ON);
if(this.input_softkbd){
this.input_softkbd.control_forecast_obj();
this.input_softkbd.adjust_translate();
this.input_softkbd.set_key_top();}
}else {
this._share_forecast_state(FORECAST_OFF);
if(this.input_softkbd){
this.input_softkbd.undisplay_forecast_obj();
this.input_softkbd.adjust_translate();
this.input_softkbd.set_key_top();}
}
};
IME_Master.prototype._share_forecast_state=function (state){
if(this.input_softkbd){
this.input_softkbd.set_forecast_state(state);}
};
IME_Master.prototype.follow_pos=function (){
var pos=this.text_box.get_cursor_position();
var bias;
if(this.mode=="TRANSLATE"||this.mode=="ADJUST")
bias=pos+this.converter.get_text_width()-this.text_box_width;
else if(this.input_method==IME_5STROKE){
bias=pos+this.input_5stroke.get_text_width()-this.text_box_width;}else if(this.input_method==IME_USBKBD){
bias=pos+this.input_usbkbd.get_text_width()-this.text_box_width;}else {
bias=pos+this.text_box_softkbd.get_text_width()-this.text_box_width;}
if(bias>0&&!this.is_direct_input){
this.text_box.set_bias_width(bias);
pos=this.text_box.get_cursor_position();}
this.converter.translate[0]=pos;
if(this.switch_menu.visible_p==true){
this.color_key_guide.translate[0]=this.color_key_guide_pos[0]+this.switch_menu.get_width()+pos;}else{
this.color_key_guide.translate[0]=this.color_key_guide_pos[0]+this.converter.get_width()+pos;}
if(this.input_method==IME_USBKBD){
if(this.converter.visible_p){
this.f_key_guide.translate[0]=this.f_key_guide_pos[0]+this.converter.get_width()+pos;}else {
this.f_key_guide.translate[0]=this.f_key_guide_pos[0]+pos;}
}
this.switch_menu.translate[0]=this.switch_menu_pos[0]+pos;
this.usb_indicator.translate[0]=this.usb_indicator.calc_pos_x_limit(this.usb_indicator_pos[0]+pos);
switch(this.input_method){
case IME_5STROKE:
this.input_5stroke.translate[0]=pos;
break;
case IME_SOFTKBD:
this.text_box_softkbd.translate[0]=pos;
break;
case IME_USBKBD:
this.input_usbkbd.translate[0]=pos;
break;
default:
break;};};
IME_Master.prototype.change_mode=function (mode){
console_log(">> IME_Master.prototype.change_mode: mode = "+mode);
if(this.mode==mode)
return;
if(this.is_direct_input){
switch(mode){

case "NO_INPUT":
case "NO_TRANSLATE":
case "TRANSLATE":
case "ADJUST":
return;

case "SELECT_CHAR_TYPE":
case "DIRECT_INPUT":
case "CHANGE_USB_SETTING":
break;
default:
return;}
}
this.pre_mode=this.mode;
this.mode=mode;
this.converter.change_mode(mode);
switch(this.input_method){
case IME_5STROKE:
this._change_mode_5stroke(mode);
break;
case IME_SOFTKBD:
this._change_mode_softkbd(mode);
break;
case IME_USBKBD:
this._change_mode_usbkbd(mode);
break;
default:
break;}
};
IME_Master.prototype._change_mode_5stroke=function (mode){
switch(mode){
case "NO_INPUT":
if(this._use_forecast_mode()){
this.converter.finish();}
this.switch_menu.visible_p=true;
this.switch_menu.change_mode("INPUT");
this.color_key_guide.visible_p=true;
this.color_key_guide.change_mode(mode);
this.input_5stroke.clear();
this.input_5stroke.disappear();
this.text_box.enable_cursor();
break;
case "NO_TRANSLATE":
this.color_key_guide.change_mode(mode);
this.text_box.disable_cursor();
this.input_5stroke.appear();
if(this._use_forecast_mode()&&
(this.pre_mode=="TRANSLATE"||this.pre_mode=="ADJUST")){
this._display_forecast_list_5stroke();}else {
this.switch_menu.visible_p=true;}
break;
case "TRANSLATE":
this.switch_menu.visible_p=false;
this.color_key_guide.change_mode(mode);
this.text_box.disable_cursor();
break;
case "ADJUST":
this.switch_menu.visible_p=true;
this.color_key_guide.change_mode("TRANSLATE");
break;
case "SELECT_CHAR_TYPE":
this.switch_menu.visible_p=true;
this.switch_menu.change_mode("SELECT");
this.color_key_guide.change_mode(mode);
break;
case "DIRECT_INPUT":
this.input_5stroke.clear();
this.input_5stroke.disappear();
this.switch_menu.change_mode("INPUT");
this.color_key_guide.change_mode("NO_INPUT");
break;
default:
break;};};
IME_Master.prototype.set_mode_change_event_hook=function (hook){
if(typeof hook=="function")
this.mode_change_event_hook=hook;};
IME_Master.prototype.set_method_from_usbkbd_change_event_hook=function (hook){
if(typeof hook=="function")
this.method_from_usbkbd_change_event_hook=hook;};
IME_Master.prototype.set_method_add_text_hook=function (hook){
if(typeof hook=="function")
this.method_add_text_hook=hook;};
IME_Master.prototype.set_method_enter_backspace_hook=function (hook){
if(typeof hook=="function")
this.method_enter_backspace_hook=hook;};
IME_Master.prototype.set_method_translate_cancel_hook=function (hook){
if(typeof hook=="function")
this.method_translate_cancel_hook=hook;};
IME_Master.prototype.set_method_cancel_to_NO_TRANSLATE_hook=function (hook){
if(typeof hook=="function")
this.method_cancel_to_NO_TRANSLATE_hook=hook;};
IME_Master.prototype.set_method_converter_updated_hook=function (hook){
if(typeof hook=="function"){
this.method_converter_updated_hook=hook;
this.converter.set_method_converter_updated_hook(hook);}
};
IME_Master.prototype.set_method_show_text_usb_NO_TRANSLATE_hook=function (hook){
if(typeof hook=="function"){
this.method_show_text_usb_NO_TRANSLATE_hook=hook;
this.input_usbkbd.set_method_show_text_NO_TRANSLATE_hook(hook);}
};
IME_Master.prototype._change_mode_softkbd=function (mode){
console_log(">> IME_Master.prototype._change_mode_softkbd: mode = "+mode);
switch(mode){
case "NO_INPUT":
this.switch_menu.visible_p=false;
this.color_key_guide.visible_p=false;
if(this.input_softkbd.is_move_cursor_mode())
this.input_softkbd.change_color_guide_mode("CURSOR_MOVE");
else
this.input_softkbd.change_color_guide_mode(mode);
this.input_softkbd.clear_keyboard_only();
this.input_softkbd.disappear();
this.input_softkbd.appear_kbd();
this.text_box.enable_cursor();
break;
case "NO_TRANSLATE":
if(this._use_forecast_mode()&&
(this.pre_mode=="TRANSLATE"||this.pre_mode=="ADJUST")){
this._forecast_softkbd();}
this.switch_menu.visible_p=false;
this.color_key_guide.visible_p=false;
this.text_box.disable_cursor();
this.input_softkbd.change_color_guide_mode(mode);
this.input_softkbd.appear();
break;
case "TRANSLATE":
this.switch_menu.visible_p=false;
this.color_key_guide.visible_p=true;
this.color_key_guide.change_mode(mode);
this.text_box.disable_cursor();
break;
case "ADJUST":
this.switch_menu.visible_p=true;
this.color_key_guide.visible_p=true;
this.color_key_guide.change_mode("TRANSLATE");
break;
case "SELECT_CHAR_TYPE":
break;
case "DIRECT_INPUT":
this.input_softkbd.clear();
this.input_softkbd.disappear();
break;
default:
break;};
if(typeof this.mode_change_event_hook=="function")
this.mode_change_event_hook(mode);};
IME_Master.prototype._change_mode_usbkbd=function (mode){
switch(mode){
case "NO_INPUT":
if(this._use_forecast_mode()){
this.converter.finish();}
this.text_box.enable_cursor();
this.usb_indicator.appear();
this.input_usbkbd.clear();
this.input_usbkbd.disappear();
this.text_box.enable_cursor();
this.f_key_guide.disappear();
break;
case "NO_TRANSLATE":
this.text_box.disable_cursor();
this.usb_indicator.appear();
this.input_usbkbd.appear();
this.f_key_guide.change_mode(mode);
if(this._use_forecast_mode()&&
(this.pre_mode=="TRANSLATE"||this.pre_mode=="ADJUST")){
this._display_forecast_list_usbkbd();}else {
this.usb_indicator.visible_p=true;}
break;
case "TRANSLATE":
this.text_box.disable_cursor();
this.usb_indicator.disappear();
this.f_key_guide.change_mode(mode);
this.f_key_guide.appear();
break;
case "ADJUST":
this.text_box.disable_cursor();
this.f_key_guide.change_mode("TRANSLATE");
this.f_key_guide.appear();
break;
case "DIRECT_INPUT":
this.usb_indicator.appear();
this.usb_indicator.init_char_type(NUM_TYPE);
this.input_usbkbd.set_char_type(NUM_TYPE);
this.input_usbkbd.clear();
this.input_usbkbd.disappear();
this.method_translate_cancel_hook();
break;
case "CHANGE_USB_SETTING":
if(this._use_forecast_mode()){
this.converter.finish();}
this.usb_indicator.disappear();
this.f_key_guide.disappear();
this._display_usb_setting();
this.input_usbkbd.disappear();
this.input_usbkbd.clear();
this.method_translate_cancel_hook();
if(this.is_direct_input){
this.usb_setting.change_input_char_set({
type:"ALPHABET",
});}else {
this.usb_setting.change_input_char_set({
type:"ALL",
});}
break;
default:
break;};};
IME_Master.prototype.change_char_type=function (char_type){
this.pre_char_type=this.char_type;
this.char_type=char_type;
this.converter.change_char_type(this.char_type);
if(this.input_method==IME_5STROKE){
switch(this.char_type){
case HIRA_TYPE:
this.input_5stroke.change_mode("HIRAGANA");
break;
case KATA_TYPE:
this.input_5stroke.change_mode("KATAKANA");
break;
case EISU_TYPE:
if(this.is_direct_input){
this.text_box.set_5stroke_mode(true);}
this.input_5stroke.change_mode("ALPHABET");
break;
case NUM_TYPE:
if(this.is_direct_input){
this.text_box.set_5stroke_mode(false);}
this.input_5stroke.change_mode("NUMBER");
break;
default:
break;};}else if(this.input_method==IME_USBKBD){
this.input_usbkbd.set_char_type(this.char_type);
this.usb_indicator.init_char_type(this.char_type);
if(this.usb_setting)
this.usb_setting.set_char_type(this.char_type);}
if(this.char_type==HIRA_TYPE){
this.forecast_switch_obj.valid();}else {
this.forecast_switch_obj.invalid();}
};
IME_Master.prototype.init=function (){
this.pre_mode="NO_INPUT";
this.mode="NO_INPUT";
this.char_type=HIRA_TYPE;
this.text_box.enable_cursor();
switch(this.input_method){
case IME_5STROKE:
this._init_5stroke();
break;
case IME_SOFTKBD:
this._init_softkbd();
break;
case IME_USBKBD:
this._init_usbkbd();
break;
default:
break;}
};
IME_Master.prototype._init_5stroke=function (){
this.switch_menu.visible_p=true;
this.switch_menu.change_mode("INPUT");
this.color_key_guide.visible_p=true;
this.color_key_guide.change_mode("NO_INPUT");
this.input_5stroke.clear();};
IME_Master.prototype._init_softkbd=function (){
this.switch_menu.visible_p=false;
this.color_key_guide.visible_p=false;
this.input_softkbd.change_color_guide_mode("NO_INPUT");
this.input_softkbd.clear();
this.input_softkbd.appear_kbd();};
IME_Master.prototype._init_usbkbd=function (){
this.input_usbkbd.clear();
if(this.usb_setting)
this.usb_setting.set_char_type(HIRA_TYPE);
this.switch_menu.visible_p=false;
this.color_key_guide.visible_p=false;
this.change_char_type(HIRA_TYPE);};
IME_Master.prototype.convert_finish=function (){
console_log(">> IME_Master.prototype.convert_finish");
this.change_mode("NO_INPUT");
this.converter.finish();
this.text_box.enable_cursor();};
IME_Master.prototype._decide_no_translate=function (){
var self=this;
var str;
switch(this.input_method){
case IME_5STROKE:
str=this.input_5stroke.get_text_array();
break;
case IME_SOFTKBD:
str=this.input_softkbd.get_text_array();
break;
case IME_USBKBD:
str=this.input_usbkbd.get_text_array();
break;
default:
break;}
for(var i=0;i<str.length;i++){
this.method_add_text_hook(str[i]);}
this.text_box.enable_cursor();
this.converter.disable_do_forecast();
this.UserHookFunc();};
IME_Master.prototype._decide_translate_text_only=function (string){
var str=string;
for(var i=0;i<str.length;i++){
this.method_add_text_hook(str[i]);}
};
IME_Master.prototype.decide_no_input=function (){
this.change_mode("NO_INPUT");
this.follow_pos();};
IME_Master.prototype.decide_no_translate=function (){
this._decide_no_translate();
this.change_mode("NO_INPUT");
this.follow_pos();};
IME_Master.prototype.decide_translate=function (){
this.converter.decide();
this._decide_translate();
this.method_converter_updated_hook();
this.follow_pos();};
IME_Master.prototype.decide_adjust=function (){
this.change_mode("TRANSLATE");
this.converter.decide();
this._decide_adjust();
this.method_converter_updated_hook();
this.follow_pos();};
IME_Master.prototype.update_kouho=function (){
console_log(">> IME_Master.prototype.update_kouho");
this.converter.update_kouho();};
IME_Master.prototype._decide_translate=function (){
var self=this;
var str=this.converter.ret_str.split("");
for(var i=0;i<str.length;i++){
this.method_add_text_hook(str[i]);}
if(this.converter.mwnn==null){
this.convert_finish();
this._continuous_forecast();}else {
this.method_converter_updated_hook();}
this.UserHookFunc();};
IME_Master.prototype._decide_translate_all=function (){
var self=this;
var str=this.converter.get_text().split("");
for(var i=0;i<str.length;i++){
this.method_add_text_hook(str[i]);}
this.convert_finish();
this.UserHookFunc();};
IME_Master.prototype._decide_adjust=function (){
var self=this;
var str=this.converter.ret_str.split("");
for(var i=0;i<str.length;i++){
this.method_add_text_hook(str[i]);}
if(this.converter.str==null){
this.convert_finish();}else {
this.method_converter_updated_hook();}
this.UserHookFunc();};
IME_Master.prototype._decide_adjust_all=function (){
var self=this;
var str=this.converter.get_text().split("");
for(var i=0;i<str.length;i++){
this.method_add_text_hook(str[i]);}
this.convert_finish();
this.UserHookFunc();};
IME_Master.prototype._decide_direct_input=function (){
var self=this;
var str;
switch(this.input_method){
case IME_5STROKE:
if(this.char_type==NUM_TYPE){
str=this.input_5stroke.get_text_array();}else{
str=[];}
this.input_5stroke.clear();
this.color_key_guide.change_mode("NO_INPUT");
break;
case IME_SOFTKBD:
str=this.input_softkbd.get_text_array();
this.input_softkbd.clear();
this.input_softkbd.disappear();
this.input_softkbd.change_color_guide_mode("NO_INPUT");
break;
case IME_USBKBD:
str=this.input_usbkbd.get_text_array();
this.input_usbkbd.clear();
break;
default:
break;}
for(var i=0;i<str.length;i++){
this.method_add_text_hook(str[i]);}
this.text_box.enable_cursor();
this.UserHookFunc();};
IME_Master.prototype._cancel=function (){
var canceled_str;
canceled_str=this.converter.ret_str;
switch(this.input_method){
case IME_5STROKE:
this.input_5stroke.set_text(canceled_str,canceled_str.length);
this.input_5stroke.appear();
break;
case IME_SOFTKBD:
this.input_softkbd.set_text(canceled_str,canceled_str.length);
this.input_softkbd.appear();
this.input_softkbd.appear_kbd();
break;
case IME_USBKBD:
this.input_usbkbd.set_text(canceled_str,canceled_str.length);
this.input_usbkbd.appear();
break;
default:
break;}
};
IME_Master.prototype._key_hook_no_input=function (up_down,keysym){
var ret=false;
switch(this.input_method){
case IME_5STROKE:
ret=this._key_hook_no_input_5stroke(up_down,keysym);
break;
case IME_SOFTKBD:
ret=this._key_hook_no_input_softkbd(up_down,keysym);
break;
case IME_USBKBD:
ret=this._key_hook_no_input_usbkbd(up_down,keysym);
break;
default:
break;};
return ret;};
IME_Master.prototype._key_hook_no_input_5stroke=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
if(this._use_forecast_mode()
&&this.converter.is_now_forecast()){
switch(keysym){
case TXK_UP:
case TXK_DOWN:
this.change_mode("TRANSLATE");
this.converter.select_forecast_candidate();
ret=true;
break;
case TXK_LEFT:
case TXK_RIGHT:
case TXK_ENTER:
case TXK_YELLOW:
case TXK_GREEN:
this._cancel_continuous_forecast_5stroke();
if(keysym==TXK_ENTER||
keysym==TXK_YELLOW){
ret=true;}
break;}
}
switch(keysym){
case TXK_LEFT:
ret=this.text_box.cursor_left();
break;
case TXK_RIGHT:
ret=this.text_box.cursor_right();
break;
case TXK_ENTER:
case TXK_RED:
case TXK_BLUE:
break;
case TXK_YELLOW:
this.text_box.backspace_text();
this.UserHookFunc();
ret=true;
break;
case TXK_GREEN:
this.switch_menu.down();
this.change_mode("SELECT_CHAR_TYPE");
ret=true;
break;
case TXK_D0:
case TXK_D1:
case TXK_D2:
case TXK_D3:
case TXK_D4:
case TXK_D5:
case TXK_D6:
case TXK_D7:
case TXK_D8:
case TXK_D9:
case TXK_ASTERISK:
this.change_mode("NO_TRANSLATE");
ret=this.input_5stroke.key_hook(up_down,keysym);
break;
case TXK_SHARP:
if(this.char_type==NUM_TYPE){
this.change_mode("NO_TRANSLATE");
ret=this.input_5stroke.key_hook(up_down,keysym);}else{
ret=true;}
break;
default:
break;};
return ret;};
IME_Master.prototype._key_hook_no_input_softkbd=function (up_down,keysym){
console_log(">> IME_Master.prototype._key_hook_no_input_softkbd");
var ret=false;
if(this.is_softkbd_finished){
if(up_down!=KEY_PRESS)
return true;
switch(keysym){
case TXK_LEFT:
ret=this.text_box.cursor_left();
break;
case TXK_RIGHT:
ret=this.text_box.cursor_right();
break;
case TXK_ENTER:
this.is_softkbd_finished=false;
this.input_softkbd.appear_kbd();
send_enter_event_to_sphone(this.sphone_input_mode,this.sphone_kbd_type);
ret=true;
break;
default:
break;}
}else {
ret=this.input_softkbd.key_hook(up_down,keysym);
if(up_down!=KEY_PRESS)
return true;
if(ret==false){
switch(keysym){
case TXK_LEFT:
ret=this.text_box.cursor_left();
break;
case TXK_RIGHT:
ret=this.text_box.cursor_right();
break;
case TXK_RED:
if(!this.input_softkbd.is_move_cursor_mode()){
this.input_softkbd.disappear();
this.input_softkbd.disappear_kbd();
send_leave_event_to_sphone();
this.is_softkbd_finished=true;}
break;
case TXK_YELLOW:
this.text_box.backspace_text();
this.UserHookFunc();
ret=true;
break;
case TXK_GREEN:
if(!this.input_softkbd.is_move_cursor_mode()){
this.input_softkbd.toggle_input_mode();
switch(this.input_softkbd.input_mode){case "HIRAGANA":
this.change_char_type(HIRA_TYPE);
break;
case "KATAKANA":
this.change_char_type(KATA_TYPE);
break;
case "ALPHABET_L":
case "ALPHABET_S":
this.change_char_type(EISU_TYPE);
break;
default:
console.log("[ERROR] Illegal input_mode. (input_softkbd)");
break;}
ret=true;}
break;
default:
break;}
}
if(this.text_box_softkbd.get_text()==""){
this.change_mode("NO_INPUT");}else{
this.change_mode("NO_TRANSLATE");}
if(keysym==TXK_ENTER){
if(this.input_softkbd.is_move_cursor_mode())
this.input_softkbd.change_color_guide_mode("CURSOR_MOVE");
else
this.input_softkbd.change_color_guide_mode(this.mode);}
}
return ret;};
IME_Master.prototype._key_hook_no_input_usbkbd=function (up_down,keysym){
console_log(">> IME_Master.prototype._key_hook_no_input_usbkbd");
var ret=false;
if(up_down!=KEY_PRESS)
return true;
if(typeof keysym!="object"){
keysym=this.get_txkb_keysym();}
if(!keysym)
return true;
if(this._use_forecast_mode()
&&this.converter.is_now_forecast()){
if(keysym.type==keysym.CHAR){
switch(keysym.code){
case " ":
if(keysym.scancode==TXKB_SC_Henkan){
this.change_mode("TRANSLATE");
this.converter.select_forecast_candidate();
ret=true;}
break;}
}else {
switch(keysym.code){
case TXKB_Up:
case TXKB_Down:
this.change_mode("TRANSLATE");
this.converter.select_forecast_candidate();
ret=true;
break;
case TXKB_Left:
case TXKB_Right:
case TXKB_Return:
case TXKB_BackSpace:
case TXKB_F12:
this._cancel_continuous_forecast_usbkbd();
if(keysym.code==TXKB_Return||
keysym.code==TXKB_F12){
ret=true;}
break;
case TXKB_F9:
case TXKB_F11:
case TXKB_Zenkaku_Hankaku:
ret=true;
break;}
}
}
if(ret==false){
if(keysym.type==keysym.CHAR){
switch(keysym.code){
case " ":
if(keysym.scancode==TXKB_SC_Space){
this.input_usbkbd.clear();
this.input_usbkbd.disappear();
ret=this.input_usbkbd.key_hook(up_down,keysym);
this._decide_direct_input();}
break;
default:
this.change_mode("NO_TRANSLATE");
ret=this.input_usbkbd.key_hook(up_down,keysym);
break;}
}else {
switch(keysym.code){
case TXKB_Left:
ret=this.text_box.cursor_left();
break;
case TXKB_Right:
ret=this.text_box.cursor_right();
break;
case TXKB_BackSpace:
this.text_box.delete_left_text();
this.method_enter_backspace_hook();
this.UserHookFunc();
ret=true;
break;
case TXKB_Delete:
this.text_box.delete_right_text();
this.method_enter_backspace_hook();
this.UserHookFunc();
ret=true;
break;
case TXKB_Zenkaku_Hankaku:
if(!this.is_direct_input){
ret=this._zenhankaku_action();}
break;
case TXKB_Shift_L:
case TXKB_Shift_R:
ret=this.input_usbkbd.key_hook(up_down,keysym);
break;
case TXKB_F9:
this.change_mode("CHANGE_USB_SETTING");
ret=true;
break;
case TXKB_F10:
case TXKB_F11:
case TXKB_F12:
ret=true;
break;
default:
break;}
}
}
return ret;};
IME_Master.prototype._key_hook_no_translate=function (up_down,keysym){
var ret=false;
switch(this.input_method){
case IME_5STROKE:
ret=this._key_hook_no_translate_5stroke(up_down,keysym);
break;
case IME_SOFTKBD:
ret=this._key_hook_no_translate_softkbd(up_down,keysym);
break;
case IME_USBKBD:
ret=this._key_hook_no_translate_usbkbd(up_down,keysym);
break;
default:
break;}
return ret;};
IME_Master.prototype._key_hook_no_translate_5stroke=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
switch(keysym){
case TXK_UP:
case TXK_DOWN:
this.change_mode("TRANSLATE");
if(this._use_forecast_mode()&&
this.converter.is_now_forecast()){
this.converter.select_forecast_candidate();}else {
this.converter.set_str(this.input_5stroke.get_text());}
this.input_5stroke.disappear();
ret=true;
break;
case TXK_ENTER:
this._decide_no_translate();
this.change_mode("NO_INPUT");
ret=true;
break;
case TXK_GREEN:
if(this._use_forecast_mode()){
this.change_mode("TRANSLATE");
this.converter.set_str(this.input_5stroke.get_text());
this.input_5stroke.disappear();
ret=true;}
break;
case TXK_YELLOW:
ret=this.input_5stroke.key_hook(up_down,keysym);
break;
case TXK_LEFT:
case TXK_RIGHT:
case TXK_D0:
case TXK_D1:
case TXK_D2:
case TXK_D3:
case TXK_D4:
case TXK_D5:
case TXK_D6:
case TXK_D7:
case TXK_D8:
case TXK_D9:
case TXK_ASTERISK:
case TXK_SHARP:
ret=this.input_5stroke.key_hook(up_down,keysym);
break;
case TXK_RETURN:
this.input_5stroke.clear();
this.change_mode("NO_INPUT");
this.text_box.enable_cursor();
ret=true;
default:
break;};
return ret;};
IME_Master.prototype.enter_translate_mode=function (){
this.change_mode("TRANSLATE");
this.converter.set_str(this.input_softkbd.get_text());
this.input_softkbd.disappear();
this.input_softkbd.disappear_kbd();
this.follow_pos();};
IME_Master.prototype._key_hook_no_translate_softkbd=function (up_down,keysym){
var ret=false;
ret=this.input_softkbd.key_hook(up_down,keysym);
if(up_down!=KEY_PRESS)
return true;
if(ret==false){
switch(keysym){
case TXK_RED:
if(!this.input_softkbd.is_move_cursor_mode()){
this._decide_no_translate();
this.change_mode("NO_INPUT");
ret=true;}
break;
case TXK_BLUE:
if(!this.input_softkbd.is_move_cursor_mode()){
this.change_mode("TRANSLATE");
this.converter.set_str(this.input_softkbd.get_text());
this.input_softkbd.disappear();
this.input_softkbd.disappear_kbd();
ret=true;}
break;
case TXK_RETURN:
this.input_softkbd.clear();
this.change_mode("NO_INPUT");
this.text_box.enable_cursor();
ret=true;
default:
break;};}
if(keysym==TXK_ENTER){
if(this.input_softkbd.is_move_cursor_mode())
this.input_softkbd.change_color_guide_mode("CURSOR_MOVE");
else
this.input_softkbd.change_color_guide_mode(this.mode);}
return ret;};
IME_Master.prototype._key_hook_no_translate_usbkbd=function (up_down,keysym){
console_log(">> IME_Master.prototype._key_hook_no_translate_usbkbd");
var ret=false;
if(up_down!=KEY_PRESS)
return true;
if(typeof keysym!="object"){
keysym=this.get_txkb_keysym();}
if(!keysym)
return true;
if(keysym.type==keysym.CHAR){
switch(keysym.code){
case " ":
if(keysym.scancode!=TXKB_SC_Muhenkan){
this.change_mode("TRANSLATE");
if(this._use_forecast_mode()&&
this.converter.is_now_forecast()){
this.converter.select_forecast_candidate();
this.method_converter_updated_hook();}else {
if(this.input_usbkbd.is_alphabet_only()){
this.converter.change_char_type(EISU_TYPE);}else {
this.converter.change_char_type(this.char_type);}
this.converter.set_str(this.input_usbkbd.get_text());}
this.input_usbkbd.disappear();
ret=true;}
break;
default:
ret=this.input_usbkbd.key_hook(up_down,keysym);
break;}
}else {
switch(keysym.code){
case TXKB_Up:
case TXKB_Down:
this.change_mode("TRANSLATE");
if(this._use_forecast_mode()&&
this.converter.is_now_forecast()){
this.converter.select_forecast_candidate();}else {
if(this.input_usbkbd.is_alphabet_only()){
this.converter.change_char_type(EISU_TYPE);}else {
this.converter.change_char_type(this.char_type);}
this.converter.set_str(this.input_usbkbd.get_text());}
this.input_usbkbd.disappear();
ret=true;
break;
case TXKB_Left:
case TXKB_Right:
ret=this.input_usbkbd.key_hook(up_down,keysym);
break;
case TXKB_Return:
this._decide_no_translate();
this.input_usbkbd.clear_text();
this.change_mode("NO_INPUT");
ret=true;
break;
case TXKB_F9:
if(!this.converter.is_now_forecast()){
this.change_mode("CHANGE_USB_SETTING");
ret=true;}
break;
case TXKB_F10:
case TXKB_F11:
case TXKB_F12:
ret=true;
break;
default:
ret=this.input_usbkbd.key_hook(up_down,keysym);
break;}
}
return ret;};
IME_Master.prototype._key_hook_translate=function (up_down,keysym){
var ret=false;
switch(this.input_method){
case IME_5STROKE:
case IME_SOFTKBD:
ret=this._key_hook_translate_remote(up_down,keysym);
break;
case IME_USBKBD:
ret=this._key_hook_translate_usbkbd(up_down,keysym);
break;
default:
break;}
return ret;};
IME_Master.prototype._key_hook_translate_remote=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
switch(keysym){
case TXK_LEFT:
case TXK_RIGHT:
if(!this.converter.is_now_forecast()){
ret=this.converter.key_hook(up_down,keysym);
if(ret)
this.change_mode("ADJUST");}
ret=true;
break;
case TXK_UP:
case TXK_DOWN:
ret=this.converter.key_hook(up_down,keysym);
break;
case TXK_ENTER:
ret=this.converter.key_hook(up_down,keysym);
this._decide_translate();
break;
case TXK_RETURN:
ret=this.converter.key_hook(up_down,keysym);
this._cancel();
this.change_mode("NO_TRANSLATE");
this.method_cancel_to_NO_TRANSLATE_hook();
break;
case TXK_YELLOW:
break;
case TXK_D0:
case TXK_D1:
case TXK_D2:
case TXK_D3:
case TXK_D4:
case TXK_D5:
case TXK_D6:
case TXK_D7:
case TXK_D8:
case TXK_D9:
case TXK_ASTERISK:
if(this.input_method==IME_5STROKE){
this._decide_translate_all();
this.change_mode("NO_TRANSLATE");
ret=this.input_5stroke.key_hook(up_down,keysym);}
break;
case TXK_SHARP:
if(this.input_method==IME_5STROKE){
ret=true;}
break;
default:
break;}
return ret;};
IME_Master.prototype._key_hook_translate_usbkbd=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
if(typeof keysym!="object"){
keysym=this.get_txkb_keysym();}
if(!keysym)
return true;
if(keysym.type==keysym.CHAR){
switch(keysym.code){
case " ":
ret=this.converter.key_hook(up_down,keysym);
if(keysym.scancode==TXKB_SC_Muhenkan){
this._cancel();
this.change_mode("NO_TRANSLATE");}
break;
default:
this._decide_translate_all();
this.input_usbkbd.init_stack();
this.change_mode("NO_TRANSLATE");
ret=this.input_usbkbd.key_hook(up_down,keysym);
break;}
}else {
switch(keysym.code){
case TXKB_Up:
case TXKB_Down:
ret=this.converter.key_hook(up_down,keysym);
break;
case TXKB_Left:
case TXKB_Right:
if(!this.converter.is_now_forecast()){
ret=this.converter.key_hook(up_down,keysym);
if(ret)
this.change_mode("ADJUST");}
ret=true;
break;
case TXKB_Return:
ret=this.converter.key_hook(up_down,keysym);
this._decide_translate();
this.input_usbkbd.init_stack();
break;
case TXKB_BackSpace:
ret=this.converter.key_hook(up_down,keysym);
this._cancel();
this.change_mode("NO_TRANSLATE");
this.input_usbkbd.show_text_NO_TRANSLATE();
ret=true;
break;
case TXKB_Page_Up:
case TXKB_Page_Down:
ret=this.converter.key_hook(up_down,keysym);
break;
case TXKB_F9:
case TXKB_F10:
case TXKB_F11:
ret=true;
break;
case TXKB_F12:
ret=this.converter.key_hook(up_down,keysym);
this._cancel();
this.change_mode("NO_TRANSLATE");
this.method_cancel_to_NO_TRANSLATE_hook();
break;
default:
break;}
}
return ret;};
IME_Master.prototype._key_hook_adjust=function (up_down,keysym){
var ret=false;
switch(this.input_method){
case IME_5STROKE:
case IME_SOFTKBD:
ret=this._key_hook_adjust_remote(up_down,keysym);
break;
case IME_USBKBD:
ret=this._key_hook_adjust_usbkbd(up_down,keysym);
break;
default:
break;}
return ret;};
IME_Master.prototype._key_hook_adjust_remote=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
switch(keysym){
case TXK_UP:
case TXK_DOWN:
ret=this.converter.key_hook(up_down,keysym);
this.change_mode("TRANSLATE");
break;
case TXK_LEFT:
case TXK_RIGHT:
this.converter.key_hook(up_down,keysym);
ret=true;
break;
case TXK_ENTER:
ret=this.converter.key_hook(up_down,keysym);
this._decide_adjust();
break;
case TXK_RETURN:
case TXK_YELLOW:
ret=this.converter.key_hook(up_down,keysym);
this._cancel();
this.change_mode("NO_TRANSLATE");
break;
case TXK_D0:
case TXK_D1:
case TXK_D2:
case TXK_D3:
case TXK_D4:
case TXK_D5:
case TXK_D6:
case TXK_D7:
case TXK_D8:
case TXK_D9:
case TXK_ASTERISK:
if(this.input_method==IME_5STROKE){
this._decide_adjust_all();
this.change_mode("NO_TRANSLATE");
ret=this.input_5stroke.key_hook(up_down,keysym);}
break;
case TXK_SHARP:
if(this.input_method==IME_5STROKE){
ret=true;}
break;
default:
break;};
return ret;};
IME_Master.prototype._key_hook_adjust_usbkbd=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
if(typeof keysym!="object"){
keysym=this.get_txkb_keysym();}
if(!keysym)
return true;
if(keysym.type==keysym.CHAR){
switch(keysym.code){
case " ":
ret=this.converter.key_hook(up_down,keysym);
if(keysym.scancode==TXKB_SC_Muhenkan){
this._cancel();
this.change_mode("NO_TRANSLATE");}else {
this.change_mode("TRANSLATE");}
break;
default:
this._decide_adjust_all();
this.change_mode("NO_TRANSLATE");
ret=this.input_usbkbd.key_hook(up_down,keysym);
break;}
}else {
switch(keysym.code){
case TXKB_Up:
case TXKB_Down:
ret=this.converter.key_hook(up_down,keysym);
this.change_mode("TRANSLATE");
break;
case TXKB_Left:
case TXKB_Right:
this.converter.key_hook(up_down,keysym);
ret=true;
break;
case TXKB_Return:
ret=this.converter.key_hook(up_down,keysym);
this._decide_adjust();
break;
case TXKB_BackSpace:
ret=this.converter.key_hook(up_down,keysym);
this._cancel();
this.change_mode("NO_TRANSLATE");
ret=true;
break;
case TXKB_F9:
case TXKB_F10:
case TXKB_F11:
ret=true;
break;
case TXKB_F12:
ret=this.converter.key_hook(up_down,keysym);
this._cancel();
this.change_mode("NO_TRANSLATE");
break;
default:
break;}
}
return ret;};
IME_Master.prototype._key_hook_select_char_type=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
switch(keysym){
case TXK_UP:
this.switch_menu.up();
ret=true;
break;
case TXK_DOWN:
this.switch_menu.down();
ret=true;
break;
case TXK_LEFT:
case TXK_RIGHT:
ret=true;
break;
case TXK_GREEN:
this.switch_menu.down();
ret=true;
break;
case TXK_RETURN:
case TXK_YELLOW:
this.switch_menu.revert_pos_to_selected();
if(this.is_direct_input||this.char_type==NUM_TYPE){
this.change_mode("DIRECT_INPUT");}else {
this.change_mode("NO_INPUT");}
ret=true;
break;
case TXK_ENTER:
if(this.is_direct_input){
this.change_char_type(this.switch_menu.get_current_position()+2);this.change_mode("DIRECT_INPUT");}else {
this.change_char_type(this.switch_menu.get_current_position());
if(this.char_type==NUM_TYPE){
this.change_mode("DIRECT_INPUT");}else {
this.change_mode("NO_INPUT");}
}
ret=true;
break;
case TXK_D0:
case TXK_D1:
case TXK_D2:
case TXK_D3:
case TXK_D4:
case TXK_D5:
case TXK_D6:
case TXK_D7:
case TXK_D8:
case TXK_D9:
case TXK_ASTERISK:
case TXK_SHARP:
break;
default:
break;};
return ret;};

IME_Master.prototype._key_hook_direct_input=function (up_down,keysym){
var ret=false;
switch(this.input_method){
case IME_5STROKE:
ret=this._key_hook_direct_input_5stroke(up_down,keysym);
break;
case IME_SOFTKBD:
ret=this._key_hook_direct_input_softkbd(up_down,keysym);
break;
case IME_USBKBD:
ret=this._key_hook_direct_input_usbkbd(up_down,keysym);
break;
default:
break;}
return ret;};
IME_Master.prototype._key_hook_direct_input_5stroke=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
this.input_5stroke.key_hook(up_down,keysym);
switch(keysym){
case TXK_UP:
case TXK_DOWN:
this._decide_direct_input();
break;
case TXK_LEFT:
if(this.input_method==IME_5STROKE)
this.input_5stroke.clear();
ret=this.text_box.cursor_left();
break;
case TXK_RIGHT:
if(this.input_method==IME_5STROKE)
this.input_5stroke.clear();
ret=this.text_box.cursor_right();
break;
case TXK_ENTER:
this._decide_direct_input();
this.text_box.fix_char();
ret=true;
break;
case TXK_RED:
case TXK_BLUE:
break;
case TXK_YELLOW:
this.text_box.backspace_text();
this._decide_direct_input();
this.UserHookFunc();
ret=true;
break;
case TXK_GREEN:
this.change_mode("SELECT_CHAR_TYPE");
this.text_box.fix_char();
ret=true;
break;
case TXK_D0:
case TXK_D1:
case TXK_D2:
case TXK_D3:
case TXK_D4:
case TXK_D5:
case TXK_D6:
case TXK_D7:
case TXK_D8:
case TXK_D9:
case TXK_ASTERISK:
case TXK_SHARP:
switch(this.char_type){
case EISU_TYPE:
ret=true;
break;
case NUM_TYPE:
this._decide_direct_input();
ret=true;
break;
default:
console.log("[ERROR] Invalid character type.");
break;}
break;
case TXK_RETURN:
this._decide_direct_input();
ret=false;
break;
default:
break;};
return ret;};
IME_Master.prototype._key_hook_direct_input_softkbd=function (up_down,keysym){
var ret=false;
if(this.is_softkbd_finished){
if(up_down!=KEY_PRESS)
return true;
switch(keysym){
case TXK_LEFT:
ret=this.text_box.cursor_left();
break;
case TXK_RIGHT:
ret=this.text_box.cursor_right();
break;
case TXK_ENTER:
this.is_softkbd_finished=false;
this.input_softkbd.appear_kbd();
ret=true;
break;
default:
break;}
}else {
ret=this.input_softkbd.key_hook(up_down,keysym);
if(up_down!=KEY_PRESS)
return true;
if(this.input_softkbd.is_move_cursor_mode()){
this.input_softkbd.change_color_guide_mode("MOVE_CURSOR");}else if(this.input_softkbd.get_text_array().length==0){
this.input_softkbd.change_color_guide_mode("NO_INPUT");}else{
this._decide_direct_input();}
if(ret==false){
switch(keysym){
case TXK_LEFT:
ret=this.text_box.cursor_left();
break;
case TXK_RIGHT:
ret=this.text_box.cursor_right();
break;
case TXK_RED:
if(!this.input_softkbd.is_move_cursor_mode()){
this.input_softkbd.disappear();
this.input_softkbd.disappear_kbd();
this.is_softkbd_finished=true;}
break;
case TXK_GREEN:
case TXK_BLUE:
break;
case TXK_YELLOW:
this.text_box.backspace_text();
this.UserHookFunc();
ret=true;
break;
case TXK_RETURN:
break;
default:
break;};}
if(keysym==TXK_ENTER){
if(this.input_softkbd.is_move_cursor_mode())
this.input_softkbd.change_color_guide_mode("CURSOR_MOVE");
else {
this.input_softkbd.change_color_guide_mode(this.mode);}
}
}
return ret;};
IME_Master.prototype._key_hook_direct_input_usbkbd=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
if(typeof keysym!="object"){
keysym=this.get_txkb_keysym();}
if(!keysym)
return true;
if(keysym.type==keysym.CHAR){
ret=this.input_usbkbd.key_hook(up_down,keysym);
this._decide_direct_input();}else {
switch(keysym.code){
case TXKB_Left:
ret=this.text_box.cursor_left();
break;
case TXKB_Right:
ret=this.text_box.cursor_right();
break;
case TXKB_BackSpace:
this.text_box.delete_left_text();
this.method_enter_backspace_hook();
this.UserHookFunc();
ret=true;
break;
case TXKB_Delete:
this.text_box.delete_right_text();
this.UserHookFunc();
ret=true;
break;
case TXKB_Zenkaku_Hankaku:
if(!this.is_direct_input){
ret=this._zenhankaku_action();}
break;
case TXKB_Shift_L:
case TXKB_Shift_R:
ret=this.input_usbkbd.key_hook(up_down,keysym);
break;
case TXKB_F9:
this.change_mode("CHANGE_USB_SETTING");
ret=true;
break;
case TXKB_F10:
case TXKB_F11:
case TXKB_F12:
ret=true;
break;
default:
break;}
}
return ret;};
IME_Master.prototype._key_hook_change_usb_setting=function (up_down,keysym){
var ret=false;
if(up_down!=KEY_PRESS)
return true;
if(typeof keysym!="object"){
keysym=this.get_txkb_keysym();}
if(!keysym)
return true;
ret=this.usb_setting.key_hook(up_down,keysym);
if(ret==false){
if(keysym.type==keysym.CONT){
switch(keysym.code){
case TXKB_BackSpace:
case TXKB_Return:
this.input_usbkbd.init();
this.usb_indicator.init();
var char_type=this.usb_setting.get_char_type();
this.change_char_type(char_type);
this.usb_setting.disappear();
if(char_type==NUM_TYPE||this.is_direct_input){
this.pre_char_type=HIRA_TYPE;
this.change_mode("DIRECT_INPUT");}else {
this.change_mode("NO_INPUT");}
ret=true;
break;}
}
}
return ret;};
IME_Master.prototype.key_hook=function (up_down,keysym){
return this.keyhook(up_down,keysym);};
IME_Master.prototype.keyhook=function (up_down,keysym){
var ret=false;
if(this.cursor==this.area_actor){
if(this._is_usbkbd_method(up_down,keysym)){
this.method_translate_cancel_hook();
return true;}
switch(this.mode){
case "NO_INPUT":
ret=this._key_hook_no_input(up_down,keysym);
break;
case "NO_TRANSLATE":
ret=this._key_hook_no_translate(up_down,keysym);
break;
case "TRANSLATE":
ret=this._key_hook_translate(up_down,keysym);
break;
case "ADJUST":
ret=this._key_hook_adjust(up_down,keysym);
break;
case "SELECT_CHAR_TYPE":
ret=this._key_hook_select_char_type(up_down,keysym);
break;
case "DIRECT_INPUT":
ret=this._key_hook_direct_input(up_down,keysym);
break;
case "CHANGE_USB_SETTING":
ret=this._key_hook_change_usb_setting(up_down,keysym);
break;
default:
console.log("[ERROR] Illegal mode for IME_Master Class");
break;}
if(up_down==KEY_PRESS){
this.follow_pos();}
}


if(up_down==KEY_PRESS&&keysym==TXK_HOME)
this.destroy();
force_redraw();

return ret;};
IME_Master.prototype.destroy=function (){
try{
ebus.mwnn.disconnect();}catch(x){
}
this.change_mode("NO_INPUT");
this.text_box.set_text("");
this.converter.finish();
switch(this.input_method){
case IME_5STROKE:
this.input_5stroke.clear();
this.input_5stroke.disappear();
break;
case IME_SOFTKBD:
this.input_softkbd.clear();
this.input_softkbd.disappear();
break;
default:
break;}
this.follow_pos();}
IME_Master.prototype.set_cursor=function (cursor_obj){
var pre_cursor_obj=this.cursor;
if(pre_cursor_obj==cursor_obj)
return;
if(pre_cursor_obj){
if(pre_cursor_obj.leave_focus)
pre_cursor_obj.leave_focus(pre_cursor_obj);
pre_cursor_obj.in_cursor=false;}
if(cursor_obj){
if(cursor_obj.enter_focus)
cursor_obj.enter_focus(cursor_obj);
cursor_obj.in_cursor=true;}
this.cursor=cursor_obj;};
IME_Master.prototype.enter_focus=function (){
if(this.last_cursor){
this.set_cursor(this.last_cursor);}else {
this.set_cursor(this.area_actor);}
};
IME_Master.prototype.leave_focus=function (){
console_log(">> IME_Master.prototype.leave_focus");
this.last_cursor=this.cursor;
this.set_cursor(null);};
IME_Master.prototype.change_input_char_set=function (obj){
if(obj==null||typeof obj.type=="undefined"){
console.log("[ERROR] Invalid argument.");
return;};
var type=obj.type;
this.text_box.fix_char();

switch(this.input_method){
case IME_5STROKE:
switch(type){
case "ALL":
this.is_direct_input=false;
this.input_5stroke.disappear();
this.text_box.set_5stroke_mode(false);
this.change_char_type(HIRA_TYPE);
this.change_mode("NO_INPUT");
this.switch_menu.change_input_char_set({
type:"ALL",
});
break;
case "ALPHABET":
this.is_direct_input=true;
this.input_5stroke.disappear();
this.text_box.set_5stroke_mode(true);
this.change_char_type(EISU_TYPE);
this.change_mode("DIRECT_INPUT");
this.switch_menu.change_input_char_set({
type:"ALPHABET"
});
break;
default:
console.log("[ERROR] Invalid type");
break;};
break;
case IME_SOFTKBD:
switch(type){
case "ALL":
this.is_direct_input=false;
this.text_box.set_5stroke_mode(false);
this.change_char_type(HIRA_TYPE);
this.change_mode("NO_INPUT");
this.input_softkbd.change_input_char_set({
type:"ALL"
});
this.input_softkbd.change_color_guide_mode("NO_INPUT");
break;
case "ALPHABET":
this.is_direct_input=true;
this.text_box.set_5stroke_mode(false);
this.change_char_type(EISU_TYPE);
this.change_mode("DIRECT_INPUT");
this.input_softkbd.change_input_char_set({
type:"ALPHABET"
});
this.input_softkbd.change_color_guide_mode("NO_INPUT");
break;
default:
console.log("[ERROR] Invalid type");
break;};
break;
case IME_USBKBD:
switch(type){
case "ALL":
this.is_direct_input=false;
this.text_box.set_5stroke_mode(false);
var type=this.input_usbkbd.get_char_type();
if(type==NUM_TYPE){
this.change_mode("DIRECT_INPUT");}else {
this.change_mode("NO_INPUT");}
break;
case "ALPHABET":
this.is_direct_input=true;
this.text_box.set_5stroke_mode(false);
this.forecast_switch_obj.invalid();
this.change_mode("DIRECT_INPUT");
break;
default:
console.log("[ERROR] Invalid type");
break;};
break;
default:
break;};};
IME_Master.prototype.set_keyboard_type=function (keyboard){
return true;}
IME_Master.prototype.get_keyboard_type=function (){
return "software";}
IME_Master.prototype.set_forecast_state=function (state){
if(!state||typeof state!="number")
return false;
var ret=_apps_nvram_write(nv_kbd_forecast_state,state);
return ret;};
IME_Master.prototype.get_forecast_state=function (){
var ret=_apps_nvram_read(nv_kbd_forecast_state);
return ret;};
IME_Master.prototype.set_usbkbd_state=function (state,symbol){
if(typeof state!="number"&&typeof state!="string")
return false;
if(!symbol||typeof symbol!="string")
return false;
switch(symbol){
case "forecast_state":
symbol=nv_kbd_forecast_state;
break;
case "usb_input_form":
symbol=nv_kbd_usb_input_form;
break;};
if(typeof state=="number")
state=state.toString();
var ret=_apps_nvram_write(symbol,state);
return ret;};
IME_Master.prototype.get_usbkbd_state=function (symbol){
if(!symbol||typeof symbol!="string")
return false;
switch(symbol){
case "forecast_state":
symbol=nv_kbd_forecast_state;
break;
case "usb_input_form":
symbol=nv_kbd_usb_input_form;
break;};
var ret=_apps_nvram_read(symbol);
if(ret!=null&&isFinite(ret))
ret=parseInt(ret);
return ret;};
IME_Master.prototype.set_mobile_input_func=function (){
return;};
IME_Master.prototype.set_keyboard_func=function (){
return;};
IME_Master.prototype.set_hook_func=function (func){
this.UserHookFunc=func;};
IME_Master.prototype.getText=function (){
return this.text_box.get_text();};
IME_Master.prototype.setText=function (text){
this.text_box.set_text(text);
this.follow_pos();
this.color_key_guide.translate[0]
=this.color_key_guide_pos[0]+this.switch_menu.get_width()+this.text_box.get_cursor_position();
return;};
IME_Master.prototype.hide_keyboard_change_obj=function (){
this.keyboard_change_obj.visible_p=false;
return;};
IME_Master.prototype.set_lang=function (){
return;};
IME_Master.prototype.set_mode=function (m){
switch(m){
case "PASSWD":
this.text_box.enable_password_mode();
break;
case "NORMAL":
this.text_box.disable_password_mode();
break;
default:
console.log("[ERROR] Invalid argument. pkg_keyboard_mwnn.js set_mode()");
break;}
return;};
IME_Master.prototype.get_password_mode=function (){
return this.text_box.get_password_mode();};
IME_Master.prototype.set_guide_translate=function (){
return;};
IME_Master.prototype.set_translate=function (translate){
this.translate[0]=translate[0];
this.translate[1]=translate[1];
this.translate[2]=translate[2];
return;};
IME_Master.prototype.reset_cursor=function (){
this.last_cursor=null;
return;};
IME_Master.prototype.reset_lang=function (){
return;};
IME_Master.prototype.reset_type=function (){
return;};
IME_Master.prototype.free=function (){
this.visible_p=false;
this.text_box.free();
this.converter.free();
this.switch_menu.free();
this.color_key_guide.free();
this.keyboard_change_obj.free();
if(this.input_5stroke)
this.input_5stroke.free();
if(this.input_softkbd)
this.input_softkbd.free();
return;};
IME_Master.prototype.revive=function (){
if(this.is_direct_input)
this.change_input_char_set({type:"ALPHABET"});
else
this.change_input_char_set({type:"ALL"});
this.text_box.revive();
this.converter.revive();
this.switch_menu.revive();
this.color_key_guide.revive();
this.keyboard_change_obj.revive();
if(this.input_5stroke)
this.input_5stroke.revive();
if(this.input_softkbd)
this.input_softkbd.revive();
this.visible_p=true;
return;};
IME_Master.prototype.get_softwarekbd_obj=function (){
return;};
IME_Master.prototype.get_mobileinput_obj=function (){
return;};
IME_Master.prototype.get_softwarekbd_container=function (){
this.components=[this.master_components];
this.softkbd.translate[0]=1260/2;this.softkbd.translate[1]=284/2;this.softkbd.translate[2]=0;
var softkbd_cont=new container({
components:[this.softkbd],
});
return softkbd_cont;};
IME_Master.prototype.set_softwarekbd_translate=function (translate){
if(this.softkbd){
this.softkbd.translate[0]=this.softkbd_pos[0]+translate[0];
this.softkbd.translate[1]=this.softkbd_pos[1]+translate[1];
this.softkbd.translate[2]=this.softkbd_pos[2]+translate[2];}
return;};
IME_Master.prototype.disable_move_kbd=function (translate){
if(this.input_softkbd){
this.input_softkbd.disable_move_kbd();}
this.is_enable_move_kbd=false;
return;};
IME_Master.prototype.enable_move_kbd=function (translate){
if(this.input_softkbd){
this.input_softkbd.enable_move_kbd();}
this.is_enable_move_kbd=true;
return;};
IME_Master.prototype.expand_up_softkbd=function (){
this.expand_direction_softkbd="UP";
if(this.input_softkbd){
this.input_softkbd.set_expand_direction("UP");}
};
IME_Master.prototype.expand_down_softkbd=function (){
this.expand_direction_softkbd="DOWN";
if(this.input_softkbd){
this.input_softkbd.set_expand_direction("DOWN");}
};
IME_Master.prototype._display_forecast_list_5stroke=function (){
if(this._use_forecast_mode()){
if(this.input_5stroke.get_text()==""){
this.change_mode("NO_INPUT");}else {
var result=
this.converter.display_forecast_list(this.input_5stroke.get_text());
if(result){
this.switch_menu.visible_p=false;}else {
this.switch_menu.visible_p=true;}
this.color_key_guide.set_text_translate();}
}
};
IME_Master.prototype._display_forecast_list_usbkbd=function (){
if(this._use_forecast_mode()){
if(this.input_usbkbd.get_text()==""){
this.change_mode("NO_INPUT");}else {
var result=
this.converter.display_forecast_list(this.input_usbkbd.get_text());
if(result){
this.usb_indicator.visible_p=false;
this.f_key_guide.appear();}else {
this.usb_indicator.visible_p=true;
this.f_key_guide.disappear();}
this.f_key_guide.set_text_translate();}
}
};
IME_Master.prototype._cancel_continuous_forecast_5stroke=function (){
this.converter.finish();
this.switch_menu.visible_p=true;
this.follow_pos();
this.converter.disable_do_forecast();
this.color_key_guide.change_mode("NO_INPUT");};
IME_Master.prototype._cancel_continuous_forecast_usbkbd=function (){
this.converter.finish();
this.usb_indicator.appear();
this.follow_pos();
this.converter.disable_do_forecast();};
IME_Master.prototype._use_forecast_mode=function (){
if(this.forecast_state==FORECAST_ON&&
this.char_type==HIRA_TYPE){
return true;}else {
return false;}
};
IME_Master.prototype._forecast_softkbd=function (){
if(this._use_forecast_mode()){
var can=this.converter.get_forecast_result(this.input_softkbd.get_text());
this.input_softkbd.set_candidate_info(can);}
};
IME_Master.prototype._continuous_forecast=function (){
if(this._use_forecast_mode()){
if(this.input_method==IME_5STROKE){
if(this.converter.do_forecast_again()){
this.color_key_guide.set_text_cancel();
this.switch_menu.visible_p=false;}
}else if(this.input_method==IME_USBKBD){
if(this.converter.do_forecast_again()){
this.f_key_guide.appear();
this.usb_indicator.disappear();}
}else {
var can=this.converter.get_forecast_result("");
this.input_softkbd.set_candidate_info(can);}
}
};
IME_Master.prototype._zenhankaku_action=function (){
var char_type=this.char_type;
if(char_type==NUM_TYPE){
if(this.char_type!=this.pre_char_type){
this.change_char_type(this.pre_char_type);}else {
this.change_char_type(HIRA_TYPE);}
this.change_mode("NO_INPUT");}else {
this.change_char_type(NUM_TYPE);
this.change_mode("DIRECT_INPUT");}
return true;};
IME_Master.prototype.check_txkb_keysym=function (){
if(this.txkb_keysym==null){
return false;}else {
return true;}
};
IME_Master.prototype.get_txkb_keysym=function (){
var type=0;
var txkb=this.txkb_keysym;
if(txkb==null){
return null;}
switch(txkb){
case TXKB_Return:
case TXKB_Left:
case TXKB_Up:
case TXKB_Right:
case TXKB_Down:
case TXKB_F9:
case TXKB_F10:
case TXKB_F11:
case TXKB_F12:
type=1;
break;}
return {
type:type,
code:txkb,
CONT:1,
CHAR:0
}
};
IME_Master.prototype.set_sphone_state=function (state){
this.sphone_input_mode=state.input_mode;
this.sphone_kbd_type=state.kbd_type;};
IME_Master.prototype._prepare_sphone_input=function (){
switch(this.mode){
case "NO_TRANSLATE":
this._decide_no_translate();
break;
case "TRANSLATE":
this._decide_translate_all();
break;
case "ADJUST":
this._decide_adjust_all();
break;
case "SELECT_CHAR_TYPE":
this.switch_menu.revert_pos_to_selected();
break;
case "CHANGE_USB_SETTING":
this.usb_setting.disappear();
break;}
};
IME_Master.prototype._finish_sphone_input=function (){
switch(this.pre_mode){
case "NO_INPUT":
case "NO_TRANSLATE":
case "TRANSLATE":
case "ADJUST":
this.change_mode("NO_INPUT");
break;
case "SELECT_CHAR_TYPE":
if(this.is_direct_input||this.char_type==NUM_TYPE){
this.change_mode("DIRECT_INPUT");}else {
this.change_mode("NO_INPUT");}
break;
case "CHANGE_USB_SETTING":
this.input_usbkbd.init();
this.usb_indicator.init();
var type=this.usb_setting.get_char_type();
this.change_char_type(type);
if(type==NUM_TYPE||this.is_direct_input){
this.pre_char_type=HIRA_TYPE;
this.change_mode("DIRECT_INPUT");}else {
this.change_mode("NO_INPUT");}
break;}
};
IME_Master.prototype.set_softkbd_toggle_mode=function (mode){
console_log(">> IME_Master.prototype.set_softkbd_toggle_mode: mode = "+mode);};
IME_Master.prototype.is_softkbd_state=function (){
console_log(">> IME_Master.prototype.is_softkbd_state");};
IME_Master.prototype.backspace_text=function (){
this.text_box.backspace_text();
this.follow_pos();};
IME_Master.prototype.cursor_left=function (){
switch(this.mode){
case "NO_INPUT":
this.text_box.cursor_left();
break;
case "TRANSLATE":
ret=this.converter.key_hook(KEY_PRESS,TXK_LEFT);
if(ret)
this.change_mode("ADJUST");
this.converter.conv();
this.change_mode("TRANSLATE");
break;
case "ADJUST":
this.converter.key_hook(KEY_PRESS,TXK_LEFT);
this.converter.conv();
this.change_mode("TRANSLATE");
break;}
this.follow_pos();};
IME_Master.prototype.cursor_right=function (){
var ret=false;
switch(this.mode){
case "NO_INPUT":
this.text_box.cursor_right();
break;
case "TRANSLATE":
ret=this.converter.key_hook(KEY_PRESS,TXK_RIGHT);
if(ret)
this.change_mode("ADJUST");
this.converter.conv();
this.change_mode("TRANSLATE");
break;
case "ADJUST":
this.converter.key_hook(KEY_PRESS,TXK_RIGHT);
this.converter.conv();
this.change_mode("TRANSLATE");
break;}
this.follow_pos();};
IME_Master.prototype.get_mode=function (){
return this.mode;};
IME_Master.prototype.addText=function (text){
var self=this;
this.method_add_text_hook(text);};
IME_Master.prototype.get_convert_info=function (){
return this.converter.get_convert_info();};
function send_init_event_to_sphone(){
if(ebus.smartphone.supported){
ebus.smartphone.set_keyboard_type(SPHONE_KEYBOARD_TYPE_NONE);
ebus.smartphone.set_string_input_mode(SPHONE_STRING_INPUT_NONE);}
}
function send_enter_event_to_sphone(input_mode,kbd_type){
if(ebus.smartphone.supported){
ebus.smartphone.set_keyboard_type(SPHONE_KEYBOARD_TYPE_NONE);
switch(kbd_type){
case "DEFAULT":
ebus.smartphone.set_keyboard_type(SPHONE_KEYBOARD_TYPE_DEFAULT);
break;
case "QWERTY":
ebus.smartphone.set_keyboard_type(SPHONE_KEYBOARD_TYPE_QWERTY);
break;
case "NUM":
ebus.smartphone.set_keyboard_type(SPHONE_KEYBOARD_TYPE_NUM);
break;
default:
ebus.smartphone.set_keyboard_type(SPHONE_KEYBOARD_TYPE_DEFAULT);
break;}
ebus.smartphone.set_string_input_mode(SPHONE_STRING_INPUT_NONE);
switch(input_mode){
case "ONESTR":
ebus.smartphone.set_string_input_mode(SPHONE_STRING_INPUT_ONESTR);
break;
case "STRING":
ebus.smartphone.set_string_input_mode(SPHONE_STRING_INPUT_STRING);
break;
default:
ebus.smartphone.set_string_input_mode(SPHONE_STRING_INPUT_STRING);
break;}
}
};
function send_leave_event_to_sphone(){
if(ebus.smartphone.supported){
ebus.smartphone.set_keyboard_type(SPHONE_KEYBOARD_TYPE_NONE);
ebus.smartphone.set_string_input_mode(SPHONE_STRING_INPUT_NONE);}
}
var print_key_code=function(code){
switch(code){
case TXKB_F9:
console.log("TXKB_F9");break;
case TXKB_F10:
console.log("TXKB_F10");break;
case TXKB_F11:
console.log("TXKB_F11");break;
case TXKB_F12:
console.log("TXKB_F12");break;
case TXK_LEFT:
console.log("TXK_LEFT");break;
case TXK_RIGHT:
console.log("TXK_RIGHT");break;
case TXK_UP:
console.log("TXK_UP");break;
case TXK_DOWN:
console.log("TXK_DOWN");break;
case TXK_ENTER:
console.log("TXK_ENTER");break;
case TXK_RETURN:
console.log("TXK_RETURN");break;
case TXK_HOME:
console.log("TXK_HOME");break;
case COLOR_KEY[0].KEY_CODE:
console.log("COLOR_KEY[0].KEY_CODE");break;
case COLOR_KEY[1].KEY_CODE:
console.log("COLOR_KEY[1].KEY_CODE");break;
case COLOR_KEY[2].KEY_CODE:
console.log("COLOR_KEY[2].KEY_CODE");break;
case COLOR_KEY[3].KEY_CODE:
console.log("COLOR_KEY[3].KEY_CODE");break;
case TXK_D0:
console.log("TXK_D0");break;
case TXK_D1:
console.log("TXK_D1");break;
case TXK_D2:
console.log("TXK_D2");break;
case TXK_D3:
console.log("TXK_D3");break;
case TXK_D4:
console.log("TXK_D4");break;
case TXK_D5:
console.log("TXK_D5");break;
case TXK_D6:
console.log("TXK_D6");break;
case TXK_D7:
console.log("TXK_D7");break;
case TXK_D8:
console.log("TXK_D8");break;
case TXK_D9:
console.log("TXK_D9");break;};};
provide("kbd");

