summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2019-01-04 13:49:54 +0800
committerPeng Wu <alexepico@gmail.com>2019-01-04 13:49:54 +0800
commit0d1e640dc4e46b76110e954c1d7f9eb09ceeb908 (patch)
tree7bc2aad6c3d86229ebb01c620b5d329adb76e89d
parent664be06dd071779211ef85b23ae8e7561ea152c1 (diff)
downloadibus-libzhuyin-0d1e640dc4e46b76110e954c1d7f9eb09ceeb908.zip
ibus-libzhuyin-0d1e640dc4e46b76110e954c1d7f9eb09ceeb908.tar.gz
ibus-libzhuyin-0d1e640dc4e46b76110e954c1d7f9eb09ceeb908.tar.xz
add need-tone option
-rw-r--r--data/com.github.libzhuyin.ibus-libzhuyin.gschema.xml4
-rw-r--r--src/ZYConfig.cc1
-rw-r--r--src/ZYConfig.h2
-rw-r--r--src/ZYLibZhuyin.cc4
-rw-r--r--src/ZYZConfig.cc9
5 files changed, 18 insertions, 2 deletions
diff --git a/data/com.github.libzhuyin.ibus-libzhuyin.gschema.xml b/data/com.github.libzhuyin.ibus-libzhuyin.gschema.xml
index 52fb8ae..0b823a6 100644
--- a/data/com.github.libzhuyin.ibus-libzhuyin.gschema.xml
+++ b/data/com.github.libzhuyin.ibus-libzhuyin.gschema.xml
@@ -77,6 +77,10 @@
<default>0</default>
<summary>Keyboard Layout</summary>
</key>
+ <key name="need-tone" type="b">
+ <default>true</default>
+ <summary>Need tone information</summary>
+ </key>
<key name="space-show-candidates" type="b">
<default>false</default>
<summary>Use Space Key to Show Candidates</summary>
diff --git a/src/ZYConfig.cc b/src/ZYConfig.cc
index 42d533e..ee6f9aa 100644
--- a/src/ZYConfig.cc
+++ b/src/ZYConfig.cc
@@ -45,6 +45,7 @@ Config::initDefaultValues (void)
m_is_zhuyin = TRUE;
m_zhuyin_scheme = ZHUYIN_DEFAULT;
m_pinyin_scheme = FULL_PINYIN_DEFAULT;
+ m_need_tone = TRUE;
m_init_chinese = TRUE;
m_init_full_width = FALSE;
diff --git a/src/ZYConfig.h b/src/ZYConfig.h
index e528696..8998453 100644
--- a/src/ZYConfig.h
+++ b/src/ZYConfig.h
@@ -46,6 +46,7 @@ public:
gboolean isZhuyin(void) const { return m_is_zhuyin; }
ZhuyinScheme zhuyinScheme (void) const { return m_zhuyin_scheme; }
FullPinyinScheme pinyinScheme (void) const { return m_pinyin_scheme; }
+ gboolean needTone (void) const { return m_need_tone; }
gboolean initChinese (void) const { return m_init_chinese; }
gboolean initFullWidth (void) const { return m_init_full_width; }
gboolean initTradChinese (void) const { return m_init_trad_chinese; }
@@ -85,6 +86,7 @@ protected:
gboolean m_is_zhuyin;
ZhuyinScheme m_zhuyin_scheme;
FullPinyinScheme m_pinyin_scheme;
+ gboolean m_need_tone;
gboolean m_init_chinese;
gboolean m_init_full_width;
diff --git a/src/ZYLibZhuyin.cc b/src/ZYLibZhuyin.cc
index 4208d56..9fa46cb 100644
--- a/src/ZYLibZhuyin.cc
+++ b/src/ZYLibZhuyin.cc
@@ -86,6 +86,10 @@ LibZhuyinBackEnd::setZhuyinOptions (Config *config)
config->pinyinScheme ());
zhuyin_option_t options = config->option ();
+
+ if (config->needTone ())
+ options |= FORCE_TONE;
+
zhuyin_set_options (m_zhuyin_context, options);
return TRUE;
}
diff --git a/src/ZYZConfig.cc b/src/ZYZConfig.cc
index 5841b1e..49f2b8a 100644
--- a/src/ZYZConfig.cc
+++ b/src/ZYZConfig.cc
@@ -39,6 +39,7 @@ const gchar * const CONFIG_SPACE_SHOW_CANDIDATES = "space-show-candidates";
const gchar * const CONFIG_CANDIDATES_AFTER_CURSOR = "candidates-after-cursor";
const gchar * const CONFIG_KEYBOARD_LAYOUT = "keyboard-layout";
+const gchar * const CONFIG_NEED_TONE = "need-tone";
const gchar * const CONFIG_CANDIDATE_KEYS = "candidate-keys";
const gchar * const CONFIG_EASY_SYMBOL = "easy-symbol";
@@ -49,7 +50,6 @@ const gchar * const CONFIG_CLEAR_USER_DATA = "clear-user-data";
const zhuyin_option_t ZHUYIN_DEFAULT_OPTION =
USE_TONE |
- FORCE_TONE |
ZHUYIN_CORRECT_ALL |
0;
@@ -86,7 +86,7 @@ void
ZhuyinConfig::initDefaultValues (void)
{
m_option = ZHUYIN_DEFAULT_OPTION;
- m_option_mask = USE_TONE | FORCE_TONE | ZHUYIN_CORRECT_ALL;
+ m_option_mask = USE_TONE | ZHUYIN_CORRECT_ALL;
m_orientation = IBUS_ORIENTATION_VERTICAL;
m_page_size = 10;
@@ -94,6 +94,7 @@ ZhuyinConfig::initDefaultValues (void)
m_is_zhuyin = TRUE;
m_zhuyin_scheme = ZHUYIN_DEFAULT;
m_pinyin_scheme = FULL_PINYIN_DEFAULT;
+ m_need_tone = TRUE;
m_init_chinese = TRUE;
m_init_full_width = FALSE;
@@ -213,6 +214,8 @@ ZhuyinConfig::readDefaultValues (void)
}
}
+ m_need_tone = read (CONFIG_NEED_TONE, true);
+
m_candidate_keys = read (CONFIG_CANDIDATE_KEYS, "1234567890");
m_easy_symbol = read (CONFIG_EASY_SYMBOL, true);
@@ -281,6 +284,8 @@ ZhuyinConfig::valueChanged (const std::string &schema_id,
m_zhuyin_scheme = zhuyin_schemes[i].scheme;
}
}
+ } else if (CONFIG_NEED_TONE == name) {
+ m_need_tone = normalizeGVariant (value, true);
} else if (CONFIG_CANDIDATE_KEYS == name) {
m_candidate_keys = normalizeGVariant (value, std::string ("1234567890"));
} /* lookup table page size */