aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xbuild.lua1
-rw-r--r--src/GuiLua/GuiLua.c4
-rw-r--r--src/extantz/ephysics_demo.c2
-rw-r--r--src/extantz/woMan.c2
-rw-r--r--src/libraries/winFang.c104
-rw-r--r--src/libraries/winFang.h3
-rw-r--r--src/purkle/purkle.c2
7 files changed, 103 insertions, 15 deletions
diff --git a/build.lua b/build.lua
index 359dbe8..1128d71 100755
--- a/build.lua
+++ b/build.lua
@@ -95,5 +95,6 @@ if 'nil' == type(args) then
95 buildSub('libraries', 'src/libraries') 95 buildSub('libraries', 'src/libraries')
96 buildSub('LuaSL', 'src/LuaSL') 96 buildSub('LuaSL', 'src/LuaSL')
97 buildSub('GuiLua', 'src/GuiLua') 97 buildSub('GuiLua', 'src/GuiLua')
98 buildSub('purkle', 'src/purkle')
98 buildSub('extantz', 'src/extantz') 99 buildSub('extantz', 'src/extantz')
99end 100end
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c
index 494be84..09c3fe9 100644
--- a/src/GuiLua/GuiLua.c
+++ b/src/GuiLua/GuiLua.c
@@ -196,6 +196,8 @@ static int widget(lua_State *L)
196 ); 196 );
197 evas_object_smart_callback_add(wid->obj, "clicked", _on_click, wid); 197 evas_object_smart_callback_add(wid->obj, "clicked", _on_click, wid);
198 198
199 evas_object_show(win->box);
200
199 lua_pushlightuserdata(L, (void *) wid); 201 lua_pushlightuserdata(L, (void *) wid);
200 return 1; 202 return 1;
201 } 203 }
@@ -259,7 +261,7 @@ static int window(lua_State *L)
259 world = gl->world; 261 world = gl->world;
260 } 262 }
261 263
262 win = winFangAdd(parent, 25, 25, w, h, title, name, world); 264 win = winFangAdd(parent, 25, 55, w, h, title, name, world);
263 if (gl) 265 if (gl)
264 { 266 {
265 // If there's no parent, we become the parent. 267 // If there's no parent, we become the parent.
diff --git a/src/extantz/ephysics_demo.c b/src/extantz/ephysics_demo.c
index 4655dbb..6ace8a0 100644
--- a/src/extantz/ephysics_demo.c
+++ b/src/extantz/ephysics_demo.c
@@ -44,7 +44,7 @@ EPhysics_World *ephysicsAdd(globals *ourGlobals)
44 ephysics_body_evas_object_set(box_body1, box1, EINA_TRUE); 44 ephysics_body_evas_object_set(box_body1, box1, EINA_TRUE);
45 ephysics_body_restitution_set(box_body1, 0.7); 45 ephysics_body_restitution_set(box_body1, 0.7);
46 ephysics_body_friction_set(box_body1, 0); 46 ephysics_body_friction_set(box_body1, 0);
47 ephysics_body_linear_velocity_set(box_body1, -1500, 2000, 0); 47 ephysics_body_linear_velocity_set(box_body1, -150, 20, 0);
48 ephysics_body_angular_velocity_set(box_body1, 0, 0, 36); 48 ephysics_body_angular_velocity_set(box_body1, 0, 0, 36);
49 ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1); 49 ephysics_body_sleeping_threshold_set(box_body1, 0.1, 0.1);
50 eo_unref(box1); 50 eo_unref(box1);
diff --git a/src/extantz/woMan.c b/src/extantz/woMan.c
index 2911686..52b3a30 100644
--- a/src/extantz/woMan.c
+++ b/src/extantz/woMan.c
@@ -159,7 +159,7 @@ winFang *woMan_add(globals *ourGlobals)
159 char buf[PATH_MAX]; 159 char buf[PATH_MAX];
160 int i; 160 int i;
161 161
162 me = winFangAdd(ourGlobals->mainWindow, 30, 150, ourGlobals->win_w / 3, ourGlobals->win_h / 3, "virtual world manager", "woMan", ourGlobals->world); 162 me = winFangAdd(ourGlobals->mainWindow, 30, 200, ourGlobals->win_w / 3, ourGlobals->win_h / 3, "virtual world manager", "woMan", ourGlobals->world);
163 163
164 // A tab thingy. 164 // A tab thingy.
165 tb = elm_toolbar_add(me->win); 165 tb = elm_toolbar_add(me->win);
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c
index 205cedb..bcf99ce 100644
--- a/src/libraries/winFang.c
+++ b/src/libraries/winFang.c
@@ -49,6 +49,55 @@ static void cb_mouse_move(void *data, Evas *evas, Evas_Object *obj, void *event_
49 evas_map_free(p); 49 evas_map_free(p);
50} 50}
51 51
52static void _onBgMove(void *data, Evas *evas, Evas_Object *obj, void *event_info)
53{
54 Evas_Event_Mouse_Move *ev = event_info;
55 winFang *win = data;
56 Evas_Coord x, y, w, h;
57 Evas_Object *img = elm_win_inlined_image_object_get(win->win), *test;
58 Eina_List *objs, *this;
59 int padding = 1, i = 0, overs[4][2];
60
61 if (obj != img) return;
62 if (1 != ev->buttons) return;
63
64 // Looks like ePhysics wont cooperate about coords and other things, so plan B.
65
66 evas_object_geometry_get(img, &x, &y, &w, &h);
67 x += ev->cur.canvas.x - ev->prev.output.x;
68 y += ev->cur.canvas.y - ev->prev.output.y;
69 overs[0][0] = x - padding; overs[0][1] = y - padding;
70 overs[1][0] = x + padding + w; overs[1][1] = y - padding;
71 overs[2][0] = x + padding + w; overs[2][1] = y + padding + h;
72 overs[3][0] = x - padding; overs[3][1] = y + padding + h;
73
74 // If we are over two or more windows, stop.
75 objs = evas_objects_in_rectangle_get(win->e, overs[0][0], overs[0][1], w + (padding * 2), h + (padding * 2), EINA_TRUE, EINA_FALSE);
76 EINA_LIST_FOREACH(objs, this, test)
77 {
78 const char * name = evas_object_name_get(test);
79 if (name && (strcmp("winFang", name) == 0))
80 i++;
81 }
82 if (2 <= i)
83 {
84 return;
85 }
86
87 // Check if we are outside the parent window.
88 evas_object_geometry_get(win->parent->win, NULL, NULL, &w, &h);
89 if ((overs[0][0] < 0) || (overs[0][1] < 0))
90 {
91 return;
92 }
93 if ((overs[2][0] > w) || (overs[2][1] > h))
94 {
95 return;
96 }
97
98 evas_object_move(img, x, y);
99}
100
52static void _on_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 101static void _on_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
53{ 102{
54 elm_exit(); 103 elm_exit();
@@ -75,7 +124,8 @@ void winFangShow(winFang *win)
75winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world) 124winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world)
76{ 125{
77 winFang *result; 126 winFang *result;
78 Evas_Object *obj, *obj2; 127 Evas_Object *obj, *obj1;
128 Evas *obj2;
79 char buf[PATH_MAX]; 129 char buf[PATH_MAX];
80 int i; 130 int i;
81 131
@@ -84,6 +134,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
84 eina_clist_init(&result->winFangs); 134 eina_clist_init(&result->winFangs);
85 135
86 if (parent) result->internal = EINA_TRUE; 136 if (parent) result->internal = EINA_TRUE;
137 result->parent = parent;
87 138
88 result->x = x; 139 result->x = x;
89 result->y = y; 140 result->y = y;
@@ -98,9 +149,11 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
98 result->win = elm_win_add(parent->win, name, ELM_WIN_INLINED_IMAGE); 149 result->win = elm_win_add(parent->win, name, ELM_WIN_INLINED_IMAGE);
99 eina_clist_add_head(&parent->winFangs, &result->node); 150 eina_clist_add_head(&parent->winFangs, &result->node);
100 obj = elm_win_inlined_image_object_get(result->win); 151 obj = elm_win_inlined_image_object_get(result->win);
152 evas_object_name_set(obj, "winFang");
101 // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets. 153 // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets.
102 // According to the Elm inlined image window example, this is what's needed to. 154 // According to the Elm inlined image window example, this is what's needed to.
103 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, NULL); 155 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_DOWN, _cb_mouse_down_elm, NULL);
156 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, _onBgMove, result);
104 elm_win_alpha_set(result->win, EINA_TRUE); 157 elm_win_alpha_set(result->win, EINA_TRUE);
105 158
106 // image object for win is unlinked to its pos/size - so manual control 159 // image object for win is unlinked to its pos/size - so manual control
@@ -110,6 +163,7 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
110 evas_object_resize(obj, result->w, result->h); 163 evas_object_resize(obj, result->w, result->h);
111 164
112 obj2 = evas_object_evas_get(obj); 165 obj2 = evas_object_evas_get(obj);
166 result->e = obj2;
113 // Create corner handles. 167 // Create corner handles.
114 snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get()); 168 snprintf(buf, sizeof(buf), "%s/pt.png", elm_app_data_dir_get());
115 for (i = 0; i < 4; i++) 169 for (i = 0; i < 4; i++)
@@ -143,16 +197,6 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
143 eo_unref(result->hand[i]); 197 eo_unref(result->hand[i]);
144#endif 198#endif
145 } 199 }
146 if (world)
147 {
148 result->body = ephysics_body_box_add(world);
149 ephysics_body_evas_object_set(result->body, obj, EINA_TRUE);
150 ephysics_body_restitution_set(result->body, 0.7);
151 ephysics_body_friction_set(result->body, 0);
152 ephysics_body_linear_velocity_set(result->body, 80, -60, 0);
153 ephysics_body_angular_velocity_set(result->body, 0, 0, 360);
154 ephysics_body_sleeping_threshold_set(result->body, 0.1, 0.1);
155 }
156 } 200 }
157 else 201 else
158 { 202 {
@@ -182,6 +226,44 @@ winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, ch
182 ); 226 );
183 elm_win_resize_object_add(result->win, result->box); 227 elm_win_resize_object_add(result->win, result->box);
184 228
229 if (result->internal)
230 {
231 result->title = eo_add(ELM_OBJ_LABEL_CLASS, result->win,
232 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
233 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0),
234 evas_obj_visibility_set(EINA_TRUE)
235 );
236 elm_object_style_set(result->title, "slide_bounce");
237 snprintf(buf, PATH_MAX, "<b>%s</b>", title);
238 elm_object_text_set(result->title, buf);
239 elm_box_pack_end(result->box, result->title);
240 eo_unref(result->title);
241
242#if 0
243 // EPysics enable the window.
244 if (world)
245 {
246 result->body = ephysics_body_box_add(world);
247 ephysics_body_evas_object_set(result->body, obj, EINA_TRUE);
248 ephysics_body_mass_set(result->body, 0);
249// ephysics_body_restitution_set(result->body, 0.7);
250// ephysics_body_friction_set(result->body, 0);
251// ephysics_body_linear_velocity_set(result->body, 0, 0, 0);
252// ephysics_body_angular_velocity_set(result->body, 0, 0, 0);
253 ephysics_body_sleeping_threshold_set(result->body, 0.1, 0.1);
254 }
255#endif
256
257 obj1 = eo_add(ELM_OBJ_SEPARATOR_CLASS, result->win,
258 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
259 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0.0),
260 elm_obj_separator_horizontal_set(EINA_TRUE),
261 evas_obj_visibility_set(EINA_TRUE)
262 );
263 elm_box_pack_end(result->box, obj1);
264 eo_unref(obj1);
265 }
266
185 evas_object_resize(result->win, result->w, result->h); 267 evas_object_resize(result->win, result->w, result->h);
186 evas_object_show(result->win); 268 evas_object_show(result->win);
187 269
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h
index a84c8de..f3b4e45 100644
--- a/src/libraries/winFang.h
+++ b/src/libraries/winFang.h
@@ -18,7 +18,10 @@
18 18
19typedef struct _winFang 19typedef struct _winFang
20{ 20{
21 Evas *e;
22 struct _winFang *parent;
21 Evas_Object *win; 23 Evas_Object *win;
24 Evas_Object *title;
22 Evas_Object *bg; 25 Evas_Object *bg;
23 Evas_Object *box; 26 Evas_Object *box;
24 EPhysics_Body *body; 27 EPhysics_Body *body;
diff --git a/src/purkle/purkle.c b/src/purkle/purkle.c
index 8ea012c..ef0bbf2 100644
--- a/src/purkle/purkle.c
+++ b/src/purkle/purkle.c
@@ -19,7 +19,7 @@ static winFang *purkleAdd(winFang *parent, int w, int h, EPhysics_World *world)
19 Widget *wid; 19 Widget *wid;
20 Evas_Object *en; 20 Evas_Object *en;
21 21
22 me = winFangAdd(parent, 30, 520, w, h, "chatter box", "purkle", world); 22 me = winFangAdd(parent, 30, 590, w, h, "chatter box", "purkle", world);
23 23
24 en = eo_add(ELM_OBJ_ENTRY_CLASS, me->win, 24 en = eo_add(ELM_OBJ_ENTRY_CLASS, me->win,
25 elm_obj_entry_scrollable_set(EINA_TRUE), 25 elm_obj_entry_scrollable_set(EINA_TRUE),