begin to write bopomofo editor
authorPeng Wu <alexepico@gmail.com>
Thu, 22 Sep 2011 06:35:40 +0000 (14:35 +0800)
committerPeng Wu <alexepico@gmail.com>
Thu, 22 Dec 2011 04:23:12 +0000 (12:23 +0800)
src/PYPBopomofoEditor.cc
src/PYPBopomofoEditor.h
src/PYPPhoneticEditor.h
src/PYPPinyinEditor.h

index 35c9ed2..9efd8f1 100644 (file)
@@ -72,125 +72,6 @@ LibPinyinBopomofoEditor::insert (gint ch)
     return TRUE;
 }
 
-gboolean
-LibPinyinBopomofoEditor::removeCharBefore (void)
-{
-    if (G_UNLIKELY (m_cursor == 0))
-        return FALSE;
-
-    m_cursor --;
-    m_text.erase (m_cursor, 1);
-    update();
-
-    return TRUE;
-}
-
-gboolean
-LibPinyinBopomofoEditor::removeCharAfter (void)
-{
-    if (G_UNLIKELY (m_cursor == m_text.length ()))
-        return FALSE;
-
-    m_text.erase (m_cursor, 1);
-    update ();
-
-    return TRUE;
-}
-
-gboolean
-LibPinyinBopomofoEditor::removeWordBefore (void)
-{
-    if (G_UNLIKELY (m_cursor == 0))
-        return FALSE;
-
-    /* TODO: to be implemented. */
-    g_assert(FALSE);
-
-    return TRUE;
-}
-
-gboolean
-LibPinyinBopomofoEditor::removeWordAfter (void)
-{
-    if (G_UNLIKELY (m_cursor == m_text.length ()))
-        return FALSE;
-
-    /* TODO: remove one word instead of the sentence. */
-    g_assert(FALSE);
-
-    return TRUE;
-}
-
-gboolean
-LibPinyinBopomofoEditor::moveCursorLeft (void)
-{
-    if (G_UNLIKELY (m_cursor == 0))
-        return FALSE;
-
-    m_cursor --;
-    update ();
-
-    return TRUE;
-}
-
-gboolean
-LibPinyinBopomofoEditor::moveCursorRight (void)
-{
-    if (G_UNLIKELY (m_cursor == m_text.length ()))
-        return FALSE;
-
-    m_cursor ++;
-    update ();
-
-    return TRUE;
-}
-
-gboolean
-LibPinyinBopomofoEditor::moveCursorLeftByWord (void)
-{
-    if (G_UNLIKELY (m_cursor == 0))
-        return FALSE;
-
-    /* TODO: to be implemented. */
-    g_assert(FALSE);
-
-    return TRUE;
-}
-
-gboolean
-LibPinyinBopomofoEditor::moveCursorRightByWord (void)
-{
-    if (G_UNLIKELY (m_cursor == m_text.length ()))
-        return FALSE;
-
-    /* TODO: to be implemented. */
-    g_assert(FALSE);
-
-    return TRUE;
-}
-
-gboolean
-LibPinyinBopomofoEditor::moveCursorToBegin (void)
-{
-    if (G_UNLIKELY (m_cursor == 0))
-        return FALSE;
-
-    m_cursor = 0;
-    update();
-
-    return TRUE;
-}
-
-gboolean
-LibPinyinBopomofoEditor::moveCursorToEnd (void)
-{
-    if (G_UNLIKELY (m_cursor == m_text.length ()))
-        return FALSE;
-
-    m_cursor = m_text.length ();
-    update();
-    return TRUE;
-}
 
 gboolean
 LibPinyinBopomofoEditor::processGuideKey (guint keyval, guint keycode,
index f78375f..9b6b4b6 100644 (file)
@@ -46,31 +46,21 @@ protected:
     gboolean processBopomofo (guint keyval, guint keycode, guint modifiers);
     gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers);
 
+
+    virtual void updateAuxiliaryText ();
+    virtual void updatePinyin (void);
+
 #if 0
-    void updateAuxiliaryText ();
     void updateLookupTable ();
     void updatePreeditText ();
+#endif
 
-    void update ();
     void commit ();
-#endif
     void reset ();
 
     gboolean insert (gint ch);
     gint keyvalToBopomofo (gint ch);
 
-    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);
-
 };
 
 };
index 428f17b..56a8ee4 100644 (file)
@@ -74,6 +74,8 @@ protected:
     virtual void commit (void) = 0;
     virtual void updateAuxiliaryText (void) = 0;
     virtual void updatePreeditText (void) = 0;
+    virtual void updatePinyin (void) = 0;
+
 
     /* varibles */
     PinyinArray                 m_pinyins;
index 974d2a5..00b49ce 100644 (file)
@@ -63,7 +63,7 @@ protected:
 
     virtual gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers);
 
-    virtual void updatePinyin (void) = 0;
+    virtual void updatePinyin (void);
 
     guint getCursorLeftByWord (void);
     guint getCursorRightByWord (void);