annotate src/mb_types.h @ 16:e17e12b112c4

A simple animation using rdman_redraw_changed().
author Thinker K.F. Li <thinker@branda.to>
date Fri, 01 Aug 2008 18:20:28 +0800
parents c2ce186a5c37
children 41f0907b27ac
rev   line source
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 #ifndef __MB_TYPES_H_
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #define __MB_TYPES_H_
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
4 #include "tools.h"
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
5
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 typedef float co_aix;
11
128af06c876c Fix the bug that data of a path end with white spaces would make system down
Thinker K.F. Li <thinker@branda.to>
parents: 10
diff changeset
7 typedef struct _shape shape_t;
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
8 typedef struct _geo geo_t;
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
9 typedef struct _area area_t;
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
10
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
11 struct _area {
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
12 co_aix x, y;
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
13 co_aix w, h;
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
14 };
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
15
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
16 /*! \brief Geometry data of a shape or a group of shape.
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
17 */
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
18 struct _geo {
16
e17e12b112c4 A simple animation using rdman_redraw_changed().
Thinker K.F. Li <thinker@branda.to>
parents: 15
diff changeset
19 #ifdef GEO_ORDER
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
20 unsigned int order;
16
e17e12b112c4 A simple animation using rdman_redraw_changed().
Thinker K.F. Li <thinker@branda.to>
parents: 15
diff changeset
21 #endif
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
22 unsigned int flags;
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
23 shape_t *shape;
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
24 geo_t *next; /*!< \brief Link all geo objects. */
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
25
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
26 area_t *cur_area, *last_area;
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
27 area_t areas[2];
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
28 };
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
29 #define GEF_DIRTY 0x1
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
30
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
31 extern int is_overlay(area_t *r1, area_t *r2);
15
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 14
diff changeset
32 extern void area_init(area_t *area, int n_pos, co_aix pos[][2]);
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
33 extern void geo_init(geo_t *g, int n_pos, co_aix pos[][2]);
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
34 extern void geo_mark_overlay(geo_t *g, int n_others, geo_t **others,
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
35 int *n_overlays, geo_t **overlays);
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
36 #define geo_get_shape(g) ((g)->shape)
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
37 #define geo_set_shape(g, sh) do {(g)->shape = sh;} while(0)
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
38
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
39
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
40 /*! \brief A coordination system.
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
41 *
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
42 * It have a transform function defined by matrix to transform
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
43 * coordination from source space to target space.
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
44 * Source space is where the contained is drawed, and target space
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
45 * is where the coordination of parent container of the element
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
46 * represented by this coord object.
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
47 *
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
48 * \dot
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
49 * digraph G {
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
50 * graph [rankdir=LR];
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
51 * root -> child00 -> child10 -> child20 [label="children" color="blue"];
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
52 * child00 -> child01 -> child02 [label="sibling"];
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
53 * child10 -> child11 [label="sibling"];
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
54 * }
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
55 * \enddot
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
56 */
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
57 typedef struct _coord {
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
58 unsigned int order;
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
59 unsigned int flags;
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
60 area_t *cur_area, *last_area;
15
c2ce186a5c37 X_main uses rdman_redraw_all()
Thinker K.F. Li <thinker@branda.to>
parents: 14
diff changeset
61 area_t areas[2];
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
62
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
63 co_aix matrix[6];
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
64 co_aix aggr_matrix[6];
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
65
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
66 struct _coord *parent;
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
67 STAILQ(struct _coord) children;
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
68 struct _coord *sibling;
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
69
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
70 STAILQ(shape_t) members; /*!< All shape_t objects in this coord. */
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
71 } coord_t;
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
72 #define COF_DIRTY 0x1
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
73
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
74 extern void coord_init(coord_t *co, coord_t *parent);
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
75 extern void coord_trans_pos(coord_t *co, co_aix *x, co_aix *y);
16
e17e12b112c4 A simple animation using rdman_redraw_changed().
Thinker K.F. Li <thinker@branda.to>
parents: 15
diff changeset
76 extern void compute_aggr_of_coord(coord_t *coord);
10
7cfecdce94cc Remove warning messages
Thinker K.F. Li <thinker@branda.to>
parents: 5
diff changeset
77 extern void update_aggr_matrix(coord_t *start);
13
ed55009d96d3 refactory for redrawing
Thinker K.F. Li <thinker@branda.to>
parents: 12
diff changeset
78 extern coord_t *preorder_coord_subtree(coord_t *root, coord_t *last);
12
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
79
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
80
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
81 /*! \brief A grahpic shape.
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
82 *
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
83 * \dot
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
84 * digraph G {
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
85 * "shape" -> "coord";
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
86 * "shape" -> "geo";
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
87 * "geo" -> "shape";
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
88 * "coord" -> "shape" [label="members"]
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
89 * "shape" -> "shape" [label="sibling"];
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
90 * }
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
91 * \enddot
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
92 */
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
93 struct _shape {
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
94 int sh_type;
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
95 geo_t *geo;
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
96 coord_t *coord;
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
97 shape_t *coord_mem_next;
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
98 };
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
99 enum { SHT_UNKNOW, SHT_PATH, SHT_TEXT };
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
100
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
101 #define sh_attach_geo(sh, g) \
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
102 do { \
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
103 (sh)->geo = g; \
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
104 (g)->shape = (shape_t *)(sh); \
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
105 } while(0)
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
106 #define sh_detach_geo(sh) \
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
107 do { \
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
108 (sh)->geo->shape = NULL; \
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
109 (sh)->geo = NULL; \
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
110 } while(0)
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
111 extern void sh_attach_coord(shape_t *sh, coord_t *coord);
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
112 extern void sh_detach_coord(shape_t *sh);
79e9edf4c00a Add redraw manager
Thinker K.F. Li <thinker@branda.to>
parents: 11
diff changeset
113
5
9c331ec9e210 SVG path is partially supported
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
114 #endif /* __MB_TYPES_H_ */