Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests/mvc Modified Files: ewl_mvc.c Log Message: - re-work the mvc selection storage, split and merge =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/mvc/ewl_mvc.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- ewl_mvc.c 25 Jul 2007 17:00:59 -0000 1.11 +++ ewl_mvc.c 18 Aug 2007 18:20:15 -0000 1.12 @@ -33,6 +33,20 @@ static int selected_rm_from_range_top_edge_point(char *buf, int len); static int selected_rm_from_range_bottom_edge_point(char *buf, int len); +static int insert_range_no_intersection(char *buf, int len); +static int insert_range_top_intersection(char *buf, int len); +static int insert_range_bottom_intersection(char *buf, int len); +static int insert_range_left_intersection(char *buf, int len); +static int insert_range_right_intersection(char *buf, int len); +static int insert_range_top_left_intersection(char *buf, int len); +static int insert_range_top_right_intersection(char *buf, int len); +static int insert_range_bottom_left_intersection(char *buf, int len); +static int insert_range_bottom_right_intersection(char *buf, int len); +static int insert_range_overlap_horizontal(char *buf, int len); +static int insert_range_overlap_vertical(char *buf, int len); +static int insert_range_overlap_new_covers_old(char *buf, int len); +static int insert_range_overlap_old_covers_new(char *buf, int len); + static int ewl_mvc_is_index(char *buf, int len, Ewl_Selection *sel, int row, int column); static int ewl_mvc_is_range(char *buf, int len, Ewl_Selection *sel, @@ -50,6 +64,7 @@ {"Is selected (range)", selected_is_range, -1, NULL}, {"Is not selected (range)", selected_is_not_range, -1, NULL}, {"Selected clear", selected_clear, -1, NULL}, + {"Remove index", selected_rm_idx, -1, NULL}, {"Remove non-selected index", selected_rm_unselected_idx, -1, NULL}, {"Remove bottom from 2x1", selected_rm_2x1_bottom, -1, NULL}, @@ -70,6 +85,34 @@ selected_rm_from_range_top_edge_point, -1, NULL}, {"Remove from range, bottom edge", selected_rm_from_range_bottom_edge_point, -1, NULL}, + + {"Insert range no intersection", + insert_range_no_intersection, -1, NULL}, + {"Insert range top intersection", + insert_range_top_intersection, -1, NULL}, + {"Insert range bottom intersection", + insert_range_bottom_intersection, -1, NULL}, + {"Insert range left intersection", + insert_range_left_intersection, -1, NULL}, + {"Insert range right intersection", + insert_range_right_intersection, -1, NULL}, + {"Insert range intersect, top left corner", + insert_range_top_left_intersection, -1, NULL}, + {"Insert range intersect, top right corner", + insert_range_top_right_intersection, -1, NULL}, + {"Insert range intersect, bottom left corner", + insert_range_bottom_left_intersection, -1, NULL}, + {"Insert range intersect, bottom right corner", + insert_range_bottom_right_intersection, -1, NULL}, + {"Insert range intersect, overlap horizontal", + insert_range_overlap_horizontal, -1, NULL}, + {"Insert range intersect, overlap vertical", + insert_range_overlap_vertical, -1, NULL}, + {"Insert range intersect, new covers old", + insert_range_overlap_new_covers_old, -1, NULL}, + {"Insert range intersect, old covers new", + insert_range_overlap_old_covers_new, -1, NULL}, + {NULL, NULL, -1, NULL} }; @@ -136,7 +179,8 @@ if ((idx->row != 1) || (idx->column != 2)) { - snprintf(buf, len, "Incorrect row/column setting"); + snprintf(buf, len, "Incorrect row/column setting " + "(%d %d) instead of (1, 2)", idx->row, idx->column); return FALSE; } @@ -182,9 +226,15 @@ m = EWL_MVC(t); ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); - ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 6, 8, 1, 2); + ewl_mvc_selected_range_add(m, NULL, NULL, 6, 8, 1, 2); idx = ecore_list_first_goto(m->selected); + if (!idx) + { + snprintf(buf, len, "Returned idx is NULL"); + return FALSE; + } + if (idx->sel.type != EWL_SELECTION_TYPE_RANGE) { snprintf(buf, len, "Incorrect selection type"); @@ -211,7 +261,7 @@ { Ewl_Widget *t; Ewl_MVC *m; - int count, expected = 46; + int count, expected = 44; t = ewl_tree2_new(); m = EWL_MVC(t); @@ -394,12 +444,25 @@ return TRUE; } +/* + * The X shows either the box to remove or the position the point is being + * removed from + */ + +/* + * ------ + * | | + * ------ + * | X | + * ------ + */ static int selected_rm_2x1_bottom(char *buf, int len) { Ewl_Widget *t; Ewl_MVC *m; Ewl_Selection *sel; + int count; t = ewl_tree2_new(); m = EWL_MVC(t); @@ -414,27 +477,35 @@ return FALSE; } - if (ewl_mvc_selected_count_get(m) != 1) + count = ewl_mvc_selected_count_get(m); + if (count != 1) { - snprintf(buf, len, "Incorrect number of selected items"); + snprintf(buf, len, "Selected items is %d instead of 1", count); return FALSE; } sel = ecore_list_first_goto(m->selected); - /* should have 1 index [(1,1)] */ if (!ewl_mvc_is_index(buf, len, sel, 1, 1)) return FALSE; return TRUE; } +/* + * ------ + * | X | + * ------ + * | | + * ------ + */ static int selected_rm_2x1_top(char *buf, int len) { Ewl_Widget *t; Ewl_MVC *m; Ewl_Selection *sel; + int count; t = ewl_tree2_new(); m = EWL_MVC(t); @@ -449,21 +520,26 @@ return FALSE; } - if (ewl_mvc_selected_count_get(m) != 1) + count = ewl_mvc_selected_count_get(m); + if (count != 1) { - snprintf(buf, len, "Incorrect number of selected items"); + snprintf(buf, len, "Selected items is %d instead of 1", count); return FALSE; } sel = ecore_list_first_goto(m->selected); - /* should have 1 index [(2,1)] */ if (!ewl_mvc_is_index(buf, len, sel, 2, 1)) return FALSE; return TRUE; } +/* + * ------------ + * | X | | + * ------------ + */ static int selected_rm_1x2_left(char *buf, int len) { @@ -492,13 +568,17 @@ sel = ecore_list_first_goto(m->selected); - /* should have 1 index [(1,2)] */ if (!ewl_mvc_is_index(buf, len, sel, 1, 2)) return FALSE; return TRUE; } +/* + * ------------ + * | | X | + * ------------ + */ static int selected_rm_1x2_right(char *buf, int len) { @@ -527,13 +607,18 @@ sel = ecore_list_first_goto(m->selected); - /* should have 1 index [(1,1)] */ if (!ewl_mvc_is_index(buf, len, sel, 1, 1)) return FALSE; return TRUE; } +/* + * ------- + * |X | + * | | + * ------- + */ static int selected_rm_from_range_top_left_point(char *buf, int len) { @@ -561,18 +646,23 @@ return FALSE; } - /* should have 2 ranges [(1,3)(6,8)] [(2,2)(6,2)] */ sel = ecore_list_index_goto(m->selected, 0); - if (!ewl_mvc_is_range(buf, len, sel, 1, 3, 6, 8)) + if (!ewl_mvc_is_range(buf, len, sel, 2, 2, 6, 8)) return FALSE; sel = ecore_list_index_goto(m->selected, 1); - if (!ewl_mvc_is_range(buf, len, sel, 2, 2, 6, 2)) + if (!ewl_mvc_is_range(buf, len, sel, 1, 3, 1, 8)) return FALSE; return TRUE; } +/* + * ------- + * | | + * | X| + * ------- + */ static int selected_rm_from_range_bottom_right_point(char *buf, int len) { @@ -600,7 +690,6 @@ return FALSE; } - /* should have 2 ranges [(1,2)(5,8)] [(6,2)(6,7)] */ sel = ecore_list_index_goto(m->selected, 0); if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 5, 8)) return FALSE; @@ -612,6 +701,13 @@ return TRUE; } +/* + * ------- + * | | + * | X | + * | | + * ------- + */ static int selected_rm_from_range_middle_point(char *buf, int len) { @@ -639,10 +735,6 @@ return FALSE; } - /* should have 4 ranges: [(1,2)(3,8)] - [(4,2)(6,4)] - [(4,6)(6,8)] - [(5,5)(6,5)] */ sel = ecore_list_index_goto(m->selected, 0); if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 3, 8)) return FALSE; @@ -652,16 +744,23 @@ return FALSE; sel = ecore_list_index_goto(m->selected, 2); - if (!ewl_mvc_is_range(buf, len, sel, 4, 6, 6, 8)) + if (!ewl_mvc_is_range(buf, len, sel, 5, 5, 6, 8)) return FALSE; sel = ecore_list_index_goto(m->selected, 3); - if (!ewl_mvc_is_range(buf, len, sel, 5, 5, 6, 5)) + if (!ewl_mvc_is_range(buf, len, sel, 4, 6, 4, 8)) return FALSE; return TRUE; } +/* + * ------- + * | | + * |X | + * | | + * ------- + */ static int selected_rm_from_range_left_edge_point(char *buf, int len) { @@ -689,24 +788,28 @@ return FALSE; } - /* should have 3 ranges: [(1,2)(3,8)] - [(4,3)(6,8)] - [(5,2)(6,2)] */ sel = ecore_list_index_goto(m->selected, 0); if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 3, 8)) return FALSE; sel = ecore_list_index_goto(m->selected, 1); - if (!ewl_mvc_is_range(buf, len, sel, 4, 3, 6, 8)) + if (!ewl_mvc_is_range(buf, len, sel, 5, 2, 6, 8)) return FALSE; sel = ecore_list_index_goto(m->selected, 2); - if (!ewl_mvc_is_range(buf, len, sel, 5, 2, 6, 2)) + if (!ewl_mvc_is_range(buf, len, sel, 4, 3, 4, 8)) return FALSE; return TRUE; } +/* + * ------- + * | | + * | X| + * | | + * ------- + */ static int selected_rm_from_range_right_edge_point(char *buf, int len) { @@ -734,9 +837,6 @@ return FALSE; } - /* should have 3 ranges: [(1,2)(2,8)] - [(3,2)(6,7)] - [(4,8)(6,8)] */ sel = ecore_list_index_goto(m->selected, 0); if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 2, 8)) return FALSE; @@ -752,6 +852,13 @@ return TRUE; } +/* + * ------- + * | X | + * | | + * | | + * ------- + */ static int selected_rm_from_range_top_edge_point(char *buf, int len) { @@ -779,24 +886,28 @@ return FALSE; } - /* should have 3 ranges: [(1,2)(6,4)] - [(1,6)(6,8)] - [(2,5)(6,5)] */ sel = ecore_list_index_goto(m->selected, 0); if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 6, 4)) return FALSE; sel = ecore_list_index_goto(m->selected, 1); - if (!ewl_mvc_is_range(buf, len, sel, 1, 6, 6, 8)) + if (!ewl_mvc_is_range(buf, len, sel, 2, 5, 6, 8)) return FALSE; sel = ecore_list_index_goto(m->selected, 2); - if (!ewl_mvc_is_range(buf, len, sel, 2, 5, 6, 5)) + if (!ewl_mvc_is_range(buf, len, sel, 1, 6, 1, 8)) return FALSE; return TRUE; } +/* + * ------- + * | | + * | | + * | X | + * ------- + */ static int selected_rm_from_range_bottom_edge_point(char *buf, int len) { @@ -837,6 +948,530 @@ sel = ecore_list_index_goto(m->selected, 2); if (!ewl_mvc_is_range(buf, len, sel, 6, 4, 6, 8)) + return FALSE; + + return TRUE; +} + +/* + * c == currently in the list + * r == range to be inserted + */ +/* + * ---- + * | c| + * ---- ---- + * |r | + * ---- + */ +static int +insert_range_no_intersection(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 4, 4, 6, 6); + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 3, 3)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 1); + if (!ewl_mvc_is_range(buf, len, sel, 4, 4, 6, 6)) + return FALSE; + + return TRUE; +} + +/* + * ---- + * | r| + * |--| + * | c| + * ---- + */ +static int +insert_range_top_intersection(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 7, 3); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3); + + count = ecore_list_count(m->selected); + if (count != 1) + { + snprintf(buf, len, "%d items in list instead of 1", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 7, 3)) + return FALSE; + + return TRUE; +} + +/* + * ---- + * | c| + * |--| + * | r| + * ---- + */ +static int +insert_range_bottom_intersection(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 7, 3); + + count = ecore_list_count(m->selected); + if (count != 1) + { + snprintf(buf, len, "%d items in list instead of 1", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 7, 3)) + return FALSE; + + return TRUE; +} + +/* + * -------- + * | r| c| + * -------- + */ +static int +insert_range_left_intersection(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 3, 5); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3); + + count = ecore_list_count(m->selected); + if (count != 1) + { + snprintf(buf, len, "%d items in list instead of 1", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 3, 5)) + return FALSE; + + return TRUE; +} + +/* + * -------- + * | c| r| + * -------- + */ +static int +insert_range_right_intersection(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 3, 3); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 3, 5); + + count = ecore_list_count(m->selected); + if (count != 1) + { + snprintf(buf, len, "%d items in list instead of 1", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 3, 5)) + return FALSE; + + return TRUE; +} + +/* + * ------ + * | r | + * | ------| + * ---|-| | + * | c | + * ------- + */ +static int +insert_range_top_left_intersection(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 7, 7); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 5, 5); + + count = ecore_list_count(m->selected); + if (count != 3) + { + snprintf(buf, len, "%d items in list instead of 3", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 6, 3, 7, 7)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 1); + if (!ewl_mvc_is_range(buf, len, sel, 3, 6, 5, 7)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 2); + if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 5, 5)) + return FALSE; + + return TRUE; +} + +/* + * ------- + * | r | + * ----|-- | + * | --|---- + * | c | + * ------- + */ +static int +insert_range_top_right_intersection(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 3); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 2, 4, 5); + + count = ecore_list_count(m->selected); + if (count != 3) + { + snprintf(buf, len, "%d items in list instead of 3", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 1)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 1); + if (!ewl_mvc_is_range(buf, len, sel, 5, 2, 5, 3)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 2); + if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 4, 5)) + return FALSE; + + return TRUE; +} + +/* + * ------- + * | c | + * ----|-- | + * | --|---- + * | r | + * ------- + */ +static int +insert_range_bottom_left_intersection(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 2, 4, 5); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 3); + + count = ecore_list_count(m->selected); + if (count != 3) + { + snprintf(buf, len, "%d items in list instead of 3", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 1, 2, 2, 5)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 1); + if (!ewl_mvc_is_range(buf, len, sel, 3, 4, 4, 5)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 2); + if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 3)) + return FALSE; + + return TRUE; +} + +/* + * ------ + * | c | + * | ------| + * ---|-| | + * | r | + * ------- + */ +static int +insert_range_bottom_right_intersection(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 5, 5); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 7, 7); + + count = ecore_list_count(m->selected); + if (count != 3) + { + snprintf(buf, len, "%d items in list instead of 3", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 2, 5)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 1); + if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 2)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 2); + if (!ewl_mvc_is_range(buf, len, sel, 3, 3, 7, 7)) + return FALSE; + + return TRUE; +} + +/* + * ---- + * |r | + * ---------- + * | | | | + * |c | | | + * ---------- + * | | + * ---- + */ +static int +insert_range_overlap_horizontal(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 9); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 7, 5); + + count = ecore_list_count(m->selected); + if (count != 3) + { + snprintf(buf, len, "%d items in list instead of 3", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 2)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 1); + if (!ewl_mvc_is_range(buf, len, sel, 3, 6, 5, 9)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 2); + if (!ewl_mvc_is_range(buf, len, sel, 1, 3, 7, 5)) + return FALSE; + + return TRUE; +} + +/* + * ---- + * |c | + * ---------- + * | | | | + * |r | | | + * ---------- + * | | + * ---- + */ +static int +insert_range_overlap_vertical(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 3, 7, 5); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 1, 5, 9); + + count = ecore_list_count(m->selected); + if (count != 3) + { + snprintf(buf, len, "%d items in list instead of 3", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 1, 3, 2, 5)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 1); + if (!ewl_mvc_is_range(buf, len, sel, 6, 3, 7, 5)) + return FALSE; + + sel = ecore_list_index_goto(m->selected, 2); + if (!ewl_mvc_is_range(buf, len, sel, 3, 1, 5, 9)) + return FALSE; + + return TRUE; +} + +/* + * ----------- + * | r | + * | ----- | + * | | c | | + * | ----- | + * ----------- + */ +static int +insert_range_overlap_new_covers_old(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 5, 5); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 9, 9); + + count = ecore_list_count(m->selected); + if (count != 1) + { + snprintf(buf, len, "%d items in list instead of 1", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 9, 9)) + return FALSE; + + return TRUE; +} + +/* + * ----------- + * | c | + * | ----- | + * | | r | | + * | ----- | + * ----------- + */ +static int +insert_range_overlap_old_covers_new(char *buf, int len) +{ + Ewl_Widget *t; + Ewl_MVC *m; + Ewl_Selection *sel; + int count; + + t = ewl_tree2_new(); + m = EWL_MVC(t); + + ewl_mvc_selection_mode_set(m, EWL_SELECTION_MODE_MULTI); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 1, 1, 9, 9); + ewl_mvc_selected_range_add(m, NULL, ewl_mvc_data_get(m), 3, 3, 5, 5); + + count = ecore_list_count(m->selected); + if (count != 1) + { + snprintf(buf, len, "%d items in list instead of 1", count); + return FALSE; + } + + sel = ecore_list_index_goto(m->selected, 0); + if (!ewl_mvc_is_range(buf, len, sel, 1, 1, 9, 9)) return FALSE; return TRUE; ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs