comparison src/mbaf/mbobject.c @ 1067:7b4e80ab671a openvg

merge from default branch
author Thinker K.F. Li <thinker@codemud.net>
date Wed, 01 Dec 2010 12:25:56 +0800
parents 152bc503dc99
children
comparison
equal deleted inserted replaced
630:bd18951b51d5 1067:7b4e80ab671a
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*-
2 // vim: sw=4:ts=8:sts=4
1 #include "mb_types.h" 3 #include "mb_types.h"
2 #include "mb_obj.h" 4 #include "mb_obj.h"
5 #include "mb_config.h"
3 6
4 7
5 void mb_obj_set_pos(mb_obj_t *obj, co_aix x, co_aix y) 8 void mb_obj_set_pos(mb_obj_t *obj, co_aix x, co_aix y)
6 { 9 {
7 if (MBO_TYPE(obj) == MBO_COORD) { 10 if (MBO_TYPE(obj) == MBO_COORD) {
8 coord_x(((coord_t *) obj)) = x; 11 coord_x(((coord_t *) obj)) = x;
9 coord_y(((coord_t *) obj)) = y; 12 coord_y(((coord_t *) obj)) = y;
13 #ifdef SH_TEXT
10 } else if (MBO_TYPE(obj) == MBO_TEXT) { 14 } else if (MBO_TYPE(obj) == MBO_TEXT) {
11 sh_text_set_pos((shape_t *) obj, x, y); 15 sh_text_set_pos((shape_t *) obj, x, y);
16 #endif
12 } else { 17 } else {
13 return; 18 return;
14 } 19 }
15 20
16 } 21 }
17 22
18 void mb_obj_get_pos(mb_obj_t *obj, co_aix *x, co_aix *y) 23 void mb_obj_get_pos(mb_obj_t *obj, co_aix *x, co_aix *y)
19 { 24 {
20 if (MBO_TYPE(obj) == MBO_COORD) { 25 if (MBO_TYPE(obj) == MBO_COORD) {
21 *x = coord_x((coord_t *) obj); 26 *x = coord_x((coord_t *) obj);
22 *y = coord_y((coord_t *) obj); 27 *y = coord_y((coord_t *) obj);
28 #ifdef SH_TEXT
23 } else if (MBO_TYPE(obj) == MBO_TEXT) { 29 } else if (MBO_TYPE(obj) == MBO_TEXT) {
24 sh_text_get_pos((shape_t *) obj, x, y); 30 sh_text_get_pos((shape_t *) obj, x, y);
31 #endif
25 } else { 32 } else {
26 return; 33 return;
27 } 34 }
28 35
29 } 36 }
30 37
31 void mb_obj_set_text(mb_obj_t *obj, const char *text) 38 void mb_obj_set_text(mb_obj_t *obj, const char *text)
32 { 39 {
33 if (MBO_TYPE(obj) == MBO_COORD) { 40 if (MBO_TYPE(obj) == MBO_COORD) {
35 shape_t *shape; 42 shape_t *shape;
36 coord_t *g = (coord_t *) obj; 43 coord_t *g = (coord_t *) obj;
37 44
38 FOR_COORD_MEMBERS(g, geo) { 45 FOR_COORD_MEMBERS(g, geo) {
39 shape = geo_get_shape(geo); 46 shape = geo_get_shape(geo);
47 #ifdef SH_TEXT
40 if(shape->obj.obj_type == MBO_TEXT) { 48 if(shape->obj.obj_type == MBO_TEXT) {
41 sh_text_set_text(shape, text); 49 sh_text_set_text(shape, text);
42 return; 50 return;
43 } 51 }
52 #endif
44 } 53 }
54 #ifdef SH_TEXT
45 } else if (MBO_TYPE(obj) == MBO_TEXT) { 55 } else if (MBO_TYPE(obj) == MBO_TEXT) {
46 sh_text_set_text((shape_t *) obj,text); 56 sh_text_set_text((shape_t *) obj,text);
57 #endif
47 } else { 58 } else {
48 return; 59 return;
49 } 60 }
50 61
51 } 62 }
52 63
53 64
54 void mb_obj_get_text(mb_obj_t *obj, char *text,int size) 65 void mb_obj_get_text(mb_obj_t *obj, char *text,int size)
55 { 66 {
58 shape_t *shape; 69 shape_t *shape;
59 coord_t *g = (coord_t *) obj; 70 coord_t *g = (coord_t *) obj;
60 71
61 FOR_COORD_MEMBERS(g, geo) { 72 FOR_COORD_MEMBERS(g, geo) {
62 shape = geo_get_shape(geo); 73 shape = geo_get_shape(geo);
74 #ifdef SH_TEXT
63 if(shape->obj.obj_type == MBO_TEXT) { 75 if(shape->obj.obj_type == MBO_TEXT) {
64 sh_text_get_text(shape, text,size); 76 sh_text_get_text(shape, text,size);
65 return; 77 return;
66 } 78 }
79 #endif
67 } 80 }
81 #ifdef SH_TEXT
68 } else if (MBO_TYPE(obj) == MBO_TEXT) { 82 } else if (MBO_TYPE(obj) == MBO_TEXT) {
69 sh_text_get_text((shape_t *) obj,text,size); 83 sh_text_get_text((shape_t *) obj,text,size);
84 #endif
70 } else { 85 } else {
71 *text = 0; 86 *text = 0;
72 return; 87 return;
73 } 88 }
74 } 89 }