Remove selection handlers (and move to elm)

Summary:
Selection handlers are now implemented in elementary. So, we should remove them from edje.
The BLOCK_HANDLE mode should be removed also.

Reviewers: cedric, tasn

CC: cedric, raster

Differential Revision: https://phab.enlightenment.org/D312
This commit is contained in:
Thiep Ha 2013-11-08 17:30:44 +09:00 committed by Carsten Haitzler (Rasterman)
parent 6e3ead1936
commit 44639b2098
11 changed files with 15 additions and 313 deletions

View File

@ -68,7 +68,7 @@ syn keyword cConstant SCRIPT LUA_SCRIPT
syn keyword cConstant DRAG_VAL_SET DRAG_VAL_STEP DRAG_VAL_PAGE syn keyword cConstant DRAG_VAL_SET DRAG_VAL_STEP DRAG_VAL_PAGE
syn keyword cConstant LINEAR SINUSOIDAL ACCELERATE DECELERATE SPRING syn keyword cConstant LINEAR SINUSOIDAL ACCELERATE DECELERATE SPRING
syn keyword cConstant VERTICAL HORIZONTAL ON_HOLD BOTH EDITABLE syn keyword cConstant VERTICAL HORIZONTAL ON_HOLD BOTH EDITABLE
syn keyword cConstatn DEFAULT EXPLICIT BLOCK_HANDLE syn keyword cConstatn DEFAULT EXPLICIT
syn keyword cConstant CURRENT syn keyword cConstant CURRENT
syn keyword cConstant FOCUS_SET "default" NEITHER syn keyword cConstant FOCUS_SET "default" NEITHER
syn keyword cConstant DYNAMIC STATIC PASSWORD syn keyword cConstant DYNAMIC STATIC PASSWORD

View File

@ -63,7 +63,7 @@ syn keyword edcConstant ACCEL_FAC DECEL_FAC SIN_FAC DIVISOR_INTERP
syn keyword edcConstant ACCELERATE_FACTOR DECELERATE_FACTOR syn keyword edcConstant ACCELERATE_FACTOR DECELERATE_FACTOR
syn keyword edcConstant VERTICAL HORIZONTAL BOTH BOX TABLE syn keyword edcConstant VERTICAL HORIZONTAL BOTH BOX TABLE
syn keyword edcConstant EDITABLE PASSWORD "default" syn keyword edcConstant EDITABLE PASSWORD "default"
syn keyword edcConstant DEFAULT EXPLICIT BLOCK_HANDLE syn keyword edcConstant DEFAULT EXPLICIT
syn keyword edcConstant SOLID syn keyword edcConstant SOLID
syn keyword edcTodo contained TODO FIXME XXX syn keyword edcTodo contained TODO FIXME XXX

View File

@ -226,8 +226,6 @@ 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_source4(void);
static void st_collections_group_parts_part_source5(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_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_entry_mode(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_select_mode(void);
static void st_collections_group_parts_part_cursor_mode(void); static void st_collections_group_parts_part_cursor_mode(void);
@ -524,8 +522,6 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.parts.part.source4", st_collections_group_parts_part_source4}, {"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.source5", st_collections_group_parts_part_source5},
{"collections.group.parts.part.source6", st_collections_group_parts_part_source6}, {"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.dragable.x", st_collections_group_parts_part_dragable_x}, {"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.y", st_collections_group_parts_part_dragable_y},
{"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine}, {"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine},
@ -2803,8 +2799,6 @@ st_collections_group_inherit(void)
ep->source4 = STRDUP(ep2->source4); ep->source4 = STRDUP(ep2->source4);
ep->source5 = STRDUP(ep2->source5); ep->source5 = STRDUP(ep2->source5);
ep->source6 = STRDUP(ep2->source6); ep->source6 = STRDUP(ep2->source6);
ep->source7 = STRDUP(ep2->source7);
ep->source8 = STRDUP(ep2->source8);
data_queue_copied_part_lookup(pc, &(ep2->clip_to_id), &(ep->clip_to_id)); data_queue_copied_part_lookup(pc, &(ep2->clip_to_id), &(ep->clip_to_id));
@ -4096,48 +4090,6 @@ st_collections_group_parts_part_source6(void)
data_queue_group_lookup(current_part->source6, current_part); data_queue_group_lookup(current_part->source6, current_part);
} }
/**
@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 the 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 the 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 @page edcref
@ -4251,8 +4203,6 @@ st_collections_group_parts_part_entry_mode(void)
@li EXPLICIT mode requires the application @li EXPLICIT mode requires the application
controlling the edje object has to explicitly begin and end selection controlling the edje object has to explicitly begin and end selection
modes, and the selection itself is dragable at both ends. modes, and the selection itself is dragable at both ends.
@li BLOCK_HANDLE is based on EXPLICIT mode and adds selection handlers
on both sides.
@endproperty @endproperty
*/ */
static void static void
@ -4263,7 +4213,6 @@ st_collections_group_parts_part_select_mode(void)
current_part->select_mode = parse_enum(0, current_part->select_mode = parse_enum(0,
"DEFAULT", EDJE_ENTRY_SELECTION_MODE_DEFAULT, "DEFAULT", EDJE_ENTRY_SELECTION_MODE_DEFAULT,
"EXPLICIT", EDJE_ENTRY_SELECTION_MODE_EXPLICIT, "EXPLICIT", EDJE_ENTRY_SELECTION_MODE_EXPLICIT,
"BLOCK_HANDLE", EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE,
NULL); NULL);
} }

View File

@ -336,8 +336,6 @@ _edje_collection_convert(Eet_File *ef, Edje_Part_Collection_Directory_Entry *ce,
replacement->source4 = part->source4; replacement->source4 = part->source4;
replacement->source5 = part->source5; replacement->source5 = part->source5;
replacement->source6 = part->source6; replacement->source6 = part->source6;
replacement->source7 = part->source7;
replacement->source8 = part->source8;
replacement->id = part->id; replacement->id = part->id;
replacement->clip_to_id = part->clip_to_id; replacement->clip_to_id = part->clip_to_id;
replacement->dragable = part->dragable; replacement->dragable = part->dragable;

View File

@ -92,7 +92,7 @@ struct _Old_Edje_Part
const char *name; /* the name if any of the part */ const char *name; /* the name if any of the part */
Old_Edje_Part_Description *default_desc; /* the part descriptor for default */ Old_Edje_Part_Description *default_desc; /* the part descriptor for default */
Eina_List *other_desc; /* other possible descriptors */ Eina_List *other_desc; /* other possible descriptors */
const char *source, *source2, *source3, *source4, *source5, *source6, *source7, *source8; const char *source, *source2, *source3, *source4, *source5, *source6;
int id; /* its id number */ int id; /* its id number */
int clip_to_id; /* the part id to clip this one to */ int clip_to_id; /* the part id to clip this one to */
Edje_Part_Dragable dragable; Edje_Part_Dragable dragable;

View File

@ -422,8 +422,6 @@ _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, "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, "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, "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_LIST(_edje_edd_old_edje_part, Old_Edje_Part, "items", items, _edje_edd_old_edje_pack_element); 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.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); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_old_edje_part, Old_Edje_Part, "api.description", api.description, EET_T_STRING);

View File

@ -377,8 +377,6 @@ _edje_collection_convert(Edje_File *file, Old_Edje_Part_Collection *oedc)
replacement->source4 = part->source4; replacement->source4 = part->source4;
replacement->source5 = part->source5; replacement->source5 = part->source5;
replacement->source6 = part->source6; replacement->source6 = part->source6;
replacement->source7 = part->source7;
replacement->source8 = part->source8;
replacement->id = part->id; replacement->id = part->id;
replacement->clip_to_id = part->clip_to_id; replacement->clip_to_id = part->clip_to_id;
replacement->dragable = part->dragable; replacement->dragable = part->dragable;

View File

@ -89,7 +89,7 @@ struct _Old_Edje_Part
const char *name; /* the name if any of the part */ const char *name; /* the name if any of the part */
Old_Edje_Part_Description *default_desc; /* the part descriptor for default */ Old_Edje_Part_Description *default_desc; /* the part descriptor for default */
Eina_List *other_desc; /* other possible descriptors */ Eina_List *other_desc; /* other possible descriptors */
const char *source, *source2, *source3, *source4, *source5, *source6, *source7, *source8; const char *source, *source2, *source3, *source4, *source5, *source6;
int id; /* its id number */ int id; /* its id number */
int clip_to_id; /* the part id to clip this one to */ int clip_to_id; /* the part id to clip this one to */
Edje_Part_Dragable dragable; Edje_Part_Dragable dragable;

View File

@ -971,8 +971,6 @@ _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, "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, "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, "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, "id", id, EET_T_INT); 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, "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); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part, Edje_Part, "dragable.x", dragable.x, EET_T_CHAR);

View File

@ -23,7 +23,6 @@ struct _Entry
Evas_Coord ox, oy; Evas_Coord ox, oy;
Evas_Object *cursor_bg; Evas_Object *cursor_bg;
Evas_Object *cursor_fg, *cursor_fg2; Evas_Object *cursor_fg, *cursor_fg2;
Evas_Object *sel_handler_start, *sel_handler_end;
Evas_Textblock_Cursor *cursor; Evas_Textblock_Cursor *cursor;
Evas_Textblock_Cursor *sel_start, *sel_end; Evas_Textblock_Cursor *sel_start, *sel_end;
Evas_Textblock_Cursor *cursor_user, *cursor_user_extra; Evas_Textblock_Cursor *cursor_user, *cursor_user_extra;
@ -554,13 +553,6 @@ _sel_extend(Edje *ed, Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
_sel_enable(ed, c, o, en); _sel_enable(ed, c, o, en);
if (!evas_textblock_cursor_compare(c, en->sel_end)) return; if (!evas_textblock_cursor_compare(c, en->sel_end)) return;
if (en->sel_handler_start && en->sel_handler_end)
{
/* Do NOT allow sel_handler_end pass sel_handler_start */
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);
}
evas_textblock_cursor_copy(c, en->sel_end); evas_textblock_cursor_copy(c, en->sel_end);
_edje_entry_imf_cursor_info_set(en); _edje_entry_imf_cursor_info_set(en);
@ -580,13 +572,6 @@ _sel_preextend(Edje *ed, Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
_sel_enable(ed, c, o, en); _sel_enable(ed, c, o, en);
if (!evas_textblock_cursor_compare(c, en->sel_start)) return; if (!evas_textblock_cursor_compare(c, en->sel_start)) return;
if (en->sel_handler_start && en->sel_handler_end)
{
/* Do NOT allow sel_handler_start pass sel_handler_end */
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);
}
evas_textblock_cursor_copy(c, en->sel_start); evas_textblock_cursor_copy(c, en->sel_start);
_edje_entry_imf_cursor_info_set(en); _edje_entry_imf_cursor_info_set(en);
@ -630,10 +615,6 @@ _sel_clear(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o EINA_U
en->have_selection = EINA_FALSE; en->have_selection = EINA_FALSE;
_edje_emit(ed, "selection,cleared", en->rp->part->name); _edje_emit(ed, "selection,cleared", en->rp->part->name);
} }
if (en->sel_handler_start)
edje_object_signal_emit(en->sel_handler_start, "edje,handler,hide", "edje");
if (en->sel_handler_end)
edje_object_signal_emit(en->sel_handler_end, "edje,handler,hide", "edje");
} }
static void static void
@ -694,15 +675,11 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr
evas_object_geometry_get(o, &x, &y, &w, &h); evas_object_geometry_get(o, &x, &y, &w, &h);
if (en->have_selection) if (en->have_selection)
{ {
int lc, li = 0;
lc = eina_list_count(en->sel);
EINA_LIST_FOREACH(en->sel, l, sel) EINA_LIST_FOREACH(en->sel, l, sel)
{ {
Evas_Textblock_Rectangle *r; Evas_Textblock_Rectangle *r;
r = range->data; r = range->data;
li++;
if (sel->obj_bg) if (sel->obj_bg)
{ {
evas_object_move(sel->obj_bg, x + r->x, y + r->y); evas_object_move(sel->obj_bg, x + r->x, y + r->y);
@ -713,19 +690,6 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr
evas_object_move(sel->obj_fg, x + r->x, y + r->y); evas_object_move(sel->obj_fg, x + r->x, y + r->y);
evas_object_resize(sel->obj_fg, r->w, r->h); evas_object_resize(sel->obj_fg, r->w, r->h);
} }
if (en->rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
{
if (li == 1)
{
evas_object_move(en->sel_handler_start, x + r->x, y + r->y + r->h);
edje_object_signal_emit(en->sel_handler_start, "edje,handler,show", "edje");
}
if (li == lc)
{
evas_object_move(en->sel_handler_end, x + r->x + r->w, y + r->y + r->h);
edje_object_signal_emit(en->sel_handler_end, "edje,handler,show", "edje");
}
}
*(&(sel->rect)) = *r; *(&(sel->rect)) = *r;
range = eina_list_remove_list(range, range); range = eina_list_remove_list(range, range);
free(r); free(r);
@ -741,172 +705,6 @@ _sel_update(Edje *ed, Evas_Textblock_Cursor *c EINA_UNUSED, Evas_Object *o, Entr
} }
} }
static void
_edje_start_handler_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Event_Mouse_Down *ev = event_info;
Edje_Real_Part *rp = data;
Evas_Coord ex, ey;
Evas_Coord cx, cy, cw, ch;
Evas_Textblock_Cursor_Type cur_type;
Entry *en;
if (ev->button != 1) return;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return;
en = rp->typedata.text->entry_data;
_edje_entry_cursor_copy(rp, EDJE_CURSOR_SELECTION_BEGIN, EDJE_CURSOR_MAIN);
evas_object_geometry_get(rp->object, &ex, &ey, NULL, NULL);
switch (rp->part->cursor_mode)
{
case EDJE_ENTRY_CURSOR_MODE_BEFORE:
cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
break;
case EDJE_ENTRY_CURSOR_MODE_UNDER:
/* no break for a reason */
default:
cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
}
evas_textblock_cursor_geometry_get(en->sel_start, &cx, &cy, &cw, &ch, NULL, cur_type);
en->ox = ev->canvas.x - (ex + cx + cw/2);
en->oy = ev->canvas.y - (ey + cy + ch/2);
en->select_mod_start = EINA_TRUE;
en->selecting = EINA_TRUE;
_edje_emit(en->ed, "handler,move,start", rp->part->name);
}
static void
_edje_start_handler_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Edje_Real_Part *rp = data;
Entry *en;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return;
en = rp->typedata.text->entry_data;
en->selecting = EINA_FALSE;
en->select_mod_start = EINA_FALSE;
_edje_emit(en->ed, "handler,move,end", rp->part->name);
}
static void
_edje_start_handler_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Event_Mouse_Move *ev = event_info;
Edje_Real_Part *rp = data;
Entry *en;
Evas_Coord ex, ey;
Evas_Coord cx, cy;
if (ev->buttons != 1) return;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return;
en = rp->typedata.text->entry_data;
evas_object_geometry_get(rp->object, &ex, &ey, NULL, NULL);
cx = ev->cur.canvas.x - en->ox - ex;
cy = ev->cur.canvas.y - en->oy - ey;
if (cx <= 0) cx = 1;
evas_textblock_cursor_char_coord_set(en->cursor, cx, cy);
if (en->select_allow)
{
if (en->select_mod_start)
_sel_preextend(en->ed, en->cursor, rp->object, en);
}
_edje_entry_real_part_configure(en->ed, rp);
_edje_emit(en->ed, "handler,moving", rp->part->name);
}
static void
_edje_end_handler_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Event_Mouse_Down *ev = event_info;
Edje_Real_Part *rp = data;
Entry *en;
Evas_Coord ex, ey;
Evas_Coord cx, cy, cw, ch;
Evas_Textblock_Cursor_Type cur_type;
if (ev->button != 1) return;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return;
en = rp->typedata.text->entry_data;
_edje_entry_cursor_copy(rp, EDJE_CURSOR_SELECTION_END, EDJE_CURSOR_MAIN);
evas_object_geometry_get(rp->object, &ex, &ey, NULL, NULL);
switch (rp->part->cursor_mode)
{
case EDJE_ENTRY_CURSOR_MODE_BEFORE:
cur_type = EVAS_TEXTBLOCK_CURSOR_BEFORE;
break;
case EDJE_ENTRY_CURSOR_MODE_UNDER:
/* no break for a reason */
default:
cur_type = EVAS_TEXTBLOCK_CURSOR_UNDER;
}
evas_textblock_cursor_geometry_get(en->sel_end, &cx, &cy, &cw, &ch, NULL, cur_type);
en->ox = ev->canvas.x - (ex + cx + cw/2);
en->oy = ev->canvas.y - (ey + cy + ch/2);
en->select_mod_end = EINA_TRUE;
en->selecting = EINA_TRUE;
_edje_emit(en->ed, "handler,move,start", rp->part->name);
}
static void
_edje_end_handler_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Edje_Real_Part *rp = data;
Entry *en;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return;
en = rp->typedata.text->entry_data;
en->selecting = EINA_FALSE;
en->select_mod_end = EINA_FALSE;
_edje_emit(en->ed, "handler,move,end", rp->part->name);
}
static void
_edje_end_handler_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Event_Mouse_Move *ev = event_info;
Edje_Real_Part *rp = data;
Entry *en;
Evas_Coord ex, ey;
Evas_Coord cx, cy;
if (ev->buttons != 1) return;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||
(!rp->typedata.text)) return;
en = rp->typedata.text->entry_data;
evas_object_geometry_get(rp->object, &ex, &ey, NULL, NULL);
cx = ev->cur.canvas.x - en->ox - ex;
cy = ev->cur.canvas.y - en->oy - ey;
if (cx <= 0) cx = 1;
evas_textblock_cursor_char_coord_set(en->cursor, cx, cy);
if (en->select_allow)
{
if (en->select_mod_end)
_sel_extend(en->ed, en->cursor, rp->object, en);
}
_edje_entry_real_part_configure(en->ed, rp);
_edje_emit(en->ed, "handler,moving", rp->part->name);
}
static void static void
_edje_anchor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) _edje_anchor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{ {
@ -2229,8 +2027,7 @@ _edje_part_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
if (dosel) if (dosel)
{ {
if ((en->have_selection) && if ((en->have_selection) &&
((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) || (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT))
(rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)))
{ {
if (shift) if (shift)
_sel_extend(en->ed, en->cursor, rp->object, en); _sel_extend(en->ed, en->cursor, rp->object, en);
@ -2386,8 +2183,7 @@ _edje_part_mouse_up_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UN
} }
} }
} }
if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) || if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)
(rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
{ {
if (en->select_allow) if (en->select_allow)
{ {
@ -2486,8 +2282,7 @@ _edje_part_mouse_move_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
_curs_lin_end(en->cursor, rp->object, en); _curs_lin_end(en->cursor, rp->object, en);
} }
} }
if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) || if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)
(rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
{ {
if (en->select_allow) if (en->select_allow)
{ {
@ -2640,36 +2435,6 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp)
evas_object_pass_events_set(en->cursor_fg, EINA_TRUE); evas_object_pass_events_set(en->cursor_fg, EINA_TRUE);
_edje_subobj_register(ed, en->cursor_fg); _edje_subobj_register(ed, en->cursor_fg);
if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE)
{
if (rp->part->source7)
{
en->sel_handler_start = edje_object_add(ed->base->evas);
edje_object_file_set(en->sel_handler_start, ed->path, rp->part->source7);
evas_object_show(en->sel_handler_start);
_edje_subobj_register(ed, en->sel_handler_start);
evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_DOWN,
_edje_start_handler_mouse_down_cb, rp);
evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_UP,
_edje_start_handler_mouse_up_cb, rp);
evas_object_event_callback_add(en->sel_handler_start, EVAS_CALLBACK_MOUSE_MOVE,
_edje_start_handler_mouse_move_cb, rp);
}
if (rp->part->source8)
{
en->sel_handler_end = edje_object_add(ed->base->evas);
edje_object_file_set(en->sel_handler_end, ed->path, rp->part->source8);
evas_object_show(en->sel_handler_end);
_edje_subobj_register(ed, en->sel_handler_end);
evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_DOWN,
_edje_end_handler_mouse_down_cb, rp);
evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_UP,
_edje_end_handler_mouse_up_cb, rp);
evas_object_event_callback_add(en->sel_handler_end, EVAS_CALLBACK_MOUSE_MOVE,
_edje_end_handler_mouse_move_cb, rp);
}
}
/* A proxy to the main cursor. */ /* A proxy to the main cursor. */
if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE) if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
{ {
@ -2766,16 +2531,6 @@ _edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp)
evas_object_del(en->cursor_bg); evas_object_del(en->cursor_bg);
evas_object_del(en->cursor_fg); evas_object_del(en->cursor_fg);
evas_object_del(en->cursor_fg2); evas_object_del(en->cursor_fg2);
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->pw_timer) if (en->pw_timer)
{ {
@ -3838,6 +3593,13 @@ _edje_entry_cursor_coord_set(Edje_Real_Part *rp, Edje_Cursor cur,
{ {
Evas_Textblock_Cursor *c = _cursor_get(rp, cur); Evas_Textblock_Cursor *c = _cursor_get(rp, cur);
if (!c) return EINA_FALSE; if (!c) return EINA_FALSE;
Entry *en = rp->typedata.text->entry_data;
if ((cur == EDJE_CURSOR_SELECTION_BEGIN) ||
(cur == EDJE_CURSOR_SELECTION_END))
{
if (en->have_selection)
_edje_emit(en->ed, "selection,changed", rp->part->name);
}
return evas_textblock_cursor_char_coord_set(c, x, y); return evas_textblock_cursor_char_coord_set(c, x, y);
} }

View File

@ -433,7 +433,6 @@ typedef struct _Edje_Signal_Callback_Custom Edje_Signal_Callback_Custom;
#define EDJE_ENTRY_SELECTION_MODE_DEFAULT 0 #define EDJE_ENTRY_SELECTION_MODE_DEFAULT 0
#define EDJE_ENTRY_SELECTION_MODE_EXPLICIT 1 #define EDJE_ENTRY_SELECTION_MODE_EXPLICIT 1
#define EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE 2
#define EDJE_ENTRY_CURSOR_MODE_UNDER 0 #define EDJE_ENTRY_CURSOR_MODE_UNDER 0
#define EDJE_ENTRY_CURSOR_MODE_BEFORE 1 #define EDJE_ENTRY_CURSOR_MODE_BEFORE 1
@ -989,7 +988,7 @@ struct _Edje_Part
Edje_Part_Description_List other; /* other possible descriptors */ Edje_Part_Description_List other; /* other possible descriptors */
const char *source, *source2, *source3, *source4, *source5, *source6, *source7, *source8; const char *source, *source2, *source3, *source4, *source5, *source6;
int id; /* its id number */ int id; /* its id number */
int clip_to_id; /* the part id to clip this one to */ int clip_to_id; /* the part id to clip this one to */
Edje_Part_Dragable dragable; Edje_Part_Dragable dragable;