diff --git a/honoka/src/honoka_imengine.cpp b/honoka/src/honoka_imengine.cpp index bb97f7c..b8baa35 100644 --- a/honoka/src/honoka_imengine.cpp +++ b/honoka/src/honoka_imengine.cpp @@ -183,7 +183,7 @@ preeditors.push_back(new Romkan(_scim_config)); preeditors.push_back(new KanaInput(_scim_config)); m_preeditor = preeditors.at(0); - wnn = 0; + m_convertor = 0; init(); } @@ -192,7 +192,7 @@ for(unsigned int i = 0;i < preeditors.size();i ++) { delete(preeditors.at(i)); } - if (wnn->isConnected()) wnn->disconnect(); + if (m_convertor->isConnected()) m_convertor->disconnect(); } @@ -213,13 +213,13 @@ yosoku = _scim_config->read(String(HONOKA_CONFIG_YOSOKU),HONOKA_DEFAULT_YOSOKU); sType = _scim_config->read(String(HONOKA_CONFIG_SERVERTYPE),String(HONOKA_DEFAULT_SERVERTYPE)); - if (wnn) delete(wnn); + if (m_convertor) delete(m_convertor); #ifdef HAVE_LIBANTHY if (sType == "Anthy") - wnn = new AnthyConversion(_scim_config); + m_convertor = new AnthyConversion(_scim_config); else #endif - wnn = new WnnConversion(_scim_config); + m_convertor = new WnnConversion(_scim_config); defaultPreEditor = _scim_config->read(String(HONOKA_CONFIG_DEFAULT_PREEDITOR),String(HONOKA_DEFAULT_DEFAULT_PREEDITOR)); @@ -309,7 +309,7 @@ changePreEditor(defaultPreEditor); // �����ǰ�����³���Ƥ������� - wnn->connect(); + m_convertor->connect(); } @@ -384,8 +384,8 @@ update_preedit_string(m_preeditor->getText(),m_preeditor->getAttributeList()); update_preedit_caret(m_preeditor->getPos()); } - if ((!m_conversion) && yosoku && wnn->isConnected() && (sType == "Wnn7") && (!auto_conversion)) { - m_convList = wnn->getYosokuList(m_preeditor->getText()); + if ((!m_conversion) && yosoku && m_convertor->isConnected() && (sType == "Wnn7") && (!auto_conversion)) { + m_convList = m_convertor->getYosokuList(m_preeditor->getText()); if (m_convList.count) { m_lookup_table.clear(); for(unsigned int i = 0;i < m_convList.count;i ++) { @@ -415,8 +415,8 @@ */ void HonokaInstance::updateConversion() { - update_preedit_string(wnn->getText(),wnn->getAttributeList()); - update_preedit_caret(wnn->getCaretPos()); + update_preedit_string(m_convertor->getText(),m_convertor->getAttributeList()); + update_preedit_caret(m_convertor->getCaretPos()); if (m_lookup) { m_lookup_table.set_cursor_pos(m_convList.pos); update_lookup_table(m_lookup_table); @@ -462,8 +462,8 @@ } else if (k_commit.comp(key)) { if (auto_conversion) { - commit_string(wnn->getText()); - wnn->reset(); + commit_string(m_convertor->getText()); + m_convertor->reset(); } else commit_string(m_preeditor->getText(true)); m_preeditor->reset(); updatePreEditor(); @@ -538,8 +538,8 @@ // preeditor�ǽ����Ǥ��ʤ��ä����Ϥ�Ϥ�commit���ƥ��ץꥱ���������֤��٤����� if (m_preeditor->getTextLength()) { if (auto_conversion) { - commit_string(wnn->getText()); - wnn->reset(); + commit_string(m_convertor->getText()); + m_convertor->reset(); } else commit_string(m_preeditor->getText(true)); } m_preeditor->reset(); @@ -585,10 +585,10 @@ } } else if (k_commit.comp(key)) { - commit_string(wnn->getText()); - wnn->updateFrequency(); + commit_string(m_convertor->getText()); + m_convertor->updateFrequency(); m_preeditor->reset(); - wnn->reset(); + m_convertor->reset(); m_conversion = false; updatePreEditor(); m_lookup = false; @@ -596,7 +596,7 @@ return(true); } else if (k_cancel.comp(key) || k_backspace.comp(key)) { - wnn->reset(); + m_convertor->reset(); m_conversion = false; m_lookup = false; alp_count = 0; @@ -609,15 +609,15 @@ else if (m_convList.pos < 0) m_convList.pos = m_convList.count - 1; alp_count ++; - wnn->select(m_convList.pos); + m_convertor->select(m_convList.pos); updateConversion(); return(true); } else if (k_conversion_expand.comp(key) || k_conversion_shrink.comp(key)) { bool r; - k_conversion_shrink.comp(key) ? r = wnn->resizeRegion(-1) : r = wnn->resizeRegion(1); + k_conversion_shrink.comp(key) ? r = m_convertor->resizeRegion(-1) : r = m_convertor->resizeRegion(1); if (!r) return(true); - m_convList = wnn->getResultList(); + m_convList = m_convertor->getResultList(); if (alp == -1) { startLookup(); } else m_lookup = false; @@ -626,7 +626,7 @@ return(true); } else if (k_conversion_rensou.comp(key) && ((sType == "Wnn7") || (sType == "Wnn8")) ) { - m_convList = wnn->getResultList(wnn->getPos(),RENSOU); + m_convList = m_convertor->getResultList(m_convertor->getPos(),RENSOU); if (m_convList.count == 0) return(true); startLookup(); updateConversion(); @@ -634,7 +634,7 @@ return(true); } else if (k_conversion_ikeiji.comp(key) && ((sType == "Wnn7") || (sType == "Wnn8")) ) { - m_convList = wnn->getResultList(wnn->getPos(),IKEIJI); + m_convList = m_convertor->getResultList(m_convertor->getPos(),IKEIJI); if (m_convList.count == 0) return(true); startLookup(); updateConversion(); @@ -642,8 +642,8 @@ return(true); } else if (k_conversion_forward.comp(key) || k_conversion_backward.comp(key)) { - k_conversion_backward.comp(key) ? wnn->setPos(wnn->getPos() - 1) : wnn->setPos(wnn->getPos() + 1); - m_convList = wnn->getResultList(); + k_conversion_backward.comp(key) ? m_convertor->setPos(m_convertor->getPos() - 1) : m_convertor->setPos(m_convertor->getPos() + 1); + m_convList = m_convertor->getResultList(); if (alp == -1) { startLookup(); } else m_lookup = false; @@ -657,7 +657,7 @@ for(unsigned int i = 0;i < m_convList.count;i ++) { if (res == m_convList.kouho[i]) { m_convList.pos = i; - wnn->select(m_convList.pos); + m_convertor->select(m_convList.pos); updateConversion(); break; } @@ -679,19 +679,19 @@ if (numkey) { if (m_lookup_table.get_current_page_size() < numc) return(true); m_convList.pos = numc + m_lookup_table.get_current_page_start(); - wnn->select(m_convList.pos); - wnn->setPos(wnn->getPos() + 1); - m_convList = wnn->getResultList(); + m_convertor->select(m_convList.pos); + m_convertor->setPos(m_convertor->getPos() + 1); + m_convList = m_convertor->getResultList(); updateConversion(); startLookup(); return(true); } } - commit_string(wnn->getText()); - wnn->updateFrequency(); + commit_string(m_convertor->getText()); + m_convertor->updateFrequency(); m_preeditor->reset(); - wnn->reset(); + m_convertor->reset(); m_conversion = false; m_lookup = false; alp_count = 0; @@ -784,10 +784,10 @@ int p = m_lookup_table.get_current_page_start() + item; m_convList.pos = p; - wnn->select(m_convList.pos); + m_convertor->select(m_convList.pos); if (m_convList.kType != YOSOKU) { - update_preedit_string(wnn->getText(),wnn->getAttributeList()); - update_preedit_caret(wnn->getCaretPos()); + update_preedit_string(m_convertor->getText(),m_convertor->getAttributeList()); + update_preedit_caret(m_convertor->getCaretPos()); } else { update_preedit_string(m_convList.kouho.at(m_convList.pos)); update_preedit_caret(0); @@ -814,9 +814,9 @@ int p = m_convList.pos - m_lookup_table.get_current_page_size(); if (p < 0) p = 0; m_convList.pos = p; - wnn->select(m_convList.pos); - update_preedit_string(wnn->getText(),wnn->getAttributeList()); - update_preedit_caret(wnn->getCaretPos()); + m_convertor->select(m_convList.pos); + update_preedit_string(m_convertor->getText(),m_convertor->getAttributeList()); + update_preedit_caret(m_convertor->getCaretPos()); m_lookup_table.set_cursor_pos(m_convList.pos); update_lookup_table(m_lookup_table); } @@ -831,9 +831,9 @@ int p = m_convList.pos + m_lookup_table.get_current_page_size(); if (p >= m_convList.count) p = m_convList.count - 1; m_convList.pos = p; - wnn->select(m_convList.pos); - update_preedit_string(wnn->getText(),wnn->getAttributeList()); - update_preedit_caret(wnn->getCaretPos()); + m_convertor->select(m_convList.pos); + update_preedit_string(m_convertor->getText(),m_convertor->getAttributeList()); + update_preedit_caret(m_convertor->getCaretPos()); m_lookup_table.set_cursor_pos(m_convList.pos); update_lookup_table(m_lookup_table); } @@ -844,10 +844,10 @@ alp_count = 0; m_conversion = false; m_lookup = false; - wnn->reset(); + m_convertor->reset(); m_preeditor->reset(); - //if (wnn->isConnected()) wnn->wnnDisconnect(); - //wnn->wnnConnect(String("scim-wnn"),host,rc,sType,0); + //if (m_convertor->isConnected()) m_convertor->wnnDisconnect(); + //m_convertor->wnnConnect(String("scim-wnn"),host,rc,sType,0); //updatePreEditor(); } @@ -860,9 +860,9 @@ void HonokaInstance::focus_out () { if (m_conversion) { - commit_string(wnn->getText()); - wnn->updateFrequency(); - wnn->reset(); + commit_string(m_convertor->getText()); + m_convertor->updateFrequency(); + m_convertor->reset(); m_conversion = false; m_lookup = false; alp_count = 0; @@ -903,29 +903,29 @@ hide_lookup_table(); hide_aux_string(); - if (!wnn->isConnected()) { - if (!wnn->connect()) { + if (!m_convertor->isConnected()) { + if (!m_convertor->connect()) { update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); show_aux_string(); return; } } - wnn->setYomiText(s); - if (wnn->ren_conversion() == -1) { + m_convertor->setYomiText(s); + if (m_convertor->ren_conversion() == -1) { update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); show_aux_string(); return; } m_convList.kouho.clear(); - m_convList = wnn->getResultList(); + m_convList = m_convertor->getResultList(); m_conversion = true; alp_count = 1; show_preedit_string(); - update_preedit_string(wnn->getText(),wnn->getAttributeList()); - update_preedit_caret(wnn->getCaretPos()); + update_preedit_string(m_convertor->getText(),m_convertor->getAttributeList()); + update_preedit_caret(m_convertor->getCaretPos()); if (alp == -1) { startLookup(); } @@ -938,8 +938,8 @@ */ void HonokaInstance::autoConversion() { - if (!wnn->isConnected()) { - if (!wnn->connect()) { + if (!m_convertor->isConnected()) { + if (!m_convertor->connect()) { update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); show_aux_string(); show_preedit_string(); @@ -949,9 +949,9 @@ } } - wnn->reset(); - wnn->setYomiText(m_preeditor->getText(true)); - if (wnn->ren_conversion() == -1) { + m_convertor->reset(); + m_convertor->setYomiText(m_preeditor->getText(true)); + if (m_convertor->ren_conversion() == -1) { update_aux_string(utf8_mbstowcs(String(_("could not connect to jserver.")))); show_aux_string(); show_preedit_string(); @@ -961,8 +961,8 @@ } show_preedit_string(); - update_preedit_string(wnn->getText()); - update_preedit_caret(wnn->getText().size()); + update_preedit_string(m_convertor->getText()); + update_preedit_caret(m_convertor->getText().size()); } diff --git a/honoka/src/honoka_imengine.h b/honoka/src/honoka_imengine.h index 2afff4e..8c740be 100644 --- a/honoka/src/honoka_imengine.h +++ b/honoka/src/honoka_imengine.h @@ -89,7 +89,7 @@ protected: CommonLookupTable m_lookup_table; PreEditor *m_preeditor; - Convertor *wnn; + Convertor *m_convertor; bool m_conversion; bool m_yosoku; bool m_lookup; @@ -104,6 +104,7 @@ String defaultPreEditor; IConvert m_iconv; vector preeditors; + vector convertors; String sType; protected: bool process_preedit_key_event(const KeyEvent &key);