Mercurial > MadButterfly
annotate nodejs/mbfly_njs.cc @ 639:dc32c1c140ae
First compilable image loader binding for Javascript
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 26 Jul 2010 20:13:58 +0800 |
parents | 683889344459 |
children | b6fb543d69ee |
rev | line source |
---|---|
546
249bcbf07eb0
Reuse and adapt X_supp.c by implmeneting X_supp_njs.c
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 #include <stdio.h> |
547
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
2 #include <v8.h> |
546
249bcbf07eb0
Reuse and adapt X_supp.c by implmeneting X_supp_njs.c
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 |
556
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
4 extern "C" { |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
5 #include "X_supp_njs.h" |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
6 } |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
7 |
559
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
8 #include "mbfly_njs.h" |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
9 |
547
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
10 using namespace v8; |
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
11 |
556
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
12 /*! \defgroup njs_template_cb Callback functions for v8 engine and nodejs. |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
13 * |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
14 * @{ |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
15 */ |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
16 |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
17 /*! \brief to Create a njs runtime object for MadButterfly. |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
18 * |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
19 * Three arguments are requried. They are |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
20 * - display name, |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
21 * - width, and |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
22 * - height. |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
23 */ |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
24 static Handle<Value> |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
25 xnjsmb_new(const Arguments &args) { |
557
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
556
diff
changeset
|
26 HandleScope scope; |
556
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
27 int argc; |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
28 Handle<Value> exc; |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
29 njs_runtime_t *rt; |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
30 char *display_name; |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
31 int width, height; |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
32 Handle<Object> self; |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
33 |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
34 argc = args.Length(); |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
35 if(argc != 3) { |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
36 exc = Exception::Error(String::New("Need 3 arguments.")); |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
37 return ThrowException(exc); |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
38 } |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
39 |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
40 if(!args[0]->IsString() || !args[1]->IsInt32() || !args[2]->IsInt32()) { |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
41 exc = Exception::Error(String::New("Invalid argument type.")); |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
42 return ThrowException(exc); |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
43 } |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
44 |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
45 String::Utf8Value disp_utf8(args[0]->ToString()); |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
46 display_name = *disp_utf8; |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
47 width = args[1]->Int32Value(); |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
48 height = args[2]->Int32Value(); |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
49 rt = X_njs_MB_new(display_name, width, height); |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
50 |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
51 self = args.This(); |
559
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
52 WRAP(self, rt); |
562
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
53 xnjsmb_coord_mkroot(self); |
556
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
54 |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
55 X_njs_MB_init_handle_connection(rt); |
558
d61133da2845
New MadButterfly runtime object install of calling function
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
56 |
d61133da2845
New MadButterfly runtime object install of calling function
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
57 return Null(); |
556
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
58 } |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
59 |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
60 static Handle<Value> |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
61 xnjsmb_handle_connection(const Arguments &args) { |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
62 } |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
63 |
571
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
64 static Handle<Value> |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
65 xnjsmb_rt_redraw_changed(const Arguments &args) { |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
66 Handle<Object> self = args.This(); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
67 njs_runtime_t *rt; |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
68 redraw_man_t *rdman; |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
69 |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
70 rdman = xnjsmb_rt_rdman(self); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
71 rdman_redraw_changed(rdman); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
72 |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
73 rt = (njs_runtime_t *)UNWRAP(self); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
74 X_njs_MB_flush(rt); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
75 |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
76 return Null(); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
77 } |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
78 |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
79 static Handle<Value> |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
80 xnjsmb_rt_redraw_all(const Arguments &args) { |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
81 Handle<Object> self = args.This(); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
82 njs_runtime_t *rt; |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
83 redraw_man_t *rdman; |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
84 |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
85 rdman = xnjsmb_rt_rdman(self); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
86 rdman_redraw_all(rdman); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
87 |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
88 rt = (njs_runtime_t *)UNWRAP(self); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
89 X_njs_MB_flush(rt); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
90 |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
91 return Null(); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
92 } |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
93 |
556
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
94 /* @} */ |
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
95 |
562
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
96 /*! \brief Get rdman associated with the runtime. |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
97 */ |
559
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
98 redraw_man_t * |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
99 xnjsmb_rt_rdman(Handle<Object> mbrt) { |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
100 HandleScope scope; |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
101 njs_runtime_t *rt; |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
102 redraw_man_t *rdman; |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
103 |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
104 rt = (njs_runtime_t *)UNWRAP(mbrt); |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
105 rdman = X_njs_MB_rdman(rt); |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
106 |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
107 return rdman; |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
108 } |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
558
diff
changeset
|
109 |
548 | 110 Handle<Value> |
111 hello_func(const Arguments &args) { | |
112 HandleScope scope; | |
113 | |
114 return String::Concat(String::New("World"), args[0]->ToString()); | |
115 } | |
116 | |
547
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
117 extern "C" void |
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
118 init(Handle<Object> target) { |
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
119 HandleScope scope; |
562
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
120 Handle<FunctionTemplate> func, mb_rt_func; |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
121 Handle<ObjectTemplate> rt_instance_temp, rt_proto_temp; |
547
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
122 |
548 | 123 func = FunctionTemplate::New(hello_func); |
124 target->Set(String::New("Hello"), func->GetFunction()); | |
556
c9d23f7279a4
The first testcase that nodejs code can show a MadButterfly window.
Thinker K.F. Li <thinker@branda.to>
parents:
548
diff
changeset
|
125 |
562
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
126 /* |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
127 * Initialize template for MadButterfly runtime objects. |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
128 */ |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
129 mb_rt_func = FunctionTemplate::New(xnjsmb_new); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
130 mb_rt_func->SetClassName(String::New("mb_rt")); |
561
a3c13c2a4792
Function template on runtime object for xnjsmb_coord_new()
Thinker K.F. Li <thinker@branda.to>
parents:
559
diff
changeset
|
131 |
562
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
132 rt_instance_temp = mb_rt_func->InstanceTemplate(); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
133 rt_instance_temp->SetInternalFieldCount(1); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
134 |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
135 rt_proto_temp = mb_rt_func->PrototypeTemplate(); |
561
a3c13c2a4792
Function template on runtime object for xnjsmb_coord_new()
Thinker K.F. Li <thinker@branda.to>
parents:
559
diff
changeset
|
136 func = FunctionTemplate::New(xnjsmb_coord_new); |
562
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
137 SET(rt_proto_temp, "coord_new", func); |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
562
diff
changeset
|
138 |
571
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
139 func = FunctionTemplate::New(xnjsmb_rt_redraw_changed); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
140 SET(rt_proto_temp, "redraw_changed", func); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
141 |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
142 func = FunctionTemplate::New(xnjsmb_rt_redraw_all); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
143 SET(rt_proto_temp, "redraw_all", func); |
13b15b7a463b
Redraw all and changed in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
144 |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
565
diff
changeset
|
145 /* |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
565
diff
changeset
|
146 * Add properties to mb_rt templates for other modules. |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
565
diff
changeset
|
147 */ |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
562
diff
changeset
|
148 xnjsmb_shapes_init_mb_rt_temp(mb_rt_func); |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
565
diff
changeset
|
149 xnjsmb_paints_init_mb_rt_temp(mb_rt_func); |
575
97159102f886
Function of query font face in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
571
diff
changeset
|
150 xnjsmb_font_init_mb_rt_temp(mb_rt_func); |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
638
diff
changeset
|
151 xnjsmb_img_ldr_init_mb_rt_temp(target); |
562
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
152 |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
153 target->Set(String::New("mb_rt"), mb_rt_func->GetFunction()); |
547
371690a166df
Remove hello.c and initial plugin at mbfly_njs.cc
Thinker K.F. Li <thinker@branda.to>
parents:
546
diff
changeset
|
154 } |