diff --git a/honoka/libhonoka/Makefile.am b/honoka/libhonoka/Makefile.am index d20b832..9bf35cf 100644 --- a/honoka/libhonoka/Makefile.am +++ b/honoka/libhonoka/Makefile.am @@ -25,18 +25,19 @@ -DHONOKA_ICON_FILE=\"@SCIM_ICONDIR@/honoka.png\" \ -DHONOKA_PLUGINDIR=\"@SCIM_MODULEDIR@/honoka\" -noinst_HEADERS = honokatimer.h +noinst_HEADERS = honokatimer.h honokasetupcore.h moduledir = @SCIM_MODULEDIR@/IMEngine libhonokaincludedir = $(includedir)/honoka libhonokainclude_HEADERS = convertor.h preeditor.h honokapluginbase.h \ - honokakeyeventlist.h honokamultiplepluginbase.h predictor.h resultlist.h + honokakeyeventlist.h honokamultiplepluginbase.h predictor.h \ + resultlist.h honokatimer.h honokasetupcore.h lib_LTLIBRARIES = libhonoka_plugin.la libhonoka_plugin_la_SOURCES = convertor.cpp honokapluginbase.cpp preeditor.cpp \ - honokakeyeventlist.cpp honokamultiplepluginbase.cpp predictor.cpp resultlist.cpp \ - honokatimer.cpp + honokakeyeventlist.cpp honokamultiplepluginbase.cpp predictor.cpp resultlist.cpp \ + honokatimer.cpp honokasetupcore.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/libhonoka/honokapluginbase.h b/honoka/libhonoka/honokapluginbase.h index fe3a570..e60d697 100644 --- a/honoka/libhonoka/honokapluginbase.h +++ b/honoka/libhonoka/honokapluginbase.h @@ -27,11 +27,13 @@ #include #define Uses_SCIM_CONFIG_BASE -#define HONOKA_PLUGIN_VERSION 4 +#define HONOKA_PLUGIN_VERSION 5 using namespace std; using namespace scim; +#include + /** @author TAM (Teppei Tamra) */ @@ -45,6 +47,24 @@ int getHonokaPluginVersion() { return(HONOKA_PLUGIN_VERSION); } \ } +#define HonokaPluginSetup(data) \ + extern "C" { \ + HonokaSetupCorePage *HonokaPluginSetup() { data }; \ + } +#ifndef HonokaSetup +#define HonokaSetupItem HonokaSetupCoreItem +#define HonokaSetupEntryItem HonokaSetupCoreEntryItem +#define HonokaSetupFileItem HonokaSetupCoreFileItem +#define HonokaSetupKeyItem HonokaSetupCoreKeyItem +#define HonokaSetupBoolItem HonokaSetupCoreBoolItem +#define HonokaSetupIntItem HonokaSetupCoreIntItem +#define HonokaSetupSelectItem HonokaSetupCoreSelectItem +#define HonokaSetupPage HonokaSetupCorePage +#define HonokaSetup HonokaSetupCore +#endif + + + class HonokaPluginBase{ protected: HonokaPluginBase(const String pluginType); diff --git a/honoka/libhonoka/honokasetupcore.cpp b/honoka/libhonoka/honokasetupcore.cpp new file mode 100644 index 0000000..566d1d3 --- /dev/null +++ b/honoka/libhonoka/honokasetupcore.cpp @@ -0,0 +1,169 @@ +/*************************************************************************** + * 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 "honokasetupcore.h" + +using namespace Honoka; + +HonokaSetupCoreItem::HonokaSetupCoreItem(String _label,String _name,String _tip) +{ + label = _label; + name = _name; + tip = _tip; +} + + +HonokaSetupCoreItem::~HonokaSetupCoreItem() +{ +} + +const String HonokaSetupCoreItem::getType() +{ + return type; +} + +const String HonokaSetupCoreItem::getName() +{ + return name; +} + +const String HonokaSetupCoreItem::getLabel() +{ + return label; +} + +const String HonokaSetupCoreItem::getTip() +{ + return tip; +} + +const String HonokaSetupCoreItem::getStringData() +{ + return stringData; +} + +int HonokaSetupCoreItem::getIntData() +{ + return intData; +} + +bool HonokaSetupCoreItem::getBoolData() +{ + return boolData; +} + +vector HonokaSetupCoreItem::getStringListData() +{ + return stringListData; +} + +int HonokaSetupCoreItem::getIntUpper() +{ + return intUpper; +} + +int HonokaSetupCoreItem::getIntLower() +{ + return intLower; +} + + +HonokaSetupCoreContainer::HonokaSetupCoreContainer() +{ +} + + +HonokaSetupCoreContainer::~HonokaSetupCoreContainer() +{ + for(unsigned int i = 0;i < items.size();i ++) { + delete items[i]; + } +} + +void HonokaSetupCoreContainer::append(HonokaSetupCoreItem *item) +{ + items.push_back(item); +} + +const vector HonokaSetupCoreContainer::getChildren() +{ + return items; +} + + +HonokaSetupCoreEntryItem::HonokaSetupCoreEntryItem(String _label,String _name,String _tip,String _default) +: HonokaSetupCoreItem(_label,_name,_tip) +{ + type = HONOKA_SETUP_ITEM_ENTRY; + stringData = _default; +} + +HonokaSetupCoreKeyItem::HonokaSetupCoreKeyItem(String _label,String _name,String _tip,String _default) +: HonokaSetupCoreItem(_label,_name,_tip) +{ + type = HONOKA_SETUP_ITEM_KEY; + stringData = _default; +} + +HonokaSetupCoreFileItem::HonokaSetupCoreFileItem(String _label,String _name,String _tip,String _default) +: HonokaSetupCoreItem(_label,_name,_tip) +{ + type = HONOKA_SETUP_ITEM_FILE; + stringData = _default; +} + +HonokaSetupCoreBoolItem::HonokaSetupCoreBoolItem(String _label,String _name,String _tip,bool _default) +: HonokaSetupCoreItem(_label,_name,_tip) +{ + type = HONOKA_SETUP_ITEM_BOOL; + boolData = _default; +} + +HonokaSetupCoreIntItem::HonokaSetupCoreIntItem(String _label,String _name,String _tip,int _default,int _lower,int _upper) +: HonokaSetupCoreItem(_label,_name,_tip) +{ + type = HONOKA_SETUP_ITEM_INT; + intData = _default; + intLower = _lower; + intUpper = _upper; +} + +HonokaSetupCoreSelectItem::HonokaSetupCoreSelectItem(String _label,String _name,String _tip,String _default,vector _list) +: HonokaSetupCoreItem(_label,_name,_tip) +{ + type = HONOKA_SETUP_ITEM_SELECT; + stringData = _default; + stringListData = _list; +} + +HonokaSetupCorePage::HonokaSetupCorePage(String _label,String _name,String _tip) +: HonokaSetupCoreItem(_label,_name,_tip),HonokaSetupCoreContainer() +{ + type = HONOKA_SETUP_ITEM_PAGE; +} + +HonokaSetupCore::HonokaSetupCore(String _label,String _name,String _tip) +: HonokaSetupCoreItem(_label,_name,_tip),HonokaSetupCoreContainer() +{ + type = HONOKA_SETUP_ITEM_SETUP; +} + + + diff --git a/honoka/libhonoka/honokasetupcore.h b/honoka/libhonoka/honokasetupcore.h new file mode 100644 index 0000000..8845590 --- /dev/null +++ b/honoka/libhonoka/honokasetupcore.h @@ -0,0 +1,140 @@ +/*************************************************************************** + * 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 HONOKASETUPCORE_H +#define HONOKASETUPCORE_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#define Uses_SCIM_UTILITY + +#include +#include +#include +#include + +#define HONOKA_SETUP_ITEM_ENTRY "entry" +#define HONOKA_SETUP_ITEM_FILE "file" +#define HONOKA_SETUP_ITEM_BOOL "bool" +#define HONOKA_SETUP_ITEM_KEY "key" +#define HONOKA_SETUP_ITEM_INT "int" +#define HONOKA_SETUP_ITEM_SELECT "select" +#define HONOKA_SETUP_ITEM_PAGE "page" +#define HONOKA_SETUP_ITEM_SETUP "setup" + +using namespace scim; +using namespace std; + + +/** + @author TAM (Teppei Tamra) +*/ +namespace Honoka { + +class HonokaSetupCoreItem { +public: + const String getType(); + const String getName(); + const String getLabel(); + const String getTip(); + const String getStringData(); + int getIntData(); + bool getBoolData(); + vector getStringListData(); + int getIntUpper(); + int getIntLower(); + + ~HonokaSetupCoreItem(); +protected: + HonokaSetupCoreItem(String _label,String _name,String _tip); +protected: + String type; + String label; + String name; + String tip; + String stringData; + bool boolData; + int intData; + int intUpper; + int intLower; + vector stringListData; +}; + +class HonokaSetupCoreContainer { +public: + const vector getChildren(); + virtual void append(HonokaSetupCoreItem *item); +protected: + HonokaSetupCoreContainer(); + ~HonokaSetupCoreContainer(); + vector items; +}; + + +class HonokaSetupCoreEntryItem : public HonokaSetupCoreItem { +public: + HonokaSetupCoreEntryItem(String _label,String _name,String _tip,String _default); +}; + +class HonokaSetupCoreKeyItem : public HonokaSetupCoreItem { +public: + HonokaSetupCoreKeyItem(String _label,String _name,String _tip,String _default); +}; + +class HonokaSetupCoreFileItem : public HonokaSetupCoreItem { +public: + HonokaSetupCoreFileItem(String _label,String _name,String _tip,String _default); +}; + +class HonokaSetupCoreBoolItem : public HonokaSetupCoreItem { +public: + HonokaSetupCoreBoolItem(String _label,String _name,String _tip,bool _default); +}; + +class HonokaSetupCoreIntItem : public HonokaSetupCoreItem { +public: + HonokaSetupCoreIntItem(String _label,String _name,String _tip,int _default,int _lower,int _upper); +}; + +class HonokaSetupCoreSelectItem : public HonokaSetupCoreItem { +public: + HonokaSetupCoreSelectItem(String _label,String _name,String _tip,String _default,vector _list); +}; + + +class HonokaSetupCorePage: public HonokaSetupCoreItem ,public HonokaSetupCoreContainer { +public: + HonokaSetupCorePage(String _label,String _name,String _tip); +}; + + +class HonokaSetupCore: public HonokaSetupCoreItem ,public HonokaSetupCoreContainer { +public: + HonokaSetupCore(String _label,String _name,String _tip); +}; + + + +} + + +#endif diff --git a/honoka/plugins/anthyplugin.cpp b/honoka/plugins/anthyplugin.cpp index 84b274c..84d0c95 100644 --- a/honoka/plugins/anthyplugin.cpp +++ b/honoka/plugins/anthyplugin.cpp @@ -20,7 +20,35 @@ #include "anthyplugin.h" +#ifdef HAVE_CONFIG_H + #include +#endif + + +#ifdef HAVE_GETTEXT + #include + #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 + HonokaPluginRegister(AnthyPlugin); +HonokaPluginSetup( + HonokaSetupPage *page = new HonokaSetupPage(_("Anthy-plugin"),"",""); + + page->append(new HonokaSetupBoolItem( + _("_Use this plugin: "), + String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-anthy"), + _("if you use this plugin, check this."), + true + )); + return page; +); AnthyPlugin::AnthyPlugin(ConfigPointer cfg) : HonokaMultiplePluginBase(cfg) { diff --git a/honoka/plugins/cannaconversion.cpp b/honoka/plugins/cannaconversion.cpp index bb71fac..d864c7c 100644 --- a/honoka/plugins/cannaconversion.cpp +++ b/honoka/plugins/cannaconversion.cpp @@ -38,7 +38,29 @@ // �ץ饤�����󲽤Τ��ޤ��ʤ��Ǥ��� HonokaPluginRegister(CannaConversion); - +HonokaPluginSetup( + HonokaSetupPage *page = new HonokaSetupPage(_("Canna-plugin"),"",""); + + page->append(new HonokaSetupBoolItem( + _("_Use this plugin: "), + String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-canna"), + _("if you use this plugin, check this."), + true + )); + page->append(new HonokaSetupEntryItem( + _("_Server: "), + HONOKA_CONFIG_CANNA_SERVER, + _("input the server name to connect."), + HONOKA_DEFAULT_CANNA_SERVER + )); + page->append(new HonokaSetupFileItem( + _("_DicHomeDir: "), + HONOKA_CONFIG_CANNA_DICHOMEDIRPATH, + _("set your DicHomeDir in this entry."), + HONOKA_DEFAULT_CANNA_DICHOMEDIRPATH + )); + return page; +); CannaConversion::CannaConversion(ConfigPointer cfg) : Convertor(cfg) { diff --git a/honoka/plugins/honoka_plugin_def.h b/honoka/plugins/honoka_plugin_def.h index 823cb55..6ad75e0 100644 --- a/honoka/plugins/honoka_plugin_def.h +++ b/honoka/plugins/honoka_plugin_def.h @@ -20,6 +20,7 @@ #ifndef HONOKA_PLUGIN_DEF_H #define HONOKA_PLUGIN_DEF_H +#include "../src/honoka_def.h" // Wnn #define HONOKA_CONFIG_JSERVERTYPE "/IMEngine/Honoka/Wnn/JServerType" @@ -76,4 +77,5 @@ #define HONOKA_CONFIG_PRIME_PREDICTION_LM "/IMEngine/Honoka/Prime/LookupMethod" #define HONOKA_DEFAULT_PRIME_PREDICTION_LM "lookup_hybrid" + #endif diff --git a/honoka/plugins/kanainput.cpp b/honoka/plugins/kanainput.cpp index b396462..edd8ff5 100644 --- a/honoka/plugins/kanainput.cpp +++ b/honoka/plugins/kanainput.cpp @@ -39,6 +39,24 @@ // �ץ饤�����󲽤Τ��ޤ��ʤ��Ǥ��� HonokaPluginRegister(KanaInput); +HonokaPluginSetup( + HonokaSetupPage *page = new HonokaSetupPage(_("KanaInput-plugin"),"",""); + + page->append(new HonokaSetupBoolItem( + _("_Use this plugin: "), + String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-kanainput"), + _("if you use this plugin, check this."), + true + )); + page->append(new HonokaSetupBoolItem( + _("use _fake kana-input: "), + HONOKA_CONFIG_KANAINPUT_FAKEKANA, + _("if you use the table of ASCII-KANA key mapping,check this."), + HONOKA_DEFAULT_KANAINPUT_FAKEKANA + )); + + return page; +); namespace Honoka { diff --git a/honoka/plugins/nicolainput.cpp b/honoka/plugins/nicolainput.cpp index d797599..bc96150 100644 --- a/honoka/plugins/nicolainput.cpp +++ b/honoka/plugins/nicolainput.cpp @@ -39,6 +39,30 @@ // �ץ饤�����󲽤Τ��ޤ��ʤ��Ǥ��� HonokaPluginRegister(NicolaInput); +HonokaPluginSetup( + HonokaSetupPage *page = new HonokaSetupPage(_("Nicola-plugin"),"",""); + + page->append(new HonokaSetupBoolItem( + _("_Use this plugin: "), + String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-nicola"), + _("if you use this plugin, check this."), + true + )); + page->append(new HonokaSetupKeyItem( + _("Left KANA-Shift keys:"), + HONOKA_CONFIG_NICOLAINPUT_LSHIFT, + "", + HONOKA_DEFAULT_NICOLAINPUT_LSHIFT + )); + page->append(new HonokaSetupKeyItem( + _("Right KANA-Shift keys:"), + HONOKA_CONFIG_NICOLAINPUT_RSHIFT, + "", + HONOKA_DEFAULT_NICOLAINPUT_RSHIFT + )); + + return page; +); namespace Honoka { struct { diff --git a/honoka/plugins/primeprediction.cpp b/honoka/plugins/primeprediction.cpp index 8d19659..7853e05 100644 --- a/honoka/plugins/primeprediction.cpp +++ b/honoka/plugins/primeprediction.cpp @@ -44,7 +44,37 @@ // �ץ饤�����󲽤Τ��ޤ��ʤ��Ǥ��� HonokaPluginRegister(PrimePrediction); - +HonokaPluginSetup( + vector l; + HonokaSetupPage *page = new HonokaSetupPage(_("PrimePrediction-plugin"),"",""); + + page->append(new HonokaSetupBoolItem( + _("_Use this plugin: "), + String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-prime"), + _("if you use this plugin, check this."), + true + )); + l.clear(); + l.push_back(String("lookup")); + l.push_back(String("lookup_all")); + l.push_back(String("lookup_compact")); + l.push_back(String("lookup_compact_all")); + l.push_back(String("lookup_direct")); + l.push_back(String("lookup_direct_all")); + l.push_back(String("lookup_exact")); + l.push_back(String("lookup_expansion")); + l.push_back(String("lookup_hybrid")); + l.push_back(String("lookup_hybrid_all")); + l.push_back(String("lookup_mixed")); + page->append(new HonokaSetupSelectItem( + _("_Lookup method: "), + HONOKA_CONFIG_PRIME_PREDICTION_LM, + _("select the lookup method."), + HONOKA_DEFAULT_PRIME_PREDICTION_LM, + l + )); + return page; +); PrimePrediction::PrimePrediction(ConfigPointer cfg) : Predictor(cfg) { diff --git a/honoka/plugins/romkan.cpp b/honoka/plugins/romkan.cpp index ec3fda0..8d646e8 100644 --- a/honoka/plugins/romkan.cpp +++ b/honoka/plugins/romkan.cpp @@ -39,6 +39,24 @@ // �ץ饤�����󲽤Τ��ޤ��ʤ��Ǥ��� HonokaPluginRegister(RomkanPlugin); +HonokaPluginSetup( + HonokaSetupPage *page = new HonokaSetupPage(_("Romkan-plugin"),"",""); + + page->append(new HonokaSetupBoolItem( + _("_Use this plugin: "), + String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-romkan"), + _("if you use this plugin, check this."), + true + )); + page->append(new HonokaSetupFileItem( + _("_Roma-Kana table: "), + HONOKA_CONFIG_ROMKAN_TABLE_FILE, + _("input the path of Roma-Kana convert table file."), + HONOKA_DEFAULT_ROMKAN_TABLE_FILE + )); + + return page; +); RomkanPlugin::RomkanPlugin(ConfigPointer cfg) : HonokaMultiplePluginBase(cfg) { diff --git a/honoka/plugins/simpleprediction.cpp b/honoka/plugins/simpleprediction.cpp index c3257b8..bd4f7f6 100644 --- a/honoka/plugins/simpleprediction.cpp +++ b/honoka/plugins/simpleprediction.cpp @@ -39,7 +39,24 @@ // �ץ饤�����󲽤Τ��ޤ��ʤ��Ǥ��� HonokaPluginRegister(SimplePrediction); - +HonokaPluginSetup( + HonokaSetupPage *page = new HonokaSetupPage(_("SimplePrediction-plugin"),"",""); + + page->append(new HonokaSetupBoolItem( + _("_Use this plugin: "), + String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-simpleprediction"), + _("if you use this plugin, check this."), + true + )); + page->append(new HonokaSetupIntItem( + _("_max history count: "), + HONOKA_CONFIG_SIMPLEPREDICTION_SIZE, + _("set maximum size of history count."), + HONOKA_DEFAULT_SIMPLEPREDICTION_SIZE, + 1,500 + )); + return page; +); SimplePrediction::SimplePrediction(ConfigPointer cfg) : Predictor(cfg) { diff --git a/honoka/plugins/skkdicconversion.cpp b/honoka/plugins/skkdicconversion.cpp index 2c85bc5..e55e30c 100644 --- a/honoka/plugins/skkdicconversion.cpp +++ b/honoka/plugins/skkdicconversion.cpp @@ -40,6 +40,23 @@ // �ץ饤�����󲽤Τ��ޤ��ʤ��Ǥ��� HonokaPluginRegister(SKKDicConversion); +HonokaPluginSetup( + HonokaSetupPage *page = new HonokaSetupPage(_("SKKDic-plugin"),"",""); + + page->append(new HonokaSetupBoolItem( + _("_Use this plugin: "), + String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-skkdic"), + _("if you use this plugin, check this."), + true + )); + page->append(new HonokaSetupFileItem( + _("_SKKDic file: "), + HONOKA_CONFIG_SKKDIC_DICFILE, + _("set SKKDic file in this entry."), + HONOKA_DEFAULT_SKKDIC_DICFILE + )); + return page; +); SKKDicConversion::SKKDicConversion(ConfigPointer cfg) : Convertor(cfg) { diff --git a/honoka/plugins/wnnplugin.cpp b/honoka/plugins/wnnplugin.cpp index 4accd15..e0735d0 100644 --- a/honoka/plugins/wnnplugin.cpp +++ b/honoka/plugins/wnnplugin.cpp @@ -20,7 +20,67 @@ #include "wnnplugin.h" +#ifdef HAVE_CONFIG_H + #include +#endif + + +#ifdef HAVE_GETTEXT + #include + #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 + + HonokaPluginRegister(WnnPlugin); +HonokaPluginSetup( + HonokaSetupPage *page = new HonokaSetupPage(_("Wnn-plugin"),"",""); + vector l; + page->append(new HonokaSetupBoolItem( + _("_Use this plugin: "), + String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-wnn"), + _("if you use this plugin, check this."), + true + )); + + page->append(new HonokaSetupEntryItem( + _("_Server: "), + HONOKA_CONFIG_JSERVER, + _("input the server name to connect."), + HONOKA_DEFAULT_JSERVER + )); + page->append(new HonokaSetupFileItem( + _("_wnnenvrc: "), + HONOKA_CONFIG_WNNENVRC, + _("input the path of wnnenvrc."), + HONOKA_DEFAULT_WNNENVRC + )); + l.clear(); + l.push_back(String("Wnn4")); + l.push_back(String("Wnn6")); + l.push_back(String("Wnn7")); + l.push_back(String("Wnn8")); + page->append(new HonokaSetupSelectItem( + _("Server_type: "), + HONOKA_CONFIG_JSERVERTYPE, + _("select the server type from Wnn4 / Wnn6 / Wnn7."), + HONOKA_DEFAULT_JSERVERTYPE, + l + )); + page->append(new HonokaSetupBoolItem( + _("use Wnn7-_YOSOKU: "), + HONOKA_CONFIG_WNNYOSOKU, + _("if you use the prediction of Wnn7, check this."), + HONOKA_DEFAULT_WNNYOSOKU + )); + return page; +); WnnPlugin::WnnPlugin(ConfigPointer cfg) : HonokaMultiplePluginBase(cfg) { diff --git a/honoka/plugins/wnnplugin.h b/honoka/plugins/wnnplugin.h index 7e59cc7..3d6e393 100644 --- a/honoka/plugins/wnnplugin.h +++ b/honoka/plugins/wnnplugin.h @@ -32,6 +32,7 @@ #include #include + using namespace std; using namespace scim; diff --git a/honoka/po/honoka.pot b/honoka/po/honoka.pot index 8627707..c5c2e6d 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-11-13 11:38+0900\n" +"POT-Creation-Date: 2005-12-12 15:17+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,66 +16,66 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/honoka_imengine.cpp:88 src/honoka_imengine.cpp:95 +#: src/honoka_imengine.cpp:89 src/honoka_imengine.cpp:96 #: src/honoka_imengine_setup.cpp:100 msgid "Honoka" msgstr "" -#: src/honoka_imengine.cpp:108 +#: src/honoka_imengine.cpp:109 msgid "ja_JP" msgstr "" -#: src/honoka_imengine.cpp:120 +#: src/honoka_imengine.cpp:121 msgid "(C)2004-2005 TAM(Teppei Tamra) " msgstr "" -#: src/honoka_imengine.cpp:130 +#: src/honoka_imengine.cpp:131 msgid "HONOKA-HELP" msgstr "" -#: src/honoka_imengine.cpp:593 +#: src/honoka_imengine.cpp:598 msgid "input mode" msgstr "" -#: src/honoka_imengine.cpp:597 src/honoka_imengine.cpp:605 -#: src/honoka_imengine.cpp:613 src/honoka_imengine.cpp:616 +#: src/honoka_imengine.cpp:602 src/honoka_imengine.cpp:610 +#: src/honoka_imengine.cpp:618 src/honoka_imengine.cpp:621 msgid "mode status" msgstr "" -#: src/honoka_imengine.cpp:601 +#: src/honoka_imengine.cpp:606 msgid "predictor" msgstr "" -#: src/honoka_imengine.cpp:609 +#: src/honoka_imengine.cpp:614 msgid "convertor" msgstr "" -#: src/honoka_imengine.cpp:618 +#: src/honoka_imengine.cpp:623 msgid "conversion mode" msgstr "" -#: src/honoka_imengine.cpp:641 +#: src/honoka_imengine.cpp:646 msgid "Kanji" msgstr "" -#: src/honoka_imengine.cpp:642 +#: src/honoka_imengine.cpp:647 msgid "Yosoku" msgstr "" -#: src/honoka_imengine.cpp:648 +#: src/honoka_imengine.cpp:653 msgid "AUTO" msgstr "" -#: src/honoka_imengine.cpp:649 +#: src/honoka_imengine.cpp:654 msgid "REN" msgstr "" -#: src/honoka_imengine.cpp:1422 src/honoka_imengine.cpp:1461 -#: src/honoka_imengine.cpp:1473 +#: src/honoka_imengine.cpp:1460 src/honoka_imengine.cpp:1499 +#: src/honoka_imengine.cpp:1511 msgid "could not connect to server." msgstr "" -#: src/honoka_imengine.cpp:1431 +#: src/honoka_imengine.cpp:1469 msgid "The error was received from Converter. " msgstr "" @@ -595,11 +595,11 @@ msgid "Roma" msgstr "" -#: plugins/kanainput.cpp:144 plugins/nicolainput.cpp:139 +#: plugins/kanainput.cpp:148 plugins/nicolainput.cpp:139 msgid "KANA" msgstr "" -#: plugins/kanainput.cpp:160 +#: plugins/kanainput.cpp:164 msgid "Kana" msgstr "" @@ -621,7 +621,7 @@ #: plugins/wnnconversion.cpp:415 plugins/anthyconversion.cpp:148 #: plugins/anthyprediction.cpp:60 plugins/simpleprediction.cpp:70 -#: plugins/primeprediction.cpp:130 plugins/skkdicconversion.cpp:101 +#: plugins/primeprediction.cpp:139 plugins/skkdicconversion.cpp:101 #: plugins/cannaconversion.cpp:175 msgid "lookup result" msgstr "" @@ -646,7 +646,7 @@ msgid "SimplePrediction" msgstr "" -#: plugins/primeprediction.cpp:207 +#: plugins/primeprediction.cpp:219 msgid "PrimePrediction" msgstr "" diff --git a/honoka/po/ja.po b/honoka/po/ja.po index c1be607..317d51d 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-11-13 11:38+0900\n" +"POT-Creation-Date: 2005-12-12 15:17+0900\n" "PO-Revision-Date: 2004-12-01 14:29+0900\n" "Last-Translator: TAM (Teppei Tamra) \n" "Language-Team: Japanese\n" @@ -18,68 +18,68 @@ "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.9.1\n" -#: src/honoka_imengine.cpp:88 src/honoka_imengine.cpp:95 +#: src/honoka_imengine.cpp:89 src/honoka_imengine.cpp:96 #: src/honoka_imengine_setup.cpp:100 msgid "Honoka" msgstr "ほのかたん" -#: src/honoka_imengine.cpp:108 +#: src/honoka_imengine.cpp:109 msgid "ja_JP" msgstr "ja_JP" -#: src/honoka_imengine.cpp:120 +#: src/honoka_imengine.cpp:121 msgid "(C)2004-2005 TAM(Teppei Tamra) " msgstr "(C)2004-2005 TAM(Teppei Tamra) " -#: src/honoka_imengine.cpp:130 +#: src/honoka_imengine.cpp:131 msgid "HONOKA-HELP" msgstr "" "詳細は以下をどぞ。\n" "http://nop.net-p.org/modules/pukiwiki/index.php?honoka" -#: src/honoka_imengine.cpp:593 +#: src/honoka_imengine.cpp:598 msgid "input mode" msgstr "入力モード" -#: src/honoka_imengine.cpp:597 src/honoka_imengine.cpp:605 -#: src/honoka_imengine.cpp:613 src/honoka_imengine.cpp:616 +#: src/honoka_imengine.cpp:602 src/honoka_imengine.cpp:610 +#: src/honoka_imengine.cpp:618 src/honoka_imengine.cpp:621 msgid "mode status" msgstr "状態" -#: src/honoka_imengine.cpp:601 +#: src/honoka_imengine.cpp:606 msgid "predictor" msgstr "予測エンジン" -#: src/honoka_imengine.cpp:609 +#: src/honoka_imengine.cpp:614 msgid "convertor" msgstr "変換エンジン" -#: src/honoka_imengine.cpp:618 +#: src/honoka_imengine.cpp:623 msgid "conversion mode" msgstr "変換モード" -#: src/honoka_imengine.cpp:641 +#: src/honoka_imengine.cpp:646 msgid "Kanji" msgstr "[漢]" -#: src/honoka_imengine.cpp:642 +#: src/honoka_imengine.cpp:647 msgid "Yosoku" msgstr "[予]" -#: src/honoka_imengine.cpp:648 +#: src/honoka_imengine.cpp:653 msgid "AUTO" msgstr "[逐]" -#: src/honoka_imengine.cpp:649 +#: src/honoka_imengine.cpp:654 msgid "REN" msgstr "[連]" -#: src/honoka_imengine.cpp:1422 src/honoka_imengine.cpp:1461 -#: src/honoka_imengine.cpp:1473 +#: src/honoka_imengine.cpp:1460 src/honoka_imengine.cpp:1499 +#: src/honoka_imengine.cpp:1511 msgid "could not connect to server." msgstr "サーバに接続できませんでした" -#: src/honoka_imengine.cpp:1431 +#: src/honoka_imengine.cpp:1469 msgid "The error was received from Converter. " msgstr "変換エンジンがエラーを返しよりました。" @@ -601,11 +601,11 @@ msgid "Roma" msgstr "ローマ字" -#: plugins/kanainput.cpp:144 plugins/nicolainput.cpp:139 +#: plugins/kanainput.cpp:148 plugins/nicolainput.cpp:139 msgid "KANA" msgstr "[あ]" -#: plugins/kanainput.cpp:160 +#: plugins/kanainput.cpp:164 msgid "Kana" msgstr "かな入力" @@ -627,7 +627,7 @@ #: plugins/wnnconversion.cpp:415 plugins/anthyconversion.cpp:148 #: plugins/anthyprediction.cpp:60 plugins/simpleprediction.cpp:70 -#: plugins/primeprediction.cpp:130 plugins/skkdicconversion.cpp:101 +#: plugins/primeprediction.cpp:139 plugins/skkdicconversion.cpp:101 #: plugins/cannaconversion.cpp:175 msgid "lookup result" msgstr "候補一覧" @@ -652,7 +652,7 @@ msgid "SimplePrediction" msgstr "単純予測" -#: plugins/primeprediction.cpp:207 +#: plugins/primeprediction.cpp:219 msgid "PrimePrediction" msgstr "prime予測" diff --git a/honoka/src/Makefile.am b/honoka/src/Makefile.am index 6da3a2d..94a308d 100644 --- a/honoka/src/Makefile.am +++ b/honoka/src/Makefile.am @@ -62,5 +62,5 @@ @SCIM_GTKUTILS_LIBS@ \ @INTLLIBS@ \ @SCIM_LIBS@ - +honoka_imengine_setup_la_LIBADD = $(top_builddir)/libhonoka/libhonoka_plugin.la diff --git a/honoka/src/honoka_imengine_setup.cpp b/honoka/src/honoka_imengine_setup.cpp index 42a1088..60fd361 100644 --- a/honoka/src/honoka_imengine_setup.cpp +++ b/honoka/src/honoka_imengine_setup.cpp @@ -27,6 +27,9 @@ #define Uses_SCIM_CONFIG_BASE #include +#include +#include +#include #ifdef HAVE_CONFIG_H #include @@ -64,6 +67,10 @@ #include +#include + +typedef HonokaSetupCorePage *pluginSetupFunc(); +typedef int getPluginVersionFunc(); static GtkWidget * create_setup_window (); static void load_config (const ConfigPointer &config); @@ -423,233 +430,32 @@ HonokaSetup * plugins = new HonokaSetup(_("plugins setting"),"",""); - // - // romkan setting - // - - page = new HonokaSetupPage(_("Romkan-plugin"),"",""); - - page->append(new HonokaSetupBoolItem( - _("_Use this plugin: "), - String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-romkan"), - _("if you use this plugin, check this."), - true - )); - page->append(new HonokaSetupFileItem( - _("_Roma-Kana table: "), - HONOKA_CONFIG_ROMKAN_TABLE_FILE, - _("input the path of Roma-Kana convert table file."), - HONOKA_DEFAULT_ROMKAN_TABLE_FILE - )); - - plugins->append(page); - - // - // kana-input setting - // - - page = new HonokaSetupPage(_("KanaInput-plugin"),"",""); - - page->append(new HonokaSetupBoolItem( - _("_Use this plugin: "), - String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-kanainput"), - _("if you use this plugin, check this."), - true - )); - page->append(new HonokaSetupBoolItem( - _("use _fake kana-input: "), - HONOKA_CONFIG_KANAINPUT_FAKEKANA, - _("if you use the table of ASCII-KANA key mapping,check this."), - HONOKA_DEFAULT_KANAINPUT_FAKEKANA - )); - - plugins->append(page); - - // - // nicola-input setting - // - - page = new HonokaSetupPage(_("Nicola-plugin"),"",""); - - page->append(new HonokaSetupBoolItem( - _("_Use this plugin: "), - String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-nicola"), - _("if you use this plugin, check this."), - true - )); - page->append(new HonokaSetupKeyItem( - _("Left KANA-Shift keys:"), - HONOKA_CONFIG_NICOLAINPUT_LSHIFT, - "", - HONOKA_DEFAULT_NICOLAINPUT_LSHIFT - )); - page->append(new HonokaSetupKeyItem( - _("Right KANA-Shift keys:"), - HONOKA_CONFIG_NICOLAINPUT_RSHIFT, - "", - HONOKA_DEFAULT_NICOLAINPUT_RSHIFT - )); - - plugins->append(page); - - // - // Wnn setting - // - page = new HonokaSetupPage(_("Wnn-plugin"),"",""); - - page->append(new HonokaSetupBoolItem( - _("_Use this plugin: "), - String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-wnn"), - _("if you use this plugin, check this."), - true - )); - - page->append(new HonokaSetupEntryItem( - _("_Server: "), - HONOKA_CONFIG_JSERVER, - _("input the server name to connect."), - HONOKA_DEFAULT_JSERVER - )); - page->append(new HonokaSetupFileItem( - _("_wnnenvrc: "), - HONOKA_CONFIG_WNNENVRC, - _("input the path of wnnenvrc."), - HONOKA_DEFAULT_WNNENVRC - )); - l.clear(); - l.push_back(String("Wnn4")); - l.push_back(String("Wnn6")); - l.push_back(String("Wnn7")); - l.push_back(String("Wnn8")); - page->append(new HonokaSetupSelectItem( - _("Server_type: "), - HONOKA_CONFIG_JSERVERTYPE, - _("select the server type from Wnn4 / Wnn6 / Wnn7."), - HONOKA_DEFAULT_JSERVERTYPE, - l - )); - plugins->append(page); - page->append(new HonokaSetupBoolItem( - _("use Wnn7-_YOSOKU: "), - HONOKA_CONFIG_WNNYOSOKU, - _("if you use the prediction of Wnn7, check this."), - HONOKA_DEFAULT_WNNYOSOKU - )); - - // - // Anthy setting - // - - page = new HonokaSetupPage(_("Anthy-plugin"),"",""); - - page->append(new HonokaSetupBoolItem( - _("_Use this plugin: "), - String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-anthy"), - _("if you use this plugin, check this."), - true - )); - plugins->append(page); - - // - // Canna setting - // - - page = new HonokaSetupPage(_("Canna-plugin"),"",""); - - page->append(new HonokaSetupBoolItem( - _("_Use this plugin: "), - String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-canna"), - _("if you use this plugin, check this."), - true - )); - page->append(new HonokaSetupEntryItem( - _("_Server: "), - HONOKA_CONFIG_CANNA_SERVER, - _("input the server name to connect."), - HONOKA_DEFAULT_CANNA_SERVER - )); - page->append(new HonokaSetupFileItem( - _("_DicHomeDir: "), - HONOKA_CONFIG_CANNA_DICHOMEDIRPATH, - _("set your DicHomeDir in this entry."), - HONOKA_DEFAULT_CANNA_DICHOMEDIRPATH - )); - plugins->append(page); - - - // - // SKKDic setting - // - - page = new HonokaSetupPage(_("SKKDic-plugin"),"",""); - - page->append(new HonokaSetupBoolItem( - _("_Use this plugin: "), - String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-skkdic"), - _("if you use this plugin, check this."), - true - )); - page->append(new HonokaSetupFileItem( - _("_SKKDic file: "), - HONOKA_CONFIG_SKKDIC_DICFILE, - _("set SKKDic file in this entry."), - HONOKA_DEFAULT_SKKDIC_DICFILE - )); - plugins->append(page); - - // - // SimplePrediction setting - // - - page = new HonokaSetupPage(_("SimplePrediction-plugin"),"",""); - - page->append(new HonokaSetupBoolItem( - _("_Use this plugin: "), - String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-simpleprediction"), - _("if you use this plugin, check this."), - true - )); - page->append(new HonokaSetupIntItem( - _("_max history count: "), - HONOKA_CONFIG_SIMPLEPREDICTION_SIZE, - _("set maximum size of history count."), - HONOKA_DEFAULT_SIMPLEPREDICTION_SIZE, - 1,500 - )); - plugins->append(page); - - // - // PrimePrediction setting - // - - page = new HonokaSetupPage(_("PrimePrediction-plugin"),"",""); - - page->append(new HonokaSetupBoolItem( - _("_Use this plugin: "), - String(HONOKA_CONFIG_PLUGINLOADER_PREFIX) + String("/plugin-prime"), - _("if you use this plugin, check this."), - true - )); - l.clear(); - l.push_back(String("lookup")); - l.push_back(String("lookup_all")); - l.push_back(String("lookup_compact")); - l.push_back(String("lookup_compact_all")); - l.push_back(String("lookup_direct")); - l.push_back(String("lookup_direct_all")); - l.push_back(String("lookup_exact")); - l.push_back(String("lookup_expansion")); - l.push_back(String("lookup_hybrid")); - l.push_back(String("lookup_hybrid_all")); - l.push_back(String("lookup_mixed")); - page->append(new HonokaSetupSelectItem( - _("_Lookup method: "), - HONOKA_CONFIG_PRIME_PREDICTION_LM, - _("select the lookup method."), - HONOKA_DEFAULT_PRIME_PREDICTION_LM, - l - )); - plugins->append(page); + //// + DIR *dir = opendir(HONOKA_PLUGINDIR); + if (dir) { + struct dirent *entry; + while((entry = readdir(dir)) != NULL) { + String d = entry->d_name; + if ((d.substr(0,6) == "plugin") && (d.substr(d.length() - 3,3) == ".so")) { + d = String(HONOKA_PLUGINDIR) + "/" + d; + void* plugin = dlopen(d.c_str(), RTLD_LAZY); + if (!plugin) continue; + pluginSetupFunc *pluginSetup = (pluginSetupFunc *)dlsym(plugin,"HonokaPluginSetup"); + getPluginVersionFunc *getPluginVersion = (getPluginVersionFunc *)dlsym(plugin,"getHonokaPluginVersion"); + if ((!pluginSetup) || (!getPluginVersion)) { + dlclose(plugin); + continue; + } + if (getPluginVersion() == HONOKA_PLUGIN_VERSION) { + HonokaSetupCorePage *p = pluginSetup(); + plugins->append(HonokaSetup::HonokaSetupCoreToGtk(p)); + } else { + dlclose(plugin); + } + } + } + } + //// setup->append(plugins); diff --git a/honoka/src/honokasetupgtk.cpp b/honoka/src/honokasetupgtk.cpp index f40edd1..5dcb187 100644 --- a/honoka/src/honokasetupgtk.cpp +++ b/honoka/src/honokasetupgtk.cpp @@ -53,7 +53,7 @@ valueWidget = 0; labelWidget = 0; if (!tipWidget) tipWidget = gtk_tooltips_new(); -}; +} HonokaSetupGtkItem::~HonokaSetupGtkItem() { @@ -66,13 +66,13 @@ createTipWidget(); } return valueWidget; -}; +} GtkWidget *HonokaSetupGtkItem::getLabelWidget() { if (!labelWidget) createLabelWidget(); return labelWidget; -}; +} void HonokaSetupGtkItem::createLabelWidget() { @@ -88,13 +88,13 @@ gtk_misc_set_alignment(GTK_MISC(valueWidget),1.0,0.5); gtk_misc_set_padding(GTK_MISC(valueWidget),4,0); gtk_widget_show(valueWidget); -}; +} void HonokaSetupGtkItem::createTipWidget() { if (!valueWidget) createValueWidget(); gtk_tooltips_set_tip(tipWidget,valueWidget,tip.c_str(),NULL); -}; +} void HonokaSetupGtkItem::readConfig(ConfigPointer cfg) { @@ -115,11 +115,11 @@ : HonokaSetupGtkItem(_label,_name,_tip) { stringData = _default; -}; +} HonokaSetupGtkEntryItem::~HonokaSetupGtkEntryItem() { -}; +} void HonokaSetupGtkEntryItem::createValueWidget() { @@ -127,7 +127,7 @@ gtk_label_set_mnemonic_widget(GTK_LABEL(getLabelWidget()),valueWidget); g_signal_connect((gpointer)valueWidget,"changed",G_CALLBACK(onEditableChanged),this); gtk_widget_show(valueWidget); -}; +} void HonokaSetupGtkEntryItem::readConfig(ConfigPointer cfg) { @@ -150,7 +150,7 @@ s->stringData = str; changed = true; } -}; +} // // Container @@ -159,17 +159,17 @@ HonokaSetupGtkContainer::HonokaSetupGtkContainer() { items.clear(); -}; +} HonokaSetupGtkContainer::~HonokaSetupGtkContainer() { -}; +} HonokaSetupGtkItem * HonokaSetupGtkContainer::getLastItem() { if (!items.size()) return 0; return items[items.size() - 1]; -}; +} void HonokaSetupGtkContainer::append(HonokaSetupGtkItem *item) { @@ -184,11 +184,11 @@ : HonokaSetupGtkItem(_label,_name,_tip) { stringData = _default; -}; +} HonokaSetupGtkKeyItem::~HonokaSetupGtkKeyItem() { -}; +} void HonokaSetupGtkKeyItem::createValueWidget() { @@ -204,14 +204,14 @@ gtk_widget_show(entry); gtk_widget_show(button); gtk_widget_show(valueWidget); -}; +} void HonokaSetupGtkKeyItem::createTipWidget() { if (!valueWidget) createValueWidget(); gtk_tooltips_set_tip(tipWidget,entry,tip.c_str(),NULL); gtk_tooltips_set_tip(tipWidget,button,tip.c_str(),NULL); -}; +} void HonokaSetupGtkKeyItem::readConfig(ConfigPointer cfg) { @@ -234,7 +234,7 @@ s->stringData = str; changed = true; } -}; +} void HonokaSetupGtkKeyItem::onSelectButtonClicked(GtkEditable *widget,gpointer self) { @@ -252,7 +252,7 @@ gtk_widget_destroy (dialog); changed = true; } -}; +} // // file @@ -261,11 +261,11 @@ : HonokaSetupGtkItem(_label,_name,_tip) { stringData = _default; -}; +} HonokaSetupGtkFileItem::~HonokaSetupGtkFileItem() { -}; +} void HonokaSetupGtkFileItem::createValueWidget() { @@ -280,14 +280,14 @@ gtk_widget_show(entry); gtk_widget_show(button); gtk_widget_show(valueWidget); -}; +} void HonokaSetupGtkFileItem::createTipWidget() { if (!valueWidget) createValueWidget(); gtk_tooltips_set_tip(tipWidget,entry,tip.c_str(),NULL); gtk_tooltips_set_tip(tipWidget,button,tip.c_str(),NULL); -}; +} void HonokaSetupGtkFileItem::readConfig(ConfigPointer cfg) { @@ -306,7 +306,7 @@ { bool *_ok = static_cast(ok); if (_ok) *_ok = true; -}; +} void HonokaSetupGtkFileItem::onEditableChanged(GtkEditable *widget,gpointer self) { @@ -316,7 +316,7 @@ s->stringData = str; changed = true; } -}; +} void HonokaSetupGtkFileItem::onSelectButtonClicked(GtkEditable *widget,gpointer self) { @@ -335,7 +335,7 @@ } gtk_widget_destroy (GTK_WIDGET (dialog)); } -}; +} // @@ -346,11 +346,11 @@ : HonokaSetupGtkItem(_label,_name,_tip) { boolData = _default; -}; +} HonokaSetupGtkBoolItem::~HonokaSetupGtkBoolItem() { -}; +} void HonokaSetupGtkBoolItem::createValueWidget() { @@ -358,7 +358,7 @@ gtk_label_set_mnemonic_widget(GTK_LABEL(getLabelWidget()),valueWidget); g_signal_connect((gpointer)valueWidget,"toggled",G_CALLBACK(onToggleButtonToggled),this); gtk_widget_show(valueWidget); -}; +} void HonokaSetupGtkBoolItem::readConfig(ConfigPointer cfg) { @@ -380,7 +380,7 @@ s->boolData = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(s->valueWidget)); changed = true; } -}; +} // // Int @@ -391,11 +391,11 @@ { intData = _default; aj = (GtkAdjustment *) gtk_adjustment_new(_default,lower,upper,1,1,1); -}; +} HonokaSetupGtkIntItem::~HonokaSetupGtkIntItem() { -}; +} void HonokaSetupGtkIntItem::createValueWidget() { @@ -403,7 +403,7 @@ gtk_label_set_mnemonic_widget(GTK_LABEL(getLabelWidget()),valueWidget); g_signal_connect((gpointer)valueWidget,"changed",G_CALLBACK(onValueChanged),this); gtk_widget_show(valueWidget); -}; +} void HonokaSetupGtkIntItem::readConfig(ConfigPointer cfg) { @@ -425,7 +425,7 @@ s->intData = gtk_spin_button_get_value_as_int(widget); changed = true; } -}; +} // @@ -437,12 +437,12 @@ { stringData = _default; stringListData = _list; -}; +} HonokaSetupGtkSelectItem::~HonokaSetupGtkSelectItem() { -}; +} void HonokaSetupGtkSelectItem::createValueWidget() { @@ -459,7 +459,7 @@ g_signal_connect((gpointer)valueWidget,"changed",G_CALLBACK(onSelected),this); gtk_widget_show(valueWidget); gtk_widget_show(menu); -}; +} void HonokaSetupGtkSelectItem::readConfig(ConfigPointer cfg) { @@ -489,7 +489,7 @@ changed = true; } } -}; +} @@ -506,7 +506,7 @@ table = gtk_table_new(3,1,FALSE); gtk_box_pack_start(GTK_BOX(valueWidget),table,FALSE,FALSE,0); gtk_widget_show(table); -}; +} void HonokaSetupGtkPage::append(HonokaSetupGtkItem *item) { @@ -522,7 +522,7 @@ gtk_table_attach(GTK_TABLE(table),item->getValueWidget(),1,2,items.size() - 1,items.size(), (GtkAttachOptions)(GTK_FILL|GTK_EXPAND),(GtkAttachOptions)(GTK_FILL),4,4); } -}; +} void HonokaSetupGtkPage::readConfig(ConfigPointer cfg) { @@ -565,7 +565,7 @@ gtk_widget_show(page->getLabelWidget()); gtk_notebook_append_page(GTK_NOTEBOOK(valueWidget),page->getValueWidget(),page->getLabelWidget()); if (dynamic_cast(page) != 0) gtk_notebook_set_tab_pos(GTK_NOTEBOOK(page->getValueWidget()),GTK_POS_LEFT); -}; +} void HonokaSetupGtk::readConfig(ConfigPointer cfg) { @@ -583,4 +583,42 @@ return; } +HonokaSetupGtkItem *HonokaSetupGtk::HonokaSetupCoreToGtk(Honoka::HonokaSetupCoreItem *item) +{ + if (item->getType() == HONOKA_SETUP_ITEM_ENTRY) { + return new HonokaSetupGtkEntryItem(item->getLabel(),item->getName(),item->getTip(),item->getStringData()); + } + if (item->getType() == HONOKA_SETUP_ITEM_KEY) { + return new HonokaSetupGtkKeyItem(item->getLabel(),item->getName(),item->getTip(),item->getStringData()); + } + if (item->getType() == HONOKA_SETUP_ITEM_FILE) { + return new HonokaSetupGtkFileItem(item->getLabel(),item->getName(),item->getTip(),item->getStringData()); + } + if (item->getType() == HONOKA_SETUP_ITEM_BOOL) { + return new HonokaSetupGtkBoolItem(item->getLabel(),item->getName(),item->getTip(),item->getBoolData()); + } + if (item->getType() == HONOKA_SETUP_ITEM_INT) { + return new HonokaSetupGtkIntItem(item->getLabel(),item->getName(),item->getTip(),item->getIntData(), + item->getIntUpper(),item->getIntLower()); + } + if (item->getType() == HONOKA_SETUP_ITEM_SELECT) { + return new HonokaSetupGtkSelectItem(item->getLabel(),item->getName(),item->getTip(),item->getStringData(), + item->getStringListData()); + } + if (item->getType() == HONOKA_SETUP_ITEM_PAGE) { + HonokaSetupGtkPage *page = new HonokaSetupGtkPage(item->getLabel(),item->getName(),item->getTip()); + for(unsigned int i = 0;i < static_cast(item)->getChildren().size(); i ++) { + page->append(HonokaSetupCoreToGtk(static_cast(item)->getChildren()[i])); + } + return page; + } + if (item->getType() == HONOKA_SETUP_ITEM_SETUP) { + HonokaSetupGtk *page = new HonokaSetupGtk(item->getLabel(),item->getName(),item->getTip()); + for(unsigned int i = 0;i < static_cast(item)->getChildren().size(); i ++) { + page->append(HonokaSetupCoreToGtk(static_cast(item)->getChildren()[i])); + } + return page; + } + return 0; +} diff --git a/honoka/src/honokasetupgtk.h b/honoka/src/honokasetupgtk.h index 0b16083..89c48da 100644 --- a/honoka/src/honokasetupgtk.h +++ b/honoka/src/honokasetupgtk.h @@ -29,6 +29,7 @@ #include #include #include +#include using namespace scim; @@ -52,8 +53,6 @@ #define HonokaSetup HonokaSetupGtk - - class HonokaSetupGtkItem { public: GtkWidget *getValueWidget(); @@ -187,6 +186,7 @@ public: HonokaSetupGtk(String _label,String _name,String _tip); ~HonokaSetupGtk(); + static HonokaSetupGtkItem *HonokaSetupCoreToGtk(Honoka::HonokaSetupCoreItem *item); virtual void append(HonokaSetupGtkItem *page); virtual void readConfig(ConfigPointer cfg); virtual void saveConfig(ConfigPointer cfg);