annotate src/subtree_free.c @ 729:299ed9319dc6

Use key symbols instead of keycodes.
author Thinker K.F. Li <thinker@branda.to>
date Tue, 17 Aug 2010 10:36:36 +0800
parents 45d9a1e2764d
children 586e50f82c1f
rev   line source
194
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 #include "mb_redraw_man.h"
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #include "mb_animate.h"
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 struct _subtree_free {
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 mb_action_t action;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 coord_t *coord;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 };
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 typedef struct _subtree_free subtree_free_t;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 void mb_subtree_free_start(mb_action_t *action,
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 const mb_timeval_t *now,
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 const mb_timeval_t *playing_time,
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 redraw_man_t *rdman) {
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 subtree_free_t *sfree = (subtree_free_t *)action;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 rdman_coord_subtree_free(rdman, sfree->coord);
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 }
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 void mb_subtree_free_step(mb_action_t *act, const mb_timeval_t *now,
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 redraw_man_t *rdman) {
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 }
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 void mb_subtree_free_stop(mb_action_t *act, const mb_timeval_t *now,
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 redraw_man_t *rdman) {
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 }
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 void mb_subtree_free_free(mb_action_t *act) {
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30 free(act);
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 }
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 mb_action_t *mb_subtree_free_new(coord_t *coord,
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 mb_word_t *word) {
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 subtree_free_t *sfree;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37 sfree = (subtree_free_t *)malloc(sizeof(subtree_free_t));
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38 if(sfree == NULL)
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39 return NULL;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 sfree->action.start = mb_subtree_free_start;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
42 sfree->action.step = mb_subtree_free_step;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
43 sfree->action.stop = mb_subtree_free_stop;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 sfree->action.free = mb_subtree_free_free;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
45 sfree->coord = coord;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
46
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
47 mb_word_add_action(word, (mb_action_t *)sfree);
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
48
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 return (mb_action_t *)sfree;
45d9a1e2764d Add mb_subtree_free animate action and fix bugs.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
50 }