summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2018-03-15 16:12:16 +0800
committerPeng Wu <alexepico@gmail.com>2018-03-15 16:12:16 +0800
commit8b52e709e857297b28fc76e9034f799538a42f5b (patch)
tree66188f4ffe495201025f4a10d228675c55ae8e3b
parentc3fd3646a3b4c6509840accb050f338f71035f6a (diff)
downloadibus-libpinyin-8b52e709e857297b28fc76e9034f799538a42f5b.tar.gz
ibus-libpinyin-8b52e709e857297b28fc76e9034f799538a42f5b.tar.xz
ibus-libpinyin-8b52e709e857297b28fc76e9034f799538a42f5b.zip
fixes candidates label
-rw-r--r--src/PYPBopomofoEditor.cc31
-rw-r--r--src/PYPBopomofoEditor.h2
2 files changed, 32 insertions, 1 deletions
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc
index 5b9fa26..430b019 100644
--- a/src/PYPBopomofoEditor.cc
+++ b/src/PYPBopomofoEditor.cc
@@ -79,7 +79,7 @@ BopomofoEditor::insert (gint ch)
gboolean
BopomofoEditor::processGuideKey (guint keyval, guint keycode,
- guint modifiers)
+ guint modifiers)
{
if (!m_config.guideKey ())
return FALSE;
@@ -90,11 +90,13 @@ BopomofoEditor::processGuideKey (guint keyval, guint keycode,
if (G_LIKELY (m_select_mode))
return FALSE;
+#if 0
if (G_UNLIKELY (keyval == IBUS_space)) {
m_select_mode = TRUE;
update ();
return TRUE;
}
+#endif
return FALSE;
}
@@ -252,6 +254,33 @@ BopomofoEditor::processKeyEvent (guint keyval, guint keycode,
}
void
+BopomofoEditor::updateLookupTableLabel (void)
+{
+ String labels = bopomofo_select_keys[m_config.selectKeys ()];
+
+ size_t len = MIN (labels.length (), m_config.pageSize ());
+ for (size_t i = 0; i < len; ++i) {
+ String label = (gchar) labels[i];
+ Text text (label);
+ m_lookup_table.setLabel (i, text);
+ }
+}
+
+void
+BopomofoEditor::updateLookupTable (void)
+{
+ m_lookup_table.clear ();
+
+ fillLookupTable ();
+ updateLookupTableLabel ();
+ if (m_lookup_table.size()) {
+ Editor::updateLookupTable (m_lookup_table, TRUE);
+ } else {
+ hideLookupTable ();
+ }
+}
+
+void
BopomofoEditor::updatePinyin (void)
{
if (G_UNLIKELY (m_text.empty ())) {
diff --git a/src/PYPBopomofoEditor.h b/src/PYPBopomofoEditor.h
index b2eea47..cc6a6f4 100644
--- a/src/PYPBopomofoEditor.h
+++ b/src/PYPBopomofoEditor.h
@@ -46,6 +46,8 @@ protected:
gboolean processBopomofo (guint keyval, guint keycode, guint modifiers);
gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers);
+ void updateLookupTableLabel ();
+ virtual void updateLookupTable ();
virtual void updatePreeditText ();
virtual void updateAuxiliaryText ();