diff src/redraw_man.c @ 57:ab028c9f0930

Ability to hidden shapes and action of visibility.
author Thinker K.F. Li <thinker@branda.to>
date Sun, 10 Aug 2008 20:25:14 +0800
parents 8d219ebd729e
children 1ca417f741f1
line wrap: on
line diff
--- a/src/redraw_man.c	Sun Aug 10 18:27:52 2008 +0800
+++ b/src/redraw_man.c	Sun Aug 10 20:25:14 2008 +0800
@@ -395,6 +395,15 @@
 
 /* Clean dirties */
 
+static int is_coord_subtree_hidden(coord_t *coord) {
+    while(coord) {
+	if(coord->flags & COF_HIDDEN)
+	    return 1;
+	coord = coord->parent;
+    }
+    return 0;
+}
+
 static void clean_shape(shape_t *shape) {
     switch(shape->sh_type) {
     case SHT_PATH:
@@ -413,6 +422,11 @@
 #endif /* UNITTEST */
     }
     shape->geo->flags &= ~GEF_DIRTY;
+
+    if(is_coord_subtree_hidden(shape->coord))
+	shape->geo->flags |= GEF_HIDDEN;
+    else
+	shape->geo->flags &= ~GEF_HIDDEN;
 }
 
 static int clean_coord(coord_t *coord) {
@@ -651,6 +665,8 @@
 	visit_geo = STAILQ_NEXT(geo_t, next, visit_geo)) {
 	if(visit_geo->flags & GEF_DIRTY)
 	    clean_shape(visit_geo->shape);
+	if(visit_geo->flags & GEF_HIDDEN)
+	    continue;
 	for(i = 0; i < n_areas; i++) {
 	    if(is_overlay(visit_geo->cur_area, areas[i])) {
 		draw_shape(rdman, visit_geo->shape);
@@ -733,6 +749,8 @@
     for(geo = STAILQ_HEAD(rdman->all_geos);
 	geo != NULL;
 	geo = STAILQ_NEXT(geo_t, next, geo)) {
+	if(geo->flags & GEF_HIDDEN)
+	    continue;
 	draw_shape(rdman, geo->shape);
     }
     copy_cr_2_backend(rdman, 0, NULL);