Mercurial > MadButterfly
changeset 747:d2f2ed27b84d
Separate GEF_NOT_SHOWED and GEF_HIDDEN flags.
GEF_HIDDEN mark a geo (shape) can not be showed, GEF_NOT_SHOWED is
implied by GEF_HIDDEN or one of ancesters that is hidden. Redraw
manager use GEF_NOT_SHOWED to determine who is not showed, actually.
GEF_NOT_SHOWED is flaged when clean_shape().
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 25 Aug 2010 18:22:32 +0800 |
parents | 1dbc74a14199 |
children | 56a5e08cd8af |
files | include/mb_types.h src/event.c src/redraw_man.c |
diffstat | 3 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/include/mb_types.h Wed Aug 25 14:48:39 2010 +0800 +++ b/include/mb_types.h Wed Aug 25 18:22:32 2010 +0800 @@ -124,6 +124,13 @@ #define GEF_FREE 0x4 #define GEF_OV_DRAW 0x8 /*!< To flag drawed for a overlay testing. */ #define GEF_SWAP 0x10 +#define GEF_NOT_SHOWED 0x20 /*!< This geo is not showed. + * + * A geo is not showed if it is hidden + * or one of its ancestors is hidden. + * Redraw manager uses this flag to + * determine who is not showed. + */ extern int areas_are_overlay(area_t *r1, area_t *r2); extern void area_init(area_t *area, int n_pos, co_aix pos[][2]);
--- a/src/event.c Wed Aug 25 14:48:39 2010 +0800 +++ b/src/event.c Wed Aug 25 18:22:32 2010 +0800 @@ -135,7 +135,7 @@ #define MB_OBJ_INIT(obj, type) do { (obj)->obj_type = type; } while(0) #define GEF_OV_DRAW 0x1 -#define GEF_HIDDEN 0x2 +#define GEF_NOT_SHOWED 0x20 struct shape { mb_obj_t obj; @@ -611,7 +611,7 @@ cr = rdman_get_cr(rdman); for(i = rdman_shape_gl_len(rdman) - 1; i >= 0; i--) { shape = rdman_get_shape_gl(rdman, i); - if(sh_get_flags(shape, GEF_HIDDEN)) + if(sh_get_flags(shape, GEF_NOT_SHOWED)) continue; r = _shape_pos_is_in(shape, x, y, in_stroke, cr); if(r)
--- a/src/redraw_man.c Wed Aug 25 14:48:39 2010 +0800 +++ b/src/redraw_man.c Wed Aug 25 18:22:32 2010 +0800 @@ -1226,10 +1226,11 @@ } shape->geo->flags &= ~GEF_DIRTY; - if(is_coord_subtree_hidden(shape->coord)) - sh_hide(shape); + if(sh_get_flags(shape, GEF_HIDDEN) || + is_coord_subtree_hidden(shape->coord)) + sh_set_flags(shape, GEF_NOT_SHOWED); else - sh_show(shape); + sh_clear_flags(shape, GEF_NOT_SHOWED); } /*! \brief Setup canvas_info for the coord. @@ -2242,7 +2243,7 @@ child = NEXT_CHILD(child); } else { ASSERT(member != NULL); - if((!(member->flags & GEF_HIDDEN)) && + if((!(member->flags & GEF_NOT_SHOWED)) && is_geo_in_areas(member, n_areas, areas)) { draw_shape(rdman, canvas, member->shape); dirty = 1;