On Mon, Feb 10, 2014 at 12:39 AM, niraj kumar <niraj.kumar....@gmail.com>wrote:
> Hi Davemds,SeoZ > > As discussed on the IRC I tried my best to explain to you why I could not > provided elm_label_slide_speed_set. > If I had to set the speed then I must calculate it for the another label > before applying it to different label. > > Since I do not have the enough information to calculate the speed so I > deferred it till I have the information. > and if I do have not have the speed of the first label so I didn't provided > the generic API elm_label_slide_speed_set > (as suggested by you on IRC ) > Add elm_label_slide_speed_get() and do a smart calculation in that function. Then you'll get the correct speed. But remember forcing a smart calculation without deep consideration will lead you a bad performance. > > As suggested by SeoZ it make more sense to have API > elm_label_slide_speed_match(l1, > l2) to match the speed. > > Initially I had the same implementation and but the problem is the second > part addressed by SeoZ. > If the speed of the the first label changes then the speed of the second > label changes according to that. > It means that both the label should have the reference of each others > like *(circular > references)* 1st label is referencing > the 2nd > And the second is referencing to the first. And the library should > re-calculate it everything when ever text change or duration change > as we have to match the speed every time. > Just rename it to elm_label_slide_speed_refer(lb1, lb2); and only lb2 refers lb1's speed :) And this makes sense. Print errors if users try to create a circular dependencies. > > Consider the following case: > > If the application developer has set the speed of the two label as same > but now he wants to change the speed of > the first label only. How he will support it ? > Then we may have to provide a API to detach both the labels and delete the > reference from each other. > > And I think App developer knows well when he want to set the speed of two > label same or not. It just require two three line > of code from application developer > > To avoid this calculation I provided the API which takes duration and text > length of the first label whenever he want to set the API. > > But the API name does not match with its design and behavior. > I agree with SeOZ that the API name is not proper and > elm_label_slide_speed_match(l1, > l2) make more sense > > I prefer having elm_label_slide_speed_match elm_label_slide_speed_set elm_label_slide_speed_get But you can add whatever you need first. Thanks. Daniel Juyung Seo (SeoZ) > > Thanks, > Niraj > > > > > > On Sun, Feb 9, 2014 at 8:51 PM, Daniel Juyung Seo <seojuyu...@gmail.com > >wrote: > > > On Sun, Feb 9, 2014 at 11:37 PM, Davide Andreoli <d...@gurumeditation.it > > >wrote: > > > > > 2014-02-09 14:59 GMT+01:00 nirajkr <niraj...@samsung.com>: > > > > > > > raster pushed a commit to branch master. > > > > > > > > > > > > > > > > > > http://git.enlightenment.org/core/elementary.git/commit/?id=56a2c96ea7a731d6066aa7cb0964a633c5bed35c > > > > > > > > commit 56a2c96ea7a731d6066aa7cb0964a633c5bed35c > > > > Author: nirajkr <niraj...@samsung.com> > > > > Date: Sun Feb 9 22:55:38 2014 +0900 > > > > > > > > label : Added the API to match the speed of label to different > > label > > > > > > > > > > Summary: > > > > Currently we do not set the speed of two label same > > > > This patch fetch the information of the previous > > > > label to set it to the next label to match the speed > > > > of the previous label > > > > > > > > > > This new API is really, really bad !!! > > > elm_label_slide_speed_match(lb, duration, textlen); !! > > > > > > what you really want here is just: > > > elm_label_slide_speed_set(lb, speed); > > > > > > So that you can set the same speed on every label. > > > > > > I vote to revert this > > > > > > davemds > > > > > > > > > > > > > > +1 here. > > > > Actually I was reviewing this patch. > > elm_label_slide_speed_set(lb, speed) is acceptable to me. > > > > And to fit your actual requirement you need > > elm_label_slide_speed_match(lb1, lb2) > > This matches lb1's speed to lb2's speed and when lb2's speed is changed > (by > > duration_set or by changing text) lb1's speed should be changed > > accordingly. > > > > Thanks. > > > > Daniel Juyung Seo (SeoZ) > > > > > > > > > > > > > > > > > > > > Reviewers: seoz, raster > > > > > > > > Reviewed By: raster > > > > > > > > CC: singh.amitesh > > > > > > > > Differential Revision: https://phab.enlightenment.org/D531 > > > > --- > > > > src/bin/test_label.c | 47 ++++++++++++++++++++++++++++++++ > > > > src/lib/elm_label.c | 68 > > > > +++++++++++++++++++++++++++++++++++++++++++--- > > > > src/lib/elm_label_eo.h | 32 ++++++++++++++++++++++ > > > > src/lib/elm_label_legacy.h | 32 ++++++++++++++++++++++ > > > > src/lib/elm_widget_label.h | 5 ++++ > > > > 5 files changed, 180 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/src/bin/test_label.c b/src/bin/test_label.c > > > > index 7e6a73d..d5e7898 100644 > > > > --- a/src/bin/test_label.c > > > > +++ b/src/bin/test_label.c > > > > @@ -113,6 +113,8 @@ void > > > > test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, > void > > > > *event_info EINA_UNUSED) > > > > { > > > > Evas_Object *win, *gd, *rect, *lb, *rd, *rdg, *sl; > > > > + double duration; > > > > + Evas_Coord textlen; > > > > > > > > win = elm_win_util_standard_add("label2", "Label 2"); > > > > elm_win_autodel_set(win, EINA_TRUE); > > > > @@ -212,6 +214,51 @@ test_label2(void *data EINA_UNUSED, Evas_Object > > *obj > > > > EINA_UNUSED, void *event_in > > > > elm_grid_pack(gd, sl, 5, 60, 90, 10); > > > > evas_object_show(sl); > > > > > > > > + /*Test label slide speed */ > > > > + lb = elm_label_add(win); > > > > + elm_object_text_set(lb, "Test Label Slide Speed:"); > > > > + elm_label_slide_mode_set(lb, ELM_LABEL_SLIDE_MODE_ALWAYS); > > > > + elm_label_slide_go(lb); > > > > + elm_grid_pack(gd, lb, 5, 70, 90, 10); > > > > + evas_object_show(lb); > > > > + > > > > + rect = evas_object_rectangle_add(evas_object_evas_get(win)); > > > > + elm_grid_pack(gd, rect, 5, 80, 90, 10); > > > > + evas_object_color_set(rect, 255, 125, 125, 255); > > > > + evas_object_show(rect); > > > > + > > > > + lb = elm_label_add(win); > > > > + elm_object_style_set(lb, "slide_long"); > > > > + elm_object_text_set(lb, > > > > + "This is a label set to slide and this will" > > > > + " test the speed of label with the below > > label." > > > > + " This label has few extra char to test"); > > > > + elm_label_slide_duration_set(lb, 8.0); > > > > + elm_label_slide_mode_set(lb, ELM_LABEL_SLIDE_MODE_ALWAYS); > > > > + elm_label_slide_go(lb); > > > > + elm_grid_pack(gd, lb, 5, 80, 90, 10); > > > > + evas_object_show(lb); > > > > + > > > > + //Get the required parameter of the previous label > > > > + duration = elm_label_slide_duration_get(lb); > > > > + textlen = elm_label_slide_text_length_get(lb); > > > > + > > > > + rect = evas_object_rectangle_add(evas_object_evas_get(win)); > > > > + elm_grid_pack(gd, rect, 5, 90, 90, 10); > > > > + evas_object_color_set(rect, 255, 125, 125, 255); > > > > + evas_object_show(rect); > > > > + > > > > + lb = elm_label_add(win); > > > > + elm_object_style_set(lb, "slide_long"); > > > > + elm_object_text_set(lb, > > > > + "This is a label set to slide and this will" > > > > + " match the speed of the upper label."); > > > > + elm_label_slide_mode_set(lb, ELM_LABEL_SLIDE_MODE_ALWAYS); > > > > + elm_label_slide_speed_match(lb, duration, textlen); > > > > + elm_label_slide_go(lb); > > > > + elm_grid_pack(gd, lb, 5, 90, 90, 10); > > > > + evas_object_show(lb); > > > > + > > > > evas_object_resize(win, 320, 320); > > > > evas_object_show(win); > > > > } > > > > diff --git a/src/lib/elm_label.c b/src/lib/elm_label.c > > > > index 976b186..a46badf 100644 > > > > --- a/src/lib/elm_label.c > > > > +++ b/src/lib/elm_label.c > > > > @@ -78,7 +78,9 @@ static void > > > > _label_slide_change(Evas_Object *obj) > > > > { > > > > Evas_Object *tb; > > > > + Evas_Coord lw; > > > > char *plaintxt; > > > > + double speed; > > > > int plainlen = 0; > > > > > > > > ELM_LABEL_DATA_GET(obj, sd); > > > > @@ -138,6 +140,17 @@ _label_slide_change(Evas_Object *obj) > > > > Edje_Message_Float_Set *msg = > > > > alloca(sizeof(Edje_Message_Float_Set) + (sizeof(double))); > > > > > > > > + evas_object_geometry_get(wd->resize_obj, > > > > + NULL, NULL, &lw, NULL); > > > > + if ((sd->slide_duration_recalc) && > > > > + (lw > 0) && > > > > + (sd->matchslide_duration > 0)) > > > > + { > > > > + speed = (sd->matchslide_textlen + lw) / > > > > (sd->matchslide_duration); > > > > + sd->slide_duration = (sd->text_formatted_length + lw) / > > > > (speed); > > > > + sd->slide_duration_recalc = EINA_FALSE; > > > > + } > > > > + > > > > msg->count = 1; > > > > msg->val[0] = sd->slide_duration; > > > > > > > > @@ -214,9 +227,10 @@ _on_label_resize(void *data, > > > > Evas_Object *obj EINA_UNUSED, > > > > void *event_info EINA_UNUSED) > > > > { > > > > - ELM_LABEL_DATA_GET(data, sd); > > > > + ELM_LABEL_DATA_GET(data, sd); > > > > > > > > - if (sd->linewrap) elm_layout_sizing_eval(data); > > > > + if (sd->slide_duration_recalc) _label_slide_change(data); > > > > + if (sd->linewrap) elm_layout_sizing_eval(data); > > > > } > > > > > > > > static int > > > > @@ -324,6 +338,8 @@ _stringshare_key_value_replace(const char > > > **srcstring, > > > > static void > > > > _elm_label_smart_text_set(Eo *obj, void *_pd, va_list *list) > > > > { > > > > + Evas_Object *tb; > > > > + > > > > Elm_Label_Smart_Data *sd = _pd; > > > > ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); > > > > const char *part = va_arg(*list, const char *); > > > > @@ -341,6 +357,11 @@ _elm_label_smart_text_set(Eo *obj, void *_pd, > > > va_list > > > > *list) > > > > sd->lastw = 0; > > > > eo_do(obj, elm_obj_layout_sizing_eval()); > > > > } > > > > + > > > > + tb = (Evas_Object *)edje_object_part_object_get(wd->resize_obj, > > > > + "elm.text"); > > > > + evas_object_textblock_size_formatted_get(tb, > > > > &sd->text_formatted_length, NULL); > > > > + > > > > if (ret) *ret = int_ret; > > > > } > > > > > > > > @@ -674,6 +695,41 @@ elm_label_slide_duration_get(const Evas_Object > > *obj) > > > > } > > > > > > > > EAPI void > > > > +elm_label_slide_speed_match(Evas_Object *obj, double duration, > > > Evas_Coord > > > > textlen) > > > > +{ > > > > + ELM_LABEL_CHECK(obj); > > > > + eo_do(obj, elm_obj_label_slide_speed_match(duration, textlen)); > > > > +} > > > > + > > > > +static void > > > > +_slide_speed_match(Eo *obj EINA_UNUSED, void *_pd, va_list *list) > > > > +{ > > > > + double duration = va_arg(*list, double); > > > > + Evas_Coord textlen = va_arg(*list, Evas_Coord); > > > > + Elm_Label_Smart_Data *sd = _pd; > > > > + sd->matchslide_duration = duration; > > > > + sd->matchslide_textlen = textlen; > > > > + sd->slide_duration_recalc = EINA_TRUE; > > > > +} > > > > + > > > > +EAPI Evas_Coord > > > > +elm_label_slide_text_length_get(const Evas_Object *obj) > > > > +{ > > > > + ELM_LABEL_CHECK(obj) 0; > > > > + Evas_Coord ret = 0; > > > > + eo_do((Eo *) obj, elm_obj_label_slide_text_length_get(&ret)); > > > > + return ret; > > > > +} > > > > + > > > > +static void > > > > +_slide_textlen_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list) > > > > +{ > > > > + Evas_Coord *ret = va_arg(*list, Evas_Coord *); > > > > + Elm_Label_Smart_Data *sd = _pd; > > > > + *ret = sd->text_formatted_length; > > > > +} > > > > + > > > > +EAPI void > > > > elm_label_slide_go(Evas_Object *obj) > > > > { > > > > ELM_LABEL_CHECK(obj); > > > > @@ -743,6 +799,8 @@ _class_constructor(Eo_Class *klass) > > > > > > > > > EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET), > > > > _slide_duration_set), > > > > > > > > > EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET), > > > > _slide_duration_get), > > > > EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_GO), > > > > _slide_go), > > > > + > > > > EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_MATCH), > > > > _slide_speed_match), > > > > + > > > > EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_TEXT_LENGTH_GET), > > > > _slide_textlen_get), > > > > EO_OP_FUNC_SENTINEL > > > > }; > > > > eo_class_funcs_set(klass, func_desc); > > > > @@ -758,9 +816,11 @@ static const Eo_Op_Description op_desc[] = { > > > > EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_GET, "Get the > > > > ellipsis behavior of the label."), > > > > EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_SET, "Set > slide > > > > effect mode of label widget."), > > > > EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_GET, "Get > > current > > > > slide effect mode."), > > > > - EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET, "Set > > the > > > > slide duration (speed) of the label."), > > > > - EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET, "Get > > the > > > > slide duration(speed) of the label."), > > > > + EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET, "Set > > the > > > > slide duration of the label."), > > > > + EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET, "Get > > the > > > > slide duration of the label."), > > > > EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_GO, "Start slide > > > > effect."), > > > > + EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_MATCH, "Set > > the > > > > required parameter to match slide speed."), > > > > + EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_TEXT_LENGTH_GET, "Get > the > > > > text length of the label."), > > > > EO_OP_DESCRIPTION_SENTINEL > > > > }; > > > > static const Eo_Class_Description class_desc = { > > > > diff --git a/src/lib/elm_label_eo.h b/src/lib/elm_label_eo.h > > > > index f79cb95..efd4013 100644 > > > > --- a/src/lib/elm_label_eo.h > > > > +++ b/src/lib/elm_label_eo.h > > > > @@ -22,6 +22,8 @@ enum > > > > ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET, > > > > ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET, > > > > ELM_OBJ_LABEL_SUB_ID_SLIDE_GO, > > > > + ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_MATCH, > > > > + ELM_OBJ_LABEL_SUB_ID_TEXT_LENGTH_GET, > > > > ELM_OBJ_LABEL_SUB_ID_LAST > > > > }; > > > > > > > > @@ -179,6 +181,36 @@ enum > > > > * @ingroup Label > > > > */ > > > > #define elm_obj_label_slide_go() > > > > ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_GO) > > > > + > > > > +/** > > > > + * @def elm_obj_label_slide_speed_match > > > > + * @since 1.9 > > > > + * > > > > + * @brief Set the required parameter to set the same speed of the > > label > > > > + * > > > > + * @param[in] duration > > > > + * @param[in] textlen > > > > + * > > > > + * @see elm_label_slide_duration_set > > > > + * > > > > + * @ingroup Label > > > > + */ > > > > +#define elm_obj_label_slide_speed_match(duration, textlen) > > > > ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_MATCH), > > > > EO_TYPECHECK(double, duration), EO_TYPECHECK(Evas_Coord, textlen) > > > > + > > > > +/** > > > > + * @def elm_obj_label_slide_text_length_get > > > > + * @since 1.9 > > > > + * > > > > + * @brief Get the text label length > > > > + * > > > > + * @param[out] ret > > > > + * > > > > + * @see elm_object_text_set > > > > + * > > > > + * @ingroup Label > > > > + */ > > > > +#define elm_obj_label_slide_text_length_get(ret) > > > > ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_TEXT_LENGTH_GET), > > > > EO_TYPECHECK(Evas_Coord * , ret) > > > > + > > > > /** > > > > * @} > > > > */ > > > > diff --git a/src/lib/elm_label_legacy.h b/src/lib/elm_label_legacy.h > > > > index b3222b8..04cfc7e 100644 > > > > --- a/src/lib/elm_label_legacy.h > > > > +++ b/src/lib/elm_label_legacy.h > > > > @@ -162,3 +162,35 @@ EAPI double > > > > elm_label_slide_duration_get(const Evas_Object > > > > * @ingroup Label > > > > */ > > > > EAPI void elm_label_slide_go(Evas_Object > *obj); > > > > + > > > > +/** > > > > + * @brief Set the required parameter to set the same speed of the > > label > > > > + * > > > > + * @param obj The label object > > > > + * @param duration The duration of the previous slide label > > > > + * @param duration The textlen of the previous slide label text > > > > + * > > > > + * @note If this API is called then it is not required to set the > > > > + * duration of the label. Internally it will calcuate the duration > > > > + * which will match the speed of the previous label. If the duration > > > > + * is explicitly set it will override these parameters. > > > > + * > > > > + * @see elm_label_slide_duration_set() > > > > + * @since 1.9 > > > > + * > > > > + * @ingroup Label > > > > + */ > > > > +EAPI void > > elm_label_slide_speed_match(Evas_Object > > > > *obj, double duration, Evas_Coord textlen); > > > > + > > > > +/** > > > > + * @brief Get the text length of the label > > > > + * > > > > + * @param obj The label object > > > > + * @return The text length of the label > > > > + * > > > > + * @see elm_object_text_set() > > > > + * @since 1.9 > > > > + * > > > > + * @ingroup Label > > > > + */ > > > > +EAPI Evas_Coord > elm_label_slide_text_length_get(const > > > > Evas_Object *obj); > > > > diff --git a/src/lib/elm_widget_label.h b/src/lib/elm_widget_label.h > > > > index 4e2ac72..4464e76 100644 > > > > --- a/src/lib/elm_widget_label.h > > > > +++ b/src/lib/elm_widget_label.h > > > > @@ -13,13 +13,18 @@ struct _Elm_Label_Smart_Data > > > > { > > > > const char *format; > > > > double slide_duration; > > > > + double matchslide_duration; > > > > + > > > > Evas_Coord lastw; > > > > Evas_Coord wrap_w; > > > > + Evas_Coord text_formatted_length; > > > > + Evas_Coord matchslide_textlen; > > > > Elm_Wrap_Type linewrap; > > > > Elm_Label_Slide_Mode slide_mode; > > > > > > > > Eina_Bool ellipsis : 1; > > > > Eina_Bool slide_ellipsis : 1; > > > > + Eina_Bool slide_duration_recalc : 1; > > > > }; > > > > > > > > #define ELM_LABEL_DATA_GET(o, sd) \ > > > > > > > > -- > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------------ > > > Managing the Performance of Cloud-Based Applications > > > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > > > Read the Whitepaper. > > > > > > > > > http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk > > > _______________________________________________ > > > enlightenment-devel mailing list > > > enlightenment-devel@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > > > > > > > > ------------------------------------------------------------------------------ > > Managing the Performance of Cloud-Based Applications > > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > > Read the Whitepaper. > > > > > http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk > > _______________________________________________ > > enlightenment-devel mailing list > > enlightenment-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > > > > > > -- > Thanks, > Niraj > > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > > http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel