annotate nodejs/observer.cc @ 1498:fc4169113259

Show popup menu for right click on a transition
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 03 May 2011 13:00:20 +0800
parents 1993e5ae60aa
children
rev   line source
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 788
diff changeset
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*-
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 788
diff changeset
2 // vim: sw=4:ts=8:sts=4
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 #include <v8.h>
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 #include "mbfly_njs.h"
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 extern "C" {
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 #include <mb.h>
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 #include <string.h>
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 }
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 #ifndef ASSERT
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 #define ASSERT(x)
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 #endif
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 using namespace v8;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16
686
ddce24029561 More doc
Thinker K.F. Li <thinker@branda.to>
parents: 679
diff changeset
17 /*! \defgroup xnjsmb_observer JS binding for observer, subject and events
ddce24029561 More doc
Thinker K.F. Li <thinker@branda.to>
parents: 679
diff changeset
18 * \ingroup xnjsmb
ddce24029561 More doc
Thinker K.F. Li <thinker@branda.to>
parents: 679
diff changeset
19 *
ddce24029561 More doc
Thinker K.F. Li <thinker@branda.to>
parents: 679
diff changeset
20 * @{
ddce24029561 More doc
Thinker K.F. Li <thinker@branda.to>
parents: 679
diff changeset
21 */
ddce24029561 More doc
Thinker K.F. Li <thinker@branda.to>
parents: 679
diff changeset
22
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 struct xnjsmb_observer_data {
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 Persistent<Function> func;
698
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
25 Persistent<Context> ctx;
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 };
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 static void
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 event_handler(event_t *evt, void *arg);
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30
679
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
31 static void
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
32 xnjsmb_event_mod(Handle<Object> self, event_t *evt) {
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
33 mouse_event_t *mevt;
1112
1993e5ae60aa Rename X_kb_event_t to mb_kb_event_t
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
34 mb_kb_event_t *xkbevt;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 788
diff changeset
35
679
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
36 switch(evt->type) {
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
37 case EVT_ANY:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
38 case EVT_MOUSE_OVER:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
39 case EVT_MOUSE_OUT:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
40 case EVT_MOUSE_MOVE:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
41 case EVT_MOUSE_BUT_PRESS:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
42 case EVT_MOUSE_BUT_RELEASE:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
43 mevt = (mouse_event_t *)evt;
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
44 SET(self, "x", Integer::New(mevt->x));
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
45 SET(self, "y", Integer::New(mevt->y));
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
46 SET(self, "but_state", Integer::New(mevt->but_state));
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
47 SET(self, "button", Integer::New(mevt->button));
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
48 break;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 788
diff changeset
49
679
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
50 case EVT_KB_PRESS:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
51 case EVT_KB_RELEASE:
1112
1993e5ae60aa Rename X_kb_event_t to mb_kb_event_t
Thinker K.F. Li <thinker@codemud.net>
parents: 822
diff changeset
52 xkbevt = (mb_kb_event_t *)evt;
679
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
53 SET(self, "keycode", Integer::New(xkbevt->keycode));
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
54 SET(self, "sym", Integer::New(xkbevt->sym));
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
55 break;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 788
diff changeset
56
679
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
57 case EVT_PROGM_COMPLETE:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
58 case EVT_RDMAN_REDRAW:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
59 case EVT_MONITOR_ADD:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
60 case EVT_MONITOR_REMOVE:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
61 case EVT_MONITOR_FREE:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
62 case EVT_MOUSE_MOVE_RAW:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
63 default:
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
64 /* Not implemented. Do nothing. */
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
65 break;
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
66 }
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
67 }
799c852b9065 Extract event info from C object to JS object
Thinker K.F. Li <thinker@branda.to>
parents: 676
diff changeset
68
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
69 static observer_t *
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
70 _subject_add_event_observer(subject_t *subject, int type,
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
71 Handle<Function> func) {
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
72 observer_t *observer;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
73 xnjsmb_observer_data *data;
698
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
74 Handle<Context> ctx;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 788
diff changeset
75
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
76 data = new xnjsmb_observer_data;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
77 if(data == NULL)
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
78 return NULL;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
79 data->func = Persistent<Function>::New(func);
698
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
80 ctx = Context::GetCurrent();
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
81 data->ctx = Persistent<Context>::New(ctx);
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
82 observer = subject_add_event_observer(subject, type,
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
83 event_handler,
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
84 data);
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
85
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
86 return observer;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
87 }
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
88
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
89 static void
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
90 _subject_remove_observer(subject_t *subject, observer_t *observer) {
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
91 xnjsmb_observer_data *data;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
92
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
93 subject_remove_observer(subject, observer);
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
94 data = (xnjsmb_observer_data *)observer->arg;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
95 delete data;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
96 }
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
97
675
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
98 static Handle<Value>
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
99 xnjsmb_event_tgt_getter(Handle<Object> self, event_t *evt, const char **err) {
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
100 Persistent<Object> *hdl;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 788
diff changeset
101
675
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
102 hdl = (Persistent<Object> *)
788
7ec13634c97d Add holder for animate
Thinker K.F. Li <thinker@codemud.net>
parents: 698
diff changeset
103 mb_prop_get(&((mb_obj_t *)evt->tgt->obj)->props,
675
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
104 PROP_JSOBJ);
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
105 return Local<Object>::New(*hdl);
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
106 }
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
107
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
108 static void
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
109 xnjsmb_event_tgt_setter(Handle<Object> self, event_t *evt,
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
110 Handle<Value> value, const char **err) {
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
111 *err = "Not implemented";
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
112 }
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
113
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
114 static Handle<Value>
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
115 xnjsmb_event_cur_tgt_getter(Handle<Object> self, event_t *evt,
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
116 const char **err) {
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
117 Persistent<Object> *hdl;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 788
diff changeset
118
675
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
119 hdl = (Persistent<Object> *)
788
7ec13634c97d Add holder for animate
Thinker K.F. Li <thinker@codemud.net>
parents: 698
diff changeset
120 mb_prop_get(&((mb_obj_t *)evt->cur_tgt->obj)->props,
675
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
121 PROP_JSOBJ);
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
122 return Local<Object>::New(*hdl);
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
123 }
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
124
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
125 static void
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
126 xnjsmb_event_cur_tgt_setter(Handle<Object> self, event_t *evt,
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
127 Handle<Value> value, const char **err) {
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
128 *err = "Not implemented";
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
129 }
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 671
diff changeset
130
655
d58251f1bf0b Add doc
Thinker K.F. Li <thinker@branda.to>
parents: 651
diff changeset
131 /* This is the part of the code generated by gen_v8_binding.m4 */
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
132 #include "observer-inc.h"
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
133
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
134 static void
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
135 event_handler(event_t *evt, void *arg) {
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
136 xnjsmb_observer_data *data = (xnjsmb_observer_data *)arg;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
137 Handle<Value> evt_obj;
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
138 Handle<Value> func_args[1];
698
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
139 Handle<Value> r;
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
140 Context::Scope context_scope(data->ctx);
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
141 TryCatch trycatch;
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
142
656
38c720272dd5 Change prefix for the code generated by generator
Thinker K.F. Li <thinker@branda.to>
parents: 655
diff changeset
143 evt_obj = xnjsmb_auto_event_new(evt);
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
144 ASSERT(!evt_obj.IsEmpty());
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
145 func_args[0] = evt_obj;
698
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
146 r = data->func->Call(data->ctx->Global(), 1, func_args);
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
147 if(r.IsEmpty()) {
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
148 Handle<Value> exception = trycatch.Exception();
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
149 String::AsciiValue exc_str(exception);
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
150 fprintf(stderr, "Exception: %s\n", *exc_str);
32e1b8005403 Handle exception for event handler
Thinker K.F. Li <thinker@branda.to>
parents: 686
diff changeset
151 }
651
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
152 }
aa52883534fc Code generated by generator can be built
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
153
676
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
154 Handle<Value>
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
155 export_xnjsmb_auto_subject_new(subject_t *subject) {
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
156 Handle<Value> val;
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 788
diff changeset
157
676
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
158 val = xnjsmb_auto_subject_new(subject);
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
159 return val;
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
160 }
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
161
658
62c2de99b03a Remove get_object() method for subject for js
Thinker K.F. Li <thinker@branda.to>
parents: 656
diff changeset
162 void
62c2de99b03a Remove get_object() method for subject for js
Thinker K.F. Li <thinker@branda.to>
parents: 656
diff changeset
163 xnjsmb_observer_init(void) {
671
fc29a343ce7c Track JS object with property store of objects
Thinker K.F. Li <thinker@branda.to>
parents: 658
diff changeset
164 xnjsmb_auto_observer_init();
fc29a343ce7c Track JS object with property store of objects
Thinker K.F. Li <thinker@branda.to>
parents: 658
diff changeset
165 xnjsmb_auto_subject_init();
fc29a343ce7c Track JS object with property store of objects
Thinker K.F. Li <thinker@branda.to>
parents: 658
diff changeset
166 xnjsmb_auto_event_init();
658
62c2de99b03a Remove get_object() method for subject for js
Thinker K.F. Li <thinker@branda.to>
parents: 656
diff changeset
167 }
686
ddce24029561 More doc
Thinker K.F. Li <thinker@branda.to>
parents: 679
diff changeset
168
ddce24029561 More doc
Thinker K.F. Li <thinker@branda.to>
parents: 679
diff changeset
169 /* @} */