From: <enl...@li...> - 2003-09-10 03:03:47
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : libs/etox Dir : e17/libs/etox/src Modified Files: Etox_private.h Makefile.am etox.c etox_context.c Log Message: Move ETOX_SOFT_WRAP flag from the context to the etox itself. Need to make it relayout when this is changed. added in some enum's for future Etox flags: ETOX_BREAK_WORDS when wrapping, break words at the last char on the line. need to make the default keep words whole. ETOX_MARKER_POSITION_* where to put the wrap marker. either at beginning of line or end, and whether inside the bounds of the etox or outside (in the margins). Also, actually set the et->th field to the current height of text in the etox. Currently, et->h and et->th are exactly the same... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox_private.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- Etox_private.h 27 Aug 2003 18:58:09 -0000 1.22 +++ Etox_private.h 10 Sep 2003 03:03:44 -0000 1.23 @@ -4,6 +4,38 @@ #include "Etox.h" #include <Edb.h> +typedef enum _etox_flags Etox_Flags; +enum _etox_flags +{ + ETOX_SOFT_WRAP = 0x1, + ETOX_BREAK_WORDS = 0x2 +}; + + +/* + * Eventually, where to place the wrap marker (if ETOX_SOFT_WRAP is set) + * (at start or end of line, and inside or outside etox bounds) + */ +typedef enum _etox_marker_position Etox_Marker_Position; +enum _etox_marker_position +{ + ETOX_MARKER_POSITION_FIRST = 0x10, + ETOX_MARKER_POSITION_LAST = 0x20, + ETOX_MARKER_POSITION_INSIDE = 0x40, + ETOX_MARKER_POSITION_OUTSIDE = 0x80 +}; + +/* + * There is some subtelty to this enum. It leaves the bits used by alignment + * untouched so that a single char can hold all of the necessary information. + */ +typedef enum _etox_line_flags Etox_Line_Flags; +enum _etox_line_flags +{ + ETOX_LINE_WRAPPED = 0x10 +}; + + /* * The color struct simply keeps track of the various colors available */ @@ -82,25 +114,14 @@ Evas_List *obstacles; /* - * Determine if the etox has been displayed yet. + * Whether to wrap the etox or not. */ - char visible; + char flags; /* * Alpha level of clip box that is applied to the text */ int alpha; -}; - -/* - * There is some subtelty to this enum. It leaves the bits used by alignment - * untouched so that a single char can hold all of the necessary information. - */ -typedef enum _etox_line_flags Etox_Line_Flags; -enum _etox_line_flags -{ - ETOX_SOFT_WRAP = 0x10, - ETOX_LINE_WRAPPED = 0x20, }; /* =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Makefile.am,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- Makefile.am 23 Jul 2003 06:46:16 -0000 1.14 +++ Makefile.am 10 Sep 2003 03:03:44 -0000 1.15 @@ -18,6 +18,6 @@ etox_selection.c -libetox_la_LIBADD = @evas_libs@ @ewd_libs@ +libetox_la_LIBADD = @evas_libs@ @ewd_libs@ -lefence libetox_la_DEPENDENCIES = $(top_builddir)/etox-config.h libetox_la_LDFLAGS = -version-info 0:2:0 =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -3 -r1.64 -r1.65 --- etox.c 8 Sep 2003 02:22:58 -0000 1.64 +++ etox.c 10 Sep 2003 03:03:44 -0000 1.65 @@ -128,8 +128,6 @@ et = evas_object_smart_data_get(obj); - et->visible = TRUE; - for (l = et->lines; l; l = l->next) { if (l->data) { line = l->data; @@ -160,8 +158,6 @@ et = evas_object_smart_data_get(obj); - et->visible = FALSE; - evas_object_hide(et->clip); } @@ -243,7 +239,7 @@ * Layout the lines on the etox starting at the newly added text. */ etox_layout(et); - if (et->lines && et->visible) + if (et->lines && evas_object_visible_get(obj)) evas_object_show(et->clip); } @@ -328,7 +324,7 @@ * Layout the lines on the etox. */ etox_layout(et); - if (et->lines && et->visible) + if (et->lines && evas_object_visible_get(obj)) evas_object_show(et->clip); } @@ -416,7 +412,7 @@ } etox_layout(et); - if (et->lines && et->visible) + if (et->lines && evas_object_visible_get(obj)) evas_object_show(et->clip); } @@ -467,7 +463,7 @@ } etox_layout(et); - if (et->lines && et->visible) + if (et->lines && evas_object_visible_get(obj)) evas_object_show(et->clip); } @@ -556,6 +552,30 @@ } /** + * etox_set_soft_wrap - turns on soft wrapping of lines that are + * longer than the etox is wide + * @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_soft_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_SOFT_WRAP; + else + et->flags &= ~ETOX_SOFT_WRAP; +} + + + + +/** * etox_set_layer - change the layer where the etox is displayed * @et: the etox to change layers * @layer: the layer to display the etox on the evas @@ -690,6 +710,7 @@ return; et->w = w; + et->h = h; /* * Layout lines if appropriate. @@ -1215,7 +1236,7 @@ * If we need to wrap the line, we don't need to re-layout since * the maximal width was used for splitting. */ - if ((et->context->flags & ETOX_SOFT_WRAP) && (line->w > et->w)) + if ((et->flags & ETOX_SOFT_WRAP) && (line->w > et->w)) etox_line_wrap(et, line); l = l->next; @@ -1226,15 +1247,17 @@ * Adjust the height of the etox to the height of all lines */ et->h = y - et->y; + et->th = et->h; + - if (et->context->flags & ETOX_SOFT_WRAP) + if (et->flags & ETOX_SOFT_WRAP) { evas_object_resize(et->clip, et->w, et->h); evas_object_resize(et->smart_obj, et->w, et->h); } else { - evas_object_resize(et->clip, et->tw, et->h); + evas_object_resize(et->clip, et->tw, et->th); evas_object_resize(et->smart_obj, et->tw, et->th); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_context.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- etox_context.c 8 Sep 2003 02:22:58 -0000 1.15 +++ etox_context.c 10 Sep 2003 03:03:44 -0000 1.16 @@ -399,24 +399,6 @@ } /** - * etox_context_set_soft_wrap - turns on soft wrapping of lines that are - * longer than the etox is wide - * @et: the etox to set for - * @boolean: 0 is off, anything else is on - * - * Returns no value. changes current context alignment value. - */ -void etox_context_set_soft_wrap(Etox_Context * context, int boolean) -{ - CHECK_PARAM_POINTER("context", context); - - if (boolean) - context->flags |= ETOX_SOFT_WRAP; - else - context->flags &= ~ETOX_SOFT_WRAP; -} - -/** * etox_set_wrap_marker - sets string to mark wrapped lines * @et: the etox to set for * @marker: the string to mark wrapped lines |