diff --git a/scim-wnn/src/scim_wnn_imengine.cpp b/scim-wnn/src/scim_wnn_imengine.cpp index e4119e0..a7fbebe 100644 --- a/scim-wnn/src/scim_wnn_imengine.cpp +++ b/scim-wnn/src/scim_wnn_imengine.cpp @@ -241,6 +241,7 @@ { if (key.code == SCIM_KEY_Return) { commit_string(wnn.getText()); + wnn.updateFrequency(); m_rk.reset(); wnn.reset(); m_conversion = false; @@ -274,10 +275,12 @@ } m_convList = wnn.getConversionList(); update_preedit_string(wnn.getText(),wnn.getAttributeList()); + update_preedit_caret(wnn.getText().length()); return(true); } if (isprint(key.code)) { commit_string(wnn.getText()); + wnn.updateFrequency(); m_rk.reset(); wnn.reset(); m_conversion = false; diff --git a/scim-wnn/src/wnnconversion.cpp b/scim-wnn/src/wnnconversion.cpp index 0fe92cd..faafea1 100644 --- a/scim-wnn/src/wnnconversion.cpp +++ b/scim-wnn/src/wnnconversion.cpp @@ -127,6 +127,7 @@ text.clear(); attr.clear(); pos = 0; + jl_kill(wnn,0,-1); } @@ -154,7 +155,7 @@ String y; m_iconv.convert(y,yomiText); strtows(ws,(unsigned char*)y.data()); - bunsetu = jl_ren_conv(wnn,ws,0,-1,WNN_USE_ATO); + bunsetu = jl_fi_ren_conv(wnn,ws,0,-1,WNN_NO_USE); bunList.resize(bunsetu); yomiList.resize(bunsetu); for(unsigned int i = 0;i < bunsetu;i ++) { @@ -185,7 +186,10 @@ w_char ws[1024]; char c[2048]; int s; - bunsetu = jl_nobi_conv(wnn,pos,yomiList[pos].length() + w,-1,WNN_USE_ATO,WNN_SHO); + int h = WNN_NO_USE; + if (pos > 0) h = WNN_USE_MAE; + else if (pos < bunsetu - 1) h = WNN_USE_ATO; + bunsetu = jl_fi_nobi_conv(wnn,pos,yomiList[pos].length() + w,-1,h,WNN_SHO); convList.kouho.clear(); bunList.clear(); bunList.resize(bunsetu); @@ -276,7 +280,7 @@ if (p == -1) p = pos; if ((p >= bunsetu) || (p < 0)) return(convList); pos = p; - convList.pos = jl_zenkouho(wnn,pos,WNN_USE_ATO,WNN_UNIQ); + convList.pos = jl_zenkouho(wnn,pos,WNN_USE_ZENGO,WNN_UNIQ); convList.count = jl_zenkouho_suu(wnn); convList.kouho.resize(convList.count); @@ -289,6 +293,7 @@ m_iconv.convert(u,buf,strlen(buf)); convList.kouho[i] = u; } + select(convList.pos); createText(); return(convList); @@ -301,7 +306,8 @@ bool WnnConversion::select(int p) { if (p > convList.count) p = 0; - convList.pos = p;//jl_set_jikouho(wnn,p); + convList.pos = p; + jl_set_jikouho(wnn,p); bunList.at(pos) = convList.kouho.at(p); createText(); @@ -313,3 +319,13 @@ + + +/*! + \fn WnnConversion::updateFrequency() + */ +void WnnConversion::updateFrequency() +{ + if (bunsetu) + jl_optimize_fi(wnn,0,-1); +} diff --git a/scim-wnn/src/wnnconversion.h b/scim-wnn/src/wnnconversion.h index 82f6cc9..3f0dc9c 100644 --- a/scim-wnn/src/wnnconversion.h +++ b/scim-wnn/src/wnnconversion.h @@ -61,6 +61,7 @@ bool select(int p); AttributeList getAttributeList(); bool resizeRegion(int w); + void updateFrequency(); protected: void wstostr(unsigned char *e,w_char *u); diff --git a/scim-wnn/src/wnnproto.h b/scim-wnn/src/wnnproto.h index a26e56b..d4ac145 100644 --- a/scim-wnn/src/wnnproto.h +++ b/scim-wnn/src/wnnproto.h @@ -37,6 +37,13 @@ void jl_get_zenkouho_kanji(struct wnn_buf*,int ,w_char *); int jl_set_jikouho(struct wnn_buf*,int); int jl_nobi_conv(struct wnn_buf*,int,int,int,int,int); + int jl_update_hindo(struct wnn_buf*,int,int); + int jl_kill(struct wnn_buf*,int,int); + + /* Wnn6�ʾ� */ + int jl_fi_ren_conv(struct wnn_buf*,w_char*,int,int,int); /*jl_fi_ren_conv�Ȥ��⤢�ä��ʤ� */ + int jl_optimize_fi(struct wnn_buf*,int,int); + int jl_fi_nobi_conv(struct wnn_buf*,int,int,int,int,int); #define WNN_NO_USE 0 #define WNN_USE_MAE 1