Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/etox
Dir : e17/libs/etox/src
Modified Files:
Etox.h Etox_private.h etox.c etox_context.c etox_line.c
etox_line.h etox_obstacle.c etox_selection.h
Log Message:
Merge of etox from SPLIT.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- Etox.h 28 May 2002 15:35:49 -0000 1.30
+++ Etox.h 14 Jan 2003 18:42:45 -0000 1.31
@@ -98,10 +98,11 @@
/*
* A marker for wrapped lines
*/
- struct {
- char *text;
- char *style;
- int r, g, b, a;
+ struct
+ {
+ char *text;
+ char *style;
+ int r, g, b, a;
} marker;
};
@@ -114,13 +115,13 @@
/*
* Evas for drawing the text
*/
- Evas evas;
+ Evas *evas;
/*
* Clip box on evas that bounds the text display and applies an alpha
* layer.
*/
- Evas_Object clip;
+ Evas_Object *clip;
/*
* The layer in the evas to set the text
@@ -145,12 +146,12 @@
/*
* List of lines in the etox
*/
- Evas_List lines;
+ Evas_List *lines;
/*
* List of obstacles in the etox
*/
- Evas_List obstacles;
+ Evas_List *obstacles;
/*
* Determine if the etox has been displayed yet.
@@ -166,8 +167,8 @@
/*
* Etox creation and deletion functions
*/
-Etox *etox_new(Evas evas);
-Etox *etox_new_all(Evas evas, int x, int y, int w, int h, int alpha,
+Etox *etox_new(Evas *evas);
+Etox *etox_new_all(Evas *evas, int x, int y, int w, int h, int alpha,
Etox_Alignment align);
void etox_free(Etox * et);
@@ -222,9 +223,8 @@
/*
* Wrap marker functions
*/
-void etox_context_set_wrap_marker(Etox * et, char *marker, char *style);
-void etox_context_set_wrap_marker_color(Etox * et, int r, int g, int b,
- int a);
+void etox_context_set_wrap_marker(Etox *et, char *marker, char *style);
+void etox_context_set_wrap_marker_color(Etox *et, int r, int g, int b, int a);
/*
* Text manipulation functions
@@ -256,22 +256,22 @@
* Appearance altering functions
*/
void etox_set_layer(Etox * et, int layer);
-void etox_set_clip(Etox * et, Evas_Object clip);
+void etox_set_clip(Etox * et, Evas_Object *clip);
void etox_set_alpha(Etox * et, int alpha);
/*
* Region selection and release
*/
-Evas_List etox_region_select(Etox * et, int start, int end);
-Evas_List etox_region_select_str(Etox * et, char *search, char *last);
-void etox_region_release(Evas_List region);
+Evas_List *etox_region_select(Etox * et, int start, int end);
+Evas_List *etox_region_select_str(Etox * et, char *search, char *last);
+void etox_region_release(Evas_List *region);
/*
* Region altering appearance modifiers
*/
-void etox_region_set_font(Evas_List region, char *name, int size);
-void etox_region_set_color(Evas_List region, int r, int g, int b, int a);
-void etox_region_set_style(Evas_List region, char *stylename);
+void etox_region_set_font(Evas_List *region, char *name, int size);
+void etox_region_set_color(Evas_List *region, int r, int g, int b, int a);
+void etox_region_set_style(Evas_List *region, char *stylename);
/*
* Obstacle manipulation functions
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox_private.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- Etox_private.h 4 May 2002 21:16:40 -0000 1.13
+++ Etox_private.h 14 Jan 2003 18:42:53 -0000 1.14
@@ -29,7 +29,7 @@
/*
* This is a pointer to a list of bits
*/
- Evas_List bits;
+ Evas_List *bits;
/*
* The dimensions of this line.
@@ -58,12 +58,12 @@
/*
* This is the estyle that displays the bit.
*/
- Evas_List estyles;
+ Evas_List *estyles;
/*
* Regions that reference this bit.
*/
- Evas_List regions;
+ Evas_List *regions;
};
#include "etox_line.h"
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- etox.c 28 May 2002 15:35:49 -0000 1.36
+++ etox.c 14 Jan 2003 18:42:59 -0000 1.37
@@ -1,10 +1,10 @@
#include "etox-config.h"
#include "Etox_private.h"
-static Evas_List _etox_break_text(Etox * et, char *text);
+static Evas_List *_etox_break_text(Etox * et, char *text);
static void _etox_wrap_lines(Etox * et);
static void _etox_unwrap_lines(Etox * et);
-static void _etox_layout(Etox * et, Evas_List start, int y);
+static void _etox_layout(Etox * et, int y);
/**
* etox_new - create a new etox with default settings
@@ -12,7 +12,7 @@
*
* Returns a pointer to a newly allocated etox on success, NULL on failure.
*/
-Etox *etox_new(Evas evas)
+Etox *etox_new(Evas *evas)
{
Etox *et;
@@ -48,7 +48,8 @@
/*
* Set up the default font
*/
- evas_font_add_path(evas, PACKAGE_DATA_DIR "/fonts");
+ evas_object_font_path_append(evas,
+ PACKAGE_DATA_DIR "/fonts");
et->context->font = strdup("nationff");
et->context->font_size = 14;
@@ -60,8 +61,8 @@
/*
* Set the clip rectangle for the etox
*/
- et->clip = evas_add_rectangle(evas);
- evas_set_color(et->evas, et->clip, 255, 255, 255, 255);
+ et->clip = evas_object_rectangle_add(evas);
+ evas_object_color_set(et->clip, 255, 255, 255, 255);
/*
* Set up a default blank wrap marker
@@ -90,7 +91,7 @@
*
* Returns a pointer to a newly allocated etox on success, NULL on failure.
*/
-Etox *etox_new_all(Evas evas, int x, int y, int w, int h, int alpha,
+Etox *etox_new_all(Evas *evas, int x, int y, int w, int h, int alpha,
Etox_Alignment align)
{
Etox *et;
@@ -123,7 +124,7 @@
void etox_free(Etox * et)
{
Etox_Obstacle *obst;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER("et", et);
@@ -148,7 +149,7 @@
void etox_show(Etox * et)
{
Etox_Line *line;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER("et", et);
@@ -164,10 +165,9 @@
/*
* Display and position the clip box with the correct size.
*/
- evas_show(et->evas, et->clip);
- evas_move(et->evas, et->clip, (double) (et->x), (double) (et->y));
- evas_resize(et->evas, et->clip, (double) (et->w),
- (double) (et->h));
+ evas_object_show(et->clip);
+ evas_object_move(et->clip, (double) (et->x), (double) (et->y));
+ evas_object_resize(et->clip, (double) (et->w), (double) (et->h));
}
/**
@@ -182,7 +182,7 @@
et->visible = FALSE;
- evas_hide(et->evas, et->clip);
+ evas_object_hide(et->clip);
}
/**
@@ -195,53 +195,49 @@
*/
void etox_append_text(Etox * et, char *text)
{
- Evas_List lines, l, ll, trail;
+ Evas_List *lines, *l, *ll;
Etox_Line *end = NULL, *start;
- int i, y;
+ int i;
CHECK_PARAM_POINTER("et", et);
CHECK_PARAM_POINTER("text", text);
/*
- * Break the incoming text into lines
+ * Break the incoming text into lines, and merge the first line of the
+ * new text with the last line of the old text.
*/
lines = _etox_break_text(et, text);
-
- /*
- * Find the end of the current lines. Remove it, and save it's current y
- * coordinate.
- */
- for (trail = NULL, l = et->lines; l; l = l->next) {
+ for (l = et->lines; l; l = l->next)
end = l->data;
- trail = l;
- }
- y = end->y;
-
- /*
- * Attempt to merge the last line of the old text with the first line of
- * the added text.
- */
- start = lines->data;
- lines = evas_list_remove(lines, start);
- et->length -= end->length;
- et->h -= end->h;
- etox_line_merge(end, start);
- et->length += end->length;
- et->h += end->h;
+ et->lines = evas_list_remove(et->lines, end);
for (i = 0, ll = lines; ll; ll = ll->next, i++) {
- start = ll->data;
+ if (i == 0) {
+ start = ll->data;
- /*
- * Now add the remaining lines to the end of the line
- * list.
- */
- if (start->w > et->w)
- et->w = start->w;
+ /*
+ * Need to adjust the height and length of the line to reflect
+the
+ * text that was added.
+ */
+ et->length -= start->length;
+ et->h -= start->h;
+ etox_line_merge(start, end);
+ et->length += start->length;
+ et->h += start->h;
+ et->lines = evas_list_append(et->lines, start);
+ } else {
+ start = ll->data;
- et->h += start->h;
- et->length += start->length;
- et->lines = evas_list_append(et->lines, start);
+ /*
+ * Now add the remaining lines to the end of the line list.
+ */
+ if (start->w > et->w)
+ et->w = start->w;
+
+ et->h += start->h;
+ et->length += start->length;
+ et->lines = evas_list_append(et->lines, start);
+ }
}
/*
@@ -252,7 +248,7 @@
/*
* Layout the lines on the etox starting at the newly added text.
*/
- _etox_layout(et, trail, y);
+ _etox_layout(et, end->y);
/*
* Destroy the temporary list of lines now that it is empty.
@@ -270,7 +266,7 @@
*/
void etox_prepend_text(Etox * et, char *text)
{
- Evas_List lines, l, ll, lll;
+ Evas_List *lines, *l, *ll, *lll;
Etox_Line *end = NULL, *start;
int i;
@@ -328,7 +324,7 @@
* Layout the lines on the etox.
*/
_etox_wrap_lines(et);
- _etox_layout(et, et->lines, et->y);
+ _etox_layout(et, et->y);
/*
* Destroy the temporary list of lines now that it is empty.
@@ -361,14 +357,14 @@
void etox_set_text(Etox * et, char *text)
{
Etox_Line *line;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER("et", et);
if (!text)
text = strdup("");
-
- text = strdup(text);
+ else
+ text = strdup(text);
etox_clear(et);
@@ -378,7 +374,7 @@
et->lines = _etox_break_text(et, text);
_etox_wrap_lines(et);
- _etox_layout(et, et->lines, et->y);
+ _etox_layout(et, et->y);
/*
* Sum up the length and height of the text in the etox.
@@ -410,7 +406,7 @@
{
char *ret, *temp;
Etox_Line *line;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER_RETURN("et", et, NULL);
@@ -446,6 +442,7 @@
void etox_clear(Etox * et)
{
Etox_Line *line;
+ Evas_List *l;
CHECK_PARAM_POINTER("et", et);
@@ -456,11 +453,12 @@
if (!et->lines)
return;
- while (et->lines) {
- line = et->lines->data;
- et->lines = evas_list_remove(et->lines, line);
+ for (l = et->lines; l; l = evas_list_remove(l, l->data)) {
+ line = l->data;
etox_line_free(line);
}
+
+ et->lines = NULL;
}
/**
@@ -475,7 +473,7 @@
{
Estyle *bit;
Etox_Line *line;
- Evas_List l, ll;
+ Evas_List *l, *ll;
CHECK_PARAM_POINTER("et", et);
@@ -519,8 +517,8 @@
if (et->alpha == alpha)
return;
- evas_get_color(et->evas, et->clip, &r, &g, &b, &a);
- evas_set_color(et->evas, et->clip, r, g, b, alpha);
+ evas_object_color_get(et->clip, &r, &g, &b, &a);
+ evas_object_color_set(et->clip, r, g, b, alpha);
}
/**
@@ -546,7 +544,7 @@
* Layout lines if appropriate.
*/
if (et->lines) {
- _etox_layout(et, et->lines, et->y);
+ _etox_layout(et, et->y);
}
/*
@@ -554,9 +552,8 @@
* do both a move and a resize in case the size has been adjusted
* during layout.
*/
- evas_move(et->evas, et->clip, (double) (et->x), (double) (et->y));
- evas_resize(et->evas, et->clip, (double) (et->w),
- (double) (et->h));
+ evas_object_move(et->clip, (double) (et->x), (double) (et->y));
+ evas_object_resize(et->clip, (double) (et->w), (double) (et->h));
}
/**
@@ -579,10 +576,10 @@
* Layout lines if appropriate.
*/
if (et->lines) {
- /* rewrap the lines */
- _etox_unwrap_lines(et);
- _etox_wrap_lines(et);
- _etox_layout(et, et->lines, et->y);
+ /* rewrap the lines */
+ _etox_unwrap_lines(et);
+ _etox_wrap_lines(et);
+ _etox_layout(et, et->y);
}
/*
@@ -590,9 +587,8 @@
* do both a move and a resize in case the size has been adjusted
* during layout.
*/
- evas_move(et->evas, et->clip, (double) (et->x), (double) (et->y));
- evas_resize(et->evas, et->clip, (double) (et->w),
- (double) (et->h));
+ evas_object_move(et->clip, (double) (et->x), (double) (et->y));
+ evas_object_resize(et->clip, (double) (et->w), (double) (et->h));
}
/**
@@ -640,7 +636,7 @@
int sum;
Estyle *bit = NULL;
Etox_Line *line = NULL;
- Evas_List l, ll, lll;
+ Evas_List *l, *ll, *lll;
CHECK_PARAM_POINTER("et", et);
@@ -712,7 +708,7 @@
Estyle *bit;
Etox_Line *line = NULL;
int tx, ty, tw, th;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER_RETURN("et", et, 0);
@@ -802,14 +798,14 @@
* Returns no value. Changes the clip rectangle for the etox @et to the clip
* rectangle @clip and updates the display.
*/
-void etox_set_clip(Etox * et, Evas_Object clip)
+void etox_set_clip(Etox * et, Evas_Object *clip)
{
CHECK_PARAM_POINTER("et", et);
if (clip == NULL)
- evas_unset_clip(et->evas, et->clip);
+ evas_object_clip_unset(et->clip);
else
- evas_set_clip(et->evas, et->clip, clip);
+ evas_object_clip_set(et->clip, clip);
}
/**
@@ -900,9 +896,9 @@
* Returns no value. Separates the text into lines and bits if specific
* characters are contained in the text.
*/
-static Evas_List _etox_break_text(Etox * et, char *text)
+static Evas_List *_etox_break_text(Etox * et, char *text)
{
- Evas_List ret = NULL;
+ Evas_List *ret = NULL;
Estyle *bit;
Etox_Line *line = NULL;
char *walk = text;
@@ -940,8 +936,7 @@
estyle_set_color(bit, et->context->r,
et->context->g, et->context->b,
et->context->a);
- estyle_set_font(bit, et->context->font,
- et->context->font_size);
+ estyle_set_font(bit, et->context->font,
+et->context->font_size);
etox_line_append(line, bit);
estyle_show(bit);
@@ -959,8 +954,7 @@
et->context->g, et->context->b,
et->context->a);
estyle_set_clip(bit, et->clip);
- estyle_set_font(bit, et->context->font,
- et->context->font_size);
+ estyle_set_font(bit, et->context->font,
+et->context->font_size);
etox_line_append(line, bit);
estyle_show(bit);
*text = t;
@@ -984,8 +978,7 @@
et->context->g, et->context->b,
et->context->a);
estyle_set_clip(bit, et->clip);
- estyle_set_font(bit, et->context->font,
- et->context->font_size);
+ estyle_set_font(bit, et->context->font,
+et->context->font_size);
etox_line_append(line, bit);
estyle_show(bit);
@@ -1012,8 +1005,7 @@
estyle_set_color(bit, et->context->r, et->context->g,
et->context->b, et->context->a);
estyle_set_clip(bit, et->clip);
- estyle_set_font(bit, et->context->font,
- et->context->font_size);
+ estyle_set_font(bit, et->context->font, et->context->font_size);
etox_line_append(line, bit);
estyle_show(bit);
} else if (line->bits == NULL) {
@@ -1030,25 +1022,88 @@
*
* Returns nothing, modifies the lines of the etox
*/
-void _etox_wrap_lines(Etox * et)
+void _etox_wrap_lines(Etox *et)
{
- Etox_Line *line;
- Evas_List l;
-
- CHECK_PARAM_POINTER("et", et);
-
- /* if the soft wrap flag is not set, don't do anything */
- if (!(et->context->flags & ETOX_SOFT_WRAP))
- return;
-
- /* iterate through the lines */
- for (l = et->lines; l; l = l->next) {
- line = l->data;
-
- /* if the line is wider than the etox */
- if (line->w > et->w)
- etox_line_wrap(et, line);
- }
+ Etox_Line *line;
+ Etox_Line *newline;
+ Evas_List *l, *ll;
+
+ CHECK_PARAM_POINTER("et", et);
+
+ /* if the soft wrap flag is not set, don't do anything */
+ if (!(et->context->flags & ETOX_SOFT_WRAP))
+ return;
+
+ /* iterate through the lines */
+ for (l = et->lines; l; l = l->next)
+ {
+ line = l->data;
+
+ /* if the line is wider than the etox */
+ if (line->w > et->w)
+ {
+ Estyle *bit = NULL, *split = NULL, *marker;
+ int index = -1;
+
+ /* iterate through the bits to find the one on the border */
+ for (ll = line->bits; ll; ll = ll->next)
+ {
+ bit = ll->data;
+
+ /* get the index of the character on the edge */
+ index = estyle_text_at_position(bit, et->x + et->w, line->y,
+ NULL, NULL, NULL, NULL);
+ /* if this bit contained the character on the edge, break */
+ if (index >= 0)
+ break;
+ }
+
+ /* if we have an index */
+ if (index != -1)
+ {
+ char *tmp;
+
+ /* don't start a new line with a space */
+ tmp = estyle_get_text(bit);
+ while (tmp[index] == ' ')
+ index ++;
+ FREE(tmp);
+
+ /* split the edge bit */
+ split = estyle_split(bit, index);
+ }
+
+ /* if split successful, set up the new bit */
+ if (split)
+ {
+ /* create a marker bit. */
+ marker = estyle_new(et->evas, et->context->marker.text,
+ et->context->marker.style);
+ estyle_set_color(marker, et->context->marker.r, et->context->marker.g,
+ et->context->marker.b, et->context->marker.a);
+ estyle_set_clip(marker, et->clip);
+ estyle_set_font(bit, et->context->font, et->context->font_size);
+ estyle_show(marker);
+
+ /* create a new line, with the marker and the split bits */
+ newline = etox_line_new(line->flags | ETOX_LINE_WRAPPED);
+ newline->et = et;
+ etox_line_append(newline, marker);
+ etox_line_append(newline, split);
+
+ /* move the remaining bits to the new line */
+ for (ll = ll->next; ll; ll = ll->next)
+ {
+ bit = ll->data;
+ etox_line_remove(line, bit);
+ etox_line_append(newline, split);
+ }
+
+ /* add the newline after the current one */
+ et->lines = evas_list_append_relative(et->lines, newline, line);
+ }
+ }
+ }
}
@@ -1058,44 +1113,38 @@
*
* Returns nothing, modifies the lines of the etox
*/
-void _etox_unwrap_lines(Etox * et)
+void _etox_unwrap_lines(Etox *et)
{
- Evas_List l, newlines = NULL;
- Etox_Line *line, *prevline;
-
- CHECK_PARAM_POINTER("et", et);
-
- if (!(et->context->flags & ETOX_SOFT_WRAP))
- return;
-
- /* The first line can't be a wrapped line, so set it as 'prevline' */
- prevline = et->lines->data;
- /* Add it to the list of newlines */
- newlines = evas_list_append(newlines, prevline);
-
- /* iterate through the remaining lines */
- for (l = et->lines->next; l; l = l->next) {
- line = l->data;
-
- /* if its a line created due to wrapping */
- if (line->flags & ETOX_LINE_WRAPPED) {
- /* free and remove the wrap marker bit (first bit) */
- estyle_free((Estyle *) (line->bits->data));
- line->bits = line->bits->next;
-
- /* merge it with the line before */
- etox_line_merge(prevline, line);
-
- } else {
- /* if not a wrapped line, add it to the list of newlines */
- newlines = evas_list_append(newlines, line);
- /* make it the new 'previous line' */
- prevline = line;
- }
- }
-
- /* set the etox's list of lines to newlines */
- et->lines = newlines;
+ Etox_Line *line, *prevline;
+ Evas_List *l;
+ int i = 0;
+
+ CHECK_PARAM_POINTER("et", et);
+
+ prevline = et->lines->data;
+
+ for (l = et->lines->next; l; l = l->next)
+ {
+ i++;
+ line = l->data;
+ if (line->flags & ETOX_LINE_WRAPPED)
+ {
+ printf("unwrap line: %i\n", i);
+ /* remove the wrap marker bit */
+ line->bits = evas_list_remove(line->bits, line->bits->data);
+
+ /* remove the line from the list */
+ et->lines = evas_list_remove(et->lines, line);
+
+ /* merge the two lines */
+ etox_line_merge(prevline, line);
+
+ /* skip the line we just merged */
+ l = l->next;
+ }
+ else
+ prevline = line;
+ }
}
/*
@@ -1107,10 +1156,10 @@
* current position in the line list, so that should be set appropriately
* before performing this operation.
*/
-static void _etox_layout(Etox * et, Evas_List start, int y)
+static void _etox_layout(Etox * et, int y)
{
Etox_Line *line;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER("et", et);
@@ -1118,7 +1167,7 @@
* Traverse the list displaying each line, moving down the screen after
* each line.
*/
- for (l = start; l; l = l->next) {
+ for (l = et->lines; l; l = l->next) {
line = l->data;
line->x = et->x;
line->y = y;
@@ -1132,5 +1181,5 @@
*/
et->h = y - et->y;
- evas_resize(et->evas, et->clip, et->w, et->h);
+ evas_object_resize(et->clip, et->w, et->h);
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_context.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- etox_context.c 28 May 2002 15:35:49 -0000 1.5
+++ etox_context.c 14 Jan 2003 18:43:12 -0000 1.6
@@ -155,9 +155,21 @@
* the event @type are cleared from the current context of @et.
*/
/*
-void etox_context_clear_callbacks(Etox *et, int type)
+void etox_context_clear_callbacks(Etox *et)
{
+ Evas_List l;
+ Etox_Callback *cb;
+
CHECK_PARAM_POINTER("et", et);
+
+ l = et->context->callbacks;
+ while (l) {
+ cb = l->data;
+ l = evas_list_remove(l, cb);
+ FREE(cb);
+ }
+
+ et->context->callbacks = NULL;
}
*/
@@ -165,15 +177,42 @@
* etox_context_add_callback - add an event callback to the current context
*/
/*
-void etox_context_add_callback(Etox *et, int type, Etox_Cb_Func func,
- void *data)
+void etox_context_add_callback(Etox *et, Evas_Callback_Type type,
+ Etox_Cb_Func func, void *data)
{
+ Etox_Callback *cb;
+
CHECK_PARAM_POINTER("et", et);
+
+ cb = malloc(sizeof(Etox_Callback));
+ cb->type = type;
+ cb->func = func;
+ cb->data = data;
+
+ et->context->callbacks = evas_list_append(et->context->callbacks, cb);
}
+*/
-void etox_context_del_callback(Etox *et, int index)
+/**
+ * etox_context_del_callback - delete the callback events of a certain type
+ */
+/*
+void etox_context_del_callback(Etox *et, Evas_Callback_Type callback)
{
+ Evas_List l;
+
CHECK_PARAM_POINTER("et", et);
+
+ l = et->context->callbacks;
+ while (l) {
+ Etox_Callback *cb;
+
+ cb = l->data;
+ l = l->next;
+ if (cb->type == callback)
+ et->context->callbacks =
+ evas_list_remove(et->context->callbacks, cb);
+ }
}
*/
@@ -273,14 +312,14 @@
*
* Returns no value. changes current context alignment value.
*/
-void etox_context_set_soft_wrap(Etox * et, int boolean)
+void etox_context_set_soft_wrap(Etox *et, int boolean)
{
- CHECK_PARAM_POINTER("et", et);
+ CHECK_PARAM_POINTER("et", et);
- if (boolean)
- et->context->flags = et->context->flags | ETOX_SOFT_WRAP;
- else
- et->context->flags = et->context->flags & ~ETOX_SOFT_WRAP;
+ if (boolean)
+ et->context->flags = et->context->flags | ETOX_SOFT_WRAP;
+ else
+ et->context->flags = et->context->flags & ~ETOX_SOFT_WRAP;
}
/*
@@ -291,13 +330,13 @@
*
* Returns nothing, changes context
*/
-void etox_context_set_wrap_marker(Etox * et, char *marker, char *style)
+void etox_context_set_wrap_marker(Etox *et, char *marker, char *style)
{
- CHECK_PARAM_POINTER("et", et);
- IF_FREE(et->context->marker.text);
- IF_FREE(et->context->marker.style);
- et->context->marker.text = strdup(marker);
- et->context->marker.style = strdup(style);
+ CHECK_PARAM_POINTER("et", et);
+ IF_FREE(et->context->marker.text);
+ IF_FREE(et->context->marker.style);
+ et->context->marker.text = strdup(marker);
+ et->context->marker.style = strdup(style);
}
/*
@@ -310,11 +349,10 @@
*
* Returns nothing, changes context
*/
-void etox_context_set_wrap_marker_color(Etox * et, int r, int g, int b,
- int a)
+void etox_context_set_wrap_marker_color(Etox *et, int r, int g, int b, int a)
{
- et->context->marker.r = r;
- et->context->marker.g = g;
- et->context->marker.b = b;
- et->context->marker.a = a;
+ et->context->marker.r = r;
+ et->context->marker.g = g;
+ et->context->marker.b = b;
+ et->context->marker.a = a;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- etox_line.c 28 May 2002 15:35:49 -0000 1.8
+++ etox_line.c 14 Jan 2003 18:43:13 -0000 1.9
@@ -32,6 +32,7 @@
void etox_line_free(Etox_Line * line)
{
Estyle *bit;
+ Evas_List *l;
CHECK_PARAM_POINTER("line", line);
@@ -43,9 +44,15 @@
/*
* Free all of the bits on the line.
*/
- bit = line->bits->data;
- line->bits = evas_list_remove(line->bits, bit);
- estyle_free(bit);
+ for (l = line->bits; l; l = l->next) {
+ bit = l->data;
+ estyle_free(bit);
+ }
+
+ /*
+ * Clean up the remaining list
+ */
+ evas_list_free(line->bits);
}
FREE(line);
@@ -60,7 +67,7 @@
void etox_line_show(Etox_Line * line)
{
Estyle *bit;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER("line", line);
@@ -83,7 +90,7 @@
void etox_line_hide(Etox_Line * line)
{
Estyle *bit;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER("line", line);
@@ -179,7 +186,7 @@
int x;
Estyle *bit;
int tx, ty, tw, th;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER("line", line);
@@ -239,7 +246,7 @@
void etox_line_minimize(Etox_Line * line)
{
Estyle *bit, *last_bit = NULL;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER("line", line);
@@ -269,6 +276,7 @@
void etox_line_merge(Etox_Line * line1, Etox_Line * line2)
{
Estyle *bit;
+ Evas_List *l;
CHECK_PARAM_POINTER("line1", line1);
CHECK_PARAM_POINTER("line2", line2);
@@ -276,12 +284,10 @@
/*
* Move the bits from line2 to line1.
*/
- while (line2->bits) {
- bit = line2->bits->data;
- line2->bits = evas_list_remove(line2->bits, bit);
+ for (l = line2->bits; l; l = l->next) {
+ bit = l->data;
line1->bits = evas_list_append(line1->bits, bit);
}
-
/*
* Adjust the height, width and length of the merged line.
*/
@@ -308,7 +314,7 @@
{
char *temp;
Estyle *es;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER("line", line);
CHECK_PARAM_POINTER("buf", buf);
@@ -330,7 +336,7 @@
void
etox_line_wrap(Etox *et, Etox_Line *line)
{
- Evas_List ll;
+ Evas_List *ll;
Etox_Line *newline;
Estyle *bit = NULL, *split = NULL, *marker;
int index = -1;
@@ -390,4 +396,39 @@
/* add the newline after the current one */
et->lines = evas_list_append_relative(et->lines, newline, line);
}
+}
+
+Evas_List *
+etox_line_coord_to_bit(Etox_Line *line, int x)
+{
+ int bx, by, bw, bh;
+ Evas_List *l = NULL, *ll = NULL;
+ Estyle *bit = NULL;
+
+ /*
+ * Find the bit on this line
+ */
+ l = line->bits;
+ while (l) {
+ bit = l->data;
+ estyle_geometry(bit, &bx, &by, &bw, &bh);
+ if (bx < x)
+ break;
+ l = l->next;
+ }
+
+ /*
+ * The found line did not contain an intersecting bit.
+ */
+ while (l && !bit) {
+ line = l->data;
+ ll = line->bits;
+ if (ll)
+ bit = ll->data;
+ }
+
+ if (!bit)
+ ll = NULL;
+
+ return ll;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- etox_line.h 28 May 2002 15:35:49 -0000 1.3
+++ etox_line.h 14 Jan 2003 18:43:15 -0000 1.4
@@ -12,6 +12,5 @@
void etox_line_merge(Etox_Line * line1, Etox_Line * line2);
void etox_line_minimize(Etox_Line * line);
void etox_line_get_text(Etox_Line * line, char *buf);
-void etox_line_wrap(Etox *et, Etox_Line *line);
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_obstacle.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- etox_obstacle.c 25 Apr 2002 16:32:00 -0000 1.9
+++ etox_obstacle.c 14 Jan 2003 18:43:18 -0000 1.10
@@ -56,7 +56,7 @@
int j = 0;
int x, y, w, h;
Etox_Line *line;
- Evas_List l_nodes, l;
+ Evas_List *l_nodes, *l;
CHECK_PARAM_POINTER("et", et);
CHECK_PARAM_POINTER("obst", obst);
@@ -122,7 +122,7 @@
int i, j;
Estyle *bit;
Etox_Line *line;
- Evas_List l, ll;
+ Evas_List *l, *ll;
CHECK_PARAM_POINTER("et", et);
CHECK_PARAM_POINTER("obst", obst);
@@ -164,7 +164,7 @@
{
Estyle *bit;
int x, y, w, h;
- Evas_List l;
+ Evas_List *l;
CHECK_PARAM_POINTER("line", line);
CHECK_PARAM_POINTER("obst", obst);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_selection.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- etox_selection.h 25 Apr 2002 16:32:01 -0000 1.2
+++ etox_selection.h 14 Jan 2003 18:43:20 -0000 1.3
@@ -1,5 +1,5 @@
-#ifndef _ETOX_REGION_H
-#define _ETOX_REGION_H
+#ifndef _ETOX_SELECTION_H
+#define _ETOX_SELECTION_H
/*
* These functions select regions of the etox.
@@ -32,8 +32,8 @@
*/
void etox_selection_add_callback(Etox_Selection * selected,
Evas_Callback_Type callback,
- void (*func) (void *data, Evas e,
- Evas_Object o, int b, int x,
+ void (*func) (void *data, Evas *e,
+ Evas_Object *o, int b, int x,
int y), void *data);
void etox_selection_del_callback(Etox_Selection * selected,
Evas_Callback_Type callback);
-------------------------------------------------------
This SF.NET email is sponsored by: Take your first step towards giving
your online business a competitive advantage. Test-drive a Thawte SSL
certificate - our easy online guide will show you how. Click here to get
started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs