/*************************************************************************** * 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. * ***************************************************************************/ // って言うか先にWnnをC++向けに優しく包み込む母のようなライブラリ激しく希望。 // ああそうですね、「お前がやれ」ですよね。 #define Uses_SCIM_UTILITY #define Uses_SCIM_IMENGINE #define Uses_SCIM_LOOKUP_TABLE #define Uses_SCIM_CONFIG_BASE #ifdef HAVE_CONFIG_H #include <config.h> #endif // 国際化のおまじない。 // まぁ愚痴を言わせてもらえば、これを毎回どうにかしなきゃいけないっつーのは // どうなんでしょうなぁ…。 // KDEなら飛ばせる部分ですが何か?。 #ifdef HAVE_GETTEXT #include <libintl.h> #define _(String) dgettext(GETTEXT_PACKAGE,String) #define N_(String) (String) #else #define _(String) (String) #define N_(String) (String) #define bindtextdomain(Package,Directory) #define textdomain(domain) #define bind_textdomain_codeset(domain,codeset) #endif // scimのおまじない。 // 一言で言えば、めんどくs #include <scim.h> #include "scim_wnn_imengine.h" #define scim_module_init wnn_LTX_scim_module_init #define scim_module_exit wnn_LTX_scim_module_exit #define scim_imengine_module_init wnn_LTX_scim_imengine_module_init #define scim_imengine_module_create_factory wnn_LTX_scim_imengine_module_create_factory #define SCIM_WNN_ICON_FILE (SCIM_ICONDIR "/scim-wnn.png") static Pointer <WnnFactory> _scim_wnn_factory; static ConfigPointer _scim_config; extern "C" { // あれでしょう。 // KDEなんかでも使われてる動的ローディングの小技。 // Cリンケージで関数名固定させて、そっからインスタンス作るっつーあれ。 // 面倒だよねぇ。まぁ別に良いけどさ。 void scim_module_init (void) { } void scim_module_exit (void) { _scim_wnn_factory.reset (); _scim_config.reset (); } unsigned int scim_imengine_module_init (const ConfigPointer &config) { _scim_config = config; return 1; } IMEngineFactoryPointer scim_imengine_module_create_factory (unsigned int factory) { if (factory != 0) return NULL; if (_scim_wnn_factory.null ()) { _scim_wnn_factory = new WnnFactory (utf8_mbstowcs (String (_("WNN"))),String("ja_JP")); } return _scim_wnn_factory; } } WnnFactory::WnnFactory() { m_name = utf8_mbstowcs(_("Wnn")); set_languages(String("ja_JP")); } WnnFactory::~ WnnFactory() { } WnnFactory::WnnFactory(const WideString & name, const String & languages) { // 文字数制限か。 if (name.length () <= 8) m_name = name; else m_name.assign (name.begin (), name.begin () + 8); // とりあえず日本語環境で固定したいトコだ。 if (languages == String ("default")) set_languages (String (_("ja_JP"))); else set_languages (languages); } WideString WnnFactory::get_name () const { // 名前を返すのね。utf8_mbstowcs(_("Wnn"))で。 return m_name; } WideString WnnFactory::get_authors () const { // AUTHERね。 return utf8_mbstowcs (String (_("(C) 2004 TAM(Teppei Tamra) <tam-t@par.odn.ne.jp>"))); } WideString WnnFactory::get_credits () const { // CREDITね。とりあえず空で。 return WideString (); } WideString WnnFactory::get_help () const { // HELPも書かないとダメなのね。 return utf8_mbstowcs (String (_("SCIM-WNN HELP"))); } String WnnFactory::get_uuid () const { // uuidgen叩いて識別と。ユニークならなんでもよさげだけども。 return String ("c069395a-d62f-4a77-8229-446e44a99976"); } String WnnFactory::get_icon_file () const { // アイコンを指定。作らないとね。 return String (SCIM_WNN_ICON_FILE); } String WnnFactory::get_language () const { // 有効locale?。とりあえず日本語に固定しときたい。 return scim_validate_language ("ja_JP"); } IMEngineInstancePointer WnnFactory::create_instance (const String& encoding, int id) { // 実際にインスタンスを作る。 return new WnnInstance (this, encoding, id); } // 淫 醋 箪 笥 // 現物。 WnnInstance::WnnInstance (WnnFactory *factory, const String& encoding, int id) : IMEngineInstanceBase (factory, encoding, id) { } WnnInstance::~ WnnInstance() { } bool WnnInstance::process_key_event (const KeyEvent& key) { } void WnnInstance::move_preedit_caret (unsigned int pos) { } void WnnInstance::select_candidate (unsigned int item) { } void WnnInstance::update_lookup_table_page_size (unsigned int page_size) { } void WnnInstance::lookup_table_page_up () { } void WnnInstance::lookup_table_page_down () { } void WnnInstance::reset () { } void WnnInstance::focus_in () { } void WnnInstance::focus_out () { } void WnnInstance::trigger_property (const String &property) { }