From a06c8ad7f26ca41a2c52bd824bed0fc0461ba58b Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 28 Sep 2011 17:35:18 +0800 Subject: re-factor pinyin editor --- src/PYPPinyinEditor.cc | 73 +------------------------------------------------- src/PYPPinyinEditor.h | 6 ----- 2 files changed, 1 insertion(+), 78 deletions(-) (limited to 'src') diff --git a/src/PYPPinyinEditor.cc b/src/PYPPinyinEditor.cc index 5599416..817f621 100644 --- a/src/PYPPinyinEditor.cc +++ b/src/PYPPinyinEditor.cc @@ -298,34 +298,7 @@ LibPinyinPinyinEditor::updateLookupTable () LibPinyinPhoneticEditor::updateLookupTable (); } -gboolean -LibPinyinPinyinEditor::removeCharBefore (void) -{ - if (G_UNLIKELY (m_cursor == 0)) - return FALSE; - - m_cursor --; - m_text.erase (m_cursor, 1); - - updatePinyin (); - update (); - - return TRUE; -} - -gboolean -LibPinyinPinyinEditor::removeCharAfter (void) -{ - if (G_UNLIKELY (m_cursor == m_text.length ())) - return FALSE; - - m_text.erase (m_cursor, 1); - - updatePinyin (); - update (); - - return TRUE; -} +/* move cursor functions */ guint LibPinyinPinyinEditor::getCursorLeftByWord (void) @@ -397,28 +370,6 @@ LibPinyinPinyinEditor::removeWordAfter (void) return TRUE; } -gboolean -LibPinyinPinyinEditor::moveCursorLeft (void) -{ - if (G_UNLIKELY (m_cursor == 0)) - return FALSE; - - m_cursor --; - update (); - return TRUE; -} - -gboolean -LibPinyinPinyinEditor::moveCursorRight (void) -{ - if (G_UNLIKELY (m_cursor == m_text.length ())) - return FALSE; - - m_cursor ++; - update (); - return TRUE; -} - gboolean LibPinyinPinyinEditor::moveCursorLeftByWord (void) { @@ -444,25 +395,3 @@ LibPinyinPinyinEditor::moveCursorRightByWord (void) update (); return TRUE; } - -gboolean -LibPinyinPinyinEditor::moveCursorToBegin (void) -{ - if (G_UNLIKELY (m_cursor == 0)) - return TRUE; - - m_cursor = 0; - update (); - return TRUE; -} - -gboolean -LibPinyinPinyinEditor::moveCursorToEnd (void) -{ - if (G_UNLIKELY (m_cursor == m_text.length ())) - return FALSE; - - m_cursor = m_text.length (); - update (); - return TRUE; -} diff --git a/src/PYPPinyinEditor.h b/src/PYPPinyinEditor.h index 974d2a5..87fe210 100644 --- a/src/PYPPinyinEditor.h +++ b/src/PYPPinyinEditor.h @@ -36,17 +36,11 @@ public: LibPinyinPinyinEditor (PinyinProperties & props, Config & config); public: - gboolean removeCharBefore (void); - gboolean removeCharAfter (void); gboolean removeWordBefore (void); gboolean removeWordAfter (void); - gboolean moveCursorLeft (void); - gboolean moveCursorRight (void); gboolean moveCursorLeftByWord (void); gboolean moveCursorRightByWord (void); - gboolean moveCursorToBegin (void); - gboolean moveCursorToEnd (void); protected: -- cgit