summaryrefslogtreecommitdiffstats
path: root/src/PinyinEngine.cc
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2010-05-19 08:10:08 +0800
committerPeng Huang <shawn.p.huang@gmail.com>2010-05-19 08:10:08 +0800
commit41b2b52a009f38f47df37bb58f7e76a8ecfba013 (patch)
tree9f410827f5e5e8737380b472a48815cd21587679 /src/PinyinEngine.cc
parentdd2ae1fb20d75f8f248effc6803f833ad80d0d3a (diff)
downloadibus-libpinyin-41b2b52a009f38f47df37bb58f7e76a8ecfba013.tar.gz
ibus-libpinyin-41b2b52a009f38f47df37bb58f7e76a8ecfba013.tar.xz
ibus-libpinyin-41b2b52a009f38f47df37bb58f7e76a8ecfba013.zip
Add PunctMode in PinyinEngine.
Diffstat (limited to 'src/PinyinEngine.cc')
-rw-r--r--src/PinyinEngine.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/PinyinEngine.cc b/src/PinyinEngine.cc
index c64e297..b0a4131 100644
--- a/src/PinyinEngine.cc
+++ b/src/PinyinEngine.cc
@@ -3,7 +3,7 @@
#include <libintl.h>
#include <string>
#include <cstdlib>
-#include <ibus.h>
+#include "PunctEditor.h"
#include "RawEditor.h"
#include "ExtEditor.h"
#include "FullPinyinEditor.h"
@@ -33,6 +33,7 @@ PinyinEngine::PinyinEngine (IBusEngine *engine)
else
m_editors[MODE_INIT].reset (new FullPinyinEditor (m_props));
+ m_editors[MODE_PUNCT].reset (new PunctEditor (m_props));
m_editors[MODE_RAW].reset (new RawEditor (m_props));
m_editors[MODE_EXTENSION].reset (new ExtEditor (m_props));
@@ -83,11 +84,16 @@ PinyinEngine::processKeyEvent (guint keyval, guint keycode, guint modifiers)
((modifiers & CASHM_MASK) == 0)) {
const String & text = m_editors[MODE_INIT]->text ();
if (text.empty ()) {
- #if 0
- if (keyval == IBUS_i) {
+ switch (keyval) {
+ case IBUS_grave:
+ m_input_mode = MODE_PUNCT;
+ break;
+ #if 0
+ case IBUS_i:
m_input_mode = MODE_EXTENSION;
+ break;
+ #endif
}
- #endif
}
else {
if (m_prev_pressed_key != IBUS_period) {