diff options
Diffstat (limited to '')
-rw-r--r-- | ClientHamr/GuiLua/GuiLua.c | 89 |
1 files changed, 9 insertions, 80 deletions
diff --git a/ClientHamr/GuiLua/GuiLua.c b/ClientHamr/GuiLua/GuiLua.c index 47b46ca..47f63d5 100644 --- a/ClientHamr/GuiLua/GuiLua.c +++ b/ClientHamr/GuiLua/GuiLua.c | |||
@@ -2,10 +2,8 @@ | |||
2 | 2 | ||
3 | Provides the skang and widget Lua packages. | 3 | Provides the skang and widget Lua packages. |
4 | 4 | ||
5 | This should be a library in the end, but for now it's just an | 5 | In the initial intended use case, several applications will be using |
6 | application that is a test bed for what goes into the library. In the | 6 | this all at once, with one central app hosting all the GUIs. |
7 | initial intended use case, several applications will be using this all at | ||
8 | once, with one central app hosting all the GUIs. | ||
9 | 7 | ||
10 | Basically this should deal with "windows" and their contents. A | 8 | Basically this should deal with "windows" and their contents. A |
11 | "window" in this case is hosted in the central app as some sort of | 9 | "window" in this case is hosted in the central app as some sort of |
@@ -43,10 +41,7 @@ Lua scripts do - | |||
43 | Seems simplest. | 41 | Seems simplest. |
44 | 42 | ||
45 | Also - | 43 | Also - |
46 | Most of what is in here becomes a library for dynamic linking to C code. | ||
47 | Pretty much just leaving main(), though most of what is in there right now should become another function. | ||
48 | Some of this gets shared with LuaSL, since it came from there anyway. | 44 | Some of this gets shared with LuaSL, since it came from there anyway. |
49 | Perhaps GuiLua.so will work, and I don't have to think of another name. lol | ||
50 | 45 | ||
51 | Finally - | 46 | Finally - |
52 | Add a --gui command line option, that runs foo.skang. | 47 | Add a --gui command line option, that runs foo.skang. |
@@ -144,68 +139,15 @@ and ordinary elementary widgets. Proper introspection can come later. | |||
144 | 139 | ||
145 | 140 | ||
146 | 141 | ||
147 | #include <Eet.h> | 142 | #include "GuiLua.h" |
148 | #include <Ecore.h> | ||
149 | #include <Ecore_Evas.h> | ||
150 | #include <Edje.h> | ||
151 | #include <stdio.h> | ||
152 | #include <ctype.h> | ||
153 | |||
154 | #include <lua.h> | ||
155 | #include <luajit.h> | ||
156 | #include <lualib.h> | ||
157 | #include <lauxlib.h> | ||
158 | |||
159 | typedef struct _globals globals; | ||
160 | |||
161 | |||
162 | #define WIDTH (300) | ||
163 | #define HEIGHT (300) | ||
164 | |||
165 | #define PC(...) EINA_LOG_DOM_CRIT(ourGlobals->logDom, __VA_ARGS__) | ||
166 | #define PE(...) EINA_LOG_DOM_ERR(ourGlobals->logDom, __VA_ARGS__) | ||
167 | #define PW(...) EINA_LOG_DOM_WARN(ourGlobals->logDom, __VA_ARGS__) | ||
168 | #define PD(...) EINA_LOG_DOM_DBG(ourGlobals->logDom, __VA_ARGS__) | ||
169 | #define PI(...) EINA_LOG_DOM_INFO(ourGlobals->logDom, __VA_ARGS__) | ||
170 | |||
171 | #define PCm(...) EINA_LOG_DOM_CRIT(ourGlobals.logDom, __VA_ARGS__) | ||
172 | #define PEm(...) EINA_LOG_DOM_ERR(ourGlobals.logDom, __VA_ARGS__) | ||
173 | #define PWm(...) EINA_LOG_DOM_WARN(ourGlobals.logDom, __VA_ARGS__) | ||
174 | #define PDm(...) EINA_LOG_DOM_DBG(ourGlobals.logDom, __VA_ARGS__) | ||
175 | #define PIm(...) EINA_LOG_DOM_INFO(ourGlobals.logDom, __VA_ARGS__) | ||
176 | |||
177 | #define D() PD("DEBUG") | ||
178 | |||
179 | // "01:03:52 01-01-1973\n\0" | ||
180 | #define DATE_TIME_LEN 21 | ||
181 | |||
182 | |||
183 | #ifndef FALSE | ||
184 | // NEVER change this | ||
185 | typedef enum | ||
186 | { | ||
187 | FALSE = 0, | ||
188 | TRUE = 1 | ||
189 | } boolean; | ||
190 | #endif | ||
191 | |||
192 | struct _globals | ||
193 | { | ||
194 | Ecore_Evas *ee; // Our window. | ||
195 | Evas *canvas; // The canvas for drawing directly onto. | ||
196 | Evas_Object *bg; // Our background edje. | ||
197 | lua_State *L; // Our Lua state. | ||
198 | int eina, logDom, ecore_evas, edje; | ||
199 | }; | ||
200 | |||
201 | globals ourGlobals; | ||
202 | 143 | ||
144 | globals ourGlobals; | ||
203 | 145 | ||
204 | static const char *ourName = "widget"; | 146 | static const char *ourName = "widget"; |
205 | int skang, _M; | 147 | static int skang, _M; |
148 | |||
206 | 149 | ||
207 | /* | 150 | void dumpStack(lua_State *L, int i) |
208 | static void dumpStack(lua_State *L, int i) | ||
209 | { | 151 | { |
210 | int type = lua_type(L, i); | 152 | int type = lua_type(L, i); |
211 | 153 | ||
@@ -224,15 +166,8 @@ static void dumpStack(lua_State *L, int i) | |||
224 | default : printf("Stack %d is unknown\n", i); break; | 166 | default : printf("Stack %d is unknown\n", i); break; |
225 | } | 167 | } |
226 | } | 168 | } |
227 | */ | ||
228 | |||
229 | |||
230 | 169 | ||
231 | char *getDateTime(struct tm **nowOut, char *dateOut, time_t *tiemOut); | 170 | static char dateTime[DATE_TIME_LEN]; |
232 | |||
233 | # define DATE_TIME_LEN 21 | ||
234 | |||
235 | char dateTime[DATE_TIME_LEN]; | ||
236 | 171 | ||
237 | static void _ggg_log_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args) | 172 | static void _ggg_log_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const char *file, const char *fnc, int line, const char *fmt, void *data, va_list args) |
238 | { | 173 | { |
@@ -307,13 +242,11 @@ char *getDateTime(struct tm **nowOut, char *dateOut, time_t *timeOut) | |||
307 | } | 242 | } |
308 | 243 | ||
309 | 244 | ||
310 | |||
311 | static void _on_delete(Ecore_Evas *ee /*__UNUSED__*/) | 245 | static void _on_delete(Ecore_Evas *ee /*__UNUSED__*/) |
312 | { | 246 | { |
313 | ecore_main_loop_quit(); | 247 | ecore_main_loop_quit(); |
314 | } | 248 | } |
315 | 249 | ||
316 | |||
317 | static int openWindow(lua_State *L) | 250 | static int openWindow(lua_State *L) |
318 | { | 251 | { |
319 | globals *ourGlobals; | 252 | globals *ourGlobals; |
@@ -487,10 +420,8 @@ int luaopen_widget(lua_State *L) | |||
487 | return 1; | 420 | return 1; |
488 | } | 421 | } |
489 | 422 | ||
490 | 423 | void GuiLuaDo(int argc, char **argv) | |
491 | int main(int argc, char **argv) | ||
492 | { | 424 | { |
493 | int result = EXIT_FAILURE; | ||
494 | lua_Number i; | 425 | lua_Number i; |
495 | 426 | ||
496 | memset(&ourGlobals, 0, sizeof(globals)); | 427 | memset(&ourGlobals, 0, sizeof(globals)); |
@@ -532,6 +463,4 @@ int main(int argc, char **argv) | |||
532 | } | 463 | } |
533 | else | 464 | else |
534 | fprintf(stderr, "Failed to start Lua!\n"); | 465 | fprintf(stderr, "Failed to start Lua!\n"); |
535 | |||
536 | return result; | ||
537 | } | 466 | } |