[evolution-patches] 39768: Tree line rendering



The code in e-cell-tree was drawing lines based on the
ETreeTableAdapter's source model, which used to be an ETreeSorted, but
is now an unsorted tree model.  This adds some api to etta to check for
a "next sibling" so that the cell can render its lines based on the
sorted node position.

Mike
Index: e-cell-tree.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-cell-tree.c,v
retrieving revision 1.46
diff -u -p -w -r1.46 e-cell-tree.c
--- e-cell-tree.c	14 Jan 2003 22:33:44 -0000	1.46
+++ e-cell-tree.c	18 Apr 2003 15:35:17 -0000
@@ -264,7 +264,7 @@ ect_draw (ECellView *ecell_view, GdkDraw
 					       rect.x + offset - INDENT_AMOUNT / 2,
 					       rect.y,
 					       rect.x + offset - INDENT_AMOUNT / 2,
-					       (e_tree_model_node_get_next (tree_model, node)
+					       (e_tree_table_adapter_node_get_next (tree_table_adapter, node)
 						? rect.y + rect.height
 						: rect.y + rect.height / 2));
 			}
@@ -276,7 +276,7 @@ ect_draw (ECellView *ecell_view, GdkDraw
 			offset -= INDENT_AMOUNT;
 			depth = visible_depth_of_node (ecell_view->e_table_model, row) - 1;
 			while (parent_node && depth != 0) {
-				if (e_tree_model_node_get_next(tree_model, parent_node)) {
+				if (e_tree_table_adapter_node_get_next(tree_table_adapter, parent_node)) {
 					gdk_draw_line (drawable, tree_view->gc,
 						       rect.x + offset - INDENT_AMOUNT / 2,
 						       rect.y,
@@ -590,7 +590,7 @@ ect_print (ECellView *ecell_view, GnomeP
 						    height);
 				gnome_print_lineto (context,
 						    offset - INDENT_AMOUNT / 2,
-						    (e_tree_model_node_get_next (tree_model, node)
+						    (e_tree_table_adapter_node_get_next (tree_table_adapter, node)
 						     ? 0
 						     : height / 2));
 			}
@@ -602,7 +602,7 @@ ect_print (ECellView *ecell_view, GnomeP
 			depth = visible_depth_of_node (ecell_view->e_table_model, row) - 1;
 			offset -= INDENT_AMOUNT;
 			while (node && depth != 0) {
-				if (e_tree_model_node_get_next(tree_model, node)) {
+				if (e_tree_table_adapter_node_get_next(tree_table_adapter, node)) {
 					gnome_print_moveto (context,
 							    offset - INDENT_AMOUNT / 2,
 							    height);
Index: e-tree-table-adapter.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-tree-table-adapter.c,v
retrieving revision 1.52
diff -u -p -w -r1.52 e-tree-table-adapter.c
--- e-tree-table-adapter.c	15 Apr 2003 21:34:31 -0000	1.52
+++ e-tree-table-adapter.c	18 Apr 2003 15:35:18 -0000
@@ -1154,3 +1154,13 @@ e_tree_table_adapter_set_sort_info (ETre
 	e_table_model_changed(E_TABLE_MODEL(etta));
 }
 
+ETreePath
+e_tree_table_adapter_node_get_next (ETreeTableAdapter *etta, ETreePath path)
+{
+	GNode *node = lookup_gnode (etta, path);
+
+	if (node && node->next)
+		return ((node_t *)node->next->data)->path;
+
+	return NULL;
+}
Index: e-tree-table-adapter.h
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-tree-table-adapter.h,v
retrieving revision 1.8
diff -u -p -w -r1.8 e-tree-table-adapter.h
--- e-tree-table-adapter.h	4 Mar 2003 06:53:46 -0000	1.8
+++ e-tree-table-adapter.h	18 Apr 2003 15:35:18 -0000
@@ -61,6 +61,8 @@ ETableModel *e_tree_table_adapter_constr
 		      					      ETableSortInfo    *sort_info,
 							      ETableHeader	*header);
 
+ETreePath    e_tree_table_adapter_node_get_next              (ETreeTableAdapter *etta,
+							      ETreePath          path);
 gboolean     e_tree_table_adapter_node_is_expanded           (ETreeTableAdapter *etta,
 							      ETreePath          path);
 void         e_tree_table_adapter_node_set_expanded          (ETreeTableAdapter *etta,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]