Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/etox

Dir     : e17/libs/etox/src


Modified Files:
        Etox.h etox.c etox_context.c etox_line.c 


Log Message:
Added word wrapping. Fixed a segv on the wrap marker.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -3 -r1.44 -r1.45
--- Etox.h      18 Oct 2003 16:43:37 -0000      1.44
+++ Etox.h      17 Feb 2004 21:58:20 -0000      1.45
@@ -167,6 +167,7 @@
                           Evas_Coord *w, Evas_Coord *h);
 
 void etox_set_soft_wrap(Evas_Object * et, int boolean);
+void etox_set_word_wrap(Evas_Object * et, int boolean);
 
 /*
  * Appearance altering functions
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -3 -r1.68 -r1.69
--- etox.c      25 Jan 2004 01:50:57 -0000      1.68
+++ etox.c      17 Feb 2004 21:58:20 -0000      1.69
@@ -571,6 +571,8 @@
                et->flags |= ETOX_SOFT_WRAP;
        else
                et->flags &= ~ETOX_SOFT_WRAP;
+
+       etox_layout(et);
 }
 
 
@@ -609,6 +611,28 @@
 }
 
 /**
+ * etox_set_word_wrap - turns on word wrapping when soft wrap enabled
+ * @obj: the etox evas object to set for
+ * @boolean: 0 is off, anything else is on
+ * 
+ * Returns no value. changes current context alignment value.
+ */
+void etox_set_word_wrap(Evas_Object *obj, int boolean)
+{
+       Etox *et;
+       CHECK_PARAM_POINTER("obj", obj);
+
+       et = evas_object_smart_data_get(obj);
+
+       if (boolean)
+               et->flags |= ETOX_BREAK_WORDS;
+       else
+               et->flags &= ~ETOX_BREAK_WORDS;
+
+       etox_layout(et);
+}
+
+/**
  * etox_set_alpha - change the alpha value for the etox
  * @et: the etox to change alpha
  * @alpha: the new alpha value for the etox
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_context.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- etox_context.c      10 Sep 2003 03:03:44 -0000      1.16
+++ etox_context.c      17 Feb 2004 21:58:20 -0000      1.17
@@ -331,7 +331,25 @@
        context->font_size = size;
 }
 
-/*
+ /**
+  * etox_context_get_font - get the default font for the etox
+  * @et: the etox to get the font from
+  * @size: where the size will be placed
+  * @return Returns the font name on success, NULL on failure
+  */
+char *etox_context_get_font(Etox_Context *context, int *size)
+{
+       CHECK_PARAM_POINTER_RETURN("context", context, NULL);
+
+    *size = context->font_size;
+
+    if (!context->font)
+        return NULL;
+
+    return strdup(context->font);
+}
+
+/**
  * etox_context_get_style - retrieve the name of current style
  * @et: the etox to query for current style.
  *
@@ -412,8 +430,10 @@
 
        IF_FREE(context->marker.text);
        IF_FREE(context->marker.style);
-       context->marker.text = strdup(marker);
-       context->marker.style = strdup(style);
+       if (marker)
+               context->marker.text = strdup(marker);
+       if (style)
+               context->marker.style = strdup(style);
 }
 
 /*
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- etox_line.c 18 Oct 2003 16:43:37 -0000      1.30
+++ etox_line.c 17 Feb 2004 21:58:20 -0000      1.31
@@ -421,8 +421,15 @@
        if (index != -1){
                char *tmp;
 
-               /* don't start a new line with a space */
                tmp = estyle_get_text(bit);
+
+               /* Back up to some whitespace when necessary */
+               if (et->flags & ETOX_BREAK_WORDS) {
+                       while (index > 0 && !isspace(tmp[index]))
+                               index--;
+               }
+
+               /* don't start a new line with a space */
                while (index < strlen(tmp) && isspace(tmp[index]))
                        index++;
                FREE(tmp);




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to