enable stroke editor
authorPeng Wu <alexepico@gmail.com>
Thu, 26 Jul 2012 04:50:06 +0000 (12:50 +0800)
committerPeng Wu <alexepico@gmail.com>
Thu, 26 Jul 2012 04:50:06 +0000 (12:50 +0800)
src/Makefile.am
src/PYPPinyinEngine.cc
src/PYPPinyinEngine.h

index 8144a75..2ea0fe6 100644 (file)
@@ -184,6 +184,12 @@ if IBUS_BUILD_ENGLISH_INPUT_MODE
        $(NULL)
 endif
 
+if IBUS_BUILD_STROKE_INPUT_MODE
+   ibus_engine_libpinyin_CXXFLAGS += \
+       -DIBUS_BUILD_STROKE_INPUT_MODE \
+       $(NULL)
+endif
+
 BUILT_SOURCES = \
        $(ibus_engine_built_c_sources) \
        $(ibus_engine_built_h_sources) \
index c219f09..4e5be29 100644 (file)
@@ -31,6 +31,9 @@
 #ifdef IBUS_BUILD_ENGLISH_INPUT_MODE
 #include "PYEnglishEditor.h"
 #endif
+#ifdef IBUS_BUILD_STROKE_INPUT_MODE
+#include "PYStrokeEditor.h"
+#endif
 #include "PYPFullPinyinEditor.h"
 #include "PYPDoublePinyinEditor.h"
 #include "PYFallbackEditor.h"
@@ -71,6 +74,11 @@ LibPinyinPinyinEngine::LibPinyinPinyinEngine (IBusEngine *engine)
 #else
     m_editors[MODE_ENGLISH].reset (new Editor (m_props, LibPinyinPinyinConfig::instance ()));
 #endif
+#ifdef IBUS_BUILD_STROKE_INPUT_MODE
+    m_editors[MODE_STROKE].reset (new StrokeEditor (m_props, LibPinyinPinyinConfig::instance ()));
+#else
+    m_editors[MODE_STROKE].reset (new Editor (m_props, LibPinyinPinyinConfig::instance ()));
+#endif
 
     m_props.signalUpdateProperty ().connect
         (std::bind (&LibPinyinPinyinEngine::updateProperty, this, _1));
@@ -149,6 +157,14 @@ LibPinyinPinyinEngine::processKeyEvent (guint keyval, guint keycode, guint modif
                     m_input_mode = MODE_ENGLISH;
                     break;
 #endif
+#ifdef IBUS_BUILD_STROKE_INPUT_MODE
+                case IBUS_u:
+                    // do not enable stroke mode when use double pinyin.
+                    if (LibPinyinPinyinConfig::instance ().doublePinyin ())
+                        break;
+                    m_input_mode = MODE_STROKE;
+                    break;
+#endif
                 }
             } else {
                 /* TODO: Unknown */
index 2df1235..a7e0e12 100644 (file)
@@ -63,9 +63,7 @@ private:
         MODE_PUNCT,             // punct mode
         MODE_RAW,               // raw mode
         MODE_ENGLISH,           // press v into English input mode
-    #if 0
         MODE_STROKE,            // press u into stroke input mode
-    #endif
         MODE_EXTENSION,         // press i into extension input mode
         MODE_LAST,
     } m_input_mode;