Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/etox
Dir : e17/libs/etox/src
Modified Files:
Etox.h etox.c etox_line.c
Log Message:
- add an etox_delete_text method
- has an issue with deleteing the last char (char dosen't disappear)
- acts a bit strange when deleting from the end (as seen in ewl_test entry)
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/Etox.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -3 -r1.52 -r1.53
--- Etox.h 29 Jul 2004 19:46:39 -0000 1.52
+++ Etox.h 6 Oct 2004 04:48:45 -0000 1.53
@@ -169,6 +169,7 @@
void etox_append_text(Evas_Object * et, char *text);
void etox_prepend_text(Evas_Object * et, char *text);
void etox_insert_text(Evas_Object * et, char *text, int index);
+void etox_delete_text(Evas_Object * et, unsigned int index, unsigned int len);
void etox_set_text(Evas_Object * et, char *text);
char *etox_get_text(Evas_Object * et);
void etox_clear(Evas_Object * et);
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -3 -r1.93 -r1.94
--- etox.c 5 Oct 2004 23:29:11 -0000 1.93
+++ etox.c 6 Oct 2004 04:48:45 -0000 1.94
@@ -457,6 +457,88 @@
}
/**
+ * etox_delete_text - delete text from an etox at specified index
+ * @et: the etox to delete the text from
+ * @index: the start position to delete from
+ * @len: the number of chars to delete
+ *
+ * Returns no value. Removes @len characters from text starting at @index
+ * and updates the layout and display of the etox.
+ */
+void etox_delete_text(Evas_Object * obj, unsigned int index, unsigned int len)
+{
+ Etox *et;
+ Etox_Line *start, *idx;
+ Evas_Object *bit;
+ int orig_index = index;
+
+ CHECK_PARAM_POINTER("obj", obj);
+
+ et = evas_object_smart_data_get(obj);
+
+ start = etox_index_to_line(et, &index);
+ if (!start) return;
+
+ bit = etox_line_index_to_bit(start, &index);
+ etox_line_split(start, bit, index);
+
+ index ++;
+ idx = etox_index_to_line(et, &index);
+ if (!idx) return;
+
+ bit = etox_line_index_to_bit(idx, &index);
+ if (!bit) {
+ evas_list_remove(et->lines, idx);
+ etox_line_free(idx);
+ return;
+ }
+
+ /*
+ * these +1's are here cuz the etox length seems to be +1 for some
+ * reason so this just accomidates that
+ */
+ if (idx->length == len + 1) {
+ etox_line_remove(idx, bit);
+ evas_list_remove(et->lines, idx);
+ etox_line_free(idx);
+
+ } else if (idx->length > (len + 1)) {
+ Etox_Line *end = NULL;
+ Evas_Object *b2;
+
+ index = len;
+ b2 = etox_line_index_to_bit(idx, &index);
+ etox_line_split(idx, b2, index);
+
+ index = orig_index + len + 2;
+ end = etox_index_to_line(et, &index);
+
+ etox_line_merge_append(start, end);
+
+ et->length -= len;
+
+ evas_list_remove(et->lines, idx);
+ evas_list_remove(et->lines, end);
+
+ etox_line_free(idx);
+ etox_line_free(end);
+
+ } else {
+ etox_line_remove(idx, bit);
+ evas_list_remove(et->lines, idx);
+ etox_line_free(idx);
+
+ /* FIXME */
+ printf("WARNING: etox_delete_text, this isn't finished\n");
+ }
+ etox_line_minimize(start);
+
+ etox_layout(et);
+ if (et->lines && evas_object_visible_get(obj))
+ evas_object_show(et->clip);
+}
+
+/**
* etox_set_text - change the text in the etox
* @et: the etox to change text
* @text: the new text to display in @et
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- etox_line.c 5 Oct 2004 23:29:11 -0000 1.42
+++ etox_line.c 6 Oct 2004 04:48:49 -0000 1.43
@@ -605,7 +605,7 @@
Evas_List *l;
for (l = line->bits; l; l = l->next) {
- printf("\tBit %d: %s\n", i, etox_style_get_text(l->data));
+ printf("\tBit %d: (%s)\n", i, etox_style_get_text(l->data));
i++;
}
}
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs