Dear Elementary developers. It's a bugfix patch and adding new functionality for wrapmode changing at elm_label.
1. bugfix strbuf_key_value_replace which is internal function 2. add wrapmode change api (wordwrap or charwrap) Thank you. ------------------------------------------- Hyoyoung CHANG Engineer SAMSUNG ELECTRONICS, Co., Ltd. E-mail: hyoyoung.ch...@samsung.com -------------------------------------------
>From 08a36f6733ca41668a9e4b38ba95bf3c92abfab6 Mon Sep 17 00:00:00 2001 From: Hyoyoung Chang <hyoyoung.ch...@samsung.com> Date: Tue, 11 Jan 2011 15:17:08 +0900 Subject: [PATCH 2/3] bugfix and improve tag searching in _strbuf_key_value_replace --- src/lib/elm_label.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lib/elm_label.c b/src/lib/elm_label.c index 5240cec..288e7de 100644 --- a/src/lib/elm_label.c +++ b/src/lib/elm_label.c @@ -260,17 +260,12 @@ _strbuf_key_value_replace(Eina_Strbuf *srcbuf, const char *key, const char *valu if (curlocater) { replocater = curlocater + key_len + 1; - while ((*replocater != '=') && (replocater)) - replocater++; - while ((*replocater) && - (*replocater != ' ') && - (*replocater != '>')) + while ((*replocater) && (*replocater != ' ') && (*replocater != '>')) replocater++; - if ((replocater - curlocater) > (key_len + 1)) + if (replocater - curlocater > key_len) { - replocater--; eina_strbuf_append_n(diffbuf, curlocater, replocater-curlocater); } -- 1.7.1
>From d1af20b5e33f773048d810fb8d2b24eafe88c88e Mon Sep 17 00:00:00 2001 From: Hyoyoung Chang <hyoyoung.ch...@samsung.com> Date: Tue, 11 Jan 2011 15:33:18 +0900 Subject: [PATCH 3/3] add wrapmode changing API --- data/themes/default.edc | 49 +++++++++++++++++++++++++++++++++++++++ src/lib/Elementary.h.in | 2 + src/lib/elm_label.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+), 0 deletions(-) diff --git a/data/themes/default.edc b/data/themes/default.edc index e457e5d..330abb1 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -1403,6 +1403,14 @@ collections { tag: "b" "+ font=Sans:style=Bold"; tag: "tab" "\t"; } + style { name: "textblock_charwrap_style"; + base: "font=Sans font_size=10 color=#000 wrap=char text_class=label"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "hilight" "+ font=Sans:style=Bold"; + tag: "b" "+ font=Sans:style=Bold"; + tag: "tab" "\t"; + } } parts { part { name: "label.swallow.background"; @@ -1458,8 +1466,28 @@ collections { min: 0 1; } } + description { state: "charwrap_mode" 0.0; + text { + style: "textblock_style"; + min: 0 1; + } + } } } + programs { + program { name: "default_wrap"; + signal: "elm,state,default"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + program { name: "char_wrap"; + signal: "elm,state,charwrap"; + source: "elm"; + action: STATE_SET "charwrap_mode" 0.0; + target: "elm.text"; + } + } } group { name: "elm/label/base_wrap_ellipsis/default"; @@ -1487,8 +1515,29 @@ collections { min: 0 1; } } + description { state: "charwrap_mode" 0.0; + fixed: 0 1; + text { + style: "textblock_charwrap_style"; + min: 0 1; + } + } } } + programs { + program { name: "default_wrap"; + signal: "elm,state,default"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + program { name: "char_wrap"; + signal: "elm,state,charwrap"; + source: "elm"; + action: STATE_SET "charwrap_mode" 0.0; + target: "elm.text"; + } + } } group { name: "elm/label/base/marker"; diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 8e6bba3..722a3cd 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -813,6 +813,8 @@ extern "C" { EAPI void elm_label_text_align_set(Evas_Object *obj, const char *alignmode) EINA_ARG_NONNULL(1); EAPI void elm_label_background_color_set(Evas_Object *obj, unsigned int r, unsigned int g, unsigned int b, unsigned int a) EINA_ARG_NONNULL(1); EAPI void elm_label_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis) EINA_ARG_NONNULL(1); + EAPI void elm_label_wrap_mode_set(Evas_Object *obj, Eina_Bool wrapmode); EINA_ARG_NONNULL(1); + EAPI Eina_Bool elm_label_wrap_mode_get(Evas_Object *obj); EINA_ARG_NONNULL(1); EAPI void elm_label_slide_set(Evas_Object *obj, Eina_Bool slide) EINA_ARG_NONNULL(1); EAPI Eina_Bool elm_label_slide_get(Evas_Object *obj) EINA_ARG_NONNULL(1); EAPI void elm_label_slide_duration_set(Evas_Object *obj, double duration) EINA_ARG_NONNULL(1); diff --git a/src/lib/elm_label.c b/src/lib/elm_label.c index 288e7de..96f561e 100644 --- a/src/lib/elm_label.c +++ b/src/lib/elm_label.c @@ -20,6 +20,7 @@ struct _Widget_Data Evas_Coord lastw; Evas_Coord wrap_w; Evas_Coord wrap_h; + Eina_Bool wrapmode : 1; Eina_Bool linewrap : 1; Eina_Bool changed : 1; Eina_Bool bgcolor : 1; @@ -559,6 +560,26 @@ _ellipsis_label_to_width(Evas_Object *obj, Eina_Bool multiline) } } +/* + * setting internal state of mulitline label. + * singleline doesn't need it + */ + +void +_label_state_change(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + + if (wd->linewrap) + { + if (wd->wrapmode) + edje_object_signal_emit(wd->lbl, "elm,state,default", "elm"); + else + edje_object_signal_emit(wd->lbl, "elm,state,charwrap", "elm"); + } +} + static void _label_sliding_change(Evas_Object *obj) { @@ -648,6 +669,7 @@ elm_label_add(Evas_Object *parent) wd->linewrap = EINA_FALSE; wd->ellipsis = EINA_FALSE; + wd->wrapmode = EINA_TRUE; wd->slidingmode = EINA_FALSE; wd->slidingellipsis = EINA_FALSE; wd->wrap_w = 0; @@ -983,6 +1005,43 @@ elm_label_ellipsis_set(Evas_Object *obj, Eina_Bool ellipsis) } /** + * Set the wrapmode of the label + * + * @param obj The label object + * @param wrapmode 0 is charwrap, 1 is wordwrap + * @ingroup Label + */ +EAPI void +elm_label_wrap_mode_set(Evas_Object *obj, + Eina_Bool wrapmode) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->wrapmode == wrapmode) return; + wd->wrapmode = wrapmode; + _label_state_change(obj); + wd->changed = 1; + _sizing_eval(obj); +} + +/** + * Get the wrapmode of the label + * + * @param obj The label object + * @return wrapmode 0 is charwrap, 1 is wordwrap + * @ingroup Label + */ +EAPI Eina_Bool +elm_label_wrap_mode_get(Evas_Object *obj) +{ + ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return EINA_FALSE; + return wd->wrapmode; +} + +/** * Set the text slide of the label * * @param obj The label object -- 1.7.1
------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel