summaryrefslogtreecommitdiffstats
path: root/src/PYPFullPinyinEditor.cc
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-09-21 14:18:36 +0800
committerPeng Wu <alexepico@gmail.com>2011-12-22 12:23:12 +0800
commit490d506672590d37242cbb45cc8ec871d6f23137 (patch)
tree0329384beb4907a5bea98818b28079739fd550dd /src/PYPFullPinyinEditor.cc
parent05035a2ca103c6dc795bcd810df7fba86f22f8a7 (diff)
downloadibus-libpinyin-490d506672590d37242cbb45cc8ec871d6f23137.tar.gz
ibus-libpinyin-490d506672590d37242cbb45cc8ec871d6f23137.tar.xz
ibus-libpinyin-490d506672590d37242cbb45cc8ec871d6f23137.zip
move cursor edit funcs to pinyin editor
Diffstat (limited to 'src/PYPFullPinyinEditor.cc')
-rw-r--r--src/PYPFullPinyinEditor.cc168
1 files changed, 0 insertions, 168 deletions
diff --git a/src/PYPFullPinyinEditor.cc b/src/PYPFullPinyinEditor.cc
index af29f53..9c1644e 100644
--- a/src/PYPFullPinyinEditor.cc
+++ b/src/PYPFullPinyinEditor.cc
@@ -54,174 +54,6 @@ LibPinyinFullPinyinEditor::insert (gint ch)
return TRUE;
}
-gboolean
-LibPinyinFullPinyinEditor::removeCharBefore (void)
-{
- if (G_UNLIKELY (m_cursor == 0))
- return FALSE;
-
- m_cursor --;
- m_text.erase (m_cursor, 1);
-
- updatePinyin ();
- update ();
-
- return TRUE;
-}
-
-gboolean
-LibPinyinFullPinyinEditor::removeCharAfter (void)
-{
- if (G_UNLIKELY (m_cursor == m_text.length ()))
- return FALSE;
-
- m_text.erase (m_cursor, 1);
-
- updatePinyin ();
- update ();
-
- return TRUE;
-}
-
-guint
-LibPinyinFullPinyinEditor::getCursorLeftByWord (void)
-{
- guint cursor;
-
- if (G_UNLIKELY (m_cursor > m_pinyin_len)) {
- cursor = m_pinyin_len;
- } else {
- PinyinKeyPosVector & pinyin_poses = m_instance->m_pinyin_poses;
- guint pinyin_cursor = getPinyinCursor ();
- PinyinKeyPos *pos = &g_array_index
- (pinyin_poses, PinyinKeyPos, pinyin_cursor);
- cursor = pos->m_pos;
-
- /* cursor at the begin of one pinyin */
- g_return_val_if_fail (pinyin_cursor > 0, 0);
- if ( cursor == m_cursor) {
- pos = &g_array_index
- (pinyin_poses, PinyinKeyPos, pinyin_cursor - 1);
- cursor = pos->m_pos;
- }
- }
-
- return cursor;
-}
-
-guint
-LibPinyinFullPinyinEditor::getCursorRightByWord (void)
-{
- guint cursor;
-
- if (G_UNLIKELY (m_cursor > m_pinyin_len)) {
- cursor = m_text.length ();
- } else {
- guint pinyin_cursor = getPinyinCursor ();
- PinyinKeyPos *pos = &g_array_index
- (m_instance->m_pinyin_poses, PinyinKeyPos, pinyin_cursor);
- cursor = pos->get_end_pos ();
- }
-
- return cursor;
-}
-
-gboolean
-LibPinyinFullPinyinEditor::removeWordBefore (void)
-{
- if (G_UNLIKELY (m_cursor == 0))
- return FALSE;
-
- guint cursor = getCursorLeftByWord ();
- m_text.erase (cursor, m_cursor - cursor);
- m_cursor = cursor;
- updatePinyin ();
- update ();
- return TRUE;
-}
-
-gboolean
-LibPinyinFullPinyinEditor::removeWordAfter (void)
-{
- if (G_UNLIKELY (m_cursor == m_text.length ()))
- return FALSE;
-
- guint cursor = getCursorRightByWord ();
- m_text.erase (m_cursor, cursor - m_cursor);
- updatePinyin ();
- update ();
- return TRUE;
-}
-
-gboolean
-LibPinyinFullPinyinEditor::moveCursorLeft (void)
-{
- if (G_UNLIKELY (m_cursor == 0))
- return FALSE;
-
- m_cursor --;
- update ();
- return TRUE;
-}
-
-gboolean
-LibPinyinFullPinyinEditor::moveCursorRight (void)
-{
- if (G_UNLIKELY (m_cursor == m_text.length ()))
- return FALSE;
-
- m_cursor ++;
- update ();
- return TRUE;
-}
-
-gboolean
-LibPinyinFullPinyinEditor::moveCursorLeftByWord (void)
-{
- if (G_UNLIKELY (m_cursor == 0))
- return FALSE;
-
- guint cursor = getCursorLeftByWord ();
-
- m_cursor = cursor;
- update ();
- return TRUE;
-}
-
-gboolean
-LibPinyinFullPinyinEditor::moveCursorRightByWord (void)
-{
- if (G_UNLIKELY (m_cursor == m_text.length ()))
- return FALSE;
-
- guint cursor = getCursorRightByWord ();
-
- m_cursor = cursor;
- update ();
- return TRUE;
-}
-
-gboolean
-LibPinyinFullPinyinEditor::moveCursorToBegin (void)
-{
- if (G_UNLIKELY (m_cursor == 0))
- return TRUE;
-
- m_cursor = 0;
- update ();
- return TRUE;
-}
-
-gboolean
-LibPinyinFullPinyinEditor::moveCursorToEnd (void)
-{
- if (G_UNLIKELY (m_cursor == m_text.length ()))
- return FALSE;
-
- m_cursor = m_text.length ();
- update ();
- return TRUE;
-}
gboolean
LibPinyinFullPinyinEditor::processKeyEvent (guint keyval,