fix preedit switchkey not work
authorMr.LeQuocTuan <Mr.LeQuocTuan@79bd180b-0a32-48ee-ac55-ada8cae9df61>
Thu, 18 Jun 2009 17:28:40 +0000 (17:28 +0000)
committerMr.LeQuocTuan <Mr.LeQuocTuan@79bd180b-0a32-48ee-ac55-ada8cae9df61>
Thu, 18 Jun 2009 17:28:40 +0000 (17:28 +0000)
git-svn-id: svn://localhost/trunk@9 79bd180b-0a32-48ee-ac55-ada8cae9df61

src/scim_unikey_const.h
src/scim_unikey_imengine.cpp
src/scim_unikey_imengine.h
src/scim_unikey_setup.cpp
src/scim_unikey_utils.cpp
src/scim_unikey_utils.h

index 832cc6f..468a7d0 100644 (file)
@@ -1,6 +1,5 @@
 /**
    Scim-Unikey Input Method
-   Version: 0.2.0a
 
    Copyright (C) 2008-2009 Ubuntu-VN <http://www.ubuntu-vn.org>
    Author: Le Quoc Tuan <mr.lequoctuan@gmail.com>
index d15d2ff..9eab534 100644 (file)
@@ -1,6 +1,5 @@
 /**
    Scim-Unikey Input Method
-   Version: 0.2.0
 
    Copyright (C) 2008-2009 Ubuntu-VN <http://www.ubuntu-vn.org>
    Author: Le Quoc Tuan <mr.lequoctuan@gmail.com>
@@ -228,6 +227,8 @@ UnikeyInstance::UnikeyInstance(UnikeyFactory *factory, const String &encoding, i
     {
         UnikeyLoadMacroTable(getMacroFile());
     }
+
+    reset();
 }
 
 UnikeyInstance::~UnikeyInstance()
@@ -236,8 +237,6 @@ UnikeyInstance::~UnikeyInstance()
 
 void UnikeyInstance::focus_in()
 {
-    reset();
-
     register_properties(CreatePropertyList());
 
     UnikeySetInputMethod(Unikey_IM[m_im]);
@@ -296,11 +295,13 @@ void UnikeyInstance::Unikey_update_preedit_string(const WideString s, const bool
     AttributeList list;
     Attribute att;
 
+    // underline preedit string
     att = Attribute(0, s.length(), SCIM_ATTR_DECORATE, SCIM_ATTR_DECORATE_UNDERLINE);
     list.push_back(att);
 
     if (m_ukopt.spellCheckEnabled==1 && UnikeyLastWordIsNonVn())
     {
+        // red preedit string
         att = Attribute(0, s.length(), SCIM_ATTR_FOREGROUND, 0xff0000);
         list.push_back(att);
     }
@@ -322,7 +323,8 @@ bool UnikeyInstance::process_key_event(const KeyEvent& key)
 {
     bool tmp;
 
-    for (int i; i<m_preeditskey.size(); i++)
+    for (int i = 0; i<m_preeditskey.size(); i++)
+    {
         if (key==m_preeditskey.at(i))
         {
             reset();
@@ -330,11 +332,11 @@ bool UnikeyInstance::process_key_event(const KeyEvent& key)
             register_properties(CreatePropertyList());
             return true;
         }
+    }
 
     tmp = m_preedit?Unikey_process_key_event_preedit(key)
         :Unikey_process_key_event_direct(key);
 
-
     if ((key.code >= SCIM_KEY_space && key.code <= SCIM_KEY_asciitilde)
         || (key.code >= SCIM_KEY_KP_Multiply && key.code <= SCIM_KEY_KP_9))
     {
@@ -352,7 +354,9 @@ bool UnikeyInstance::process_key_event(const KeyEvent& key)
 bool UnikeyInstance::Unikey_process_key_event_direct(const KeyEvent& key)
 {
     if (key.is_key_release())
+    {
         return false;
+    }
 
     if (key.is_control_down() || key.mask & SCIM_KEY_AltMask)
     {
@@ -361,7 +365,9 @@ bool UnikeyInstance::Unikey_process_key_event_direct(const KeyEvent& key)
     }
 
     if (key.code >= SCIM_KEY_Shift_L && key.code <= SCIM_KEY_Hyper_R)
+    {
         return false;
+    }
 
     if (key.code == SCIM_KEY_BackSpace)
     {
index 2c191cd..505eb33 100644 (file)
@@ -1,6 +1,5 @@
 /**
    Scim-Unikey Input Method
-   Version: 0.2.0a
 
    Copyright (C) 2008-2009 Ubuntu-VN <http://www.ubuntu-vn.org>
    Author: Le Quoc Tuan <mr.lequoctuan@gmail.com>
index ace4b89..d2ebe4b 100644 (file)
@@ -1,6 +1,5 @@
 /**
    Scim-Unikey Input Method
-   Version: 0.2.0
 
    Copyright (C) 2008-2009 Ubuntu-VN <http://www.ubuntu-vn.org>
    Author: Le Quoc Tuan <mr.lequoctuan@gmail.com>
index f1cde6b..44fd0af 100644 (file)
@@ -1,6 +1,5 @@
 /**
    Scim-Unikey Input Method
-   Version: 0.2.0a
 
    Copyright (C) 2008-2009 Ubuntu-VN <http://www.ubuntu-vn.org>
    Author: Le Quoc Tuan <mr.lequoctuan@gmail.com>
index cd1a05b..79cf010 100644 (file)
@@ -1,6 +1,5 @@
 /**
    Scim-Unikey Input Method
-   Version: 0.2.0a
 
    Copyright (C) 2008-2009 Ubuntu-VN <http://www.ubuntu-vn.org>
    Author: Le Quoc Tuan <mr.lequoctuan@gmail.com>