summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-09-20 14:32:41 +0800
committerPeng Wu <alexepico@gmail.com>2016-09-20 14:32:41 +0800
commite07ea48d15e995d82ebe0ca9028a153fb93cb674 (patch)
treeaa9bc97c9b2e2ac34f6712f6eda2acdf3b032616
parent12c295ced1ee2baa0ecbade7812aa66c208e1c27 (diff)
downloadibus-libzhuyin-e07ea48d15e995d82ebe0ca9028a153fb93cb674.tar.gz
ibus-libzhuyin-e07ea48d15e995d82ebe0ca9028a153fb93cb674.tar.xz
ibus-libzhuyin-e07ea48d15e995d82ebe0ca9028a153fb93cb674.zip
update PhoneticEditor
-rw-r--r--src/ZYZPhoneticEditor.cc49
-rw-r--r--src/ZYZPhoneticEditor.h3
-rw-r--r--src/ZYZPinyinEditor.cc8
-rw-r--r--src/ZYZZhuyinEditor.cc8
4 files changed, 15 insertions, 53 deletions
diff --git a/src/ZYZPhoneticEditor.cc b/src/ZYZPhoneticEditor.cc
index 184ab90..f82a4b2 100644
--- a/src/ZYZPhoneticEditor.cc
+++ b/src/ZYZPhoneticEditor.cc
@@ -149,14 +149,14 @@ PhoneticEditor::processSpace (guint keyval, guint keycode,
return FALSE;
if (m_text.empty ()) {
- assert (is_half_english (' '));
+ assert (is_special_symbol (' '));
if (m_props.modeFullWidth ()) {
- String english;
- half_english_to_full_english (keyval, english);
- commit (english);
+ String symbol;
+ convert_special_symbol (keyval, symbol);
+ commit (symbol);
} else {
- String english = ' ';
- commit (english);
+ String symbol = ' ';
+ commit (symbol);
}
return TRUE;
}
@@ -956,13 +956,13 @@ PhoneticEditor::getZhuyinCursor (void)
}
gboolean
-PhoneticEditor::insertPunct (guint keyval, guint keycode, guint modifiers)
+PhoneticEditor::insertSymbol (guint keyval, guint keycode, guint modifiers)
{
- /* for punctuations. */
- if (is_half_punct (keyval)) {
+ /* for symbols. */
+ if (is_full_width_symbol (keyval)) {
if (m_props.modeFullWidth () || modifiers & IBUS_SHIFT_MASK) {
String choice;
- assert (half_punct_to_full_punct (keyval, choice));
+ assert (convert_full_width_symbol (keyval, choice));
String lookup;
int ch = find_lookup_key (choice);
@@ -973,34 +973,9 @@ PhoneticEditor::insertPunct (guint keyval, guint keycode, guint modifiers)
lookup, choice);
} else {
String choice = (gchar) keyval;
- insert_symbol (m_text, m_cursor++, BUILTIN_SYMBOL_TYPE,
- "", choice);
- }
-
- return TRUE;
- }
+ if (is_special_symbol (keyval))
+ convert_special_symbol (keyval, choice);
- return FALSE;
-}
-
-gboolean
-PhoneticEditor::insertEnglish (guint keyval, guint keycode, guint modifiers)
-{
- /* for English. */
- if (is_half_english (keyval)) {
- if (m_props.modeFullWidth () || modifiers & IBUS_SHIFT_MASK) {
- String choice;
- assert (half_english_to_full_english (keyval, choice));
-
- String lookup;
- int ch = find_lookup_key (choice);
- if (ch != 0)
- lookup = (gchar) ch;
-
- insert_symbol (m_text, m_cursor++, BUILTIN_SYMBOL_TYPE,
- lookup, choice);
- } else {
- String choice = (gchar) keyval;
insert_symbol (m_text, m_cursor++, BUILTIN_SYMBOL_TYPE,
"", choice);
}
diff --git a/src/ZYZPhoneticEditor.h b/src/ZYZPhoneticEditor.h
index 90f00e7..7aa6d98 100644
--- a/src/ZYZPhoneticEditor.h
+++ b/src/ZYZPhoneticEditor.h
@@ -74,8 +74,7 @@ public:
virtual void updateLookupTableLabel ();
virtual gboolean fillLookupTableByPage ();
- virtual gboolean insertPunct (guint keyval, guint keycode, guint modifiers);
- virtual gboolean insertEnglish (guint keyval, guint keycode, guint modifiers);
+ virtual gboolean insertSymbol (guint keyval, guint keycode, guint modifiers);
virtual gboolean insertNumbers (guint keyval, guint keycode, guint modifiers);
protected:
diff --git a/src/ZYZPinyinEditor.cc b/src/ZYZPinyinEditor.cc
index 67889a8..5b5e9df 100644
--- a/src/ZYZPinyinEditor.cc
+++ b/src/ZYZPinyinEditor.cc
@@ -212,13 +212,7 @@ PinyinEditor::insert (guint keyval, guint keycode, guint modifiers)
return TRUE;
}
- if (insertPunct (keyval, keycode, modifiers)) {
- updateZhuyin ();
- update ();
- return TRUE;
- }
-
- if (insertEnglish (keyval, keycode, modifiers)) {
+ if (insertSymbol (keyval, keycode, modifiers)) {
updateZhuyin ();
update ();
return TRUE;
diff --git a/src/ZYZZhuyinEditor.cc b/src/ZYZZhuyinEditor.cc
index 60ba093..55e29e0 100644
--- a/src/ZYZZhuyinEditor.cc
+++ b/src/ZYZZhuyinEditor.cc
@@ -259,13 +259,7 @@ ZhuyinEditor::insert (guint keyval, guint keycode, guint modifiers)
return TRUE;
}
- if (insertPunct (keyval, keycode, modifiers)) {
- updateZhuyin ();
- update ();
- return TRUE;
- }
-
- if (insertEnglish (keyval, keycode, modifiers)) {
+ if (insertSymbol (keyval, keycode, modifiers)) {
updateZhuyin ();
update ();
return TRUE;