summaryrefslogtreecommitdiffstats
path: root/src/BopomofoEditor.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/BopomofoEditor.cc')
-rw-r--r--src/BopomofoEditor.cc54
1 files changed, 16 insertions, 38 deletions
diff --git a/src/BopomofoEditor.cc b/src/BopomofoEditor.cc
index 6e18133..167dfdb 100644
--- a/src/BopomofoEditor.cc
+++ b/src/BopomofoEditor.cc
@@ -22,23 +22,13 @@
#include "BopomofoEditor.h"
#include "SimpTradConverter.h"
-#define CMSHM_MASK \
- (IBUS_CONTROL_MASK | \
- IBUS_MOD1_MASK | \
- IBUS_SUPER_MASK | \
- IBUS_HYPER_MASK | \
- IBUS_META_MASK)
-
-#define CMSHM_FILTER(modifiers) \
- (modifiers & (CMSHM_MASK))
-
namespace PY {
#include "Bopomofo.h"
#include "BopomofoKeyboard.h"
BopomofoEditor::BopomofoEditor (PinyinProperties & props, Config & config)
- : PinyinEditor (props, config),
+ : PhoneticEditor (props, config),
m_select_mode (FALSE)
{
}
@@ -51,7 +41,7 @@ void
BopomofoEditor::reset (void)
{
m_select_mode = FALSE;
- PinyinEditor::reset ();
+ PhoneticEditor::reset ();
}
gboolean
@@ -235,22 +225,6 @@ BopomofoEditor::moveCursorToEnd (void)
return TRUE;
}
-inline gboolean
-BopomofoEditor::processSpace (guint keyval, guint keycode, guint modifiers)
-{
- if (!m_text)
- return FALSE;
- if (CMSHM_FILTER (modifiers) != 0)
- return TRUE;
- if (m_lookup_table.size () != 0) {
- selectCandidate (m_lookup_table.cursorPos ());
- }
- else {
- commit ();
- }
- return TRUE;
-}
-
gboolean
BopomofoEditor::processNumber (guint keyval, guint keycode, guint modifiers)
{
@@ -336,7 +310,7 @@ BopomofoEditor::processNumberWithShift (guint keyval, guint keycode, guint modif
inline gboolean
BopomofoEditor::processBopomofo (guint keyval, guint keycode, guint modifiers)
{
- if (G_UNLIKELY (CMSHM_FILTER(modifiers) != 0))
+ if (G_UNLIKELY (CMSHM_FILTER (modifiers) != 0))
return m_text ? TRUE : FALSE;
if (keyvalToBopomofo (keyval) == BOPOMOFO_ZERO)
@@ -384,7 +358,7 @@ BopomofoEditor::processKeyEvent (guint keyval, guint keycode, guint modifiers)
case IBUS_KP_Page_Down:
case IBUS_Tab:
m_select_mode = TRUE;
- return PinyinEditor::processKeyEvent (keyval, keycode, modifiers);
+ return PhoneticEditor::processFunctionKey (keyval, keycode, modifiers);
case IBUS_BackSpace:
case IBUS_Delete:
@@ -398,10 +372,10 @@ BopomofoEditor::processKeyEvent (guint keyval, guint keycode, guint modifiers)
case IBUS_End:
case IBUS_KP_End:
m_select_mode = FALSE;
- return PinyinEditor::processKeyEvent (keyval, keycode, modifiers);
+ return PhoneticEditor::processFunctionKey (keyval, keycode, modifiers);
default:
- return PinyinEditor::processKeyEvent (keyval, keycode, modifiers);
+ return PhoneticEditor::processFunctionKey (keyval, keycode, modifiers);
}
}
@@ -441,8 +415,6 @@ BopomofoEditor::updateAuxiliaryText (void)
m_buffer.clear ();
- updateAuxiliaryTextBefore (m_buffer);
-
guint si = 0;
guint m_text_len = m_text.length();
for (guint i = m_phrase_editor.cursor (); i < m_pinyin.size (); ++i) {
@@ -467,8 +439,6 @@ BopomofoEditor::updateAuxiliaryText (void)
if (m_cursor == m_text.length ())
m_buffer << '|';
- updateAuxiliaryTextAfter (m_buffer);
-
StaticText aux_text (m_buffer);
Editor::updateAuxiliaryText (aux_text, TRUE);
}
@@ -476,7 +446,7 @@ BopomofoEditor::updateAuxiliaryText (void)
void
BopomofoEditor::commit (void)
{
- if (G_UNLIKELY (empty ()))
+ if (G_UNLIKELY (m_buffer.empty ()))
return;
m_buffer.clear ();
@@ -499,7 +469,7 @@ BopomofoEditor::commit (void)
m_phrase_editor.commit ();
reset ();
- PinyinEditor::commit ((const gchar *)m_buffer);
+ PhoneticEditor::commit ((const gchar *)m_buffer);
}
void
@@ -584,6 +554,14 @@ BopomofoEditor::updatePreeditText (void)
Editor::updatePreeditText (preedit_text, edit_begin, TRUE);
}
+void
+BopomofoEditor::updateLookupTable ()
+{
+ m_lookup_table.setPageSize (m_config.pageSize ());
+ m_lookup_table.setOrientation (m_config.orientation ());
+ PhoneticEditor::updateLookupTable ();
+}
+
static int
keyboard_cmp (const void *p1, const void *p2)
{