diff --git a/honoka/plugins/romkan.cpp b/honoka/plugins/romkan.cpp index fed1010..4d8c80b 100644 --- a/honoka/plugins/romkan.cpp +++ b/honoka/plugins/romkan.cpp @@ -38,13 +38,47 @@ #endif // �ץ饤�����󲽤Τ��ޤ��ʤ��Ǥ��� -HonokaPluginRegister(Romkan); +HonokaPluginRegister(RomkanPlugin); -Romkan::Romkan(ConfigPointer cfg) : PreEditor(cfg) +RomkanPlugin::RomkanPlugin(ConfigPointer cfg) : HonokaMultiplePluginBase(cfg) +{ + String c = config->read(HONOKA_CONFIG_ROMKAN_TABLE_FILE,String(HONOKA_DEFAULT_ROMKAN_TABLE_FILE)); + if (c.length()) romkans.push_back(new Romkan(cfg,String(""))); + for(unsigned int i = 1;i < 10;i ++) { + char a[3]; + sprintf(a,"%d",i); + c = config->read(String(HONOKA_CONFIG_ROMKAN_TABLE_FILE) + String(a),String("")); + if (c.length()) romkans.push_back(new Romkan(cfg,String(a))); + } +} + +RomkanPlugin::~RomkanPlugin() +{ + for(unsigned int i = 0;i < romkans.size();i ++) delete romkans[i]; +} + +HonokaPluginBase * RomkanPlugin::getPluginInstanceAt(int p) +{ + if ((p < 0) || (p >= romkans.size())) return 0; + return romkans[p]; +} + +int RomkanPlugin::getPluginCount() +{ + return romkans.size(); +} + +String RomkanPlugin::getName() +{ + return String("RomkanPlugin"); +} + +Romkan::Romkan(ConfigPointer cfg,String _postfix) : PreEditor(cfg) { reset(); iconvert.set_encoding ("EUC-JP"); mode = ROMA; + postfix = _postfix; init(); } @@ -156,7 +190,8 @@ keepTable.clear(); tableConfig.clear(); - String rk_table = config->read(HONOKA_CONFIG_ROMKAN_TABLE_FILE,String(HONOKA_DEFAULT_ROMKAN_TABLE_FILE)); + //String rk_table = config->read(HONOKA_CONFIG_ROMKAN_TABLE_FILE,String(HONOKA_DEFAULT_ROMKAN_TABLE_FILE)); + String rk_table = config->read(String(HONOKA_CONFIG_ROMKAN_TABLE_FILE) + postfix,String(HONOKA_DEFAULT_ROMKAN_TABLE_FILE)); if (rk_table.size()) { loadTable(rk_table); @@ -620,7 +655,7 @@ */ String Romkan::getName() { - return String("Romkan"); + return String("Romkan") + postfix; } /*! @@ -628,7 +663,7 @@ */ String Romkan::getPropertyName() { - return String(_("Roma")); + return String(_("Roma")) + postfix; } diff --git a/honoka/plugins/romkan.h b/honoka/plugins/romkan.h index b81e9a8..acbfdb7 100644 --- a/honoka/plugins/romkan.h +++ b/honoka/plugins/romkan.h @@ -28,7 +28,8 @@ #include #include #include -#include "preeditor.h" +#include +#include using namespace std; using namespace scim; @@ -47,10 +48,24 @@ WideString p; }; +class Romkan; +class RomkanPlugin : public HonokaMultiplePluginBase { +public: + RomkanPlugin(ConfigPointer cfg); + + ~RomkanPlugin(); + virtual HonokaPluginBase * getPluginInstanceAt(int p); + virtual int getPluginCount(); + virtual String getName(); + +protected: + vector romkans; +}; + class Romkan : public PreEditor { public: - Romkan(ConfigPointer cfg); + Romkan(ConfigPointer cfg,String _postfix); ~Romkan(); virtual void clear(); @@ -96,6 +111,7 @@ map tableConfig; String hookp; vector hookKey; + String postfix; }; #endif