rpms/scim-anthy/devel scim-anthy-1.0.0-pseudo-ascii-insert-space.patch, NONE, 1.1 scim-anthy-1.0.0-pseudo-ascii.patch, NONE, 1.1 scim-anthy.spec, 1.31, 1.32

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Jul 14 12:27:30 UTC 2006


Author: tagoh

Update of /cvs/dist/rpms/scim-anthy/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv360

Modified Files:
	scim-anthy.spec 
Added Files:
	scim-anthy-1.0.0-pseudo-ascii-insert-space.patch 
	scim-anthy-1.0.0-pseudo-ascii.patch 
Log Message:
* Fri Jul 14 2006 Akira TAGOH <tagohr at edhat.com> - 1.0.0-4
- scim-anthy-1.0.0-pseudo-ascii.patch,
  scim-anthy-1.0.0-pseudo-ascii-insert-space.patch: applied to allow the ASCII
  characters with the capital letter without even turning off the IME. (#187721)

scim-anthy-1.0.0-pseudo-ascii-insert-space.patch:
 scim_anthy_action.cpp       |    6 ++
 scim_anthy_action.h         |    3 -
 scim_anthy_factory.cpp      |   15 ++++++-
 scim_anthy_factory.h        |    3 +
 scim_anthy_imengine.cpp     |   90 +++++++++++++++++++++++++++++++------------
 scim_anthy_imengine.h       |    2 
 scim_anthy_kana.cpp         |   14 +++++-
 scim_anthy_kana.h           |    6 ++
 scim_anthy_key2kana.cpp     |   27 ++++++++----
 scim_anthy_key2kana.h       |   14 ++++--
 scim_anthy_key2kana_base.h  |    8 ++-
 scim_anthy_nicola.cpp       |   16 ++++++-
 scim_anthy_nicola.h         |    6 ++
 scim_anthy_preedit.cpp      |   23 ++++++++++-
 scim_anthy_preedit.h        |    9 +++-
 scim_anthy_prefs.cpp        |   82 ++++++++++++++++++++++++++++++++++++++-
 scim_anthy_prefs.h          |    9 ++++
 scim_anthy_reading.cpp      |   92 ++++++++++++++++++++++++++++++++++++++++++--
 scim_anthy_reading.h        |    6 ++
 scim_anthy_setup.cpp        |   60 ----------------------------
 scim_anthy_setup_romaji.cpp |   60 +++++++++++++++++++++-------
 21 files changed, 418 insertions(+), 133 deletions(-)

--- NEW FILE scim-anthy-1.0.0-pseudo-ascii-insert-space.patch ---
2006-07-13 Akira TAGOH <at at gclab.org>

	* src/scim_anthy_action.{cpp,h}, src/scim_anthy_factory.{cpp,h},
	  src/scim_anthy_imengine.{cpp,h}, src/scim_anthy_kana.{cpp,h},
	  src/scim_anthy_key2kana.{cpp,h}, src/scim_anthy_key2kana_base.h,
	  src/scim_anthy_nicola.{cpp,h}, src/scim_anthy_preedit.{cpp,h},
	  src/scim_anthy_prefs.{cpp,h}, src/scim_anthy_reading.{cpp,h},
	  src/scim_anthy_setup.cpp, src/scim_anthy_setup_romaji.cpp:
	  Enable to enter space during pseudo ASCII mode.
Index: src/scim_anthy_action.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_action.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- src/scim_anthy_action.cpp	22 Jul 2005 11:25:27 -0000	1.6
+++ src/scim_anthy_action.cpp	13 Jul 2006 07:41:51 -0000	1.7
@@ -78,3 +78,9 @@
 {
     return util_match_key_event (m_key_bindings, key, SCIM_KEY_CapsLockMask);
 }
+
+bool
+Action::match_action_name (const char *name)
+{
+    return (m_name.compare (name) == 0);
+}
Index: src/scim_anthy_action.h
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_action.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- src/scim_anthy_action.h	2 Jun 2005 07:35:03 -0000	1.3
+++ src/scim_anthy_action.h	13 Jul 2006 07:41:51 -0000	1.4
@@ -43,7 +43,8 @@
     bool perform (AnthyInstance  *performer);
     bool perform (AnthyInstance  *performer,
                   const KeyEvent &key);
-    
+
+    bool match_action_name (const char *name);
 
 private:
     bool match_key_event (const KeyEvent &key);
Index: src/scim_anthy_factory.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_factory.cpp,v
retrieving revision 1.45
retrieving revision 1.47
diff -u -r1.45 -r1.47
--- src/scim_anthy_factory.cpp	4 Jul 2006 09:19:48 -0000	1.45
+++ src/scim_anthy_factory.cpp	14 Jul 2006 02:37:17 -0000	1.47
@@ -123,6 +123,7 @@
       m_romaji_half_number          (SCIM_ANTHY_CONFIG_ROMAJI_HALF_NUMBER_DEFAULT),
       m_romaji_allow_split          (SCIM_ANTHY_CONFIG_ROMAJI_ALLOW_SPLIT_DEFAULT),
       m_romaji_pseudo_ascii_mode    (SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE_DEFAULT),
+      m_romaji_pseudo_ascii_blank_behavior (SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_BLANK_BEHAVIOR),
       m_nicola_time                 (SCIM_ANTHY_CONFIG_NICOLA_TIME_DEFAULT),
       m_dict_admin_command          (SCIM_ANTHY_CONFIG_DICT_ADMIN_COMMAND_DEFAULT),
       m_add_word_command            (SCIM_ANTHY_CONFIG_ADD_WORD_COMMAND_DEFAULT),
@@ -214,7 +215,11 @@
           "  Ryo Dairiki <ryo-dairiki at mbm.nifty.com>\n"
           "  Seiichi SATO\n"
           "  AWASHIRO Ikuya <ikuya at oooug.jp>\n"
-          "  Hatuka*nezumi <nezumi at jca.apc.org>"));
+          "  Hatuka*nezumi <nezumi at jca.apc.org>\n"
+          "  Teppei Tamra <tam-t at par.odn.ne.jp>\n"
+          "  Akira TAGOH <at at gclab.org>\n"
+          "  Tatsuki Sugiura <sugi at nemui.org>\n"
+          "  Takashi Nakamoto <bluedwarf at bpost.plala.or.jp>"));
 }
 
 WideString
@@ -328,7 +333,7 @@
 #else
 #define APPEND_ACTION(key, func)                                               \
 {                                                                              \
-    String name = "func", str;                                                 \
+    String name = #key, str;                                                   \
     if (loaded) {                                                              \
         String str2, str3;                                                     \
         str2 = String (SCIM_ANTHY_CONFIG_##key##_KEY);                         \
@@ -415,6 +420,7 @@
 ANTHY_DEFINE_ACTION (action_hiragana_mode);
 ANTHY_DEFINE_ACTION (action_katakana_mode);
 ANTHY_DEFINE_ACTION (action_half_katakana_mode);
+ANTHY_DEFINE_ACTION (action_cancel_pseudo_ascii_mode);
 ANTHY_DEFINE_ACTION (action_launch_dict_admin_tool);
 ANTHY_DEFINE_ACTION (action_add_word);
 
@@ -500,6 +506,10 @@
             = config->read (String (SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE),
                             SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE_DEFAULT);
 
+        m_romaji_pseudo_ascii_blank_behavior
+            = config->read (String (SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_BLANK_BEHAVIOR),
+                            SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_BLANK_BEHAVIOR_DEFAULT);
+
         m_nicola_time
             = config->read (String (SCIM_ANTHY_CONFIG_NICOLA_TIME),
                             SCIM_ANTHY_CONFIG_NICOLA_TIME_DEFAULT);
@@ -693,6 +703,7 @@
     APPEND_ACTION (HIRAGANA_MODE,           action_hiragana_mode);
     APPEND_ACTION (KATAKANA_MODE,           action_katakana_mode);
     APPEND_ACTION (HALF_KATAKANA_MODE,      action_half_katakana_mode);
+    APPEND_ACTION (CANCEL_PSEUDO_ASCII_MODE,action_cancel_pseudo_ascii_mode);
 
     // dict keys
     APPEND_ACTION (DICT_ADMIN,              action_launch_dict_admin_tool);
Index: src/scim_anthy_factory.h
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_factory.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- src/scim_anthy_factory.h	4 Jul 2006 09:19:48 -0000	1.23
+++ src/scim_anthy_factory.h	13 Jul 2006 07:41:51 -0000	1.24
@@ -92,7 +92,10 @@
     bool           m_romaji_half_symbol;
     bool           m_romaji_half_number;
     bool           m_romaji_allow_split;
+
     bool           m_romaji_pseudo_ascii_mode;
+    bool           m_romaji_pseudo_ascii_blank_behavior;
+
     int            m_nicola_time;
     KeyEventList   m_left_thumb_keys;
     KeyEventList   m_right_thumb_keys;
Index: src/scim_anthy_imengine.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_imengine.cpp,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -r1.145 -r1.146
--- src/scim_anthy_imengine.cpp	11 Jul 2006 01:16:00 -0000	1.145
+++ src/scim_anthy_imengine.cpp	13 Jul 2006 07:41:51 -0000	1.146
@@ -194,9 +194,25 @@
 bool
 AnthyInstance::process_key_event_lookup_keybind (const KeyEvent& key)
 {
+    std::vector<Action>::iterator it;
+
     m_last_key = key;
 
-    std::vector<Action>::iterator it;
+    /* try to find a "insert a blank" action to be not stolen a blank key
+     * when entering the pseudo ascii mode.
+     */
+    if (get_pseudo_ascii_mode () != 0 &&
+        m_factory->m_romaji_pseudo_ascii_blank_behavior &&
+        m_preedit.is_pseudo_ascii_mode ()) {
+        for (it  = m_factory->m_actions.begin();
+             it != m_factory->m_actions.end();
+             it++) {
+            if (it->match_action_name ("INSERT_SPACE") &&
+                it->perform (this, key)) {
+                return true;
+            }
+        }
+    }
     for (it  = m_factory->m_actions.begin();
          it != m_factory->m_actions.end();
          it++)
@@ -829,16 +845,14 @@
 
     if (method != get_typing_method ()) {
         Key2KanaTable *fundamental_table = NULL;
-        bool pseudo_ascii = false;
 
         if (method == SCIM_ANTHY_TYPING_METHOD_ROMAJI) {
             fundamental_table = m_factory->m_custom_romaji_table;
-            pseudo_ascii = m_factory->m_romaji_pseudo_ascii_mode;
         } else if (method == SCIM_ANTHY_TYPING_METHOD_KANA) {
             fundamental_table = m_factory->m_custom_kana_table;
         }
         m_preedit.set_typing_method (method);
-        m_preedit.use_pseudo_ascii_mode (pseudo_ascii);
+        m_preedit.set_pseudo_ascii_mode (get_pseudo_ascii_mode ());
     }
 }
 
@@ -1125,10 +1139,11 @@
 bool
 AnthyInstance::action_insert_space (void)
 {
-    if (m_preedit.is_preediting ())
-        return false;
+    String str;
+    bool is_wide = false, retval = false;
 
-    bool is_wide = false;
+    if (m_preedit.is_preediting () && !m_factory->m_romaji_pseudo_ascii_blank_behavior)
+        return false;
 
     if (m_factory->m_space_type == "FollowMode") {
         InputMode mode = get_input_mode ();
@@ -1144,27 +1159,38 @@
     }
 
     if (is_wide) {
-        commit_string (utf8_mbstowcs ("\xE3\x80\x80"));
-        return true;
+        str = "\xE3\x80\x80";
+        retval = true;
     } else if (get_typing_method () == SCIM_ANTHY_TYPING_METHOD_NICOLA || // FIXME! it's a ad-hoc solution.
                (m_last_key.code != SCIM_KEY_space &&
                 m_last_key.code != SCIM_KEY_KP_Space))
     {
-        commit_string (utf8_mbstowcs (" "));
-        return true;
+        str = " ";
+        retval = true;
     }
 
-    return false;
+    if (retval) {
+        if (m_preedit.is_pseudo_ascii_mode ()) {
+            m_preedit.append (m_last_key, str);
+            show_preedit_string ();
+            m_preedit_string_visible = true;
+            set_preedition ();
+        } else {
+            commit_string (utf8_mbstowcs (str));
+        }
+    }
+
+    return retval;
 }
 
 bool 
 AnthyInstance::action_insert_alternative_space (void)
 {
+    bool is_wide = false;
+
     if (m_preedit.is_preediting ())
         return false;
 
-    bool is_wide = false;
-
     if (m_factory->m_space_type == "FollowMode") {
         InputMode mode = get_input_mode ();
         if (mode == SCIM_ANTHY_MODE_LATIN ||
@@ -1795,6 +1821,14 @@
 }
 
 bool
+AnthyInstance::action_cancel_pseudo_ascii_mode (void)
+{
+    m_preedit.reset_pseudo_ascii_mode ();
+
+    return true;
+}
+
+bool
 AnthyInstance::convert_kana (CandidateType type)
 {
     if (!m_preedit.is_preediting ())
@@ -2213,22 +2247,15 @@
     if (m_on_init || !m_factory->m_show_typing_method_label) {
         if (m_factory->m_typing_method == "NICOLA") {
             m_preedit.set_typing_method (SCIM_ANTHY_TYPING_METHOD_NICOLA);
-            m_preedit.use_pseudo_ascii_mode(false);
         } else if (m_factory->m_typing_method == "Kana") {
             m_preedit.set_typing_method (SCIM_ANTHY_TYPING_METHOD_KANA);
-            m_preedit.use_pseudo_ascii_mode(false);
         } else {
             m_preedit.set_typing_method (SCIM_ANTHY_TYPING_METHOD_ROMAJI);
-            m_preedit.use_pseudo_ascii_mode(m_factory->m_romaji_pseudo_ascii_mode);
         }
+        m_preedit.set_pseudo_ascii_mode (get_pseudo_ascii_mode ());
     } else {
-        TypingMethod m = m_preedit.get_typing_method ();
-
-        m_preedit.set_typing_method (m);
-        if (m == SCIM_ANTHY_TYPING_METHOD_ROMAJI)
-            m_preedit.use_pseudo_ascii_mode(m_factory->m_romaji_pseudo_ascii_mode);
-        else
-            m_preedit.use_pseudo_ascii_mode(false);
+        m_preedit.set_typing_method (get_typing_method ());
+        m_preedit.set_pseudo_ascii_mode (get_pseudo_ascii_mode ());
     }
 
     // set conversion mode
@@ -2313,6 +2340,21 @@
     else
         return false;
 }
+
+int
+AnthyInstance::get_pseudo_ascii_mode (void)
+{
+    int retval = 0;
+    TypingMethod m = get_typing_method ();
+
+    if (m == SCIM_ANTHY_TYPING_METHOD_ROMAJI) {
+        if (m_factory->m_romaji_pseudo_ascii_mode)
+            retval |= SCIM_ANTHY_PSEUDO_ASCII_TRIGGERED_CAPITALIZED;
+    }
+
+    return retval;
+}
+
 /*
 vi:ts=4:nowrap:ai:expandtab
 */
Index: src/scim_anthy_imengine.h
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_imengine.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- src/scim_anthy_imengine.h	13 Feb 2006 08:06:25 -0000	1.47
+++ src/scim_anthy_imengine.h	13 Jul 2006 07:41:51 -0000	1.48
@@ -184,6 +184,7 @@
     bool   action_hiragana_mode               (void);
     bool   action_katakana_mode               (void);
     bool   action_half_katakana_mode          (void);
+    bool   action_cancel_pseudo_ascii_mode    (void);
 
     bool   action_add_word                    (void);
     bool   action_launch_dict_admin_tool      (void);
@@ -203,6 +204,7 @@
                                                void         *data = NULL,
                                                delete_func   delete_fn = NULL);
     void   timeout_remove                     (uint32        id);
+    int    get_pseudo_ascii_mode              (void);
 
 private:
     /* processing key event */
Index: src/scim_anthy_kana.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_kana.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- src/scim_anthy_kana.cpp	19 Nov 2005 01:22:08 -0000	1.6
+++ src/scim_anthy_kana.cpp	13 Jul 2006 07:41:51 -0000	1.7
@@ -93,7 +93,8 @@
 }
 
 bool
-KanaConvertor::can_append (const KeyEvent & key)
+KanaConvertor::can_append (const KeyEvent & key,
+                           bool             ignore_space)
 {
     // ignore key release.
     if (key.is_key_release ())
@@ -196,8 +197,17 @@
 
     String s;
     s += key.get_ascii_code ();
-    result = utf8_mbstowcs (s);
     raw    = s;
+
+    return append (raw, result, pending);
+}
+
+bool
+KanaConvertor::append (const String & str,
+                       WideString   & result,
+                       WideString   & pending)
+{
+    result = utf8_mbstowcs (str);
     m_pending = String ();
 
     return false;
Index: src/scim_anthy_kana.h
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_kana.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- src/scim_anthy_kana.h	19 Nov 2005 01:22:08 -0000	1.5
+++ src/scim_anthy_kana.h	13 Jul 2006 07:41:51 -0000	1.6
@@ -40,11 +40,15 @@
                KanaConvertor      (AnthyInstance    & anthy);
     virtual   ~KanaConvertor      ();
 
-    bool       can_append         (const KeyEvent   & key);
+    bool       can_append         (const KeyEvent   & key,
+                                   bool               ignore_space = false);
     bool       append             (const KeyEvent   & key,
                                    WideString       & result,
                                    WideString       & pending,
                                    String           & raw);
+    bool       append             (const String     & raw,
+                                   WideString       & result,
+                                   WideString       & pending);
     void       clear              (void);
 
     bool       is_pending         (void);
Index: src/scim_anthy_key2kana.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_key2kana.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- src/scim_anthy_key2kana.cpp	25 Apr 2006 07:26:19 -0000	1.13
+++ src/scim_anthy_key2kana.cpp	13 Jul 2006 07:41:51 -0000	1.14
@@ -32,7 +32,7 @@
       m_is_in_pseudo_ascii_mode (false)
 {
     set_case_sensitive (false);
-    use_pseudo_ascii_mode (false);
+    set_pseudo_ascii_mode (0);
 }
 
 Key2KanaConvertor::~Key2KanaConvertor ()
@@ -40,7 +40,8 @@
 }
 
 bool
-Key2KanaConvertor::can_append (const KeyEvent & key)
+Key2KanaConvertor::can_append (const KeyEvent & key,
+                               bool             ignore_space)
 {
     // ignore key release.
     if (key.is_key_release ())
@@ -53,7 +54,8 @@
         return false;
     }
 
-    if (isprint(key.get_ascii_code ()) && !isspace(key.get_ascii_code ()))
+    if (isprint(key.get_ascii_code ()) &&
+        (ignore_space || !isspace(key.get_ascii_code ())))
         return true;
 
     if (util_key_is_keypad (key))
@@ -126,9 +128,7 @@
     bool has_partial_match = false;
     bool retval = false;
 
-    if (m_pseudo_ascii_mode)
-        compute_for_pseudo_ascii_mode(widestr);
-    if (m_is_in_pseudo_ascii_mode) {
+    if (m_pseudo_ascii_mode != 0 && process_pseudo_ascii_mode (widestr)) {
         m_pending += widestr;
         pending = m_pending;
         return false;
@@ -268,19 +268,26 @@
     }
 }
 
-void
-Key2KanaConvertor::compute_for_pseudo_ascii_mode(const WideString & wstr)
+bool
+Key2KanaConvertor::process_pseudo_ascii_mode (const WideString & wstr)
 {
-    for (unsigned int i = 0; !m_is_in_pseudo_ascii_mode && i < wstr.length (); i++) {
-        if (wstr[i] >= 'A' && wstr[i] <= 'Z')
+    for (unsigned int i = 0; i < wstr.length (); i++) {
+        if ((wstr[i] >= 'A' && wstr[i] <= 'Z') ||
+            iswspace(wstr[i])) {
             m_is_in_pseudo_ascii_mode = true;
+        } else if (wstr[i] >= 0x80) {
+            m_is_in_pseudo_ascii_mode = false;
+        }
     }
+
+    return m_is_in_pseudo_ascii_mode;
 }
 
 void
 Key2KanaConvertor::reset_pseudo_ascii_mode (void)
 {
     m_is_in_pseudo_ascii_mode = false;
+    m_pending.clear();
 }
 
 /*
Index: src/scim_anthy_key2kana.h
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_key2kana.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- src/scim_anthy_key2kana.h	25 Apr 2006 07:26:19 -0000	1.8
+++ src/scim_anthy_key2kana.h	13 Jul 2006 07:41:51 -0000	1.9
@@ -41,7 +41,8 @@
                                               Key2KanaTableSet & tables);
     virtual ~Key2KanaConvertor               ();
 
-    bool       can_append                    (const KeyEvent   & key);
+    bool       can_append                    (const KeyEvent   & key,
+                                              bool               ignore_space = false);
     bool       append                        (const KeyEvent   & key,
                                               WideString       & result,
                                               WideString       & pending,
@@ -53,9 +54,11 @@
     WideString flush_pending                 (void);
     void       reset_pending                 (const WideString & result,
                                               const String     & raw);
-    void       use_pseudo_ascii_mode         (bool               flag)
-        { m_pseudo_ascii_mode = flag; }
-    void       compute_for_pseudo_ascii_mode (const WideString & wstr);
+    void       set_pseudo_ascii_mode         (int                mode)
+        { m_pseudo_ascii_mode = mode; }
+    bool       is_pseudo_ascii_mode          (void)
+        { return m_is_in_pseudo_ascii_mode; }
+    bool       process_pseudo_ascii_mode     (const WideString & wstr);
     void       reset_pseudo_ascii_mode       (void);
 
 private:
@@ -70,8 +73,9 @@
     // state
     WideString         m_pending;
     Key2KanaRule       m_exact_match;
-    bool               m_pseudo_ascii_mode;
+    int                m_pseudo_ascii_mode;
     bool               m_is_in_pseudo_ascii_mode;
+    bool               m_reset_pseudo_ascii_mode;
 };
 
 }
Index: src/scim_anthy_key2kana_base.h
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_key2kana_base.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- src/scim_anthy_key2kana_base.h	25 Apr 2006 07:26:19 -0000	1.6
+++ src/scim_anthy_key2kana_base.h	13 Jul 2006 07:41:51 -0000	1.7
@@ -36,11 +36,15 @@
         {};
     virtual ~Key2KanaConvertorBase        () {};
 
-    virtual bool       can_append         (const KeyEvent   & key)       = 0;
+    virtual bool       can_append         (const KeyEvent   & key,
+                                           bool               ignore_space = false) = 0;
     virtual bool       append             (const KeyEvent   & key,
                                            WideString       & result,
                                            WideString       & pending,
                                            String           & raw)       = 0;
+    virtual bool       append             (const String     & raw,
+                                           WideString       & result,
+                                           WideString       & pending)   = 0;
     virtual void       clear              (void)                         = 0;
 
     virtual bool       is_pending         (void)                         = 0;
@@ -51,7 +55,7 @@
 
     virtual void       reset_pseudo_ascii_mode       (void)
         {}
-    virtual void       compute_for_pseudo_ascii_mode (const WideString & wstr)
+    virtual bool       process_pseudo_ascii_mode     (const WideString & wstr)
         {}
 
     virtual void       set_case_sensitive (bool               sensitive)
Index: src/scim_anthy_nicola.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_nicola.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- src/scim_anthy_nicola.cpp	6 Dec 2005 05:43:45 -0000	1.33
+++ src/scim_anthy_nicola.cpp	13 Jul 2006 07:41:51 -0000	1.34
@@ -43,7 +43,8 @@
 }
 
 bool
-NicolaConvertor::can_append (const KeyEvent & key)
+NicolaConvertor::can_append (const KeyEvent & key,
+                             bool             ignore_space)
 {
     if (key == m_through_key_event) {
         m_through_key_event = KeyEvent ();
@@ -84,7 +85,7 @@
     }
 
     if (isprint (key.get_ascii_code ()) &&
-        !isspace (key.get_ascii_code ()))
+        (ignore_space || !isspace (key.get_ascii_code ())))
     {
         return true;
     }
@@ -583,6 +584,17 @@
     return handle_voiced_consonant (result, pending);
 }
 
+bool
+NicolaConvertor::append (const String & str,
+                         WideString   & result,
+                         WideString   & pending)
+{
+    result = utf8_mbstowcs (str);
+    m_pending = WideString ();
+
+    return false;
+}
+
 void
 NicolaConvertor::clear (void)
 {
Index: src/scim_anthy_nicola.h
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_nicola.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- src/scim_anthy_nicola.h	19 Nov 2005 01:22:08 -0000	1.16
+++ src/scim_anthy_nicola.h	13 Jul 2006 07:41:51 -0000	1.17
@@ -48,11 +48,15 @@
                                          Key2KanaTableSet & tables);
     virtual ~NicolaConvertor            ();
 
-    bool       can_append               (const KeyEvent   & key);
+    bool       can_append               (const KeyEvent   & key,
+                                         bool               ignore_space = false);
     bool       append                   (const KeyEvent   & key,
                                          WideString       & result,
                                          WideString       & pending,
                                          String           & raw);
+    bool       append                   (const String     & raw,
+                                         WideString       & result,
+                                         WideString       & pending);
     void       clear                    (void);
 
     bool       is_pending               (void);
Index: src/scim_anthy_preedit.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_preedit.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- src/scim_anthy_preedit.cpp	18 Jun 2006 14:37:52 -0000	1.66
+++ src/scim_anthy_preedit.cpp	13 Jul 2006 07:41:51 -0000	1.67
@@ -191,6 +191,13 @@
     return retval;
 }
 
+bool
+Preedit::append (const KeyEvent & key,
+                 const String   & string)
+{
+    return m_reading.append (key, string);
+}
+
 void
 Preedit::erase (bool backward)
 {
@@ -489,9 +496,21 @@
 }
 
 void
-Preedit::use_pseudo_ascii_mode (bool flag)
+Preedit::set_pseudo_ascii_mode (int mode)
+{
+    m_reading.set_pseudo_ascii_mode (mode);
+}
+
+bool
+Preedit::is_pseudo_ascii_mode (void)
+{
+    return m_reading.is_pseudo_ascii_mode ();
+}
+
+void
+Preedit::reset_pseudo_ascii_mode (void)
 {
-    m_reading.use_pseudo_ascii_mode (flag);
+    m_reading.reset_pseudo_ascii_mode ();
 }
 
 bool
Index: src/scim_anthy_preedit.h
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_preedit.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- src/scim_anthy_preedit.h	26 Jun 2006 06:27:04 -0000	1.45
+++ src/scim_anthy_preedit.h	13 Jul 2006 07:41:51 -0000	1.46
@@ -29,6 +29,9 @@
 #include "scim_anthy_reading.h"
 #include "scim_anthy_conversion.h"
 
+#define SCIM_ANTHY_PSEUDO_ASCII_TRIGGERED_CAPITALIZED			(1 << 0)
+#define SCIM_ANTHY_PSEUDO_ASCII_TRIGGERED_COUPLE_OF_CAPITAL		(1 << 1)
+
 using namespace scim;
 
 class AnthyInstance;
@@ -64,6 +67,8 @@
     virtual bool          can_process_key_event  (const KeyEvent & key);
     // return true if commiting is needed.
     virtual bool          process_key_event      (const KeyEvent & key);
+    virtual bool          append                 (const KeyEvent & key,
+                                                  const String   & string);
     virtual void          erase                  (bool backward = true);
     virtual void          finish                 (void);
 
@@ -121,7 +126,9 @@
     virtual bool          get_symbol_width       (void);
     virtual void          set_number_width       (bool           half);
     virtual bool          get_number_width       (void);
-    virtual void          use_pseudo_ascii_mode  (bool           flag);
+    virtual void          set_pseudo_ascii_mode  (int            mode);
+    virtual bool          is_pseudo_ascii_mode   (void);
+    virtual void          reset_pseudo_ascii_mode(void);
 
 private:
     void                  get_reading_substr     (WideString   & substr,
Index: src/scim_anthy_prefs.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_prefs.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- src/scim_anthy_prefs.cpp	4 Jul 2006 09:19:48 -0000	1.35
+++ src/scim_anthy_prefs.cpp	13 Jul 2006 07:41:51 -0000	1.36
@@ -102,7 +102,16 @@
         SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE_DEFAULT,
         N_("_Entering the pseudo ASCII input mode with capital letters."),
         NULL,
-        N_("If this check is enabled, capital letters will becomes a trigger to enter the pseudo ASCII input mode during capital letters are in preedit."),
+        N_("If this check is enabled, capital letters will becomes a trigger to enter the pseudo ASCII input mode."),
+        false,
+    },
+    {
+        SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_BLANK_BEHAVIOR,
+        SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_BLANK_BEHAVIOR_DEFAULT,
+        SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_BLANK_BEHAVIOR_DEFAULT,
+        N_("Insert a blank with a blank key."),
+        NULL,
+        N_("If this check is enabled, a blank key will works to insert a blank when entering the pseudo ASCII input mode."),
         false,
     },
     {
@@ -557,6 +566,16 @@
         false,
     },
     {
+        SCIM_ANTHY_CONFIG_CANCEL_PSEUDO_ASCII_MODE_KEY,
+        SCIM_ANTHY_CONFIG_CANCEL_PSEUDO_ASCII_MODE_KEY_DEFAULT,
+        SCIM_ANTHY_CONFIG_CANCEL_PSEUDO_ASCII_MODE_KEY_DEFAULT,
+        N_("pseudo ASCII mode cancel key"),
+        N_("Select pseudo ASCII mode cancel key"),
+        N_("The key events to cancel the pseudo ASCII mode."),
+        NULL,
+        false,
+    },
+    {
         SCIM_ANTHY_CONFIG_CIRCLE_TYPING_METHOD_KEY,
         SCIM_ANTHY_CONFIG_CIRCLE_TYPING_METHOD_KEY_DEFAULT,
         SCIM_ANTHY_CONFIG_CIRCLE_TYPING_METHOD_KEY_DEFAULT,
@@ -1242,4 +1261,65 @@
         false,
     },
 };
+
+BoolConfigData *
+find_bool_config_entry (const char *config_key)
+{
+    if (!config_key)
+        return NULL;
+
+    for (unsigned int i = 0; config_bool_common[i].key; i++) {
+        BoolConfigData *entry = &config_bool_common[i];
+        if (entry->key && !strcmp (entry->key, config_key))
+            return entry;
+    }
+
+    return NULL;
+}
+
+IntConfigData *
+find_int_config_entry (const char *config_key)
+{
+    if (!config_key)
+        return NULL;
+
+    for (unsigned int i = 0; config_int_common[i].key; i++) {
+        IntConfigData *entry = &config_int_common[i];
+        if (entry->key && !strcmp (entry->key, config_key))
+            return entry;
+    }
+
+    return NULL;
+}
+
+StringConfigData *
+find_string_config_entry (const char *config_key)
+{
+    if (!config_key)
+        return NULL;
+
+    for (unsigned int i = 0; config_string_common[i].key; i++) {
+        StringConfigData *entry = &config_string_common[i];
+        if (entry->key && !strcmp (entry->key, config_key))
+            return entry;
+    }
+
+    return NULL;
+}
+
+ColorConfigData *
+find_color_config_entry (const char *config_key)
+{
+    if (!config_key)
+        return NULL;
+
+    for (unsigned int i = 0; config_color_common[i].fg_key; i++) {
+        ColorConfigData *entry = &config_color_common[i];
+        if (entry->fg_key && !strcmp (entry->fg_key, config_key))
+            return entry;
+    }
+
+    return NULL;
+}
+
 }
Index: src/scim_anthy_prefs.h
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_prefs.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- src/scim_anthy_prefs.h	4 Jul 2006 09:19:48 -0000	1.71
+++ src/scim_anthy_prefs.h	13 Jul 2006 07:41:51 -0000	1.72
@@ -37,6 +37,7 @@
 #define SCIM_ANTHY_CONFIG_ROMAJI_HALF_NUMBER          "/IMEngine/Anthy/RomajiHalfNumber"
 #define SCIM_ANTHY_CONFIG_ROMAJI_ALLOW_SPLIT          "/IMEngine/Anthy/RomajiAllowSplit"
 #define SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE    "/IMEngine/Anthy/RomajiPseudoAsciiMode"
+#define SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_BLANK_BEHAVIOR    "/IMEngine/Anthy/RomajiPseudoAsciiBlankBehavior"
 
 #define SCIM_ANTHY_CONFIG_KANA_LAYOUT_FILE            "/IMEngine/Anthy/KanaLayoutFile"
 
@@ -82,6 +83,7 @@
 #define SCIM_ANTHY_CONFIG_HIRAGANA_MODE_KEY           "/IMEngine/Anthy/HiraganaModeKey"
 #define SCIM_ANTHY_CONFIG_KATAKANA_MODE_KEY           "/IMEngine/Anthy/KatakanaModeKey"
 #define SCIM_ANTHY_CONFIG_HALF_KATAKANA_MODE_KEY      "/IMEngine/Anthy/HalfKatakanaModeKey"
+#define SCIM_ANTHY_CONFIG_CANCEL_PSEUDO_ASCII_MODE_KEY  "/IMEngine/Anthy/CancelPseudoAsciiModeKey"
 
 #define SCIM_ANTHY_CONFIG_INSERT_SPACE_KEY            "/IMEngine/Anthy/InsertSpaceKey"
 #define SCIM_ANTHY_CONFIG_INSERT_ALT_SPACE_KEY        "/IMEngine/Anthy/InsertAltSpaceKey"
@@ -171,6 +173,7 @@
 #define SCIM_ANTHY_CONFIG_ROMAJI_HALF_NUMBER_DEFAULT          false
 #define SCIM_ANTHY_CONFIG_ROMAJI_ALLOW_SPLIT_DEFAULT          true
 #define SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE_DEFAULT    true
+#define SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_BLANK_BEHAVIOR_DEFAULT    true
 
 #define SCIM_ANTHY_CONFIG_KANA_LAYOUT_FILE_DEFAULT            ""
 
@@ -216,6 +219,7 @@
 #define SCIM_ANTHY_CONFIG_HIRAGANA_MODE_KEY_DEFAULT           ""
 #define SCIM_ANTHY_CONFIG_KATAKANA_MODE_KEY_DEFAULT           ""
 #define SCIM_ANTHY_CONFIG_HALF_KATAKANA_MODE_KEY_DEFAULT      ""
+#define SCIM_ANTHY_CONFIG_CANCEL_PSEUDO_ASCII_MODE_KEY_DEFAULT ""
 
 #define SCIM_ANTHY_CONFIG_INSERT_SPACE_KEY_DEFAULT            "space"
 #define SCIM_ANTHY_CONFIG_INSERT_ALT_SPACE_KEY_DEFAULT        "Shift+space"
@@ -366,6 +370,11 @@
 extern StringConfigData config_keyboards_dict [];
 extern ColorConfigData  config_color_common [];
 
+BoolConfigData   *find_bool_config_entry   (const char *config_key);
+IntConfigData    *find_int_config_entry    (const char *config_key);
+StringConfigData *find_string_config_entry (const char *config_key);
+ColorConfigData  *find_color_config_entry  (const char *config_key);
+
 }
 
 #endif /* SCIM_ANTHY_USE_GTK */
Index: src/scim_anthy_reading.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_reading.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- src/scim_anthy_reading.cpp	25 Apr 2006 07:26:19 -0000	1.37
+++ src/scim_anthy_reading.cpp	13 Jul 2006 07:41:51 -0000	1.38
@@ -330,6 +330,71 @@
     }
 }
 
+bool
+Reading::append (const KeyEvent & key,
+                 const String   & string)
+{
+    bool was_pending;
+    WideString result, pending;
+    bool need_commiting;
+
+    if (!m_kana.can_append (key, true) &&
+        !m_key2kana->can_append (key, true))
+        return false;
+
+    if (m_caret_offset != 0) {
+        split_segment (m_segment_pos);
+        reset_pending ();
+    }
+
+    if (m_kana.can_append (key))
+        was_pending = m_kana.is_pending ();
+    else
+        was_pending = m_key2kana->is_pending ();
+
+    if (m_kana.can_append (key))
+        need_commiting = m_kana.append (string, result, pending);
+    else
+        need_commiting = m_key2kana->append (string, result, pending);
+
+    ReadingSegments::iterator begin = m_segments.begin ();
+
+    // fix previous segment and prepare next segment if needed
+    if (!result.empty () || !pending.empty ()) {
+        if (!was_pending ||  // previous segment was already fixed
+            need_commiting)  // previous segment has been fixed
+        {
+            ReadingSegment c;
+            m_segments.insert (begin + m_segment_pos, c);
+            m_segment_pos++;
+        }
+    }
+
+    // fill segment
+    if (result.length() > 0 && pending.length () > 0) {
+        m_segments[m_segment_pos - 1].kana = result;
+
+        ReadingSegment c;
+        c.raw += string;
+        c.kana = pending;
+        m_segments.insert (begin + m_segment_pos, c);
+        m_segment_pos++;
+
+    } else if (result.length () > 0) {
+        m_segments[m_segment_pos - 1].raw += string;
+        m_segments[m_segment_pos - 1].kana = result;
+
+    } else if (pending.length () > 0) {
+        m_segments[m_segment_pos - 1].raw += string;
+        m_segments[m_segment_pos - 1].kana = pending;
+
+    } else {
+
+    }
+
+    return false;
+}
+
 void
 Reading::erase (unsigned int start, int len, bool allow_split)
 {
@@ -433,7 +498,7 @@
                           m_segments[m_segment_pos - 1].raw);
     m_key2kana->reset_pseudo_ascii_mode();
     for (unsigned int i = 0; i < m_segment_pos; i++)
-        m_key2kana->compute_for_pseudo_ascii_mode(m_segments[i].kana);
+        m_key2kana->process_pseudo_ascii_mode(m_segments[i].kana);
 }
 
 unsigned int
@@ -655,7 +720,28 @@
 }
 
 void
-Reading::use_pseudo_ascii_mode (bool flag)
+Reading::set_pseudo_ascii_mode (int mode)
 {
-    m_key2kana_normal.use_pseudo_ascii_mode (flag);
+    m_key2kana_normal.set_pseudo_ascii_mode (mode);
+}
+
+bool
+Reading::is_pseudo_ascii_mode (void)
+{
+    return m_key2kana_normal.is_pseudo_ascii_mode ();
+}
+
+void
+Reading::reset_pseudo_ascii_mode (void)
+{
+    if (m_key2kana_normal.is_pseudo_ascii_mode () &&
+        m_key2kana_normal.is_pending ()) {
+        ReadingSegment c;
+        ReadingSegments::iterator it = m_segments.begin ();
+
+        /* separate to another segment */
+        m_key2kana_normal.reset_pseudo_ascii_mode ();
+        m_segments.insert (it + m_segment_pos, c);
+        m_segment_pos++;
+    }
 }
Index: src/scim_anthy_reading.h
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_reading.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- src/scim_anthy_reading.h	25 Apr 2006 07:26:19 -0000	1.25
+++ src/scim_anthy_reading.h	13 Jul 2006 07:41:51 -0000	1.26
@@ -80,6 +80,8 @@
                                         = SCIM_ANTHY_STRING_HIRAGANA);
     String       get_raw               (unsigned int     start  = 0,
                                         int              length = -1);
+    bool         append                (const KeyEvent & key,
+                                        const String   & string);
     void         erase                 (unsigned int     start  = 0,
                                         int              length = -1,
                                         bool             allow_split = false);
@@ -104,7 +106,9 @@
     bool         get_symbol_width      (void);
     void         set_number_width      (bool             half);
     bool         get_number_width      (void);
-    void         use_pseudo_ascii_mode (bool             flag);
+    void         set_pseudo_ascii_mode (int              mode);
+    bool         is_pseudo_ascii_mode  (void);
+    void         reset_pseudo_ascii_mode (void);
 
 private:
     void         reset_pending         (void);
Index: src/scim_anthy_setup.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_setup.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- src/scim_anthy_setup.cpp	4 Jul 2006 09:19:48 -0000	1.65
+++ src/scim_anthy_setup.cpp	13 Jul 2006 07:41:51 -0000	1.66
@@ -328,51 +328,6 @@
                                                    gpointer          user_data);
 
 
-static BoolConfigData *
-find_bool_config_entry (const char *config_key)
-{
-    if (!config_key)
-        return NULL;
-
-    for (unsigned int i = 0; config_bool_common[i].key; i++) {
-        BoolConfigData *entry = &config_bool_common[i];
-        if (entry->key && !strcmp (entry->key, config_key))
-            return entry;
-    }
-
-    return NULL;
-}
-
-static IntConfigData *
-find_int_config_entry (const char *config_key)
-{
-    if (!config_key)
-        return NULL;
-
-    for (unsigned int i = 0; config_int_common[i].key; i++) {
-        IntConfigData *entry = &config_int_common[i];
-        if (entry->key && !strcmp (entry->key, config_key))
-            return entry;
-    }
-
-    return NULL;
-}
-
-static StringConfigData *
-find_string_config_entry (const char *config_key)
-{
-    if (!config_key)
-        return NULL;
-
-    for (unsigned int i = 0; config_string_common[i].key; i++) {
-        StringConfigData *entry = &config_string_common[i];
-        if (entry->key && !strcmp (entry->key, config_key))
-            return entry;
-    }
-
-    return NULL;
-}
-
 static StringConfigData *
 find_key_config_entry (const char *config_key)
 {
@@ -387,21 +342,6 @@
     return NULL;
 }
 
-static ColorConfigData *
-find_color_config_entry (const char *config_key)
-{
-    if (!config_key)
-        return NULL;
-
-    for (unsigned int i = 0; config_color_common[i].fg_key; i++) {
-        ColorConfigData *entry = &config_color_common[i];
-        if (entry->fg_key && !strcmp (entry->fg_key, config_key))
-            return entry;
-    }
-
-    return NULL;
-}
-
 GtkWidget *
 create_check_button (const char *config_key)
 {
Index: src/scim_anthy_setup_romaji.cpp
===================================================================
RCS file: /cvsroot/scim-imengine/scim-anthy/src/scim_anthy_setup_romaji.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- src/scim_anthy_setup_romaji.cpp	25 Apr 2006 07:26:19 -0000	1.19
+++ src/scim_anthy_setup_romaji.cpp	13 Jul 2006 07:41:51 -0000	1.20
@@ -60,23 +60,25 @@
 
 static bool     load_romaji_theme                 (void);
 
-static void     on_romaji_theme_menu_changed      (GtkOptionMenu        *omenu,
-                                                   gpointer              user_data);
-static void     on_romaji_customize_button_clicked(GtkWidget            *button,
-                                                   gpointer              data);
-static void     on_table_editor_add_entry         (ScimAnthyTableEditor *editor,
-                                                   gpointer              data);
-static void     on_table_editor_added_entry       (ScimAnthyTableEditor *editor,
-                                                   gpointer              data);
-static void     on_table_editor_remove_entry      (ScimAnthyTableEditor *editor,
-                                                   gpointer              data);
-static void     on_table_editor_removed_entry     (ScimAnthyTableEditor *editor,
-                                                   gpointer              data);
+static void     on_romaji_pseudo_ascii_mode_toggled(GtkToggleButton *togglebutton,
+                                                    gpointer         user_data);
+static void     on_romaji_theme_menu_changed       (GtkOptionMenu        *omenu,
+                                                    gpointer              user_data);
+static void     on_romaji_customize_button_clicked (GtkWidget            *button,
+                                                    gpointer              data);
+static void     on_table_editor_add_entry          (ScimAnthyTableEditor *editor,
+                                                    gpointer              data);
+static void     on_table_editor_added_entry        (ScimAnthyTableEditor *editor,
+                                                    gpointer              data);
+static void     on_table_editor_remove_entry       (ScimAnthyTableEditor *editor,
+                                                    gpointer              data);
+static void     on_table_editor_removed_entry      (ScimAnthyTableEditor *editor,
+                                                    gpointer              data);
 
 GtkWidget *
 romaji_page_create_ui (void)
 {
-    GtkWidget *vbox, *widget;
+    GtkWidget *vbox, *widget, *hbox, *label;
 
     vbox = gtk_vbox_new (FALSE, 0);
     gtk_widget_show (vbox);
@@ -95,15 +97,31 @@
 
     /* pseudo ascii mode */
     widget = create_check_button (SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE);
+    g_signal_connect ((gpointer) widget, "toggled",
+                      G_CALLBACK (on_romaji_pseudo_ascii_mode_toggled),
+                      NULL);
     gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 4);
 
+    /* pseudo ascii: blank behavior */
+    hbox = gtk_hbox_new (FALSE, 0), *label;
+    gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 4);
+    gtk_widget_show (hbox);
+    label = gtk_label_new ("    ");
+    gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+    gtk_widget_show (label);
+
+    widget = create_check_button (SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_BLANK_BEHAVIOR);
+    gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
+    // set initial state
+    on_romaji_pseudo_ascii_mode_toggled (GTK_TOGGLE_BUTTON (widget), NULL);
+
     /* romaji table */
-    GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
+    hbox = gtk_hbox_new (FALSE, 0);
     gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
     gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
     gtk_widget_show(hbox);
 
-    GtkWidget *label = gtk_label_new_with_mnemonic (_("Romaji _table:"));
+    label = gtk_label_new_with_mnemonic (_("Romaji _table:"));
     gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
     gtk_widget_show (label);
 
@@ -407,6 +425,18 @@
 }
 
 static void
+on_romaji_pseudo_ascii_mode_toggled (GtkToggleButton *togglebutton,
+                                     gpointer         user_data)
+{
+    gboolean active = gtk_toggle_button_get_active (togglebutton);
+    BoolConfigData *entry;
+
+    entry = find_bool_config_entry (SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_BLANK_BEHAVIOR);
+    if (entry->widget)
+        gtk_widget_set_sensitive (GTK_WIDGET (entry->widget), active);
+}
+
+static void
 on_romaji_theme_menu_changed (GtkOptionMenu *omenu, gpointer user_data)
 {
     bool success;

scim-anthy-1.0.0-pseudo-ascii.patch:
 scim_anthy_factory.cpp      |    5 +++++
 scim_anthy_factory.h        |    1 +
 scim_anthy_imengine.cpp     |   29 ++++++++++++++++++++++-------
 scim_anthy_key2kana.cpp     |   30 ++++++++++++++++++++++++++++--
 scim_anthy_key2kana.h       |   38 ++++++++++++++++++++++----------------
 scim_anthy_key2kana_base.h  |    5 +++++
 scim_anthy_preedit.cpp      |    6 ++++++
 scim_anthy_preedit.h        |    1 +
 scim_anthy_prefs.cpp        |    9 +++++++++
 scim_anthy_prefs.h          |    2 ++
 scim_anthy_reading.cpp      |    9 +++++++++
 scim_anthy_reading.h        |    1 +
 scim_anthy_setup_romaji.cpp |    4 ++++
 13 files changed, 115 insertions(+), 25 deletions(-)

--- NEW FILE scim-anthy-1.0.0-pseudo-ascii.patch ---
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_factory.cpp scim-anthy-1.0.0/src/scim_anthy_factory.cpp
--- scim-anthy-1.0.0.orig/src/scim_anthy_factory.cpp	2006-02-13 19:18:19.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_factory.cpp	2006-07-06 20:43:34.000000000 +0900
@@ -121,6 +121,7 @@
       m_romaji_half_symbol          (SCIM_ANTHY_CONFIG_ROMAJI_HALF_SYMBOL_DEFAULT),
       m_romaji_half_number          (SCIM_ANTHY_CONFIG_ROMAJI_HALF_NUMBER_DEFAULT),
       m_romaji_allow_split          (SCIM_ANTHY_CONFIG_ROMAJI_ALLOW_SPLIT_DEFAULT),
+      m_romaji_pseudo_ascii_mode    (SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE_DEFAULT),
       m_nicola_time                 (SCIM_ANTHY_CONFIG_NICOLA_TIME_DEFAULT),
       m_dict_admin_command          (SCIM_ANTHY_CONFIG_DICT_ADMIN_COMMAND_DEFAULT),
       m_add_word_command            (SCIM_ANTHY_CONFIG_ADD_WORD_COMMAND_DEFAULT),
@@ -490,6 +491,10 @@
             = config->read (String (SCIM_ANTHY_CONFIG_ROMAJI_ALLOW_SPLIT),
                             SCIM_ANTHY_CONFIG_ROMAJI_ALLOW_SPLIT_DEFAULT);
 
+        m_romaji_pseudo_ascii_mode
+            = config->read (String (SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE),
+                            SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE_DEFAULT);
+
         m_nicola_time
             = config->read (String (SCIM_ANTHY_CONFIG_NICOLA_TIME),
                             SCIM_ANTHY_CONFIG_NICOLA_TIME_DEFAULT);
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_factory.h scim-anthy-1.0.0/src/scim_anthy_factory.h
--- scim-anthy-1.0.0.orig/src/scim_anthy_factory.h	2006-02-13 19:17:02.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_factory.h	2006-07-06 20:43:34.000000000 +0900
@@ -91,6 +91,7 @@
     bool           m_romaji_half_symbol;
     bool           m_romaji_half_number;
     bool           m_romaji_allow_split;
+    bool           m_romaji_pseudo_ascii_mode;
     int            m_nicola_time;
     KeyEventList   m_left_thumb_keys;
     KeyEventList   m_right_thumb_keys;
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_imengine.cpp scim-anthy-1.0.0/src/scim_anthy_imengine.cpp
--- scim-anthy-1.0.0.orig/src/scim_anthy_imengine.cpp	2006-03-29 14:18:59.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_imengine.cpp	2006-07-06 20:43:34.000000000 +0900
@@ -819,11 +819,16 @@
 
     if (method != get_typing_method ()) {
         Key2KanaTable *fundamental_table = NULL;
-        if (method == SCIM_ANTHY_TYPING_METHOD_ROMAJI)
+        bool pseudo_ascii = false;
+
+        if (method == SCIM_ANTHY_TYPING_METHOD_ROMAJI) {
             fundamental_table = m_factory->m_custom_romaji_table;
-        else if (method == SCIM_ANTHY_TYPING_METHOD_KANA)
+            pseudo_ascii = m_factory->m_romaji_pseudo_ascii_mode;
+        } else if (method == SCIM_ANTHY_TYPING_METHOD_KANA) {
             fundamental_table = m_factory->m_custom_kana_table;
+        }
         m_preedit.set_typing_method (method);
+        m_preedit.use_pseudo_ascii_mode (pseudo_ascii);
     }
 }
 
@@ -2173,16 +2178,26 @@
             m_preedit.set_input_mode (SCIM_ANTHY_MODE_WIDE_LATIN);
     }
 
-    // set typing method
+    // set typing method and pseudo ASCII mode
     if (m_on_init || !m_factory->m_show_typing_method_label) {
-        if (m_factory->m_typing_method == "NICOLA")
+        if (m_factory->m_typing_method == "NICOLA") {
             m_preedit.set_typing_method (SCIM_ANTHY_TYPING_METHOD_NICOLA);
-        else if (m_factory->m_typing_method == "Kana")
+            m_preedit.use_pseudo_ascii_mode(false);
+        } else if (m_factory->m_typing_method == "Kana") {
             m_preedit.set_typing_method (SCIM_ANTHY_TYPING_METHOD_KANA);
-        else
+            m_preedit.use_pseudo_ascii_mode(false);
+        } else {
             m_preedit.set_typing_method (SCIM_ANTHY_TYPING_METHOD_ROMAJI);
+            m_preedit.use_pseudo_ascii_mode(m_factory->m_romaji_pseudo_ascii_mode);
+        }
     } else {
-        m_preedit.set_typing_method (m_preedit.get_typing_method ());
+        TypingMethod m = m_preedit.get_typing_method ();
+
+        m_preedit.set_typing_method (m);
+        if (m == SCIM_ANTHY_TYPING_METHOD_ROMAJI)
+            m_preedit.use_pseudo_ascii_mode(m_factory->m_romaji_pseudo_ascii_mode);
+        else
+            m_preedit.use_pseudo_ascii_mode(false);
     }
 
     // set conversion mode
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_key2kana.cpp scim-anthy-1.0.0/src/scim_anthy_key2kana.cpp
--- scim-anthy-1.0.0.orig/src/scim_anthy_key2kana.cpp	2006-02-08 12:14:01.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_key2kana.cpp	2006-07-06 20:43:34.000000000 +0900
@@ -27,10 +27,12 @@
 
 Key2KanaConvertor::Key2KanaConvertor (AnthyInstance    & anthy,
                                       Key2KanaTableSet & tables)
-    : m_anthy          (anthy),
-      m_tables         (tables)
+    : m_anthy                   (anthy),
+      m_tables                  (tables),
+      m_is_in_pseudo_ascii_mode (false)
 {
     set_case_sensitive (false);
+    use_pseudo_ascii_mode (false);
 }
 
 Key2KanaConvertor::~Key2KanaConvertor ()
@@ -124,6 +126,13 @@
     bool has_partial_match = false;
     bool retval = false;
 
+    if (m_pseudo_ascii_mode)
+        compute_for_pseudo_ascii_mode(widestr);
+    if (m_is_in_pseudo_ascii_mode) {
+        m_pending += widestr;
+        pending = m_pending;
+        return false;
+    }
     if (!m_case_sensitive) {
         String half = utf8_wcstombs (matching_str);
         for (unsigned int i = 0; i < half.length (); i++)
@@ -213,6 +222,7 @@
 {
     m_pending.clear ();
     m_exact_match.clear ();
+    reset_pseudo_ascii_mode();
 }
 
 bool
@@ -257,6 +267,22 @@
         append (raw.substr(i, 1), res, pend);
     }
 }
+
+void
+Key2KanaConvertor::compute_for_pseudo_ascii_mode(const WideString & wstr)
+{
+    for (unsigned int i = 0; !m_is_in_pseudo_ascii_mode && i < wstr.length (); i++) {
+        if (wstr[i] >= 'A' && wstr[i] <= 'Z')
+            m_is_in_pseudo_ascii_mode = true;
+    }
+}
+
+void
+Key2KanaConvertor::reset_pseudo_ascii_mode (void)
+{
+    m_is_in_pseudo_ascii_mode = false;
+}
+
 /*
 vi:ts=4:nowrap:ai:expandtab
 */
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_key2kana.h scim-anthy-1.0.0/src/scim_anthy_key2kana.h
--- scim-anthy-1.0.0.orig/src/scim_anthy_key2kana.h	2006-02-08 12:14:01.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_key2kana.h	2006-07-06 20:43:34.000000000 +0900
@@ -37,22 +37,26 @@
 class Key2KanaConvertor : public Key2KanaConvertorBase
 {
 public:
-    Key2KanaConvertor             (AnthyInstance    & anthy,
-                                   Key2KanaTableSet & tables);
-    virtual ~Key2KanaConvertor    ();
-
-    bool       can_append         (const KeyEvent   & key);
-    bool       append             (const KeyEvent   & key,
-                                   WideString       & result,
-                                   WideString       & pending,
-                                   String           & raw);
-    void       clear              (void);
-
-    bool       is_pending         (void);
-    WideString get_pending        (void);
-    WideString flush_pending      (void);
-    void       reset_pending      (const WideString & result,
-                                   const String     & raw);
+    Key2KanaConvertor                        (AnthyInstance    & anthy,
+                                              Key2KanaTableSet & tables);
+    virtual ~Key2KanaConvertor               ();
+
+    bool       can_append                    (const KeyEvent   & key);
+    bool       append                        (const KeyEvent   & key,
+                                              WideString       & result,
+                                              WideString       & pending,
+                                              String           & raw);
+    void       clear                         (void);
+
+    bool       is_pending                    (void);
+    WideString get_pending                   (void);
+    WideString flush_pending                 (void);
+    void       reset_pending                 (const WideString & result,
+                                              const String     & raw);
+    void       use_pseudo_ascii_mode         (bool               flag)
+        { m_pseudo_ascii_mode = flag; }
+    void       compute_for_pseudo_ascii_mode (const WideString & wstr);
+    void       reset_pseudo_ascii_mode       (void);
 
 private:
     bool       append             (const String     & str,
@@ -66,6 +70,8 @@
     // state
     WideString         m_pending;
     Key2KanaRule       m_exact_match;
+    bool               m_pseudo_ascii_mode;
+    bool               m_is_in_pseudo_ascii_mode;
 };
 
 }
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_key2kana_base.h scim-anthy-1.0.0/src/scim_anthy_key2kana_base.h
--- scim-anthy-1.0.0.orig/src/scim_anthy_key2kana_base.h	2006-02-08 12:14:01.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_key2kana_base.h	2006-07-06 20:43:34.000000000 +0900
@@ -49,6 +49,11 @@
     virtual void       reset_pending      (const WideString & result,
                                            const String     & raw)       = 0;
 
+    virtual void       reset_pseudo_ascii_mode       (void)
+        {}
+    virtual void       compute_for_pseudo_ascii_mode (const WideString & wstr)
+        {}
+
     virtual void       set_case_sensitive (bool               sensitive)
         { m_case_sensitive = sensitive; }
     virtual bool       get_case_sensitive (void)
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_preedit.cpp scim-anthy-1.0.0/src/scim_anthy_preedit.cpp
--- scim-anthy-1.0.0.orig/src/scim_anthy_preedit.cpp	2006-02-13 17:00:41.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_preedit.cpp	2006-07-06 20:43:34.000000000 +0900
@@ -476,6 +476,12 @@
     return m_reading.get_number_width ();
 }
 
+void
+Preedit::use_pseudo_ascii_mode (bool flag)
+{
+    m_reading.use_pseudo_ascii_mode (flag);
+}
+
 bool
 Preedit::is_comma_or_period (const String & str)
 {
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_preedit.h scim-anthy-1.0.0/src/scim_anthy_preedit.h
--- scim-anthy-1.0.0.orig/src/scim_anthy_preedit.h	2006-02-13 17:00:42.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_preedit.h	2006-07-06 20:43:34.000000000 +0900
@@ -121,6 +121,7 @@
     virtual bool          get_symbol_width       (void);
     virtual void          set_number_width       (bool           half);
     virtual bool          get_number_width       (void);
+    virtual void          use_pseudo_ascii_mode  (bool           flag);
 
 private:
     void                  get_reading_substr     (WideString   & substr,
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_prefs.cpp scim-anthy-1.0.0/src/scim_anthy_prefs.cpp
--- scim-anthy-1.0.0.orig/src/scim_anthy_prefs.cpp	2006-02-13 19:07:19.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_prefs.cpp	2006-07-06 20:43:49.000000000 +0900
@@ -97,6 +97,15 @@
         false,
     },
     {
+        SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE,
+        SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE_DEFAULT,
+        SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE_DEFAULT,
+        N_("_Entering the pseudo ASCII input mode with capital letters."),
+        NULL,
+        N_("If this check is enabled, capital letters will becomes a trigger to enter the pseudo ASCII input mode during capital letters are in preedit."),
+        false,
+    },
+    {
         SCIM_ANTHY_CONFIG_PREDICT_ON_INPUT,
         SCIM_ANTHY_CONFIG_PREDICT_ON_INPUT_DEFAULT,
         SCIM_ANTHY_CONFIG_PREDICT_ON_INPUT_DEFAULT,
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_prefs.h scim-anthy-1.0.0/src/scim_anthy_prefs.h
--- scim-anthy-1.0.0.orig/src/scim_anthy_prefs.h	2006-02-13 19:03:56.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_prefs.h	2006-07-06 20:43:34.000000000 +0900
@@ -35,6 +35,7 @@
 #define SCIM_ANTHY_CONFIG_ROMAJI_HALF_SYMBOL          "/IMEngine/Anthy/RomajiHalfSymbol"
 #define SCIM_ANTHY_CONFIG_ROMAJI_HALF_NUMBER          "/IMEngine/Anthy/RomajiHalfNumber"
 #define SCIM_ANTHY_CONFIG_ROMAJI_ALLOW_SPLIT          "/IMEngine/Anthy/RomajiAllowSplit"
+#define SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE    "/IMEngine/Anthy/RomajiPseudoAsciiMode"
 
 #define SCIM_ANTHY_CONFIG_KANA_LAYOUT_FILE            "/IMEngine/Anthy/KanaLayoutFile"
 
@@ -167,6 +168,7 @@
 #define SCIM_ANTHY_CONFIG_ROMAJI_HALF_SYMBOL_DEFAULT          false
 #define SCIM_ANTHY_CONFIG_ROMAJI_HALF_NUMBER_DEFAULT          false
 #define SCIM_ANTHY_CONFIG_ROMAJI_ALLOW_SPLIT_DEFAULT          true
+#define SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE_DEFAULT    true
 
 #define SCIM_ANTHY_CONFIG_KANA_LAYOUT_FILE_DEFAULT            ""
 
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_reading.cpp scim-anthy-1.0.0/src/scim_anthy_reading.cpp
--- scim-anthy-1.0.0.orig/src/scim_anthy_reading.cpp	2006-02-13 17:00:42.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_reading.cpp	2006-07-06 20:43:34.000000000 +0900
@@ -431,6 +431,9 @@
                                m_segments[m_segment_pos - 1].raw);
     m_kana.reset_pending (m_segments[m_segment_pos - 1].kana,
                           m_segments[m_segment_pos - 1].raw);
+    m_key2kana->reset_pseudo_ascii_mode();
+    for (unsigned int i = 0; i < m_segment_pos; i++)
+        m_key2kana->compute_for_pseudo_ascii_mode(m_segments[i].kana);
 }
 
 unsigned int
@@ -650,3 +653,9 @@
 {
     return m_key2kana_tables.number_is_half ();
 }
+
+void
+Reading::use_pseudo_ascii_mode (bool flag)
+{
+    m_key2kana_normal.use_pseudo_ascii_mode (flag);
+}
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_reading.h scim-anthy-1.0.0/src/scim_anthy_reading.h
--- scim-anthy-1.0.0.orig/src/scim_anthy_reading.h	2006-02-13 17:00:42.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_reading.h	2006-07-06 20:43:34.000000000 +0900
@@ -104,6 +104,7 @@
     bool         get_symbol_width      (void);
     void         set_number_width      (bool             half);
     bool         get_number_width      (void);
+    void         use_pseudo_ascii_mode (bool             flag);
 
 private:
     void         reset_pending         (void);
diff -ruN scim-anthy-1.0.0.orig/src/scim_anthy_setup_romaji.cpp scim-anthy-1.0.0/src/scim_anthy_setup_romaji.cpp
--- scim-anthy-1.0.0.orig/src/scim_anthy_setup_romaji.cpp	2006-02-08 12:14:01.000000000 +0900
+++ scim-anthy-1.0.0/src/scim_anthy_setup_romaji.cpp	2006-07-06 20:43:34.000000000 +0900
@@ -93,6 +93,10 @@
     widget = create_check_button (SCIM_ANTHY_CONFIG_ROMAJI_HALF_NUMBER);
     gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 4);
 
+    /* pseudo ascii mode */
+    widget = create_check_button (SCIM_ANTHY_CONFIG_ROMAJI_PSEUDO_ASCII_MODE);
+    gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 4);
+
     /* romaji table */
     GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
     gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);


Index: scim-anthy.spec
===================================================================
RCS file: /cvs/dist/rpms/scim-anthy/devel/scim-anthy.spec,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- scim-anthy.spec	13 Jul 2006 00:51:29 -0000	1.31
+++ scim-anthy.spec	14 Jul 2006 12:27:28 -0000	1.32
@@ -2,7 +2,7 @@
 
 Name:           scim-anthy
 Version:        1.0.0
-Release:	3%{?dist}
+Release:	4%{?dist}
 
 License:        GPL
 URL:            http://scim-imengine.sourceforge.jp/
@@ -14,6 +14,8 @@
 Buildrequires: libstdc++so7-devel
 %endif
 Patch1:		scim-anthy-helper-moduledir.patch
+Patch2:		scim-anthy-1.0.0-pseudo-ascii.patch
+Patch3:		scim-anthy-1.0.0-pseudo-ascii-insert-space.patch
 
 Summary:        SCIM IMEngine for anthy for Japanese input
 Group:          System Environment/Libraries
@@ -26,6 +28,8 @@
 %prep
 %setup -q
 %patch1 -p1 -b .1-moduledir
+%patch2 -p1 -b .2-pseudo-ascii
+%patch3 -p0 -b .3-insert-space
 # patch1 touches src/Makefile.am
 aclocal
 automake
@@ -70,6 +74,11 @@
 
 
 %changelog
+* Fri Jul 14 2006 Akira TAGOH <tagohr at edhat.com> - 1.0.0-4
+- scim-anthy-1.0.0-pseudo-ascii.patch,
+  scim-anthy-1.0.0-pseudo-ascii-insert-space.patch: applied to allow the ASCII
+  characters with the capital letter without even turning off the IME. (#187721)
+
 * Wed Jul 12 2006 Jesse Keating <jkeating at redhat.com> - 1.0.0-3
 - rebuild
 - Add missing br automake




More information about the fedora-cvs-commits mailing list