diff --git a/honoka/src/Makefile.am b/honoka/src/Makefile.am index a78ab96..e90f45a 100644 --- a/honoka/src/Makefile.am +++ b/honoka/src/Makefile.am @@ -27,8 +27,8 @@ -DHONOKA_PLUGINDIR=\"@SCIM_MODULEDIR@/honoka\" noinst_HEADERS = honoka_imengine.h wnnproto.h romkan.h romkan_table.h \ - wnnconversion.h honoka_def.h kanainput.h anthyconversion.h multiconvertor.h skkdic.h \ - skkdicconversion.h wnnplugin.h wnnprediction.h + wnnconversion.h honoka_def.h kanainput.h anthyconversion.h multiconvertor.h skkdic.h \ + skkdicconversion.h wnnplugin.h wnnprediction.h resultlist.h moduledir = @SCIM_MODULEDIR@/IMEngine module_LTLIBRARIES = honoka.la @@ -70,7 +70,7 @@ lib_LTLIBRARIES = libhonoka_plugin.la libhonoka_plugin_la_SOURCES = convertor.cpp honokapluginbase.cpp preeditor.cpp \ - honokakeyeventlist.cpp honokamultiplepluginbase.cpp predictor.cpp + honokakeyeventlist.cpp honokamultiplepluginbase.cpp predictor.cpp resultlist.cpp libhonoka_plugin_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ libhonoka_plugin_la_CXXFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ libhonoka_plugin_la_LDFLAGS = @LIBTOOL_EXPORT_OPTIONS@ @INTLLIBS@ @SCIM_LIBS@ diff --git a/honoka/src/anthyconversion.cpp b/honoka/src/anthyconversion.cpp index 62aeb81..e26b31d 100644 --- a/honoka/src/anthyconversion.cpp +++ b/honoka/src/anthyconversion.cpp @@ -106,7 +106,7 @@ } bool AnthyConversion::select(int p) { - if (p < convResult[pos].count) { + if (p < convResult[pos].count()) { convResult[pos].pos = p; } } @@ -167,7 +167,7 @@ l.Title = utf8_mbstowcs(String(_("lookup result"))); struct anthy_segment_stat sstat; anthy_get_segment_stat(context,i,&sstat); - l.count = sstat.nr_candidate; + //l.count = sstat.nr_candidate; l.Yomi = yomiText.substr(slen,sstat.seg_len); slen += sstat.seg_len; l.pos = 0; diff --git a/honoka/src/convertor.cpp b/honoka/src/convertor.cpp index d83547c..ac69d56 100644 --- a/honoka/src/convertor.cpp +++ b/honoka/src/convertor.cpp @@ -19,19 +19,6 @@ ***************************************************************************/ #include "convertor.h" -ResultEntry::ResultEntry(WideString k,WideString l) -{ - kanji = k; - label = l; -} - -ResultList::ResultList() -{ - pos = 0; - count = 0; - kType = 0; -} - /* �������ߡ��᥽�åɤ������� */ Convertor::Convertor(ConfigPointer cfg) : HonokaPluginBase(String("Convertor")) diff --git a/honoka/src/convertor.h b/honoka/src/convertor.h index 8dbcda3..059da0e 100644 --- a/honoka/src/convertor.h +++ b/honoka/src/convertor.h @@ -23,6 +23,7 @@ #define Uses_SCIM_CONFIG_BASE #include +#include #include #include @@ -38,23 +39,6 @@ /** @author TAM (Teppei Tamra) */ -class ResultEntry { -public: - ResultEntry(WideString k = WideString(),WideString l = WideString()); - WideString kanji; - WideString label; -}; - -class ResultList{ -public: - ResultList(); - WideString Yomi; - WideString Title; - int pos; - int count; - int kType; - vector kouho; -}; class Convertor : public HonokaPluginBase { public: diff --git a/honoka/src/honoka_imengine.cpp b/honoka/src/honoka_imengine.cpp index 2c7da00..b18e3e4 100644 --- a/honoka/src/honoka_imengine.cpp +++ b/honoka/src/honoka_imengine.cpp @@ -556,9 +556,9 @@ // m_convList = m_convertor->getYosokuList(m_preeditor->getText()); if ((!m_conversion) && yosoku && m_predictor->isConnected() && (!auto_conversion)) { m_convList = m_predictor->getPredictionList(m_preeditor->getText()); - if (m_convList.count) { + if (m_convList.count()) { m_lookup_table.clear(); - for(unsigned int i = 0;i < m_convList.count;i ++) { + for(unsigned int i = 0;i < m_convList.count();i ++) { m_lookup_table.append_candidate(m_convList.kouho.at(i).kanji); } startLookup(); @@ -704,7 +704,7 @@ return true; } else if (k_select_yosoku.comp(key) && yosoku) { - if ((m_convList.kType == YOSOKU) && (m_convList.count)) { + if ((m_convList.kType == YOSOKU) && (m_convList.count())) { return process_yosoku_key_event(key); } } @@ -852,8 +852,8 @@ } else if (k_conversion_next.comp(key) || k_conversion_prev.comp(key)) { k_conversion_prev.comp(key) ? m_convList.pos --: m_convList.pos ++; - if (m_convList.pos >= m_convList.count) m_convList.pos = 0; - else if (m_convList.pos < 0) m_convList.pos = m_convList.count - 1; + if (m_convList.pos >= m_convList.count()) m_convList.pos = 0; + else if (m_convList.pos < 0) m_convList.pos = m_convList.count() - 1; alp_count ++; m_convertor->select(m_convList.pos); @@ -874,7 +874,7 @@ } else if (k_conversion_rensou.comp(key) && ((sType == "Wnn7") || (sType == "Wnn8")) ) { m_convList = m_convertor->getResultList(m_convertor->getPos(),RENSOU); - if (m_convList.count == 0) return true; + if (m_convList.count() == 0) return true; startLookup(); updateConversion(); alp_count = 1; @@ -882,7 +882,7 @@ } else if (k_conversion_ikeiji.comp(key) && ((sType == "Wnn7") || (sType == "Wnn8")) ) { m_convList = m_convertor->getResultList(m_convertor->getPos(),IKEIJI); - if (m_convList.count == 0) return true; + if (m_convList.count() == 0) return true; startLookup(); updateConversion(); alp_count = 1; @@ -901,7 +901,7 @@ if (k_convert_hiragana.comp(key) || k_convert_katakana.comp(key)) { WideString res = m_convList.Yomi; k_convert_hiragana.comp(key) ? m_preeditor->convKataHira(res) : m_preeditor->convHiraKata(res); - for(unsigned int i = 0;i < m_convList.count;i ++) { + for(unsigned int i = 0;i < m_convList.count();i ++) { if (res == m_convList.kouho[i].kanji) { m_convList.pos = i; m_convertor->select(m_convList.pos); @@ -1017,8 +1017,8 @@ } else if (k_conversion_next.comp(key) || k_conversion_prev.comp(key) || k_select_yosoku.comp(key)) { k_conversion_prev.comp(key) ? m_convList.pos --: m_convList.pos ++; - if (m_convList.pos >= m_convList.count) m_convList.pos = 0; - else if (m_convList.pos < 0) m_convList.pos = m_convList.count - 1; + if (m_convList.pos >= m_convList.count()) m_convList.pos = 0; + else if (m_convList.pos < 0) m_convList.pos = m_convList.count() - 1; m_lookup_table.set_cursor_pos(m_convList.pos); update_lookup_table(m_lookup_table); update_preedit_string(m_convList.kouho.at(m_convList.pos).kanji); @@ -1128,7 +1128,7 @@ return; int p = m_convList.pos + m_lookup_table.get_current_page_size(); - if (p >= m_convList.count) p = m_convList.count - 1; + if (p >= m_convList.count()) p = m_convList.count() - 1; m_convList.pos = p; m_convertor->select(m_convList.pos); update_preedit_string(m_convertor->getText(),m_convertor->getAttributeList()); @@ -1300,8 +1300,8 @@ // ����������롣 hide_lookup_table(); m_lookup_table.clear(); - if (!cList.count) return; - for (unsigned int i = 0;i < cList.count;i ++) { + if (!cList.count()) return; + for (unsigned int i = 0;i < cList.count();i ++) { if (cList.kouho.at(i).label.length()) m_lookup_table.append_candidate(cList.kouho.at(i).label); else m_lookup_table.append_candidate(cList.kouho.at(i).kanji); } @@ -1317,7 +1317,7 @@ { // ���������ɽ�����롣 createLookupTable(m_convList); - if (m_convList.count == 0) return; + if (m_convList.count() == 0) return; m_lookup = true; update_aux_string(m_convList.Title); show_aux_string(); diff --git a/honoka/src/multiconvertor.cpp b/honoka/src/multiconvertor.cpp index 2bc6f47..664a498 100644 --- a/honoka/src/multiconvertor.cpp +++ b/honoka/src/multiconvertor.cpp @@ -119,7 +119,7 @@ utf8_mbstowcs(results[i].convertor->getName()) + utf8_mbstowcs(String(")")))); } } - l.count = l.kouho.size(); + //l.count() = l.kouho.size(); result = l; return l; } @@ -157,7 +157,7 @@ vector s; for(unsigned int i = 0;;i ++) { ResultList l = instance->m_def_convertor->getResultList(i); - if (!l.count) break; + if (!l.count()) break; s.push_back(l.Yomi.length()); texts.push_back(l.kouho[0].kanji); } diff --git a/honoka/src/predictor.h b/honoka/src/predictor.h index c5c6ef8..31dcda0 100644 --- a/honoka/src/predictor.h +++ b/honoka/src/predictor.h @@ -32,8 +32,7 @@ #include #include -// @todo ResultList��å���� -#include +#include using namespace std; using namespace scim; diff --git a/honoka/src/resultlist.cpp b/honoka/src/resultlist.cpp new file mode 100644 index 0000000..b996b18 --- /dev/null +++ b/honoka/src/resultlist.cpp @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2005 by TAM(Teppei Tamra) * + * tam-t@par.odn.ne.jp * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "resultlist.h" + +ResultEntry::ResultEntry(WideString k,WideString l) +{ + kanji = k; + label = l; +} + +ResultList::ResultList() +{ + pos = 0; + kType = 0; +} + +int ResultList::count() +{ + return kouho.size(); +} diff --git a/honoka/src/resultlist.h b/honoka/src/resultlist.h new file mode 100644 index 0000000..0b27236 --- /dev/null +++ b/honoka/src/resultlist.h @@ -0,0 +1,57 @@ +/*************************************************************************** + * Copyright (C) 2005 by TAM(Teppei Tamra) * + * tam-t@par.odn.ne.jp * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef RESULTLIST_H +#define RESULTLIST_H + +#include +#include +#include +#include +#include +#include + + +using namespace std; +using namespace scim; + + +/** +@author TAM (Teppei Tamra) +*/ +class ResultEntry { +public: + ResultEntry(WideString k = WideString(),WideString l = WideString()); + WideString kanji; + WideString label; +}; + +class ResultList{ +public: + ResultList(); + WideString Yomi; + WideString Title; + int pos; + int count(); + int kType; + vector kouho; +}; + +#endif diff --git a/honoka/src/skkdicconversion.cpp b/honoka/src/skkdicconversion.cpp index 83a71b8..120b85c 100644 --- a/honoka/src/skkdicconversion.cpp +++ b/honoka/src/skkdicconversion.cpp @@ -101,7 +101,7 @@ list.Yomi.clear(); list.kouho.clear(); list.Title = utf8_mbstowcs(String(_("lookup result"))); - list.count = 0; + //list.count = 0; ResultEntry e; if (kt != 0) return list; if (p == -1) p = pos; @@ -109,7 +109,7 @@ e.kanji = buns[pos]; list.Yomi = buns[pos]; list.kouho.push_back(e); - list.count = 1; + //list.count = 1; vector es = dic->find(buns[p]); for(unsigned int i = 0;i < es.size();i ++) { e.kanji = es[i].kouho; @@ -118,7 +118,7 @@ } list.kouho.push_back(e); } - list.count = list.kouho.size(); + //list.count = list.kouho.size(); return list; } diff --git a/honoka/src/wnnconversion.cpp b/honoka/src/wnnconversion.cpp index 3ec6909..bdac3ce 100644 --- a/honoka/src/wnnconversion.cpp +++ b/honoka/src/wnnconversion.cpp @@ -347,7 +347,7 @@ { convList.Yomi = str; convList.kouho.clear(); - convList.count = 0; + //convList.count = 0; convList.pos = 0; convList.kType = YOSOKU; convList.Title = utf8_mbstowcs(String(_("yosoku lookup result"))); @@ -358,8 +358,8 @@ char c[1024]; strcpy(c,s.c_str()); if (jl_yosoku_yosoku(wnn,c) != 0) return convList; - convList.count = ykYosokuKouhoNum; - for(unsigned int i = 0;i < convList.count;i ++) { + //convList.count = ykYosokuKouhoNum; + for(unsigned int i = 0;i < ykYosokuKouhoNum;i ++) { WideString w; m_iconv.convert(w,ykYosokuKouho[i],strlen(ykYosokuKouho[i])); convList.kouho.push_back(ResultEntry(w)); @@ -381,7 +381,7 @@ convList.kouho.clear(); convList.Yomi.clear(); convList.pos = 0; - convList.count = 0; + //convList.count = 0; if ((sType != Wnn8) && (sType != Wnn7) && (kt != DEFAULT)) return convList; if (p == -1) p = pos; @@ -427,9 +427,9 @@ //convList.pos = jl_zenassoc_dai(wnn,pos,pos + 1,WNN_USE_ZENGO,WNN_UNIQ); //convList.pos = jl_zenkouho(wnn,pos,conn,WNN_UNIQ); if (convList.pos == -1) return convList; - convList.count = jl_zenkouho_suu(wnn); + int count = jl_zenkouho_suu(wnn); - for (unsigned int i = 0;i < convList.count; i ++) { + for (unsigned int i = 0;i < count; i ++) { jl_get_zenkouho_kanji(wnn,i,k); wstostr((unsigned char*)buf,k); m_iconv.convert(u,buf,strlen(buf)); @@ -447,7 +447,7 @@ */ bool WnnConversion::select(int p) { - if (p > convList.count) p = 0; + if (p > convList.count()) p = 0; convList.pos = p; switch(convList.kType) { case DEFAULT: {