Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_enums.h ewl_text.c ewl_text.h Log Message: - add option to make text wrap as word, char or none - add wrap to the test case - NOTE wrap doesn't seem to be working correctly at the moment =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_enums.h,v retrieving revision 1.53 retrieving revision 1.54 diff -u -3 -r1.53 -r1.54 --- ewl_enums.h 5 Sep 2006 02:14:24 -0000 1.53 +++ ewl_enums.h 6 Sep 2006 17:47:45 -0000 1.54 @@ -706,6 +706,22 @@ typedef enum Ewl_Sort_Direction Ewl_Sort_Direction; /** + * @enum Ewl_Text_Wrap + * The text wrap setting + */ +enum Ewl_Text_Wrap +{ + EWL_TEXT_WRAP_NONE = 0, + EWL_TEXT_WRAP_CHAR, + EWL_TEXT_WRAP_WORD +}; + +/** + * The Ewl_Text_Wrap + */ +typedef enum Ewl_Text_Wrap Ewl_Text_Wrap; + +/** * @} */ #endif /* __EWL_ENUMS_H__ */ =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text.c,v retrieving revision 1.114 retrieving revision 1.115 diff -u -3 -r1.114 -r1.115 --- ewl_text.c 6 Sep 2006 17:28:54 -0000 1.114 +++ ewl_text.c 6 Sep 2006 17:47:45 -0000 1.115 @@ -1336,7 +1336,7 @@ * @brief Sets the wrap value of the text at the given index */ void -ewl_text_wrap_set(Ewl_Text *t, unsigned int wrap) +ewl_text_wrap_set(Ewl_Text *t, Ewl_Text_Wrap wrap) { Ewl_Text_Context *change; @@ -1362,7 +1362,7 @@ * the given length of text */ void -ewl_text_wrap_apply(Ewl_Text *t, unsigned int wrap, unsigned int length) +ewl_text_wrap_apply(Ewl_Text *t, Ewl_Text_Wrap wrap, unsigned int length) { Ewl_Text_Context *tx; @@ -1391,7 +1391,7 @@ * @return Returns the wrap value of the text at the given index * @brief Retrives the text wrap value at the given index */ -unsigned int +Ewl_Text_Wrap ewl_text_wrap_get(Ewl_Text *t, unsigned int idx) { Ewl_Text_Context *tx; @@ -2288,6 +2288,7 @@ char *ptr; char style[512]; char align[128]; + char wrap[128]; DENTER_FUNCTION(DLEVEL_STABLE); DCHECK_PARAM_PTR_RET("ctx", ctx, NULL); @@ -2411,17 +2412,26 @@ else snprintf(align, sizeof(align), "align=left"); + if (ctx->wrap == EWL_TEXT_WRAP_WORD) + snprintf(wrap, sizeof(wrap), "wrap=word"); + + else if (ctx->wrap == EWL_TEXT_WRAP_CHAR) + snprintf(wrap, sizeof(wrap), "wrap=char"); + + else + snprintf(wrap, sizeof(wrap), "wrap=off"); + ptr = ewl_theme_path_get(); /* create the formatting string */ snprintf(fmt, 2048, "+font=fonts/%s font_source=%s font_size=%d " "backing_color=#%02x%02x%02x%02x color=#%02x%02x%02x%02x " - "%s wrap=%s %s", ctx->font, + "%s %s %s", ctx->font, ptr, ctx->size, ctx->style_colors.bg.r, ctx->style_colors.bg.g, ctx->style_colors.bg.b, ctx->style_colors.bg.a, ctx->color.r, ctx->color.g, ctx->color.b, ctx->color.a, style, - ((ctx->wrap) ? "word" : "off"), align); + wrap, align); IF_FREE(ptr); =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text.h,v retrieving revision 1.38 retrieving revision 1.39 diff -u -3 -r1.38 -r1.39 --- ewl_text.h 10 Jun 2006 16:52:06 -0000 1.38 +++ ewl_text.h 6 Sep 2006 17:47:45 -0000 1.39 @@ -173,10 +173,10 @@ unsigned int ewl_text_style_has(Ewl_Text *t, Ewl_Text_Style style, unsigned int idx); -void ewl_text_wrap_set(Ewl_Text *t, unsigned int wrap); -void ewl_text_wrap_apply(Ewl_Text *t, unsigned int wrap, +void ewl_text_wrap_set(Ewl_Text *t, Ewl_Text_Wrap wrap); +void ewl_text_wrap_apply(Ewl_Text *t, Ewl_Text_Wrap wrap, unsigned int length); -unsigned int ewl_text_wrap_get(Ewl_Text *t, unsigned int idx); +Ewl_Text_Wrap ewl_text_wrap_get(Ewl_Text *t, unsigned int idx); void ewl_text_bg_color_set(Ewl_Text *t, unsigned int r, unsigned int g, unsigned int b, unsigned int a); @@ -320,7 +320,7 @@ char *font; /**< Font name */ unsigned int styles; /**< Styles set in this node */ unsigned int align; /**< Text alignment */ - unsigned int wrap; /**< Text wrap setting */ + Ewl_Text_Wrap wrap; /**< Text wrap setting */ char size; /**< Font size */ Ewl_Color_Set color; /**< Font colour */ ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs