Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_entry.c
Log Message:
Scrolling now works reasonably well, at least when using keys to navigate it.
Need to adjust the theme to see how well mouse selection works.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -3 -r1.58 -r1.59
--- ewl_entry.c 7 Jun 2003 15:38:20 -0000 1.58
+++ ewl_entry.c 8 Jun 2003 07:17:31 -0000 1.59
@@ -194,9 +194,8 @@
Ewl_Entry *e;
int xx, yy, ww, hh;
int c_spos, c_epos, base, l;
- int sx = 0, sy = 0, ex = 0, ey = 0;
+ int sx = 0, sy = 0, ex = 0, ey = 0, dx = 0;
unsigned int ew = 0;
- char *str;
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("w", w);
@@ -217,15 +216,15 @@
ewl_object_request_geometry(EWL_OBJECT(e->text), xx - e->offset, yy,
ww, hh);
- str = ewl_text_get_text(EWL_TEXT(e->text));
c_spos = ewl_cursor_get_start_position(EWL_CURSOR(e->cursor));
c_epos = ewl_cursor_get_end_position(EWL_CURSOR(e->cursor));
base = ewl_cursor_get_base_position(EWL_CURSOR(e->cursor));
l = ewl_text_get_length(EWL_TEXT(e->text));
- if (str && l && c_spos > l) {
- sx = xx + ewl_object_get_current_w(EWL_OBJECT(e->text));
- ew = 5 + sx;
+ if (l && c_spos > l) {
+ ex = sx = ewl_object_get_current_x(EWL_OBJECT(e->text)) +
+ ewl_object_get_current_w(EWL_OBJECT(e->text));
+ ew = 5;
} else {
/*
@@ -244,27 +243,25 @@
* Scroll the text to fit the contents.
*/
if ((c_spos == base) && ((ex + ew) > (int)(xx + ww))) {
- /*
- * Calculation re-ordered to maintain precision
- */
- e->offset += (int)((ex + ew) - (xx + ww));
- printf("Scrolling text by %d\n", e->offset);
+ dx -= (int)((ex + ew) - (xx + ww));
}
else if ((c_epos == base) && (sx < xx)) {
- e->offset -= xx - sx;
+ dx = xx - sx;
}
if (e->offset < 0)
e->offset = 0;
+ printf("Scrolling text by %d\n", e->offset);
- ew = (ex + ew);
- ewl_object_request_geometry(EWL_OBJECT(e->text), xx - e->offset,
- CURRENT_Y(e), CURRENT_W(e), hh);
+ ewl_object_request_geometry(EWL_OBJECT(e->text),
+ ewl_object_get_current_x(EWL_OBJECT(e->text)) + dx,
+ CURRENT_Y(e), CURRENT_W(e), hh);
- ewl_object_request_geometry(EWL_OBJECT(e->cursor), sx, yy,
- ew - sx, hh);
+ ew = (ex + ew) - sx;
+ ewl_object_request_geometry(EWL_OBJECT(e->cursor), sx + dx, yy,
+ ew, hh);
- FREE(str);
+ e->offset -= dx;
DLEAVE_FUNCTION(DLEVEL_STABLE);
}
@@ -363,7 +360,7 @@
if (ev->x < CURRENT_X(e->text))
index = 0;
else if (ev->x > CURRENT_X(e->text) + CURRENT_W(e->text))
- index = ewl_text_get_length(EWL_TEXT(e->text));
+ index = ewl_text_get_length(EWL_TEXT(e->text)) + 1;
else {
index = ewl_text_get_index_at(EWL_TEXT(e->text), ev->x,
(CURRENT_Y(e->text) +
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs