Update CM key button 26/41826/1
authorHaifeng Deng <haifeng.deng@samsung.com>
Thu, 7 May 2015 07:50:28 +0000 (15:50 +0800)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 18 Jun 2015 05:28:02 +0000 (14:28 +0900)
Change-Id: I92ba762cda730f6e4a0c0296dffc72226ce2f68d
Signed-off-by: Haifeng Deng <haifeng.deng@samsung.com>
data/layout/sdk/LYT_LANDSCAPE_QTY_ENGLISH.xml
data/layout/sdk/LYT_LANDSCAPE_QTY_SYM_1.xml
data/layout/sdk/LYT_LANDSCAPE_QTY_SYM_2.xml
data/layout/sdk/LYT_PORTRAIT_QTY_ENGLISH.xml
data/layout/sdk/LYT_PORTRAIT_QTY_SYM_1.xml
data/layout/sdk/LYT_PORTRAIT_QTY_SYM_2.xml
src/ise.cpp [changed mode: 0644->0755]

index 65bfd53..25383a1 100755 (executable)
         <rec>SYM_QTY_1</rec>
       </key_value>
     </key>
-    <key key_type="user" width="81" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key key_type="modechange" width="81" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>SYM_QTY_1</rec>
       </key_value>
     </key>
-    <key key_type="user" width="81" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key key_type="modechange" width="81" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>SYM_QTY_1</rec>
       </key_value>
     </key>
-    <key key_type="user" width="81" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key key_type="modechange" width="81" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
index 67f23ee..c7d5b23 100755 (executable)
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key key_type="user" width="81" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key key_type="modechange" width="81" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key key_type="user" width="81" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key key_type="modechange" width="81" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key key_type="user" width="81" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key key_type="modechange" width="81" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
index 0f0f7e8..e585f0f 100755 (executable)
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key key_type="user" width="81" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key key_type="modechange" width="81" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key key_type="user" width="81" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key key_type="modechange" width="81" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key key_type="user" width="81" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key key_type="modechange" width="81" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
index 2907d02..cb97517 100755 (executable)
         <rec>SYM_QTY_1</rec>
       </key_value>
     </key>
-    <key button_type="selfish" key_type="user" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key button_type="selfish" key_type="modechange" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>SYM_QTY_1</rec>
       </key_value>
     </key>
-    <key button_type="selfish" key_type="user" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key button_type="selfish" key_type="modechange" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>SYM_QTY_1</rec>
       </key_value>
     </key>
-    <key button_type="selfish" key_type="user" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key button_type="selfish" key_type="modechange" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
index e8ee826..82a6e0b 100755 (executable)
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key button_type="selfish" key_type="user" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key button_type="selfish" key_type="modechange" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key button_type="selfish" key_type="user" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key button_type="selfish" key_type="modechange" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key button_type="selfish" key_type="user" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key button_type="selfish" key_type="modechange" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
index ee6d866..8f28a4a 100755 (executable)
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key button_type="selfish" key_type="user" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key button_type="selfish" key_type="modechange" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key button_type="selfish" key_type="user" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key button_type="selfish" key_type="modechange" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
         <rec>CUR_LANG</rec>
       </key_value>
     </key>
-    <key button_type="selfish" key_type="user" use_magnifier="false" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
+    <key button_type="selfish" key_type="modechange" use_magnifier="false" custom_id="CM_KEY" label_type="SETTING_CUE" popup_type="longpress_popup_once" popup_offset_x="0" popup_offset_y="-90">
       <label>
         <rec>...</rec>
       </label>
old mode 100644 (file)
new mode 100755 (executable)
index 9acf7d3..66740d7
@@ -69,7 +69,7 @@ static void update_recent_used_punctuation(const char *key_value);
 static sclboolean g_punctuation_popup_opened = FALSE;
 static sclboolean g_popup_opened = FALSE;
 static vector<string> g_recent_used_punctuation;
-const int MAX_DEFAULT_PUNCTUATION = 6;
+static const int MAX_DEFAULT_PUNCTUATION = 6;
 static string g_default_punctuation[MAX_DEFAULT_PUNCTUATION] = {"-", "@", "'", "!", "?", ","};
 static string g_current_punctuation[MAX_DEFAULT_PUNCTUATION-1] = {"RCENT1", "RCENT2", "RCENT3", "RCENT4", "RCENT5"};
 
@@ -84,9 +84,9 @@ KEYBOARD_STATE g_keyboard_state = {
 };
 
 #define ISE_LAYOUT_NUMBERONLY_VARIATION_MAX 4
-const sclchar *g_ise_numberonly_variation_name[ISE_LAYOUT_NUMBERONLY_VARIATION_MAX] = {
+/*static const sclchar *_ise_numberonly_variation_name[ISE_LAYOUT_NUMBERONLY_VARIATION_MAX] = {
     "DEFAULT", "SIG", "DEC", "SIGDEC"
-};
+};*/
 
 #define SIG_DEC_SIZE        2
 static scluint              _click_count = 0;
@@ -128,7 +128,13 @@ static ISELanguageManager _language_manager;
 #define MVK_Shift_Enable 0x9fe7
 #define MVK_Shift_Disable 0x9fe8
 
-#define USER_KEYSTRING_OPTION "OPTION"
+#define CM_KEY_LIST_SIZE        2
+#define USER_KEYSTRING_OPTION   "OPTION"
+#define USER_KEYSTRING_EMOTICON "EMOTICON_LAYOUT"
+
+static sclboolean           _cm_popup_opened = FALSE;
+static const char          *_cm_key_list [CM_KEY_LIST_SIZE] = {USER_KEYSTRING_OPTION, USER_KEYSTRING_EMOTICON};
+static scluint              _current_cm_key_id = 0;
 
 /*
  * This callback class will receive all response events from SCL
@@ -167,6 +173,37 @@ static void _reset_shift_state (void)
     }
 }
 
+static void ise_set_cm_private_key (scluint cm_key_id)
+{
+    if (cm_key_id >= CM_KEY_LIST_SIZE || g_ui == NULL) {
+        LOGE ("cm_key_id=%d", cm_key_id);
+        return;
+    }
+
+    if (strcmp (_cm_key_list[cm_key_id], USER_KEYSTRING_EMOTICON) == 0) {
+        sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
+            const_cast<sclchar*>("emoticon/icon_emotion.png"),
+            const_cast<sclchar*>("emoticon/icon_emotion_press.png"),
+            const_cast<sclchar*>("emoticon/icon_emotion_dim.png")};
+        g_ui->set_private_key("CM_KEY", "", imagelabel, NULL, 0, USER_KEYSTRING_EMOTICON, TRUE);
+    } else if (strcmp (_cm_key_list[cm_key_id], USER_KEYSTRING_OPTION) == 0) {
+        sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
+            const_cast<sclchar*>("setting icon/B09_icon_setting_50x50.png"),
+            const_cast<sclchar*>("setting icon/B09_icon_setting_50x50_press.png"),
+            const_cast<sclchar*>("setting icon/B09_icon_setting_50x50_dim.png")};
+        g_ui->set_private_key("CM_KEY", "", imagelabel, NULL, 0, USER_KEYSTRING_OPTION, TRUE);
+    }
+}
+
+static scluint ise_get_cm_key_id (const sclchar *key_value)
+{
+    for (int i = 0; i < CM_KEY_LIST_SIZE; ++i) {
+        if (0 == strcmp (key_value, _cm_key_list[i]))
+            return i;
+    }
+    return 0;
+}
+
 void CCoreEventCallback::on_init()
 {
     LOGD("CCoreEventCallback::init()\n");
@@ -466,7 +503,7 @@ on_input_mode_changed(const sclchar *key_value, sclulong key_event, sclint key_t
         if(is_emoticon_show()){
             ise_destroy_emoticon_window();
         }
-        if(!strcmp(key_value, "EMOTICON_LAYOUT")){
+        if(!strcmp(key_value, USER_KEYSTRING_EMOTICON)){
             ise_init_emoticon_list();
             if(emoticon_list_recent.size() == 0)
                 current_emoticon_group = EMOTICON_GROUP_1;
@@ -525,8 +562,10 @@ SCLEventReturnType CUIEventCallback::on_event_notification(SCLUINotiType noti_ty
     {
         g_popup_opened = TRUE;
         SclNotiPopupOpenedDesc *openedDesc = (SclNotiPopupOpenedDesc *)etc_info;
-        if(0 == strcmp(openedDesc->input_mode, "PUNCTUATION_POPUP")){
+        if (0 == strcmp (openedDesc->input_mode, "PUNCTUATION_POPUP")) {
             g_punctuation_popup_opened = TRUE;
+        } else if (0 == strcmp (openedDesc->input_mode, "CM_POPUP")) {
+            _cm_popup_opened = TRUE;
         }
     }
 
@@ -622,8 +661,21 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
                 break;
            }
         case KEY_TYPE_MODECHANGE:
-            if (on_input_mode_changed(event_desc.key_value, event_desc.key_event, event_desc.key_type)) {
+            if (strcmp (event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
+                g_core.create_option_window ();
                 ret = SCL_EVENT_DONE;
+            } else if (on_input_mode_changed (event_desc.key_value, event_desc.key_event, event_desc.key_type)) {
+                ret = SCL_EVENT_DONE;
+            }
+            if (_cm_popup_opened) {
+                if (strcmp (event_desc.key_value, USER_KEYSTRING_EMOTICON) == 0) {
+                    sclint id = ise_get_cm_key_id (USER_KEYSTRING_EMOTICON);
+                    if (id != _current_cm_key_id) {
+                        _current_cm_key_id = id;
+                        ise_set_cm_private_key (_current_cm_key_id);
+                    }
+                }
+                _cm_popup_opened = FALSE;
             }
             break;
         case KEY_TYPE_USER:
@@ -648,6 +700,16 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
                     }
                 }
             }
+            if (_cm_popup_opened) {
+                if (strcmp (event_desc.key_value, USER_KEYSTRING_OPTION) == 0) {
+                    sclint id = ise_get_cm_key_id (USER_KEYSTRING_OPTION);
+                    if (id != _current_cm_key_id) {
+                        _current_cm_key_id = id;
+                        ise_set_cm_private_key (_current_cm_key_id);
+                    }
+                }
+                _cm_popup_opened = FALSE;
+            }
             break;
         default:
             break;