diff --git a/honoka/src/honoka_def.h b/honoka/src/honoka_def.h index c8d1207..d9d3c84 100644 --- a/honoka/src/honoka_def.h +++ b/honoka/src/honoka_def.h @@ -90,6 +90,9 @@ #define HONOKA_CONFIG_KEY_RESULTTOPREEDIT "/IMEngine/Honoka/Key/SetResultToPreEditor" #define HONOKA_DEFAULT_KEY_RESULTTOPREEDIT "Control+Return" +#define HONOKA_CONFIG_KEY_ALLRESET "/IMEngine/Honoka/Key/AllReset" +#define HONOKA_DEFAULT_KEY_ALLRESET "Control+Shift+Home" + #define HONOKA_CONFIG_ALP "/IMEngine/Honoka/AutoLookupPopup" #define HONOKA_DEFAULT_ALP 3 diff --git a/honoka/src/honoka_imengine.cpp b/honoka/src/honoka_imengine.cpp index 80ef725..75f3f8b 100644 --- a/honoka/src/honoka_imengine.cpp +++ b/honoka/src/honoka_imengine.cpp @@ -165,18 +165,12 @@ HonokaInstance::~HonokaInstance() { - HonokaTimer::destruct(); if (save_setting) { _scim_config->write(String(HONOKA_PREVIOUS_PREEDITOR),m_preeditor->getName()); _scim_config->write(String(HONOKA_PREVIOUS_PREDICTOR),m_predictor->getName()); _scim_config->write(String(HONOKA_PREVIOUS_CONVERTOR),m_convertor->getName()); } - for(unsigned int i = 0;i < plugins.size();i ++) { - plugins[i].deleteInstance(plugins[i].instance); - dlclose(plugins[i].dll); - } - delete acpredictor; - delete m_multi; + unload(); } /*! @@ -309,6 +303,25 @@ /*! + \fn HonokaInstance::unload() + */ +void HonokaInstance::unload() +{ + HonokaTimer::destruct(); + m_preeditor->reset(); + for(unsigned int i = 0;i < plugins.size();i ++) { + plugins[i].deleteInstance(plugins[i].instance); + dlclose(plugins[i].dll); + } + convertors.clear(); + preeditors.clear(); + predictors.clear(); + delete acpredictor; + delete m_multi; + plugins.clear(); +} + +/*! \fn HonokaInstance::init() */ void HonokaInstance::init() @@ -442,6 +455,9 @@ scim_string_to_key_list(k_multi_conversion, _scim_config->read(String(HONOKA_CONFIG_KEY_MULTI_CONVERSION), String(HONOKA_DEFAULT_KEY_MULTI_CONVERSION))); + scim_string_to_key_list(k_allreset, + _scim_config->read(String(HONOKA_CONFIG_KEY_ALLRESET), + String(HONOKA_DEFAULT_KEY_ALLRESET))); for(unsigned i = 0;i < 10;i ++) { char a[3]; sprintf(a,"%d",i); @@ -847,6 +863,15 @@ */ bool HonokaInstance::process_preedit_key_event(const KeyEvent &key) { + if (k_allreset.comp(key)) { + unload(); + loadPlugins(); + init(); + m_proplist.clear(); + updateProperty(); + updatePreEditor(); + return true; + } if (!m_preeditor->getTextLength()) pStringType = NORMAL; // PreEdit時のキーイベント。 // PreEditorのキーイベントフック。 diff --git a/honoka/src/honoka_imengine.h b/honoka/src/honoka_imengine.h index 7ec3c53..65a0f70 100644 --- a/honoka/src/honoka_imengine.h +++ b/honoka/src/honoka_imengine.h @@ -166,6 +166,7 @@ void createLookupTable(ResultList cList); void loadPlugins(); void init(); + void unload(); void updatePreEditor(); void updateProperty(); void updateConversion(); @@ -213,6 +214,7 @@ k_reconversion, // 再変換 k_result_to_preedit, // 変換結果をPreEditorにpush k_furigana_commit, // ふりがな付き確定 + k_allreset, // 機能全リセット // for Wnn7 k_conversion_ikeiji, // 異形字変換