Enlightenment CVS committal
Author : codewarrior
Project : e17
Module : libs/esmart
Dir : e17/libs/esmart/src/lib/esmart_textarea
Modified Files:
TODO esmart_textarea_callbacks.c esmart_textarea_cursor.c
Log Message:
optimized up / down movement, looked into unformatting \n to no avail. Raster,
help? TODO changed
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_textarea/TODO,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- TODO 31 Mar 2005 08:57:09 -0000 1.4
+++ TODO 5 Apr 2005 23:06:02 -0000 1.5
@@ -1,19 +1,22 @@
Simple:
=======
-- add mouse selection
- handle up / down movement when lower line longer that top one and v/v
- remove all hardcoded values
Medium:
=======
+- add mouse selection
- when we reach the top / botton line, up / down need special cases
- if on the last line and hit enter, cursor doesnt move till you enter
a character
-
+- handle empty lines
Hard:
=====
- add copy / paste (clipboard support)
+- sort out \n removal
+- look into fact that at end of line, cursor is 1 pos ahead
+- save / restore text with \n
Insane:
=======
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_textarea/esmart_textarea_callbacks.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- esmart_textarea_callbacks.c 3 Apr 2005 01:57:54 -0000 1.3
+++ esmart_textarea_callbacks.c 5 Apr 2005 23:06:03 -0000 1.4
@@ -43,7 +43,7 @@
!strcmp(ev->keyname, "KP_Return") ||
!strcmp(ev->keyname, "Enter") ||
!strcmp(ev->keyname, "KP_Enter")) {
- evas_object_textblock_text_insert(t->text, "\0");
+ //evas_object_textblock_text_insert(t->text, "\0");
evas_object_textblock_format_insert(t->text, "\n");
} else {
evas_object_textblock_text_insert(t->text, ev->string);
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/esmart/src/lib/esmart_textarea/esmart_textarea_cursor.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- esmart_textarea_cursor.c 2 Apr 2005 12:58:13 -0000 1.3
+++ esmart_textarea_cursor.c 5 Apr 2005 23:06:03 -0000 1.4
@@ -76,14 +76,26 @@
cur_line = evas_object_textblock_cursor_line_get(t->text);
}
- /* keep moving until we hit the required x coord */
- evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
- while(cx > i && pos <= len) {
- pos++;
- evas_object_textblock_cursor_pos_set(t->text, pos);
- evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
-
- }
+ /* get y of this line */
+ evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
+
+ /* get pos using y of line and x of initial char */
+ pos = evas_object_textblock_char_coords_get(t->text, cx, cy,
+ NULL,NULL,NULL,NULL);
+ if(pos > 0) pos++;
+ else if(pos < 0)
+ {
+ /* handle case where upper line is longer than lower line */
+ pos = evas_object_textblock_line_end_pos_get(t->text);
+ }
+
+ evas_object_textblock_cursor_pos_set(t->text, pos);
+ /* keep moving until we hit the required x coord */
+// while(cx > i && pos <= len) {
+// pos++;
+// evas_object_textblock_cursor_pos_set(t->text, pos);
+// evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
+// }
}
@@ -107,43 +119,56 @@
pos--;
evas_object_textblock_cursor_pos_set(t->text, pos);
cur_line = evas_object_textblock_cursor_line_get(t->text);
- }
+ }
- /* keep moving until we hit the required x coord */
- evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
- while(cx < i && pos >= 0) {
- pos--;
- evas_object_textblock_cursor_pos_set(t->text, pos);
- evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
- }
+ /* get y of this line */
+ evas_object_textblock_char_pos_get(t->text,pos,&i,&cy,&cw,&ch);
+
+ /* get pos using y of line and x of initial char */
+ pos = evas_object_textblock_char_coords_get(t->text, cx, cy,
+ NULL,NULL,NULL,NULL);
+ /* pos is always one char behind because of above loop */
+ if(pos > 0) pos++;
+ else if(pos < 0) {
+ /* handle case where lower line is longer than upper line */
+ pos = evas_object_textblock_line_end_pos_get(t->text);
+ }
+ evas_object_textblock_cursor_pos_set(t->text, pos);
}
/* move cursor to home position, usually, start of line */
-void _esmart_textarea_cursor_move_home(Esmart_Text_Area *ta) {
+void _esmart_textarea_cursor_move_home(Esmart_Text_Area *t) {
}
/* move cursor to end position, usually, end of line */
-void _esmart_textarea_cursor_move_end(Esmart_Text_Area *ta) {
+void _esmart_textarea_cursor_move_end(Esmart_Text_Area *t) {
}
/* delete one character from current cursor location */
/* TODO: make sure that the last pos = len, and not len - 1 */
-void _esmart_textarea_cursor_delete_right(Esmart_Text_Area *ta) {
+void _esmart_textarea_cursor_delete_right(Esmart_Text_Area *t) {
int pos, len;
- pos = evas_object_textblock_cursor_pos_get(ta->text);
- len = evas_object_textblock_length_get(ta->text);
+ pos = evas_object_textblock_cursor_pos_get(t->text);
+ len = evas_object_textblock_length_get(t->text);
if(pos == len) return;
- evas_object_textblock_text_del(ta->text, 1);
+ evas_object_textblock_text_del(t->text, 1);
}
/* delete left, backspace, one character from current location */
-void _esmart_textarea_cursor_delete_left(Esmart_Text_Area *ta) {
- int pos;
- pos = evas_object_textblock_cursor_pos_get(ta->text);
+void _esmart_textarea_cursor_delete_left(Esmart_Text_Area *t) {
+ int pos, start;
+ pos = evas_object_textblock_cursor_pos_get(t->text);
+ start = evas_object_textblock_line_start_pos_get(t->text);
if(pos == 0) return;
- evas_object_textblock_cursor_pos_set(ta->text, pos - 1);
- evas_object_textblock_text_del(ta->text, 1);
+ if(pos == start)
+ {
+ /* we need to remove the formatting!! we cant though because
+ * of current limitations in textblock, bug raster to fix
+ */
+ }
+ evas_object_textblock_cursor_pos_set(t->text, pos - 1);
+ evas_object_textblock_text_del(t->text, 1);
}
/* override the default cursor */
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs