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_entry_mode(void);
static void st_collections_group_parts_part_select_mode(void);
static void st_collections_group_parts_part_cursor_mode(void);
{"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.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},
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);
data_queue_copied_part_lookup(pc, &(ep2->clip_to_id), &(ep->clip_to_id));
/**
@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
@property
effect
current_part->select_mode = parse_enum(0,
"DEFAULT", EDJE_ENTRY_SELECTION_MODE_DEFAULT,
"EXPLICIT", EDJE_ENTRY_SELECTION_MODE_EXPLICIT,
- "BLOCK_HANDLE", EDJE_ENTRY_SELECTION_MODE_DEFAULT,
+ "BLOCK_HANDLE", EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE,
NULL);
}
{
Edje_Real_Part *rp;
Edje *ed;
+ Evas_Coord ox, oy;
Evas_Object *cursor_bg;
Evas_Object *cursor_fg, *cursor_fg2;
+ Evas_Object *sel_handler_start, *sel_handler_end;
Evas_Textblock_Cursor *cursor;
Evas_Textblock_Cursor *sel_start, *sel_end;
Evas_Textblock_Cursor *cursor_user, *cursor_user_extra;
if (!en->sel_end) return;
_sel_enable(ed, c, o, en);
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);
_edje_entry_imf_cursor_info_set(en);
if (!en->sel_end) return;
_sel_enable(ed, c, o, en);
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);
_edje_entry_imf_cursor_info_set(en);
en->have_selection = EINA_FALSE;
_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
evas_object_geometry_get(o, &x, &y, &w, &h);
if (en->have_selection)
{
+ int lc, li = 0;
+ lc = eina_list_count(en->sel);
+
EINA_LIST_FOREACH(en->sel, l, sel)
{
Evas_Textblock_Rectangle *r;
r = range->data;
+ li++;
if (sel->obj_bg)
{
evas_object_move(sel->obj_bg, 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);
}
+ 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;
range = eina_list_remove_list(range, range);
free(r);
}
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;
+
+ 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;
+
+ 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,end", 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
_edje_anchor_mouse_down_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Anchor *an = data;
en->select_mod_end = EINA_FALSE;
if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
dosel = EINA_TRUE;
- else if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)
+ else if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) ||
+ (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_BLOCK_HANDLE))
{
if (en->select_allow) dosel = EINA_TRUE;
}
if (dosel)
{
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)
_sel_extend(en->ed, 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)
{
_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)
{
evas_object_pass_events_set(en->cursor_fg, EINA_TRUE);
_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. */
if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
{
evas_object_del(en->cursor_bg);
evas_object_del(en->cursor_fg);
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)
{