diff options
author | David Walter Seikel | 2014-05-08 07:32:36 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-08 07:32:36 +1000 |
commit | 6617c76a5e8c902abab5e54c462e552f4ac285e1 (patch) | |
tree | 4dde0d6e14a7112e5595da9fc68f21365efaa046 /src | |
parent | Switch to purkle is complete. (diff) | |
download | SledjHamr-6617c76a5e8c902abab5e54c462e552f4ac285e1.zip SledjHamr-6617c76a5e8c902abab5e54c462e552f4ac285e1.tar.gz SledjHamr-6617c76a5e8c902abab5e54c462e552f4ac285e1.tar.bz2 SledjHamr-6617c76a5e8c902abab5e54c462e552f4ac285e1.tar.xz |
And now purkle is it's own skang module.
Diffstat (limited to '')
-rw-r--r-- | src/GuiLua/GuiLua.c | 2 | ||||
-rw-r--r-- | src/GuiLua/GuiLua.h | 2 | ||||
-rwxr-xr-x | src/extantz/build.lua | 4 | ||||
-rw-r--r-- | src/extantz/extantz.c | 7 | ||||
-rw-r--r-- | src/extantz/extantz.h | 1 | ||||
-rw-r--r-- | src/extantz/purkle.c | 43 | ||||
-rwxr-xr-x | src/purkle/build.lua | 22 | ||||
-rw-r--r-- | src/purkle/purkle.c | 82 |
8 files changed, 113 insertions, 50 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index cfcc9d8..dbd3f95 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c | |||
@@ -144,7 +144,7 @@ and ordinary elementary widgets. Proper introspection can come later. | |||
144 | 144 | ||
145 | 145 | ||
146 | static int logDom; // Our logging domain. | 146 | static int logDom; // Our logging domain. |
147 | static const char *glName = "ourGuiLua"; | 147 | const char *glName = "ourGuiLua"; |
148 | 148 | ||
149 | /* Sooo, how to do this - | 149 | /* Sooo, how to do this - |
150 | widget has to be a light userdata | 150 | widget has to be a light userdata |
diff --git a/src/GuiLua/GuiLua.h b/src/GuiLua/GuiLua.h index 2a4a3f0..75c0b38 100644 --- a/src/GuiLua/GuiLua.h +++ b/src/GuiLua/GuiLua.h | |||
@@ -27,6 +27,8 @@ typedef struct _GuiLua | |||
27 | Evas_Smart_Cb on_del; | 27 | Evas_Smart_Cb on_del; |
28 | } GuiLua; | 28 | } GuiLua; |
29 | 29 | ||
30 | extern const char *glName; | ||
31 | |||
30 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent); | 32 | GuiLua *GuiLuaDo(int argc, char **argv, winFang *parent); |
31 | void GuiLuaDel(GuiLua *gl); | 33 | void GuiLuaDel(GuiLua *gl); |
32 | 34 | ||
diff --git a/src/extantz/build.lua b/src/extantz/build.lua index d15be35..1591e8a 100755 --- a/src/extantz/build.lua +++ b/src/extantz/build.lua | |||
@@ -18,11 +18,11 @@ LDFLAGS = LDFLAGS .. ' -L../../libraries/irrlicht-1.8.1/lib/Linux' | |||
18 | libs = libs .. ' -lIrrlicht -lGL -lbz2 -lGuiLua -lwinFang -lRunnr' | 18 | libs = libs .. ' -lIrrlicht -lGL -lbz2 -lGuiLua -lwinFang -lRunnr' |
19 | 19 | ||
20 | removeFiles(dir, {'crappisspuke.o', 'CDemo.o', 'extantzCamera.o', 'gears.o', 'ephysics_demo.o', 'Evas_3D_demo.o', '../../media/extantz.edj'}) | 20 | removeFiles(dir, {'crappisspuke.o', 'CDemo.o', 'extantzCamera.o', 'gears.o', 'ephysics_demo.o', 'Evas_3D_demo.o', '../../media/extantz.edj'}) |
21 | removeFiles(dir, {'../../extantz', 'camera.o', 'purkle.o', 'files.o', 'scenri.o', 'woMan.o'}) | 21 | removeFiles(dir, {'../../extantz', 'camera.o', 'files.o', 'scenri.o', 'woMan.o'}) |
22 | 22 | ||
23 | runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' extantz.edc ../../media/extantz.edj') | 23 | runCommand('edje_cc', dir, 'edje_cc ' .. EDJE_FLAGS .. ' extantz.edc ../../media/extantz.edj') |
24 | runCommand('Irrlicht files', dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c crappisspuke.cpp -o crappisspuke.o ' .. LDFLAGS) | 24 | runCommand('Irrlicht files', dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c crappisspuke.cpp -o crappisspuke.o ' .. LDFLAGS) |
25 | runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c CDemo.cpp -o CDemo.o ' .. LDFLAGS) | 25 | runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c CDemo.cpp -o CDemo.o ' .. LDFLAGS) |
26 | runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c extantzCamera.cpp -o extantzCamera.o ' .. LDFLAGS) | 26 | runCommand(nil, dir, 'g++ ' .. CFLAGS .. ' -ffast-math -c extantzCamera.cpp -o extantzCamera.o ' .. LDFLAGS) |
27 | CFLAGS = CFLAGS .. ' -Wl,-export-dynamic' | 27 | CFLAGS = CFLAGS .. ' -Wl,-export-dynamic' |
28 | compileFiles('../../extantz', dir, {'gears', 'ephysics_demo', 'camera', 'Evas_3D_demo', 'purkle', 'files', 'scenri', 'woMan', 'extantz'}, 'crappisspuke.o CDemo.o extantzCamera.o') | 28 | compileFiles('../../extantz', dir, {'gears', 'ephysics_demo', 'camera', 'Evas_3D_demo', 'files', 'scenri', 'woMan', 'extantz'}, 'crappisspuke.o CDemo.o extantzCamera.o') |
diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index b8536e9..590770d 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c | |||
@@ -515,11 +515,12 @@ EAPI_MAIN int elm_main(int argc, char **argv) | |||
515 | makeMainMenu(&ourGlobals); | 515 | makeMainMenu(&ourGlobals); |
516 | 516 | ||
517 | // overlay_add(&ourGlobals); | 517 | // overlay_add(&ourGlobals); |
518 | woMan_add(&ourGlobals); | ||
519 | purkleAdd(&ourGlobals); | ||
520 | ourGlobals.files = filesAdd(&ourGlobals, (char *) elm_app_data_dir_get(), EINA_TRUE, EINA_FALSE); | ||
521 | char *args[] = {"extantz", "-l", "test", "-foo", "COMBINED!", NULL}; | 518 | char *args[] = {"extantz", "-l", "test", "-foo", "COMBINED!", NULL}; |
522 | GuiLuaDo(5, args, ourGlobals.mainWindow); | 519 | GuiLuaDo(5, args, ourGlobals.mainWindow); |
520 | woMan_add(&ourGlobals); | ||
521 | args[2] = "purkle"; | ||
522 | GuiLuaDo(3, args, ourGlobals.mainWindow); | ||
523 | ourGlobals.files = filesAdd(&ourGlobals, (char *) elm_app_data_dir_get(), EINA_TRUE, EINA_FALSE); | ||
523 | 524 | ||
524 | #if USE_PHYSICS | 525 | #if USE_PHYSICS |
525 | world = ephysicsAdd(&ourGlobals); | 526 | world = ephysicsAdd(&ourGlobals); |
diff --git a/src/extantz/extantz.h b/src/extantz/extantz.h index c6e3393..684b53d 100644 --- a/src/extantz/extantz.h +++ b/src/extantz/extantz.h | |||
@@ -258,7 +258,6 @@ Eina_Bool animateCamera(Scene_Data *scene); | |||
258 | 258 | ||
259 | winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool save); | 259 | winFang *filesAdd(globals *ourGlobals, char *path, Eina_Bool multi, Eina_Bool save); |
260 | void filesShow(winFang *me, Evas_Smart_Cb func, void *data); | 260 | void filesShow(winFang *me, Evas_Smart_Cb func, void *data); |
261 | winFang *purkleAdd(globals *ourGlobals); | ||
262 | winFang *woMan_add(globals *ourGlobals); | 261 | winFang *woMan_add(globals *ourGlobals); |
263 | 262 | ||
264 | 263 | ||
diff --git a/src/extantz/purkle.c b/src/extantz/purkle.c deleted file mode 100644 index 590a84e..0000000 --- a/src/extantz/purkle.c +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | #include "extantz.h" | ||
2 | |||
3 | |||
4 | // TODO - This is to work around a bug in Elm entry, remove it when the bug is fixed. | ||
5 | // The bug is that editable entry widgets cause the app to hang on exit. | ||
6 | static void _on_entry_del(void *data, Evas_Object *obj, void *event_info) | ||
7 | { | ||
8 | // winFang *me = data; | ||
9 | |||
10 | elm_entry_editable_set(obj, EINA_FALSE); | ||
11 | } | ||
12 | |||
13 | winFang *purkleAdd(globals *ourGlobals) | ||
14 | { | ||
15 | winFang *me; | ||
16 | Widget *wid; | ||
17 | Evas_Object *en; | ||
18 | |||
19 | me = winFangAdd(ourGlobals->mainWindow, 30, 520, ourGlobals->win_w / 3, ourGlobals->win_h / 3, "chatter box", "purkle"); | ||
20 | |||
21 | en = eo_add(ELM_OBJ_ENTRY_CLASS, me->win, | ||
22 | elm_obj_entry_scrollable_set(EINA_TRUE), | ||
23 | elm_obj_entry_editable_set(EINA_FALSE), | ||
24 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | ||
25 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | ||
26 | evas_obj_visibility_set(EINA_TRUE) | ||
27 | ); | ||
28 | elm_object_text_set(en, "History is shown here"); | ||
29 | elm_box_pack_end(me->box, en); | ||
30 | eo_unref(en); | ||
31 | |||
32 | wid = widgetAdd(me, ELM_OBJ_ENTRY_CLASS, me->win, ""); | ||
33 | wid->on_del = _on_entry_del; | ||
34 | eo_do(wid->obj, | ||
35 | elm_obj_entry_scrollable_set(EINA_TRUE), | ||
36 | elm_obj_entry_editable_set(EINA_TRUE) | ||
37 | ); | ||
38 | elm_box_pack_end(me->box, wid->obj); | ||
39 | |||
40 | evas_object_show(me->box); | ||
41 | |||
42 | return me; | ||
43 | } | ||
diff --git a/src/purkle/build.lua b/src/purkle/build.lua new file mode 100755 index 0000000..32ff522 --- /dev/null +++ b/src/purkle/build.lua | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/usr/bin/env lua | ||
2 | |||
3 | local dir = ... | ||
4 | |||
5 | if 'nil' == type(dir) then | ||
6 | local build, err = loadfile('../../build.lua') | ||
7 | if build then | ||
8 | setfenv(build, getfenv(2)) | ||
9 | build(2) | ||
10 | else | ||
11 | print("ERROR - " .. err) | ||
12 | end | ||
13 | dir = workingDir | ||
14 | end | ||
15 | |||
16 | CFLAGS = CFLAGS .. ' -I../GuiLua' | ||
17 | LDFLAGS = '-L ' .. dir .. ' ' .. LDFLAGS | ||
18 | libs = libs .. ' -lGuiLua -lwinFang -lRunnr' | ||
19 | |||
20 | removeFiles(dir, {lib_d .. '/purkle.so'}) | ||
21 | |||
22 | runCommand('C modules', dir, 'gcc ' .. CFLAGS .. ' -fPIC -shared -o ' .. lib_d .. '/purkle.so purkle.c') | ||
diff --git a/src/purkle/purkle.c b/src/purkle/purkle.c new file mode 100644 index 0000000..971ad37 --- /dev/null +++ b/src/purkle/purkle.c | |||
@@ -0,0 +1,82 @@ | |||
1 | //#include "LumbrJack.h" | ||
2 | #include "GuiLua.h" | ||
3 | #include "Runnr.h" | ||
4 | #include "winFang.h" | ||
5 | |||
6 | |||
7 | // TODO - This is to work around a bug in Elm entry, remove it when the bug is fixed. | ||
8 | // The bug is that editable entry widgets cause the app to hang on exit. | ||
9 | static void _on_entry_del(void *data, Evas_Object *obj, void *event_info) | ||
10 | { | ||
11 | // winFang *me = data; | ||
12 | |||
13 | elm_entry_editable_set(obj, EINA_FALSE); | ||
14 | } | ||
15 | |||
16 | static winFang *purkleAdd(winFang *parent, int w, int h) | ||
17 | { | ||
18 | winFang *me; | ||
19 | Widget *wid; | ||
20 | Evas_Object *en; | ||
21 | |||
22 | me = winFangAdd(parent, 30, 520, w, h, "chatter box", "purkle"); | ||
23 | |||
24 | en = eo_add(ELM_OBJ_ENTRY_CLASS, me->win, | ||
25 | elm_obj_entry_scrollable_set(EINA_TRUE), | ||
26 | elm_obj_entry_editable_set(EINA_FALSE), | ||
27 | evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), | ||
28 | evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL), | ||
29 | evas_obj_visibility_set(EINA_TRUE) | ||
30 | ); | ||
31 | elm_object_text_set(en, "History is shown here"); | ||
32 | elm_box_pack_end(me->box, en); | ||
33 | eo_unref(en); | ||
34 | |||
35 | wid = widgetAdd(me, ELM_OBJ_ENTRY_CLASS, me->win, ""); | ||
36 | wid->on_del = _on_entry_del; | ||
37 | eo_do(wid->obj, | ||
38 | elm_obj_entry_scrollable_set(EINA_TRUE), | ||
39 | elm_obj_entry_editable_set(EINA_TRUE) | ||
40 | ); | ||
41 | elm_box_pack_end(me->box, wid->obj); | ||
42 | |||
43 | evas_object_show(me->box); | ||
44 | |||
45 | return me; | ||
46 | } | ||
47 | |||
48 | static const char *ourName = "purkle"; | ||
49 | int skang, _M; | ||
50 | |||
51 | int luaopen_purkle(lua_State *L) | ||
52 | { | ||
53 | GuiLua *gl; | ||
54 | winFang *parent = NULL; | ||
55 | |||
56 | |||
57 | // local skang = require 'skang' | ||
58 | lua_getglobal(L, "require"); | ||
59 | lua_pushstring(L, SKANG); | ||
60 | lua_call(L, 1, 1); | ||
61 | lua_setfield(L, LUA_REGISTRYINDEX, SKANG); | ||
62 | lua_getfield(L, LUA_REGISTRYINDEX, SKANG); | ||
63 | skang = lua_gettop(L); | ||
64 | |||
65 | // local _M = skang.moduleBegin('test_c', nil, 'Copyright 2014 David Seikel', '0.1', '2014-03-27 03:57:00', nil, false) | ||
66 | push_lua(L, "@ ( $ ~ $ $ $ ~ ! )", skang, MODULEBEGIN, ourName, "Copyright 2014 David Seikel", "0.1", "2014-05-08 07:18:00", 0, 1); | ||
67 | lua_setfield(L, LUA_REGISTRYINDEX, ourName); | ||
68 | lua_getfield(L, LUA_REGISTRYINDEX, ourName); | ||
69 | _M = lua_gettop(L); | ||
70 | |||
71 | lua_getfield(L, LUA_REGISTRYINDEX, glName); | ||
72 | gl = lua_touserdata(L, -1); | ||
73 | lua_pop(L, 1); | ||
74 | if (gl && gl->parent) parent = gl->parent; | ||
75 | |||
76 | purkleAdd(parent, 300, 400); | ||
77 | |||
78 | push_lua(L, "@ ( = )", skang, MODULEEND, _M, 0); | ||
79 | |||
80 | // Return _M, the table itself, not the index. | ||
81 | return 1; | ||
82 | } | ||