From: Thiep Ha Date: Thu, 14 Mar 2013 04:30:10 +0000 (+0900) Subject: [Selection] Selection refactoring, add cursor handler, edge selection, change selecti... X-Git-Tag: accepted/tizen/20130607.210713~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55f06eb8439082f51b5b869eb62c9b99fc6a9782;p=profile%2Fmobile%2Fedje.git [Selection] Selection refactoring, add cursor handler, edge selection, change selection handler sources - Remove space at end of lines. Change-Id: If28c76e216c40a94a59af0e1b19364f37a9021ec --- diff --git a/src/bin/edje_cc_handlers.c b/src/bin/edje_cc_handlers.c index a65e923..be92a1b 100644 --- a/src/bin/edje_cc_handlers.c +++ b/src/bin/edje_cc_handlers.c @@ -158,6 +158,11 @@ static void st_collections_group_parts_part_source3(void); static void st_collections_group_parts_part_source4(void); static void st_collections_group_parts_part_source5(void); static void st_collections_group_parts_part_source6(void); +static void st_collections_group_parts_part_source7(void); +static void st_collections_group_parts_part_source8(void); +static void st_collections_group_parts_part_source9(void); +static void st_collections_group_parts_part_source10(void); +static void st_collections_group_parts_part_source11(void); static void st_collections_group_parts_part_entry_mode(void); static void st_collections_group_parts_part_select_mode(void); static void st_collections_group_parts_part_cursor_mode(void); @@ -402,6 +407,11 @@ New_Statement_Handler statement_handlers[] = {"collections.group.parts.part.source4", st_collections_group_parts_part_source4}, {"collections.group.parts.part.source5", st_collections_group_parts_part_source5}, {"collections.group.parts.part.source6", st_collections_group_parts_part_source6}, + {"collections.group.parts.part.source7", st_collections_group_parts_part_source7}, + {"collections.group.parts.part.source8", st_collections_group_parts_part_source8}, + {"collections.group.parts.part.source9", st_collections_group_parts_part_source9}, + {"collections.group.parts.part.source10", st_collections_group_parts_part_source10}, + {"collections.group.parts.part.source11", st_collections_group_parts_part_source11}, {"collections.group.parts.part.dragable.x", st_collections_group_parts_part_dragable_x}, {"collections.group.parts.part.dragable.y", st_collections_group_parts_part_dragable_y}, {"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine}, @@ -2421,6 +2431,11 @@ st_collections_group_inherit(void) ep->source4 = STRDUP(ep2->source4); ep->source5 = STRDUP(ep2->source5); ep->source6 = STRDUP(ep2->source6); + ep->source7 = STRDUP(ep2->source7); + ep->source8 = STRDUP(ep2->source8); + ep->source9 = STRDUP(ep2->source9); + ep->source10 = STRDUP(ep2->source10); + ep->source11 = STRDUP(ep2->source11); data_queue_copied_part_lookup(pc, &(ep2->clip_to_id), &(ep->clip_to_id)); @@ -3602,6 +3617,112 @@ st_collections_group_parts_part_source6(void) /** @page edcref + @property + source7 + @parameters + [another group's name] + @effect + Only available to TEXTBLOCK parts. It is used for the group to be + loaded and used for start selection handler display. + @endproperty +*/ +static void +st_collections_group_parts_part_source7(void) +{ + check_arg_count(1); + + //FIXME: validate this somehow (need to decide on the format also) + current_part->source7 = parse_str(0); + data_queue_group_lookup(current_part->source7, current_part); +} + +/** + @page edcref + @property + source8 + @parameters + [another group's name] + @effect + Only available to TEXTBLOCK parts. It is used for the group to be + loaded and used for end selection handler display. + @endproperty +*/ +static void +st_collections_group_parts_part_source8(void) +{ + check_arg_count(1); + + //FIXME: validate this somehow (need to decide on the format also) + current_part->source8 = parse_str(0); + data_queue_group_lookup(current_part->source8, current_part); +} + +/** + @page edcref + @property + source9 + @parameters + [another group's name] + @effect + Only available to TEXTBLOCK parts. It is used for the group to be + loaded and used for cursor handler display. + @endproperty +*/ +static void +st_collections_group_parts_part_source9(void) +{ + check_arg_count(1); + + //FIXME: validate this somehow (need to decide on the format also) + current_part->source9 = parse_str(0); + data_queue_group_lookup(current_part->source9, current_part); +} + +/** + @page edcref + @property + source10 + @parameters + [another group's name] + @effect + Only available to TEXTBLOCK parts. It is used for the group to be + loaded and used for start edge of selection display. + @endproperty +*/ +static void +st_collections_group_parts_part_source10(void) +{ + check_arg_count(1); + + //FIXME: validate this somehow (need to decide on the format also) + current_part->source10 = parse_str(0); + data_queue_group_lookup(current_part->source10, current_part); +} + +/** + @page edcref + @property + source11 + @parameters + [another group's name] + @effect + Only available to TEXTBLOCK parts. It is used for the group to be + loaded and used for end edge of selection display. + @endproperty +*/ +static void +st_collections_group_parts_part_source11(void) +{ + check_arg_count(1); + + //FIXME: validate this somehow (need to decide on the format also) + current_part->source11 = parse_str(0); + data_queue_group_lookup(current_part->source11, current_part); +} + + +/** + @page edcref @property effect diff --git a/src/bin/edje_convert.c b/src/bin/edje_convert.c index bd6cf31..bdb7031 100644 --- a/src/bin/edje_convert.c +++ b/src/bin/edje_convert.c @@ -336,6 +336,11 @@ _edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce, replacement->source4 = part->source4; replacement->source5 = part->source5; replacement->source6 = part->source6; + replacement->source7 = part->source7; + replacement->source8 = part->source8; + replacement->source9 = part->source9; + replacement->source10 = part->source10; + replacement->source11 = part->source11; replacement->id = part->id; replacement->clip_to_id = part->clip_to_id; replacement->dragable = part->dragable; diff --git a/src/bin/edje_convert.h b/src/bin/edje_convert.h index 0bbb38e..90af774 100644 --- a/src/bin/edje_convert.h +++ b/src/bin/edje_convert.h @@ -92,7 +92,7 @@ struct _Old_Edje_Part const char *name; /* the name if any of the part */ Old_Edje_Part_Description *default_desc; /* the part descriptor for default */ Eina_List *other_desc; /* other possible descriptors */ - const char *source, *source2, *source3, *source4, *source5, *source6; + const char *source, *source2, *source3, *source4, *source5, *source6, *source7, *source8, *source9, *source10, *source11; int id; /* its id number */ int clip_to_id; /* the part id to clip this one to */ Edje_Part_Dragable dragable; diff --git a/src/bin/edje_data_convert.c b/src/bin/edje_data_convert.c index 5fb129e..31f826b 100644 --- a/src/bin/edje_data_convert.c +++ b/src/bin/edje_data_convert.c @@ -422,6 +422,11 @@ _edje_edd_old_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source4", source4, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source5", source5, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source6", source6, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source7", source7, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source8", source8, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source9", source9, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source10", source10, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "source11", source11, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_old_edje_part, Old_Edje_Part, "items", items, _edje_edd_old_edje_pack_element); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.name", api.name, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.description", api.description, EET_T_STRING); diff --git a/src/lib/Edje.h b/src/lib/Edje.h index 733e30d..2b2ec2e 100644 --- a/src/lib/Edje.h +++ b/src/lib/Edje.h @@ -2919,6 +2919,16 @@ EAPI void edje_object_part_text_select_none (const Evas_ EAPI void edje_object_part_text_select_all (const Evas_Object *obj, const char *part); /** + * @brief Set the selection to be word pointed by current cursor. + * + * @param obj A valid Evas_Object handle + * @param part The part name + * + * This function selects the word pointed by cursor of the object of the part. + */ +EAPI void edje_object_part_text_select_word (const Evas_Object *obj, const char *part); + +/** * @brief Enables selection if the entry is an EXPLICIT selection mode * type. * @@ -3574,6 +3584,12 @@ EAPI void edje_object_part_text_input_panel_return_key_disabled_set( EAPI Eina_Bool edje_object_part_text_input_panel_return_key_disabled_get(const Evas_Object *obj, const char *part); // TIZEN ONLY - START +typedef enum _Edje_Selection_Handler +{ + EDJE_SELECTION_HANDLER_START, + EDJE_SELECTION_HANDLER_END, +} Edje_Selection_Handler; + /** * @brief Set the viewport region of the text. * @@ -3603,12 +3619,35 @@ EAPI void edje_object_part_text_viewport_region_set (const Evas_ EAPI void edje_object_part_text_layout_region_set (const Evas_Object *obj, const char *part, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); /** - * @brief Set whether entry uses copy paste feature or not. + * @brief Get geometry of selection handler. * - * @param disabled If SET, disable double click word selection - * @param part The part name + * @param obj A valid object handle + * @param part edje part + * @param type type of handler (start, end) + * @param x A pointer to a variable where to set the handler's x + * @param y A pointer to a variable where to set the handler's y + * @param w A pointer to a variable where to set the handler's width + * @param h A pointer to a variable where to set the handler's height + */ +EAPI Eina_Bool edje_object_part_text_selection_handler_geometry_get (const Evas_Object *obj, const char *part, Edje_Selection_Handler type, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); + +/** + * @brief Get whether cursor handler is disabled or not. + * + * @param obj A valid object handle + * @param part edje part + * @return EINA_TRUE if cursor handler is disabled, otherwise EINA_FALSE + */ +EAPI Eina_Bool edje_object_part_text_cursor_handler_disabled_get (const Evas_Object *obj, const char *part); + +/** + * @brief Set whether cursor handler is disabled or not. + * + * @param obj A valid object handle + * @param part edje part + * @param EINA_TRUE to disable cursor handler, otherwise EINA_FALSE */ -EAPI void edje_object_part_text_copy_paste_disabled_set (const Evas_Object *obj, const char *part, Eina_Bool disabled); +EAPI void edje_object_part_text_cursor_handler_disabled_set (Evas_Object *obj, const char *part, Eina_Bool disabled); // TIZEN ONLY - END /** diff --git a/src/lib/edje_convert.c b/src/lib/edje_convert.c index 07d43ce..cb68d71 100644 --- a/src/lib/edje_convert.c +++ b/src/lib/edje_convert.c @@ -377,6 +377,11 @@ _edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc) replacement->source4 = part->source4; replacement->source5 = part->source5; replacement->source6 = part->source6; + replacement->source7 = part->source7; + replacement->source8 = part->source8; + replacement->source9 = part->source9; + replacement->source10 = part->source10; + replacement->source11 = part->source11; replacement->id = part->id; replacement->clip_to_id = part->clip_to_id; replacement->dragable = part->dragable; diff --git a/src/lib/edje_convert.h b/src/lib/edje_convert.h index fcc2781..be34be6 100644 --- a/src/lib/edje_convert.h +++ b/src/lib/edje_convert.h @@ -89,7 +89,7 @@ struct _Old_Edje_Part const char *name; /* the name if any of the part */ Old_Edje_Part_Description *default_desc; /* the part descriptor for default */ Eina_List *other_desc; /* other possible descriptors */ - const char *source, *source2, *source3, *source4, *source5, *source6; + const char *source, *source2, *source3, *source4, *source5, *source6, *source7, *source8, *source9, *source10, *source11; int id; /* its id number */ int clip_to_id; /* the part id to clip this one to */ Edje_Part_Dragable dragable; diff --git a/src/lib/edje_data.c b/src/lib/edje_data.c index 4c278d0..be2776b 100644 --- a/src/lib/edje_data.c +++ b/src/lib/edje_data.c @@ -842,6 +842,11 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source4", source4, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source5", source5, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source6", source6, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source7", source7, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source8", source8, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source9", source9, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source10", source10, EET_T_STRING); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "source11", source11, EET_T_STRING); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "id", id, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "clip_to_id", clip_to_id, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.x", dragable.x, EET_T_CHAR); diff --git a/src/lib/edje_entry.c b/src/lib/edje_entry.c index a061143..3743974 100644 --- a/src/lib/edje_entry.c +++ b/src/lib/edje_entry.c @@ -9,13 +9,18 @@ static void _edje_entry_imf_event_delete_surrounding_cb(void *data, Ecore_I #endif // TIZEN ONLY - START -static void _edje_entry_top_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); -static void _edje_entry_top_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); -static void _edje_entry_top_handler_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); - -static void _edje_entry_bottom_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); -static void _edje_entry_bottom_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); -static void _edje_entry_bottom_handler_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info); +static void _edje_entry_start_handler_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _edje_entry_start_handler_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _edje_entry_start_handler_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static void _edje_entry_end_handler_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _edje_entry_end_handler_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _edje_entry_end_handler_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); + +static void _edje_entry_cursor_handler_mouse_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _edje_entry_cursor_handler_mouse_move_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _edje_entry_cursor_handler_mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _edje_entry_changed_cb(void *data, Evas_Object *obj, const char *emission, const char *source); // TIZEN ONLY - END typedef struct _Entry Entry; @@ -45,8 +50,11 @@ struct _Entry Evas_Coord_Rectangle viewport_region; // TIZEN ONLY Evas_Object *cursor_bg; Evas_Object *cursor_fg; - Evas_Object *block_handler_top; // TIZEN ONLY - Evas_Object *block_handler_btm; // TIZEN ONLY + Evas_Object *sel_handler_start; // TIZEN ONLY + Evas_Object *sel_handler_end; // TIZEN ONLY + Evas_Object *sel_handler_edge_start; // TIZEN ONLY + Evas_Object *sel_handler_edge_end; // TIZEN ONLY + Evas_Object *cursor_handler; // TIZEN ONLY Evas_Textblock_Cursor *cursor; Evas_Textblock_Cursor *sel_start, *sel_end; Evas_Textblock_Cursor *cursor_user, *cursor_user_extra; @@ -65,11 +73,12 @@ struct _Entry Eina_Bool select_allow : 1; Eina_Bool select_mod_start : 1; Eina_Bool select_mod_end : 1; - Eina_Bool double_clicked : 1; // TIZEN ONLY + Eina_Bool handler_bypassing: 1; // TIZEN ONLY + Eina_Bool cursor_handler_disabled: 1; // TIZEN ONLY Eina_Bool had_sel : 1; Eina_Bool input_panel_enable : 1; Eina_Bool prediction_allow : 1; - Eina_Bool copy_paste_disabled : 1; + Eina_Bool focused : 1; // TIZEN ONLY // TIZEN ONLY(130129) : Currently, for freezing cursor movement. Eina_Bool freeze : 1; // @@ -81,7 +90,8 @@ struct _Entry Ecore_IMF_Context *imf_context; #endif - Ecore_Timer *longpress_timer; // TIZEN ONLY + Ecore_Timer *long_press_timer; // TIZEN ONLY + Ecore_Timer *cursor_handler_click_timer; // TIZEN ONLY Entry_Long_Press_State long_press_state; // TIZEN ONLY }; @@ -147,50 +157,68 @@ _edje_entry_focus_in_cb(void *data, Evas_Object *o __UNUSED__, const char *emiss if (evas_object_focus_get(rp->edje->obj)) { // TIZEN ONLY - START - if ((!en->block_handler_top) && (!en->block_handler_btm) && + if ((!en->sel_handler_start) && (!en->sel_handler_end) && (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)) { - const char *bh_position; - Evas_Object *ob; + if (rp->part->source8) + { + en->sel_handler_end = edje_object_add(en->rp->edje->base.evas); + edje_object_file_set(en->sel_handler_end, en->rp->edje->path, en->rp->part->source8); + + evas_object_layer_set(en->sel_handler_end, EVAS_LAYER_MAX - 2); + en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_end); + evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_end_handler_mouse_down_cb, en->rp); + evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_UP, _edje_entry_end_handler_mouse_up_cb, en->rp); + evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_end_handler_mouse_move_cb, en->rp); + } - ob = edje_object_add(en->rp->edje->base.evas); - edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source2); - bh_position = edje_object_data_get(ob, "position"); - if ((!bh_position) || (bh_position[0] == 0)) bh_position = "BOTH"; + if (rp->part->source7) + { + en->sel_handler_start = edje_object_add(en->rp->edje->base.evas); + edje_object_file_set(en->sel_handler_start, en->rp->edje->path, en->rp->part->source7); + evas_object_layer_set(en->sel_handler_start, EVAS_LAYER_MAX - 2); + en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_start); + evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_start_handler_mouse_down_cb, en->rp); + evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_UP, _edje_entry_start_handler_mouse_up_cb, en->rp); + evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_start_handler_mouse_move_cb, en->rp); + } - if ((!strcmp(bh_position, "BOTTOM")) || (!strcmp(bh_position, "BOTH"))) + //start edge handler + if (rp->part->source10) { - evas_object_layer_set(ob, EVAS_LAYER_MAX - 2); - en->block_handler_btm = ob; - en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->block_handler_btm); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_bottom_handler_mouse_down_cb, en->rp); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_UP, _edje_entry_bottom_handler_mouse_up_cb, en->rp); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_bottom_handler_mouse_move_cb, en->rp); + en->sel_handler_edge_start = edje_object_add(en->rp->edje->base.evas); + edje_object_file_set(en->sel_handler_edge_start, en->rp->edje->path, en->rp->part->source10); + evas_object_layer_set(en->sel_handler_edge_start, EVAS_LAYER_MAX - 2); + en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_edge_start); + evas_object_clip_set(en->sel_handler_edge_start, evas_object_clip_get(rp->object)); } - else - if (ob) evas_object_del(ob); - if ((!strcmp(bh_position, "TOP")) || (!strcmp(bh_position, "BOTH"))) + //end edge handler + if (rp->part->source11) { - ob = edje_object_add(en->rp->edje->base.evas); - edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source3); - evas_object_layer_set(ob, EVAS_LAYER_MAX - 2); - en->block_handler_top = ob; - en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->block_handler_top); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_top_handler_mouse_down_cb, en->rp); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_UP, _edje_entry_top_handler_mouse_up_cb, en->rp); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_top_handler_mouse_move_cb, en->rp); + en->sel_handler_edge_end = edje_object_add(en->rp->edje->base.evas); + edje_object_file_set(en->sel_handler_edge_end, en->rp->edje->path, en->rp->part->source11); + evas_object_layer_set(en->sel_handler_edge_end, EVAS_LAYER_MAX - 2); + en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_edge_end); + evas_object_clip_set(en->sel_handler_edge_end, evas_object_clip_get(rp->object)); } } - if (en->block_handler_top) - edje_object_signal_emit(en->block_handler_top, "edje,focus,in", "edje"); - if (en->block_handler_btm) - edje_object_signal_emit(en->block_handler_btm, "edje,focus,in", "edje"); + if (en->sel_handler_start) + edje_object_signal_emit(en->sel_handler_start, "edje,focus,in", "edje"); + if (en->sel_handler_end) + edje_object_signal_emit(en->sel_handler_end, "edje,focus,in", "edje"); + if (en->cursor_handler) + edje_object_signal_emit(en->cursor_handler, "edje,focus,in", "edje"); + if (en->sel_handler_edge_start) + edje_object_signal_emit(en->sel_handler_edge_start, "edje,focus,in", "edje"); + if (en->sel_handler_edge_end) + edje_object_signal_emit(en->sel_handler_edge_end, "edje,focus,in", "edje"); // TIZEN ONLY - END ecore_imf_context_reset(en->imf_context); ecore_imf_context_focus_in(en->imf_context); _edje_entry_imf_cursor_info_set(en); + en->focused = EINA_TRUE; } } @@ -209,10 +237,16 @@ _edje_entry_focus_out_cb(void *data, Evas_Object *o __UNUSED__, const char *emis if (!en || !en->imf_context) return; // TIZEN ONLY - START - if (en->block_handler_top) - edje_object_signal_emit(en->block_handler_top, "edje,focus,out", "edje"); - if (en->block_handler_btm) - edje_object_signal_emit(en->block_handler_btm, "edje,focus,out", "edje"); + if (en->sel_handler_start) + edje_object_signal_emit(en->sel_handler_start, "edje,focus,out", "edje"); + if (en->sel_handler_end) + edje_object_signal_emit(en->sel_handler_end, "edje,focus,out", "edje"); + if (en->cursor_handler) + edje_object_signal_emit(en->cursor_handler, "edje,focus,out", "edje"); + if (en->sel_handler_edge_start) + edje_object_signal_emit(en->sel_handler_edge_start, "edje,focus,out", "edje"); + if (en->sel_handler_edge_end) + edje_object_signal_emit(en->sel_handler_edge_end, "edje,focus,out", "edje"); // TIZEN ONLY - END ecore_imf_context_reset(en->imf_context); @@ -242,46 +276,64 @@ _edje_focus_in_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v return; // TIZEN ONLY - START - if ((!en->block_handler_top) && (!en->block_handler_btm) && - (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)) + if ((!en->sel_handler_start) && (!en->sel_handler_end) && + (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)) { - const char *bh_position; - Evas_Object *ob; + if (rp->part->source8) + { + en->sel_handler_end = edje_object_add(en->rp->edje->base.evas); + edje_object_file_set(en->sel_handler_end, en->rp->edje->path, en->rp->part->source8); + + evas_object_layer_set(en->sel_handler_end, EVAS_LAYER_MAX - 2); + en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_end); + evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_end_handler_mouse_down_cb, en->rp); + evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_UP, _edje_entry_end_handler_mouse_up_cb, en->rp); + evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_end_handler_mouse_move_cb, en->rp); + } - ob = edje_object_add(en->rp->edje->base.evas); - edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source2); - bh_position = edje_object_data_get(ob, "position"); - if ((!bh_position) || (bh_position[0] == 0)) bh_position = "BOTH"; + if (rp->part->source7) + { + en->sel_handler_start = edje_object_add(en->rp->edje->base.evas); + edje_object_file_set(en->sel_handler_start, en->rp->edje->path, en->rp->part->source7); + evas_object_layer_set(en->sel_handler_start, EVAS_LAYER_MAX - 2); + en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_start); + evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_start_handler_mouse_down_cb, en->rp); + evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_UP, _edje_entry_start_handler_mouse_up_cb, en->rp); + evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_start_handler_mouse_move_cb, en->rp); + } - if ((!strcmp(bh_position, "BOTTOM")) || (!strcmp(bh_position, "BOTH"))) + //start edge handler + if (rp->part->source10) { - evas_object_layer_set(ob, EVAS_LAYER_MAX - 2); - en->block_handler_btm = ob; - en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->block_handler_btm); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_bottom_handler_mouse_down_cb, en->rp); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_UP, _edje_entry_bottom_handler_mouse_up_cb, en->rp); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_bottom_handler_mouse_move_cb, en->rp); + en->sel_handler_edge_start = edje_object_add(en->rp->edje->base.evas); + edje_object_file_set(en->sel_handler_edge_start, en->rp->edje->path, en->rp->part->source10); + evas_object_layer_set(en->sel_handler_edge_start, EVAS_LAYER_MAX - 2); + en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_edge_start); + evas_object_clip_set(en->sel_handler_edge_start, evas_object_clip_get(rp->object)); } - else - if (ob) evas_object_del(ob); - if ((!strcmp(bh_position, "TOP")) || (!strcmp(bh_position, "BOTH"))) + //end edge handler + if (rp->part->source11) { - ob = edje_object_add(en->rp->edje->base.evas); - edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source3); - evas_object_layer_set(ob, EVAS_LAYER_MAX - 2); - en->block_handler_top = ob; - en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->block_handler_top); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_top_handler_mouse_down_cb, en->rp); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_UP, _edje_entry_top_handler_mouse_up_cb, en->rp); - evas_object_event_callback_add(ob, EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_top_handler_mouse_move_cb, en->rp); + en->sel_handler_edge_end = edje_object_add(en->rp->edje->base.evas); + edje_object_file_set(en->sel_handler_edge_end, en->rp->edje->path, en->rp->part->source11); + evas_object_layer_set(en->sel_handler_edge_end, EVAS_LAYER_MAX - 2); + en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->sel_handler_edge_end); + evas_object_clip_set(en->sel_handler_edge_end, evas_object_clip_get(rp->object)); } } - if (en->block_handler_top) - edje_object_signal_emit(en->block_handler_top, "edje,focus,in", "edje"); - if (en->block_handler_btm) - edje_object_signal_emit(en->block_handler_btm, "edje,focus,in", "edje"); - + if (en->sel_handler_start) + edje_object_signal_emit(en->sel_handler_start, "edje,focus,in", "edje"); + if (en->sel_handler_end) + edje_object_signal_emit(en->sel_handler_end, "edje,focus,in", "edje"); + if (en->cursor_handler) + edje_object_signal_emit(en->cursor_handler, "edje,focus,in", "edje"); + if (en->sel_handler_edge_start) + edje_object_signal_emit(en->sel_handler_edge_start, "edje,focus,in", "edje"); + if (en->sel_handler_edge_end) + edje_object_signal_emit(en->sel_handler_edge_end, "edje,focus,in", "edje"); + + en->focused = EINA_TRUE; if (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE) return; // TIZEN ONLY - END @@ -315,11 +367,17 @@ _edje_focus_out_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, return; // TIZEN ONLY - START - if (en->block_handler_top) - edje_object_signal_emit(en->block_handler_top, "edje,focus,out", "edje"); - if (en->block_handler_btm) - edje_object_signal_emit(en->block_handler_btm, "edje,focus,out", "edje"); - + if (en->sel_handler_start) + edje_object_signal_emit(en->sel_handler_start, "edje,focus,out", "edje"); + if (en->sel_handler_end) + edje_object_signal_emit(en->sel_handler_end, "edje,focus,out", "edje"); + if (en->cursor_handler) + edje_object_signal_emit(en->cursor_handler, "edje,focus,out", "edje"); + if (en->sel_handler_edge_start) + edje_object_signal_emit(en->sel_handler_edge_start, "edje,focus,out", "edje"); + if (en->sel_handler_edge_end) + edje_object_signal_emit(en->sel_handler_edge_end, "edje,focus,out", "edje"); + en->focused = EINA_FALSE; if (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_EDITABLE) return; // TIZEN ONLY - END @@ -632,15 +690,6 @@ _sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) _sel_enable(c, o, en); if (!evas_textblock_cursor_compare(c, en->sel_end)) return; - // TIZEN ONLY - START - if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE) - { - /* Do NOT allow sel_end to pass sel_start while extending */ - if (evas_textblock_cursor_compare(c, en->sel_start) <= 0) - evas_textblock_cursor_pos_set(c, evas_textblock_cursor_pos_get(en->sel_start) + 1); - } - // TIZEN ONLY - END - evas_textblock_cursor_copy(c, en->sel_end); _edje_entry_imf_cursor_info_set(en); @@ -651,6 +700,10 @@ _sel_extend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) en->selection = NULL; } _edje_emit(en->rp->edje, "selection,changed", en->rp->part->name); + // TIZEN ONLY - start + if (en->cursor_handler) + evas_object_hide(en->cursor_handler); + // TIZEN ONLY - end } static void @@ -661,15 +714,6 @@ _sel_preextend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) _sel_enable(c, o, en); if (!evas_textblock_cursor_compare(c, en->sel_start)) return; - // TIZEN ONLY - START - if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE) - { - /* Do NOT allow sel_start to pass sel_end while pre-extending */ - if (evas_textblock_cursor_compare(c, en->sel_end) >= 0) - evas_textblock_cursor_pos_set(c, evas_textblock_cursor_pos_get(en->sel_end) - 1); - } - // TIZEN ONLY - END - evas_textblock_cursor_copy(c, en->sel_start); _edje_entry_imf_cursor_info_set(en); @@ -680,6 +724,10 @@ _sel_preextend(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en) en->selection = NULL; } _edje_emit(en->rp->edje, "selection,changed", en->rp->part->name); + // TIZEN ONLY - start + if (en->cursor_handler) + evas_object_hide(en->cursor_handler); + // TIZEN ONLY - end } static void @@ -709,8 +757,11 @@ _sel_clear(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o __UNUSED__, Entry // TIZEN ONLY - START if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE) { - evas_object_hide(en->block_handler_top); - evas_object_hide(en->block_handler_btm); + evas_object_hide(en->sel_handler_start); + evas_object_hide(en->sel_handler_end); + + evas_object_hide(en->sel_handler_edge_start); + evas_object_hide(en->sel_handler_edge_end); } // TIZEN ONLY - END free(sel); @@ -770,10 +821,7 @@ _sel_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) _edje_subobj_register(en->rp->edje, sel->obj_bg); ob = edje_object_add(en->rp->edje->base.evas); - if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE) - edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source6); - else - edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source2); + edje_object_file_set(ob, en->rp->edje->path, en->rp->part->source2); evas_object_smart_member_add(ob, smart); evas_object_stack_above(ob, o); evas_object_clip_set(ob, clip); @@ -816,32 +864,57 @@ _sel_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) // TIZEN ONLY - START if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE) { - if (list_idx == 1) + int fh_idx, eh_idx; + const char *gc = edje_object_data_get(en->sel_handler_start, "gap"); + int bh_gap = 0; + if (gc) bh_gap = atoi(gc); + + if (en->handler_bypassing) { - Evas_Coord nx, ny, handler_height = 0; - const char *bh_position = edje_object_data_get(en->block_handler_top, "position"); + fh_idx = list_cnt; + eh_idx = 1; + } + else + { + fh_idx = 1; + eh_idx = list_cnt; + } - edje_object_part_geometry_get(en->block_handler_top, "handle", NULL, NULL, NULL, &handler_height); + if (list_idx == fh_idx) + { + Evas_Coord nx, ny, handler_height = 0; + Evas_Coord edge_w; + edje_object_part_geometry_get(en->sel_handler_start, "handle", NULL, NULL, NULL, &handler_height); - if (bh_position && !strcmp(bh_position, "BOTTOM")) + //keep same touch pos when by passing + if (en->handler_bypassing) { - nx = x + r->x; - ny = y + r->y + r->h; + nx = x + r->x + r->w; + ny = y + r->y; } else { nx = x + r->x; ny = y + r->y; } - evas_object_hide(en->block_handler_top); - evas_object_move(en->block_handler_top, nx, ny); + evas_object_hide(en->sel_handler_start); + + edje_object_size_min_calc(en->sel_handler_edge_start, &edge_w, NULL); + evas_object_move(en->sel_handler_edge_start, nx, ny); + evas_object_resize(en->sel_handler_edge_start, edge_w, r->h); + + evas_object_hide(en->sel_handler_edge_start); // if viewport region is not set, show handlers if (en->viewport_region.x == -1 && en->viewport_region.y == -1 && en->viewport_region.w == -1 && en->viewport_region.h == -1) { - edje_object_signal_emit(en->block_handler_top, "elm,state,bottom", "elm"); - evas_object_show(en->block_handler_top); + evas_object_hide(en->sel_handler_start); + evas_object_move(en->sel_handler_start, nx, ny); + edje_object_signal_emit(en->sel_handler_start, "elm,state,top", "elm"); + evas_object_show(en->sel_handler_start); + + evas_object_show(en->sel_handler_edge_start); } else { @@ -850,33 +923,65 @@ _sel_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) (ny >= en->viewport_region.y) && (ny <= (en->viewport_region.y + en->viewport_region.h))) { if (en->layout_region.w != -1 && en->layout_region.h != -1 && - ((ny + handler_height) > (en->layout_region.y + en->layout_region.h))) - edje_object_signal_emit(en->block_handler_top, "elm,state,top", "elm"); + ((ny - handler_height) > en->layout_region.y)) + { + evas_object_move(en->sel_handler_start, nx, ny); + if (nx <= en->layout_region.x + bh_gap) + edje_object_signal_emit(en->sel_handler_start, "elm,state,top,reversed", "elm"); + else + edje_object_signal_emit(en->sel_handler_start, "elm,state,top", "elm"); + } else - edje_object_signal_emit(en->block_handler_top, "elm,state,bottom", "elm"); - - evas_object_show(en->block_handler_top); + { + evas_object_move(en->sel_handler_start, nx, ny + r->h); + if (nx <= en->layout_region.x + bh_gap) + edje_object_signal_emit(en->sel_handler_start, "elm,state,bottom,reversed", "elm"); + else + edje_object_signal_emit(en->sel_handler_start, "elm,state,bottom", "elm"); + } + + evas_object_show(en->sel_handler_start); + evas_object_show(en->sel_handler_edge_start); } } } - if (list_idx == list_cnt) + if (list_idx == eh_idx) { Evas_Coord nx, ny, handler_height = 0; + Evas_Coord edge_w; + + edje_object_part_geometry_get(en->sel_handler_end, "handle", NULL, NULL, NULL, &handler_height); + + //keep pos when bypassing + if (en->handler_bypassing) + { + nx = x + r->x; + ny = y + r->y + r->h; + } + else + { + nx = x + r->x + r->w; + ny = y + r->y + r->h; + } - edje_object_part_geometry_get(en->block_handler_btm, "handle", NULL, NULL, NULL, &handler_height); + evas_object_hide(en->sel_handler_end); - nx = x + r->x + r->w; - ny = y + r->y + r->h; + edje_object_size_min_calc(en->sel_handler_edge_end, &edge_w, NULL); + evas_object_move(en->sel_handler_edge_end, nx, ny - r->h); + evas_object_resize(en->sel_handler_edge_end, edge_w, r->h); - evas_object_hide(en->block_handler_btm); - evas_object_move(en->block_handler_btm, nx, ny); + evas_object_hide(en->sel_handler_edge_end); // if viewport region is not set, show handlers if (en->viewport_region.x == -1 && en->viewport_region.y == -1 && en->viewport_region.w == -1 && en->viewport_region.h == -1) { - edje_object_signal_emit(en->block_handler_btm, "elm,state,bottom", "elm"); - evas_object_show(en->block_handler_btm); + evas_object_move(en->sel_handler_end, nx, ny); + evas_object_move(en->sel_handler_end, nx, ny); + edje_object_signal_emit(en->sel_handler_end, "elm,state,bottom", "elm"); + evas_object_show(en->sel_handler_end); + + evas_object_show(en->sel_handler_edge_end); } else { @@ -884,18 +989,34 @@ _sel_update(Evas_Textblock_Cursor *c __UNUSED__, Evas_Object *o, Entry *en) (nx >= en->viewport_region.x) && (nx <= (en->viewport_region.x + en->viewport_region.w)) && (ny >= en->viewport_region.y) && (ny <= (en->viewport_region.y + en->viewport_region.h))) { + evas_object_move(en->sel_handler_end, nx, ny - r->h); if (en->layout_region.w != -1 && en->layout_region.h != -1 && ((ny + handler_height) > (en->layout_region.y + en->layout_region.h))) - edje_object_signal_emit(en->block_handler_btm, "elm,state,top", "elm"); + { + if (nx >= en->layout_region.w - bh_gap) + edje_object_signal_emit(en->sel_handler_end, "elm,state,top,reversed", "elm"); + else + edje_object_signal_emit(en->sel_handler_end, "elm,state,top", "elm"); + } else - edje_object_signal_emit(en->block_handler_btm, "elm,state,bottom", "elm"); + { + evas_object_move(en->sel_handler_end, nx, ny); + + if (nx >= en->layout_region.w - bh_gap) + edje_object_signal_emit(en->sel_handler_end, "elm,state,bottom,reversed", "elm"); + else + edje_object_signal_emit(en->sel_handler_end, "elm,state,bottom", "elm"); + } - evas_object_show(en->block_handler_btm); + evas_object_show(en->sel_handler_end); + + evas_object_show(en->sel_handler_edge_end); } } } } // TIZEN ONLY - END + *(&(sel->rect)) = *r; range = eina_list_remove_list(range, range); free(r); @@ -1756,7 +1877,8 @@ _edje_key_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, v } else { - _edje_emit(ed, "entry,selection,all,request", rp->part->name); + if (en->select_allow) // TIZEN ONLY + _edje_emit(ed, "entry,selection,all,request", rp->part->name); ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; } } @@ -2036,7 +2158,7 @@ _edje_key_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, voi } // TIZEN ONLY - START -static Eina_Bool +Eina_Bool _edje_entry_select_word(Edje_Real_Part *rp) { Entry *en; @@ -2068,35 +2190,14 @@ _edje_entry_select_word(Edje_Real_Part *rp) _sel_extend(en->cursor, rp->object, en); _edje_entry_real_part_configure(rp); - en->select_allow = EINA_TRUE; en->had_sel = EINA_TRUE; en->selecting = EINA_FALSE; return EINA_TRUE; } -static void -_edje_entry_mouse_double_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) -{ - Edje_Real_Part *rp = data; - Entry *en; - if (!rp) return; - if ((rp->type != EDJE_RP_TYPE_TEXT) || - (!rp->typedata.text)) return; - - en = rp->typedata.text->entry_data; - - if (!en) return; - en->double_clicked = EINA_TRUE; - - if (en->copy_paste_disabled) return; - - _edje_entry_select_word(rp); - _edje_emit(en->rp->edje, "selection,end", en->rp->part->name); -} - static Eina_Bool -_long_press(void *data) +_long_press_cb(void *data) { Edje_Real_Part *rp = data; Entry *en; @@ -2107,16 +2208,22 @@ _long_press(void *data) en = rp->typedata.text->entry_data; if (!en) return ECORE_CALLBACK_CANCEL; - if (en->longpress_timer) + if (en->long_press_timer) { - ecore_timer_del(en->longpress_timer); - en->longpress_timer = NULL; + ecore_timer_del(en->long_press_timer); + en->long_press_timer = NULL; } en->long_press_state = _ENTRY_LONG_PRESSED; - en->longpress_timer = NULL; + en->long_press_timer = NULL; _edje_emit(en->rp->edje, "long,pressed", en->rp->part->name); + + if (en->cursor_handler && !en->cursor_handler_disabled && en->focused) + { + edje_object_signal_emit(en->cursor_handler, "edje,cursor,handle,show", "edje"); + evas_object_show(en->cursor_handler); + } return ECORE_CALLBACK_CANCEL; } // TIZEN ONLY - END @@ -2151,8 +2258,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS if ((rp->type != EDJE_RP_TYPE_TEXT) || (!rp->typedata.text)) return; en = rp->typedata.text->entry_data; - en->double_clicked = EINA_FALSE; - en->long_press_state = _ENTRY_LONG_PRESSING; + en->long_press_state = _ENTRY_LONG_PRESSING; // TIZEN ONLY if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) || (rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE)) return; @@ -2377,9 +2483,9 @@ _edje_part_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS // TIZEN ONLY - START if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE) { - if (en->longpress_timer) ecore_timer_del(en->longpress_timer); - en->longpress_timer = ecore_timer_add(1.0, _long_press, data); - } // TIZEN ONLY - END + if (en->long_press_timer) ecore_timer_del(en->long_press_timer); + en->long_press_timer = ecore_timer_add(0.5, _long_press_cb, data); //FIXME: timer value + } else _edje_entry_real_part_configure(rp); if (ev->button == 2) @@ -2411,13 +2517,12 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED return; // TIZEN ONLY - START - if (en->longpress_timer) + if (en->long_press_timer) { - ecore_timer_del(en->longpress_timer); - en->longpress_timer = NULL; + ecore_timer_del(en->long_press_timer); + en->long_press_timer = NULL; } - if (en->double_clicked) return; if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) { _edje_entry_imf_cursor_info_set(en); @@ -2431,9 +2536,17 @@ _edje_part_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED { en->long_press_state = _ENTRY_LONG_PRESS_RELEASED; _edje_entry_imf_cursor_info_set(en); + + if (strcmp(_edje_entry_text_get(rp), "") == 0) + { + evas_object_hide(en->cursor_handler); + } return; } en->long_press_state = _ENTRY_LONG_PRESS_RELEASED; + + if (en->cursor_handler && !en->cursor_handler_disabled) + evas_object_show(en->cursor_handler); // TIZEN ONLY - END #ifdef HAVE_ECORE_IMF @@ -2577,10 +2690,10 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS if (((dx*dx) + (dy*dy)) > (40*40)) { en->long_press_state = _ENTRY_LONG_PRESS_RELEASED; - if (en->longpress_timer) + if (en->long_press_timer) { - ecore_timer_del(en->longpress_timer); - en->longpress_timer = NULL; + ecore_timer_del(en->long_press_timer); + en->long_press_timer = NULL; } } } @@ -2628,7 +2741,7 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS } evas_textblock_cursor_free(tc); - _edje_emit(en->rp->edje, "magnifier,changed", en->rp->part->name); + //_edje_emit(en->rp->edje, "magnifier,changed", en->rp->part->name); } } // TIZEN ONLY - END else @@ -2706,8 +2819,152 @@ _edje_part_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS } // TIZEN ONLY - START +static Eina_Bool +_cursor_handler_click_cb(void *data) +{ + Edje_Real_Part *rp = data; + Entry *en; + if (!rp) return ECORE_CALLBACK_CANCEL; + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return ECORE_CALLBACK_CANCEL; + en = rp->typedata.text->entry_data; + if (!en) return ECORE_CALLBACK_CANCEL; + + if (en->cursor_handler_click_timer) + { + ecore_timer_del(en->cursor_handler_click_timer); + en->cursor_handler_click_timer = NULL; + } + en->cursor_handler_click_timer = NULL; + + return ECORE_CALLBACK_CANCEL; +} + static void -_edje_entry_top_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_edje_entry_cursor_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) +{ + Entry *en; + Edje_Real_Part *rp = data; + Evas_Event_Mouse_Down *ev = event_info; + Evas_Coord ox, oy, ow, oh; + Evas_Coord lx, ly, lw, lh; + + if (!rp) return; + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return; + en = rp->typedata.text->entry_data; + + if (ev->button != 1) return; + + en->rx = en->sx = ev->canvas.x; + en->ry = en->sy = ev->canvas.y; + + evas_object_geometry_get(obj, &ox, &oy, NULL, NULL); + edje_object_size_min_calc(obj, &ow, &oh); + evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh); + + en->ox = ox + ow/2 - en->rx; + en->oy = oy - en->ry - lh/2; + + _edje_emit(rp->edje, "cursor,handler,move,start", en->rp->part->name); + + if (en->cursor_handler_click_timer) ecore_timer_del(en->cursor_handler_click_timer); + en->cursor_handler_click_timer = ecore_timer_add(0.1, _cursor_handler_click_cb, data); //FIXME: timer value +} + +static void +_edje_entry_cursor_handler_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Entry *en; + Edje_Real_Part *rp = data; + Evas_Event_Mouse_Up *ev = event_info; + + if (!rp) return; + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return; + en = rp->typedata.text->entry_data; + + if (ev->button != 1) return; + + if (en->cursor_handler_click_timer) + { + ecore_timer_del(en->cursor_handler_click_timer); + en->cursor_handler_click_timer = NULL; + + _edje_emit(rp->edje, "cursor,handler,clicked", rp->part->name); + } + else + { + _edje_entry_imf_cursor_info_set(en); + _edje_emit(rp->edje, "cursor,handler,move,end", en->rp->part->name); + } +} + +static void +_edje_entry_cursor_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Entry *en; + Edje_Real_Part *rp = data; + Evas_Event_Mouse_Move *ev = event_info; + Evas_Coord x, y, tx, ty, tw, th; + Evas_Coord cx, cy; + Evas_Coord lh; + + if (!rp) return; + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return; + en = rp->typedata.text->entry_data; + + if (ev->buttons != 1) return; + + x = ev->cur.canvas.x; + y = ev->cur.canvas.y; + + en->rx += (x - en->sx); + en->ry += (y - en->sy); + en->sx = ev->cur.canvas.x; + en->sy = ev->cur.canvas.y; + + evas_object_geometry_get(rp->object, &tx, &ty, NULL, NULL); + evas_object_textblock_size_formatted_get(rp->object, &tw, &th); + + cx = en->rx + en->ox - tx; + cy = en->ry + en->oy - ty; + + evas_textblock_cursor_line_geometry_get(en->cursor, NULL, NULL, NULL, &lh); + if (cx <= 0) cx = 1; + if (cy <= 0) cy = lh / 2; + if (cy > th) cy = th - 1; + + evas_textblock_cursor_char_coord_set(en->cursor, cx, cy); + + //_edje_entry_imf_cursor_info_set(en); + _edje_emit(rp->edje, "cursor,changed", rp->part->name); //to scroll scroller + _edje_entry_real_part_configure(rp); + + _edje_emit(rp->edje, "cursor,handler,moving", rp->part->name); +} + +static void +_edje_entry_changed_cb(void *data, Evas_Object *obj, const char *emission, const char *source) +{ + Entry *en; + Edje_Real_Part *rp = data; + + if (!rp) return; + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return; + en = rp->typedata.text->entry_data; + if(!en) return; + + if (en->cursor_handler) + { + evas_object_hide(en->cursor_handler); + } +} + +static void +_edje_entry_start_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info) { Evas_Event_Mouse_Down *ev = event_info; Evas_Coord ox, oy, ow, oh; @@ -2735,16 +2992,30 @@ _edje_entry_top_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Objec } static void -_edje_entry_top_handler_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_edje_entry_start_handler_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { Edje_Real_Part *rp = data; Entry *en = rp->typedata.text->entry_data; + //switch sel_start,end + if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) >= 0) + { + Evas_Textblock_Cursor *tc; + tc = evas_object_textblock_cursor_new(rp->object); + evas_textblock_cursor_copy(en->sel_start, tc); + evas_textblock_cursor_copy(en->sel_end, en->sel_start); + evas_textblock_cursor_copy(tc, en->sel_end); + evas_textblock_cursor_free(tc); + } + //update handlers + en->handler_bypassing = EINA_FALSE; + _edje_entry_real_part_configure(rp); + _edje_emit(en->rp->edje, "handler,move,end", en->rp->part->name); } static void -_edje_entry_top_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_edje_entry_start_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { Evas_Event_Mouse_Move *ev = event_info; Edje_Real_Part *rp = data; @@ -2790,17 +3061,12 @@ _edje_entry_top_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Objec evas_textblock_cursor_char_coord_set(en->cursor, cx, cy); - //moving in allowed space + // by passing if (evas_textblock_cursor_compare(en->cursor, en->sel_end) >= 0) - { - if (cx >= sx) - evas_textblock_cursor_pos_set(en->cursor, evas_textblock_cursor_pos_get(en->sel_end) - 1); - else - { - if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, sy + 1)) - evas_textblock_cursor_line_char_first(en->cursor); - } - } + en->handler_bypassing = EINA_TRUE; + else + en->handler_bypassing = EINA_FALSE; + // if (en->select_allow) { @@ -2815,7 +3081,7 @@ _edje_entry_top_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Objec } static void -_edje_entry_bottom_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_edje_entry_end_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { Evas_Event_Mouse_Down *ev = event_info; Evas_Coord ox, oy, ow, oh; @@ -2842,16 +3108,35 @@ _edje_entry_bottom_handler_mouse_down_cb(void *data, Evas *e __UNUSED__, Evas_Ob } static void -_edje_entry_bottom_handler_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_edje_entry_end_handler_mouse_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { Edje_Real_Part *rp = data; Entry *en = rp->typedata.text->entry_data; + //switch sel_start,end + if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) >= 0) + { + Evas_Textblock_Cursor *tc; + tc = evas_object_textblock_cursor_new(rp->object); + evas_textblock_cursor_copy(en->sel_start, tc); + evas_textblock_cursor_copy(en->sel_end, en->sel_start); + evas_textblock_cursor_copy(tc, en->sel_end); + // first char case + if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) == 0) + { + evas_textblock_cursor_char_next(en->sel_end); + } + evas_textblock_cursor_free(tc); + } + //update handlers + en->handler_bypassing = EINA_FALSE; + _edje_entry_real_part_configure(rp); + _edje_emit(en->rp->edje, "handler,move,end", en->rp->part->name); } static void -_edje_entry_bottom_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +_edje_entry_end_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { Evas_Event_Mouse_Move *ev = event_info; Edje_Real_Part *rp = data; @@ -2860,7 +3145,6 @@ _edje_entry_bottom_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Ob Evas_Coord cx, cy; Evas_Textblock_Cursor_Type cur_type; Evas_Coord sx, sy; - Evas_Coord ox, oy, hx; if (ev->buttons != 1) return; @@ -2895,26 +3179,12 @@ _edje_entry_bottom_handler_mouse_move_cb(void *data, Evas *e __UNUSED__, Evas_Ob evas_textblock_cursor_geometry_get(en->sel_start, &sx, &sy, NULL, NULL, NULL, cur_type); evas_textblock_cursor_char_coord_set(en->cursor, cx, cy); - //avoid hiding the first char - if (evas_textblock_cursor_compare(en->cursor, en->sel_start) == 0) - { - evas_object_geometry_get(rp->object, &ox, &oy, NULL, NULL); - evas_object_geometry_get(en->block_handler_top, &hx, NULL, NULL, NULL); - if (hx < en->viewport_region.x) - evas_object_move(rp->object, ox + en->viewport_region.x - hx, oy); - } - - //moving in allowed space + // by passing if (evas_textblock_cursor_compare(en->cursor, en->sel_start) <= 0) - { - if (cx <= sx) - evas_textblock_cursor_pos_set(en->cursor, evas_textblock_cursor_pos_get(en->sel_start) + 1); - else - { - if (!evas_textblock_cursor_char_coord_set(en->cursor, cx, sy + 1)) - evas_textblock_cursor_line_char_last(en->cursor); - } - } + en->handler_bypassing = EINA_TRUE; + else + en->handler_bypassing = EINA_FALSE; + // if (en->select_allow) { @@ -3027,10 +3297,7 @@ _edje_entry_real_part_init(Edje_Real_Part *rp) } en->cursor_bg = edje_object_add(rp->edje->base.evas); - if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE) - edje_object_file_set(en->cursor_bg, rp->edje->path, rp->part->source6); - else - edje_object_file_set(en->cursor_bg, rp->edje->path, rp->part->source3); + edje_object_file_set(en->cursor_bg, rp->edje->path, rp->part->source3); evas_object_smart_member_add(en->cursor_bg, rp->edje->obj); evas_object_stack_below(en->cursor_bg, rp->object); evas_object_clip_set(en->cursor_bg, evas_object_clip_get(rp->object)); @@ -3045,6 +3312,26 @@ _edje_entry_real_part_init(Edje_Real_Part *rp) evas_object_pass_events_set(en->cursor_fg, EINA_TRUE); _edje_subobj_register(en->rp->edje, en->cursor_fg); + // TIZEN ONLY - START + //cursor handler + en->cursor_handler_disabled = EINA_FALSE; + if (rp->part->source9) + { + en->cursor_handler = edje_object_add(en->rp->edje->base.evas); + edje_object_file_set(en->cursor_handler , en->rp->edje->path, rp->part->source9); + + evas_object_layer_set(en->cursor_handler , EVAS_LAYER_MAX - 2); + en->rp->edje->subobjs = eina_list_append(en->rp->edje->subobjs, en->cursor_handler ); + + evas_object_event_callback_add(en->cursor_handler , EVAS_CALLBACK_MOUSE_DOWN, _edje_entry_cursor_handler_mouse_down_cb, en->rp); + evas_object_event_callback_add(en->cursor_handler , EVAS_CALLBACK_MOUSE_UP, _edje_entry_cursor_handler_mouse_up_cb, en->rp); + evas_object_event_callback_add(en->cursor_handler , EVAS_CALLBACK_MOUSE_MOVE, _edje_entry_cursor_handler_mouse_move_cb, en->rp); + + edje_object_signal_callback_add(rp->edje->obj, "entry,changed", "elm.text", _edje_entry_changed_cb, en->rp); + } + // TIZEN ONLY - END + en->focused = EINA_FALSE; + evas_object_textblock_legacy_newline_set(rp->object, EINA_TRUE); if (rp->part->entry_mode >= EDJE_ENTRY_EDIT_MODE_EDITABLE) @@ -3107,10 +3394,6 @@ _edje_entry_real_part_init(Edje_Real_Part *rp) done: #endif en->cursor = (Evas_Textblock_Cursor *)evas_object_textblock_cursor_get(rp->object); - - // TIZEN ONLY - START - edje_object_signal_callback_add(rp->edje->obj, "mouse,down,1,double", rp->part->name, _edje_entry_mouse_double_clicked, rp); - // TIZEN ONLY - END } void @@ -3131,28 +3414,51 @@ _edje_entry_real_part_shutdown(Edje_Real_Part *rp) // TIZEN ONLY - START rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->cursor_bg); rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->cursor_fg); - rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->block_handler_top); - rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->block_handler_btm); + rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->sel_handler_start); + rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->sel_handler_end); + rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->sel_handler_edge_start); + rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->sel_handler_edge_end); + rp->edje->subobjs = eina_list_remove(rp->edje->subobjs, en->cursor_handler); // TIZEN ONLY - END evas_object_del(en->cursor_bg); evas_object_del(en->cursor_fg); // TIZEN ONLY - START - if (en->block_handler_top) + if (en->sel_handler_start) + { + evas_object_del(en->sel_handler_start); + en->sel_handler_start = NULL; + } + if (en->sel_handler_end) + { + evas_object_del(en->sel_handler_end); + en->sel_handler_end = NULL; + } + if (en->cursor_handler) + { + evas_object_del(en->cursor_handler); + en->cursor_handler = NULL; + } + if (en->sel_handler_edge_start) { - evas_object_del(en->block_handler_top); - en->block_handler_top = NULL; + evas_object_del(en->sel_handler_edge_start); + en->sel_handler_edge_start = NULL; } - if (en->block_handler_btm) + if (en->sel_handler_edge_end) { - evas_object_del(en->block_handler_btm); - en->block_handler_btm = NULL; + evas_object_del(en->sel_handler_edge_end); + en->sel_handler_edge_end = NULL; } - if (en->longpress_timer) + if (en->long_press_timer) { - ecore_timer_del(en->longpress_timer); - en->longpress_timer = NULL; + ecore_timer_del(en->long_press_timer); + en->long_press_timer = NULL; + } + if (en->cursor_handler_click_timer) + { + ecore_timer_del(en->cursor_handler_click_timer); + en->cursor_handler_click_timer = NULL; } // TIZEN ONLY - END @@ -3225,6 +3531,15 @@ _edje_entry_real_part_configure(Edje_Real_Part *rp) evas_object_move(en->cursor_fg, x + xx, y + yy); evas_object_resize(en->cursor_fg, ww, hh); } + if (en->cursor_handler && (!en->cursor_handler_disabled || en->long_press_state == _ENTRY_LONG_PRESSED || en->long_press_state == _ENTRY_LONG_PRESSING)) + { + Evas_Coord chx, chy; + chx = x + xx; + chy = y + yy + hh; + evas_object_move(en->cursor_handler, chx, chy); + if ((chx < en->viewport_region.x) || (chy < en->viewport_region.y)) + evas_object_hide(en->cursor_handler); + } } const char * @@ -3537,18 +3852,13 @@ _edje_entry_items_list(Edje_Real_Part *rp) // TIZEN ONLY - START void -_edje_entry_copy_paste_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled) -{ - Entry *en = rp->typedata.text->entry_data; - if (!en) return; - - en->copy_paste_disabled = disabled; -} - -void _edje_entry_layout_region_set(Edje_Real_Part *rp, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { - Entry *en = rp->typedata.text->entry_data; + Entry *en; + + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return; + en = rp->typedata.text->entry_data; if (!en) return; en->layout_region.x = x; @@ -3561,7 +3871,10 @@ _edje_entry_layout_region_set(Edje_Real_Part *rp, Evas_Coord x, Evas_Coord y, Ev void _edje_entry_viewport_region_set(Edje_Real_Part *rp, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { - Entry *en = rp->typedata.text->entry_data; + Entry *en; + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return; + en = rp->typedata.text->entry_data; if (!en) return; en->viewport_region.x = x; @@ -3570,6 +3883,70 @@ _edje_entry_viewport_region_set(Edje_Real_Part *rp, Evas_Coord x, Evas_Coord y, en->viewport_region.h = h; _sel_update(en->cursor, rp->object, en); } + +void +_edje_entry_selection_handler_geometry_get(Edje_Real_Part *rp, Edje_Selection_Handler type, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + Entry *en; + Evas_Coord ex, ey, hx, hy, edx, edy, edw, edh; + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return; + en = rp->typedata.text->entry_data; + if (!en) return; + + evas_object_geometry_get(rp->object, &ex, &ey, NULL, NULL); + switch (type) + { + case EDJE_SELECTION_HANDLER_START: + if (en->sel_handler_start) + { + evas_object_geometry_get(en->sel_handler_start, &hx, &hy, NULL, NULL); + edje_object_part_geometry_get(en->sel_handler_start, "handle", &edx, &edy, &edw, &edh); + hx = hx - ex + edx; + hy = hy - ey + edy; + } + break; + case EDJE_SELECTION_HANDLER_END: + if (en->sel_handler_end) + { + evas_object_geometry_get(en->sel_handler_end, &hx, &hy, NULL, NULL); + edje_object_part_geometry_get(en->sel_handler_end, "handle", &edx, &edy, &edw, &edh); + hx = hx - ex + edx; + hy = hy - ey + edy; + } + break; + default: + break; + } + + if (x) *x = hx; + if (y) *y = hy; + if (w) *w = edw; + if (h) *h = edh; +} + +Eina_Bool +_edje_entry_cursor_handler_disabled_get(Edje_Real_Part *rp) +{ + Entry *en; + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return EINA_FALSE; + en = rp->typedata.text->entry_data; + if (!en) return EINA_FALSE; + return en->cursor_handler_disabled; +} + +void +_edje_entry_cursor_handler_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled) +{ + Entry *en; + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text)) return; + en = rp->typedata.text->entry_data; + if (!en) return; + + en->cursor_handler_disabled = disabled; +} // TIZEN ONLY - END void @@ -3660,14 +4037,6 @@ _edje_entry_select_allow_set(Edje_Real_Part *rp, Eina_Bool allow) if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT) return; en->select_allow = allow; - - // TIZEN ONLY - START - if ((allow) && (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)) - { - if (!_edje_entry_select_word(rp)) return; - _edje_emit(en->rp->edje, "selection,end", en->rp->part->name); - } - // TIZEN ONLY - END } Eina_Bool @@ -3701,6 +4070,59 @@ _edje_entry_select_abort(Edje_Real_Part *rp) } } +// TIZEN ONLY - START +Eina_Bool +_edje_entry_selection_geometry_get(Edje_Real_Part *rp, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + Entry *en = rp->typedata.text->entry_data; + if (!en || !en->have_selection || !en->sel) + return EINA_FALSE; + + Sel *sel; + Eina_List *l; + Evas_Textblock_Rectangle rect; + Evas_Coord tx, ty, tw, th; + + l = en->sel; + if (!l) return EINA_FALSE; + sel = eina_list_data_get(l); + if (!sel) return EINA_FALSE; + rect = sel->rect; + ty = rect.y; + tw = rect.w; + + l = eina_list_last(en->sel); + if (!l) return EINA_FALSE; + sel = eina_list_data_get(l); + if (!sel) return EINA_FALSE; + rect = sel->rect; + + tx = rect.x; + th = rect.y - ty + rect.h; + + EINA_LIST_FOREACH(en->sel, l, sel) + { + if (sel) + { + if (tw < sel->rect.w) tw = sel->rect.w; + if (sel->rect.x < tx) tx = sel->rect.x; + } + } + + Evas_Coord vx, vy; + evas_object_geometry_get(rp->object, &vx, &vy, NULL, NULL); + tx += vx; + ty += vy; + + if (x) *x = tx; + if (y) *y = ty; + if (w) *w = tw; + if (h) *h = th; + + return EINA_TRUE; +} +// TIZEN ONLY - END + void * _edje_entry_imf_context_get(Edje_Real_Part *rp) { @@ -4343,59 +4765,6 @@ _edje_entry_cursor_pos_get(Edje_Real_Part *rp, Edje_Cursor cur) return evas_textblock_cursor_pos_get(c); } -// TIZEN ONLY - START -Eina_Bool -_edje_entry_selection_geometry_get(Edje_Real_Part *rp, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) -{ - Entry *en = rp->typedata.text->entry_data; - if (!en || !en->have_selection || !en->sel) - return EINA_FALSE; - - Sel *sel; - Eina_List *l; - Evas_Textblock_Rectangle rect; - Evas_Coord tx, ty, tw, th; - - l = en->sel; - if (!l) return EINA_FALSE; - sel = eina_list_data_get(l); - if (!sel) return EINA_FALSE; - rect = sel->rect; - ty = rect.y; - tw = rect.w; - - l = eina_list_last(en->sel); - if (!l) return EINA_FALSE; - sel = eina_list_data_get(l); - if (!sel) return EINA_FALSE; - rect = sel->rect; - - tx = rect.x; - th = rect.y - ty + rect.h; - - EINA_LIST_FOREACH(en->sel, l, sel) - { - if (sel) - { - if (tw < sel->rect.w) tw = sel->rect.w; - if (sel->rect.x < tx) tx = sel->rect.x; - } - } - - Evas_Coord vx, vy; - evas_object_geometry_get(rp->object, &vx, &vy, NULL, NULL); - tx += vx; - ty += vy; - - if (x) *x = tx; - if (y) *y = ty; - if (w) *w = tw; - if (h) *h = th; - - return EINA_TRUE; -} -// TIZEN ONLY - END - void _edje_entry_input_panel_layout_set(Edje_Real_Part *rp, Edje_Input_Panel_Layout layout) { diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index 5750895..445bdc0 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -856,7 +856,7 @@ struct _Edje_Part Edje_Part_Description_List other; /* other possible descriptors */ - const char *source, *source2, *source3, *source4, *source5, *source6; + const char *source, *source2, *source3, *source4, *source5, *source6, *source7, *source8, *source9, *source10, *source11; int id; /* its id number */ int clip_to_id; /* the part id to clip this one to */ Edje_Part_Dragable dragable; @@ -2089,8 +2089,12 @@ Eina_Bool _edje_entry_input_panel_return_key_disabled_get(Edje_Real_Part *rp); ///////////////////////////// TIZEN ONLY : START ///////////////////////////////////////////////////////////////////////////// Eina_Bool _edje_entry_selection_geometry_get(Edje_Real_Part *rp, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); -void _edje_entry_viewport_object_set(Edje_Real_Part *rp, Evas_Object *obj); - +void _edje_entry_layout_region_set(Edje_Real_Part *rp, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); +void _edje_entry_viewport_region_set(Edje_Real_Part *rp, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); +void _edje_entry_selection_handler_geometry_get(Edje_Real_Part *rp, Edje_Selection_Handler type, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); +Eina_Bool _edje_entry_select_word(Edje_Real_Part *rp); +Eina_Bool _edje_entry_cursor_handler_disabled_get(Edje_Real_Part *rp); +void _edje_entry_cursor_handler_disabled_set(Edje_Real_Part *rp, Eina_Bool disabled); /* Currently, this is only for freezing and thawing the cursor's movement while style change.(130129) */ void _edje_entry_freeze(Edje_Real_Part *rp); void _edje_entry_thaw(Edje_Real_Part *rp); diff --git a/src/lib/edje_util.c b/src/lib/edje_util.c index ee0c2e6..9fb5cf1 100644 --- a/src/lib/edje_util.c +++ b/src/lib/edje_util.c @@ -1602,6 +1602,24 @@ edje_object_part_text_select_all(const Evas_Object *obj, const char *part) } EAPI void +edje_object_part_text_select_word(const Evas_Object *obj, const char *part) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return; + rp = _edje_real_part_recursive_get(ed, part); + if (!rp) return; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + { + _edje_entry_select_word(rp); + _edje_emit(rp->edje, "selection,end", rp->part->name); + } +} + + +EAPI void edje_object_part_text_insert(Evas_Object *obj, const char *part, const char *text) { Edje *ed; @@ -1709,7 +1727,7 @@ edje_object_part_text_item_geometry_get(const Evas_Object *obj, const char *part } EAPI void -edje_object_part_text_copy_paste_disabled_set(const Evas_Object *obj, const char *part, Eina_Bool disabled) +edje_object_part_text_viewport_region_set(const Evas_Object *obj, const char *part, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { Edje *ed; Edje_Real_Part *rp; @@ -1719,12 +1737,12 @@ edje_object_part_text_copy_paste_disabled_set(const Evas_Object *obj, const char rp = _edje_real_part_recursive_get(ed, (char *)part); if (!rp) return; if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) - _edje_entry_copy_paste_disabled_set(rp, disabled); + _edje_entry_viewport_region_set(rp, x, y, w, h); return; } EAPI void -edje_object_part_text_viewport_region_set(const Evas_Object *obj, const char *part, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +edje_object_part_text_layout_region_set(const Evas_Object *obj, const char *part, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) { Edje *ed; Edje_Real_Part *rp; @@ -1734,12 +1752,41 @@ edje_object_part_text_viewport_region_set(const Evas_Object *obj, const char *pa rp = _edje_real_part_recursive_get(ed, (char *)part); if (!rp) return; if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) - _edje_entry_viewport_region_set(rp, x, y, w, h); + _edje_entry_layout_region_set(rp, x, y, w, h); return; } +EAPI Eina_Bool +edje_object_part_text_selection_handler_geometry_get(const Evas_Object *obj, const char *part, Edje_Selection_Handler type, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return EINA_FALSE; + rp = _edje_real_part_recursive_get(ed, (char *)part); + if (!rp) return EINA_FALSE; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + _edje_entry_selection_handler_geometry_get(rp, type, x, y, w, h); + return EINA_TRUE; +} + +EAPI Eina_Bool +edje_object_part_text_cursor_handler_disabled_get(const Evas_Object *obj, const char *part) +{ + Edje *ed; + Edje_Real_Part *rp; + + ed = _edje_fetch(obj); + if ((!ed) || (!part)) return EINA_FALSE; + rp = _edje_real_part_recursive_get(ed, (char *)part); + if (!rp) return EINA_FALSE; + if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) + return _edje_entry_cursor_handler_disabled_get(rp); +} + EAPI void -edje_object_part_text_layout_region_set(const Evas_Object *obj, const char *part, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h) +edje_object_part_text_cursor_handler_disabled_set(Evas_Object *obj, const char *part, Eina_Bool disabled) { Edje *ed; Edje_Real_Part *rp; @@ -1749,8 +1796,7 @@ edje_object_part_text_layout_region_set(const Evas_Object *obj, const char *part rp = _edje_real_part_recursive_get(ed, (char *)part); if (!rp) return; if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) - _edje_entry_layout_region_set(rp, x, y, w, h); - return; + _edje_entry_cursor_handler_disabled_set(rp, disabled); } EAPI void