Commit 29df6d8b authored by ChangZhuo Chen's avatar ChangZhuo Chen

Imported Upstream version 1.7.3

parent 9175d6df
......@@ -22,7 +22,7 @@
m4_define([ibus_released], [1])
m4_define([ibus_major_version], [1])
m4_define([ibus_minor_version], [7])
m4_define([ibus_micro_version], [2])
m4_define([ibus_micro_version], [3])
m4_define(ibus_maybe_datestamp,
m4_esyscmd([if test x]ibus_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
......@@ -64,7 +64,7 @@ PKG_CHECK_MODULES(SQLITE, [
AC_PATH_PROG(SQLITE3, sqlite3)
PKG_CHECK_MODULES(LIBPINYIN, [
libpinyin >= 1.1.91
libpinyin >= 1.2.91
], [enable_libpinyin=yes])
LIBPINYIN_DATADIR=`$PKG_CONFIG --variable=pkgdatadir libpinyin`
......
......@@ -157,7 +157,11 @@ static const luaL_Reg syslib[] = {
LUALIB_API int luaopen_myos (lua_State *L) {
#if LUA_VERSION_NUM >= 502
luaL_newlib(L, syslib);
#else
luaL_register(L, LUA_OSLIBNAME, syslib);
#endif
return 1;
}
......@@ -425,7 +425,11 @@ static const luaL_Reg imelib[] = {
};
LUALIB_API int luaopen_ime (lua_State *L) {
#if LUA_VERSION_NUM >= 502
luaL_newlib(L, imelib);
#else
luaL_register(L, LUA_IMELIBNAME, imelib);
#endif
return 1;
}
ca
fr
ru
zh_CN
......
This diff is collapsed.
......@@ -58,7 +58,7 @@ public:
gboolean initFullPunct (void) const { return m_init_full_punct; }
gboolean initSimpChinese (void) const { return m_init_simp_chinese; }
gboolean specialPhrases (void) const { return m_special_phrases; }
ChewingScheme bopomofoKeyboardMapping (void) const { return m_bopomofo_keyboard_mapping; }
ZhuyinScheme bopomofoKeyboardMapping (void) const { return m_bopomofo_keyboard_mapping; }
gint selectKeys (void) const { return m_select_keys; }
gboolean guideKey (void) const { return m_guide_key; }
gboolean auxiliarySelectKeyF (void) const { return m_auxiliary_select_key_f; }
......@@ -112,7 +112,7 @@ protected:
gboolean m_init_simp_chinese;
gboolean m_special_phrases;
ChewingScheme m_bopomofo_keyboard_mapping;
ZhuyinScheme m_bopomofo_keyboard_mapping;
gint m_select_keys;
gboolean m_guide_key;
gboolean m_auxiliary_select_key_f;
......
......@@ -603,7 +603,7 @@ ExtEditor::updateStateFromInput (void)
return FALSE;
}
if ( ! 'i' == m_text[0] ) {
if ( 'i' != m_text[0] ) {
g_warning ("i is expected in m_text string.\n");
return FALSE;
}
......
......@@ -180,8 +180,8 @@ LibPinyinBackEnd::setChewingOptions (Config *config)
if (NULL == m_chewing_context)
return FALSE;
ChewingScheme scheme = config->bopomofoKeyboardMapping ();
pinyin_set_chewing_scheme (m_chewing_context, scheme);
ZhuyinScheme scheme = config->bopomofoKeyboardMapping ();
pinyin_set_zhuyin_scheme (m_chewing_context, scheme);
pinyin_option_t options = config->option() | USE_TONE;
pinyin_set_options(m_chewing_context, options);
......
......@@ -18,7 +18,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "PYPBopomofoEditor.h"
#include <assert.h>
#include "PYConfig.h"
#include "PYLibPinyin.h"
#include "PYPinyinProperties.h"
......@@ -170,8 +172,10 @@ BopomofoEditor::processBopomofo (guint keyval, guint keycode,
if (G_UNLIKELY (cmshm_filter (modifiers) != 0))
return m_text ? TRUE : FALSE;
if (!(pinyin_in_chewing_keyboard (m_instance, keyval, NULL)))
gchar ** symbols = NULL;
if (!pinyin_in_chewing_keyboard (m_instance, keyval, &symbols))
return FALSE;
g_strfreev (symbols);
if (keyval == IBUS_space)
return FALSE;
......@@ -273,9 +277,11 @@ BopomofoEditor::commit ()
/* text after pinyin */
const gchar *p = m_text.c_str() + m_pinyin_len;
while (*p != '\0') {
const char * symbol = NULL;
if (pinyin_in_chewing_keyboard(m_instance, *p, &symbol)) {
m_buffer << symbol;
gchar ** symbols = NULL;
if (pinyin_in_chewing_keyboard (m_instance, *p, &symbols)) {
assert (1 == g_strv_length (symbols));
m_buffer << symbols[0];
g_strfreev (symbols);
} else {
if (G_UNLIKELY (m_props.modeFull ())) {
m_buffer.appendUnichar (HalfFullConverter::toFull (*p));
......@@ -353,7 +359,7 @@ BopomofoEditor::updateAuxiliaryText (void)
gchar * str = NULL;
if (G_UNLIKELY (cursor == m_cursor)) { /* at word boundary. */
pinyin_get_chewing_string (m_instance, key, &str);
pinyin_get_zhuyin_string (m_instance, key, &str);
m_buffer << '|' << str;
g_free (str);
} else if (G_LIKELY (cursor < m_cursor &&
......@@ -368,22 +374,28 @@ BopomofoEditor::updateAuxiliaryText (void)
String before = raw.substr (0, offset);
String after = raw.substr (offset);
String::const_iterator iter;
const char * symbol = NULL;
for ( iter = before.begin (); iter != before.end (); ++iter) {
if ( pinyin_in_chewing_keyboard(m_instance, *iter, &symbol))
m_buffer << symbol;
else
gchar ** symbols = NULL;
for (iter = before.begin (); iter != before.end (); ++iter) {
if (pinyin_in_chewing_keyboard(m_instance, *iter, &symbols)) {
assert (1 == g_strv_length (symbols));
m_buffer << symbols[0];
g_strfreev (symbols);
} else {
m_buffer << *iter;
}
}
m_buffer << '|';
for ( iter = after.begin (); iter != after.end (); ++iter) {
if ( pinyin_in_chewing_keyboard (m_instance, *iter, &symbol))
m_buffer << symbol;
else
for (iter = after.begin (); iter != after.end (); ++iter) {
if (pinyin_in_chewing_keyboard (m_instance, *iter, &symbols)) {
assert (1 == g_strv_length (symbols));
m_buffer << symbols[0];
g_strfreev (symbols);
} else {
m_buffer << *iter;
}
}
} else { /* other words */
pinyin_get_chewing_string (m_instance, key, &str);
pinyin_get_zhuyin_string (m_instance, key, &str);
m_buffer << ' ' << str;
g_free (str);
}
......
......@@ -63,7 +63,7 @@ const gchar * const CONFIG_TRAD_SWITCH = "TradSwitch";
const pinyin_option_t PINYIN_DEFAULT_OPTION =
PINYIN_INCOMPLETE |
CHEWING_INCOMPLETE|
ZHUYIN_INCOMPLETE|
PINYIN_CORRECT_ALL|
0;
......@@ -88,7 +88,7 @@ void
LibPinyinConfig::initDefaultValues (void)
{
m_option = PINYIN_DEFAULT_OPTION;
m_option_mask = PINYIN_INCOMPLETE | CHEWING_INCOMPLETE | PINYIN_CORRECT_ALL;
m_option_mask = PINYIN_INCOMPLETE | ZHUYIN_INCOMPLETE | PINYIN_CORRECT_ALL;
m_orientation = IBUS_ORIENTATION_HORIZONTAL;
m_page_size = 5;
......@@ -121,7 +121,7 @@ static const struct {
const gchar * const name;
guint option;
} options [] = {
{ "IncompletePinyin", PINYIN_INCOMPLETE|CHEWING_INCOMPLETE},
{ "IncompletePinyin", PINYIN_INCOMPLETE|ZHUYIN_INCOMPLETE},
/* fuzzy pinyin */
{ "FuzzyPinyin_C_CH", PINYIN_AMB_C_CH },
{ "FuzzyPinyin_Z_ZH", PINYIN_AMB_Z_ZH },
......@@ -464,12 +464,12 @@ PinyinConfig::valueChanged (const std::string &section,
/* Here are the chewing keyboard scheme mapping table. */
static const struct {
gint bopomofo_keyboard;
ChewingScheme scheme;
ZhuyinScheme scheme;
} chewing_schemes [] = {
{0, CHEWING_STANDARD},
{1, CHEWING_GINYIEH},
{2, CHEWING_ETEN},
{3, CHEWING_IBM}
{0, ZHUYIN_STANDARD},
{1, ZHUYIN_GINYIEH},
{2, ZHUYIN_ETEN},
{3, ZHUYIN_IBM}
};
BopomofoConfig::BopomofoConfig (Bus & bus)
......@@ -500,7 +500,7 @@ BopomofoConfig::readDefaultValues (void)
m_special_phrases = read (CONFIG_SPECIAL_PHRASES, false);
const gint map = read (CONFIG_BOPOMOFO_KEYBOARD_MAPPING, 0);
m_bopomofo_keyboard_mapping = CHEWING_DEFAULT;
m_bopomofo_keyboard_mapping = ZHUYIN_DEFAULT;
for (guint i = 0; i < G_N_ELEMENTS (chewing_schemes); i++) {
if (map == chewing_schemes[i].bopomofo_keyboard) {
......@@ -542,7 +542,7 @@ BopomofoConfig::valueChanged (const std::string &section,
m_special_phrases = normalizeGVariant (value, false);
else if (CONFIG_BOPOMOFO_KEYBOARD_MAPPING == name) {
const gint map = normalizeGVariant (value, 0);
m_bopomofo_keyboard_mapping = CHEWING_DEFAULT;
m_bopomofo_keyboard_mapping = ZHUYIN_DEFAULT;
for (guint i = 0; i < G_N_ELEMENTS (chewing_schemes); i++) {
if (map == chewing_schemes[i].bopomofo_keyboard) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment