summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2012-07-26 12:50:06 +0800
committerPeng Wu <alexepico@gmail.com>2012-07-26 12:50:06 +0800
commit88e6f403b0ed6a4eb33737c642d12b6fd462531b (patch)
tree89b92798eb3438e188ee58273a16e324fc3dd89a
parent82f7ed8fe4f108fc5408708fa3dad6b29fc15448 (diff)
downloadibus-libpinyin-88e6f403b0ed6a4eb33737c642d12b6fd462531b.tar.gz
enable stroke editor
-rw-r--r--src/Makefile.am6
-rw-r--r--src/PYPPinyinEngine.cc16
-rw-r--r--src/PYPPinyinEngine.h2
3 files changed, 22 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 8144a75..2ea0fe6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -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) \
diff --git a/src/PYPPinyinEngine.cc b/src/PYPPinyinEngine.cc
index c219f09..4e5be29 100644
--- a/src/PYPPinyinEngine.cc
+++ b/src/PYPPinyinEngine.cc
@@ -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 */
diff --git a/src/PYPPinyinEngine.h b/src/PYPPinyinEngine.h
index 2df12351..a7e0e12 100644
--- a/src/PYPPinyinEngine.h
+++ b/src/PYPPinyinEngine.h
@@ -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;