Mercurial > MadButterfly
annotate nodejs/shapes.cc @ 675:c643af2095c5
Keep and retrieve respective js object to/from property store
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Fri, 06 Aug 2010 00:56:26 +0800 |
parents | fc29a343ce7c |
children | 7685c57e29d0 |
rev | line source |
---|---|
564 | 1 #include <v8.h> |
2 #include "mbfly_njs.h" | |
3 | |
4 extern "C" { | |
5 #include <mb.h> | |
6 } | |
7 | |
570
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
8 #ifndef ASSERT |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
9 #define ASSERT(x) |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
10 #endif |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
11 |
564 | 12 using namespace v8; |
13 | |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
14 /*! \defgroup shape_temp Templates for shape and derivations. |
564 | 15 * |
16 * @{ | |
17 */ | |
18 static Persistent<FunctionTemplate> xnjsmb_shape_temp; | |
19 | |
20 static Handle<Value> | |
21 xnjsmb_shape_show(const Arguments &args) { | |
22 shape_t *sh; | |
23 Handle<Object> self; | |
24 | |
25 self = args.This(); | |
26 sh = (shape_t *)UNWRAP(self); | |
27 sh_show(sh); | |
28 | |
29 return Null(); | |
30 } | |
31 | |
32 static Handle<Value> | |
33 xnjsmb_shape_hide(const Arguments &args) { | |
34 shape_t *sh; | |
35 Handle<Object> self; | |
36 | |
37 self = args.This(); | |
38 sh = (shape_t *)UNWRAP(self); | |
39 sh_hide(sh); | |
40 | |
41 return Null(); | |
42 } | |
43 | |
570
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
44 /*! \brief Get stroke width of a shape. |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
45 */ |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
46 static Handle<Value> |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
47 xnjsmb_shape_stroke_width_getter(Local<String> property, |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
48 const AccessorInfo &info) { |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
49 Handle<Object> self = info.This(); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
50 shape_t *sh; |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
51 float w; |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
52 Handle<Value> w_val; |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
53 |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
54 sh = (shape_t *)UNWRAP(self); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
55 w = sh_get_stroke_width(sh); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
56 w_val = Number::New(w); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
57 |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
58 return w_val; |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
59 } |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
60 |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
61 /*! \brief Set stroke width of a shape. |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
62 */ |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
63 static void |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
64 xnjsmb_shape_stroke_width_setter(Local<String> property, |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
65 Local<Value> value, |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
66 const AccessorInfo &info) { |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
67 Handle<Object> self = info.This(); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
68 Handle<Object> rt; |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
69 shape_t *sh; |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
70 redraw_man_t *rdman; |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
71 float w; |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
72 Handle<Number> w_num; |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
73 |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
74 sh = (shape_t *)UNWRAP(self); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
75 w_num = value->ToNumber(); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
76 w = w_num->Value(); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
77 |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
78 sh_set_stroke_width(sh, w); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
79 |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
80 /* |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
81 * Mark changed. |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
82 */ |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
83 rt = GET(self, "mbrt")->ToObject(); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
84 ASSERT(rt != NULL); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
85 rdman = xnjsmb_rt_rdman(rt); |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
86 |
576
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
87 if(sh_get_coord(sh)) |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
88 rdman_shape_changed(rdman, sh); |
570
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
89 } |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
90 |
564 | 91 static void |
92 xnjsmb_init_shape_temp(void) { | |
93 Handle<FunctionTemplate> temp; | |
94 Handle<ObjectTemplate> proto_temp; | |
95 Handle<FunctionTemplate> method_temp; | |
96 | |
97 temp = FunctionTemplate::New(); | |
98 temp->SetClassName(String::New("shape")); | |
99 xnjsmb_shape_temp = Persistent<FunctionTemplate>::New(temp); | |
100 proto_temp = temp->PrototypeTemplate(); | |
101 | |
102 method_temp = FunctionTemplate::New(xnjsmb_shape_show); | |
103 SET(proto_temp, "show", method_temp); | |
104 method_temp = FunctionTemplate::New(xnjsmb_shape_hide); | |
105 SET(proto_temp, "hide", method_temp); | |
570
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
106 |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
107 proto_temp->SetAccessor(String::New("stroke_width"), |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
108 xnjsmb_shape_stroke_width_getter, |
49e79253b6d3
Functions of setting/getting stroke width of a shape
Thinker K.F. Li <thinker@branda.to>
parents:
569
diff
changeset
|
109 xnjsmb_shape_stroke_width_setter); |
564 | 110 } |
111 | |
112 /* @} */ | |
113 | |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
114 /*! \defgroup path_temp Templates for path objects. |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
115 * |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
116 * @{ |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
117 */ |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
118 static Persistent<FunctionTemplate> xnjsmb_path_temp; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
119 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
120 /*! \brief Callback of constructor of path objects for Javascript. |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
121 */ |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
122 static Handle<Value> |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
123 xnjsmb_shape_path(const Arguments &args) { |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
124 shape_t *sh; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
125 redraw_man_t *rdman; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
126 Handle<Object> self = args.This(); // path object |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
127 Handle<Object> rt; |
675
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
128 Persistent<Object> *self_hdl; |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
129 char *dstr; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
130 int argc; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
131 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
132 argc = args.Length(); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
133 if(argc != 2) |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
134 THROW("Invalid number of arugments (!= 1)"); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
135 if(!args[0]->IsString()) |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
136 THROW("Invalid argument type (should be a string)"); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
137 if(!args[1]->IsObject()) |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
138 THROW("Invalid argument type (should be an object)"); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
139 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
140 String::Utf8Value dutf8(args[0]->ToString()); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
141 dstr = *dutf8; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
142 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
143 rt = args[1]->ToObject(); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
144 rdman = xnjsmb_rt_rdman(rt); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
145 sh = rdman_shape_path_new(rdman, dstr); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
146 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
147 WRAP(self, sh); |
569
f87a368e847a
Functions of stroke and fill a shape
Thinker K.F. Li <thinker@branda.to>
parents:
565
diff
changeset
|
148 SET(self, "mbrt", rt); |
675
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
149 /* Keep associated js object in property store for retrieving, |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
150 * later, without create new js object. |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
151 */ |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
152 self_hdl = new Persistent<Object>(self); |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
153 mb_prop_set(&sh->obj.props, PROP_JSOBJ, self_hdl); |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
154 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
155 return Null(); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
156 } |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
157 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
158 /*! \brief Initial function template for constructor of path objects. |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
159 */ |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
160 static void |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
161 xnjsmb_init_path_temp(void) { |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
162 Handle<FunctionTemplate> temp; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
163 Handle<ObjectTemplate> inst_temp; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
164 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
165 temp = FunctionTemplate::New(xnjsmb_shape_path); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
166 temp->Inherit(xnjsmb_shape_temp); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
167 temp->SetClassName(String::New("path")); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
168 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
169 inst_temp = temp->InstanceTemplate(); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
170 inst_temp->SetInternalFieldCount(1); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
171 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
172 xnjsmb_path_temp = Persistent<FunctionTemplate>::New(temp); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
173 } |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
174 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
175 /*! \brief Callback function of mb_rt.path_new(). |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
176 */ |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
177 static Handle<Value> |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
178 xnjsmb_shape_path_new(const Arguments &args) { |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
179 HandleScope scope; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
180 Handle<Object> self = args.This(); // runtime object |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
181 Handle<Object> path_obj; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
182 Handle<Value> path_args[2]; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
183 int argc; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
184 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
185 argc = args.Length(); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
186 if(argc != 1) |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
187 THROW("Invalid number of arugments (!= 1)"); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
188 if(!args[0]->IsString()) |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
189 THROW("Invalid argument type (shoud be a string)"); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
190 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
191 path_args[0] = args[0]; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
192 path_args[1] = self; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
193 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
194 path_obj = xnjsmb_path_temp->GetFunction()->NewInstance(2, path_args); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
195 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
196 scope.Close(path_obj); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
197 return path_obj; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
198 } |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
199 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
200 /* @} */ |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
201 |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
202 /*! \defgroup stext_path Template for stext objects. |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
203 * |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
204 * @{ |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
205 */ |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
206 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
207 /*! \brief Constructor for stext objects. |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
208 * |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
209 * 4 arguments |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
210 * \param rt is a runtime object. |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
211 * \param data is a text to be showed. |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
212 * \param x is postion in x-axis. |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
213 * \param y is position in y-axis. |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
214 */ |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
215 static Handle<Value> |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
216 xnjsmb_shape_stext(const Arguments &args) { |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
217 int argc = args.Length(); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
218 Handle<Object> self = args.This(); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
219 Handle<Object> rt; |
675
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
220 Persistent<Object> *self_hdl; |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
221 float x, y; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
222 char *data; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
223 redraw_man_t *rdman; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
224 shape_t *stext; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
225 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
226 if(argc != 4) |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
227 THROW("Invalid number of arguments (!= 4)"); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
228 if(!args[0]->IsObject() || !args[1]->IsString() || |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
229 !args[2]->IsNumber() || !args[3]->IsNumber()) |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
230 THROW("Invalid argument type"); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
231 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
232 rt = args[0]->ToObject(); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
233 String::Utf8Value data_utf8(args[1]); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
234 data = *data_utf8; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
235 x = args[2]->ToNumber()->Value(); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
236 y = args[3]->ToNumber()->Value(); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
237 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
238 rdman = xnjsmb_rt_rdman(rt); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
239 ASSERT(rdman != NULL); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
240 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
241 stext = rdman_shape_stext_new(rdman, data, x, y); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
242 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
243 WRAP(self, stext); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
244 SET(self, "mbrt", rt); |
675
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
245 /* Keep associated js object in property store for retrieving, |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
246 * later, without create new js object. |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
247 */ |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
248 self_hdl = new Persistent<Object>(self); |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
249 mb_prop_set(&stext->obj.props, PROP_JSOBJ, self_hdl); |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
250 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
251 return Null(); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
252 } |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
253 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
254 static Persistent<FunctionTemplate> xnjsmb_shape_stext_temp; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
255 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
256 /*! \brief Create a stext and return it. |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
257 */ |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
258 static Handle<Value> |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
259 xnjsmb_shape_stext_new(const Arguments &args) { |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
260 HandleScope scope; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
261 int argc = args.Length(); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
262 Handle<Object> self = args.This(); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
263 Handle<Value> stext_args[4]; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
264 Handle<Object> stext_obj; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
265 Handle<Function> func; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
266 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
267 if(argc != 3) |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
268 THROW("Invalid number of arguments (!= 3)"); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
269 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
270 stext_args[0] = self; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
271 stext_args[1] = args[0]; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
272 stext_args[2] = args[1]; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
273 stext_args[3] = args[2]; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
274 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
275 func = xnjsmb_shape_stext_temp->GetFunction(); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
276 stext_obj = func->NewInstance(4, stext_args); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
277 ASSERT(stext_obj != NULL); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
278 |
641
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
279 scope.Close(stext_obj); |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
280 return stext_obj; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
281 } |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
282 |
576
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
283 /*! \brief Setup style blocks for a stext. |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
284 * |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
285 * It defines font style and size for blocks of text message. |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
286 * |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
287 * \param blks is a list (n_char, face, font size) tuples. |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
288 */ |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
289 static Handle<Value> |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
290 xnjsmb_shape_stext_set_style(const Arguments &args) { |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
291 HandleScope scope; |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
292 int argc = args.Length(); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
293 Handle<Object> self = args.This(); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
294 shape_t *sh; |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
295 Array *blksobj; |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
296 Array *blkobj; |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
297 mb_style_blk_t *blks; |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
298 int nblks; |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
299 int i; |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
300 int r; |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
301 |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
302 if(argc != 1) |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
303 THROW("Invalid number of arguments (!= 1)"); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
304 if(!args[0]->IsArray()) |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
305 THROW("Invalid type of the argument"); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
306 |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
307 blksobj = Array::Cast(*args[0]); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
308 nblks = blksobj->Length(); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
309 blks = new mb_style_blk_t[nblks]; |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
310 for(i = 0; i < nblks; i++) { |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
311 blkobj = Array::Cast(*blksobj->Get(i)); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
312 blks[i].n_chars = blkobj->Get(0)->ToInt32()->Value(); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
313 blks[i].face = (mb_font_face_t *)UNWRAP(blkobj->Get(1)->ToObject()); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
314 blks[i].font_sz = blkobj->Get(2)->ToNumber()->Value(); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
315 } |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
316 |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
317 sh = (shape_t *)UNWRAP(self); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
318 r = sh_stext_set_style(sh, blks, nblks); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
319 if(r != 0) |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
320 THROW("Unknown error"); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
321 |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
322 delete blks; |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
323 |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
324 return Null(); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
325 } |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
326 |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
327 /*! \brief Initialize function template for stext objects. |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
328 */ |
641
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
329 static void |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
330 xnjsmb_init_stext_temp(void) { |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
331 Handle<FunctionTemplate> func_temp; |
576
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
332 Handle<FunctionTemplate> meth_temp; |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
333 Handle<ObjectTemplate> inst_temp; |
576
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
334 Handle<ObjectTemplate> proto_temp; |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
335 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
336 func_temp = FunctionTemplate::New(xnjsmb_shape_stext); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
337 func_temp->Inherit(xnjsmb_shape_temp); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
338 func_temp->SetClassName(String::New("stext")); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
339 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
340 inst_temp = func_temp->InstanceTemplate(); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
341 inst_temp->SetInternalFieldCount(1); |
576
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
342 |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
343 proto_temp = func_temp->PrototypeTemplate(); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
344 meth_temp = FunctionTemplate::New(xnjsmb_shape_stext_set_style); |
5a68e2bcea17
Set font styles for stext in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
574
diff
changeset
|
345 SET(proto_temp, "set_style", meth_temp); |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
346 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
347 xnjsmb_shape_stext_temp = Persistent<FunctionTemplate>::New(func_temp); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
348 } |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
349 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
350 /* @} */ |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
351 |
641
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
352 /*! \defgroup image_temp Templates for image objects. |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
353 * |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
354 * @{ |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
355 */ |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
356 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
357 static Handle<Value> |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
358 xnjsmb_shape_image(const Arguments &args) { |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
359 int argc = args.Length(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
360 Handle<Object> self = args.This(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
361 Handle<Object> rt; |
675
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
362 Persistent<Object> *self_hdl; |
641
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
363 float x, y; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
364 float w, h; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
365 redraw_man_t *rdman; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
366 shape_t *img; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
367 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
368 if(argc != 5) |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
369 THROW("Invalid number of arguments (!= 5)"); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
370 if(!args[0]->IsObject() || |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
371 !args[1]->IsNumber() || !args[2]->IsNumber() || |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
372 !args[3]->IsNumber() || !args[4]->IsNumber()) |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
373 THROW("Invalid argument type"); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
374 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
375 rt = args[0]->ToObject(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
376 x = args[1]->ToNumber()->Value(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
377 y = args[2]->ToNumber()->Value(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
378 w = args[3]->ToNumber()->Value(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
379 h = args[4]->ToNumber()->Value(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
380 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
381 rdman = xnjsmb_rt_rdman(rt); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
382 img = rdman_shape_image_new(rdman, x, y, w, h); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
383 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
384 WRAP(self, img); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
385 SET(self, "mbrt", rt); |
675
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
386 /* Keep associated js object in property store for retrieving, |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
387 * later, without create new js object. |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
388 */ |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
389 self_hdl = new Persistent<Object>(self); |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
671
diff
changeset
|
390 mb_prop_set(&img->obj.props, PROP_JSOBJ, self_hdl); |
641
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
391 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
392 return Null(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
393 } |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
394 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
395 static Persistent<FunctionTemplate> xnjsmb_shape_image_temp; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
396 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
397 static Handle<Value> |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
398 xnjsmb_shape_image_new(const Arguments &args) { |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
399 HandleScope scope; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
400 int argc = args.Length(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
401 Handle<Object> self = args.This(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
402 Handle<Value> img_args[5]; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
403 Handle<Object> img_obj; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
404 Handle<Function> func; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
405 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
406 if(argc != 4) |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
407 THROW("Invalid number of arguments (!= 3)"); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
408 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
409 img_args[0] = self; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
410 img_args[1] = args[0]; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
411 img_args[2] = args[1]; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
412 img_args[3] = args[2]; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
413 img_args[4] = args[3]; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
414 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
415 func = xnjsmb_shape_image_temp->GetFunction(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
416 img_obj = func->NewInstance(5, img_args); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
417 ASSERT(img_obj != NULL); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
418 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
419 scope.Close(img_obj); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
420 return img_obj; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
421 } |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
422 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
423 static void |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
424 xnjsmb_init_image_temp() { |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
425 Handle<FunctionTemplate> func_temp; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
426 Handle<FunctionTemplate> meth_temp; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
427 Handle<ObjectTemplate> inst_temp; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
428 Handle<ObjectTemplate> proto_temp; |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
429 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
430 func_temp = FunctionTemplate::New(xnjsmb_shape_image); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
431 func_temp->Inherit(xnjsmb_shape_temp); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
432 func_temp->SetClassName(String::New("image")); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
433 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
434 inst_temp = func_temp->InstanceTemplate(); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
435 inst_temp->SetInternalFieldCount(1); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
436 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
437 xnjsmb_shape_image_temp = Persistent<FunctionTemplate>::New(func_temp); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
438 } |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
439 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
440 /* @} */ |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
441 |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
442 /*! \brief Set properties of template of mb_rt. |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
443 */ |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
444 void |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
445 xnjsmb_shapes_init_mb_rt_temp(Handle<FunctionTemplate> rt_temp) { |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
446 HandleScope scope; |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
447 Handle<FunctionTemplate> path_new_temp, stext_new_temp; |
641
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
448 Handle<FunctionTemplate> image_new_temp; |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
449 Handle<ObjectTemplate> rt_proto_temp; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
450 static int temp_init_flag = 0; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
451 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
452 if(temp_init_flag == 0) { |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
453 xnjsmb_init_shape_temp(); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
454 xnjsmb_init_path_temp(); |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
455 xnjsmb_init_stext_temp(); |
643
a65720721c60
Fix issue of exception of internal field.
Thinker K.F. Li <thinker@branda.to>
parents:
641
diff
changeset
|
456 xnjsmb_init_image_temp(); |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
457 temp_init_flag = 1; |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
458 } |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
459 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
460 rt_proto_temp = rt_temp->PrototypeTemplate(); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
461 |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
462 path_new_temp = FunctionTemplate::New(xnjsmb_shape_path_new); |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
463 SET(rt_proto_temp, "path_new", path_new_temp); |
574
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
464 |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
465 stext_new_temp = FunctionTemplate::New(xnjsmb_shape_stext_new); |
a2faee809514
Implement stext type for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
570
diff
changeset
|
466 SET(rt_proto_temp, "stext_new", stext_new_temp); |
641
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
467 |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
468 image_new_temp = FunctionTemplate::New(xnjsmb_shape_image_new); |
f60d8fa1c55b
Javascript binding for shape_image_t
Thinker K.F. Li <thinker@branda.to>
parents:
576
diff
changeset
|
469 SET(rt_proto_temp, "image_new", image_new_temp); |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
564
diff
changeset
|
470 } |