add set chewing options
authorPeng Wu <alexepico@gmail.com>
Fri, 23 Sep 2011 06:44:10 +0000 (14:44 +0800)
committerPeng Wu <alexepico@gmail.com>
Thu, 22 Dec 2011 04:23:12 +0000 (12:23 +0800)
src/PYLibPinyin.cc
src/PYLibPinyin.h

index 36eaba3..ceada04 100644 (file)
@@ -43,7 +43,7 @@ LibPinyinBackEnd::~LibPinyinBackEnd(){
 /* Here are the fuzzy pinyin options conversion table. */
 static const struct {
     guint ibus_pinyin_option;
-    PinyinAmbiguity libpinyin_option;    
+    PinyinAmbiguity libpinyin_option;
 } fuzzy_options [] = {
     /* fuzzy pinyin */
     { PINYIN_FUZZY_C_CH,        PINYIN_AmbCiChi        },
@@ -68,6 +68,7 @@ static const struct {
     { PINYIN_FUZZY_ING_IN,      PINYIN_AmbIngIn        }
 };
 
+
 gboolean
 LibPinyinBackEnd::setPinyinOptions (Config * config)
 {
@@ -88,3 +89,29 @@ LibPinyinBackEnd::setPinyinOptions (Config * config)
 
     return TRUE;
 }
+
+/* Here are the chewing keyboard scheme mapping table. */
+static const struct {
+    guint bopomofo_keyboard;
+    PinyinZhuYinScheme chewing_keyboard;
+} chewing_options [] = {
+    {0, ZHUYIN_STANDARD},
+    {1, ZHUYIN_GIN_YIEH},
+    {2, ZHUYIN_ET26},
+    {3, ZHUYIN_IBM}
+};
+
+
+gboolean
+LibPinyinBackEnd::setChewingOptions (Config *config)
+{
+    const guint map = config->bopomofoKeyboardMapping ();
+    for (guint i = 0; i < G_N_ELEMENTS (chewing_options); i++) {
+        if (map == chewing_options[i].bopomofo_keyboard){
+            /* TODO: set chewing scheme. */
+            PinyinZhuYinScheme scheme = chewing_options[i].chewing_keyboard;
+            g_assert (FALSE);
+        }            
+    }
+    return TRUE;
+}
index 83aa1fc..538930c 100644 (file)
@@ -35,7 +35,8 @@ public:
     LibPinyinBackEnd();
     ~LibPinyinBackEnd();
 
-    gboolean setPinyinOptions(Config *config);
+    gboolean setPinyinOptions (Config *config);
+    gboolean setChewingOptions (Config *config);
 
     /* use static initializer in C++. */
     static LibPinyinBackEnd & instance (void) { return *m_instance; }