summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2014-11-05 10:53:58 +0800
committerPeng Wu <alexepico@gmail.com>2014-11-05 10:53:58 +0800
commit82b89ae4b01f353664a44e833829f1633ffdfdd2 (patch)
tree06583e844f2b08490b6703e36e23f234d74f6ecf /src
parent1bbb6ca2a0240ab98510fe8a5f470d0a47b382af (diff)
downloadibus-libpinyin-82b89ae4b01f353664a44e833829f1633ffdfdd2.tar.gz
ibus-libpinyin-82b89ae4b01f353664a44e833829f1633ffdfdd2.tar.xz
ibus-libpinyin-82b89ae4b01f353664a44e833829f1633ffdfdd2.zip
disable lookup table lazy candidate fill
Diffstat (limited to 'src')
-rw-r--r--src/PYPPhoneticEditor.cc41
-rw-r--r--src/PYPPhoneticEditor.h2
2 files changed, 34 insertions, 9 deletions
diff --git a/src/PYPPhoneticEditor.cc b/src/PYPPhoneticEditor.cc
index a5622c7..0d55fa7 100644
--- a/src/PYPPhoneticEditor.cc
+++ b/src/PYPPhoneticEditor.cc
@@ -179,7 +179,7 @@ PhoneticEditor::updateLookupTable (void)
{
m_lookup_table.clear ();
- fillLookupTableByPage ();
+ fillLookupTable ();
if (m_lookup_table.size()) {
Editor::updateLookupTable (m_lookup_table, TRUE);
} else {
@@ -187,6 +187,7 @@ PhoneticEditor::updateLookupTable (void)
}
}
+#if 0
gboolean
PhoneticEditor::fillLookupTableByPage (void)
{
@@ -227,6 +228,36 @@ PhoneticEditor::fillLookupTableByPage (void)
return TRUE;
}
+#endif
+
+gboolean
+PhoneticEditor::fillLookupTable (void)
+{
+ guint len = 0;
+ pinyin_get_n_candidate (m_instance, &len);
+
+ String word;
+ for (guint i = 0; i < len; i++) {
+ lookup_candidate_t * candidate = NULL;
+ pinyin_get_candidate (m_instance, i, &candidate);
+
+ const gchar * phrase_string = NULL;
+ pinyin_get_candidate_string (m_instance, candidate, &phrase_string);
+
+ /* show get candidates. */
+ if (G_LIKELY (m_props.modeSimp ())) {
+ word = phrase_string;
+ } else { /* Traditional Chinese */
+ word.truncate (0);
+ SimpTradConverter::simpToTrad (phrase_string, word);
+ }
+
+ Text text (word);
+ m_lookup_table.appendCandidate (text);
+ }
+
+ return TRUE;
+}
void
PhoneticEditor::pageUp (void)
@@ -241,8 +272,7 @@ PhoneticEditor::pageUp (void)
void
PhoneticEditor::pageDown (void)
{
- if (G_LIKELY((m_lookup_table.pageDown ()) ||
- (fillLookupTableByPage () && m_lookup_table.pageDown()))) {
+ if (G_LIKELY(m_lookup_table.pageDown ())) {
updateLookupTableFast ();
updatePreeditText ();
updateAuxiliaryText ();
@@ -262,11 +292,6 @@ PhoneticEditor::cursorUp (void)
void
PhoneticEditor::cursorDown (void)
{
- if (G_LIKELY ((m_lookup_table.cursorPos () == m_lookup_table.size() - 1) &&
- (fillLookupTableByPage () == FALSE))) {
- return;
- }
-
if (G_LIKELY (m_lookup_table.cursorDown ())) {
updateLookupTableFast ();
updatePreeditText ();
diff --git a/src/PYPPhoneticEditor.h b/src/PYPPhoneticEditor.h
index 5708d86..e8a3ece 100644
--- a/src/PYPPhoneticEditor.h
+++ b/src/PYPPhoneticEditor.h
@@ -47,7 +47,7 @@ public:
virtual gboolean processFunctionKey (guint keyval, guint keycode, guint modifiers);
virtual void updateLookupTable ();
virtual void updateLookupTableFast ();
- virtual gboolean fillLookupTableByPage ();
+ virtual gboolean fillLookupTable ();
protected:
gboolean selectCandidate (guint i);