From 3351e928c6555f0a28511fb56fb2e5abce6d21eb Mon Sep 17 00:00:00 2001 From: Youngbok Shin Date: Tue, 1 Aug 2017 20:05:08 +0900 Subject: [PATCH] edje: add text marquee duration set/get APIs for internal usages It also add some missing comments for changes of ellipsize features. @tizen_feature Change-Id: I8e2df138833dbfb4d1b110325eb7c089f1105140 --- src/lib/edje/edje_calc.c | 18 ++++++++++----- src/lib/edje/edje_object.eo | 25 +++++++++++++++++++++ src/lib/edje/edje_private.h | 7 ++++++ src/lib/edje/edje_util.c | 54 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 5 deletions(-) diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index bdbcc8c..a5640d3 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -5378,6 +5378,10 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta * 20170322: fix crash issue when Edje tries to clean up fade object * 20170427: fix clipper loop issue caused by clipper object for fade * 20170703: Add ellipsize feature and refactory fade_ellipsis, marquee features. + * 20170725: fix wrong speed calculation for text marquee's duration. + * 20170725: fix to apply loop_delay even if there is no loop limit. + * 20170725: restore ellipsis state of TEXT part when marquee mode is NONE. + * 20170801: add text marquee duration set/get APIs for internal usages. * **********************************************************************************/ #define EDJE_DEFAULT_FADE_IMAGE "edje_default_fade_image.png" @@ -6489,6 +6493,8 @@ _edje_text_ellipsize_apply(Edje *ed, Edje_Real_Part *ep, if (is_marquee) { + double duration = chosen_desc->text.ellipsize.marquee.duration; + double speed = chosen_desc->text.ellipsize.marquee.speed; Eina_Bool text_marquee_vertical; if (valign != -1.0) @@ -6496,7 +6502,10 @@ _edje_text_ellipsize_apply(Edje *ed, Edje_Real_Part *ep, else text_marquee_vertical = EINA_FALSE; - if (chosen_desc->text.ellipsize.marquee.speed > 0.0) + if (ep->typedata.text->ellipsize.marquee.duration > 0.0) + duration = ep->typedata.text->ellipsize.marquee.duration; + + if (speed > 0.0) { /* Convert px_per_sec (speed) to sec_per_pixel */ FLOAT_T sc = 1.0; @@ -6507,9 +6516,9 @@ _edje_text_ellipsize_apply(Edje *ed, Edje_Real_Part *ep, if (sc == 0.0) sc = 1.0; } - ep->typedata.text->ellipsize.marquee.sec_per_pixel = 1.0 / (chosen_desc->text.ellipsize.marquee.speed * TO_DOUBLE(sc)); + ep->typedata.text->ellipsize.marquee.sec_per_pixel = 1.0 / (speed * TO_DOUBLE(sc)); } - else if (chosen_desc->text.ellipsize.marquee.duration > 0.0) + else if (duration > 0.0) { /* Convert sec_per_loop (duration) to sec_per_pixel */ int distance_per_loop = 0.0; @@ -6530,8 +6539,7 @@ _edje_text_ellipsize_apply(Edje *ed, Edje_Real_Part *ep, distance_per_loop = tw + pf->final.w; } - ep->typedata.text->ellipsize.marquee.sec_per_pixel = - chosen_desc->text.ellipsize.marquee.duration / (double)distance_per_loop; + ep->typedata.text->ellipsize.marquee.sec_per_pixel = duration / (double)distance_per_loop; } else { diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index e475d882..4ed8946 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -3080,6 +3080,31 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File) } } /* END */ + /* TIZEN_ONLY(20170801): add text marquee duration set/get APIs for internal usages */ + @property part_text_marquee_duration @internal { + set { + [[Sets the duration for text's marquee. + + Do not use this API without understanding whats going on. + It is made for internal usage. + ]] + return: bool; [[$true, on success or $false, on error]] + } + get { + [[Gets the duration for text's marquee. + + Do not use this API without understanding whats going on. + It is made for internal usage. + ]] + } + keys { + part: const(char)*; [[The part name]] + } + values { + duration: double; [[The duration. 0.0 for respect EDC's duration value.]] + } + } + /* END */ } implements { Eo.Base.constructor; diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 559a575..97a6e10 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -1937,6 +1937,11 @@ struct _Edje_Real_Part_Text /* TIZEN_ONLY(20170217): add part_text_valign property for internal usage */ FLOAT_T valign; // 4 /* END */ + /* TIZEN_ONLY(20170801): add text marquee duration set/get APIs for internal usages */ + struct { + double duration; // 8 + } marquee; + /* END */ /* TIZEN_ONLY(20160920): Add fade_ellipsis feature to TEXTBLOCK, TEXT part. */ struct { Evas_Object *clipper_obj; // 4 @@ -1961,6 +1966,8 @@ struct _Edje_Real_Part_Text int orig_x, orig_y; int loop_count; int distance; + + double duration; } marquee; } ellipsize; /* END */ diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 5914d1f..8bfe47a 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -6987,4 +6987,58 @@ _edje_object_part_text_valign_get(Eo *eo_obj EINA_UNUSED, Edje *ed, const char * } /* END */ +/* TIZEN_ONLY(20170801): add text marquee duration set/get APIs for internal usages */ +EOLIAN Eina_Bool +_edje_object_part_text_marquee_duration_set(Eo *eo_obj EINA_UNUSED, Edje *ed, const char *part, double duration) +{ + Edje_Real_Part *rp; + Edje_Part_Description_Text *desc; + + if (!part) return EINA_FALSE; + rp = _edje_real_part_recursive_get(&ed, part); + if (!rp) return EINA_FALSE; + if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) && + (rp->part->type != EDJE_PART_TYPE_TEXT)) + return EINA_FALSE; + + if (rp->typedata.text) + { + rp->typedata.text->ellipsize.marquee.duration = duration; + + return EINA_TRUE; + } + + return EINA_FALSE; +} + +EOLIAN double +_edje_object_part_text_marquee_duration_get(Eo *eo_obj EINA_UNUSED, Edje *ed, const char *part) +{ + Edje_Real_Part *rp; + Edje_Part_Description_Text *desc; + + if (!part) return -1.0; + rp = _edje_real_part_recursive_get(&ed, part); + if (!rp) return -1.0; + if ((rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) && + (rp->part->type != EDJE_PART_TYPE_TEXT)) + return -1.0; + + if (rp->typedata.text) + { + if (rp->typedata.text->ellipsize.marquee.duration <= 0.0) + { + desc = (Edje_Part_Description_Text *)rp->chosen_description; + return desc->text.ellipsize.marquee.duration; + } + else + { + return rp->typedata.text->ellipsize.marquee.duration; + } + } + + return -1.0; +} +/* END */ + /* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ -- 2.7.4