summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-08-04 14:17:01 +0800
committerPeng Wu <alexepico@gmail.com>2015-08-04 14:17:01 +0800
commit5a9fa844efd42522eb5739f3ba12913ab80437a5 (patch)
tree5609f983fcb20b23c1ae16c5fdce6d4c827b825d /src
parent551ef42ffa74793b69f8ffc1c338e25674abc6de (diff)
downloadibus-libzhuyin-5a9fa844efd42522eb5739f3ba12913ab80437a5.tar.gz
ibus-libzhuyin-5a9fa844efd42522eb5739f3ba12913ab80437a5.tar.xz
ibus-libzhuyin-5a9fa844efd42522eb5739f3ba12913ab80437a5.zip
add candidates after cursor option
Diffstat (limited to 'src')
-rw-r--r--src/ZYConfig.cc1
-rw-r--r--src/ZYConfig.h2
-rw-r--r--src/ZYZConfig.cc5
-rw-r--r--src/ZYZPhoneticSection.cc6
4 files changed, 13 insertions, 1 deletions
diff --git a/src/ZYConfig.cc b/src/ZYConfig.cc
index fcc717e..bc6fad5 100644
--- a/src/ZYConfig.cc
+++ b/src/ZYConfig.cc
@@ -55,6 +55,7 @@ Config::initDefaultValues (void)
m_always_input_numbers = FALSE;
m_space_show_candidates = FALSE;
+ m_candidates_after_cursor = TRUE;
m_easy_symbol = TRUE;
m_user_symbol = TRUE;
diff --git a/src/ZYConfig.h b/src/ZYConfig.h
index cba5f78..8a1c5d6 100644
--- a/src/ZYConfig.h
+++ b/src/ZYConfig.h
@@ -51,6 +51,7 @@ public:
gboolean initTradChinese (void) const { return m_init_trad_chinese; }
gboolean alwaysInputNumbers (void) const { return m_always_input_numbers; }
gboolean spaceShowCandidates (void) const { return m_space_show_candidates; }
+ gboolean candidatesAfterCursor (void) const { return m_candidates_after_cursor; }
std::string candidateKeys (void) const { return m_candidate_keys; }
gboolean easySymbol (void) const { return m_easy_symbol; }
@@ -90,6 +91,7 @@ protected:
gboolean m_always_input_numbers;
gboolean m_space_show_candidates;
+ gboolean m_candidates_after_cursor;
std::string m_candidate_keys;
diff --git a/src/ZYZConfig.cc b/src/ZYZConfig.cc
index 17a6a34..db785e6 100644
--- a/src/ZYZConfig.cc
+++ b/src/ZYZConfig.cc
@@ -36,6 +36,7 @@ const gchar * const CONFIG_INIT_FULL_PUNCT = "fullhalfpunct";
const gchar * const CONFIG_INIT_TRAD_CHINESE = "traditionalchinese";
const gchar * const CONFIG_ALWAYS_INPUT_NUMBERS = "alwaysinputnum";
const gchar * const CONFIG_SPACE_SHOW_CANDIDATES = "spaceshowcandidates";
+const gchar * const CONFIG_CANDIDATES_AFTER_CURSOR = "candidatesaftercursor";
const gchar * const CONFIG_KEYBOARD_LAYOUT = "keyboardlayout";
const gchar * const CONFIG_CANDIDATE_KEYS = "candidatekeys";
@@ -96,6 +97,7 @@ ZhuyinConfig::initDefaultValues (void)
m_always_input_numbers = FALSE;
m_space_show_candidates = FALSE;
+ m_candidates_after_cursor = TRUE;
m_candidate_keys = "1234567890";
@@ -188,6 +190,7 @@ ZhuyinConfig::readDefaultValues (void)
m_always_input_numbers = read (CONFIG_ALWAYS_INPUT_NUMBERS, false);
m_space_show_candidates = read (CONFIG_SPACE_SHOW_CANDIDATES, false);
+ m_candidates_after_cursor = read (CONFIG_CANDIDATES_AFTER_CURSOR, true);
gint layout = read (CONFIG_KEYBOARD_LAYOUT, 0);
m_keyboard_layout = CHEWING_DEFAULT;
@@ -246,6 +249,8 @@ ZhuyinConfig::valueChanged (const std::string &section,
m_always_input_numbers = normalizeGVariant (value, false);
else if (CONFIG_SPACE_SHOW_CANDIDATES == name)
m_space_show_candidates = normalizeGVariant (value, false);
+ else if (CONFIG_CANDIDATES_AFTER_CURSOR == name)
+ m_candidates_after_cursor = normalizeGVariant (value, true);
else if (CONFIG_KEYBOARD_LAYOUT == name) {
gint layout = normalizeGVariant (value, 0);
m_keyboard_layout = CHEWING_DEFAULT;
diff --git a/src/ZYZPhoneticSection.cc b/src/ZYZPhoneticSection.cc
index 99d6213..f8bfe7d 100644
--- a/src/ZYZPhoneticSection.cc
+++ b/src/ZYZPhoneticSection.cc
@@ -21,6 +21,7 @@
#include "ZYZPhoneticSection.h"
#include <assert.h>
+#include "ZYConfig.h"
#include "ZYZhuyinProperties.h"
#include "ZYTradSimpConverter.h"
@@ -47,7 +48,10 @@ PhoneticSection::initCandidates (zhuyin_instance_t * instance,
zhuyin_get_zhuyin_key_rest_offset
(instance, cursor, &offset);
- zhuyin_guess_candidates (m_instance, offset);
+ if (m_editor.m_config.candidatesAfterCursor ())
+ zhuyin_guess_candidates_after_cursor (m_instance, offset);
+ else
+ zhuyin_guess_candidates_before_cursor (m_instance, offset);
return true;
}