diff --git a/honoka/Makefile.am b/honoka/Makefile.am index 2769013..d331a1d 100644 --- a/honoka/Makefile.am +++ b/honoka/Makefile.am @@ -28,7 +28,7 @@ ## @end 1 AUTOMAKE_OPTIONS = gnu -SUBDIRS = src intl po m4 data +SUBDIRS = libhonoka src intl po m4 data ## @start 1 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config.h.in $(AUX_DIST) diff --git a/honoka/configure.ac b/honoka/configure.ac index bc49560..01c761f 100644 --- a/honoka/configure.ac +++ b/honoka/configure.ac @@ -194,5 +194,5 @@ AC_SUBST(SCIM_DATADIR) AC_CONFIG_FILES([Makefile intl/Makefile po/Makefile.in m4/Makefile - src/Makefile data/Makefile]) + libhonoka/Makefile src/Makefile data/Makefile]) AC_OUTPUT diff --git a/honoka/libhonoka/convertor.cpp b/honoka/libhonoka/convertor.cpp new file mode 100644 index 0000000..ac69d56 --- /dev/null +++ b/honoka/libhonoka/convertor.cpp @@ -0,0 +1,132 @@ +/*************************************************************************** + * Copyright (C) 2004 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 "convertor.h" + +/* �������ߡ��᥽�åɤ������� */ + +Convertor::Convertor(ConfigPointer cfg) : HonokaPluginBase(String("Convertor")) +{ + // cfg�ץ�ѥƥ���Ȥä�SCIM������˥���������ǽ�Ǥ��� + config = cfg; +} + + +Convertor::~Convertor() +{ + // ��������λ������ǥ��ȥ饯���˽񤭤ޤ��礦�� +} + +bool Convertor::isConnected() { + // �����Ф���³�Ǥ��Ƥ��뤫�ɤ���������å�����᥽�åɡ� + // ������/���饤����ȷ��Ǥʤ��Ѵ����󥸥�ξ��Ͼ��true���֤����ɤ��Ǥ��� + return false; +} + +void Convertor::reset(){ + // reset�᥽�åɡ� + // ���Υ᥽�åɤ��ƤФ��ޤǤ��Ѵ������Ȱ����ޤ��� + return; +} + +void Convertor::setYomiText(WideString yomi) { + // �ɤߤ򥻥åȤ��ޤ��� + return; +} + +int Convertor::ren_conversion() { + // Ϣʸ���Ѵ��򳫻Ϥ��ޤ��� + // ʸ������֤��ޤ��� + return 0; +} + +WideString Convertor::getText() { + // �Ѵ���Υƥ����Ȥ򥲥åȤ��ޤ��� + // �������������ä����Ϥ��θ�Υƥ����Ȥ��֤��褦�ˤ��ޤ��� + return WideString(); +} + +int Convertor::setPos(int p){ + // ���ܤ���ʸ����֤򥻥åȤ��ޤ���0���鳫�Ϥ��ޤ��� + return 0; +} + +int Convertor::getPos() { + // ����ʸ����ֹ���֤��ޤ���0�����ֺ��Ǥ��� + return 0; +} + +ResultList Convertor::getResultList(int p,int kt){ + // ����ʸ��p���Ф���kt�ȸ����Ѵ���ˡ���Ѵ����� + // �Ѵ���̤θ���򤹤٤�ResultList��������֤��Ʋ������� + // ����/���顼�����ϸ���̵����ResultList���֤����ɤ��Ǥ��� + return ResultList(); +} + +bool Convertor::select(int p) { + // ���ߤ�����ʸ��θ����ֹ�p�����򤷤ޤ��� + return false; +} + +AttributeList Convertor::getAttributeList() { + // getText���Ф���Attribute���֤��ޤ��� + return AttributeList(); +} + +bool Convertor::resizeRegion(int w) { + // ����ʸ��������ϰϤ���ꤷ�ޤ���w�������ͤ���ꤷ�ޤ��� + return false; +} + +void Convertor::updateFrequency() { + // ���٤򹹿����������񤤤Ʋ������� + // select�Ǥ����ٹ����򤹤٤��ǤϤʤ��Ȼפ��ޤ����Ŀ�Ū�ո��� + return; +} + +bool Convertor::connect() { + // �����Ф���³���������񤭤ޤ��� + // ���פʤ�true���֤����ɤ��Ǥ��� + return false; +} +void Convertor::disconnect() { + // �����Ф�����³�����Ǥ��������񤭤ޤ��� + return; +} + +int Convertor::getCaretPos() { + // �Ѵ����Υ����åȤΰ��֤���ꤷ�ޤ��� + // SCIM�ξ��lookupTable�ϥ����åȤΰ��֤�ɽ�������褦�ʤΤ� + // ���δؿ��Ǥ��ΰ��֤򤭤�ޤ��� + return 0; +} + + +String Convertor::getName() +{ + // ̾�����֤��Ʋ������� + // ɬ����ˡ����ʤ�Τ���ꤷ�ޤ��礦�� + return String("Convertor"); +} + +String Convertor::getPropertyName() +{ + // �����λ���ǡ���ˡ����ʤ�Τ���ꤷ�ޤ��礦�� + return getName(); +} diff --git a/honoka/libhonoka/convertor.h b/honoka/libhonoka/convertor.h new file mode 100644 index 0000000..059da0e --- /dev/null +++ b/honoka/libhonoka/convertor.h @@ -0,0 +1,72 @@ +/*************************************************************************** + * Copyright (C) 2004 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 CONVERTOR_H +#define CONVERTOR_H + +#define Uses_SCIM_CONFIG_BASE + +#include +#include + +#include +#include +#include +#include +#include +#include + + +using namespace std; +using namespace scim; + +/** +@author TAM (Teppei Tamra) +*/ + +class Convertor : public HonokaPluginBase { +public: + Convertor(ConfigPointer cfg); + + ~Convertor(); + virtual bool isConnected(); + virtual void reset(); + virtual void setYomiText(WideString yomi); + virtual int ren_conversion(); + virtual WideString getText(); + virtual int setPos(int p); + virtual int getPos(); + virtual ResultList getResultList(int p = -1 ,int kt = 0); + virtual bool select(int p); + virtual AttributeList getAttributeList(); + virtual bool resizeRegion(int w); + virtual void updateFrequency(); + virtual bool connect(); + virtual void disconnect(); + virtual int getCaretPos(); + virtual String getName(); + virtual String getPropertyName(); + +protected: + ConfigPointer config; + + +}; + +#endif diff --git a/honoka/libhonoka/honokakeyeventlist.cpp b/honoka/libhonoka/honokakeyeventlist.cpp new file mode 100644 index 0000000..0ebb334 --- /dev/null +++ b/honoka/libhonoka/honokakeyeventlist.cpp @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2004 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 "honokakeyeventlist.h" + + +void HonokaKeyEventList::append(const KeyEvent &k) { + push_back(k); +} + +void HonokaKeyEventList::append(int code,int mask) { + KeyEvent k; + k.code = code; + k.mask = mask; + append(k); +} + +bool HonokaKeyEventList::comp(const KeyEvent &k) { + int kc = k.get_ascii_code(); + if ((kc > 0x60) && (kc < 0x7b)) kc -= 0x20; + else if ((kc > 0x40) && (kc < 0x5b)) kc += 0x20; + for (unsigned int i = 0;i < size();i ++) { + if ((at(i).code == k.code) && (at(i).mask == k.mask)) { + return true; + } + if (kc && (at(i).code == kc) && (at(i).mask == k.mask)) { + return true; + } + } + return false; +} + + diff --git a/honoka/libhonoka/honokakeyeventlist.h b/honoka/libhonoka/honokakeyeventlist.h new file mode 100644 index 0000000..dcdb516 --- /dev/null +++ b/honoka/libhonoka/honokakeyeventlist.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2004 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 HONOKAKEYEVENTLIST_H +#define HONOKAKEYEVENTLIST_H + +#include +#include +#include +#include +#include + +using namespace scim; +using namespace std; + + +/** +@author TAM (Teppei Tamra) +*/ +class HonokaKeyEventList : public KeyEventList +{ +public: + void append(const KeyEvent &k); + void append(int code,int mask); + bool comp(const KeyEvent &k); + +}; + +#endif diff --git a/honoka/libhonoka/honokamultiplepluginbase.cpp b/honoka/libhonoka/honokamultiplepluginbase.cpp new file mode 100644 index 0000000..2ee4e3c --- /dev/null +++ b/honoka/libhonoka/honokamultiplepluginbase.cpp @@ -0,0 +1,59 @@ +/*************************************************************************** + * 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 "honokamultiplepluginbase.h" + +HonokaMultiplePluginBase::HonokaMultiplePluginBase(ConfigPointer cfg) : HonokaPluginBase(String("Multiple")) +{ + config = cfg; +} + + +HonokaMultiplePluginBase::~HonokaMultiplePluginBase() +{ +} + + + + +/*! + \fn HonokaMultiplePluginBase::getPluginInstanceAt(int p) + */ +HonokaPluginBase * HonokaMultiplePluginBase::getPluginInstanceAt(int p) +{ + return 0; +} + + +/*! + \fn HonokaMultiplePluginBase::getPluginCount() + */ +int HonokaMultiplePluginBase::getPluginCount() +{ + return 0; +} + +/*! + \fn HonokaMultiplePluginBase::getName() + */ +String HonokaMultiplePluginBase::getName() +{ + return String("MultiplePlugin"); +} diff --git a/honoka/libhonoka/honokamultiplepluginbase.h b/honoka/libhonoka/honokamultiplepluginbase.h new file mode 100644 index 0000000..5b7755f --- /dev/null +++ b/honoka/libhonoka/honokamultiplepluginbase.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * 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 HONOKAMULTIPLEPLUGINBASE_H +#define HONOKAMULTIPLEPLUGINBASE_H + +#include + +#include +#include +#include +#include +#include + + +using namespace std; +using namespace scim; + + +/** +@author TAM (Teppei Tamra) +*/ +class HonokaMultiplePluginBase : public HonokaPluginBase { +public: + HonokaMultiplePluginBase(ConfigPointer cfg); + + ~HonokaMultiplePluginBase(); + virtual HonokaPluginBase * getPluginInstanceAt(int p); + virtual int getPluginCount(); + virtual String getName(); + +protected: + ConfigPointer config; +}; + +#endif diff --git a/honoka/libhonoka/honokapluginbase.cpp b/honoka/libhonoka/honokapluginbase.cpp new file mode 100644 index 0000000..50586ec --- /dev/null +++ b/honoka/libhonoka/honokapluginbase.cpp @@ -0,0 +1,42 @@ +/*************************************************************************** + * Copyright (C) 2004 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 "honokapluginbase.h" + +HonokaPluginBase::HonokaPluginBase(const String pluginType) +{ + type = pluginType; +} + + +HonokaPluginBase::~HonokaPluginBase() +{ +} + +String HonokaPluginBase::getPluginType() +{ + return type; +} + +String HonokaPluginBase::getName() +{ + return String("PluginBase"); +} + diff --git a/honoka/libhonoka/honokapluginbase.h b/honoka/libhonoka/honokapluginbase.h new file mode 100644 index 0000000..509a61a --- /dev/null +++ b/honoka/libhonoka/honokapluginbase.h @@ -0,0 +1,60 @@ +/*************************************************************************** + * Copyright (C) 2004 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 HONOKAPLUGINBASE_H +#define HONOKAPLUGINBASE_H + +#include +#include +#include +#include +#define Uses_SCIM_CONFIG_BASE + +#define HONOKA_PLUGIN_VERSION 1 + +using namespace std; +using namespace scim; + +/** +@author TAM (Teppei Tamra) +*/ + +#define HonokaPluginRegister(pName) \ + extern "C" { \ + HonokaPluginBase *getHonokaPluginInstance(ConfigPointer cfg) { return new pName(cfg); } \ + void deleteHonokaPluginInstance(HonokaPluginBase *o) { delete static_cast(o); } \ + int getHonokaPluginVersion() { return(HONOKA_PLUGIN_VERSION); } \ + } + +class HonokaPluginBase{ +protected: + HonokaPluginBase(const String pluginType); + ~HonokaPluginBase(); + +public: + + String getPluginType(); + virtual String getName(); + +private: + String type; +}; + +#endif diff --git a/honoka/libhonoka/predictor.cpp b/honoka/libhonoka/predictor.cpp new file mode 100644 index 0000000..ad101b8 --- /dev/null +++ b/honoka/libhonoka/predictor.cpp @@ -0,0 +1,95 @@ +/*************************************************************************** + * 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 "predictor.h" + +Predictor::Predictor(ConfigPointer cfg) : HonokaPluginBase(String("Predictor")) +{ +} + + +Predictor::~Predictor() +{ +} + + + + +/*! + \fn Predictor::getPredictionList(const WideString &str) + */ +ResultList Predictor::getPredictionList(const WideString &str) +{ + return ResultList(); +} + + +/*! + \fn Predictor::disconnect() + */ +void Predictor::disconnect() +{ + return; +} + + +/*! + \fn Predictor::connect() + */ +bool Predictor::connect() +{ + return false; +} + + +/*! + \fn Predictor::isConnected() + */ +bool Predictor::isConnected() +{ + return false; +} + + +/*! + \fn Predictor::getPropertyName() + */ +String Predictor::getPropertyName() +{ + return getName(); +} + +/*! + \fn Predictor::getName() + */ +String Predictor::getName() +{ + return String("Predicter"); +} + + + +/*! + \fn Predictor::update(const WideString str,const WideString yomi) + */ +void Predictor::update(const WideString str,const WideString yomi) +{ + return; +} diff --git a/honoka/libhonoka/predictor.h b/honoka/libhonoka/predictor.h new file mode 100644 index 0000000..31dcda0 --- /dev/null +++ b/honoka/libhonoka/predictor.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 PREDICTOR_H +#define PREDICTOR_H + +#define Uses_SCIM_CONFIG_BASE + +#include + +#include +#include +#include +#include +#include +#include + +#include + +using namespace std; +using namespace scim; + +/** +@author TAM (Teppei Tamra) +*/ +class Predictor : public HonokaPluginBase { +public: + Predictor(ConfigPointer cfg); + + ~Predictor(); + virtual ResultList getPredictionList(const WideString &str); + virtual void disconnect(); + virtual bool connect(); + virtual bool isConnected(); + virtual String getPropertyName(); + virtual String getName(); + virtual void update(const WideString str,const WideString yomi); +}; + +#endif diff --git a/honoka/libhonoka/preeditor.cpp b/honoka/libhonoka/preeditor.cpp new file mode 100644 index 0000000..04f0099 --- /dev/null +++ b/honoka/libhonoka/preeditor.cpp @@ -0,0 +1,371 @@ +/*************************************************************************** + * Copyright (C) 2004 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 "preeditor.h" + + +PreEditor::PreEditor(ConfigPointer cfg) : HonokaPluginBase(String("PreEditor")) +{ + // ���󥹥ȥ饯���� + // �����Ǥ�PreEditor��¢�ν���(Ⱦ�������Ѵ���)�ν������äƤޤ��� + iconvert.set_encoding ("EUC-JP"); + config = cfg; + if (!convChars.size()) + iconvert.convert(convChars,String("���󥡥�!~���Ѥ��")); + if (!hKanaChars.size()) { + // ���������ɤ���ʳ���ˡ�פ��Ĥ��ʤ��衼 + const String hKana[] = { + "��","��","��","��","��","��","��","��","��","��","��","����","��","����","��", + "����","��","����","��","����","��","����","��","����","��","����","��","����","��", + "����","��","����","��","����","��","��","�Ž�","��","�Î�","��","�Ď�","��","��","��", + "��","��","��","�ʎ�","�ʎ�","��","�ˎ�","�ˎ�","��","�̎�","�̎�","��","�͎�","�͎�", + "��","�Ύ�","�Ύ�","��","��","��","��","��","��","��","��","��","��","��","��", + "��","��","��","��","��","��","��","��","��","��","","","","","","","", + "��","��","","","","", + "��","��","��","��","��","��","��","��","��","��","��","����","��","����","��", + "����","��","����","��","����","��","����","��","����","��","����","��","����","��", + "����","��","����","��","����","��","��","�Ž�","��","�Î�","��","�Ď�","��","��","��", + "��","��","��","�ʎ�","�ʎ�","��","�ˎ�","�ˎ�","��","�̎�","�̎�","��","�͎�","�͎�", + "��","�Ύ�","�Ύ�","��","��","��","��","��","��","��","��","��","��","��","��", + "��","��","��","��","��","��","��","��","��","��","����","��","��","","","","", + "","-","���܎؎��ގ��ގَ�" + }; + for(unsigned int i = 0;hKana[i] != "���܎؎��ގ��ގَ�";i ++) { + if (hKana[i] != "") { + WideString k; + iconvert.convert(k,hKana[i]); + hKanaChars.insert(pair(convChars[HIRA_START] + i,k)); + } + } + } +} + + +PreEditor::~PreEditor() +{ + // ��������λ������ǥ��ȥ饯���˽񤭤ޤ��礦�� +} + +WideString PreEditor::text = WideString(); +WideString PreEditor::convChars = WideString(); +map PreEditor::hKanaChars; +int PreEditor::pos = 0; +IConvert PreEditor::iconvert; + +/*! + \fn PreEditor::getPos() + */ +int PreEditor::getPos() +{ + // �����åȤΰ��֤��֤��ޤ��� + // �����åȰ��֤δ����ϼ����ǹԤäƲ������� + return pos; +} + + +/*! + \fn PreEditor::getTextLength() + */ +int PreEditor::getTextLength() +{ + // PreEdit�ƥ����Ȥ�Ĺ�����֤��ޤ��� + // WideString���Ĥޤ��wcs�Ǥ�ʸ�����Ǥ��� + return text.length(); +} + + +/*! + \fn PreEditor::textIsEmpty() + */ +bool PreEditor::textIsEmpty() +{ + // PreEdit�ƥ����Ȥ������ɤ����֤��ޤ��� + // getTextLength������Τ��פ�ʤ��褦�ʵ��⤷�ޤ��� + return text.empty(); +} + + +/*! + \fn PreEditor::setPos(int p) + */ +void PreEditor::setPos(int p) +{ + // �����åȤΰ��֤򥻥åȤ��ޤ��� + if (p < 0) p = 0; + else if (p > getTextLength()) p = getTextLength(); + pos = p; +} + + +/*! + \fn PreEditor::clear() + */ +void PreEditor::clear() +{ + // PreEdit�ƥ����Ȥ�õ�ޤ��� + text.clear(); +} + + + +/*! + \fn PreEditor::reset() + */ +void PreEditor::reset() +{ + // PreEditor�Υꥻ�åȽ����򵭽Ҥ��ޤ��� + clear(); + pos = 0; +} + + +/*! + \fn PreEditor::getText(bool hosei) + */ +WideString PreEditor::getText(bool hosei) +{ + // PreEdit�ƥ����Ȥ��֤��ޤ��� + // hosei=true�ξ��ϡִ����ʾ��֡פΥƥ����Ȥ��֤��ޤ��� + // �㤨�Х��޻��Ѵ��ˤ�����ʸ���Ρ�n������֤�פ�ľ�����Ǥ��� + return text; +} + + +/*! + \fn PreEditor::backspace() + */ +void PreEditor::backspace() +{ + // �Хå����ڡ����������줿���ν����򵭽Ҥ��ޤ��� + if (getPos() == 0) return; + text = text.substr(0,pos - 1) + text.substr(pos); + setPos(pos - 1); +} + + + +/*! + \fn PreEditor::del() + */ +void PreEditor::del() +{ + // �ǥ꡼�Ȥ������줿���ν����򵭽Ҥ��ޤ��� + if (getPos() == getTextLength()) return; + text = text.substr(0,pos) + text.substr(pos + 1); +} + + +/*! + \fn PreEditor::convHiraKata(WideString &t) + */ +void PreEditor::convHiraKata(WideString &t) +{ + // �Ҥ餬��->���������Ѵ���static�᥽�åɤǤ��� + for(unsigned int i = 0;i < t.size();i ++) { + if ((t[i] >= convChars[HIRA_START]) && (t[i] <= convChars[HIRA_END])) + t[i] = t[i] - convChars[HIRA_START] + convChars[KATA_START]; + } + return; +} + + +/*! + \fn PreEditor::convKataHira(WideString &t) + */ +void PreEditor::convKataHira(WideString &t) +{ + // ��������->�Ҥ餬���Ѵ���static�᥽�åɤǤ��� + for(unsigned int i = 0;i < t.size();i ++) { + if ((t[i] >= convChars[KATA_START]) && (t[i] <= convChars[KATA_END])) + t[i] = t[i] - convChars[KATA_START] + convChars[HIRA_START]; + } + return; + +} + + +/*! + \fn PreEditor::convHanZen(WideString &t,int p) + */ +int PreEditor::convHanZen(WideString &t,int p) +{ + // Ⱦ��->�����Ѵ���static�᥽�åɤǤ��� + for(unsigned int i = 0;i < t.size();i ++) { + if ((t[i] >= convChars[ASCII_START]) && (t[i] <= convChars[ASCII_END])) + t[i] = t[i] - convChars[ASCII_START] + convChars[WASCII_START]; + } + return p; + +} + + +/*! + \fn PreEditor::convZenHan(WideString &t,int p) + */ +int PreEditor::convZenHan(WideString &t,int p) +{ + // ����->Ⱦ���Ѵ���static�᥽�åɤǤ��� + for(unsigned int i = 0;i < t.size();i ++) { + if ((t[i] >= convChars[WASCII_START]) && (t[i] <= convChars[WASCII_END])) + t[i] = t[i] - convChars[WASCII_START] + convChars[ASCII_START]; + + // Ķ��Ⱦ�ѥ����Ѵ� + map::iterator it = hKanaChars.find(t[i]); + if (it != hKanaChars.end()) { + WideString m1 = t.substr(0,i); + WideString m2 = t.substr(i + 1); + t = m1 + it->second + m2; + if (p > i) p += it->second.size() - 1; + i += it->second.length() - 1; + } + } + return p; + +} + + +/*! + \fn PreEditor::hiraKata() + */ +void PreEditor::hiraKata() +{ + // �Ҥ餬��->���������Ѵ������򵭽Ҥ��ޤ��� + // �ä�����ʤ���Х����Х��ɤ�ɬ�פϤ���ޤ��� + convHiraKata(text); +} + + +/*! + \fn PreEditor::kataHira() + */ +void PreEditor::kataHira() +{ + // ��������->�Ҥ餬���Ѵ������򵭽Ҥ��ޤ��� + // �ä�����ʤ���Х����Х��ɤ�ɬ�פϤ���ޤ��� + convKataHira(text); +} + + +/*! + \fn PreEditor::toHalf() + */ +void PreEditor::toHalf() +{ + // ����->Ⱦ���Ѵ������򵭽Ҥ��ޤ��� + // �ä�����ʤ���Х����Х��ɤ�ɬ�פϤ���ޤ��� + convZenHan(text,pos); +} + +/*! + \fn PreEditor::toWide() + */ +void PreEditor::toWide() +{ + // Ⱦ��->�����Ѵ������򵭽Ҥ��ޤ��� + // �ä�����ʤ���Х����Х��ɤ�ɬ�פϤ���ޤ��� + convHanZen(text,pos); +} + + +/*! + \fn PreEditor::keyEventHook(const KeyEvent &key) + */ +bool PreEditor::keyEventHook(const KeyEvent &key) +{ + // IMEngine�Υ��󥹥��󥹤����˽�������륭�����٥�Ƚ�����񤭤ޤ��� + // �ü�ʾ�������ơ������ϻ��Ѥ��ʤ������ɤ��Ȼפ��ޤ��� + // �㤨��Space��ޤ������PreEditor�ǽ�������������������Ѥ���С� + // �Ѵ������Ȥ���Space��������Ƥ��Ƥ����Ȥ��Ƥ�����Ǥ��ޤ��� + // true���֤����Ȥǰʸ�ν������˴�����ޤ��� + return false; +} + + + +/*! + \fn PreEditor::getModeName() + */ +String PreEditor::getModeName() +{ + // �ġ���С��Υץ�ѥƥ���ɽ�������⡼����ʬ��̾������ꤷ�ޤ��� + // �����ѡס�Ⱦ�ѡ�����ʸ����ɽ����������Ǥ��ޤ��� + String s; + return s; +} + + +/*! + \fn PreEditor::cancelEvent() + */ +bool PreEditor::cancelEvent() +{ + // ����󥻥�˳�����Ƥ�줿�����������줿���ν�����񤭤ޤ��� + return false; +} + + + +/*! + \fn PreEditor::inputEvent(const KeyEvent &key) + */ +bool PreEditor::inputEvent(const KeyEvent &key) +{ + // �������٥�Ƚ�����񤭤ޤ��� + // true���֤����Ȥǰʸ�ν������˴�����ޤ��� + if (isprint(key.code)){ + String s; + s = key.get_ascii_code(); + text = text.substr(0,pos) + utf8_mbstowcs(s) + text.substr(pos); + pos ++; + return true; + } + return false; +} + + +/*! + \fn PreEditor::getName() + */ +String PreEditor::getName() +{ + // ̾�����֤��ޤ��� + // ��ˡ�����̾���������Ƥޤ��礦�� + return String("PreEditor"); +} + + +/*! + \fn PreEditor::setText(const WideString &t) + */ +void PreEditor::setText(const WideString &t) +{ + // PreEdit�ƥ����Ȥ򥻥åȤ��ޤ��� + text = t; +} + + + +/*! + \fn PreEditor::getAttributeList() + */ +AttributeList PreEditor::getAttributeList() +{ + // getText��Ʊ���˻Ȥ���Attribute���֤��ޤ��� + return AttributeList(); +} diff --git a/honoka/libhonoka/preeditor.h b/honoka/libhonoka/preeditor.h new file mode 100644 index 0000000..0481b92 --- /dev/null +++ b/honoka/libhonoka/preeditor.h @@ -0,0 +1,99 @@ +/*************************************************************************** + * Copyright (C) 2004 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 PREEDITOR_H +#define PREEDITOR_H + +#include +#include + +#define Uses_SCIM_ICONV +#define Uses_SCIM_CONFIG_BASE +#include +#include +#include +#include +#include +#include + +#define HIRA_START 0 +#define HIRA_END 1 +#define KATA_START 2 +#define KATA_END 3 +#define ASCII_START 4 +#define ASCII_END 5 +#define WASCII_START 6 +#define WASCII_END 7 +#define KANA_N 8 +#define KANA_XTU 9 + +using namespace std; +using namespace scim; + + +// �Ҥ餬��/������������preedit��ʸ�������Ϥ�����ȤߤΥ١������饹�� +// ���޻������Ѵ��ʳ��ˤ��б�����٤ν����� + + +/** +@author TAM(Teppei Tamra) +*/ + +class PreEditor : public HonokaPluginBase { +public: + PreEditor(ConfigPointer cfg); + + ~PreEditor(); + virtual void clear(); + int getPos(); + virtual void setPos(int p); + int getTextLength(); + bool textIsEmpty(); + virtual void reset(); + virtual WideString getText(bool hosei = false); + virtual void backspace(); + virtual void del(); + virtual void hiraKata(); + virtual void kataHira(); + virtual bool keyEventHook(const KeyEvent &key); + virtual String getModeName(); + static void convHiraKata(WideString &t); + static void convKataHira(WideString &t); + static int convHanZen(WideString &t,int p); + static int convZenHan(WideString &t,int p); + virtual bool cancelEvent(); + virtual bool inputEvent(const KeyEvent &key); + virtual String getName(); + virtual String getPropertyName() {return String("PreEditor");}; + virtual void setText(const WideString &t); + virtual void toWide(); + virtual void toHalf(); + virtual AttributeList getAttributeList(); + +protected: + static WideString text; + static int pos; + static IConvert iconvert; + ConfigPointer config; + static WideString convChars; + static map hKanaChars; + +}; + +#endif diff --git a/honoka/libhonoka/resultlist.cpp b/honoka/libhonoka/resultlist.cpp new file mode 100644 index 0000000..b996b18 --- /dev/null +++ b/honoka/libhonoka/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/libhonoka/resultlist.h b/honoka/libhonoka/resultlist.h new file mode 100644 index 0000000..0b27236 --- /dev/null +++ b/honoka/libhonoka/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/m4/Makefile b/honoka/m4/Makefile index 9b79a61..4e43678 100644 --- a/honoka/m4/Makefile +++ b/honoka/m4/Makefile @@ -79,11 +79,11 @@ CATOBJEXT = .gmo CC = gcc CCDEPMODE = depmode=gcc3 -CFLAGS = -g -O2 -g +CFLAGS = -g -O2 CONVENIENCE_LTDL_FALSE = CONVENIENCE_LTDL_TRUE = # CPP = gcc -E -CPPFLAGS = -O3 -march=i686 -fomit-frame-pointer -fforce-addr -fexpensive-optimizations -fpeephole -fgcse -funroll-loops -g +CPPFLAGS = CXX = g++ CXXCPP = g++ -E CXXDEPMODE = depmode=gcc3 @@ -155,7 +155,7 @@ SCIM_BUILD_SETUP_TRUE = SCIM_CFLAGS = -I/usr/include/scim-1.0 SCIM_DATADIR = /usr/share/scim -SCIM_DEBUG_FLAGS = -DENABLE_DEBUG=1 +SCIM_DEBUG_FLAGS = SCIM_GTKUTILS_CFLAGS = -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -I/usr/include/scim-1.0 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include SCIM_GTKUTILS_LIBS = -Wl,--export-dynamic -lscim-gtkutils-1.0 -lgtk-x11-2.0 -lscim-1.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 SCIM_ICONDIR = /usr/share/scim/icons diff --git a/honoka/po/POTFILES.in b/honoka/po/POTFILES.in index 4363043..fe0e387 100644 --- a/honoka/po/POTFILES.in +++ b/honoka/po/POTFILES.in @@ -13,9 +13,9 @@ src/wnnprediction.cpp src/anthyconversion.h src/anthyconversion.cpp -src/preeditor.h -src/preeditor.cpp -src/convertor.h -src/convertor.cpp -src/predictor.h -src/predictor.cpp +libhonoka/preeditor.h +libhonoka/preeditor.cpp +libhonoka/convertor.h +libhonoka/convertor.cpp +libhonoka/predictor.h +libhonoka/predictor.cpp diff --git a/honoka/po/honoka.pot b/honoka/po/honoka.pot index 5b74bcd..09b7660 100644 --- a/honoka/po/honoka.pot +++ b/honoka/po/honoka.pot @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-06-20 15:54+0900\n" +"POT-Creation-Date: 2005-06-24 11:15+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -70,8 +70,8 @@ msgid "REN" msgstr "" -#: src/honoka_imengine.cpp:1226 src/honoka_imengine.cpp:1234 -#: src/honoka_imengine.cpp:1262 src/honoka_imengine.cpp:1274 +#: src/honoka_imengine.cpp:1233 src/honoka_imengine.cpp:1241 +#: src/honoka_imengine.cpp:1269 src/honoka_imengine.cpp:1281 msgid "could not connect to jserver." msgstr "" @@ -516,7 +516,7 @@ msgid "association lookup result" msgstr "" -#: src/wnnconversion.cpp:419 src/anthyconversion.cpp:171 +#: src/wnnconversion.cpp:419 src/anthyconversion.cpp:167 msgid "lookup result" msgstr "" diff --git a/honoka/po/ja.po b/honoka/po/ja.po index 7752a11..3b69222 100644 --- a/honoka/po/ja.po +++ b/honoka/po/ja.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: ja\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-06-20 15:54+0900\n" +"POT-Creation-Date: 2005-06-24 11:15+0900\n" "PO-Revision-Date: 2004-12-01 14:29+0900\n" "Last-Translator: TAM (Teppei Tamra) \n" "Language-Team: Japanese\n" @@ -72,8 +72,8 @@ msgid "REN" msgstr "[連]" -#: src/honoka_imengine.cpp:1226 src/honoka_imengine.cpp:1234 -#: src/honoka_imengine.cpp:1262 src/honoka_imengine.cpp:1274 +#: src/honoka_imengine.cpp:1233 src/honoka_imengine.cpp:1241 +#: src/honoka_imengine.cpp:1269 src/honoka_imengine.cpp:1281 msgid "could not connect to jserver." msgstr "サーバに接続できませんでした" @@ -518,7 +518,7 @@ msgid "association lookup result" msgstr "連想変換" -#: src/wnnconversion.cpp:419 src/anthyconversion.cpp:171 +#: src/wnnconversion.cpp:419 src/anthyconversion.cpp:167 msgid "lookup result" msgstr "候補一覧" diff --git a/honoka/src/Makefile.am b/honoka/src/Makefile.am index e90f45a..4d04a3e 100644 --- a/honoka/src/Makefile.am +++ b/honoka/src/Makefile.am @@ -19,7 +19,7 @@ INCLUDES = -I$(top_builddir) \ -I$(top_srcdir) \ - -I$(top_srcdir)/src \ + -I$(top_srcdir)/libhonoka \ -DSCIM_ICONDIR=\"@SCIM_ICONDIR@\" \ -DHONOKA_LOCALEDIR=\"$(datadir)/locale\" \ -DHONOKA_DATADIR=\"@SCIM_DATADIR@/honoka\" \ @@ -28,7 +28,7 @@ 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 resultlist.h + skkdicconversion.h wnnplugin.h wnnprediction.h moduledir = @SCIM_MODULEDIR@/IMEngine module_LTLIBRARIES = honoka.la @@ -40,7 +40,7 @@ honoka_la_LDFLAGS = -avoid-version -module -rpath $(moduledir) \ @LIBTOOL_EXPORT_OPTIONS@ @INTLLIBS@ @SCIM_LIBS@ -honoka_la_LIBADD = $(top_builddir)/src/libhonoka_plugin.la +honoka_la_LIBADD = $(top_builddir)/libhonoka/libhonoka_plugin.la if SCIM_BUILD_SETUP @@ -64,18 +64,6 @@ @INTLLIBS@ \ @SCIM_LIBS@ -libhonokaincludedir = $(includedir)/honoka -libhonokainclude_HEADERS = convertor.h preeditor.h honokapluginbase.h \ - honokakeyeventlist.h honokamultiplepluginbase.h predictor.h - -lib_LTLIBRARIES = libhonoka_plugin.la -libhonoka_plugin_la_SOURCES = convertor.cpp honokapluginbase.cpp preeditor.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@ - - if WNNCONVERSION WNN_PLUGIN = plugin-wnn.la endif @@ -91,29 +79,29 @@ plugin_anthy_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ plugin_anthy_la_CXXFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ plugin_anthy_la_LDFLAGS = -avoid-version -module -rpath $(plugindir) @LIBTOOL_EXPORT_OPTIONS@ @INTLLIBS@ @SCIM_LIBS@ @ANTHY_LIBS@ -plugin_anthy_la_LIBADD = $(top_builddir)/src/libhonoka_plugin.la +plugin_anthy_la_LIBADD = $(top_builddir)/libhonoka/libhonoka_plugin.la plugin_wnn_la_SOURCES = wnnconversion.cpp wnnplugin.cpp wnnprediction.cpp plugin_wnn_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ plugin_wnn_la_CXXFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ plugin_wnn_la_LDFLAGS = -avoid-version -module -rpath $(plugindir) @LIBTOOL_EXPORT_OPTIONS@ @INTLLIBS@ @SCIM_LIBS@ @WNN_LIBS@ -plugin_wnn_la_LIBADD = $(top_builddir)/src/libhonoka_plugin.la +plugin_wnn_la_LIBADD = $(top_builddir)/libhonoka/libhonoka_plugin.la plugin_skkdic_la_SOURCES = skkdic.cpp skkdicconversion.cpp plugin_skkdic_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ plugin_skkdic_la_CXXFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ plugin_skkdic_la_LDFLAGS = -avoid-version -module -rpath $(plugindir) @LIBTOOL_EXPORT_OPTIONS@ @INTLLIBS@ @SCIM_LIBS@ @ANTHY_LIBS@ -plugin_skkdic_la_LIBADD = $(top_builddir)/src/libhonoka_plugin.la +plugin_skkdic_la_LIBADD = $(top_builddir)/libhonoka/libhonoka_plugin.la plugin_romkan_la_SOURCES = romkan.cpp plugin_romkan_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ plugin_romkan_la_CXXFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ plugin_romkan_la_LDFLAGS = -avoid-version -module -rpath $(plugindir) @LIBTOOL_EXPORT_OPTIONS@ @INTLLIBS@ @SCIM_LIBS@ -plugin_romkan_la_LIBADD = $(top_builddir)/src/libhonoka_plugin.la +plugin_romkan_la_LIBADD = $(top_builddir)/libhonoka/libhonoka_plugin.la plugin_kanainput_la_SOURCES = kanainput.cpp plugin_kanainput_la_CFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ plugin_kanainput_la_CXXFLAGS = @SCIM_CFLAGS@ @SCIM_DEBUG_FLAGS@ plugin_kanainput_la_LDFLAGS = -avoid-version -module -rpath $(plugindir) @LIBTOOL_EXPORT_OPTIONS@ @INTLLIBS@ @SCIM_LIBS@ -plugin_kanainput_la_LIBADD = $(top_builddir)/src/libhonoka_plugin.la +plugin_kanainput_la_LIBADD = $(top_builddir)/libhonoka/libhonoka_plugin.la diff --git a/honoka/src/convertor.cpp b/honoka/src/convertor.cpp deleted file mode 100644 index ac69d56..0000000 --- a/honoka/src/convertor.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 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 "convertor.h" - -/* �������ߡ��᥽�åɤ������� */ - -Convertor::Convertor(ConfigPointer cfg) : HonokaPluginBase(String("Convertor")) -{ - // cfg�ץ�ѥƥ���Ȥä�SCIM������˥���������ǽ�Ǥ��� - config = cfg; -} - - -Convertor::~Convertor() -{ - // ��������λ������ǥ��ȥ饯���˽񤭤ޤ��礦�� -} - -bool Convertor::isConnected() { - // �����Ф���³�Ǥ��Ƥ��뤫�ɤ���������å�����᥽�åɡ� - // ������/���饤����ȷ��Ǥʤ��Ѵ����󥸥�ξ��Ͼ��true���֤����ɤ��Ǥ��� - return false; -} - -void Convertor::reset(){ - // reset�᥽�åɡ� - // ���Υ᥽�åɤ��ƤФ��ޤǤ��Ѵ������Ȱ����ޤ��� - return; -} - -void Convertor::setYomiText(WideString yomi) { - // �ɤߤ򥻥åȤ��ޤ��� - return; -} - -int Convertor::ren_conversion() { - // Ϣʸ���Ѵ��򳫻Ϥ��ޤ��� - // ʸ������֤��ޤ��� - return 0; -} - -WideString Convertor::getText() { - // �Ѵ���Υƥ����Ȥ򥲥åȤ��ޤ��� - // �������������ä����Ϥ��θ�Υƥ����Ȥ��֤��褦�ˤ��ޤ��� - return WideString(); -} - -int Convertor::setPos(int p){ - // ���ܤ���ʸ����֤򥻥åȤ��ޤ���0���鳫�Ϥ��ޤ��� - return 0; -} - -int Convertor::getPos() { - // ����ʸ����ֹ���֤��ޤ���0�����ֺ��Ǥ��� - return 0; -} - -ResultList Convertor::getResultList(int p,int kt){ - // ����ʸ��p���Ф���kt�ȸ����Ѵ���ˡ���Ѵ����� - // �Ѵ���̤θ���򤹤٤�ResultList��������֤��Ʋ������� - // ����/���顼�����ϸ���̵����ResultList���֤����ɤ��Ǥ��� - return ResultList(); -} - -bool Convertor::select(int p) { - // ���ߤ�����ʸ��θ����ֹ�p�����򤷤ޤ��� - return false; -} - -AttributeList Convertor::getAttributeList() { - // getText���Ф���Attribute���֤��ޤ��� - return AttributeList(); -} - -bool Convertor::resizeRegion(int w) { - // ����ʸ��������ϰϤ���ꤷ�ޤ���w�������ͤ���ꤷ�ޤ��� - return false; -} - -void Convertor::updateFrequency() { - // ���٤򹹿����������񤤤Ʋ������� - // select�Ǥ����ٹ����򤹤٤��ǤϤʤ��Ȼפ��ޤ����Ŀ�Ū�ո��� - return; -} - -bool Convertor::connect() { - // �����Ф���³���������񤭤ޤ��� - // ���פʤ�true���֤����ɤ��Ǥ��� - return false; -} -void Convertor::disconnect() { - // �����Ф�����³�����Ǥ��������񤭤ޤ��� - return; -} - -int Convertor::getCaretPos() { - // �Ѵ����Υ����åȤΰ��֤���ꤷ�ޤ��� - // SCIM�ξ��lookupTable�ϥ����åȤΰ��֤�ɽ�������褦�ʤΤ� - // ���δؿ��Ǥ��ΰ��֤򤭤�ޤ��� - return 0; -} - - -String Convertor::getName() -{ - // ̾�����֤��Ʋ������� - // ɬ����ˡ����ʤ�Τ���ꤷ�ޤ��礦�� - return String("Convertor"); -} - -String Convertor::getPropertyName() -{ - // �����λ���ǡ���ˡ����ʤ�Τ���ꤷ�ޤ��礦�� - return getName(); -} diff --git a/honoka/src/convertor.h b/honoka/src/convertor.h deleted file mode 100644 index 059da0e..0000000 --- a/honoka/src/convertor.h +++ /dev/null @@ -1,72 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 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 CONVERTOR_H -#define CONVERTOR_H - -#define Uses_SCIM_CONFIG_BASE - -#include -#include - -#include -#include -#include -#include -#include -#include - - -using namespace std; -using namespace scim; - -/** -@author TAM (Teppei Tamra) -*/ - -class Convertor : public HonokaPluginBase { -public: - Convertor(ConfigPointer cfg); - - ~Convertor(); - virtual bool isConnected(); - virtual void reset(); - virtual void setYomiText(WideString yomi); - virtual int ren_conversion(); - virtual WideString getText(); - virtual int setPos(int p); - virtual int getPos(); - virtual ResultList getResultList(int p = -1 ,int kt = 0); - virtual bool select(int p); - virtual AttributeList getAttributeList(); - virtual bool resizeRegion(int w); - virtual void updateFrequency(); - virtual bool connect(); - virtual void disconnect(); - virtual int getCaretPos(); - virtual String getName(); - virtual String getPropertyName(); - -protected: - ConfigPointer config; - - -}; - -#endif diff --git a/honoka/src/honokakeyeventlist.cpp b/honoka/src/honokakeyeventlist.cpp deleted file mode 100644 index 0ebb334..0000000 --- a/honoka/src/honokakeyeventlist.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 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 "honokakeyeventlist.h" - - -void HonokaKeyEventList::append(const KeyEvent &k) { - push_back(k); -} - -void HonokaKeyEventList::append(int code,int mask) { - KeyEvent k; - k.code = code; - k.mask = mask; - append(k); -} - -bool HonokaKeyEventList::comp(const KeyEvent &k) { - int kc = k.get_ascii_code(); - if ((kc > 0x60) && (kc < 0x7b)) kc -= 0x20; - else if ((kc > 0x40) && (kc < 0x5b)) kc += 0x20; - for (unsigned int i = 0;i < size();i ++) { - if ((at(i).code == k.code) && (at(i).mask == k.mask)) { - return true; - } - if (kc && (at(i).code == kc) && (at(i).mask == k.mask)) { - return true; - } - } - return false; -} - - diff --git a/honoka/src/honokakeyeventlist.h b/honoka/src/honokakeyeventlist.h deleted file mode 100644 index dcdb516..0000000 --- a/honoka/src/honokakeyeventlist.h +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 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 HONOKAKEYEVENTLIST_H -#define HONOKAKEYEVENTLIST_H - -#include -#include -#include -#include -#include - -using namespace scim; -using namespace std; - - -/** -@author TAM (Teppei Tamra) -*/ -class HonokaKeyEventList : public KeyEventList -{ -public: - void append(const KeyEvent &k); - void append(int code,int mask); - bool comp(const KeyEvent &k); - -}; - -#endif diff --git a/honoka/src/honokamultiplepluginbase.cpp b/honoka/src/honokamultiplepluginbase.cpp deleted file mode 100644 index 2ee4e3c..0000000 --- a/honoka/src/honokamultiplepluginbase.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * 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 "honokamultiplepluginbase.h" - -HonokaMultiplePluginBase::HonokaMultiplePluginBase(ConfigPointer cfg) : HonokaPluginBase(String("Multiple")) -{ - config = cfg; -} - - -HonokaMultiplePluginBase::~HonokaMultiplePluginBase() -{ -} - - - - -/*! - \fn HonokaMultiplePluginBase::getPluginInstanceAt(int p) - */ -HonokaPluginBase * HonokaMultiplePluginBase::getPluginInstanceAt(int p) -{ - return 0; -} - - -/*! - \fn HonokaMultiplePluginBase::getPluginCount() - */ -int HonokaMultiplePluginBase::getPluginCount() -{ - return 0; -} - -/*! - \fn HonokaMultiplePluginBase::getName() - */ -String HonokaMultiplePluginBase::getName() -{ - return String("MultiplePlugin"); -} diff --git a/honoka/src/honokamultiplepluginbase.h b/honoka/src/honokamultiplepluginbase.h deleted file mode 100644 index 5b7755f..0000000 --- a/honoka/src/honokamultiplepluginbase.h +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************** - * 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 HONOKAMULTIPLEPLUGINBASE_H -#define HONOKAMULTIPLEPLUGINBASE_H - -#include - -#include -#include -#include -#include -#include - - -using namespace std; -using namespace scim; - - -/** -@author TAM (Teppei Tamra) -*/ -class HonokaMultiplePluginBase : public HonokaPluginBase { -public: - HonokaMultiplePluginBase(ConfigPointer cfg); - - ~HonokaMultiplePluginBase(); - virtual HonokaPluginBase * getPluginInstanceAt(int p); - virtual int getPluginCount(); - virtual String getName(); - -protected: - ConfigPointer config; -}; - -#endif diff --git a/honoka/src/honokapluginbase.cpp b/honoka/src/honokapluginbase.cpp deleted file mode 100644 index 50586ec..0000000 --- a/honoka/src/honokapluginbase.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 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 "honokapluginbase.h" - -HonokaPluginBase::HonokaPluginBase(const String pluginType) -{ - type = pluginType; -} - - -HonokaPluginBase::~HonokaPluginBase() -{ -} - -String HonokaPluginBase::getPluginType() -{ - return type; -} - -String HonokaPluginBase::getName() -{ - return String("PluginBase"); -} - diff --git a/honoka/src/honokapluginbase.h b/honoka/src/honokapluginbase.h deleted file mode 100644 index 509a61a..0000000 --- a/honoka/src/honokapluginbase.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 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 HONOKAPLUGINBASE_H -#define HONOKAPLUGINBASE_H - -#include -#include -#include -#include -#define Uses_SCIM_CONFIG_BASE - -#define HONOKA_PLUGIN_VERSION 1 - -using namespace std; -using namespace scim; - -/** -@author TAM (Teppei Tamra) -*/ - -#define HonokaPluginRegister(pName) \ - extern "C" { \ - HonokaPluginBase *getHonokaPluginInstance(ConfigPointer cfg) { return new pName(cfg); } \ - void deleteHonokaPluginInstance(HonokaPluginBase *o) { delete static_cast(o); } \ - int getHonokaPluginVersion() { return(HONOKA_PLUGIN_VERSION); } \ - } - -class HonokaPluginBase{ -protected: - HonokaPluginBase(const String pluginType); - ~HonokaPluginBase(); - -public: - - String getPluginType(); - virtual String getName(); - -private: - String type; -}; - -#endif diff --git a/honoka/src/predictor.cpp b/honoka/src/predictor.cpp deleted file mode 100644 index ad101b8..0000000 --- a/honoka/src/predictor.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/*************************************************************************** - * 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 "predictor.h" - -Predictor::Predictor(ConfigPointer cfg) : HonokaPluginBase(String("Predictor")) -{ -} - - -Predictor::~Predictor() -{ -} - - - - -/*! - \fn Predictor::getPredictionList(const WideString &str) - */ -ResultList Predictor::getPredictionList(const WideString &str) -{ - return ResultList(); -} - - -/*! - \fn Predictor::disconnect() - */ -void Predictor::disconnect() -{ - return; -} - - -/*! - \fn Predictor::connect() - */ -bool Predictor::connect() -{ - return false; -} - - -/*! - \fn Predictor::isConnected() - */ -bool Predictor::isConnected() -{ - return false; -} - - -/*! - \fn Predictor::getPropertyName() - */ -String Predictor::getPropertyName() -{ - return getName(); -} - -/*! - \fn Predictor::getName() - */ -String Predictor::getName() -{ - return String("Predicter"); -} - - - -/*! - \fn Predictor::update(const WideString str,const WideString yomi) - */ -void Predictor::update(const WideString str,const WideString yomi) -{ - return; -} diff --git a/honoka/src/predictor.h b/honoka/src/predictor.h deleted file mode 100644 index 31dcda0..0000000 --- a/honoka/src/predictor.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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 PREDICTOR_H -#define PREDICTOR_H - -#define Uses_SCIM_CONFIG_BASE - -#include - -#include -#include -#include -#include -#include -#include - -#include - -using namespace std; -using namespace scim; - -/** -@author TAM (Teppei Tamra) -*/ -class Predictor : public HonokaPluginBase { -public: - Predictor(ConfigPointer cfg); - - ~Predictor(); - virtual ResultList getPredictionList(const WideString &str); - virtual void disconnect(); - virtual bool connect(); - virtual bool isConnected(); - virtual String getPropertyName(); - virtual String getName(); - virtual void update(const WideString str,const WideString yomi); -}; - -#endif diff --git a/honoka/src/preeditor.cpp b/honoka/src/preeditor.cpp deleted file mode 100644 index 04f0099..0000000 --- a/honoka/src/preeditor.cpp +++ /dev/null @@ -1,371 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 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 "preeditor.h" - - -PreEditor::PreEditor(ConfigPointer cfg) : HonokaPluginBase(String("PreEditor")) -{ - // ���󥹥ȥ饯���� - // �����Ǥ�PreEditor��¢�ν���(Ⱦ�������Ѵ���)�ν������äƤޤ��� - iconvert.set_encoding ("EUC-JP"); - config = cfg; - if (!convChars.size()) - iconvert.convert(convChars,String("���󥡥�!~���Ѥ��")); - if (!hKanaChars.size()) { - // ���������ɤ���ʳ���ˡ�פ��Ĥ��ʤ��衼 - const String hKana[] = { - "��","��","��","��","��","��","��","��","��","��","��","����","��","����","��", - "����","��","����","��","����","��","����","��","����","��","����","��","����","��", - "����","��","����","��","����","��","��","�Ž�","��","�Î�","��","�Ď�","��","��","��", - "��","��","��","�ʎ�","�ʎ�","��","�ˎ�","�ˎ�","��","�̎�","�̎�","��","�͎�","�͎�", - "��","�Ύ�","�Ύ�","��","��","��","��","��","��","��","��","��","��","��","��", - "��","��","��","��","��","��","��","��","��","��","","","","","","","", - "��","��","","","","", - "��","��","��","��","��","��","��","��","��","��","��","����","��","����","��", - "����","��","����","��","����","��","����","��","����","��","����","��","����","��", - "����","��","����","��","����","��","��","�Ž�","��","�Î�","��","�Ď�","��","��","��", - "��","��","��","�ʎ�","�ʎ�","��","�ˎ�","�ˎ�","��","�̎�","�̎�","��","�͎�","�͎�", - "��","�Ύ�","�Ύ�","��","��","��","��","��","��","��","��","��","��","��","��", - "��","��","��","��","��","��","��","��","��","��","����","��","��","","","","", - "","-","���܎؎��ގ��ގَ�" - }; - for(unsigned int i = 0;hKana[i] != "���܎؎��ގ��ގَ�";i ++) { - if (hKana[i] != "") { - WideString k; - iconvert.convert(k,hKana[i]); - hKanaChars.insert(pair(convChars[HIRA_START] + i,k)); - } - } - } -} - - -PreEditor::~PreEditor() -{ - // ��������λ������ǥ��ȥ饯���˽񤭤ޤ��礦�� -} - -WideString PreEditor::text = WideString(); -WideString PreEditor::convChars = WideString(); -map PreEditor::hKanaChars; -int PreEditor::pos = 0; -IConvert PreEditor::iconvert; - -/*! - \fn PreEditor::getPos() - */ -int PreEditor::getPos() -{ - // �����åȤΰ��֤��֤��ޤ��� - // �����åȰ��֤δ����ϼ����ǹԤäƲ������� - return pos; -} - - -/*! - \fn PreEditor::getTextLength() - */ -int PreEditor::getTextLength() -{ - // PreEdit�ƥ����Ȥ�Ĺ�����֤��ޤ��� - // WideString���Ĥޤ��wcs�Ǥ�ʸ�����Ǥ��� - return text.length(); -} - - -/*! - \fn PreEditor::textIsEmpty() - */ -bool PreEditor::textIsEmpty() -{ - // PreEdit�ƥ����Ȥ������ɤ����֤��ޤ��� - // getTextLength������Τ��פ�ʤ��褦�ʵ��⤷�ޤ��� - return text.empty(); -} - - -/*! - \fn PreEditor::setPos(int p) - */ -void PreEditor::setPos(int p) -{ - // �����åȤΰ��֤򥻥åȤ��ޤ��� - if (p < 0) p = 0; - else if (p > getTextLength()) p = getTextLength(); - pos = p; -} - - -/*! - \fn PreEditor::clear() - */ -void PreEditor::clear() -{ - // PreEdit�ƥ����Ȥ�õ�ޤ��� - text.clear(); -} - - - -/*! - \fn PreEditor::reset() - */ -void PreEditor::reset() -{ - // PreEditor�Υꥻ�åȽ����򵭽Ҥ��ޤ��� - clear(); - pos = 0; -} - - -/*! - \fn PreEditor::getText(bool hosei) - */ -WideString PreEditor::getText(bool hosei) -{ - // PreEdit�ƥ����Ȥ��֤��ޤ��� - // hosei=true�ξ��ϡִ����ʾ��֡פΥƥ����Ȥ��֤��ޤ��� - // �㤨�Х��޻��Ѵ��ˤ�����ʸ���Ρ�n������֤�פ�ľ�����Ǥ��� - return text; -} - - -/*! - \fn PreEditor::backspace() - */ -void PreEditor::backspace() -{ - // �Хå����ڡ����������줿���ν����򵭽Ҥ��ޤ��� - if (getPos() == 0) return; - text = text.substr(0,pos - 1) + text.substr(pos); - setPos(pos - 1); -} - - - -/*! - \fn PreEditor::del() - */ -void PreEditor::del() -{ - // �ǥ꡼�Ȥ������줿���ν����򵭽Ҥ��ޤ��� - if (getPos() == getTextLength()) return; - text = text.substr(0,pos) + text.substr(pos + 1); -} - - -/*! - \fn PreEditor::convHiraKata(WideString &t) - */ -void PreEditor::convHiraKata(WideString &t) -{ - // �Ҥ餬��->���������Ѵ���static�᥽�åɤǤ��� - for(unsigned int i = 0;i < t.size();i ++) { - if ((t[i] >= convChars[HIRA_START]) && (t[i] <= convChars[HIRA_END])) - t[i] = t[i] - convChars[HIRA_START] + convChars[KATA_START]; - } - return; -} - - -/*! - \fn PreEditor::convKataHira(WideString &t) - */ -void PreEditor::convKataHira(WideString &t) -{ - // ��������->�Ҥ餬���Ѵ���static�᥽�åɤǤ��� - for(unsigned int i = 0;i < t.size();i ++) { - if ((t[i] >= convChars[KATA_START]) && (t[i] <= convChars[KATA_END])) - t[i] = t[i] - convChars[KATA_START] + convChars[HIRA_START]; - } - return; - -} - - -/*! - \fn PreEditor::convHanZen(WideString &t,int p) - */ -int PreEditor::convHanZen(WideString &t,int p) -{ - // Ⱦ��->�����Ѵ���static�᥽�åɤǤ��� - for(unsigned int i = 0;i < t.size();i ++) { - if ((t[i] >= convChars[ASCII_START]) && (t[i] <= convChars[ASCII_END])) - t[i] = t[i] - convChars[ASCII_START] + convChars[WASCII_START]; - } - return p; - -} - - -/*! - \fn PreEditor::convZenHan(WideString &t,int p) - */ -int PreEditor::convZenHan(WideString &t,int p) -{ - // ����->Ⱦ���Ѵ���static�᥽�åɤǤ��� - for(unsigned int i = 0;i < t.size();i ++) { - if ((t[i] >= convChars[WASCII_START]) && (t[i] <= convChars[WASCII_END])) - t[i] = t[i] - convChars[WASCII_START] + convChars[ASCII_START]; - - // Ķ��Ⱦ�ѥ����Ѵ� - map::iterator it = hKanaChars.find(t[i]); - if (it != hKanaChars.end()) { - WideString m1 = t.substr(0,i); - WideString m2 = t.substr(i + 1); - t = m1 + it->second + m2; - if (p > i) p += it->second.size() - 1; - i += it->second.length() - 1; - } - } - return p; - -} - - -/*! - \fn PreEditor::hiraKata() - */ -void PreEditor::hiraKata() -{ - // �Ҥ餬��->���������Ѵ������򵭽Ҥ��ޤ��� - // �ä�����ʤ���Х����Х��ɤ�ɬ�פϤ���ޤ��� - convHiraKata(text); -} - - -/*! - \fn PreEditor::kataHira() - */ -void PreEditor::kataHira() -{ - // ��������->�Ҥ餬���Ѵ������򵭽Ҥ��ޤ��� - // �ä�����ʤ���Х����Х��ɤ�ɬ�פϤ���ޤ��� - convKataHira(text); -} - - -/*! - \fn PreEditor::toHalf() - */ -void PreEditor::toHalf() -{ - // ����->Ⱦ���Ѵ������򵭽Ҥ��ޤ��� - // �ä�����ʤ���Х����Х��ɤ�ɬ�פϤ���ޤ��� - convZenHan(text,pos); -} - -/*! - \fn PreEditor::toWide() - */ -void PreEditor::toWide() -{ - // Ⱦ��->�����Ѵ������򵭽Ҥ��ޤ��� - // �ä�����ʤ���Х����Х��ɤ�ɬ�פϤ���ޤ��� - convHanZen(text,pos); -} - - -/*! - \fn PreEditor::keyEventHook(const KeyEvent &key) - */ -bool PreEditor::keyEventHook(const KeyEvent &key) -{ - // IMEngine�Υ��󥹥��󥹤����˽�������륭�����٥�Ƚ�����񤭤ޤ��� - // �ü�ʾ�������ơ������ϻ��Ѥ��ʤ������ɤ��Ȼפ��ޤ��� - // �㤨��Space��ޤ������PreEditor�ǽ�������������������Ѥ���С� - // �Ѵ������Ȥ���Space��������Ƥ��Ƥ����Ȥ��Ƥ�����Ǥ��ޤ��� - // true���֤����Ȥǰʸ�ν������˴�����ޤ��� - return false; -} - - - -/*! - \fn PreEditor::getModeName() - */ -String PreEditor::getModeName() -{ - // �ġ���С��Υץ�ѥƥ���ɽ�������⡼����ʬ��̾������ꤷ�ޤ��� - // �����ѡס�Ⱦ�ѡ�����ʸ����ɽ����������Ǥ��ޤ��� - String s; - return s; -} - - -/*! - \fn PreEditor::cancelEvent() - */ -bool PreEditor::cancelEvent() -{ - // ����󥻥�˳�����Ƥ�줿�����������줿���ν�����񤭤ޤ��� - return false; -} - - - -/*! - \fn PreEditor::inputEvent(const KeyEvent &key) - */ -bool PreEditor::inputEvent(const KeyEvent &key) -{ - // �������٥�Ƚ�����񤭤ޤ��� - // true���֤����Ȥǰʸ�ν������˴�����ޤ��� - if (isprint(key.code)){ - String s; - s = key.get_ascii_code(); - text = text.substr(0,pos) + utf8_mbstowcs(s) + text.substr(pos); - pos ++; - return true; - } - return false; -} - - -/*! - \fn PreEditor::getName() - */ -String PreEditor::getName() -{ - // ̾�����֤��ޤ��� - // ��ˡ�����̾���������Ƥޤ��礦�� - return String("PreEditor"); -} - - -/*! - \fn PreEditor::setText(const WideString &t) - */ -void PreEditor::setText(const WideString &t) -{ - // PreEdit�ƥ����Ȥ򥻥åȤ��ޤ��� - text = t; -} - - - -/*! - \fn PreEditor::getAttributeList() - */ -AttributeList PreEditor::getAttributeList() -{ - // getText��Ʊ���˻Ȥ���Attribute���֤��ޤ��� - return AttributeList(); -} diff --git a/honoka/src/preeditor.h b/honoka/src/preeditor.h deleted file mode 100644 index 0481b92..0000000 --- a/honoka/src/preeditor.h +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 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 PREEDITOR_H -#define PREEDITOR_H - -#include -#include - -#define Uses_SCIM_ICONV -#define Uses_SCIM_CONFIG_BASE -#include -#include -#include -#include -#include -#include - -#define HIRA_START 0 -#define HIRA_END 1 -#define KATA_START 2 -#define KATA_END 3 -#define ASCII_START 4 -#define ASCII_END 5 -#define WASCII_START 6 -#define WASCII_END 7 -#define KANA_N 8 -#define KANA_XTU 9 - -using namespace std; -using namespace scim; - - -// �Ҥ餬��/������������preedit��ʸ�������Ϥ�����ȤߤΥ١������饹�� -// ���޻������Ѵ��ʳ��ˤ��б�����٤ν����� - - -/** -@author TAM(Teppei Tamra) -*/ - -class PreEditor : public HonokaPluginBase { -public: - PreEditor(ConfigPointer cfg); - - ~PreEditor(); - virtual void clear(); - int getPos(); - virtual void setPos(int p); - int getTextLength(); - bool textIsEmpty(); - virtual void reset(); - virtual WideString getText(bool hosei = false); - virtual void backspace(); - virtual void del(); - virtual void hiraKata(); - virtual void kataHira(); - virtual bool keyEventHook(const KeyEvent &key); - virtual String getModeName(); - static void convHiraKata(WideString &t); - static void convKataHira(WideString &t); - static int convHanZen(WideString &t,int p); - static int convZenHan(WideString &t,int p); - virtual bool cancelEvent(); - virtual bool inputEvent(const KeyEvent &key); - virtual String getName(); - virtual String getPropertyName() {return String("PreEditor");}; - virtual void setText(const WideString &t); - virtual void toWide(); - virtual void toHalf(); - virtual AttributeList getAttributeList(); - -protected: - static WideString text; - static int pos; - static IConvert iconvert; - ConfigPointer config; - static WideString convChars; - static map hKanaChars; - -}; - -#endif diff --git a/honoka/src/resultlist.cpp b/honoka/src/resultlist.cpp deleted file mode 100644 index b996b18..0000000 --- a/honoka/src/resultlist.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/*************************************************************************** - * 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 deleted file mode 100644 index 0b27236..0000000 --- a/honoka/src/resultlist.h +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************** - * 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