/* TIZEN_ONLY(20160920): Add fade_ellipsis feature to TEXTBLOCK, TEXT part. */
static void st_collections_group_parts_part_description_text_fade_ellipsis(void);
/* END */
+//TIZEN_ONLY(20160923): introduction of text marquee
+static void st_collections_group_parts_part_description_text_ellipsize_mode(void);
+static void st_collections_group_parts_part_description_text_ellipsize_marquee_repeat_limit(void);
+//
static void st_collections_group_parts_part_description_box_layout(void);
static void st_collections_group_parts_part_description_box_align(void);
static void st_collections_group_parts_part_description_box_padding(void);
{"collections.group.parts.part.description.text.fonts.font", st_fonts_font}, /* dup */
{"collections.group.parts.part.description.text.elipsis", st_collections_group_parts_part_description_text_ellipsis},
{"collections.group.parts.part.description.text.ellipsis", st_collections_group_parts_part_description_text_ellipsis},
+ //TIZEN_ONLY(20160923): introduction of text marquee
+ {"collections.group.parts.part.description.text.ellipsize.mode", st_collections_group_parts_part_description_text_ellipsize_mode},
+ {"collections.group.parts.part.description.text.ellipsize.marquee_repeat_limit", st_collections_group_parts_part_description_text_ellipsize_marquee_repeat_limit},
+ //
{"collections.group.parts.part.description.text.filter", st_collections_group_parts_part_description_filter_code}, /* dup */
/* TIZEN_ONLY(20160920): Add fade_ellipsis feature to TEXTBLOCK, TEXT part. */
{"collections.group.parts.part.description.text.fade_ellipsis", st_collections_group_parts_part_description_text_fade_ellipsis},
{"collections.group.parts.part.description.fill.origin", NULL},
{"collections.group.parts.part.description.fill.size", NULL},
{"collections.group.parts.part.description.text", NULL},
+ {"collections.group.parts.part.description.text.ellipsize", NULL},
{"collections.group.parts.part.description.text.fonts", NULL}, /* dup */
{"collections.group.parts.part.description.images", NULL}, /* dup */
{"collections.group.parts.part.description.images.set", ob_images_set}, /* dup */
/* TIZEN_ONLY(20160920): Add fade_ellipsis feature to TEXTBLOCK, TEXT part. */
ed->text.fade_ellipsis = FROM_DOUBLE(0.0);
/* END */
+ //TIZEN_ONLY(20160923): introduction of text marquee
+ ed->text.ellipsize.marquee_repeat_limit = -1;
+ //
result = &ed->common;
break;
}
/* END */
+//TIZEN_ONLY(20160923): introduction of text marquee
+static void
+st_collections_group_parts_part_description_text_ellipsize_mode(void)
+{
+ Edje_Part_Description_Text *ed;
+
+ check_arg_count(1);
+
+ if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
+ (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ {
+ ERR("parse error %s:%i. text attributes in non-TEXT part.",
+ file_in, line - 1);
+ exit(-1);
+ }
+
+ ed = (Edje_Part_Description_Text*) current_desc;
+
+ ed->text.ellipsize.mode = parse_enum(0,
+ "NONE", EDJE_TEXT_ELLIPSIZE_MODE_NONE,
+ "START", EDJE_TEXT_ELLIPSIZE_MODE_START,
+ "MIDDLE", EDJE_TEXT_ELLIPSIZE_MODE_MIDDLE,
+ "END", EDJE_TEXT_ELLIPSIZE_MODE_END,
+ "FADE_START", EDJE_TEXT_ELLIPSIZE_MODE_FADE_START,
+ "FADE_END", EDJE_TEXT_ELLIPSIZE_MODE_FADE_END,
+ "MARQUEE", EDJE_TEXT_ELLIPSIZE_MODE_MARQUEE,
+ NULL);
+}
+
+static void
+st_collections_group_parts_part_description_text_ellipsize_marquee_repeat_limit(void)
+{
+ Edje_Part_Description_Text *ed;
+
+ check_arg_count(1);
+
+ if ((current_part->type != EDJE_PART_TYPE_TEXT) &&
+ (current_part->type != EDJE_PART_TYPE_TEXTBLOCK))
+ {
+ ERR("parse error %s:%i. text attributes in non-TEXT part.",
+ file_in, line - 1);
+ exit(-1);
+ }
+
+ ed = (Edje_Part_Description_Text*) current_desc;
+
+ ed->text.ellipsize.marquee_repeat_limit = parse_int_range(0, -1, 0x7fffffff);
+}
+//
/** @edcsubsection{collections_group_parts_description_box,
* Group.Parts.Part.Description.Box} */
Edje_Part_Description_Common *last_desc;
Eina_Bool change_w, change_h;
Edje_Part_Description_Image *epdi;
+ //TIZEN_ONLY(20160923): introduction of text marquee
+ Edje_Part_Description_Text *last_desc_text;
+ Edje_Part_Description_Text *desc_text;
+ //
if (!d1) d1 = "default";
edje_object_mirrored_set(ep->typedata.swallow->swallowed_object,
edje_object_mirrored_get(ed->obj));
}
+ //TIZEN_ONLY(20160923): introduction of text marquee
+ /* reset margquee_repeat_count */
+ else if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK ||
+ ep->part->type == EDJE_PART_TYPE_TEXT)
+ {
+ if (last_desc)
+ {
+ last_desc_text = (Edje_Part_Description_Text *)last_desc;
+ last_desc_text->text.ellipsize.marquee_repeat_count = 0;
+
+ desc_text = (Edje_Part_Description_Text *)ep->chosen_description;
+ if (ep->part->type == EDJE_PART_TYPE_TEXT)
+ {
+ if (desc_text->text.ellipsize.mode == EDJE_TEXT_ELLIPSIZE_MODE_MARQUEE)
+ {
+ desc_text->text.ellipsis = -1;
+ evas_object_text_ellipsis_set(ep->object, -1.0);
+ }
+ else if ((last_desc_text->text.ellipsize.mode == EDJE_TEXT_ELLIPSIZE_MODE_MARQUEE) &&
+ (last_desc_text->text.ellipsize.mode != desc_text->text.ellipsize.mode))
+ {
+ //FIXME: Need to enhancement using other ellipsize modes
+ evas_object_text_ellipsis_set(ep->object, desc_text->text.ellipsis);
+ evas_object_resize(ep->object, ep->w, ep->h);
+ }
+ }
+ else if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
+ {
+ if (desc_text->text.ellipsize.mode == EDJE_TEXT_ELLIPSIZE_MODE_MARQUEE)
+ {
+ evas_object_textblock_ellipsis_disabled_set(ep->object, EINA_TRUE);
+ }
+ else if (last_desc_text->text.ellipsize.mode == EDJE_TEXT_ELLIPSIZE_MODE_MARQUEE &&
+ last_desc_text->text.ellipsize.mode != desc_text->text.ellipsize.mode)
+ {
+ //FIXME: Need to enhancement using other ellipsize modes
+ Eina_Bool ellipsis = evas_object_text_ellipsis_get(ep->object);
+ evas_object_textblock_ellipsis_disabled_set(ep->object, ellipsis);
+ }
+ }
+ }
+ }
+ //
}
ed->recalc_hints = EINA_TRUE;
#endif
}
/* END */
+//TIZEN_ONLY(20160923): introduction of text marquee
+static Eina_Bool
+_text_object_marquee_animator(void *data)
+{
+ double cur_time;
+ double elapsed_time;
+ double default_time = 0.025; /* moving 1 px for 0.025 sec makes 40 px/sec */
+ Evas_Coord move_length = 0;
+ Edje_Real_Part *ep;
+ Edje_Part_Description_Text *chosen_desc;
+ Evas_Coord_Rectangle text_cur_area;
+ Evas_Coord_Rectangle clipper_area;
+
+ ep = data;
+ chosen_desc = (Edje_Part_Description_Text *)ep->chosen_description;
+
+ evas_object_geometry_get(ep->object, &text_cur_area.x, &text_cur_area.y,
+ &text_cur_area.w, &text_cur_area.h);
+
+ if (!ep->text_marquee_clipper)
+ {
+ ep->text_marquee_clipper = evas_object_rectangle_add(evas_object_evas_get(ep->object));
+ evas_object_color_set(ep->text_marquee_clipper, 255, 255, 255, 255);
+ evas_object_show(ep->text_marquee_clipper);
+
+ Evas_Object *prev_clipper = evas_object_clip_get(ep->object);
+ if (prev_clipper) evas_object_clip_set(ep->text_marquee_clipper, prev_clipper);
+
+ evas_object_clip_set(ep->object, ep->text_marquee_clipper);
+ evas_object_move(ep->text_marquee_clipper, text_cur_area.x - ep->typedata.text->offset.x,
+ text_cur_area.y - ep->typedata.text->offset.y);
+
+ ep->text_marquee_prev_time = ecore_time_get();
+ }
+
+ evas_object_resize(ep->text_marquee_clipper, ep->w, ep->h);
+ evas_object_geometry_get(ep->text_marquee_clipper, &clipper_area.x, &clipper_area.y,
+ &clipper_area.w, &clipper_area.h);
+
+ cur_time = ecore_time_get();
+ elapsed_time = cur_time - ep->text_marquee_prev_time;
+ default_time = default_time / evas_object_scale_get(ep->object);
+ while (elapsed_time > default_time)
+ {
+ elapsed_time -= default_time;
+ move_length++;
+ }
+
+ ep->text_marquee_prev_time = cur_time - elapsed_time;
+ if (ep->text_marquee_to_left)
+ {
+ if (text_cur_area.x + text_cur_area.w < clipper_area.x)
+ {
+ if (chosen_desc->text.ellipsize.marquee_repeat_limit != -1)
+ chosen_desc->text.ellipsize.marquee_repeat_count++;
+
+ text_cur_area.x = clipper_area.x + clipper_area.w;
+ }
+ else
+ {
+ text_cur_area.x = text_cur_area.x - move_length;
+ }
+ }
+ else
+ {
+ if (text_cur_area.x > clipper_area.x + clipper_area.w)
+ {
+ if (chosen_desc->text.ellipsize.marquee_repeat_limit != -1)
+ chosen_desc->text.ellipsize.marquee_repeat_count++;
+
+ text_cur_area.x = clipper_area.x - text_cur_area.w;
+ }
+ else
+ {
+ text_cur_area.x = text_cur_area.x + move_length;
+ }
+ }
+
+ /* reset text to start point */
+ if (chosen_desc->text.ellipsize.marquee_repeat_limit ==
+ chosen_desc->text.ellipsize.marquee_repeat_count)
+ {
+ evas_object_move(ep->object,
+ chosen_desc->text.ellipsize.marquee_start_point.x,
+ chosen_desc->text.ellipsize.marquee_start_point.y);
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ evas_object_move(ep->object, text_cur_area.x, text_cur_area.y);
+ return ECORE_CALLBACK_RENEW;
+}
+
+static void
+_text_marquee_job(void *data)
+{
+ Edje_Real_Part *ep;
+ Evas_BiDi_Direction dir;
+ Edje_Part_Description_Text *chosen_desc;
+ Evas_Coord_Rectangle text_cur_position;
+
+ ep = data;
+ chosen_desc = (Edje_Part_Description_Text *)ep->chosen_description;
+
+ /* keep marquee start point */
+ evas_object_geometry_get(ep->object, &text_cur_position.x,
+ &text_cur_position.y,
+ NULL, NULL);
+ chosen_desc->text.ellipsize.marquee_start_point.x = text_cur_position.x;
+ chosen_desc->text.ellipsize.marquee_start_point.y = text_cur_position.y;
+
+ if (ep->text_marquee_animator)
+ {
+ ecore_animator_del(ep->text_marquee_animator);
+ ep->text_marquee_animator = NULL;
+ }
+ ep->text_marquee_animator = ecore_animator_add(_text_object_marquee_animator, ep);
+
+ /* check text direction */
+ if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
+ {
+ dir = evas_object_paragraph_direction_get(ep->object);
+ if (dir == EVAS_BIDI_DIRECTION_NEUTRAL)
+ {
+ Evas_Textblock_Cursor *cur;
+ cur = evas_object_textblock_cursor_new(ep->object);
+ evas_textblock_cursor_geometry_get(cur,
+ NULL, NULL, NULL, NULL, &dir,
+ EVAS_TEXTBLOCK_CURSOR_BEFORE);
+ evas_textblock_cursor_free(cur);
+ }
+ }
+ else
+ {
+ dir = evas_object_text_direction_get(ep->object);
+ }
+
+ /* define marquee direction */
+ ep->text_marquee_to_left = (dir != EVAS_BIDI_DIRECTION_RTL);
+
+ ep->text_marquee_job = NULL;
+}
+
+static void
+_text_marquee_clipper_update(Edje_Real_Part *ep, Eina_Bool del_clipper)
+{
+ Evas_Object *prev_clipper;
+ Evas_Coord_Rectangle text_cur_area;
+
+ prev_clipper = evas_object_clip_get(ep->text_marquee_clipper);
+ if (!del_clipper)
+ {
+ /* reset marquee clipper changed in _edje_part_recalc */
+ if (prev_clipper && prev_clipper != ep->text_marquee_clipper)
+ {
+ evas_object_clip_set(ep->text_marquee_clipper, prev_clipper);
+ evas_object_clip_set(ep->object, ep->text_marquee_clipper);
+ }
+
+ evas_object_geometry_get(ep->object, &text_cur_area.x, &text_cur_area.y,
+ &text_cur_area.w, &text_cur_area.h);
+ evas_object_move(ep->text_marquee_clipper, text_cur_area.x - ep->typedata.text->offset.x,
+ text_cur_area.y - ep->typedata.text->offset.y);
+ evas_object_resize(ep->text_marquee_clipper, ep->w, ep->h);
+ }
+ else
+ {
+ evas_object_del(ep->text_marquee_clipper);
+ ep->text_marquee_clipper = NULL;
+
+ if (prev_clipper) evas_object_clip_set(ep->object, prev_clipper);
+ }
+}
+
+static void
+_text_object_del_cb(void *data, EINA_UNUSED Evas *e, EINA_UNUSED Evas_Object *obj, EINA_UNUSED void *event_info)
+{
+ Edje_Real_Part *ep;
+
+ ep = data;
+ if (ep->text_marquee_job)
+ {
+ ecore_job_del(ep->text_marquee_job);
+ ep->text_marquee_job = NULL;
+ }
+
+ if (ep->text_marquee_animator)
+ {
+ ecore_animator_del(ep->text_marquee_animator);
+ ep->text_marquee_animator = NULL;
+ _text_marquee_clipper_update(ep, EINA_TRUE);
+ }
+}
+
+static void
+_edje_text_marquee_apply(Edje *ed EINA_UNUSED, Edje_Real_Part *ep,
+ Edje_Calc_Params *params EINA_UNUSED,
+ Edje_Part_Description_Text *chosen_desc)
+{
+ Eina_Bool is_marquee_on;
+
+ is_marquee_on = ((chosen_desc->text.ellipsize.mode == EDJE_TEXT_ELLIPSIZE_MODE_MARQUEE) &&
+ (chosen_desc->text.ellipsize.marquee_repeat_count !=
+ chosen_desc->text.ellipsize.marquee_repeat_limit));
+
+ if (ep->text_marquee_job)
+ {
+ ecore_job_del(ep->text_marquee_job);
+ ep->text_marquee_job = NULL;
+ }
+
+ if (ep->text_marquee_animator)
+ {
+ ecore_animator_del(ep->text_marquee_animator);
+ ep->text_marquee_animator = NULL;
+ /* in case of marquee mode, do not remove existing clipper */
+ _text_marquee_clipper_update(ep, !is_marquee_on);
+ }
+
+ if (is_marquee_on)
+ {
+ ep->text_marquee_job = ecore_job_add(_text_marquee_job, ep);
+ evas_object_event_callback_add(ep->object, EVAS_CALLBACK_DEL,
+ _text_object_del_cb, ep);
+ }
+}
+//
void
_edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state)
Edje_Calc_Params lp3;
Evas_Coord mmw = 0, mmh = 0;
Eina_Bool map_colors_free = EINA_FALSE;
+ //TIZEN_ONLY(20160923): introduction of text marquee
+ Evas_Coord tw, th;
+ Edje_Part_Description_Text *text_chosen_desc;
+ //
/* GRADIENT ARE GONE, WE MUST IGNORE IT FROM OLD FILE. */
if (ep->part->type == EDJE_PART_TYPE_GRADIENT)
efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y));
#else
eo_do(ep->object,
- efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y),
- efl_gfx_size_set(pf->final.w, pf->final.h));
+ efl_gfx_position_set(ed->x + pf->final.x, ed->y + pf->final.y));
+
+ //TIZEN_ONLY(20160923): introduction of text marquee
+ if(ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
+ {
+ tw = pf->final.w;
+ th = pf->final.h;
+
+ text_chosen_desc = (Edje_Part_Description_Text *)ep->chosen_description;
+ if (text_chosen_desc->text.ellipsize.mode == EDJE_TEXT_ELLIPSIZE_MODE_MARQUEE &&
+ text_chosen_desc->text.ellipsize.marquee_repeat_limit != 0)
+ {
+ eo_do(ep->object,
+ evas_obj_textblock_size_formatted_get(&tw, &th));
+ if (tw < pf->final.w) tw = pf->final.w;
+ if (th < pf->final.h) th = pf->final.h;
+ }
+ eo_do(ep->object,
+ efl_gfx_size_set(tw, th));
+ }
+ //
+ else
+ eo_do(ep->object,
+ efl_gfx_size_set(pf->final.w, pf->final.h));
#endif
if (ep->nested_smart) /* Move, Resize all nested parts */
/* TIZEN_ONLY(20160920): Add fade_ellipsis feature to TEXTBLOCK, TEXT part. */
if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK ||
ep->part->type == EDJE_PART_TYPE_TEXT)
- _edje_fade_ellipsis_apply(ed, ep, pf, (Edje_Part_Description_Text*) chosen_desc);
+ {
+ _edje_fade_ellipsis_apply(ed, ep, pf, (Edje_Part_Description_Text*) chosen_desc);
+ //TIZEN_ONLY(20160923): introduction of text marquee
+ _edje_text_marquee_apply(ed, ep, pf, (Edje_Part_Description_Text *) chosen_desc);
+ //
+ }
/* END */
}