Support internal method to set auto mode 07/87307/4 accepted/tizen/common/20160907.154831 accepted/tizen/common/20160909.114953 accepted/tizen/ivi/20160909.062349 accepted/tizen/mobile/20160909.062304 accepted/tizen/tv/20160909.062316 accepted/tizen/wearable/20160909.062334 submit/tizen/20160907.102659 submit/tizen/20160909.002354 submit/tizen/20160909.052914
authorKwangyoun Kim <ky85.kim@samsung.com>
Wed, 7 Sep 2016 09:36:08 +0000 (18:36 +0900)
committerKwangyoun Kim <ky85.kim@samsung.com>
Wed, 7 Sep 2016 10:44:22 +0000 (19:44 +0900)
Change-Id: Icd1cc5412dce5f77eb3ea19816918797b5997c85
Signed-off-by: Kwangyoun Kim <ky85.kim@samsung.com>
21 files changed:
CMakeLists.txt [changed mode: 0755->0644]
data/po/CMakeLists.txt [changed mode: 0755->0644]
include/voice_control_elm_private.h [new file with mode: 0644]
packaging/voice-control-elm.spec
src/CMakeLists.txt
src/vc_elm.c
src/vc_elm.h
src/vc_elm_core.c
src/vc_elm_core.h
src/vc_elm_core_default_widgets.c
src/vc_elm_efl_dump.c [new file with mode: 0644]
src/vc_elm_efl_dump.h [new file with mode: 0644]
src/vc_elm_main.h
src/vc_elm_rectangle.c
src/vc_elm_rectangle.h
src/vc_elm_tools.h
src/vc_elm_tooltip.c
src/vc_elm_tooltip.h
src/vc_elm_widget_wrapper.c
src/vc_elm_widget_wrapper.h
voice-control-elm-config.xml [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 264dfba..f124b6e
@@ -77,7 +77,7 @@ MESSAGE(STATUS "CMAKE_RANLIB: " ${CMAKE_RANLIB})
 MESSAGE(STATUS "========================================")
 
 # Warning flags
-ADD_DEFINITIONS("-Werror")             # Generate all warnings as errors
+#ADD_DEFINITIONS("-Werror")            # Generate all warnings as errors
 ADD_DEFINITIONS("-Wall")               # Generate all warnings
 ADD_DEFINITIONS("-Wextra")             # Generate even more extra warnings
 #ADD_DEFINITIONS("-pedantic")          # Accept only pedantic code
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/include/voice_control_elm_private.h b/include/voice_control_elm_private.h
new file mode 100644 (file)
index 0000000..2628fbe
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2011-2015 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the License);
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an AS IS BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+#ifndef VOICE_CONTROL_ELEMENTARY_PRIVATE_H_
+#define VOICE_CONTROL_ELEMENTARY_PRIVATE_H_
+
+/**
+* @internal
+* @addtogroup VOICE_CONTROL_ELEMENTARY_PRIVATE_MODULE
+* @{
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int vc_elm_set_auto_register_mode(int mode, int click_method);
+
+int vc_elm_get_auto_register_mode(int* mode, int* click_method);
+
+int vc_elm_add_allowed_text_part(const char* text_part);
+
+int vc_elm_remove_allowed_text_part(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+/**
+ * @}@}
+ */
+
+#endif /* VOICE_CONTROL_ELEMENTARY_PRIVATE_H_ */
index d4ffdc3..2b498ba 100644 (file)
@@ -19,6 +19,7 @@ BuildRequires:        pkgconfig(dlog)
 BuildRequires: pkgconfig(ecore)
 BuildRequires: pkgconfig(eina)
 BuildRequires: pkgconfig(edje)
+BuildRequires: pkgconfig(capi-ui-efl-util)
 BuildRequires: pkgconfig(elementary)
 BuildRequires: pkgconfig(evas)
 BuildRequires: pkgconfig(libtzplatform-config)
@@ -96,4 +97,5 @@ mkdir -p %{TZ_SYS_RO_SHARE}/voice
 %files devel
 %manifest %{name}-devel.manifest
 %{_includedir}/voice_control_elm.h
-%{_libdir}/pkgconfig/%{name}.pc
+%{_includedir}/voice_control_elm_private.h
+%{_libdir}/pkgconfig/%{name}.pc
\ No newline at end of file
index acd0ead..c00e5ee 100644 (file)
@@ -8,6 +8,7 @@ SET(VC_ELM_PKGS
        evas
        eina
        ecore
+       capi-ui-efl-util
        elementary
        dlog
        libxml-2.0
index ccd174a..dfda5c1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 #include <system_info.h>
 #include "vc_elm_main.h"
 #include <voice_control_elm.h>
+#include <voice_control_elm_private.h>
 
 #include "vc_elm.h"
 #include "vc_elm_core.h"
@@ -62,6 +63,9 @@ static int g_feature_enabled = -1;
 static int g_privilege_allowed = -1;
 static cynara *p_cynara = NULL;
 
+static int g_auto_mode = 0;
+static int g_click_method = 0;
+
 static int __vc_elm_get_feature_enabled()
 {
        if (0 == g_feature_enabled) {
@@ -185,6 +189,7 @@ int vc_elm_initialize()
        _vc_elm_core_load();
 
        is_vc_elm_initialized = true;
+
        VC_ELM_LOG_DBG("vc elm is initialized");
        return VC_ELM_ERROR_NONE;
 }
@@ -961,6 +966,69 @@ int _vc_elm_get_text_domain(char **domain)
        return VC_ELM_ERROR_NONE;
 }
 
+int _vc_elm_set_auto_register_mode(int mode, int click_method)
+{
+       g_auto_mode = mode;
+       g_click_method = click_method;
+
+       return 0;
+}
+int _vc_elm_get_auto_register_mode(int* mode, int* click_method)
+{
+       *mode = g_auto_mode;
+       *click_method = g_click_method;
+
+       return 0;
+}
+
+int vc_elm_set_auto_register_mode(int mode, int click_method)
+{
+       if (0 != __vc_elm_get_feature_enabled()) {
+               return VC_ELM_ERROR_NOT_SUPPORTED;
+       }
+       if (0 != __vc_elm_check_privilege()) {
+               return VC_ELM_ERROR_PERMISSION_DENIED;
+       }
+
+       return _vc_elm_set_auto_register_mode(mode, click_method);
+}
+
+int vc_elm_get_auto_register_mode(int* mode, int* click_method)
+{
+       if (0 != __vc_elm_get_feature_enabled()) {
+               return VC_ELM_ERROR_NOT_SUPPORTED;
+       }
+       if (0 != __vc_elm_check_privilege()) {
+               return VC_ELM_ERROR_PERMISSION_DENIED;
+       }
+
+       return _vc_elm_get_auto_register_mode(mode, click_method);
+}
+
+int vc_elm_add_allowed_text_part(const char* text_part)
+{
+       if (0 != __vc_elm_get_feature_enabled()) {
+               return VC_ELM_ERROR_NOT_SUPPORTED;
+       }
+       if (0 != __vc_elm_check_privilege()) {
+               return VC_ELM_ERROR_PERMISSION_DENIED;
+       }
+
+       return _vc_elm_core_add_allowed_text_part(text_part);
+}
+
+int vc_elm_remove_allowed_text_part(void)
+{
+       if (0 != __vc_elm_get_feature_enabled()) {
+               return VC_ELM_ERROR_NOT_SUPPORTED;
+       }
+       if (0 != __vc_elm_check_privilege()) {
+               return VC_ELM_ERROR_PERMISSION_DENIED;
+       }
+
+       return _vc_elm_core_remove_allowed_text_part();
+}
+
 #ifdef SRPOL_DEBUG
 /**
  * @brief Wrapper for making internal function public - for automated test purposes
index 586b7f5..3e9db17 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -56,6 +56,8 @@ int _vc_elm_set_text_domain(const char *domain, const char *locale_dir);
  */
 int _vc_elm_get_text_domain(char **domain);
 
+int _vc_elm_set_auto_register_mode(int mode, int click_method);
+int _vc_elm_get_auto_register_mode(int* mode, int* click_method);
 
 #ifdef __cplusplus
 }
index 6b08e1d..6001b57 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <Ecore_Evas.h>
+#include <efl_util.h>
 #include <libxml/parser.h>
 #include <voice_control_widget.h>
 
@@ -31,6 +32,8 @@
 #include "vc_elm_tooltip.h"
 #include "vc_elm_rectangle.h"
 
+#include "vc_elm_efl_dump.h"
+
 #ifdef _
 #undef _
 #endif
@@ -64,6 +67,10 @@ static char *g_tooltips_show = NULL;
 static Ecore_Timer *g_animation_view_idler = NULL;
 static Eina_Bool g_view_changed = EINA_FALSE;
 
+static Eina_List *g_dump_list = NULL;
+
+static Eina_List *g_allowed_text_part_list = NULL;
+
 #define HIDE 0xa
 #define X_VISIBILITY_TOLERANCE 32.0
 #define Y_VISIBILITY_TOLERANCE 54.0
@@ -201,6 +208,38 @@ const char *_get_ui_object_name(const Evas_Object *obj)
        return ret;
 }
 
+static Eina_Bool __click_event(void *data)
+{
+       (void)data;
+       efl_util_inputgen_h input_h;
+       input_h = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_KEYBOARD);
+       if (NULL != input_h) {
+               efl_util_input_generate_key(input_h, "Return", 1);
+               efl_util_input_generate_key(input_h, "Return", 0);
+               efl_util_input_deinitialize_generator(input_h);
+       }
+
+       VC_ELM_LOG_INFO("click!!!!!");
+
+       return EINA_FALSE;
+}
+
+static void __focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       (void)event_info;
+       char* event = (char*)data;
+
+       if (NULL != event) {
+               if (!strcmp("focused", event)) {
+                       evas_object_smart_callback_del(obj, "focused", __focused_cb);
+               } else if (!strcmp("item,focused", event)) {
+                       evas_object_smart_callback_del(obj, "item,focused", __focused_cb);
+               }
+
+               ecore_timer_add(0.5, __click_event, NULL);
+       }
+}
+
 /**
  * @brief Function that matches recognition result to the registered actions
  *             and calls for action execution
@@ -237,6 +276,84 @@ Eina_Bool _recognize_command(const char *cmd, const char *param1, const char *pa
                        free(tmp_cmd);
 
                return EINA_TRUE;
+       } else {
+               int auto_mode = 0;
+               int click_method = 0;
+               _vc_elm_get_auto_register_mode(&auto_mode, &click_method);
+               if (1 == auto_mode) {
+                       Eina_List *dump_iter = NULL;
+                       void *data = NULL;
+                       Eina_Bool text_found = EINA_FALSE;
+                       EINA_LIST_FOREACH(g_dump_list, dump_iter, data) {
+                               Object_Info* info = (Object_Info*)data;
+
+                               if (NULL != info && NULL != info->text && NULL != info->part_name) {
+                                       Eina_List *iter = NULL;
+                                       char *part_name = NULL;
+                                       EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) {
+                                               if (NULL != part_name && !strcmp(part_name, info->part_name)) {
+                                                       if (!strcmp(info->text, cmd)) {
+                                                               int x = info->geometry_info.x;
+                                                               int y = info->geometry_info.y;
+                                                               int w = info->geometry_info.w;
+                                                               int h = info->geometry_info.h;
+                                                               VC_ELM_LOG_DBG("Click event : %s x(%d) y(%d) w(%d) h(%d), address(%d) type(%s)", info->text, x, y, w, h, info->address, info->type);
+                                                               if (0 == click_method) {
+                                                                       evas_event_feed_mouse_move(evas_object_evas_get((Evas_Object*)(info->address)), x + w/2, y + h/2, 0, NULL);
+                                                                       evas_event_feed_mouse_down(evas_object_evas_get((Evas_Object*)(info->address)), 1, EVAS_BUTTON_NONE, 1, NULL);
+                                                                       evas_event_feed_mouse_up(evas_object_evas_get((Evas_Object*)(info->address)), 1, EVAS_BUTTON_NONE, 2, NULL);
+                                                               } else if (1 == click_method) {
+                                                                       VC_ELM_LOG_DBG("click method - focus/key");
+                                                                       Object_Info* parent_info = ea_object_dump_parent_widget_data_get(info);
+
+                                                                       if (NULL != parent_info && EINA_TRUE == parent_info->focusable) {
+                                                                               VC_ELM_LOG_DBG("Focusable Parent");
+                                                                               VC_ELM_LOG_DBG("Click event");
+                                                                               evas_object_smart_callback_add((Evas_Object*)(parent_info->address), "focused", __focused_cb, "focused");
+                                                                               elm_object_focus_set((Evas_Object*)(parent_info->address), EINA_TRUE);
+                                                                       } else {
+                                                                               Object_Info* grand_info = ea_object_dump_parent_widget_data_get(parent_info);
+                                                                               while (NULL != grand_info) {
+                                                                                       if (EINA_TRUE == grand_info->focusable) {
+                                                                                               VC_ELM_LOG_DBG("Focusable Grand parent");
+                                                                                               Elm_Object_Item* item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w/2, y + h/2, NULL);
+                                                                                               if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) {
+                                                                                                       VC_ELM_LOG_DBG("Click event");
+                                                                                                       evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused");
+                                                                                                       elm_object_item_focus_set(item, EINA_TRUE);
+                                                                                                       elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE);
+                                                                                               } else {
+                                                                                                       item = elm_genlist_at_xy_item_get((Evas_Object*)(grand_info->address), x + w + w/2, y + h/2, NULL);
+                                                                                                       if (NULL != item && EINA_FALSE == elm_object_item_disabled_get(item)) {
+                                                                                                               VC_ELM_LOG_DBG("Click event 2");
+                                                                                                               evas_object_smart_callback_add((Evas_Object*)(grand_info->address), "item,focused", __focused_cb, "item,focused");
+                                                                                                               elm_object_item_focus_set(item, EINA_TRUE);
+                                                                                                               elm_object_focus_set((Evas_Object*)(grand_info->address), EINA_TRUE);
+                                                                                                       }
+                                                                                               }
+                                                                                               break;
+                                                                                       } else {
+                                                                                               grand_info = ea_object_dump_parent_widget_data_get(grand_info);
+                                                                                       }
+                                                                               }
+                                                                       }
+                                                                       VC_ELM_LOG_DBG("Nothing");
+                                                               } else {
+                                                                        VC_ELM_LOG_DBG("Invalid click method");
+                                                                }
+
+                                                               /* Propagation */
+                                                               //return EINA_TRUE;
+                                                               text_found = EINA_TRUE;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       ea_object_dump_list_clear();
+                       g_dump_list = NULL;
+                       return text_found;
+               }
        }
 
        return EINA_FALSE;
@@ -308,6 +425,11 @@ void _vc_elm_core_init()
        g_config_action_map = eina_hash_string_superfast_new(__hash_entry_stringshare_free_cb);
        g_config_widget_map = eina_hash_string_superfast_new(__hash_entry_eina_list_free_cb);
 
+
+       if (NULL == g_allowed_text_part_list) {
+               g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, "elm.text");
+       }
+
        ret = _vc_elm_core_read_xml_data();
        g_view_changed = EINA_FALSE;
        VC_ELM_LOG_DBG("XML RETURNED %d", ret);
@@ -315,6 +437,16 @@ void _vc_elm_core_init()
 
 void _vc_elm_core_fini()
 {
+       if (NULL != g_allowed_text_part_list) {
+               char *data;
+               EINA_LIST_FREE(g_allowed_text_part_list, data) {
+                       free(data);
+                        data = NULL;
+                }
+
+               g_allowed_text_part_list = NULL;
+       }
+
        eina_hash_free(g_widget_info_hash);
        g_widget_info_hash = NULL;
 
@@ -997,6 +1129,37 @@ static void __vc_add_commands()
                eina_stringshare_del(obj_name);
        }
 
+       int auto_mode = -1;
+       int click_method = -1;
+       _vc_elm_get_auto_register_mode(&auto_mode, &click_method);
+       VC_ELM_LOG_DBG("Auto mode (%d) Click method (%d)", auto_mode, click_method);
+       if (1 == auto_mode) {
+               if (NULL != g_dump_list) {
+                       ea_object_dump_list_clear();
+                       g_dump_list = NULL;
+               }
+               g_dump_list = ea_object_dump_full_list_get();
+               VC_ELM_LOG_DBG("Count (%d)", eina_list_count(g_dump_list));
+
+               Eina_List *dump_iter = NULL;
+               void *data = NULL;
+               EINA_LIST_FOREACH(g_dump_list, dump_iter, data) {
+                       Object_Info* info = (Object_Info*)data;
+
+                       if (NULL != info && NULL != info->text && NULL != info->part_name) {
+                               Eina_List *iter = NULL;
+                               char *part_name = NULL;
+                               EINA_LIST_FOREACH(g_allowed_text_part_list, iter, part_name) {
+                                       if (NULL != part_name && !strcmp(part_name, info->part_name)) {
+                                               VC_ELM_LOG_DBG("Text (%s), Part(%s)", info->text, info->part_name);
+                                               VC_ELM_LOG_DBG("x(%d) y(%d) w(%d) h(%d)", info->geometry_info.x, info->geometry_info.y, info->geometry_info.w, info->geometry_info.h);
+                                               _vc_elm_widget_wrapper_add_command(info->text, NULL);
+                                       }
+                               }
+                       }
+               }
+       }
+
        _vc_elm_widget_wrapper_commit_commands(&__result_cb, NULL);
 }
 
@@ -1861,3 +2024,28 @@ void _vc_elm_core_set_view_changed()
        g_view_changed = EINA_TRUE;
        __idle_changed(NULL);
 }
+
+int _vc_elm_core_add_allowed_text_part(const char* text_part)
+{
+       if (NULL == g_allowed_text_part_list) {
+               return -1;
+       }
+
+       g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, text_part);
+       VC_ELM_LOG_DBG("Add Allowed text part (%s)", text_part);
+       return 0;
+}
+
+int _vc_elm_core_remove_allowed_text_part()
+{
+       char *data;
+
+       EINA_LIST_FREE(g_allowed_text_part_list, data) {
+               free(data);
+                data = NULL;
+        }
+
+       g_allowed_text_part_list = eina_list_append(g_allowed_text_part_list, "elm.text");
+       VC_ELM_LOG_DBG("Remove Allowed text part");
+       return 0;
+}
index dd38b10..c014e7e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -509,6 +509,10 @@ void _vc_elm_core_unregister_view_change_detection();
 
 void _vc_elm_core_set_view_changed();
 
+int _vc_elm_core_add_allowed_text_part(const char* text_part);
+
+int _vc_elm_core_remove_allowed_text_part();
+
 #ifdef __cplusplus
 }
 #endif
index 22d60b0..9c8306a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
diff --git a/src/vc_elm_efl_dump.c b/src/vc_elm_efl_dump.c
new file mode 100644 (file)
index 0000000..936af61
--- /dev/null
@@ -0,0 +1,578 @@
+/*
+ * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file     vc_elm_efl_dump.c
+ * @brief    The private module for efl object dump.
+ * @author   Jaeyong Hwang <j_yong.hwang@samsung.com>
+ */
+
+#include "vc_elm_efl_dump.h"
+
+typedef struct _Ea_Util_Mgr
+{
+   Evas *evas;
+   FILE *fp;
+
+   Eina_List *edje_part_name_list;
+   int x,y,w,h;
+} Ea_Util_Mgr;
+
+typedef struct _Edje_Info
+{
+   const Evas_Object *obj;
+
+   char *part_name;
+   const char *image_name;
+   const char *color_class;
+
+} Edje_Info;
+
+#define SPANS_COMMON(x1, w1, x2, w2) \
+   (!(( (int)((x2) + (int)(w2)) <= (int)(x1)) || (int)((x2) >= (int)((x1) + (int)(w1)))))
+
+#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \
+   ((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
+
+Eina_List *ret_list = NULL;
+Eina_List *ret_text_list = NULL;
+
+static Eina_Bool
+evas_object_is_visible_get(Evas_Object *obj)
+{
+   int r = 0, g = 0, b = 0, a = 0;
+   Evas_Coord x = 0, y = 0, w = 0, h = 0;
+   Evas_Object *clip = NULL;
+   int vis = 0;
+
+   evas_object_color_get(obj, &r, &g, &b, &a);
+   evas_object_geometry_get(obj, &x, &y, &w, &h);
+
+   if (evas_object_visible_get(obj)) vis = 1;
+   clip = evas_object_clip_get(obj);
+   if (clip) evas_object_color_get(obj, &r, &g, &b, &a);
+   if (clip && !evas_object_visible_get(clip)) vis = 0;
+
+   if (clip && a == 0) vis = 0;
+
+   if (0 == vis)
+          return EINA_FALSE;
+   else
+          return EINA_TRUE;
+}
+
+static Eina_Bool
+evas_object_type_match(const Evas_Object *obj, const char *type)
+{
+   int ret = strcmp(evas_object_type_get(obj), type);
+
+   if (!ret) return EINA_TRUE;
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+evas_object_is_swallow_rect(const Evas_Object *obj)
+{
+   int r = 0, g = 0, b = 0, a = 0;
+
+   evas_object_color_get(obj, &r, &g, &b, &a);
+   if (!r && !g && !b && !a
+       && evas_object_pointer_mode_get(obj) == EVAS_OBJECT_POINTER_MODE_NOGRAB
+       && evas_object_pass_events_get(obj))
+     return EINA_TRUE;
+
+   return EINA_FALSE;
+}
+
+static void
+_extract_edje_file_name(Object_Info *object_info, const char *full_path)
+{
+   char name[255] = {0, };
+   unsigned int i, cnt = 0;
+
+   if (!full_path) return;
+
+   for (i = 0; i < strlen(full_path); i++)
+     {
+        if (full_path[i] == '/')
+          {
+             cnt = 0;
+             continue;
+          }
+        name[cnt++] = full_path[i];
+     }
+   name[cnt] = '\0';
+   object_info->edje_file = calloc(1, strlen(name) + 1);
+   strncpy(object_info->edje_file, name, strlen(name) + 1);
+}
+
+static void
+_edje_file_info_save(Ea_Util_Mgr *util_mgr, const Evas_Object *obj)
+{
+   Evas_Object *ed = NULL;
+   const Evas_Object *pobj = NULL;
+   Eina_List *parts = NULL, *l = NULL;
+   Edje_Info *edje_info = NULL;
+   const char *file = NULL, *group = NULL, *pname = NULL, *ret = NULL;
+   double val = 0.0;
+
+   if(!evas_object_type_match(obj, "edje")) return;
+
+   edje_object_file_get(obj, &file, &group);
+
+   ed = edje_edit_object_add(util_mgr->evas); // evas new ??
+   if (edje_object_file_set(ed, file, group))
+     {
+        parts = edje_edit_parts_list_get(ed);
+        EINA_LIST_FOREACH(parts, l, pname)
+          {
+             if ((pobj = edje_object_part_object_get(obj, pname)))
+               {
+                  edje_info = malloc(sizeof(Edje_Info));
+                  edje_info->obj = pobj;
+                  edje_info->part_name = strdup(pname);
+                  ret = edje_object_part_state_get(obj, edje_info->part_name, &val);
+
+                  if (ret)
+                    {
+                       edje_info->color_class = edje_edit_state_color_class_get(ed, edje_info->part_name , ret, val);
+                       edje_info->image_name = edje_edit_state_image_get(ed, edje_info->part_name , ret, val);
+                    }
+
+                  util_mgr->edje_part_name_list = eina_list_append(util_mgr->edje_part_name_list, edje_info);
+
+               }
+          }
+        edje_edit_string_list_free(parts);
+     }
+   evas_object_del(ed);
+}
+
+static void
+_obj_tree_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent)
+{
+   Eina_List *children = NULL, *l = NULL;
+   Evas_Object *child, *smart_parent_obj = NULL;
+   Evas_Coord x = 0, y = 0, w = 0, h = 0;
+   Eina_Bool is_clip = EINA_FALSE;
+   int r = 0, g = 0, b = 0, a = 0;
+   const char *ret = NULL;
+   double val = 0.0;
+   const char *file = NULL, *key = NULL, *group = NULL, *text = NULL;
+   Edje_Info *edje_info = NULL;
+   Object_Info *object_info = NULL;
+
+   // visible check
+   if (!evas_object_is_visible_get(obj)) return;
+
+   // viewport check
+   evas_object_geometry_get(obj, &x, &y, &w, &h);
+
+   if (!RECTS_INTERSECT(x,y,w,h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h)) return;
+
+   // clipper check
+   if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE;
+   if (is_clip) goto next;
+
+   object_info = calloc(1, sizeof(Object_Info));
+
+   object_info->parent = parent;
+
+   object_info->address = (int)obj;
+   object_info->geometry_info.x = x;
+   object_info->geometry_info.y = y;
+   object_info->geometry_info.w = w;
+   object_info->geometry_info.h = h;
+
+   if (elm_widget_is(obj))
+     {
+        if (elm_object_focus_get(obj))
+          object_info->focus = EINA_TRUE;
+        else
+          object_info->focus = EINA_FALSE;
+
+        if (elm_widget_can_focus_get(obj) &&
+            (!elm_object_disabled_get(obj)))
+          object_info->focusable = EINA_TRUE;
+        else
+          object_info->focusable = EINA_FALSE;
+     }
+
+   // evas object type check
+   if (evas_object_is_swallow_rect(obj))
+     {
+        object_info->type = calloc(1, strlen("swallow") + 1);
+        strncpy(object_info->type, "swallow", strlen("swallow") + 1);
+     }
+   else if (evas_object_type_match(obj, "rectangle"))
+     {
+        object_info->type = calloc(1, strlen("rect") + 1);
+        strncpy(object_info->type, "rect", strlen("rect") + 1);
+        evas_object_color_get(obj, &r, &g, &b, &a);
+        object_info->rgb_info.r = r;
+        object_info->rgb_info.g = g;
+        object_info->rgb_info.b = b;
+        object_info->rgb_info.a = a;
+     }
+   else
+     {
+        object_info->type = calloc(1, strlen(evas_object_type_get(obj)) + 1);
+        strncpy(object_info->type, evas_object_type_get(obj), strlen(evas_object_type_get(obj)) + 1);
+     }
+
+   smart_parent_obj = evas_object_smart_parent_get(obj);
+
+   // image info save
+   if (!strcmp(evas_object_type_get(obj), "elm_icon") ||
+       !strcmp(evas_object_type_get(obj), "elm_image"))
+     {
+        elm_image_file_get(obj, &file, &key);
+        evas_object_data_set(obj, "image_name", file);
+     }
+
+   // image name check
+   if (smart_parent_obj && evas_object_type_match(obj, "image")
+       && (evas_object_type_match(smart_parent_obj, "elm_icon")
+           || evas_object_type_match(smart_parent_obj, "elm_image")))
+     {
+        if ((ret = evas_object_data_get(smart_parent_obj, "image_name")))
+          {
+             _extract_edje_file_name(object_info, ret);
+             evas_object_data_del(smart_parent_obj, "edje_image_name");
+          }
+     }
+
+   // edje info save
+   if(evas_object_type_match(obj, "edje"))
+     {
+        edje_object_file_get(obj, &file, &group);
+        if (group)
+          {
+             object_info->group = calloc(1, strlen(group) + 1);
+             strncpy(object_info->group, group, strlen(group) + 1);
+          }
+
+        _extract_edje_file_name(object_info, file);
+        _edje_file_info_save(util_mgr, obj);
+     }
+
+   // edje info check
+   if( !is_clip && smart_parent_obj
+       && !elm_widget_is(obj) && evas_object_type_match(smart_parent_obj, "edje"))
+     {
+        EINA_LIST_FOREACH(util_mgr->edje_part_name_list, l, edje_info)
+          {
+             if(edje_info->obj == obj)
+               {
+                  if (edje_info->color_class)
+                    {
+                       object_info->color_class = calloc(1, strlen(edje_info->color_class) + 1);
+                       strncpy(object_info->color_class, edje_info->color_class, strlen(edje_info->color_class) + 1);
+                    }
+
+                  ret = edje_object_part_state_get(evas_object_smart_parent_get(obj), edje_info->part_name, &val);
+                  object_info->part_name = calloc(1, strlen(edje_info->part_name) + 1);
+                  object_info->part_state = calloc(1, strlen(ret) + 1);
+                  strncpy(object_info->part_name, edje_info->part_name, strlen(edje_info->part_name) + 1);
+                  strncpy(object_info->part_state, ret, strlen(ret) + 1);
+
+                  if (edje_info->image_name)
+                    {
+                       object_info->image_name = calloc(1, strlen(edje_info->image_name) + 1);
+                       strncpy(object_info->image_name, edje_info->image_name, strlen(edje_info->image_name) + 1);
+                    }
+                  break;
+               }
+          }
+     }
+
+   text = NULL;
+   if (!strcmp(evas_object_type_get(obj), "text"))
+     text = eina_stringshare_add(evas_object_text_text_get(obj));
+   else if (!strcmp(evas_object_type_get(obj), "textblock"))
+     {
+        ret = evas_object_textblock_text_markup_get(obj);
+        text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret));
+     }
+   if (text && strlen(text) > 0)
+     {
+        object_info->text = calloc(1, strlen(text) + 1);
+        strncpy(object_info->text, text, strlen(text) + 1);
+     }
+
+   ret_list = eina_list_append(ret_list, object_info);
+next:
+   if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image"))
+     {
+        children = evas_object_smart_members_get(obj);
+        EINA_LIST_FREE(children, child)
+           _obj_tree_items(util_mgr, child, object_info);
+     }
+}
+
+static void
+_obj_tree_text_items(Ea_Util_Mgr *util_mgr, Evas_Object *obj)
+{
+   Eina_List *children = NULL, *l = NULL;
+   Evas_Object *child;
+   Evas_Coord x = 0, y = 0, w = 0, h = 0;
+   Eina_Bool is_clip = EINA_FALSE;
+   const char *ret = NULL;
+   const char *text = NULL;
+   char* data = NULL;
+   Eina_Bool check;
+
+   // visible check
+   if (!evas_object_is_visible_get(obj)) return;
+
+   // viewport check
+   evas_object_geometry_get(obj, &x, &y, &w, &h);
+
+   if (!RECTS_INTERSECT(x,y,w,h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h)) return;
+
+   // clipper check
+   if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE;
+   if (is_clip) goto next;
+
+   text = NULL;
+   if (!strcmp(evas_object_type_get(obj), "text"))
+     text = eina_stringshare_add(evas_object_text_text_get(obj));
+   else if (!strcmp(evas_object_type_get(obj), "textblock"))
+     {
+        ret = evas_object_textblock_text_markup_get(obj);
+        text = eina_stringshare_add(evas_textblock_text_markup_to_utf8(obj, ret));
+     }
+   if (text && strlen(text) > 0)
+     {
+        check = EINA_TRUE;
+        EINA_LIST_FOREACH(ret_text_list, l, data)
+          {
+             if (!strcmp(data, text))
+               {
+                  check = EINA_FALSE;
+                  break;
+               }
+          }
+        if (check) ret_text_list = eina_list_append(ret_text_list, text);
+     }
+
+next:
+   if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image"))
+     {
+        children = evas_object_smart_members_get(obj);
+        EINA_LIST_FREE(children, child)
+           _obj_tree_text_items(util_mgr, child);
+     }
+}
+
+static void
+_object_tree(Ea_Util_Mgr *util_mgr, int val)
+{
+   Eina_List *objs = NULL;
+   Evas_Object *obj = NULL;
+
+   objs = evas_objects_in_rectangle_get(util_mgr->evas, SHRT_MIN, SHRT_MIN, USHRT_MAX, USHRT_MAX, EINA_TRUE, EINA_TRUE);
+
+   if (val == 1)
+     {
+        EINA_LIST_FREE(objs, obj)
+           _obj_tree_items(util_mgr, obj, NULL);
+     }
+   else if (val == 2)
+     {
+        EINA_LIST_FREE(objs, obj)
+           _obj_tree_text_items(util_mgr, obj);
+     }
+}
+
+void
+ea_object_dump_list_clear(void)
+{
+   Object_Info *obj_info = NULL;
+   EINA_LIST_FREE(ret_list, obj_info)
+      free(obj_info);
+
+   ret_list = NULL;
+}
+
+Eina_List*
+ea_object_dump_full_list_get(void)
+{
+   Eina_List *ecore_evas_list = NULL;
+   Ecore_Evas *ee = NULL;
+   Evas *evas = NULL;
+
+   if (!ret_list)
+     ea_object_dump_list_clear();
+
+   Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr));
+   if (!util_mgr)
+     {
+        printf("Fail : utility manager memory alloc\n");
+        goto exit;
+     }
+
+   ecore_evas_list = ecore_evas_ecore_evas_list_get();
+
+   EINA_LIST_FREE(ecore_evas_list, ee)
+     {
+        evas = ecore_evas_get(ee);
+        util_mgr->evas = evas;
+
+       ecore_wl_sync();
+       util_mgr->x = 0;
+       util_mgr->y = 0;
+       ecore_wl_screen_size_get(&util_mgr->w, &util_mgr->h);
+
+
+        _object_tree(util_mgr, 1);
+     }
+
+exit:
+   if (!util_mgr) return NULL;
+   if (util_mgr->edje_part_name_list)
+     eina_list_free(util_mgr->edje_part_name_list);  // need to check
+   free(util_mgr);
+   return ret_list;
+}
+
+Eina_List*
+ea_object_dump_text_list_get(void)
+{
+   Eina_List *ecore_evas_list = NULL;
+   Ecore_Evas *ee = NULL;
+   Evas *evas = NULL;
+
+   Ea_Util_Mgr *util_mgr = calloc(1, sizeof(Ea_Util_Mgr));
+   if (!util_mgr)
+     {
+        printf("Fail : utility manager memory alloc\n");
+        goto exit;
+     }
+
+   ecore_evas_list = ecore_evas_ecore_evas_list_get();
+
+   EINA_LIST_FREE(ecore_evas_list, ee)
+     {
+        evas = ecore_evas_get(ee);
+        util_mgr->evas = evas;
+
+       ecore_wl_sync();
+       util_mgr->x = 0;
+       util_mgr->y = 0;
+       ecore_wl_screen_size_get(&util_mgr->w, &util_mgr->h);
+
+        _object_tree(util_mgr, 2);
+     }
+
+exit:
+   if (!util_mgr) return NULL;
+   free(util_mgr);
+   return ret_text_list;
+}
+
+Eina_List*
+ea_object_dump_find_data(Eina_List *list, const char *str1, const char *str2)
+{
+   Eina_List *l = NULL;
+   Object_Info *data = NULL;
+   Eina_List *ret_data_list = NULL;
+
+   if (!list) return NULL;
+   if (!str1 || !str2) return NULL;
+
+   if (!strcmp(str1, "type"))
+     {
+        EINA_LIST_FOREACH(list, l, data)
+          {
+             if (data->type)
+               if (!strcmp(data->type, str2)) ret_data_list = eina_list_append(ret_data_list, data);
+          }
+     }
+   else if (!strcmp(str1, "edje_file"))
+     {
+        EINA_LIST_FOREACH(list, l, data)
+          {
+             if (data->edje_file)
+               if (!strcmp(data->edje_file, str2)) ret_data_list = eina_list_append(ret_data_list, data);
+          }
+     }
+   else if (!strcmp(str1, "group"))
+     {
+        EINA_LIST_FOREACH(list, l, data)
+          {
+             if (data->group)
+               if (!strcmp(data->group, str2)) ret_data_list = eina_list_append(ret_data_list, data);
+          }
+     }
+   else if (!strcmp(str1, "image_name"))
+     {
+        EINA_LIST_FOREACH(list, l, data)
+          {
+             if (data->image_name)
+               if (!strcmp(data->image_name, str2)) ret_data_list = eina_list_append(ret_data_list, data);
+          }
+     }
+   else if (!strcmp(str1, "color_class"))
+     {
+        EINA_LIST_FOREACH(list, l, data)
+          {
+             if (data->color_class)
+               if (!strcmp(data->color_class, str2)) ret_data_list = eina_list_append(ret_data_list, data);
+          }
+     }
+   else if (!strcmp(str1, "part_name"))
+     {
+        EINA_LIST_FOREACH(list, l, data)
+          {
+             if (data->part_name)
+               if (!strcmp(data->part_name, str2)) ret_data_list = eina_list_append(ret_data_list, data);
+          }
+     }
+   else if (!strcmp(str1, "part_state"))
+     {
+        EINA_LIST_FOREACH(list, l, data)
+          {
+             if (data->part_state)
+               if (!strcmp(data->part_state, str2)) ret_data_list = eina_list_append(ret_data_list, data);
+          }
+     }
+   else if (!strcmp(str1, "text"))
+     {
+        EINA_LIST_FOREACH(list, l, data)
+          {
+             if (data->text)
+               if (!strcmp(data->text, str2)) ret_data_list = eina_list_append(ret_data_list, data);
+          }
+     }
+
+   return ret_data_list;
+}
+
+Object_Info*
+ea_object_dump_parent_widget_data_get(const Object_Info *obj_info)
+{
+   Object_Info *parent_info = NULL;
+
+   parent_info = obj_info->parent;
+   while (parent_info)
+     {
+        if (strstr(parent_info->type, "elm"))
+          return parent_info;
+        parent_info = parent_info->parent;
+     }
+   return NULL;
+}
diff --git a/src/vc_elm_efl_dump.h b/src/vc_elm_efl_dump.h
new file mode 100644 (file)
index 0000000..3962b0e
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file     vc_elm_efl_dump.h
+ * @brief    The private module for efl object dump.
+ * @author   Jaeyong Hwang <j_yong.hwang@samsung.com>
+ */
+
+#ifndef __VC_ELM_EFL_DUMP_H__
+#define __VC_ELM_EFL_DUMP_H__
+
+#include <Elementary.h>
+
+#define EDJE_EDIT_IS_UNSTABLE_AND_I_KNOW_ABOUT_IT
+#include <Edje_Edit.h>
+
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+#include <elm_widget.h>
+
+#include <Ecore_Wayland.h>
+
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef struct _Object_Info Object_Info;
+
+struct _Object_Info
+{
+   Object_Info *parent;
+   char *type;
+   char *edje_file;
+   char *group;
+   char *image_name;
+   char *color_class;
+   int address;
+
+   struct
+   {
+      Evas_Coord x;
+      Evas_Coord y;
+      Evas_Coord w;
+      Evas_Coord h;
+   }geometry_info;
+   char *part_name;
+   char *part_state;
+   char *text;
+   struct
+   {
+      Evas_Coord r;
+      Evas_Coord g;
+      Evas_Coord b;
+      Evas_Coord a;
+   }rgb_info;
+   Eina_Bool focusable;
+   Eina_Bool focus;
+};
+
+void ea_object_dump_list_clear(void);
+Eina_List *ea_object_dump_full_list_get(void);
+Eina_List *ea_object_dump_text_list_get(void);
+Eina_List *ea_object_dump_find_data(Eina_List*, const char*, const char*);
+Object_Info *ea_object_dump_parent_widget_data_get(const Object_Info*);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VC_ELM_EFL_DUMP_H__ */
index 4980f48..6f4dbae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
index 54b4aad..5d9f40c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
index 7896483..da39d17 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
index f3d12fc..ce298f3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
index 961b481..9c7fe78 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
index 083eaa5..63912b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
index b544b5e..290298e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
index b5dd698..64f6298 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
old mode 100755 (executable)
new mode 100644 (file)