2 * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #include <Elementary.h>
24 #include <app_preference.h>
26 #include <sclfeedback.h>
28 #include "ise-emoticon-mode.h"
29 #include "ise-emoticon-list.h"
32 #include "candidate-factory.h"
35 #define LOG_TAG "ISE_DEFAULT"
38 #define EVAS_CANDIDATE_LAYER 32000
41 #define ISE_HEIGHT_PORT 398
42 #define ISE_HEIGHT_LAND 398
44 #define ISE_HEIGHT_PORT 240
45 #define ISE_HEIGHT_LAND 240
47 #define ISE_HEIGHT_PORT 442
48 #define ISE_HEIGHT_LAND 318
51 #define EMOTICON_DIR LAYOUTDIR"/emoticons/"
52 #define EMOTICON_EDJ_FILE_PATH RESDIR"/edje/layout_keypad.edj"
53 #define CUSTOM_GENGRID_EDJ_FILE_PATH RESDIR"/edje/customised_gengrid.edj"
55 #define EMOTICON_EDJ_GROUP_PORT_CANDIDATE_ON "emoticon.main.portrait.candidate.on"
56 #define EMOTICON_EDJ_GROUP_LAND_CANDIDATE_ON "emoticon.main.landscape.candidate.on"
58 #define EMOTICON_EDJ_GROUP_PORT_CANDIDATE_OFF "emoticon.main.portrait.candidate.off"
59 #define EMOTICON_EDJ_GROUP_LAND_CANDIDATE_OFF "emoticon.main.landscape.candidate.off"
61 #define EMOTICON_GENGRID_ITEM_STYLE_PORT "ise/customized_default_style_port"
62 #define EMOTICON_GENGRID_ITEM_STYLE_LAND "ise/customized_default_style_land"
64 #define EMOTICON_GENGRID_ITEM_STYLE_PORT2 "ise/customized_default_style_port2"
65 #define EMOTICON_GENGRID_ITEM_STYLE_LAND2 "ise/customized_default_style_land2"
67 #define EMOTICON_GENGRID_ITEM_STYLE_WEARABLE "ise/customized_default_style_wearable"
72 #define EMOTICON_ICON_WIDTH_PORT 40
73 #define EMOTICON_ICON_HEIGHT_PORT 40
75 #define EMOTICON_ICON_GAP_WIDTH_PORT 24
76 #define EMOTICON_ICON_GAP_HEIGHT_PORT 3
78 #define EMOTICON_ICON_WIDTH_PORT 27
79 #define EMOTICON_ICON_HEIGHT_PORT 27
81 #define EMOTICON_ICON_GAP_WIDTH_PORT 10
82 #define EMOTICON_ICON_GAP_HEIGHT_PORT 2
85 #define EMOTICON_WIDTH_PORT (EMOTICON_ICON_WIDTH_PORT + EMOTICON_ICON_GAP_WIDTH_PORT)
86 #define EMOTICON_HEIGHT_PORT (EMOTICON_ICON_HEIGHT_PORT + EMOTICON_ICON_GAP_HEIGHT_PORT)
88 #define EMOTICON_ICON_WIDTH_LAND 27
89 #define EMOTICON_ICON_HEIGHT_LAND 27
92 #define EMOTICON_ICON_GAP_WIDTH_LAND 16
93 #define EMOTICON_ICON_GAP_HEIGHT_LAND 16
95 #define EMOTICON_ICON_GAP_WIDTH_LAND 4
96 #define EMOTICON_ICON_GAP_HEIGHT_LAND 0
99 #define EMOTICON_LAYOUT_LEFT_MARGIN 88
101 #define EMOTICON_WIDTH_LAND (EMOTICON_ICON_WIDTH_LAND + EMOTICON_ICON_GAP_WIDTH_LAND)
102 #define EMOTICON_HEIGHT_LAND (EMOTICON_ICON_HEIGHT_LAND + EMOTICON_ICON_GAP_HEIGHT_LAND)
104 #define MIN_RECENT_EMOTICON_NEEDED_IN_PORT 22 // (7*3 + 1)
105 #define MIN_RECENT_EMOTICON_NEEDED_IN_LAND 27 // (13*2 + 1)
107 #define MAX_SIZE_AMONG_FIRST_3_EMOTICON_GROUPS (EMOTICON_GROUP_1_NUM > EMOTICON_GROUP_2_NUM ? (EMOTICON_GROUP_1_NUM > EMOTICON_GROUP_3_NUM ? EMOTICON_GROUP_1_NUM : EMOTICON_GROUP_3_NUM) : (EMOTICON_GROUP_2_NUM > EMOTICON_GROUP_3_NUM ? EMOTICON_GROUP_2_NUM : EMOTICON_GROUP_3_NUM))
108 #define MAX_SIZE_AMONG_EMOTICON_GROUPS (EMOTICON_GROUP_4_NUM > EMOTICON_GROUP_5_NUM ? (EMOTICON_GROUP_4_NUM > MAX_SIZE_AMONG_FIRST_3_EMOTICON_GROUPS ? EMOTICON_GROUP_4_NUM : MAX_SIZE_AMONG_FIRST_3_EMOTICON_GROUPS) : (EMOTICON_GROUP_5_NUM > MAX_SIZE_AMONG_FIRST_3_EMOTICON_GROUPS ? EMOTICON_GROUP_5_NUM : MAX_SIZE_AMONG_FIRST_3_EMOTICON_GROUPS))
110 static bool is_emoticon_mode = false;
111 static emoticon_group_t current_emoticon_group = EMOTICON_GROUP_RECENTLY_USED;
112 static std::vector <int> emoticon_list_recent;
114 size_t ise_emoticon_get_recent_list_size()
116 return emoticon_list_recent.size();
119 emoticon_group_t ise_emoticon_get_current_group()
121 return current_emoticon_group;
124 void ise_emoticon_set_current_group(emoticon_group_t emoticon_group)
126 current_emoticon_group = emoticon_group;
130 static unsigned short int emoticon_group_items[MAX_EMOTICON_GROUP] =
132 EMOTICON_GROUP_RECENTLY_USED_NUM,
133 EMOTICON_GROUP_1_NUM,
134 EMOTICON_GROUP_2_NUM,
138 static unsigned short int emoticon_group_items[MAX_EMOTICON_GROUP] =
140 EMOTICON_GROUP_RECENTLY_USED_NUM,
141 EMOTICON_GROUP_1_NUM,
142 EMOTICON_GROUP_2_NUM,
143 EMOTICON_GROUP_3_NUM,
144 EMOTICON_GROUP_4_NUM,
148 const char *emoticon_group_icons_press[MAX_EMOTICON_GROUP] =
150 "emotion/icon_recent_press.png",
151 "emotion/icon_emotion_press.png",
152 "emotion/icon_crown_press.png",
153 "emotion/icon_dog_press.png",
154 "emotion/icon_house_press.png",
155 "emotion/icon_star_press.png"
159 struct emoticon_item_t
161 Elm_Object_Item *item;
164 Eina_Unicode keyevent;
167 static emoticon_item_t emoticon_items[MAX_SIZE_AMONG_EMOTICON_GROUPS] = {{0, }, };
169 // Static variable declarations
170 static Evas_Object *layout = NULL;
171 static Evas_Object *gengrid = NULL;
172 static Elm_Theme *theme = NULL;
173 static Elm_Gengrid_Item_Class *gic = NULL;
175 // Static Function declarations
176 static void __ise_emoticon_create_gengrid(unsigned short int screen_degree);
177 static void __ise_emoticon_append_items_to_gengrid(emoticon_group_t emoticon_group);
178 static void __ise_emoticon_create_item_class(unsigned short int screen_degree);
179 static char * grid_text_get(void *data, Evas_Object *obj, const char *part);
180 static void _item_selected(void *data, Evas_Object *obj, void *event_info);
181 static Eina_Bool _focus_done(void *data);
182 static void _multi_down(void *data, Evas *e, Evas_Object *o, void *event_info);
183 static void _multi_up(void *data, Evas *e, Evas_Object *o, void *event_info);
185 void ise_read_recent_emoticon_list_from_scim(void)
188 std::string string_value;
189 read_ise_config_string(ISE_CONFIG_RECENT_EMOTICONS_LIST, string_value);
191 if (string_value.length() > 0) {
192 LOGD("read recent emoticon:%s\n", string_value.c_str());
193 std::stringstream ss(string_value);
194 std::istream_iterator<std::string> begin(ss);
195 std::istream_iterator<std::string> end;
196 std::vector<std::string> vstrings(begin, end);
198 emoticon_list_recent.clear();
199 std::vector<std::string>::iterator it;
200 for (it = vstrings.begin(); it != vstrings.end(); it++) {
201 emoticon_list_recent.push_back(atoi((*it).c_str()));
206 void ise_write_recent_emoticon_list_to_scim(void)
208 std::string string_value;
209 for (std::vector<int>::iterator it = emoticon_list_recent.begin();
210 it != emoticon_list_recent.end(); std::advance(it, 1)) {
212 snprintf (buf, sizeof(buf), "%d", *it);
213 string_value += std::string(buf);
216 if (string_value.length() > 0) {
217 preference_set_string(ISE_CONFIG_RECENT_EMOTICONS_LIST, string_value.c_str());
218 LOGD("write recent emoticon:%s\n", string_value.c_str());
222 void ise_emoticon_show_layout(emoticon_group_t emoticon_group, const int screen_degree, const bool is_candidate_on, void *main_window)
224 CSCLUI *ui = get_ui();
227 CONFIG_VALUES *config_values = get_config_values();
228 if (!config_values) return;
233 ise_emoticon_init_list();
234 ise_emoticon_set_private_key_for_emoticon_mode(emoticon_group);
236 if (emoticon_group == EMOTICON_GROUP_RECENTLY_USED) {
237 //ise_read_recent_emoticon_list_from_scim();
238 if (emoticon_list_recent.empty()) {
239 //PRINTFUNC(DLOG_ERROR,"Cannot display recently used emoticons group. No recently used emoticons available");
244 ise_emoticon_destroy_layout();
246 layout = elm_layout_add((Evas_Object *)main_window);
247 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
248 evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
251 Candidate *candidate = get_candidate();
252 if (candidate && candidate->get_visible())
253 y = candidate->get_height();
255 read_ise_config_values();
256 if (config_values->floating_mode)
257 evas_object_move(layout, 0, y + FLOATING_TITLE_BAR_HEIGHT);
259 evas_object_move(layout, 0, y);
261 bool landscape_device = get_landscape_device(screen_degree);
263 if (is_candidate_on) {
264 if (screen_degree == 0 || screen_degree == 180) {
265 elm_layout_file_set(layout, EMOTICON_EDJ_FILE_PATH,
267 EMOTICON_EDJ_GROUP_LAND_CANDIDATE_ON :
268 EMOTICON_EDJ_GROUP_PORT_CANDIDATE_ON);
271 elm_layout_file_set(layout, EMOTICON_EDJ_FILE_PATH,
273 EMOTICON_EDJ_GROUP_PORT_CANDIDATE_ON :
274 EMOTICON_EDJ_GROUP_LAND_CANDIDATE_ON);
279 ui->get_screen_resolution(&width, &height);
280 LOGD("screen width:%d, height:%d\n", width, height);
281 if (screen_degree == 0 || screen_degree == 180) {
282 elm_layout_file_set(layout, EMOTICON_EDJ_FILE_PATH,
284 EMOTICON_EDJ_GROUP_LAND_CANDIDATE_OFF :
285 EMOTICON_EDJ_GROUP_PORT_CANDIDATE_OFF);
287 if (config_values->floating_mode)
288 evas_object_resize(layout, width * FLOATING_SCALE_RATE, ui->get_scaled_y(ISE_HEIGHT_PORT) - ELM_SCALE_SIZE(EMOTICON_HEIGHT_PORT));
290 evas_object_resize(layout, width, ui->get_scaled_y(landscape_device ? ISE_HEIGHT_LAND : ISE_HEIGHT_PORT));
292 elm_layout_file_set(layout, EMOTICON_EDJ_FILE_PATH,
294 EMOTICON_EDJ_GROUP_PORT_CANDIDATE_OFF :
295 EMOTICON_EDJ_GROUP_LAND_CANDIDATE_OFF);
297 if (config_values->floating_mode)
298 evas_object_resize(layout, width * FLOATING_SCALE_RATE, ui->get_scaled_y(ISE_HEIGHT_LAND) * FLOATING_SCALE_RATE);
300 evas_object_resize(layout, width, ui->get_scaled_y(landscape_device ? ISE_HEIGHT_PORT : ISE_HEIGHT_LAND));
304 if (config_values->floating_mode) {
305 evas_object_resize(layout, 260 * FLOATING_SCALE_RATE, 240 * FLOATING_SCALE_RATE);
306 evas_object_move(layout, 10, y + FLOATING_TITLE_BAR_HEIGHT);
308 evas_object_resize(layout, 260, 240);
309 evas_object_move(layout, 10, y);
312 if (screen_degree == 0 || screen_degree == 180) {
313 if (landscape_device) {
314 evas_object_resize(layout, width - ui->get_scaled_y(EMOTICON_LAYOUT_LEFT_MARGIN*2), ui->get_scaled_y(ISE_HEIGHT_LAND));
315 evas_object_move(layout, ui->get_scaled_y(EMOTICON_LAYOUT_LEFT_MARGIN), y);
318 if (config_values->floating_mode) {
319 evas_object_resize(layout, (width - ui->get_scaled_y(EMOTICON_LAYOUT_LEFT_MARGIN*2)) * FLOATING_SCALE_RATE, (ui->get_scaled_y(ISE_HEIGHT_LAND)) * FLOATING_SCALE_RATE);
320 evas_object_move(layout, ui->get_scaled_y(EMOTICON_LAYOUT_LEFT_MARGIN), y + FLOATING_TITLE_BAR_HEIGHT);
322 evas_object_resize(layout, width - ui->get_scaled_y(EMOTICON_LAYOUT_LEFT_MARGIN*2), ui->get_scaled_y(landscape_device ? ISE_HEIGHT_PORT : ISE_HEIGHT_LAND));
323 evas_object_move(layout, ui->get_scaled_y(EMOTICON_LAYOUT_LEFT_MARGIN), y);
329 theme = elm_theme_new();
330 elm_theme_ref_set(theme, NULL); // refer to default theme
331 elm_theme_extension_add(theme, CUSTOM_GENGRID_EDJ_FILE_PATH);
333 __ise_emoticon_create_gengrid((unsigned short)screen_degree);
334 __ise_emoticon_create_item_class((unsigned short)screen_degree);
335 __ise_emoticon_append_items_to_gengrid(emoticon_group);
337 elm_object_part_content_set(layout, "emoticon.swallow.gengrid", gengrid);
338 //elm_win_resize_object_add(main_window, layout);
340 evas_object_show(gengrid);
341 evas_object_layer_set(layout, EVAS_CANDIDATE_LAYER-1);
342 evas_object_show(layout);
344 is_emoticon_mode = true;
345 current_emoticon_group = emoticon_group;
348 void ise_emoticon_destroy_layout(void)
350 /* According to UI FW team, when the a parent is deleted, all its child content will
351 * also be deleted. So no need to delete gengrid explicitly. Just setting the gendrid
352 * pointer to NULL should suffice here.
354 * We can first delete all the child elements and then we delete the parent.
355 * This approach is currently used below
359 elm_gengrid_clear(gengrid);
360 evas_object_del(gengrid);
365 evas_object_del(layout);
370 elm_theme_free(theme);
375 void ise_emoticon_change_mode(emoticon_group_t emoticon_group)
377 if (emoticon_group == EMOTICON_GROUP_RECENTLY_USED) {
378 //ise_read_recent_emoticon_list_from_scim();
379 if (emoticon_list_recent.empty()) {
380 //PRINTFUNC(DLOG_ERROR,"Cannot display recently used emoticons group. No recently used emoticons available");
386 elm_gengrid_clear(gengrid);
389 __ise_emoticon_append_items_to_gengrid(emoticon_group);
390 current_emoticon_group = emoticon_group;
393 static Eina_Bool _focus_done(void *data)
395 Elm_Object_Item *item = (Elm_Object_Item *)data;
397 elm_object_item_signal_emit(item, "mouse,up,1", "reorder_bg");
399 return ECORE_CALLBACK_CANCEL;
402 static void _multi_down(void *data, Evas *e, Evas_Object *o, void *event_info)
404 Evas_Event_Multi_Down *ev = (Evas_Event_Multi_Down*)event_info;
406 // PRINTFUNC(DLOG_DEBUG,"MULTI: down @ %4i %4i | dev: %i\n", ev->canvas.x, ev->canvas.y, ev->device);
407 if (ev->device >= IND_NUM)
410 Elm_Object_Item *item;
411 item = elm_gengrid_at_xy_item_get(o, ev->canvas.x, ev->canvas.y, NULL, NULL);
413 elm_object_item_signal_emit(item, "mouse,down,1", "reorder_bg");
415 ecore_timer_add(0.5, _focus_done, item);
418 static void _multi_up(void *data, Evas *e, Evas_Object *o, void *event_info)
420 Evas_Event_Multi_Up *ev = (Evas_Event_Multi_Up*)event_info;
421 // PRINTFUNC(DLOG_DEBUG,"MULTI: up @ %4i %4i | dev: %i\n", ev->canvas.x, ev->canvas.y, ev->device);
422 if (ev->device >= IND_NUM)
425 Elm_Object_Item *item = NULL;
426 item = elm_gengrid_at_xy_item_get(o, ev->canvas.x, ev->canvas.y, NULL, NULL);
428 elm_object_item_signal_emit(item, "mouse,up,1", "reorder_bg");
430 elm_gengrid_item_selected_set(item, EINA_TRUE);
434 static const char *get_item_style_for_degree(int screen_degree)
436 bool landscape_device = get_landscape_device(screen_degree);
438 if (screen_degree == 0 || screen_degree == 180) {
439 if (landscape_device)
440 return EMOTICON_GENGRID_ITEM_STYLE_LAND2;
442 return EMOTICON_GENGRID_ITEM_STYLE_PORT2;
445 if (landscape_device)
446 return EMOTICON_GENGRID_ITEM_STYLE_PORT2;
448 return EMOTICON_GENGRID_ITEM_STYLE_LAND2;
453 static void __ise_emoticon_create_gengrid(unsigned short int screen_degree)
455 gengrid = elm_gengrid_add(layout);
456 elm_object_theme_set(gengrid, theme);
457 //elm_object_style_set(gengrid,"no_effect");
458 elm_gengrid_align_set(gengrid, 0.5, 0);
460 evas_object_size_hint_weight_set(gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
461 evas_object_size_hint_align_set(gengrid, EVAS_HINT_FILL, EVAS_HINT_FILL);
463 bool landscape_device = get_landscape_device(screen_degree);
465 if (screen_degree == 0 || screen_degree == 180) {
466 elm_gengrid_item_size_set(gengrid,
467 ELM_SCALE_SIZE(landscape_device ? EMOTICON_WIDTH_LAND : EMOTICON_WIDTH_PORT),
468 ELM_SCALE_SIZE(landscape_device ? EMOTICON_HEIGHT_LAND : EMOTICON_HEIGHT_PORT));
471 elm_gengrid_item_size_set(gengrid,
472 ELM_SCALE_SIZE(landscape_device ? EMOTICON_WIDTH_PORT : EMOTICON_WIDTH_LAND),
473 ELM_SCALE_SIZE(landscape_device ? EMOTICON_HEIGHT_PORT: EMOTICON_HEIGHT_LAND));
476 elm_gengrid_highlight_mode_set(gengrid, EINA_TRUE);
477 elm_gengrid_select_mode_set(gengrid, ELM_OBJECT_SELECT_MODE_ALWAYS);
478 // elm_gengrid_cache_mode_set(gengrid, EINA_TRUE);
479 elm_gengrid_multi_select_set(gengrid, EINA_TRUE);
481 evas_object_event_callback_add(gengrid, EVAS_CALLBACK_MULTI_DOWN, _multi_down, NULL);
482 evas_object_event_callback_add(gengrid, EVAS_CALLBACK_MULTI_UP, _multi_up, NULL);
485 static void __ise_emoticon_append_items_to_gengrid(emoticon_group_t emoticon_group)
489 std::string file_path = "";
491 if (emoticon_group == EMOTICON_GROUP_RECENTLY_USED) {
492 items = emoticon_list_recent.size();
494 for (int i = 0; i < items; i++) {
495 snprintf(img_name, 10, "%x", emoticon_list_recent[i]);
496 emoticon_items[i].keyevent = emoticon_list_recent[i];
497 emoticon_items[i].path = (std::string)img_name;
498 emoticon_items[i].item = elm_gengrid_item_append(gengrid, gic, &(emoticon_items[i]), _item_selected, &(emoticon_items[i]));
501 if (emoticon_group != EMOTICON_GROUP_DESTROY) {
502 items = emoticon_group_items[emoticon_group];
504 for (int i = 0; i < items; i++) {
505 snprintf(img_name, 10, "%x", ise_emoticon_get_code(emoticon_group-1, i));
506 file_path = (std::string)img_name;
507 emoticon_items[i].keyevent = ise_emoticon_get_code(emoticon_group-1, i);
508 emoticon_items[i].path = file_path;
509 emoticon_items[i].item = elm_gengrid_item_append(gengrid, gic, &(emoticon_items[i]), _item_selected, &(emoticon_items[i]));
512 Elm_Object_Item * it = elm_gengrid_first_item_get(gengrid);
513 elm_gengrid_item_show(it, ELM_GENGRID_ITEM_SCROLLTO_NONE);
516 static void __ise_emoticon_create_item_class(unsigned short int screen_degree)
519 gic = elm_gengrid_item_class_new();
523 gic->item_style = EMOTICON_GENGRID_ITEM_STYLE_WEARABLE;
525 gic->item_style = get_item_style_for_degree(screen_degree);
527 gic->func.text_get = grid_text_get;
528 gic->func.content_get = NULL;
529 gic->func.state_get = NULL;
530 gic->func.del = NULL;
534 static char * grid_text_get(void *data, Evas_Object *obj, const char *part)
536 emoticon_item_t *ti = (emoticon_item_t *)data;
541 if (!strcmp(part, "elm.text")) {
542 if (ti && !(ti->path.empty())) {
543 const Eina_Unicode unicode_event[2] = {ti->keyevent, 0};
544 utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
552 static void _item_selected(void *data, Evas_Object *obj, void *event_info)
554 emoticon_item_t *ti = (emoticon_item_t *)data;
558 std::vector<int>::iterator it;
560 CONFIG_VALUES *config_values = get_config_values();
561 static CSCLUtils *utils = CSCLUtils::get_instance();
562 if (utils && config_values) {
563 if (config_values->sound_on)
564 utils->play_sound(DEFAULT_SOUND_STYLE);
565 if (config_values->vibration_on)
566 utils->play_vibration(DEFAULT_VIBRATION_STYLE, DEFAULT_VIBRATION_DURATION);
570 elm_gengrid_item_selected_set((Elm_Object_Item *)event_info, EINA_FALSE);
571 if (ti && ti->keyevent) {
572 const Eina_Unicode unicode_event[2] = {ti->keyevent, 0};
573 // PRINTFUNC(DLOG_DEBUG,"unicode_event is %x",unicode_event);
574 utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
577 ise_send_string((sclchar *)utf_8);
581 if (current_emoticon_group != EMOTICON_GROUP_RECENTLY_USED) {
582 if (emoticon_list_recent.size() < EMOTICON_GROUP_RECENTLY_USED_NUM) {
583 it = find(emoticon_list_recent.begin(), emoticon_list_recent.end(), ti->keyevent);
584 if (it == emoticon_list_recent.end()) { // Item not found
585 emoticon_list_recent.insert(emoticon_list_recent.begin(), ti->keyevent);
587 emoticon_list_recent.erase(it);
588 emoticon_list_recent.insert(emoticon_list_recent.begin(), ti->keyevent);
591 it = find(emoticon_list_recent.begin(), emoticon_list_recent.end(), ti->keyevent);
592 if (it != emoticon_list_recent.end())
593 emoticon_list_recent.erase(it);
595 emoticon_list_recent.erase(emoticon_list_recent.end() - 1);
597 emoticon_list_recent.insert(emoticon_list_recent.begin(), ti->keyevent);
599 ise_write_recent_emoticon_list_to_scim();
601 if (is_recently_used_emoticon_mode_disabled)
602 ise_disable_recently_used_emoticon_key(false);
607 //PRINTFUNC(DLOG_DEBUG,"_item_selected() ends");
610 bool ise_emoticon_is_show(void)
612 return is_emoticon_mode;
615 void ise_emoticon_set_private_key_for_emoticon_mode(const emoticon_group_t emoticon_group)
617 CSCLUI *ui = get_ui();
619 const char *group_name = NULL;
620 for (int id = EMOTICON_GROUP_RECENTLY_USED; id < MAX_EMOTICON_GROUP; id++) {
621 group_name = ise_emoticon_get_group_name(id);
623 ui->unset_private_key(group_name);
626 group_name = ise_emoticon_get_group_name(emoticon_group);
629 sclchar* imagelabel[SCL_BUTTON_STATE_MAX] = {
630 const_cast<sclchar*>(emoticon_group_icons_press[emoticon_group]), const_cast<sclchar*>(""), const_cast<sclchar*>("")};
632 ui->set_private_key(group_name, const_cast<sclchar*>(""), imagelabel, NULL, 0, const_cast<sclchar*>(group_name), TRUE);