Evas textblock: Added mixedwrap code - the code is there but nothing is really using it at the moment, will add that in the future.

SVN revision: 56519
This commit is contained in:
Tom Hacohen 2011-01-30 10:43:21 +00:00
parent 546ceb4151
commit 03e32ec5c4
1 changed files with 35 additions and 9 deletions

View File

@ -3019,10 +3019,11 @@ _layout_get_charwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
/* -1 means no wrap */
static int
_layout_get_wordwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
const Evas_Object_Textblock_Text_Item *ti)
_layout_get_word_mixwrap_common(Ctxt *c, Evas_Object_Textblock_Format *fmt,
const Evas_Object_Textblock_Text_Item *ti, Eina_Bool mixed_wrap)
{
int wrap = -1, twrap;
int orig_wrap;
Eina_Unicode ch;
const Eina_Unicode *str = ti->text;
@ -3030,6 +3031,7 @@ _layout_get_wordwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
/* Avoiding too small textblocks to even contain one char */
if (wrap == 0)
GET_NEXT(str, wrap);
orig_wrap = wrap;
/* We need to wrap and found the position that overflows */
if (wrap > 0)
{
@ -3079,6 +3081,12 @@ _layout_get_wordwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
/* If there were no items in this line, try to do
* our best wrapping possible since it's the middle
* of the word */
else
{
if (mixed_wrap)
{
return (str[orig_wrap]) ? orig_wrap : -1;
}
else
{
wrap = 0;
@ -3096,6 +3104,7 @@ _layout_get_wordwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
}
}
}
}
/* We need to wrap, but for some reason we failed obatining the
* overflow position. */
else
@ -3124,6 +3133,23 @@ _layout_get_wordwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
return -1;
}
/* -1 means no wrap */
static int
_layout_get_wordwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
const Evas_Object_Textblock_Text_Item *ti)
{
return _layout_get_word_mixwrap_common(c, fmt, ti, EINA_FALSE);
}
/* -1 means no wrap - unused atm but can be used by whoever wants this
* I'm leaving it here because of the many requests I got about it... */
static int __UNUSED__
_layout_get_mixedwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
const Evas_Object_Textblock_Text_Item *ti)
{
return _layout_get_word_mixwrap_common(c, fmt, ti, EINA_TRUE);
}
static void
_layout_visualize_par(Ctxt *c)
{