Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/etox
Dir : e17/libs/etox/src
Modified Files:
Etox.h etox.c etox_line.c etox_line.h etox_selection.c
Log Message:
Support for more comprehensive merging of lines internally. Fix
etox_prepend_text. Start of wrapping test in etox_selections.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -3 -r1.34 -r1.35
--- Etox.h 26 Jul 2003 06:35:21 -0000 1.34
+++ Etox.h 28 Jul 2003 22:04:31 -0000 1.35
@@ -129,6 +129,11 @@
int x, y, w, h;
/*
+ * Geometry the text prefers w/o wraps.
+ */
+ int tw, th;
+
+ /*
* The length text in the etox
*/
int length;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- etox.c 27 Jul 2003 05:27:09 -0000 1.46
+++ etox.c 28 Jul 2003 22:04:31 -0000 1.47
@@ -221,11 +221,12 @@
*/
et->length -= end->length;
et->h -= end->h;
- etox_line_merge(end, start);
+ etox_line_merge_append(end, start);
+ etox_line_free(start);
et->length += end->length;
et->h += end->h;
- if (end->w > et->w)
- et->w = end->w;
+ if (end->w > et->tw)
+ et->tw = end->w;
}
/*
@@ -234,8 +235,8 @@
while (lines) {
start = lines->data;
- if (start->w > et->w)
- et->w = start->w;
+ if (start->w > et->tw)
+ et->tw = start->w;
et->h += start->h;
et->length += start->length;
@@ -286,9 +287,9 @@
Evas_List *l;
l = evas_list_last(lines);
- end = l->data;
- start = et->lines->data;
- et->lines = evas_list_remove(et->lines, start);
+ start = l->data;
+ lines = evas_list_remove(lines, start);
+ end = et->lines->data;
/*
* Need to adjust the height and length of the line to reflect
@@ -296,30 +297,32 @@
*/
et->length -= end->length;
et->h -= end->h;
- etox_line_merge(end, start);
+ etox_line_merge_prepend(start, end);
+ etox_line_free(start);
et->length += end->length;
et->h += end->h;
- if (end->w > et->w)
- et->w = end->w;
+ if (end->w > et->tw)
+ et->tw = end->w;
}
/*
* Now add the remaining lines to the end of the line list.
*/
- while (et->lines) {
- end = et->lines->data;
+ while (lines) {
+ Evas_List *l;
- if (end->w > et->w)
- et->w = end->w;
+ l = evas_list_last(lines);
+ end = l->data;
+
+ if (end->w > et->tw)
+ et->tw = end->w;
et->h += end->h;
et->length += end->length;
- lines = evas_list_append(lines, end);
- et->lines = evas_list_remove(et->lines, end);
+ et->lines = evas_list_prepend(et->lines, end);
+ lines = evas_list_remove(lines, end);
}
- et->lines = lines;
-
/*
* Layout the lines on the etox.
*/
@@ -384,8 +387,8 @@
/*
* Grab the largest line width for the width of the etox.
*/
- if (line->w > et->w)
- et->w = line->w;
+ if (line->w > et->tw)
+ et->tw = line->w;
et->h += line->h;
et->length += line->length;
@@ -984,6 +987,8 @@
/*
* Create a new line for the next text
*/
+ if (line->w > et->tw)
+ et->tw = line->w;
line = etox_line_new(line->flags);
ret = evas_list_append(ret, line);
line->et = et;
@@ -1140,7 +1145,8 @@
et->lines = evas_list_remove(et->lines, line);
/* merge the two lines */
- etox_line_merge(prevline, line);
+ etox_line_merge_append(prevline, line);
+ etox_line_free(line);
/* skip the line we just merged */
l = l->next;
@@ -1200,7 +1206,10 @@
*/
et->h = y - et->y;
- evas_object_resize(et->clip, et->w, et->h);
+ if (et->context->flags & ETOX_SOFT_WRAP)
+ evas_object_resize(et->clip, et->w, et->h);
+ else
+ evas_object_resize(et->clip, et->tw, et->h);
}
Etox_Line *
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- etox_line.c 26 Jul 2003 06:35:21 -0000 1.13
+++ etox_line.c 28 Jul 2003 22:04:31 -0000 1.14
@@ -255,13 +255,13 @@
}
/*
- * etox_line_merge - merge two lines into the first line, free the second
+ * etox_line_merge_append - merge lines into the first line, empty the second
* @line1: the destination of the merged lines
* @line2: the line that will be merged with line1
*
* Returns no value. Moves the bits from line2 into line 1.
*/
-void etox_line_merge(Etox_Line * line1, Etox_Line * line2)
+void etox_line_merge_append(Etox_Line * line1, Etox_Line * line2)
{
Estyle *bit;
@@ -283,11 +283,37 @@
if (line2->h > line1->h)
line1->h = line2->h;
line1->length += line2->length;
+}
+/*
+ * etox_line_merge_prepend - merge lines into the second line, empty the first
+ * @line1: the destination of the merged lines
+ * @line2: the line that will be merged with line1
+ *
+ * Returns no value. Moves the bits from line2 into line 1.
+ */
+void etox_line_merge_prepend(Etox_Line * line1, Etox_Line * line2)
+{
+ Estyle *bit;
+
+ CHECK_PARAM_POINTER("line1", line1);
+ CHECK_PARAM_POINTER("line2", line2);
+
+ /*
+ * Move the bits from line2 to line1.
+ */
+ while (line1->bits) {
+ bit = line1->bits->data;
+ line2->bits = evas_list_prepend(line2->bits, bit);
+ line1->bits = evas_list_remove(line1->bits, bit);
+ }
/*
- * Destroy the line that was merged.
+ * Adjust the height, width and length of the merged line.
*/
- etox_line_free(line2);
+ line2->w += line1->w;
+ if (line1->h > line2->h)
+ line2->h = line1->h;
+ line2->length += line1->length;
}
/*
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- etox_line.h 23 Jul 2003 06:46:17 -0000 1.5
+++ etox_line.h 28 Jul 2003 22:04:31 -0000 1.6
@@ -9,7 +9,8 @@
void etox_line_prepend(Etox_Line * line, Estyle * bit);
void etox_line_layout(Etox_Line * line);
void etox_line_remove(Etox_Line * line, Estyle * bit);
-void etox_line_merge(Etox_Line * line1, Etox_Line * line2);
+void etox_line_merge_append(Etox_Line * line1, Etox_Line * line2);
+void etox_line_merge_prepend(Etox_Line * line1, Etox_Line * line2);
void etox_line_minimize(Etox_Line * line);
void etox_line_get_text(Etox_Line * line, char *buf);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_selection.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- etox_selection.c 23 Jul 2003 20:04:39 -0000 1.3
+++ etox_selection.c 28 Jul 2003 22:04:31 -0000 1.4
@@ -7,13 +7,20 @@
Estyle *bit = NULL; \
Etox_Line *line; \
Evas_List *l, *bl; \
+ int w, h; \
line = selected->start.line; \
l = evas_list_find_list(selected->etox->lines, selected->start.line); \
bl = evas_list_find_list(line->bits, selected->start.bit); \
while (bl && bit != selected->end.bit) { \
- bit = bl->data
+ bit = bl->data; \
+ estyle_geometry(bit, NULL, NULL, &w, NULL); \
+ line->w -= w
#define SELECTION_LOOP_END \
+ estyle_geometry(bit, NULL, NULL, &w, &h); \
+ line->w += w; \
+ if (h > line->h) \
+ line->h = h; \
bl = bl->next; \
if (!bl) { \
l = l->next; \
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs