From 028f059d325c8361cd9157adc08029148708d0ca Mon Sep 17 00:00:00 2001 From: Aharon Hillel Date: Tue, 29 Jan 2013 06:36:23 +0000 Subject: [PATCH] Clouseau-Eo integration: Added debug info functions. From now, classes implementing the Eo function with id EO_BASE_SUB_ID_DBG_INFO_GET will be able to show in Clouseau their own specific information. Information contents is controlled by the class itself and no more by Clouseau. Basic types and lists are supported.. Signed-off-by: Aharon Hillel SVN revision: 83410 --- src/lib/edje/edje_smart.c | 26 ++- src/lib/eo/Eo.h | 192 ++++++++++++++++++++ src/lib/eo/eo.c | 59 ++++++ src/lib/eo/eo_base_class.c | 9 + src/lib/evas/canvas/evas_object_image.c | 28 ++- src/lib/evas/canvas/evas_object_main.c | 116 ++++++++++++ src/lib/evas/canvas/evas_object_text.c | 25 ++- src/lib/evas/canvas/evas_object_textblock.c | 28 ++- 8 files changed, 479 insertions(+), 4 deletions(-) diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index a180bf097a..5dfa0f00e0 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -10,6 +10,8 @@ EAPI Eo_Op EDJE_OBJ_BASE_ID = EO_NOOP; #define MY_CLASS EDJE_OBJ_CLASS +#define MY_CLASS_NAME "Edje_Smart" + Eina_List *_edje_edjes = NULL; /************************** API Routines **************************/ @@ -34,6 +36,27 @@ _edje_smart_constructor(Eo *obj, void *class_data, va_list *list EINA_UNUSED) _edje_lib_ref(); } +static void +_dbg_info_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +{ + Eo_Dbg_Info *root = (Eo_Dbg_Info *) va_arg(*list, Eo_Dbg_Info *); + eo_do_super(eo_obj, eo_dbg_info_get(root)); + Eo_Dbg_Info *group = EO_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); + + const char *file, *edje_group; + eo_do(eo_obj, edje_obj_file_get(&file, &edje_group)); + EO_DBG_INFO_TEXT_APPEND(group, "File", file); + EO_DBG_INFO_TEXT_APPEND(group, "Group", edje_group); + + Edje_Load_Error error; + eo_do(eo_obj, edje_obj_load_error_get(&error)); + if (error != EDJE_LOAD_ERROR_NONE) + { + EO_DBG_INFO_TEXT_APPEND(group, "Error", + edje_load_error_str(error)); + } +} + static void _edje_color_class_free(void *data) { @@ -317,6 +340,7 @@ _edje_smart_class_constructor(Eo_Class *klass) { const Eo_Op_Func_Description func_desc[] = { EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _edje_smart_constructor), + EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), _dbg_info_get), EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _edje_smart_add), EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _edje_smart_del), EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MOVE), _edje_smart_move), @@ -610,7 +634,7 @@ static const Eo_Op_Description op_desc[] = { static const Eo_Class_Description edje_smart_class_desc = { EO_VERSION, - "Edje_Smart", + MY_CLASS_NAME, EO_CLASS_TYPE_REGULAR, EO_CLASS_DESCRIPTION_OPS(&EDJE_OBJ_BASE_ID, op_desc, EDJE_OBJ_SUB_ID_LAST), NULL, diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h index 875fca940a..95ec675e83 100644 --- a/src/lib/eo/Eo.h +++ b/src/lib/eo/Eo.h @@ -63,6 +63,138 @@ enum _Eo_Op_Type */ typedef enum _Eo_Op_Type Eo_Op_Type; +/* START - Eo Debug support */ +/** + * @var Eo_Dbg_Info_Type + * #Eo_Dbg_Info_Type - tells what type of info in union. + */ +enum _Eo_Dbg_Info_Type +{ /* Public */ + EO_DBG_INFO_TYPE_UNKNOWN, + EO_DBG_INFO_TYPE_STRING, /**< info is string */ + EO_DBG_INFO_TYPE_INT, /**< Single int, enum */ + EO_DBG_INFO_TYPE_BOOL, /**< Single Eina_Bool */ + EO_DBG_INFO_TYPE_PTR, /**< Single PTR value */ + EO_DBG_INFO_TYPE_DOUBLE, /**< Single DBL value */ + EO_DBG_INFO_TYPE_LIST /**< Eina_List * of structs */ +}; +typedef enum _Eo_Dbg_Info_Type Eo_Dbg_Info_Type; + +union _Eo_Dbg_Info_Union +{ + const char *text; + int i; + Eina_Bool b; + void *ptr; + double dbl; + Eina_List *list; /* Sub-List of (Eo_Dbg_Info *) if needed */ +}; +typedef union _Eo_Dbg_Info_Union Eo_Dbg_Info_Union; + +/* Private */ +typedef struct _Eo_Dbg_Info Eo_Dbg_Info; + +/** + * @def EO_DBG_INFO_TEXT_APPEND + * Append a parameter into debug info list. + * @param[in] LIST list where to append + * @param[in] NAME name of the parameter + * @param[in] VALUE text + * + */ +#define EO_DBG_INFO_TEXT_APPEND(LIST, NAME, VALUE) \ + do { \ + Eo_Dbg_Info_Union *un = EO_DBG_INFO_APPEND(LIST, NAME, EO_DBG_INFO_TYPE_STRING); \ + un->text = VALUE; \ + } while (0); + +/** + * @def EO_DBG_INFO_INTEGER_APPEND + * Append a parameter into debug info list. + * @param[in] LIST list where to append + * @param[in] NAME name of the parameter + * @param[in] VALUE integer + * + */ +#define EO_DBG_INFO_INTEGER_APPEND(LIST, NAME, VALUE) \ + do { \ + Eo_Dbg_Info_Union *un = EO_DBG_INFO_APPEND(LIST, NAME, EO_DBG_INFO_TYPE_INT); \ + un->i = VALUE; \ + } while (0); + +/** + * @def EO_DBG_INFO_BOOLEAN_APPEND + * Append a parameter into debug info list. + * @param[in] LIST list where to append + * @param[in] NAME name of the parameter + * @param[in] VALUE boolean + * + */ +#define EO_DBG_INFO_BOOLEAN_APPEND(LIST, NAME, VALUE) \ + do { \ + Eo_Dbg_Info_Union *un = EO_DBG_INFO_APPEND(LIST, NAME, EO_DBG_INFO_TYPE_BOOL); \ + un->b = VALUE; \ + } while (0); + +/** + * @def EO_DBG_INFO_PTR_APPEND + * Append a parameter into debug info list. + * @param[in] LIST list where to append + * @param[in] NAME name of the parameter + * @param[in] VALUE pointer + * + */ +#define EO_DBG_INFO_PTR_APPEND(LIST, NAME, VALUE) \ + do { \ + Eo_Dbg_Info_Union *un = EO_DBG_INFO_APPEND(LIST, NAME, EO_DBG_INFO_TYPE_PTR); \ + un->ptr = VALUE; \ + } while (0); + +/** + * @def EO_DBG_INFO_DOUBLE_APPEND + * Append a parameter into debug info list. + * @param[in] LIST list where to append + * @param[in] NAME name of the parameter + * @param[in] VALUE double + * + */ +#define EO_DBG_INFO_DOUBLE_APPEND(LIST, NAME, VALUE) \ + do { \ + Eo_Dbg_Info_Union *un = EO_DBG_INFO_APPEND(LIST, NAME, EO_DBG_INFO_TYPE_DOUBLE); \ + un->dbl = VALUE; \ + } while (0); + +/** + * @def EO_DBG_INFO_DOUBLE_APPEND + * Creates a list inside debug info list. + * @param[in] LIST list where to append + * @param[in] NAME name of the list + * @return the new list + * + */ +#define EO_DBG_INFO_LIST_APPEND(LIST, NAME) \ + ( \ + eo_dbg_info_append(LIST, NAME, EO_DBG_INFO_TYPE_LIST) \ + ) + +/** + * @def EO_DBG_INFO_APPEND + * Creates a new debug info into a list + * @param[in] LIST list where to append + * @param[in] NAME name of the parameter + * @param[in] TYPE type of the parameter + * @return a pointer to the debug info union where to store the value + * @return the new list + * + */ +#define EO_DBG_INFO_APPEND(LIST, NAME, TYPE) \ + ({ \ + Eo_Dbg_Info *_node = eo_dbg_info_append(LIST, NAME, TYPE); \ + eo_dbg_union_get(_node); }) + +/* END - Eo Debug support */ + + /** * @page eo_main Eo * @@ -844,6 +976,57 @@ EAPI void eo_composite_detach(Eo *comp_obj, Eo *parent); */ EAPI Eina_Bool eo_composite_is(const Eo *comp_obj); +/** + * @brief Allocates Eo_Dbg_Info node + * @param root - tree to where we append allocated node. + * @param name - Name (title) of info. + * @param type - type of info. + * Use this function to allocate Eo_Dbg_Info node. + * Use dbg_info_free to free this node. + * + * @return a pointer to the newly allocated Eo_Dbg_Info. + * @see eo_dbg_info_free, eo_dbg_type_get, eo_dbg_information_get + */ +EAPI Eo_Dbg_Info *eo_dbg_info_append(Eo_Dbg_Info *root, const char *name, Eo_Dbg_Info_Type type); + +/** + * @brief Free list of Eo_Dbg_Info node (including children) + * @param node - node to free. + * + * @see eo_dbg_type_get, eo_dbg_information_get + */ +EAPI void eo_dbg_info_free(Eo_Dbg_Info *node); + +/** + * @brief Get a pointer to Eo_Dbg_Info union + * @param node - pointer to Eo_Dbg_Info node + * + * @return Pointer to struct union (public data). + * @see eo_dbg_info_free, eo_dbg_type_get, eo_dbg_information_get + */ +EAPI Eo_Dbg_Info_Union *eo_dbg_union_get(Eo_Dbg_Info *node); + +/** + * @brief Returns name of dbg-info. + * @param node - pointer to info struct. + * Use this function to retrieve the name field of debug info. + * + * @see eo_dbg_info_free + * @see eo_dbg_type_get, eo_dbg_information_get + */ +EAPI const char *eo_dbg_name_get(Eo_Dbg_Info *node); + +/** + * @brief Returns type of dbg-info. + * @param node - pointer to info struct. + * Use this function to retrieve the type field of debug info. + * + * @return name (title) of info. + * @see eo_dbg_info_free + * @see eo_dbg_name_get, eo_dbg_information_get + */ +EAPI Eo_Dbg_Info_Type eo_dbg_type_get(Eo_Dbg_Info *node); + /** * @} */ @@ -895,6 +1078,7 @@ enum { EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE, EO_BASE_SUB_ID_EVENT_GLOBAL_THAW, EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE_GET, + EO_BASE_SUB_ID_DBG_INFO_GET, EO_BASE_SUB_ID_LAST }; @@ -928,6 +1112,14 @@ enum { */ #define eo_base_data_get(key, data) EO_BASE_ID(EO_BASE_SUB_ID_DATA_GET), EO_TYPECHECK(const char *, key), EO_TYPECHECK(void **, data) +/** + * @def eo_dbg_info_get(root_node) + * Get generic data from object. + * @param[in] root node of the tree + * + */ +#define eo_dbg_info_get(root_node) EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), EO_TYPECHECK(Eo_Dbg_Info *, root_node) + /** * @def eo_base_data_del(key) * Del generic data from object. diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index e38a9771cd..64f04d9c86 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -55,6 +55,16 @@ struct _Eo { Eina_Bool manual_free:1; }; +/* START - EO Debug structs */ +struct _Eo_Dbg_Info +{ /* Debug info composed of a list of Eo_Dbg_Info */ + const char *name; + Eo_Dbg_Info_Type type; + Eo_Dbg_Info_Union un_dbg_info; +}; +/* END - EO Debug structs */ + + /* Start of Dich */ /* How we search and store the implementations in classes. */ @@ -1581,3 +1591,52 @@ eo_manual_free(Eo *obj) _eo_free(obj); } + +EAPI Eo_Dbg_Info * +eo_dbg_info_append(Eo_Dbg_Info *root, const char *name, Eo_Dbg_Info_Type type) +{ + if (root && EO_DBG_INFO_TYPE_LIST != root->type) + return NULL; + + Eo_Dbg_Info *st = calloc(1, sizeof(Eo_Dbg_Info)); + if (!st) return NULL; + + st->name = name; + st->type = type; + + if (root) + root->un_dbg_info.list = eina_list_append(root->un_dbg_info.list, st); + + return st; +} + +EAPI void +eo_dbg_info_free(Eo_Dbg_Info *root) +{ + if (EO_DBG_INFO_TYPE_LIST == root->type) + { + Eo_Dbg_Info *eo; + EINA_LIST_FREE(root->un_dbg_info.list, eo) + eo_dbg_info_free(eo); + } + free(root); +} + +EAPI const char * +eo_dbg_name_get(Eo_Dbg_Info *node) +{ + return ((node) ? node->name : NULL); +} + +EAPI Eo_Dbg_Info_Union * +eo_dbg_union_get(Eo_Dbg_Info *node) +{ + return ((node) ? &node->un_dbg_info : NULL); +} + +EAPI Eo_Dbg_Info_Type +eo_dbg_type_get(Eo_Dbg_Info *node) +{ + return ((node) ? node->type : EO_DBG_INFO_TYPE_UNKNOWN); +} + diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c index 4657da2bbc..ec09a60ca2 100644 --- a/src/lib/eo/eo_base_class.c +++ b/src/lib/eo/eo_base_class.c @@ -102,6 +102,13 @@ _data_get(Eo *obj EINA_UNUSED, void *class_data, va_list *list) } } +static void +_dbg_info_get(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED, + va_list *data EINA_UNUSED) +{ /* No info required in the meantime */ + return; +} + static void _data_del(Eo *obj EINA_UNUSED, void *class_data, va_list *list) { @@ -530,6 +537,7 @@ _class_constructor(Eo_Class *klass) EO_OP_FUNC_CLASS(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE), _ev_global_freeze), EO_OP_FUNC_CLASS(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_THAW), _ev_global_thaw), EO_OP_FUNC_CLASS(EO_BASE_ID(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE_GET), _ev_global_freeze_get), + EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), _dbg_info_get), EO_OP_FUNC_SENTINEL }; @@ -555,6 +563,7 @@ static const Eo_Op_Description op_desc[] = { EO_OP_DESCRIPTION_CLASS(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE, "Freezes events globally."), EO_OP_DESCRIPTION_CLASS(EO_BASE_SUB_ID_EVENT_GLOBAL_THAW, "Thaws events globally."), EO_OP_DESCRIPTION_CLASS(EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE_GET, "Get global event freeze counter."), + EO_OP_DESCRIPTION(EO_BASE_SUB_ID_DBG_INFO_GET, "Get debug info list for obj."), EO_OP_DESCRIPTION_SENTINEL }; diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 924f2bdb1f..e1abe2407f 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -25,6 +25,8 @@ EAPI Eo_Op EVAS_OBJ_IMAGE_BASE_ID = EO_NOOP; #define MY_CLASS EVAS_OBJ_IMAGE_CLASS +#define MY_CLASS_NAME "Evas_Object_Image" + #define VERBOSE_PROXY_ERROR 1 /* private magic number for image objects */ @@ -764,6 +766,29 @@ _image_source_events_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) *source_events = obj->proxy->src_events; } +static void +_dbg_info_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +{ + Eo_Dbg_Info *root = (Eo_Dbg_Info *) va_arg(*list, Eo_Dbg_Info *); + eo_do_super(eo_obj, eo_dbg_info_get(root)); + Eo_Dbg_Info *group = EO_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); + + const char *file, *key; + eo_do(eo_obj, evas_obj_image_file_get(&file, &key)); + EO_DBG_INFO_TEXT_APPEND(group, "Image File", file); + EO_DBG_INFO_TEXT_APPEND(group, "Key", key); + EO_DBG_INFO_PTR_APPEND(group, "Source", + (void *) evas_object_image_source_get(eo_obj)); + + if (evas_object_image_load_error_get(eo_obj) != EVAS_LOAD_ERROR_NONE) + { + Evas_Load_Error error; + eo_do(eo_obj, evas_obj_image_load_error_get(&error)); + EO_DBG_INFO_TEXT_APPEND(group, "Load Error", + evas_load_error_str(error)); + } +} + EAPI void evas_object_image_source_visible_set(Evas_Object *eo_obj, Eina_Bool visible) { @@ -5043,6 +5068,7 @@ _class_constructor(Eo_Class *klass) const Eo_Op_Func_Description func_desc[] = { EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor), EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor), + EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), _dbg_info_get), EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_MEMFILE_SET), _image_memfile_set), EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_FILE_SET), _image_file_set), EO_OP_FUNC(EVAS_OBJ_IMAGE_ID(EVAS_OBJ_IMAGE_SUB_ID_FILE_GET), _image_file_get), @@ -5191,7 +5217,7 @@ static const Eo_Op_Description op_desc[] = { static const Eo_Class_Description class_desc = { EO_VERSION, - "Evas_Object_Image", + MY_CLASS_NAME, EO_CLASS_TYPE_REGULAR, EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_IMAGE_BASE_ID, op_desc, EVAS_OBJ_IMAGE_SUB_ID_LAST), NULL, diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 4e3bd82d90..f1745f1797 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -1857,6 +1857,121 @@ evas_object_evas_get(const Evas_Object *eo_obj) return eo_evas; } +static void +_dbg_info_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +{ + Eo_Dbg_Info *root = (Eo_Dbg_Info *) va_arg(*list, Eo_Dbg_Info *); + eo_do_super(eo_obj, eo_dbg_info_get(root)); + Eo_Dbg_Info *group = EO_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); + Eo_Dbg_Info *node; + + Eina_Bool visible; + eo_do(eo_obj, evas_obj_visibility_get(&visible)); + EO_DBG_INFO_BOOLEAN_APPEND(group, "Visibility", visible); + + short layer; + eo_do(eo_obj, evas_obj_layer_get(&layer)); + EO_DBG_INFO_INTEGER_APPEND(group, "Layer", layer); + + int x, y; + eo_do(eo_obj, evas_obj_position_get(&x, &y)); + node = EO_DBG_INFO_LIST_APPEND(group, "Position"); + EO_DBG_INFO_INTEGER_APPEND(node, "x", x); + EO_DBG_INFO_INTEGER_APPEND(node, "y", y); + + int w, h; + eo_do(eo_obj, evas_obj_size_get(&w, &h)); + node = EO_DBG_INFO_LIST_APPEND(group, "Size"); + EO_DBG_INFO_INTEGER_APPEND(node, "w", w); + EO_DBG_INFO_INTEGER_APPEND(node, "h", h); + + double scale; + eo_do(eo_obj, evas_obj_scale_get(&scale)); + EO_DBG_INFO_DOUBLE_APPEND(group, "Scale", scale); + + eo_do(eo_obj, evas_obj_size_hint_min_get(&w, &h)); + node = EO_DBG_INFO_LIST_APPEND(group, "Min size"); + EO_DBG_INFO_INTEGER_APPEND(node, "w", w); + EO_DBG_INFO_INTEGER_APPEND(node, "h", h); + + eo_do(eo_obj, evas_obj_size_hint_max_get(&w, &h)); + node = EO_DBG_INFO_LIST_APPEND(group, "Max size"); + EO_DBG_INFO_INTEGER_APPEND(node, "w", w); + EO_DBG_INFO_INTEGER_APPEND(node, "h", h); + + eo_do(eo_obj, evas_obj_size_hint_request_get(&w, &h)); + node = EO_DBG_INFO_LIST_APPEND(group, "Request size"); + EO_DBG_INFO_INTEGER_APPEND(node, "w", w); + EO_DBG_INFO_INTEGER_APPEND(node, "h", h); + + double dblx, dbly; + eo_do(eo_obj, evas_obj_size_hint_align_get(&dblx, &dbly)); + node = EO_DBG_INFO_LIST_APPEND(group, "Align"); + EO_DBG_INFO_INTEGER_APPEND(node, "x", dblx); + EO_DBG_INFO_INTEGER_APPEND(node, "y", dbly); + + double dblw, dblh; + eo_do(eo_obj, evas_obj_size_hint_weight_get(&dblw, &dblh)); + node = EO_DBG_INFO_LIST_APPEND(group, "Weight"); + EO_DBG_INFO_INTEGER_APPEND(node, "w", dblw); + EO_DBG_INFO_INTEGER_APPEND(node, "h", dblh); + + int r, g, b, a; + eo_do(eo_obj, evas_obj_color_get(&r, &g, &b, &a)); + node = EO_DBG_INFO_LIST_APPEND(group, "Color"); + EO_DBG_INFO_INTEGER_APPEND(node, "r", r); + EO_DBG_INFO_INTEGER_APPEND(node, "g", g); + EO_DBG_INFO_INTEGER_APPEND(node, "b", b); + EO_DBG_INFO_INTEGER_APPEND(node, "a", a); + + Eina_Bool focus; + eo_do(eo_obj, evas_obj_focus_get(&focus)); + EO_DBG_INFO_BOOLEAN_APPEND(group, "Has focus", focus); + + unsigned int m; + eo_do(eo_obj, evas_obj_pointer_mode_get(&m)); + const char *text = NULL; + if (EVAS_OBJECT_POINTER_MODE_AUTOGRAB == m) + text = "EVAS_OBJECT_POINTER_MODE_AUTOGRAB"; + if (EVAS_OBJECT_POINTER_MODE_NOGRAB == m) + text = "EVAS_OBJECT_POINTER_MODE_NOGRAB"; + if (EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN == m) + text = "EVAS_OBJECT_POINTER_MODE_NOGRAB_NO_REPEAT_UPDOWN"; + + if (text) + EO_DBG_INFO_TEXT_APPEND(group, "Pointer Mode", text); + + Eina_Bool event; + eo_do(eo_obj, evas_obj_pass_events_get(&event)); + EO_DBG_INFO_BOOLEAN_APPEND(group, "Pass Events", event); + + eo_do(eo_obj, evas_obj_repeat_events_get(&event)); + EO_DBG_INFO_BOOLEAN_APPEND(group, "Repeat Events", event); + + eo_do(eo_obj, evas_obj_propagate_events_get(&event)); + EO_DBG_INFO_BOOLEAN_APPEND(group, "Propagate Events", event); + + const Eina_List *clipees; + eo_do(eo_obj, evas_obj_clipees_get(&clipees)); + EO_DBG_INFO_BOOLEAN_APPEND(group, "Has clipees", (Eina_Bool) (!!clipees)); + + const Evas_Map *map = evas_object_map_get(eo_obj); + if (map) + { /* Save map coords count info if object has map */ + node = EO_DBG_INFO_LIST_APPEND(group, "Evas Map"); + int points_count = evas_map_count_get(map); + for(int i = 0 ; i < points_count; i++) + { + Evas_Coord px, py, pz; + evas_map_point_coord_get(map, i, &px, &py, &pz); + Eo_Dbg_Info *point = EO_DBG_INFO_LIST_APPEND(node, "Coords"); + EO_DBG_INFO_INTEGER_APPEND(point, "x", px); + EO_DBG_INFO_INTEGER_APPEND(point, "y", py); + EO_DBG_INFO_INTEGER_APPEND(point, "z", pz); + } + } +} + static void _evas_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { @@ -2382,6 +2497,7 @@ _class_constructor(Eo_Class *klass) const Eo_Op_Func_Description func_desc[] = { EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor), EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor), + EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), _dbg_info_get), EO_OP_FUNC(EVAS_COMMON_ID(EVAS_COMMON_SUB_ID_EVAS_GET), _evas_get), EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_SET), _position_set), EO_OP_FUNC(EVAS_OBJ_ID(EVAS_OBJ_SUB_ID_POSITION_GET), _position_get), diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c index 67ab0c7f2c..a0394e80d7 100644 --- a/src/lib/evas/canvas/evas_object_text.c +++ b/src/lib/evas/canvas/evas_object_text.c @@ -7,6 +7,8 @@ EAPI Eo_Op EVAS_OBJ_TEXT_BASE_ID = EO_NOOP; #define MY_CLASS EVAS_OBJ_TEXT_CLASS +#define MY_CLASS_NAME "Evas_Object_Text" + /* save typing */ #define ENFN obj->layer->evas->engine.func #define ENDT obj->layer->evas->engine.data.output @@ -941,6 +943,26 @@ _text_ellipsis_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) *r = o->cur.ellipsis; } +static void +_dbg_info_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +{ + Eo_Dbg_Info *root = (Eo_Dbg_Info *) va_arg(*list, Eo_Dbg_Info *); + eo_do_super(eo_obj, eo_dbg_info_get(root)); + Eo_Dbg_Info *group = EO_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); + + const char *text; + int size; + eo_do(eo_obj, evas_obj_text_font_get(&text, &size)); + EO_DBG_INFO_TEXT_APPEND(group, "Font", text); + EO_DBG_INFO_INTEGER_APPEND(group, "Text size", size); + + eo_do(eo_obj, evas_obj_text_font_source_get(&text)); + EO_DBG_INFO_TEXT_APPEND(group, "Font source", text); + + eo_do(eo_obj, evas_obj_text_text_get(&text)); + EO_DBG_INFO_TEXT_APPEND(group, "Text", text); +} + EAPI void evas_object_text_text_set(Evas_Object *eo_obj, const char *_text) { @@ -2393,6 +2415,7 @@ _class_constructor(Eo_Class *klass) const Eo_Op_Func_Description func_desc[] = { EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor), EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor), + EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), _dbg_info_get), EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_FONT_SOURCE_SET), _text_font_source_set), EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_FONT_SOURCE_GET), _text_font_source_get), EO_OP_FUNC(EVAS_OBJ_TEXT_ID(EVAS_OBJ_TEXT_SUB_ID_FONT_SET), _text_font_set), @@ -2466,7 +2489,7 @@ static const Eo_Op_Description op_desc[] = { }; static const Eo_Class_Description class_desc = { EO_VERSION, - "Evas_Object_Text", + MY_CLASS_NAME, EO_CLASS_TYPE_REGULAR, EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_TEXT_BASE_ID, op_desc, EVAS_OBJ_TEXT_SUB_ID_LAST), NULL, diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index ad52290476..64d333c49d 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -71,6 +71,8 @@ EAPI Eo_Op EVAS_OBJ_TEXTBLOCK_BASE_ID = EO_NOOP; #define MY_CLASS EVAS_OBJ_TEXTBLOCK_CLASS +#define MY_CLASS_NAME "Evas_Object_Textblock" + #include "linebreak.h" #include "wordbreak.h" @@ -10017,6 +10019,29 @@ _textblock_style_insets_get(Eo *eo_obj, void *_pd, va_list *list) if (b) *b = o->style_pad.b; } +static void +_dbg_info_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) +{ + Eo_Dbg_Info *root = (Eo_Dbg_Info *) va_arg(*list, Eo_Dbg_Info *); + eo_do_super(eo_obj, eo_dbg_info_get(root)); + Eo_Dbg_Info *group = EO_DBG_INFO_LIST_APPEND(root, MY_CLASS_NAME); + + const char *style; + const char *text; + char shorttext[48]; + const Evas_Textblock_Style *ts; + + eo_do(eo_obj, evas_obj_textblock_style_get(&ts)); + style = evas_textblock_style_get(ts); + eo_do(eo_obj, evas_obj_textblock_text_markup_get(&text)); + strncpy(shorttext, text, 38); + if (shorttext[37]) + strcpy(shorttext + 37, "\xe2\x80\xa6"); /* HORIZONTAL ELLIPSIS */ + + EO_DBG_INFO_TEXT_APPEND(group, "Style", style); + EO_DBG_INFO_TEXT_APPEND(group, "Text", shorttext); +} + /** @internal * FIXME: DELETE ME! DELETE ME! * This is an ugly workaround to get around the fact that @@ -10742,6 +10767,7 @@ _class_constructor(Eo_Class *klass) const Eo_Op_Func_Description func_desc[] = { EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor), EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor), + EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), _dbg_info_get), EO_OP_FUNC(EVAS_OBJ_TEXTBLOCK_ID(EVAS_OBJ_TEXTBLOCK_SUB_ID_STYLE_SET), _textblock_style_set), EO_OP_FUNC(EVAS_OBJ_TEXTBLOCK_ID(EVAS_OBJ_TEXTBLOCK_SUB_ID_STYLE_GET), _textblock_style_get), EO_OP_FUNC(EVAS_OBJ_TEXTBLOCK_ID(EVAS_OBJ_TEXTBLOCK_SUB_ID_STYLE_USER_PUSH), _textblock_style_user_push), @@ -10803,7 +10829,7 @@ static const Eo_Op_Description op_desc[] = { }; static const Eo_Class_Description class_desc = { EO_VERSION, - "Evas_Object_Textblock", + MY_CLASS_NAME, EO_CLASS_TYPE_REGULAR, EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_TEXTBLOCK_BASE_ID, op_desc, EVAS_OBJ_TEXTBLOCK_SUB_ID_LAST), NULL,