Loading src/PyZyBopomofoContext.cc +5 −5 Original line number Diff line number Diff line Loading @@ -310,7 +310,7 @@ BopomofoContext::updateAuxiliaryText (void) if (G_UNLIKELY (m_text.empty () || m_phrase_editor.candidates ().size () == 0)) { m_auxiliary_text = ""; m_observer->auxiliaryTextChanged (); m_observer->auxiliaryTextChanged (this); return; } Loading Loading @@ -349,7 +349,7 @@ BopomofoContext::updateAuxiliaryText (void) } m_auxiliary_text = m_buffer; m_observer->auxiliaryTextChanged (); m_observer->auxiliaryTextChanged (this); } void Loading Loading @@ -384,7 +384,7 @@ BopomofoContext::commit () m_phrase_editor.commit (); reset (); update (); m_observer->commitText (m_buffer); m_observer->commitText (this, m_buffer); } void Loading @@ -393,7 +393,7 @@ BopomofoContext::updatePreeditText (void) /* preedit text = selected phrases + highlight candidate + rest text */ if (G_UNLIKELY (m_phrase_editor.empty () && m_text.empty ())) { m_preedit_text.clear (); m_observer->preeditTextChanged (); m_observer->preeditTextChanged (this); return; } Loading Loading @@ -474,7 +474,7 @@ BopomofoContext::updatePreeditText (void) m_preedit_text.rest_text = m_buffer.substr (edit_end_byte); } m_observer->preeditTextChanged (); m_observer->preeditTextChanged (this); } static gint Loading src/PyZyInputContext.h +8 −5 Original line number Diff line number Diff line Loading @@ -56,7 +56,9 @@ enum VKeyCode { VKEY_CANDIDATE_SELECT = (30 << 8), VKEY_CANDIDATE_FOCUS = (31 << 8), VKEY_CANDIDATE_RESET = (32 << 8), VKEY_CANDIDATE_FOCUS_PREVIOUS = (32 << 8), VKEY_CANDIDATE_FOCUS_NEXT = (33 << 8), VKEY_CANDIDATE_RESET = (34 << 8), VKEY_PAGE_PREVIOUS = (40 << 8), VKEY_PAGE_NEXT = (41 << 8), Loading @@ -78,10 +80,11 @@ public: class Observer { public: virtual ~Observer () { } virtual void commitText (const std::string &commit_text) = 0; virtual void preeditTextChanged () = 0; virtual void auxiliaryTextChanged () = 0; virtual void lookupTableChanged () = 0; virtual void commitText (const InputContext * context, const std::string &commit_text) = 0; virtual void preeditTextChanged (const InputContext * context) = 0; virtual void auxiliaryTextChanged (const InputContext * context) = 0; virtual void lookupTableChanged (const InputContext * context) = 0; }; enum InputType { Loading src/PyZyPhoneticContext.cc +23 −1 Original line number Diff line number Diff line Loading @@ -107,6 +107,10 @@ PhoneticContext::processKeyEvent (unsigned short key) return selectCandidateInPage (key_num); case VKEY_CANDIDATE_FOCUS: return focusCandidateInPage (key_num); case VKEY_CANDIDATE_FOCUS_PREVIOUS: return focusCandidatePrevious (); case VKEY_CANDIDATE_FOCUS_NEXT: return focusCandidateNext (); case VKEY_CANDIDATE_RESET: return resetCandidateInPage (key_num); Loading Loading @@ -196,7 +200,7 @@ PhoneticContext::updateLookupTable (void) m_candidates.push_back (candidate); } m_observer->lookupTableChanged (); m_observer->lookupTableChanged (this); } void Loading @@ -220,6 +224,24 @@ PhoneticContext::focusCandidateInPage (guint i) return focusCandidate (page () * m_config.pageSize () + i); } gboolean PhoneticContext::focusCandidatePrevious () { if (G_UNLIKELY (m_focused_candidate == 0)) { return FALSE; } return focusCandidate (m_focused_candidate - 1); } gboolean PhoneticContext::focusCandidateNext () { if (G_UNLIKELY (m_focused_candidate >= m_candidates.size ())) { return FALSE; } return focusCandidate (m_focused_candidate + 1); } gboolean PhoneticContext::focusCandidate (guint i) { Loading src/PyZyPhoneticContext.h +3 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ protected: gboolean resetCandidateInPage (guint i); gboolean focusCandidate (guint i); gboolean focusCandidateInPage (guint i); gboolean focusCandidatePrevious (); gboolean focusCandidateNext (); virtual void selectPage (guint i); Loading src/PyZyPinyinContext.cc +5 −5 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ PinyinContext::commit () m_phrase_editor.commit (); reset (); update (); m_observer->commitText (m_buffer); m_observer->commitText (this, m_buffer); } void Loading @@ -71,7 +71,7 @@ PinyinContext::updatePreeditText () /* preedit text = selected phrases + highlight candidate + rest text */ if (G_UNLIKELY (m_phrase_editor.empty () && m_text.empty ())) { m_preedit_text.clear (); m_observer->preeditTextChanged (); m_observer->preeditTextChanged (this); return; } Loading Loading @@ -148,7 +148,7 @@ PinyinContext::updatePreeditText () m_preedit_text.rest_text = m_buffer.substr (edit_end_byte); } m_observer->preeditTextChanged (); m_observer->preeditTextChanged (this); } void Loading @@ -158,7 +158,7 @@ PinyinContext::updateAuxiliaryText (void) if (G_UNLIKELY (m_text.empty () || m_candidates.size () == 0)) { m_auxiliary_text = ""; m_observer->auxiliaryTextChanged (); m_observer->auxiliaryTextChanged (this); return; } Loading Loading @@ -201,7 +201,7 @@ PinyinContext::updateAuxiliaryText (void) } m_auxiliary_text = m_buffer; m_observer->auxiliaryTextChanged (); m_observer->auxiliaryTextChanged (this); } }; // namespace PyZy Loading
src/PyZyBopomofoContext.cc +5 −5 Original line number Diff line number Diff line Loading @@ -310,7 +310,7 @@ BopomofoContext::updateAuxiliaryText (void) if (G_UNLIKELY (m_text.empty () || m_phrase_editor.candidates ().size () == 0)) { m_auxiliary_text = ""; m_observer->auxiliaryTextChanged (); m_observer->auxiliaryTextChanged (this); return; } Loading Loading @@ -349,7 +349,7 @@ BopomofoContext::updateAuxiliaryText (void) } m_auxiliary_text = m_buffer; m_observer->auxiliaryTextChanged (); m_observer->auxiliaryTextChanged (this); } void Loading Loading @@ -384,7 +384,7 @@ BopomofoContext::commit () m_phrase_editor.commit (); reset (); update (); m_observer->commitText (m_buffer); m_observer->commitText (this, m_buffer); } void Loading @@ -393,7 +393,7 @@ BopomofoContext::updatePreeditText (void) /* preedit text = selected phrases + highlight candidate + rest text */ if (G_UNLIKELY (m_phrase_editor.empty () && m_text.empty ())) { m_preedit_text.clear (); m_observer->preeditTextChanged (); m_observer->preeditTextChanged (this); return; } Loading Loading @@ -474,7 +474,7 @@ BopomofoContext::updatePreeditText (void) m_preedit_text.rest_text = m_buffer.substr (edit_end_byte); } m_observer->preeditTextChanged (); m_observer->preeditTextChanged (this); } static gint Loading
src/PyZyInputContext.h +8 −5 Original line number Diff line number Diff line Loading @@ -56,7 +56,9 @@ enum VKeyCode { VKEY_CANDIDATE_SELECT = (30 << 8), VKEY_CANDIDATE_FOCUS = (31 << 8), VKEY_CANDIDATE_RESET = (32 << 8), VKEY_CANDIDATE_FOCUS_PREVIOUS = (32 << 8), VKEY_CANDIDATE_FOCUS_NEXT = (33 << 8), VKEY_CANDIDATE_RESET = (34 << 8), VKEY_PAGE_PREVIOUS = (40 << 8), VKEY_PAGE_NEXT = (41 << 8), Loading @@ -78,10 +80,11 @@ public: class Observer { public: virtual ~Observer () { } virtual void commitText (const std::string &commit_text) = 0; virtual void preeditTextChanged () = 0; virtual void auxiliaryTextChanged () = 0; virtual void lookupTableChanged () = 0; virtual void commitText (const InputContext * context, const std::string &commit_text) = 0; virtual void preeditTextChanged (const InputContext * context) = 0; virtual void auxiliaryTextChanged (const InputContext * context) = 0; virtual void lookupTableChanged (const InputContext * context) = 0; }; enum InputType { Loading
src/PyZyPhoneticContext.cc +23 −1 Original line number Diff line number Diff line Loading @@ -107,6 +107,10 @@ PhoneticContext::processKeyEvent (unsigned short key) return selectCandidateInPage (key_num); case VKEY_CANDIDATE_FOCUS: return focusCandidateInPage (key_num); case VKEY_CANDIDATE_FOCUS_PREVIOUS: return focusCandidatePrevious (); case VKEY_CANDIDATE_FOCUS_NEXT: return focusCandidateNext (); case VKEY_CANDIDATE_RESET: return resetCandidateInPage (key_num); Loading Loading @@ -196,7 +200,7 @@ PhoneticContext::updateLookupTable (void) m_candidates.push_back (candidate); } m_observer->lookupTableChanged (); m_observer->lookupTableChanged (this); } void Loading @@ -220,6 +224,24 @@ PhoneticContext::focusCandidateInPage (guint i) return focusCandidate (page () * m_config.pageSize () + i); } gboolean PhoneticContext::focusCandidatePrevious () { if (G_UNLIKELY (m_focused_candidate == 0)) { return FALSE; } return focusCandidate (m_focused_candidate - 1); } gboolean PhoneticContext::focusCandidateNext () { if (G_UNLIKELY (m_focused_candidate >= m_candidates.size ())) { return FALSE; } return focusCandidate (m_focused_candidate + 1); } gboolean PhoneticContext::focusCandidate (guint i) { Loading
src/PyZyPhoneticContext.h +3 −1 Original line number Diff line number Diff line Loading @@ -77,6 +77,8 @@ protected: gboolean resetCandidateInPage (guint i); gboolean focusCandidate (guint i); gboolean focusCandidateInPage (guint i); gboolean focusCandidatePrevious (); gboolean focusCandidateNext (); virtual void selectPage (guint i); Loading
src/PyZyPinyinContext.cc +5 −5 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ PinyinContext::commit () m_phrase_editor.commit (); reset (); update (); m_observer->commitText (m_buffer); m_observer->commitText (this, m_buffer); } void Loading @@ -71,7 +71,7 @@ PinyinContext::updatePreeditText () /* preedit text = selected phrases + highlight candidate + rest text */ if (G_UNLIKELY (m_phrase_editor.empty () && m_text.empty ())) { m_preedit_text.clear (); m_observer->preeditTextChanged (); m_observer->preeditTextChanged (this); return; } Loading Loading @@ -148,7 +148,7 @@ PinyinContext::updatePreeditText () m_preedit_text.rest_text = m_buffer.substr (edit_end_byte); } m_observer->preeditTextChanged (); m_observer->preeditTextChanged (this); } void Loading @@ -158,7 +158,7 @@ PinyinContext::updateAuxiliaryText (void) if (G_UNLIKELY (m_text.empty () || m_candidates.size () == 0)) { m_auxiliary_text = ""; m_observer->auxiliaryTextChanged (); m_observer->auxiliaryTextChanged (this); return; } Loading Loading @@ -201,7 +201,7 @@ PinyinContext::updateAuxiliaryText (void) } m_auxiliary_text = m_buffer; m_observer->auxiliaryTextChanged (); m_observer->auxiliaryTextChanged (this); } }; // namespace PyZy