Mercurial > MadButterfly
comparison nodejs/mbfly_njs.cc @ 1053:df6ee4568ca2
Rename X_njs_MB_* to njs_mb_* for nodejs plugin.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 24 Nov 2010 15:44:28 +0800 |
parents | 18256f404193 |
children | 88bd0eee2b00 |
comparison
equal
deleted
inserted
replaced
1052:1f93f38688c2 | 1053:df6ee4568ca2 |
---|---|
20 static coord_t * | 20 static coord_t * |
21 xnjsmb_coord_new(njs_runtime_t *rt, coord_t *parent, const char **err) { | 21 xnjsmb_coord_new(njs_runtime_t *rt, coord_t *parent, const char **err) { |
22 coord_t *coord; | 22 coord_t *coord; |
23 redraw_man_t *rdman; | 23 redraw_man_t *rdman; |
24 | 24 |
25 rdman = X_njs_MB_rdman(rt); | 25 rdman = njs_mb_rdman(rt); |
26 coord = rdman_coord_new(rdman, parent); | 26 coord = rdman_coord_new(rdman, parent); |
27 if(coord == NULL) { | 27 if(coord == NULL) { |
28 *err = "Can not allocate a redraw_man_t"; | 28 *err = "Can not allocate a redraw_man_t"; |
29 return NULL; | 29 return NULL; |
30 } | 30 } |
44 | 44 |
45 static void | 45 static void |
46 xnjsmb_redraw_changed(njs_runtime_t *rt) { | 46 xnjsmb_redraw_changed(njs_runtime_t *rt) { |
47 redraw_man_t *rdman; | 47 redraw_man_t *rdman; |
48 | 48 |
49 rdman = X_njs_MB_rdman(rt); | 49 rdman = njs_mb_rdman(rt); |
50 rdman_redraw_changed(rdman); | 50 rdman_redraw_changed(rdman); |
51 } | 51 } |
52 | 52 |
53 static void | 53 static void |
54 xnjsmb_redraw_all(njs_runtime_t *rt) { | 54 xnjsmb_redraw_all(njs_runtime_t *rt) { |
55 redraw_man_t *rdman; | 55 redraw_man_t *rdman; |
56 | 56 |
57 rdman = X_njs_MB_rdman(rt); | 57 rdman = njs_mb_rdman(rt); |
58 rdman_redraw_all(rdman); | 58 rdman_redraw_all(rdman); |
59 } | 59 } |
60 | 60 |
61 static void | 61 static void |
62 xnjsmb_handle_single_event(njs_runtime_t *rt, void *evt) { | 62 xnjsmb_handle_single_event(njs_runtime_t *rt, void *evt) { |
63 X_njs_MB_handle_single_event(rt, evt); | 63 njs_mb_handle_single_event(rt, evt); |
64 } | 64 } |
65 | 65 |
66 static void | 66 static void |
67 xnjsmb_no_more_event(njs_runtime_t *rt) { | 67 xnjsmb_no_more_event(njs_runtime_t *rt) { |
68 X_njs_MB_no_more_event(rt); | 68 njs_mb_no_more_event(rt); |
69 } | 69 } |
70 | 70 |
71 static njs_runtime_t * | 71 static njs_runtime_t * |
72 _X_njs_MB_new(Handle<Object> self, char *display_name, | 72 _njs_mb_new(Handle<Object> self, char *display_name, |
73 int width, int height) { | 73 int width, int height) { |
74 njs_runtime_t *obj; | 74 njs_runtime_t *obj; |
75 subject_t *subject; | 75 subject_t *subject; |
76 Handle<Value> subject_o; | 76 Handle<Value> subject_o; |
77 | 77 |
78 obj = X_njs_MB_new(display_name, width, height); | 78 obj = njs_mb_new(display_name, width, height); |
79 WRAP(self, obj); /* mkroot need a wrapped object, but | 79 WRAP(self, obj); /* mkroot need a wrapped object, but |
80 * it is wrapped after returning of | 80 * it is wrapped after returning of |
81 * this function. So, we wrap it | 81 * this function. So, we wrap it |
82 * here. */ | 82 * here. */ |
83 xnjsmb_coord_mkroot(self); | 83 xnjsmb_coord_mkroot(self); |
84 | 84 |
85 subject = X_njs_MB_kbevents(obj); | 85 subject = njs_mb_kbevents(obj); |
86 subject_o = export_xnjsmb_auto_subject_new(subject); | 86 subject_o = export_xnjsmb_auto_subject_new(subject); |
87 SET(self, "kbevents", subject_o); | 87 SET(self, "kbevents", subject_o); |
88 | 88 |
89 return obj; | 89 return obj; |
90 } | 90 } |
91 | 91 |
92 static njs_runtime_t * | 92 static njs_runtime_t * |
93 _X_njs_MB_new_with_win(Handle<Object> self, void *display, | 93 _njs_mb_new_with_win(Handle<Object> self, void *display, |
94 long win) { | 94 long win) { |
95 njs_runtime_t *obj; | 95 njs_runtime_t *obj; |
96 subject_t *subject; | 96 subject_t *subject; |
97 Handle<Value> subject_o; | 97 Handle<Value> subject_o; |
98 | 98 |
99 obj = X_njs_MB_new_with_win(display, win); | 99 obj = njs_mb_new_with_win(display, win); |
100 WRAP(self, obj); /* mkroot need a wrapped object, but | 100 WRAP(self, obj); /* mkroot need a wrapped object, but |
101 * it is wrapped after returning of | 101 * it is wrapped after returning of |
102 * this function. So, we wrap it | 102 * this function. So, we wrap it |
103 * here. */ | 103 * here. */ |
104 xnjsmb_coord_mkroot(self); | 104 xnjsmb_coord_mkroot(self); |
105 | 105 |
106 subject = X_njs_MB_kbevents(obj); | 106 subject = njs_mb_kbevents(obj); |
107 subject_o = export_xnjsmb_auto_subject_new(subject); | 107 subject_o = export_xnjsmb_auto_subject_new(subject); |
108 SET(self, "kbevents", subject_o); | 108 SET(self, "kbevents", subject_o); |
109 | 109 |
110 return obj; | 110 return obj; |
111 } | 111 } |
141 HandleScope scope; | 141 HandleScope scope; |
142 njs_runtime_t *rt; | 142 njs_runtime_t *rt; |
143 redraw_man_t *rdman; | 143 redraw_man_t *rdman; |
144 | 144 |
145 rt = (njs_runtime_t *)UNWRAP(mbrt); | 145 rt = (njs_runtime_t *)UNWRAP(mbrt); |
146 rdman = X_njs_MB_rdman(rt); | 146 rdman = njs_mb_rdman(rt); |
147 | 147 |
148 return rdman; | 148 return rdman; |
149 } | 149 } |
150 | 150 |
151 Handle<Value> | 151 Handle<Value> |
168 * Initialize template for MadButterfly runtime objects. | 168 * Initialize template for MadButterfly runtime objects. |
169 */ | 169 */ |
170 xnjsmb_auto_mb_rt_init(); | 170 xnjsmb_auto_mb_rt_init(); |
171 xnjsmb_auto_mb_rt_display_init(); | 171 xnjsmb_auto_mb_rt_display_init(); |
172 xnjsmb_auto_mb_rt_with_win_init(); | 172 xnjsmb_auto_mb_rt_with_win_init(); |
173 X_njs_MB_reg_timer_man(); | 173 njs_mb_reg_timer_man(); |
174 X_njs_MB_reg_IO_man(); | 174 njs_mb_reg_IO_man(); |
175 | 175 |
176 /* | 176 /* |
177 * Add properties to mb_rt templates for other modules. | 177 * Add properties to mb_rt templates for other modules. |
178 */ | 178 */ |
179 xnjsmb_shapes_init_mb_rt_temp(xnjsmb_auto_mb_rt_temp); | 179 xnjsmb_shapes_init_mb_rt_temp(xnjsmb_auto_mb_rt_temp); |