--- Begin Message ---
Package: scim-pinyin
Severity: normal
Dear Maintainer,
Here is the patch to let scim-pinyin work for gtk3 and scim, please consider
accepting it, thanks.
Tz-Huan
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=zh_TW.UTF-8, LC_CTYPE=zh_TW.UTF-8 (charmap=UTF-8) (ignored: LC_ALL
set to zh_TW.UTF-8)
Shell: /bin/sh linked to /bin/dash
diff --git a/po/fr.po b/po/fr.po
index 1e80e3e..7550d3a 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -11,6 +11,7 @@ msgstr ""
"PO-Revision-Date: 2004-11-06 14:08+0100\n"
"Last-Translator: Damien Menanteau <damien.menant...@cegetel.net>\n"
"Language-Team: French\n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/po/it.po b/po/it.po
index d474dad..8b2e5ef 100644
--- a/po/it.po
+++ b/po/it.po
@@ -41,6 +41,10 @@ msgstr ""
msgid "Full/Half Punct"
msgstr "Punto pieno/mezzo"
+#: src/scim_pinyin_imengine.cpp:435 src/scim_pinyin_imengine_setup.cpp:67
+msgid "Smart Pinyin"
+msgstr "Pinyin intelligenti"
+
#: src/scim_pinyin_imengine.cpp:550
msgid "Copyright (C) 2002, 2003 James Su <su...@tsinghua.org.cn>"
msgstr "Copyright (C) 2002, 2003 di James Su <su...@tsinghua.org.cn>"
diff --git a/po/ko.po b/po/ko.po
index bec3e87..3a1a39d 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -2,8 +2,8 @@
# Copyright (C) 2004 James Su <su...@tsinghua.org.cn>
# This file is distributed under the same license as the PACKAGE package.
# 김기태 <ne...@yahoo.com>, 2004.
-#
-#
+#
+#
msgid ""
msgstr ""
"Project-Id-Version: ko\n"
@@ -12,6 +12,7 @@ msgstr ""
"PO-Revision-Date: 2004-08-16 04:17+0800\n"
"Last-Translator: 김기태 <ne...@yahoo.com>\n"
"Language-Team: Korean\n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
diff --git a/src/scim_phrase.cpp b/src/scim_phrase.cpp
index b8618ca..dbc9963 100644
--- a/src/scim_phrase.cpp
+++ b/src/scim_phrase.cpp
@@ -27,6 +27,8 @@
#define SCIM_PHRASE_MAX_RELATION 1000
+#include <cstring>
+
#include <scim.h>
#include "scim_pinyin_private.h"
#include "scim_phrase.h"
@@ -197,13 +199,13 @@ PhraseLib::input (std::istream &is)
// Check lib file
is.getline (temp, 40);
- if (strncmp (temp,
+ if (std::strncmp (temp,
scim_phrase_lib_text_header,
- strlen (scim_phrase_lib_text_header)) == 0) {
+ std::strlen (scim_phrase_lib_text_header)) == 0) {
binary = false;
- } else if (strncmp (temp,
+ } else if (std::strncmp (temp,
scim_phrase_lib_binary_header,
- strlen (scim_phrase_lib_binary_header)) == 0) {
+ std::strlen (scim_phrase_lib_binary_header)) == 0) {
binary = true;
} else {
return false;
@@ -211,7 +213,7 @@ PhraseLib::input (std::istream &is)
is.getline (temp, 40);
- if (strncmp (temp, scim_phrase_lib_version, strlen (scim_phrase_lib_version)) != 0)
+ if (std::strncmp (temp, scim_phrase_lib_version, std::strlen (scim_phrase_lib_version)) != 0)
return false;
// Read phrase library
diff --git a/src/scim_pinyin.cpp b/src/scim_pinyin.cpp
index 0c281ec..f148b59 100644
--- a/src/scim_pinyin.cpp
+++ b/src/scim_pinyin.cpp
@@ -28,6 +28,7 @@
#define Uses_SCIM_CONFIG_PATH
#define Uses_SCIM_LOOKUP_TABLE
+#include <cstring>
#include <scim.h>
#include "scim_pinyin.h"
@@ -684,7 +685,7 @@ PinyinValidator::PinyinValidator (const PinyinTable *table)
void
PinyinValidator::initialize (const PinyinTable *table)
{
- memset (m_bitmap, 0, sizeof (m_bitmap));
+ std::memset (m_bitmap, 0, sizeof (m_bitmap));
if (!table || !table->size()) return;
diff --git a/src/scim_pinyin_imengine.cpp b/src/scim_pinyin_imengine.cpp
index a45a52f..cdd6a07 100644
--- a/src/scim_pinyin_imengine.cpp
+++ b/src/scim_pinyin_imengine.cpp
@@ -210,7 +210,7 @@ PinyinFactory::init ()
false, false, false, false,
false, false, false };
- char *amb_names [SCIM_PINYIN_AmbLast + 2] =
+ const char *amb_names [SCIM_PINYIN_AmbLast + 2] =
{ "Any", "ZhiZi","ChiCi","ShiSi",
"NeLe", "LeRi", "FoHe", "AnAng",
"EnEng","InIng", 0};
diff --git a/src/scim_pinyin_imengine_setup.cpp b/src/scim_pinyin_imengine_setup.cpp
index e092467..f959e87 100644
--- a/src/scim_pinyin_imengine_setup.cpp
+++ b/src/scim_pinyin_imengine_setup.cpp
@@ -128,7 +128,7 @@ static bool __config_ambiguities [SCIM_PINYIN_AmbLast+1] =
false, false, false
};
-static char * __ambiguity_config_keys [SCIM_PINYIN_AmbLast+1] =
+static const char * __ambiguity_config_keys [SCIM_PINYIN_AmbLast+1] =
{
SCIM_CONFIG_IMENGINE_PINYIN_AMBIGUITY_ANY,
SCIM_CONFIG_IMENGINE_PINYIN_AMBIGUITY_ZhiZi,
@@ -142,7 +142,7 @@ static char * __ambiguity_config_keys [SCIM_PINYIN_AmbLast+1] =
SCIM_CONFIG_IMENGINE_PINYIN_AMBIGUITY_InIng
};
-static char * __ambiguity_ui_strings [SCIM_PINYIN_AmbLast+1] =
+static const char * __ambiguity_ui_strings [SCIM_PINYIN_AmbLast+1] =
{
N_("A_mbiguities"),
N_("_Zh and Z"),
@@ -327,7 +327,10 @@ static GtkWidget * __widget_ambiguities [SCIM_PINYIN_AmbLast+1] =
NULL, NULL, NULL
};
+#if GTK_CHECK_VERSION(2, 12, 0)
+#else
static GtkTooltips * __widget_tooltips = 0;
+#endif
// Common callbacks
static void
@@ -383,14 +386,21 @@ __create_setup_window ()
GtkWidget *hbox;
GtkWidget *separator;
+#if GTK_CHECK_VERSION(2, 12, 0)
+#else
__widget_tooltips = gtk_tooltips_new ();
+#endif
// Create the Notebook.
notebook = gtk_notebook_new ();
gtk_widget_show (notebook);
// Create the input configuration page.
+#if GTK_CHECK_VERSION(3, 0, 0)
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+#else
vbox = gtk_vbox_new (FALSE, 0);
+#endif
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (notebook), vbox);
@@ -453,7 +463,11 @@ __create_setup_window ()
gtk_container_set_border_width (GTK_CONTAINER (__widget_dynamic_adjust), 2);
// Max user phrase length
+#if GTK_CHECK_VERSION(3, 0, 0)
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+#else
hbox = gtk_hbox_new (FALSE, 0);
+#endif
gtk_widget_show (hbox);
gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, 0, 1,
(GtkAttachOptions) (GTK_FILL),
@@ -475,7 +489,11 @@ __create_setup_window ()
gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_max_user_phrase_length);
// Max preedit length
+#if GTK_CHECK_VERSION(3, 0, 0)
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+#else
hbox = gtk_hbox_new (FALSE, 0);
+#endif
gtk_widget_show (hbox);
gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, 1, 2,
(GtkAttachOptions) (GTK_FILL),
@@ -497,7 +515,11 @@ __create_setup_window ()
gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_max_preedit_length);
// Smart match level
+#if GTK_CHECK_VERSION(3, 0, 0)
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+#else
hbox = gtk_hbox_new (FALSE, 0);
+#endif
gtk_widget_show (hbox);
gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, 2, 3,
(GtkAttachOptions) (GTK_FILL),
@@ -519,7 +541,11 @@ __create_setup_window ()
gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_smart_match_level);
// Burst stack size
+#if GTK_CHECK_VERSION(3, 0, 0)
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+#else
hbox = gtk_hbox_new (FALSE, 0);
+#endif
gtk_widget_show (hbox);
gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, 3, 4,
(GtkAttachOptions) (GTK_FILL),
@@ -541,7 +567,11 @@ __create_setup_window ()
gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_burst_stack_size);
// Dynamic sensitivity
+#if GTK_CHECK_VERSION(3, 0, 0)
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+#else
hbox = gtk_hbox_new (FALSE, 0);
+#endif
gtk_widget_show (hbox);
gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, 4, 5,
(GtkAttachOptions) (GTK_FILL),
@@ -563,7 +593,11 @@ __create_setup_window ()
gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_dynamic_sensitivity);
// Save period
+#if GTK_CHECK_VERSION(3, 0, 0)
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+#else
hbox = gtk_hbox_new (FALSE, 0);
+#endif
gtk_widget_show (hbox);
gtk_table_attach (GTK_TABLE (table), hbox, 2, 3, 5, 6,
(GtkAttachOptions) (GTK_FILL),
@@ -584,14 +618,22 @@ __create_setup_window ()
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (__widget_save_period), 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), __widget_save_period);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
+#else
separator = gtk_vseparator_new ();
+#endif
gtk_widget_show (separator);
gtk_table_attach (GTK_TABLE (table), separator, 1, 2, 0, 6,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 8, 0);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+#else
separator = gtk_hseparator_new ();
+#endif
gtk_widget_show (separator);
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 4);
@@ -601,12 +643,20 @@ __create_setup_window ()
gtk_box_pack_start (GTK_BOX (vbox), __widget_user_data_binary, FALSE, FALSE, 4);
gtk_container_set_border_width (GTK_CONTAINER (__widget_user_data_binary), 2);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+#else
separator = gtk_hseparator_new ();
+#endif
gtk_widget_show (separator);
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 4);
// Create the pinyin configurations page
+#if GTK_CHECK_VERSION(3, 0, 0)
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+#else
vbox = gtk_vbox_new (FALSE, 0);
+#endif
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (notebook), vbox);
@@ -615,7 +665,11 @@ __create_setup_window ()
gtk_widget_show (label);
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1), label);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+#else
hbox = gtk_hbox_new (FALSE, 0);
+#endif
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4);
@@ -630,7 +684,11 @@ __create_setup_window ()
gtk_box_pack_start (GTK_BOX (hbox), __widget_incomplete, TRUE, TRUE, 4);
gtk_container_set_border_width (GTK_CONTAINER (__widget_incomplete), 2);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+#else
separator = gtk_hseparator_new ();
+#endif
gtk_widget_show (separator);
gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 4);
@@ -683,7 +741,7 @@ __create_setup_window ()
gtk_table_attach (GTK_TABLE (table), __config_keyboards[i].entry, 1, 2, i, i+1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
- gtk_entry_set_editable (GTK_ENTRY (__config_keyboards[i].entry), FALSE);
+ gtk_editable_set_editable (GTK_EDITABLE (__config_keyboards[i].entry), FALSE);
__config_keyboards[i].button = gtk_button_new_with_label ("...");
gtk_widget_show (__config_keyboards[i].button);
@@ -772,6 +830,91 @@ __create_setup_window ()
// Set all tooltips.
+#if GTK_CHECK_VERSION(2, 12, 0)
+ gtk_widget_set_tooltip_text (__widget_user_data_binary,
+ _("If this option is checked, "
+ "the user pinyin and phrase data will be stored "
+ "in binary format. "
+ "This will increase the loading speed."));
+
+ gtk_widget_set_tooltip_text (__widget_auto_combine_phrase,
+ _("If this option is checked, "
+ "the inputed phrases will be combined to one longer "
+ "phrase automatically."));
+
+ gtk_widget_set_tooltip_text (__widget_auto_fill_preedit,
+ _("If this option is checked, "
+ "the preedit string will be filled up automatically, "
+ "by a kind of smart matching algorithm."));
+
+ gtk_widget_set_tooltip_text (__widget_match_longer_phrase,
+ _("If this option is checked, "
+ "the phrases which are longer than the inputed keys "
+ "can also be matched. "
+ "This option is valid only when "
+ "\"Auto combine phrase\" is checked."));
+
+ gtk_widget_set_tooltip_text (__widget_always_show_lookup,
+ _("If this option is checked, "
+ "the lookup table will be always shown "
+ "when there are any candidate phrases."));
+
+ gtk_widget_set_tooltip_text (__widget_show_all_keys,
+ _("If this option is checked, "
+ "all inputed keys will be shown. "
+ "This option is valid only when "
+ "\"Auto fill preedit\" is checked."));
+
+ gtk_widget_set_tooltip_text (__widget_dynamic_adjust,
+ _("If this option is checked, "
+ "the phrase library will be adjusted dynamically "
+ "according to the inputed contents. "
+ "The changed part of the phrase library will be "
+ "stored into local files owned by the user."));
+
+ gtk_widget_set_tooltip_text (__widget_max_user_phrase_length,
+ _("The maxmium length of the custom phrases created "
+ "by user. Those phrases will be created automatically "
+ "when user inputs text."));
+
+ gtk_widget_set_tooltip_text (__widget_max_preedit_length,
+ _("The maxmium length of the preedit string."));
+
+ gtk_widget_set_tooltip_text (__widget_smart_match_level,
+ _("The level of the smart matching algorithm. "
+ "The larger the more accurate but slower."));
+
+ gtk_widget_set_tooltip_text (__widget_burst_stack_size,
+ _("The size of the burst stack. "
+ "Newly inputed phrases will be put into the "
+ "burst stack. The phrases in this stack "
+ "have higher priority than others."));
+
+ gtk_widget_set_tooltip_text (__widget_dynamic_sensitivity,
+ _("The sensitivity of the "
+ "dynamic adjusting algorithm. "
+ "The larger the more sensitive."));
+
+ gtk_widget_set_tooltip_text (__widget_save_period,
+ _("The period in seconds to "
+ "save the user data."));
+
+ gtk_widget_set_tooltip_text (__widget_tone,
+ _("If this option is checked, "
+ "the tone information will be used "
+ "in matching pinyin key."));
+
+ gtk_widget_set_tooltip_text (__widget_incomplete,
+ _("If this option is checked, "
+ "the pinyin keys which only have initial part (Sheng Mu) "
+ "will be allowed. "));
+
+ gtk_widget_set_tooltip_text (__widget_ambiguities [0],
+ _("The following options control the ambiguous "
+ "behaviour of the pinyin matching algorithm. "
+ "Turn on them as you wish, if you can't "
+ "distinguish between them."));
+#else
gtk_tooltips_set_tip (__widget_tooltips, __widget_user_data_binary,
_("If this option is checked, "
"the user pinyin and phrase data will be stored "
@@ -855,10 +998,16 @@ __create_setup_window ()
"behaviour of the pinyin matching algorithm. "
"Turn on them as you wish, if you can't "
"distinguish between them."), NULL);
+#endif
for (i = 0; __config_keyboards [i].key; ++ i) {
+#if GTK_CHECK_VERSION(2, 12, 0)
+ gtk_widget_set_tooltip_text (__config_keyboards [i].entry,
+ _(__config_keyboards [i].tooltip));
+#else
gtk_tooltips_set_tip (__widget_tooltips, __config_keyboards [i].entry,
_(__config_keyboards [i].tooltip), NULL);
+#endif
}
window = notebook;
diff --git a/src/scim_pinyin_phrase.cpp b/src/scim_pinyin_phrase.cpp
index e44e9df..559ebbe 100644
--- a/src/scim_pinyin_phrase.cpp
+++ b/src/scim_pinyin_phrase.cpp
@@ -26,6 +26,8 @@
#define Uses_SCIM_CONFIG_PATH
#define Uses_SCIM_LOOKUP_TABLE
+#include <cstring>
+
#include <scim.h>
#include "scim_pinyin_private.h"
#include "scim_phrase.h"
@@ -118,20 +120,20 @@ PinyinPhraseLib::input_pinyin_lib (const PinyinValidator &validator, std::istrea
//check header
is.getline (header, 40);
- if (strncmp (header,
+ if (std::strncmp (header,
scim_pinyin_lib_text_header,
- strlen (scim_pinyin_lib_text_header)) == 0) {
+ std::strlen (scim_pinyin_lib_text_header)) == 0) {
binary = false;
- } else if (strncmp (header,
+ } else if (std::strncmp (header,
scim_pinyin_lib_binary_header,
- strlen (scim_pinyin_lib_binary_header)) == 0) {
+ std::strlen (scim_pinyin_lib_binary_header)) == 0) {
binary = true;
} else {
return false;
}
is.getline (header, 40);
- if (strncmp (header, scim_pinyin_lib_version, strlen (scim_pinyin_lib_version)) != 0)
+ if (std::strncmp (header, scim_pinyin_lib_version, std::strlen (scim_pinyin_lib_version)) != 0)
return false;
unsigned char bytes [4];
@@ -268,21 +270,21 @@ PinyinPhraseLib::input_indexes (std::istream &is)
//check index file
is.getline (header, 40);
- if (strncmp (header,
+ if (std::strncmp (header,
scim_pinyin_phrase_idx_lib_text_header,
- strlen (scim_pinyin_phrase_idx_lib_text_header)) == 0) {
+ std::strlen (scim_pinyin_phrase_idx_lib_text_header)) == 0) {
binary = false;
- } else if (strncmp (header,
+ } else if (std::strncmp (header,
scim_pinyin_phrase_idx_lib_binary_header,
- strlen (scim_pinyin_phrase_idx_lib_binary_header)) == 0) {
+ std::strlen (scim_pinyin_phrase_idx_lib_binary_header)) == 0) {
binary = true;
} else {
return false;
}
is.getline (header, 40);
- if (strncmp (header, scim_pinyin_phrase_idx_lib_version,
- strlen (scim_pinyin_phrase_idx_lib_version)) != 0)
+ if (std::strncmp (header, scim_pinyin_phrase_idx_lib_version,
+ std::strlen (scim_pinyin_phrase_idx_lib_version)) != 0)
return false;
unsigned char bytes [8];
diff --git a/src/scim_special_table.cpp b/src/scim_special_table.cpp
index 6a46e8f..b84c6fe 100644
--- a/src/scim_special_table.cpp
+++ b/src/scim_special_table.cpp
@@ -20,7 +20,9 @@
#define Uses_STL_IOMANIP
#define Uscs_C_STRING
-#include <time.h>
+#include <cstring>
+#include <ctime>
+
#include <scim.h>
#include "scim_pinyin_private.h"
#include "scim_special_table.h"
@@ -120,7 +122,7 @@ class SpecialKeyItemLessThanByKey
public:
bool operator () (const std::pair <String, String> & lhs,
const std::pair <String, String> & rhs) const {
- int eq = strncmp (lhs.first.c_str (), rhs.first.c_str (), std::min (lhs.first.length(), rhs.first.length()));
+ int eq = std::strncmp (lhs.first.c_str (), rhs.first.c_str (), std::min (lhs.first.length(), rhs.first.length()));
if (eq < 0) return true;
if (eq > 0) return false;
@@ -141,7 +143,7 @@ public:
bool operator () (const std::pair <String, String> & lhs,
const std::pair <String, String> & rhs) const {
- int eq = strncmp (lhs.first.c_str (), rhs.first.c_str (), std::min (lhs.first.length(), rhs.first.length()));
+ int eq = std::strncmp (lhs.first.c_str (), rhs.first.c_str (), std::min (lhs.first.length(), rhs.first.length()));
if (eq < 0) return true;
if (eq > 0) return false;
@@ -308,7 +310,7 @@ static const char * __chinese_week_2 [] =
static void
get_broken_down_time (struct tm &buf)
{
- time_t simple_time = time (NULL);
+ time_t simple_time = std::time (NULL);
#ifdef HAVE_LOCALTIME_R
localtime_r (&simple_time, &buf);
--- End Message ---