Mercurial > MadButterfly
diff src/redraw_man.c @ 1060:e415c55b4a0d
Stop using ob as acronym observer
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 28 Nov 2010 12:59:05 +0800 |
parents | 36aef79d68e4 |
children | a8d20bc8ce40 |
line wrap: on
line diff
--- a/src/redraw_man.c Sun Nov 28 12:07:37 2010 +0800 +++ b/src/redraw_man.c Sun Nov 28 12:59:05 2010 +0800 @@ -370,12 +370,14 @@ extern void sh_dummy_fill(shape_t *, mbe_t *); #endif /* UNITTEST */ -static subject_t *ob_subject_alloc(ob_factory_t *factory); -static void ob_subject_free(ob_factory_t *factory, subject_t *subject); -static observer_t *ob_observer_alloc(ob_factory_t *factory); -static void ob_observer_free(ob_factory_t *factory, observer_t *observer); -static subject_t *ob_get_parent_subject(ob_factory_t *factory, - subject_t *cur_subject); +static subject_t *observer_subject_alloc(observer_factory_t *factory); +static void observer_subject_free(observer_factory_t *factory, + subject_t *subject); +static observer_t *observer_observer_alloc(observer_factory_t *factory); +static void observer_observer_free(observer_factory_t *factory, + observer_t *observer); +static subject_t *observer_get_parent_subject(observer_factory_t *factory, + subject_t *cur_subject); /* Functions for children. */ #define FORCHILDREN(coord, child) \ for((child) = STAILQ_HEAD((coord)->children); \ @@ -710,16 +712,16 @@ rdman->paint_color_pool && rdman->coord_canvas_pool)) goto err; - rdman->ob_factory.subject_alloc = ob_subject_alloc; - rdman->ob_factory.subject_free = ob_subject_free; - rdman->ob_factory.observer_alloc = ob_observer_alloc; - rdman->ob_factory.observer_free = ob_observer_free; - rdman->ob_factory.get_parent_subject = ob_get_parent_subject; + rdman->observer_factory.subject_alloc = observer_subject_alloc; + rdman->observer_factory.subject_free = observer_subject_free; + rdman->observer_factory.observer_alloc = observer_observer_alloc; + rdman->observer_factory.observer_free = observer_observer_free; + rdman->observer_factory.get_parent_subject = observer_get_parent_subject; rdman->redraw = - subject_new(&rdman->ob_factory, rdman, OBJT_RDMAN); + subject_new(&rdman->observer_factory, rdman, OBJT_RDMAN); rdman->addrm_monitor = - subject_new(&rdman->ob_factory, rdman, OBJT_RDMAN); + subject_new(&rdman->observer_factory, rdman, OBJT_RDMAN); if(!(rdman->redraw && rdman->addrm_monitor)) goto err; @@ -736,7 +738,7 @@ rdman->n_coords = 1; coord_init(rdman->root_coord, NULL); mb_prop_store_init(&rdman->root_coord->obj.props, rdman->pent_pool); - rdman->root_coord->mouse_event = subject_new(&rdman->ob_factory, + rdman->root_coord->mouse_event = subject_new(&rdman->observer_factory, rdman->root_coord, OBJT_COORD); coord_set_flags(rdman->root_coord, COF_OWN_CANVAS); @@ -886,7 +888,7 @@ return ERR; geo_init(geo); - geo->mouse_event = subject_new(&rdman->ob_factory, geo, OBJT_GEO); + geo->mouse_event = subject_new(&rdman->observer_factory, geo, OBJT_GEO); subject_set_monitor(geo->mouse_event, rdman->addrm_monitor); geo_attach_coord(geo, coord); @@ -1034,7 +1036,7 @@ coord_init(coord, parent); mb_prop_store_init(&coord->obj.props, rdman->pent_pool); - coord->mouse_event = subject_new(&rdman->ob_factory, + coord->mouse_event = subject_new(&rdman->observer_factory, coord, OBJT_COORD); subject_set_monitor(coord->mouse_event, rdman->addrm_monitor); @@ -2619,48 +2621,51 @@ * Implment factory and strategy functions for observers and subjects. * @{ */ -static subject_t *ob_subject_alloc(ob_factory_t *factory) { +static subject_t *observer_subject_alloc(observer_factory_t *factory) { redraw_man_t *rdman; subject_t *subject; - rdman = MEM2OBJ(factory, redraw_man_t, ob_factory); + rdman = MEM2OBJ(factory, redraw_man_t, observer_factory); subject = elmpool_elm_alloc(rdman->subject_pool); return subject; } -static void ob_subject_free(ob_factory_t *factory, subject_t *subject) { +static void +observer_subject_free(observer_factory_t *factory, subject_t *subject) { redraw_man_t *rdman; - rdman = MEM2OBJ(factory, redraw_man_t, ob_factory); + rdman = MEM2OBJ(factory, redraw_man_t, observer_factory); elmpool_elm_free(rdman->subject_pool, subject); } -static observer_t *ob_observer_alloc(ob_factory_t *factory) { +static observer_t *observer_observer_alloc(observer_factory_t *factory) { redraw_man_t *rdman; observer_t *observer; - rdman = MEM2OBJ(factory, redraw_man_t, ob_factory); + rdman = MEM2OBJ(factory, redraw_man_t, observer_factory); observer = elmpool_elm_alloc(rdman->observer_pool); return observer; } -static void ob_observer_free(ob_factory_t *factory, observer_t *observer) { +static void +observer_observer_free(observer_factory_t *factory, observer_t *observer) { redraw_man_t *rdman; - rdman = MEM2OBJ(factory, redraw_man_t, ob_factory); + rdman = MEM2OBJ(factory, redraw_man_t, observer_factory); elmpool_elm_free(rdman->observer_pool, observer); } -static subject_t *ob_get_parent_subject(ob_factory_t *factory, - subject_t *cur_subject) { +static subject_t * +observer_get_parent_subject(observer_factory_t *factory, + subject_t *cur_subject) { redraw_man_t *rdman; coord_t *coord, *parent_coord; geo_t *geo; subject_t *parent; - rdman = MEM2OBJ(factory, redraw_man_t, ob_factory); + rdman = MEM2OBJ(factory, redraw_man_t, observer_factory); switch(cur_subject->obj_type) { case OBJT_GEO: geo = (geo_t *)cur_subject->obj;