diff options
Diffstat (limited to 'src/PinyinEngine.cc')
| -rw-r--r-- | src/PinyinEngine.cc | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/PinyinEngine.cc b/src/PinyinEngine.cc index aa9f247..c64e297 100644 --- a/src/PinyinEngine.cc +++ b/src/PinyinEngine.cc @@ -2,11 +2,13 @@ #include <libintl.h> #include <string> +#include <cstdlib> #include <ibus.h> #include "RawEditor.h" #include "ExtEditor.h" #include "FullPinyinEditor.h" #include "DoublePinyinEditor.h" +#include "BopomofoEditor.h" #include "PinyinEngine.h" #include "HalfFullConverter.h" #include "Config.h" @@ -19,13 +21,13 @@ namespace PY { /* constructor */ PinyinEngine::PinyinEngine (IBusEngine *engine) - : m_engine (engine), + : Engine (engine), m_prev_pressed_key (IBUS_VoidSymbol), m_input_mode (MODE_INIT), m_fallback_editor (new FallbackEditor (m_props)) { gint i; - /* create editors */ + if (Config::doublePinyin ()) m_editors[MODE_INIT].reset (new DoublePinyinEditor (m_props)); else @@ -126,7 +128,6 @@ PinyinEngine::processKeyEvent (guint keyval, guint keycode, guint modifiers) void PinyinEngine::focusIn (void) { - /* reset pinyin editor */ if (Config::doublePinyin ()) { if (dynamic_cast <DoublePinyinEditor *> (m_editors[MODE_INIT].get ()) == NULL) { m_editors[MODE_INIT].reset (new DoublePinyinEditor (m_props)); @@ -139,7 +140,7 @@ PinyinEngine::focusIn (void) connectEditorSignals (m_editors[MODE_INIT]); } } - ibus_engine_register_properties (m_engine, m_props.properties ()); + registerProperties (m_props.properties ()); } @@ -196,7 +197,7 @@ PinyinEngine::candidateClicked (guint index, guint button, guint state) void PinyinEngine::slotCommitText (Text & text) { - ibus_engine_commit_text (m_engine, text); + commitText (text); if (m_input_mode != MODE_INIT) m_input_mode = MODE_INIT; if (text.text ()) @@ -208,67 +209,67 @@ PinyinEngine::slotCommitText (Text & text) void PinyinEngine::slotUpdatePreeditText (Text & text, guint cursor, gboolean visible) { - ibus_engine_update_preedit_text (m_engine, text, cursor, visible); + updatePreeditText (text, cursor, visible); } void PinyinEngine::slotShowPreeditText (void) { - ibus_engine_show_preedit_text (m_engine); + showPreeditText (); } void PinyinEngine::slotHidePreeditText (void) { - ibus_engine_hide_preedit_text (m_engine); + hidePreeditText (); } void PinyinEngine::slotUpdateAuxiliaryText (Text & text, gboolean visible) { - ibus_engine_update_auxiliary_text (m_engine, text, visible); + updateAuxiliaryText (text, visible); } void PinyinEngine::slotShowAuxiliaryText (void) { - ibus_engine_show_auxiliary_text (m_engine); + showAuxiliaryText (); } void PinyinEngine::slotHideAuxiliaryText (void) { - ibus_engine_hide_auxiliary_text (m_engine); + hideAuxiliaryText (); } void PinyinEngine::slotUpdateLookupTable (LookupTable & table, gboolean visible) { - ibus_engine_update_lookup_table (m_engine, table, visible); + updateLookupTable (table, visible); } void PinyinEngine::slotUpdateLookupTableFast (LookupTable & table, gboolean visible) { - ibus_engine_update_lookup_table_fast (m_engine, table, visible); + updateLookupTableFast (table, visible); } void PinyinEngine::slotShowLookupTable (void) { - ibus_engine_show_lookup_table (m_engine); + showLookupTable (); } void PinyinEngine::slotHideLookupTable (void) { - ibus_engine_hide_lookup_table (m_engine); + hideLookupTable (); } void PinyinEngine::slotUpdateProperty (Property & prop) { - ibus_engine_update_property (m_engine, prop); + updateProperty (prop); } void |
