summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2013-09-17 14:28:50 +0300
committerYakov Goldberg <yakov.g@samsung.com>2013-09-17 14:28:50 +0300
commit14f3a04adbcba2878739aca36e259208e4da4bce (patch)
tree80c838c442370d87776805b1aa169505764ab83e
parent27241397784da0d0df0872b34631e63bade3827d (diff)
parentcff091bdea62b500dd6b00bd3cfc9ba1bdc6cb4c (diff)
Merge commit 'cff091bdea62b500dd6b00bd3cfc9ba1bdc6cb4c'v0.1.0
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt1
-rw-r--r--TODO81
-rw-r--r--examples/example.c698
-rw-r--r--examples/example.h17
-rw-r--r--examples/main.c36
-rw-r--r--py/USAGE1
-rw-r--r--py/__init__.py0
-rw-r--r--py/cparser.py720
-rw-r--r--py/func_names.json291
-rwxr-xr-xpy/gui_db_gen.py89
-rw-r--r--py/helper.py178
-rw-r--r--src/bin/CMakeLists.txt4
-rw-r--r--src/bin/editor.c310
-rw-r--r--src/bin/egui.c388
-rw-r--r--src/bin/egui.h19
-rw-r--r--src/bin/egui_layout.c1044
-rw-r--r--src/bin/egui_layout.h37
-rw-r--r--src/bin/egui_logic.c490
-rw-r--r--src/bin/egui_logic.h2
-rw-r--r--src/bin/main.c2
-rw-r--r--src/bin/objtree.c78
-rw-r--r--src/bin/objtree.h9
-rw-r--r--src/bin/props_helper.c266
-rw-r--r--src/bin/props_helper.h33
-rw-r--r--src/bin/propview.c1018
-rw-r--r--src/bin/propview.h54
-rw-r--r--src/bin/seqview.c400
-rw-r--r--src/bin/seqview.h11
-rw-r--r--src/data/images/CMakeLists.txt23
-rw-r--r--src/data/images/factory_actionslider.pngbin0 -> 3728 bytes
-rw-r--r--src/data/images/factory_bg.pngbin0 -> 4119 bytes
-rw-r--r--src/data/images/factory_box.pngbin0 -> 8403 bytes
-rw-r--r--src/data/images/factory_bubble.pngbin0 -> 6080 bytes
-rw-r--r--src/data/images/factory_button.pngbin0 -> 2307 bytes
-rw-r--r--src/data/images/factory_calendar.pngbin0 -> 27226 bytes
-rw-r--r--src/data/images/factory_check.pngbin0 -> 825 bytes
-rw-r--r--src/data/images/factory_clock.pngbin0 -> 6884 bytes
-rw-r--r--src/data/images/factory_colorselector.pngbin0 -> 27693 bytes
-rw-r--r--src/data/images/factory_dayselector.pngbin0 -> 6038 bytes
-rw-r--r--src/data/images/factory_icon.pngbin0 -> 2061 bytes
-rw-r--r--src/data/images/factory_image.pngbin0 -> 3798 bytes
-rw-r--r--src/data/images/factory_label.pngbin0 -> 1139 bytes
-rw-r--r--src/data/images/factory_win.pngbin0 -> 114252 bytes
-rw-r--r--src/lib/CMakeLists.txt3
-rw-r--r--src/lib/database.c26
-rw-r--r--src/lib/database.h21
-rw-r--r--src/lib/db_dynamic_init.h112
-rw-r--r--src/lib/db_static_init.h10
-rw-r--r--src/lib/espion_preload.c374
-rw-r--r--src/lib/ffi_abstraction.c6
-rw-r--r--src/lib/ffi_glue.c132
-rw-r--r--src/lib/ffi_glue.h2
-rw-r--r--src/lib/generator.c586
-rw-r--r--src/lib/generator.h3
-rw-r--r--src/lib/gui_parser.c50
-rw-r--r--src/lib/gui_widget.c520
-rw-r--r--src/lib/gui_widget.h118
-rw-r--r--src/lib/simulator.c125
59 files changed, 5262 insertions, 3127 deletions
diff --git a/.gitignore b/.gitignore
index b6bb34d..8708600 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
1*.swp 1*.swp
2*.swo 2*.swo
3*.o 3*.o
4*.pyc
4/build 5/build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0369b7d..28eb9a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,3 +14,4 @@ include(EFLCheck)
14add_subdirectory(src/lib) 14add_subdirectory(src/lib)
15add_subdirectory(src/bin) 15add_subdirectory(src/bin)
16add_subdirectory(src/tests) 16add_subdirectory(src/tests)
17add_subdirectory(src/data/images)
diff --git a/TODO b/TODO
index bc37d09..28c592b 100644
--- a/TODO
+++ b/TODO
@@ -1,21 +1,72 @@
1Espion: 1Features:
2- Support parameters whose types can be double and defines 2--------
3- Callback interceptor MUST support actions without creations. Need some sequence id to determine if an action on a widget is done at the same time of the creation of the widget. Otherwise, we can't make an action into a callback. 3- Espion: support parameters whose types can be double and defines
4- Callback intercepted can be only of type CB_EXECUTE because no possibility to determine the behavior of the user code 4- Factory: add all the widgets / DnD
5- Database: fill / add display names
6- Multiple simulations modes:
7 - UI:
8 - hoversel (mode) and button to launch
9 - list of launched simulations
10 - Eo* must move from Gui_Widget to some simulation context
11 - Stop simulation
5 12
13Fixes:
14-----
15- Egui:
16 - Fix value types for parameters in property view.
6 17
7Egui: 18Improvements:
8- Fix value types for parameters in property view. 19------------
9- Prettify window canvas -> add grid. 20- Prettify the UI
10- Factory: add widgets to layout. (with click or DnD) 21- stringshare
11- Factory: add all widgets. 22- wdg, cb, action, seq: ptr->id...
12- Fill up database, change property names in database. 23- Have to improve the egui UI
24 - goal: give an identity to egui -> recognizable just by the UI
25 - theme: edc files proper to the application
26 - entries to improve: min size...
13- When DnD widget around canvas, bind it around objects. 27- When DnD widget around canvas, bind it around objects.
14 (DnD widget from one box to another; content_set, etc.)
15- Generate source files in different formats.
16- add "return EO_CALLBACK_CONTINUE" into generation of win create callback;
17- now _create callback is generated, when there is CB_CREATE is assigned to some object.
18 need to generate create callback, if widget is not auto_generated
19- add scroll_bars to layout windows, if actual size is larger than frame 28- add scroll_bars to layout windows, if actual size is larger than frame
20- connect window's visibility to its frame 29- connect window's visibility to its frame
30- DnD widget from one box to another; content_set, etc.
31
32Open issues:
33-----------
34- How to handle functions located in private H files?
35
36Known EFL bugs:
37--------------
38- FILE SELECTOR
21- button: if size_set will be before part_text_set, text will be ellipsed!!! need some fixes in recalculation 39- button: if size_set will be before part_text_set, text will be ellipsed!!! need some fixes in recalculation
40
41Future:
42------
43- Generator: source files in different formats
44- 3D representation of the exploded window:
45 - shows every widget-layer of the win (win, containers, basic) created by the user
46- Evas objects
47
48Miscellaneous:
49-------------
50- New code generation way (have to think if it can be better than now):
51 - User invokes application generation
52 - Context generation:
53 - Sequence BigBang generation:
54 - Prototype in buffer
55 - Check actions
56 - If action == create, check wdg created:
57 - yes? just generate call function to create the wdg in buffer.
58 - no? invoke wdg code generation and then do as yes
59 - Prototype in buffer
60 - Generate wdg creation code in buffer
61 - Walk on properties
62 - if dependence on not yet created widget, delay it
63 - otherwise generate property code
64 - Walk on callbacks
65 - if sequence already exists, just generate the callback add code into the buffer
66 - otherwise, invoke action generation.
67 - Check no delayed properties
68 - Walk on children and check existence
69 - yes? just generate call function to create the child in buffer.
70 - no? invoke child code generation and then do as yes
71 - Insert the buffer into the global context buffer
72 - If action == modif or user, just generate code into buffer.
diff --git a/examples/example.c b/examples/example.c
index acdeb15..23402e5 100644
--- a/examples/example.c
+++ b/examples/example.c
@@ -1,381 +1,363 @@
1//Compile with:
2//gcc -g example.c -o start `pkg-config --cflags --libs elementary`
3
4#include <Elementary.h> 1#include <Elementary.h>
2#include "elm_widget.h"
3#include "elm_widget_container.h"
4#include "elm_interface_scrollable.h"
5#include "example.h"
6
7GUI *pub_widgets;
5 8
9static Eo *win;
6static Eina_Bool 10static Eina_Bool
7_mouse_move(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc, void *event_info) 11_create_win2(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
8{ 12{
9 printf("=============== %s ============\n", __func__); 13 Eo *win2;
10 Evas_Event_Mouse_Move *ev = event_info; 14 Eo *but3;
11
12 int x, y;
13 eo_do(obj, evas_obj_position_get(&x, &y));
14 printf("but: %d %d\n", x, y);
15 x = x + ev->cur.canvas.x - ev->prev.canvas.x;
16 printf("coords prev: %d %d\n", ev->prev.canvas.x, ev->prev.canvas.y);
17 printf("coords cur: %d %d\n", ev->cur.canvas.x, ev->cur.canvas.y);
18 y = y + ev->cur.canvas.y - ev->prev.canvas.y;
19 printf("but new: %d %d\n", x, y);
20 eo_do(obj, evas_obj_position_set(x, y));
21 return EO_CALLBACK_CONTINUE;
22}
23 15
24static Eina_Bool 16/* @egui
25_mouse_down(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc, void *event_info)
26{ 17{
27 eo_do(obj, eo_event_callback_add(EVAS_EVENT_MOUSE_MOVE, _mouse_move, NULL)); 18 "win2":
28 return EO_CALLBACK_CONTINUE; 19 {
20 "Desc":
21 {
22 "parent":"win",
23 "class":"elm_win",
24 "public":true,
25 "auto_create":false
26 },
27 "Properties":
28 {
29 "constructor":["elm_obj_win_constructor"],
30 "elm_obj_win_constructor":[null, "ELM_WIN_BASIC"],
31 "title_set":["window!!!"],
32 "autodel_set":[true],
33 "size_set":[120, 120],
34 "visibility_set":[true]
35 }
36 }
37 }
38@!egui */
39 win2 = eo_add_custom(ELM_OBJ_WIN_CLASS, win, elm_obj_win_constructor(NULL, ELM_WIN_BASIC));
40 eo_unref(win2);
41 eo_do(win2, elm_obj_win_title_set("window!!!"));
42 eo_do(win2, elm_obj_win_autodel_set(EINA_TRUE));
43 eo_do(win2, evas_obj_size_set(120, 120));
44 eo_do(win2, evas_obj_visibility_set(EINA_TRUE));
45/* @egui
46{
47 "but3":
48 {
49 "Desc":
50 {
51 "parent":"win2",
52 "class":"elm_button"
53 },
54 "Properties":
55 {
56 "color_set":[255, 255, 0, 255],
57 "visibility_set":[true],
58 "part_text_set":[null, "button2"],
59 "size_set":[100, 30],
60 "position_set":[10, 40]
61 }
62 }
63 }
64@!egui */
65 but3 = eo_add(ELM_OBJ_BUTTON_CLASS, win2);
66 eo_unref(but3);
67 eo_do(but3, evas_obj_color_set(255, 255, 0, 255));
68 eo_do(but3, evas_obj_visibility_set(EINA_TRUE));
69 eo_do(but3, elm_wdg_part_text_set(NULL, "button2"));
70 eo_do(but3, evas_obj_size_set(100, 30));
71 eo_do(but3, evas_obj_position_set(10, 40));
72
73 pub_widgets->win2 = win2;
29} 74}
30 75
31static Eina_Bool 76static Eina_Bool
32_mouse_up(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc, void *event_info) 77_create_win3(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
33{ 78{
34 eo_do(obj, eo_event_callback_del(EVAS_EVENT_MOUSE_MOVE, _mouse_move, NULL)); 79 Eo *win3;
35 return EO_CALLBACK_CONTINUE; 80 Eo *but4;
36}
37 81
38static void 82/* @egui
39_main_win_del_cb(void *data, Evas_Object *obj, void *event)
40{ 83{
41 printf("win del\n"); 84 "win3":
42 elm_exit(); 85 {
43} 86 "Desc":
44 87 {
45static void 88 "parent":null,
46_bt_clicked(void *data, Evas_Object *obj, void *event) 89 "class":"elm_win",
90 "public":true,
91 "auto_create":false
92 },
93 "Properties":
94 {
95 "constructor":["elm_obj_win_constructor"],
96 "elm_obj_win_constructor":[null, "ELM_WIN_BASIC"],
97 "title_set":["window3"],
98 "autodel_set":[true],
99 "size_set":[50, 50],
100 "visibility_set":[true]
101 }
102 }
103 }
104@!egui */
105 win3 = eo_add_custom(ELM_OBJ_WIN_CLASS, NULL, elm_obj_win_constructor(NULL, ELM_WIN_BASIC));
106 eo_unref(win3);
107 eo_do(win3, elm_obj_win_title_set("window3"));
108 eo_do(win3, elm_obj_win_autodel_set(EINA_TRUE));
109 eo_do(win3, evas_obj_size_set(50, 50));
110 eo_do(win3, evas_obj_visibility_set(EINA_TRUE));
111/* @egui
47{ 112{
48 Eo *w = data; 113 "but4":
49 Eina_Bool v; 114 {
50 printf("clicked\n"); 115 "Desc":
51 eo_do(w, evas_obj_visibility_get(&v)); 116 {
52 eo_do(w, evas_obj_visibility_set(!v)); 117 "parent":"win3",
118 "class":"elm_button"
119 },
120 "Properties":
121 {
122 "color_set":[255, 255, 0, 255],
123 "visibility_set":[true],
124 "part_text_set":[null, "button4"],
125 "size_set":[30, 30],
126 "position_set":[10, 10]
127 }
128 }
129 }
130@!egui */
131 but4 = eo_add(ELM_OBJ_BUTTON_CLASS, win3);
132 eo_unref(but4);
133 eo_do(but4, evas_obj_color_set(255, 255, 0, 255));
134 eo_do(but4, evas_obj_visibility_set(EINA_TRUE));
135 eo_do(but4, elm_wdg_part_text_set(NULL, "button4"));
136 eo_do(but4, evas_obj_size_set(30, 30));
137 eo_do(but4, evas_obj_position_set(10, 10));
138
139 pub_widgets->win3 = win3;
53} 140}
54 141
55Eina_Bool 142extern Eina_Bool
56_bt_clicked2(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) 143_bt_clicked(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
144
145static Eina_Bool
146hide(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
57{ 147{
58 printf("clicked\n"); 148 eo_do(data, evas_obj_visibility_set(EINA_FALSE));
59 return EO_CALLBACK_CONTINUE; 149 return EO_CALLBACK_CONTINUE;
60} 150}
61 151
62EAPI_MAIN int 152GUI* get_gui()
63elm_main(int argc, char **argv)
64{ 153{
65 Eo *but1, *but2; 154 Eo *bg;
66 Eo *win, *win2, *bg; 155 Eo *but1;
67 156 Eo *but2;
68 157 Eo *bubble;
69 /** 158 Eo *label;
70 * @egui
71 * {
72 * "win": {
73 * "Desc" : {
74 * "class" : "elm_win",
75 * "main" : true,
76 * "public" : true
77 * },
78 * "Properties" : {
79 * "constructor" : ["elm_obj_win_constructor"],
80 * "elm_obj_win_constructor" : [null, "ELM_WIN_BASIC"],
81 * "title_set" : ["window!!!"],
82 * "autodel_set" : [true],
83 * "size_set" : [320, 320],
84 * "resize_object_add" : ["bg"],
85 * "visibility_set" : [true]
86 * }
87 * }
88 * }
89 * @!egui
90 */
91 win = eo_add_custom(ELM_OBJ_WIN_CLASS, NULL, elm_obj_win_constructor("window", ELM_WIN_BASIC));
92 eo_do(win, evas_obj_size_set(320, 320));
93 eo_do(win, evas_obj_visibility_set(EINA_TRUE));
94 eo_do(win, elm_obj_win_title_set("window!!!"));
95 eo_do(win, elm_obj_win_autodel_set(EINA_TRUE));
96
97 //elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
98 evas_object_smart_callback_add(win, "delete,request", _main_win_del_cb, NULL);
99
100 win2 = eo_add_custom(ELM_OBJ_WIN_CLASS, win, elm_obj_win_constructor("window", ELM_WIN_BASIC));
101 eo_do(win2, evas_obj_size_set(120, 120));
102 eo_do(win2, evas_obj_visibility_set(EINA_TRUE));
103 eo_do(win2, elm_obj_win_title_set("window2"));
104 eo_do(win2, elm_obj_win_autodel_set(EINA_TRUE));
105
106 //elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
107 evas_object_smart_callback_add(win, "delete,request", _main_win_del_cb, NULL);
108
109
110 /**
111 * @egui
112 * {
113 * "bg" : {
114 * "Desc" : {
115 * "class" : "elm_bg",
116 * "parent" : "win",
117 * "public" : true
118 * },
119 * "Properties" : {
120 * "bg_color_set" : [255,255,200],
121 * "size_hint_weight_set" : [1.0, 1.0],
122 * "visibility_set" : [true]
123 * }
124 * }
125 * }
126 * @!egui
127 */
128
129 bg = eo_add(ELM_OBJ_BG_CLASS, win);
130 eo_do(bg,
131 elm_obj_bg_color_set(255, 255, 200),
132 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
133 evas_obj_visibility_set(EINA_TRUE));
134 eo_do(win, elm_obj_win_resize_object_add(bg));
135 eo_do(bg, eo_event_callback_add(EVAS_EVENT_MOUSE_DOWN, _mouse_down, NULL));
136 eo_do(bg, eo_event_callback_add(EVAS_EVENT_MOUSE_UP, _mouse_up, NULL));
137
138 /**
139 * @egui
140 * {
141 * "but1" : {
142 * "Desc" : {
143 * "class" : "elm_button",
144 * "parent" : "win"
145 * },
146 * "Properties" : {
147 * "color_set" : [10, 255,0, 255],
148 * "visibility_set" : [true],
149 * "part_text_set" : [null, "button1"],
150 * "size_set" : [100, 50],
151 * "position_set" : [40, 20]
152 * },
153 * "Callbacks" : {
154 * "cb" : {"type" : "GUI_CB_USER",
155 * "params" : ["clicked", "_bt_clicked", null]
156 * },
157 *
158 "cb" : {"type" : "GUI_CB_CREATE",
159 * "params" : ["clicked", "_create_cb", "win2"]
160 * }
161 * }
162 * }
163 * }
164 * @!egui
165 */
166
167 but1 = eo_add(ELM_OBJ_BUTTON_CLASS, win);
168 eo_do(but1, evas_obj_color_set(0, 250, 0, 255));
169 eo_do(but1, evas_obj_position_set(40, 20));
170 eo_do(but1, evas_obj_size_set(100, 50));
171 eo_do(but1, evas_obj_visibility_set(EINA_TRUE));
172 elm_object_text_set(but1, "button1");
173// evas_object_smart_callback_add(but1, "clicked", _bt_clicked, win2);
174 eo_do(but1, eo_event_callback_add(EVAS_SMART_CLICKED_EVENT, _bt_clicked2, NULL));
175 159
176 eo_do(but1, eo_event_callback_add(EVAS_EVENT_MOUSE_DOWN, _mouse_down, NULL)); 160/* @egui
177 eo_do(but1, eo_event_callback_add(EVAS_EVENT_MOUSE_UP, _mouse_up, NULL)); 161{
178 162 "win":
179 /** 163 {
180 * @egui 164 "Desc":
181 * { 165 {
182 * "but2" : { 166 "parent":null,
183 * "Desc" : { 167 "class":"elm_win",
184 * "class" : "elm_button", 168 "public":true,
185 * "parent" : "win", 169 "main":true
186 * "public" : true 170 },
187 * }, 171 "Properties":
188 * "Properties" : { 172 {
189 * "color_set" : [255,255, 0,255], 173 "constructor":["elm_obj_win_constructor"],
190 * "visibility_set" : [true], 174 "elm_obj_win_constructor":[null, "ELM_WIN_BASIC"],
191 * "part_text_set" : [null, "button2"], 175 "title_set":["window!!!"],
192 * "size_set" : [100, 30], 176 "autodel_set":[true],
193 * "position_set" : [50, 190] 177 "size_set":[320, 320],
194 * }, 178 "resize_object_add":["bg"],
195 * "Callbacks" : { 179 "visibility_set":[true]
196 * "cb" : {"type" : "GUI_CB_HIDE", 180 }
197 * "params" : ["Mouse Up", "hide", "bubble"] 181 }
198 * }, 182 }
199 "cb" : {"type" : "GUI_CB_CREATE", 183@!egui */
200 * "params" : ["clicked", "_create_cb", "win3"] 184 win = eo_add_custom(ELM_OBJ_WIN_CLASS, NULL, elm_obj_win_constructor(NULL, ELM_WIN_BASIC));
201 * } 185 eo_unref(win);
202 * } 186 eo_do(win, elm_obj_win_title_set("window!!!"));
203 * } 187 eo_do(win, elm_obj_win_autodel_set(EINA_TRUE));
204 * } 188 eo_do(win, evas_obj_size_set(320, 320));
205 * @!egui 189 eo_do(win, evas_obj_visibility_set(EINA_TRUE));
206 */ 190/* @egui
207 but2 = eo_add(ELM_OBJ_BUTTON_CLASS, win); 191{
208 eo_do(but2, evas_obj_color_set(255, 255, 0, 255)); 192 "bg":
209 eo_do(but2, evas_obj_position_set(50, 190)); 193 {
210 eo_do(but2, evas_obj_size_set(100, 30)); 194 "Desc":
211 eo_do(but2, evas_obj_visibility_set(EINA_TRUE)); 195 {
212 elm_object_text_set(but2, "button2"); 196 "parent":"win",
213 197 "class":"elm_bg",
214 /** 198 "public":true
215 * @egui 199 },
216 * { 200 "Properties":
217 * "bubble" : { 201 {
218 * "Desc" : { 202 "bg_color_set":[255, 255, 200, 255],
219 * "class" : "elm_bubble", 203 "size_hint_weight_set":[1, 1],
220 * "parent" : "win" 204 "visibility_set":[true]
221 * }, 205 }
222 * "Properties" : 206 }
223 * { 207 }
224 * "part_text_set" : [null, "bubble text"], 208@!egui */
225 * "part_text_set" : ["info", "INFO"], 209 bg = eo_add(ELM_OBJ_BG_CLASS, win);
226 * "size_set" : [300, 100], 210 eo_unref(bg);
227 * "position_set" : [0, 60], 211 eo_do(bg, elm_obj_bg_color_set(255, 255, 200, 255));
228 * "content_set" : [null, "label", null], 212 eo_do(bg, evas_obj_size_hint_weight_set(1.000000, 1.000000));
229 * "visibility_set" : [true] 213 eo_do(bg, evas_obj_visibility_set(EINA_TRUE));
230 * } 214 eo_do(win, elm_obj_win_resize_object_add(bg));
231 * } 215/* @egui
232 * } 216{
233 * @!egui 217 "but1":
234 */ 218 {
235 Eo *bubble; 219 "Desc":
236 bubble = eo_add(ELM_OBJ_BUBBLE_CLASS, win); 220 {
237 elm_object_part_text_set(bubble, "info", "INFO"); 221 "parent":"win",
238 elm_object_text_set(bubble, "bubble text"); 222 "class":"elm_button"
239 eo_do(bubble, evas_obj_size_set(300, 100)); 223 },
240 eo_do(bubble, evas_obj_position_set(0, 60)); 224 "Properties":
241 eo_do(bubble, evas_obj_visibility_set(EINA_TRUE)); 225 {
242 226 "color_set":[10, 255, 0, 255],
243 eo_do(bubble, eo_event_callback_add(EVAS_EVENT_MOUSE_DOWN, _mouse_down, NULL)); 227 "visibility_set":[true],
244 eo_do(bubble, eo_event_callback_add(EVAS_EVENT_MOUSE_UP, _mouse_up, NULL)); 228 "part_text_set":[null, "button1"],
245 229 "size_set":[217, 50],
246 /** 230 "position_set":[40, 20]
247 * @egui 231 },
248 * { 232 "Callbacks":
249 * "label" : { 233 {
250 * "Desc" : { 234 "cb":
251 * "class" : "elm_label", 235 {
252 * "parent" : "bubble", 236 "type":"GUI_CB_USER",
253 * "public" : true 237 "params":["clicked", "_bt_clicked", null]
254 * }, 238 },
255 * "Properties" : { 239 "cb":
256 * "visibility_set" : [true], 240 {
257 * "part_text_set" : [null, "This is the CONTENT of our bubble"], 241 "type":"GUI_CB_CREATE",
258 * "size_set" : [60, 30], 242 "params":["clicked", "_create_win2", "win2"]
259 * "position_set" : [100, 30] 243 }
260 * } 244 }
261 * } 245 }
262 * } 246 }
263 * @!egui 247@!egui */
264 */ 248 but1 = eo_add(ELM_OBJ_BUTTON_CLASS, win);
265 Eo *label; 249 eo_unref(but1);
266 label = eo_add(ELM_OBJ_LABEL_CLASS, win); 250 eo_do(but1, evas_obj_color_set(10, 255, 0, 255));
267 elm_object_text_set(label, "This is the CONTENT of our bubble"); 251 eo_do(but1, evas_obj_visibility_set(EINA_TRUE));
268 eo_do(label, evas_obj_position_set(100, 30)); 252 eo_do(but1, elm_wdg_part_text_set(NULL, "button1"));
269 eo_do(label, evas_obj_visibility_set(EINA_TRUE)); 253 eo_do(but1, evas_obj_size_set(217, 50));
270 eo_do(label, evas_obj_size_set(60,30)); 254 eo_do(but1, evas_obj_position_set(40, 20));
271 255 eo_do(but1, eo_event_callback_add(&_CLICKED_EVENT, _bt_clicked, NULL));
272 elm_object_content_set(bubble, label); 256 eo_do(but1, eo_event_callback_add(&_CLICKED_EVENT, _create_win2, NULL));
273 257/* @egui
274 258{
275 elm_run(); 259 "but2":
276 260 {
277 eo_del(bg); 261 "Desc":
278 eo_del(but1); 262 {
279 eo_del(but2); 263 "parent":"win",
280 eo_del(bubble); 264 "class":"elm_button",
281 eo_del(label); 265 "public":true
282 eo_del(win2); 266 },
283 eo_del(win); 267 "Properties":
284 268 {
285 elm_shutdown(); 269 "color_set":[255, 255, 0, 255],
286 270 "visibility_set":[true],
287 return 0; 271 "part_text_set":[null, "button2"],
272 "size_set":[100, 30],
273 "position_set":[50, 190]
274 },
275 "Callbacks":
276 {
277 "cb":
278 {
279 "type":"GUI_CB_HIDE",
280 "params":["Mouse Up", "hide", "bubble"]
281 },
282 "cb":
283 {
284 "type":"GUI_CB_CREATE",
285 "params":["clicked", "_create_win3", "win3"]
286 }
287 }
288 }
289 }
290@!egui */
291 but2 = eo_add(ELM_OBJ_BUTTON_CLASS, win);
292 eo_unref(but2);
293 eo_do(but2, evas_obj_color_set(255, 255, 0, 255));
294 eo_do(but2, evas_obj_visibility_set(EINA_TRUE));
295 eo_do(but2, elm_wdg_part_text_set(NULL, "button2"));
296 eo_do(but2, evas_obj_size_set(100, 30));
297 eo_do(but2, evas_obj_position_set(50, 190));
298 eo_do(but2, eo_event_callback_add(&_CLICKED_EVENT, _create_win3, NULL));
299/* @egui
300{
301 "bubble":
302 {
303 "Desc":
304 {
305 "parent":"win",
306 "class":"elm_bubble"
307 },
308 "Properties":
309 {
310 "part_text_set":[null, "bubble text"],
311 "part_text_set":["info", "INFO"],
312 "size_set":[300, 100],
313 "position_set":[0, 60],
314 "content_set":[null, "label", null],
315 "visibility_set":[true]
316 }
317 }
318 }
319@!egui */
320 bubble = eo_add(ELM_OBJ_BUBBLE_CLASS, win);
321 eo_unref(bubble);
322 eo_do(bubble, elm_wdg_part_text_set(NULL, "bubble text"));
323 eo_do(bubble, elm_wdg_part_text_set("info", "INFO"));
324 eo_do(bubble, evas_obj_size_set(300, 100));
325 eo_do(bubble, evas_obj_position_set(0, 60));
326 eo_do(bubble, evas_obj_visibility_set(EINA_TRUE));
327 eo_do(but2, eo_event_callback_add(&_EVAS_OBJECT_EVENT_MOUSE_UP, hide, bubble));
328/* @egui
329{
330 "label":
331 {
332 "Desc":
333 {
334 "parent":"bubble",
335 "class":"elm_label",
336 "public":true
337 },
338 "Properties":
339 {
340 "visibility_set":[true],
341 "part_text_set":[null, "This is the CONTENT of our bubble"],
342 "size_set":[60, 30],
343 "position_set":[100, 30]
344 }
345 }
346 }
347@!egui */
348 label = eo_add(ELM_OBJ_LABEL_CLASS, bubble);
349 eo_unref(label);
350 eo_do(label, evas_obj_visibility_set(EINA_TRUE));
351 eo_do(label, elm_wdg_part_text_set(NULL, "This is the CONTENT of our bubble"));
352 eo_do(label, evas_obj_size_set(60, 30));
353 eo_do(label, evas_obj_position_set(100, 30));
354 eo_do(bubble, elm_obj_container_content_set(NULL, label, NULL));
355
356 pub_widgets = (GUI *) calloc(1, sizeof(GUI));
357 pub_widgets->win = win;
358 pub_widgets->bg = bg;
359 pub_widgets->but2 = but2;
360 pub_widgets->label = label;
361 return pub_widgets;
288} 362}
289ELM_MAIN()
290
291
292 /**
293 * @egui
294 * {
295 * "win2": {
296 * "Desc" : {
297 * "class" : "elm_win",
298 * "parent" : "win",
299 * "auto_create" : false,
300 * "public" : true
301 *
302 * },
303 * "Properties" : {
304 * "constructor" : ["elm_obj_win_constructor"],
305 * "elm_obj_win_constructor" : [null, "ELM_WIN_BASIC"],
306 * "title_set" : ["window!!!"],
307 * "autodel_set" : [true],
308 * "size_set" : [120, 120],
309 * "visibility_set" : [true]
310 * }
311 * }
312 * }
313 * @!egui
314 */
315
316
317 /**
318 * @egui
319 * {
320 * "but3" : {
321 * "Desc" : {
322 * "class" : "elm_button",
323 * "parent" : "win2"
324 * },
325 * "Properties" : {
326 * "color_set" : [255,255, 0,255],
327 * "visibility_set" : [true],
328 * "part_text_set" : [null, "button2"],
329 * "size_set" : [100, 30],
330 * "position_set" : [10, 40]
331 * }
332 * }
333 * }
334 * @!egui
335 */
336
337
338 /**
339 * @egui
340 * {
341 * "win3": {
342 * "Desc" : {
343 * "class" : "elm_win",
344 * "parent" : null,
345 * "auto_create" : false,
346 * "public" : true
347 *
348 * },
349 * "Properties" : {
350 * "constructor" : ["elm_obj_win_constructor"],
351 * "elm_obj_win_constructor" : [null, "ELM_WIN_BASIC"],
352 * "title_set" : ["window3"],
353 * "autodel_set" : [true],
354 * "size_set" : [50, 50],
355 * "visibility_set" : [true]
356 * }
357 * }
358 * }
359 * @!egui
360 */
361
362 363
363 /**
364 * @egui
365 * {
366 * "but4" : {
367 * "Desc" : {
368 * "class" : "elm_button",
369 * "parent" : "win3"
370 * },
371 * "Properties" : {
372 * "color_set" : [255,255, 0,255],
373 * "visibility_set" : [true],
374 * "part_text_set" : [null, "button4"],
375 * "size_set" : [30, 30],
376 * "position_set" : [10, 10]
377 * }
378 * }
379 * }
380 * @!egui
381 */
diff --git a/examples/example.h b/examples/example.h
new file mode 100644
index 0000000..453c80b
--- /dev/null
+++ b/examples/example.h
@@ -0,0 +1,17 @@
1#ifndef _example2_h
2#define _example2_h
3#include <Eo.h>
4
5typedef struct
6{
7 Eo *win2;
8 Eo *win3;
9 Eo *win;
10 Eo *bg;
11 Eo *but2;
12 Eo *label;
13} GUI;
14
15GUI* get_gui();
16
17#endif \ No newline at end of file
diff --git a/examples/main.c b/examples/main.c
new file mode 100644
index 0000000..8809490
--- /dev/null
+++ b/examples/main.c
@@ -0,0 +1,36 @@
1//gcc -o start main.c new.c `pkg-config --cflags --libs elementary` -DELM_INTERNAL_API_ARGESFSDFEFC=1
2
3#include "example.h"
4#include <Elementary.h>
5#include <Eo.h>
6
7#include "elm_widget.h"
8#include "elm_widget_container.h"
9#include "elm_interface_scrollable.h"
10
11Eina_Bool
12_bt_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc, void *event_info)
13{
14 printf("my click \n");
15 eo_do(obj, elm_wdg_part_text_set(NULL, "Y"));
16 eo_do(obj, elm_wdg_part_text_set(NULL, "Ya"));
17 eo_do(obj, elm_wdg_part_text_set(NULL, "Yak"));
18 return EO_CALLBACK_CONTINUE;
19}
20
21
22
23
24EAPI_MAIN int
25elm_main(int arg, char **argv)
26{
27 GUI *g;
28
29 g = get_gui();
30 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
31 elm_run();
32 elm_shutdown();
33 return 0;
34}
35
36ELM_MAIN()
diff --git a/py/USAGE b/py/USAGE
new file mode 100644
index 0000000..2a9be24
--- /dev/null
+++ b/py/USAGE
@@ -0,0 +1 @@
./gui_db_gen.py -d ~/e17/efl/src/lib/evas/ -d ~/e17/elementary/ -o .
diff --git a/py/__init__.py b/py/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/py/__init__.py
diff --git a/py/cparser.py b/py/cparser.py
new file mode 100644
index 0000000..70ee2f3
--- /dev/null
+++ b/py/cparser.py
@@ -0,0 +1,720 @@
1import xml.parsers.expat
2import sys, os, re
3import subprocess
4
5from xml.etree.ElementTree import Element, SubElement, Comment, tostring
6from xml.dom import minidom
7from string import capwords
8from helper import normalize_names
9from helper import _const
10import json
11
12print "Egui_db_generation cparser found..."
13GUI_CPARSER = True
14const = _const()
15
16print_flag = False
17def verbose_print(mes):
18 if print_flag:
19 print mes
20
21class Cparser(object):
22 def __init__(self, _print_flag):
23 global print_flag
24 print_flag = _print_flag
25
26 self.typedef_enum = {}
27 self.typedefs = {}
28
29 self.cl_data = {}
30 self.cl_incl = {}
31 self.gui_events = []
32
33 self.outdir = ""
34
35 def fetch_data(self, _in_data):
36 def_list = []
37
38 reg = "EO_DEFINE_CLASS\((.*)\).*"
39 def_list += re.findall(reg, _in_data)
40
41 #event_desc structure
42 #
43 # EO_DEFINE_CLASS(elm_scrollable_interface_get, &_elm_scrollable_interface_desc, NULL, EVAS_SMART_SCROLLABLE_INTERFACE, NULL);
44 #
45
46 class_def = {}
47 class_desc = {}
48 ev_desc = {"NULL" : []}
49 #print "def list: ", def_list
50 for s in def_list:
51 s = s.replace(" ", "").replace("\n", "")
52 l_tmp = s.split(",")
53
54 key = l_tmp[0].strip(" ")
55 desc_var = l_tmp[1].strip(" &")
56 parent = l_tmp[2]
57 l_tmp = l_tmp[3:-1]
58 l_tmp = filter(lambda l: False if l == "NULL" else True, l_tmp)
59
60 class_def[key] = [desc_var, parent, l_tmp]
61
62 #event_desc structure
63 # { EV_CLICKED, EV_BUTTON_DOWN, EV_BUTTON_UP, NULL }
64 #
65 reg = "Eo_Event_Description[ ]*([\w]*)[ =]*EO_EVENT_DESCRIPTION\(([^\)]*)\)"
66 af = _in_data.replace("\n", "")
67 ev_list = re.findall(reg, af)
68 for tup in ev_list:
69 key = tup[0]
70 name = tup[1].replace(" ", "").split(",")
71 lst = tup[1].split("\"")
72 it = filter(len, lst)[0]
73 self.gui_events.append("\t{\"%s\", &%s, \"&%s\"},"%(it, key, key))
74
75 #event_desc structure
76 # { EV_CLICKED, EV_BUTTON_DOWN, EV_BUTTON_UP, NULL }
77 #
78 reg = "Eo_Event_Description[ *]*([\w]*)[][ =]*{([^}]*)};"
79 af = _in_data.replace("\n", "")
80 ev_list = re.findall(reg, af)
81
82 for tup in ev_list:
83 key = tup[0]
84 lst = tup[1].replace(" ", "").split(",")
85 if lst[-1] != "NULL":
86 print "ERROR: last event descriptor should be NULL in class %s"%(cl_id)
87 exit(1)
88 lst = filter(lambda l: False if l == "NULL" else True, lst)
89 ev_desc[key] = lst
90
91 # fetching
92 # op description
93 #
94 reg = "Eo_Op_Description[ ]*([\w]*)\[\][ =]*{([^}]*)};"
95 all_op_descs = re.findall(reg, af)
96 op_desc = {"NULL" : []}
97 for tup in all_op_descs:
98 s_tmp = tup[1]
99 # fetching op_ids and descriptions
100 reg = "EO_OP_DESCRIPTION[^\)]*\([ ]*([A-Z0-9_]*)[ ]*,[ ]*\"([^\"]*)\"[ ]*\),"
101 ids_and_descs = re.findall(reg, s_tmp)
102
103 op_list = []
104 for t in ids_and_descs:
105 op_id = t[0] #op_id
106 func_name = re.findall("SUB_ID_(.*)", op_id)
107 if (len(func_name) == 0):
108 print "Warning! Check: %s"%(t[0])
109 func_name = t[0].lower()
110 else:
111 func_name = func_name[0].lower()
112 op_list.append((op_id, func_name))
113
114 op_desc[tup[0]] = op_list
115
116 ###
117 # Class desc structure:
118 # {
119 #[0] EO_VERSION
120 #[1] "Evas_Object_Line",
121 #[2] EO_CLASS_TYPE_REGULAR,
122 #[3] EO_CLASS_DESCRIPTION_OPS(&EVAS_OBJ_LINE_BASE_ID, op_desc, EVAS_OBJ_LINE_SUB_ID_LAST),
123 #[4] NULL,
124 #[5] sizeof(Evas_Object_Line),
125 #[6] _class_constructor,
126 #[7] NULL
127 # }
128 #
129 reg = "Eo_Class_Description[ ]*([\w]*)[ =]*{([^}]*)};"
130 desc_list = re.findall(reg, af)
131
132 for tup in desc_list:
133 key = tup[0]
134 l_tmp = smart_split(tup[1])
135 ver = l_tmp[0].strip(" ")
136 name = l_tmp[1].strip(" ")
137 cl_type = l_tmp[2].strip(" ")
138
139 #splitting string into list
140 desc_ops = l_tmp[3].replace(" ", "").replace("&", "")
141 desc_ops = re.findall("\(([^)]*)\)" , desc_ops)[0].split(",")
142
143 #mapping op_desc var name into ops list
144 #if op_desc == NULL; t.e. no op_id for current class; NULL will be changed to empty list
145 desc_ops[1] = op_desc[desc_ops[1]]
146
147 ev_desc_var = l_tmp[4].strip(" ")
148
149 if -1 == name.find("\""):
150 name = name.strip(" ")
151 reg = "#define[ ]*%s[ ]*(\"[^\"]*\")"%name
152 ll = re.findall(reg, af)
153 if len(ll):
154 name = ll[0]
155
156 name = name.strip("\"")
157 class_desc[key] = [name, cl_type, desc_ops, ev_desc[ev_desc_var]]
158
159 #mapping class_desc_var_name to content
160 for key, data in class_def.iteritems():
161 class_def[key] += class_desc[data[0]]
162 class_def[key].pop(0)
163
164 return class_def
165
166 def c_file_data_get2(self, filename):
167
168 f = open(filename, 'r')
169 allfile = f.read()
170 f.close()
171 ttt = self.fetch_data(allfile)
172
173 #for each class which was found it c-file
174 for key, data in ttt.iteritems():
175
176 cl_id = key
177 lst = []
178 lst.append(data[0])
179 lst += data[1]
180 lst = filter(lambda l: False if l == "NULL" else True, lst)
181
182 if cl_id in self.cl_data:
183 verbose_print("Class %s from file %s won't be added in the tree"%(cl_id, filename))
184 verbose_print("Class %s from file %s will be used as parent in inheritance"%(cl_id, self.cl_data[cl_id][const.C_FILE]))
185 return
186
187 self.cl_data[cl_id] = {const.PARENTS:lst,
188 const.C_FILE:filename,
189 const.FUNCS:{}}
190
191 cl_name = data[2]
192 self.cl_data[cl_id][const.C_NAME] = cl_name
193
194 self.cl_data[cl_id][const.MODULE] = normalize_names([cl_name])[0].lower()
195 self.cl_data[cl_id][const.TYPE] = data[3]
196 self.cl_data[cl_id][const.EV_DESC] = data[5]
197 # self.cl_data[cl_id][const.CLASS_CONSTRUCTOR] = lst[5]
198
199 class_desc_ops = data[4]
200 self.cl_data[cl_id][const.OP_DESC] = class_desc_ops[1]
201
202 for tup in class_desc_ops[1]:
203 self.cl_data[cl_id][const.FUNCS][tup[1]] = {const.OP_ID : tup[0], const.C_MACRO: ""}
204
205 self.cl_data[cl_id][const.BASE_ID] = class_desc_ops[0]
206
207
208 # resolving parameters's types and names according to
209 # #define, @def and op_ids
210 def parse_op_func_params(self, cl_id):
211 if const.OP_DESC not in self.cl_data[cl_id]:
212 print "Not found: %s"%const.OP_DESC
213 exit()
214
215 op_desc = self.cl_data[cl_id][const.OP_DESC]
216 defines = self.cl_data[cl_id][const.DEFINES]
217 macros = self.cl_data[cl_id][const.OP_MACROS]
218 b_id = self.cl_data[cl_id][const.BASE_ID]
219 b_id_macro = ""
220 for d in defines:
221 o = re.match("#define ([\w]*)\(([^\)]*)\) \(%s[\W]*\\2[\W]*\)"%(b_id), d)
222 if o != None:
223 b_id_macro = o.group(1)
224
225 #looking for op_id in define; if found, cutting op_macro from define
226 #and checking if it is in macros list. If not - we forgot to add comment
227 #if yes - cutting types from define
228 for op, f in op_desc:
229 found = False
230 for d in defines:
231 # looking for #define elm_obj_flip_get ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_GET)
232 o = re.match("#define ([\w]*)\([^\)]*\) %s\(%s\).*"%(b_id_macro, op), d)
233 if o != None:
234 found = True
235 s_tmp = o.group(1)
236
237 if s_tmp not in macros:
238 print "Warning: no comments for \"%s\"; file: \"%s\" "%(s_tmp, self.cl_data[cl_id][const.H_FILE])
239 else:
240
241 params = []
242 params_direction = macros[s_tmp]
243 reg = "%s\(([^,]*),([^,]*)\)"%const.EO_TYPECHECK
244 ss = re.findall(reg, d)
245
246 i = 0
247 for tup in ss:
248 lst = list(tup)
249 modifier = "const" if lst[0].find("const") != -1 else ""
250 lst[0] = lst[0].replace("const", "")
251 lst[0] = " ".join(lst[0].split())
252 lst[0] = lst[0].replace(" *", "*")
253 lst[1] = lst[1].replace(" ", "")
254 if len(lst) == 2:
255 try:
256 tok = params_direction[i]
257 params.append((lst[1], modifier, lst[0], tok))
258 except IndexError:
259 print "Warning: error in description %s in %s"%(s_tmp,self.cl_data[cl_id][const.H_FILE])
260
261 else:
262 print "ERROR: check parameters in EO_TYPECHECK"
263 exit(1)
264 i += 1
265 self.cl_data[cl_id][const.FUNCS][f][const.PARAMETERS] = params
266 self.cl_data[cl_id][const.FUNCS][f][const.C_MACRO] = s_tmp
267
268 if not found:
269 print "Warning: no API for %s in %s"%(op, self.cl_data[cl_id][const.H_FILE])
270 print "Function won't be added"
271 self.cl_data[cl_id][const.FUNCS].pop(f)
272
273
274 def get_param_dir_from_comment(self, com):
275 res = re.findall("@param.*", com)
276 l_tmp = []
277 for s in res:
278 s = s.replace(" ", "")
279 ret = re.match("@param\[([inout,]*)\]", s)
280 l_tmp.append(ret.group(1) if (ret != None and ret.group(1) in ["in", "out", "in,out"]) else "in,out");
281 return l_tmp
282
283 #parsing header file
284 def h_file_data_get(self, filename):
285 f = open (filename, 'r')
286 allfile = f.read()
287 f.close()
288
289 # Fetch typedefs which can be resolved automatically
290 matcher = re.compile("typedef[^;\n]*;")
291 ss = matcher.findall(allfile)
292 for tup in ss:
293 s = tup.replace("typedef ", "").replace(";", "")
294 s = " ".join(s.split()) #removing more than one spaces
295 flag = 1;
296 for l in ["enum", "struct", "(*"]:
297 if l in s:
298 flag = 0
299 if flag is 1:
300 # I can't use split() here because of "typedef usigned int MyType"
301 p = s.rfind(" ")
302 bt = s[ : p]
303 dt = s[p + 1:]
304 #print "%s :: %s"%(bt, dt)
305 self.typedefs[dt] = bt
306
307 #fetching and resolving typedef enum
308 # Each enum is typedefed with "typedef enum name {A, B} Name". So function uses
309 # parameter with type Name.
310 #
311 # Example:
312 # enum _name {A, B} - will add record to dictionary:
313 # {'_name' : (filename, [A, B])} - this is not used for type checking, because no func
314 # uses type _name, but I need to keep it for following:
315 # typedef enum _name Name; - there is some func which uses type Name:
316 # {'Name' : (filename, [A, B])} - will be added to dict.
317 # I can't resolve to '_name', because, I'll have to use 'enum _name'
318
319 # In case of 'typedef enum _name2 {AA, BB} Name2' two records will be added:
320 #
321 # {'_name2' : (filename2, [AA, BB]), 'Name2' : (filename2, [AA, BB])} -
322 # first not used for type checking, secont - yes
323 #
324 # and
325 # 'typedef Name2 Name3' will be resolved to 'Name2'
326
327 #fetch all "#enum name {A , B};" from file
328 matcher = re.compile(r"^[ \t]*enum[ ]+([\w]+)([^;]*);",re.MULTILINE)
329 ss = matcher.findall(allfile)
330 for tup in ss:
331 td_name = tup[0]
332 s_tmp = tup[1]
333 s_tmp = s_tmp.replace("\n", "").replace("\\", "")
334 s_tmp = re.sub("/\*.*?\*/", "", s_tmp) #remove comments
335 s_tmp = " ".join(s_tmp.split())
336 td_values = s_tmp[s_tmp.find("{") + 1 : s_tmp.find("}")].strip().split(",")
337 td_values = filter(len, td_values)
338 td_list = []
339 for v in td_values:
340 v = v.strip()
341 match = re.search("[\w]*", v);
342 td_list.append(match.group(0))
343 self.typedef_enum[td_name] = (filename, td_list)
344
345 #fetch all
346 # typedef enum _name Name
347 # typedef enum {A, B} Name
348 # typedef enum _name {A, B} Name
349 matcher = re.compile(r"^[ \t]*typedef enum([^;]*);",re.MULTILINE)
350 ss = matcher.findall(allfile)
351 for tup in ss:
352 m = tup
353 s_tmp = m.replace("\n", "").replace("\\", "")
354 s_tmp = re.sub("/\*.*?\*/", "", s_tmp) #remove comments
355 s_tmp = " ".join(s_tmp.split())
356
357 pre_enum_token = post_enum_token = ""
358
359 if s_tmp.find("{") == -1:
360 l = s_tmp.split()
361 if len(l) != 2:
362 verbose_print("Smth wrong in \"typedef enum %s\" in file \"%s\""%(s_tmp, filename))
363 pre_enum_token = l[0]
364 post_enum_token = l[1]
365 self.typedef_enum[post_enum_token] = self.typedef_enum[pre_enum_token]
366 else:
367 pre_enum_token = s_tmp[: s_tmp.find("{")].strip()
368 post_enum_token = s_tmp[s_tmp.find("}") + 1 : ].strip()
369
370 td_values = s_tmp[s_tmp.find("{") + 1 : s_tmp.find("}")].strip().split(",")
371 td_values = filter(len, td_values)
372 td_list = []
373 for v in td_values:
374 v = v.strip()
375 match = re.search("[\w]*", v);
376 td_list.append(match.group(0))
377
378 if len(pre_enum_token) and pre_enum_token not in self.typedef_enum:
379 self.typedef_enum[pre_enum_token] = (filename, td_list)
380
381 self.typedef_enum[post_enum_token] = (filename, td_list)
382
383 """
384 for tup in ss:
385 s_tmp = tup[0]
386 s_tmp = s_tmp.replace("\n", "").replace("\\", "")
387 s_tmp = " ".join(s_tmp.split())
388 typedef_list.append(s_tmp)
389 """
390 #fetch all "#define" from file
391 matcher = re.compile(r"^[ \t]*(#define(.*\\\n)*.*$)",re.MULTILINE)
392 ss = matcher.findall(allfile)
393 def_list = []
394 for tup in ss:
395 s_tmp = tup[0].replace("\n", "").replace("\\", "")
396 s_tmp = " ".join(s_tmp.split())
397 def_list.append(s_tmp)
398
399 #fetch all "@def" from file
400 matcher = re.compile("(^/\*\*\n(((.(?!\*/))*\n)*).*\*/$)",re.MULTILINE)
401 all_comments_list = matcher.findall(allfile)
402 macro = {}
403 for comment in all_comments_list:
404 comment_tmp = comment[1]
405
406 #looking for @def token in comment
407 res = re.search("@def[ ]+([\w]*)", comment_tmp)
408 if res == None:
409 continue
410
411 macro_name = res.group(1)
412 #looking for parameters direction in comment
413 macro[macro_name] = self.get_param_dir_from_comment(comment_tmp)
414
415 #looking for class_get function to get class macro
416 current_class = ""
417 cl_macro = []
418 cl_id_copy = []
419
420 for k in self.cl_data:
421 pos = 0
422 get_func = ""
423
424 for d in def_list:
425 # looking for #define SOME_CLASS some_class_get()
426 reg = '#define[ ]*[\w]*[ ]*%s\(\)'%k
427 res = re.findall(reg, d)
428 if re.match(reg, d):
429 lst = d.split()
430 current_class = lst[1]
431 get_func = k
432 cl_macro.append((get_func, current_class))
433
434 if current_class in self.cl_data:
435 verbose_print("Class %s from file %s won't be added in the tree"%(current_class, filename))
436 verbose_print("Class %s from file %s will be used as parent in inheritance"%(current_class, self.cl_data[current_class][const.H_FILE]))
437 return
438
439 if current_class == "":
440 return
441
442 for gf, cl_id in cl_macro:
443 self.cl_data[cl_id] = self.cl_data[gf]
444 self.cl_data.pop(gf)
445 self.cl_data[cl_id][const.GET_FUNCTION] = gf
446 self.cl_data[cl_id][const.H_FILE] = filename
447 self.cl_data[cl_id][const.DEFINES] = def_list
448 self.cl_data[cl_id][const.OP_MACROS] = macro
449
450 #print out data from each class in parser object
451 def print_data(self):
452 for klass in self.cl_data:
453 print ""
454 print klass
455 for kk in self.cl_data[klass]:
456 print " ", kk, " : ", type(self.cl_data[klass][kk])# " : ", cp.cl_data[klass][kk]
457 d = self.cl_data[klass][kk]
458 spaces = " " * 15
459 if type(d) == str:
460 print spaces, d
461 elif type(d) == dict:
462 for key in d:
463 print spaces, key, " : ", d[key]
464 elif type(d) == list:
465 for l in d:
466 print spaces, l
467
468 def print_typedefs(self):
469 for n, (f, t) in self.typedef_enum.items():
470 print "n : %s; t: %s; f: %s"%(n, t, f)
471
472 def enum_resolver_file_create(self, _tup):
473 f = open ("typedefs.c", 'w')
474 f.write("#include <stdio.h>\n");
475 f.write("#include <Elementary.h>\n\n");
476 f.write("int main()\n");
477 f.write("{\n");
478 _enum_init_dict = _tup[3]
479
480 for enum_list in _enum_init_dict.itervalues():
481 for l in enum_list:
482 s = "printf(\"%%s,%%d:\", \"%s\", %s);"%(l, l)
483 f.write("\t" + s + "\n")
484
485 f.write("}");
486 f.close()
487
488 #subprocess.call(["gcc", "-o start", "typedefs.c", "`pkg-config --cflags --libs elementary`"])
489 #subprocess.call(["pkg-config", "--cflags", "--libs", "elementary"])
490 pr = subprocess.Popen(["pkg-config", "--cflags", "--libs", "elementary"], stdout = subprocess.PIPE)
491 out, err = pr.communicate()
492
493 gcc_lst = ["gcc", "-o", "start", "typedefs.c"]
494 gcc_lst += out.split()
495
496 subprocess.call(gcc_lst)
497 pr = subprocess.Popen(["./start"], stdout = subprocess.PIPE)
498 out, err = pr.communicate()
499 # parse output "ENUM1,0:ENUM2,1:"
500 lst = filter(len, out.split(":"))
501 os.unlink("typedefs.c")
502 os.unlink("start")
503
504 f = open ("db_dynamic_init.h", 'w')
505 f.write("#ifndef _DB_DYNAMIC_INIT_H\n")
506 f.write("#define _DB_DYNAMIC_INIT_H\n\n")
507 f.write("static Gui_Type_Desc _null[] = {{GUI_TYPE_NONE, \"\"}};\n\n")
508 f.write("static Enum_Props enum_arr[] = {\n")
509 for s in lst:
510 ab = s.split(",")
511 a = ab[0]
512 b = ab[1]
513 #print a, b
514 ss = "\t{\"%s\", {%s}},\n"%(a, b)
515 f.write(ss)
516 f.write("\t{NULL, {0}}\n")
517 f.write("};\n\n")
518
519 # generating array of enum type names and values
520 type_var_lst = []
521 for enum_type, enum_list in _enum_init_dict.items():
522 s = "\t{\"%s\", %s_enums},"%(enum_type, enum_type)
523 type_var_lst.append(s)
524 s = "\", \"".join(enum_list)
525 s = "static char *%s_enums[] = {\"%s\", NULL};"%(enum_type, s)
526 f.write("%s\n"%s)
527
528 s = "\nstatic Enum_Types enum_types[] =\n{%s\n\t{NULL, NULL}\n};\n\n"%("\n".join(type_var_lst))
529 f.write("%s"%s)
530
531 ev_desc_init_lst = _tup[4]
532 s = "\nstatic Gui_Event_Desc event_desc[] =\n{%s\n\t{NULL, NULL, NULL}\n};\n\n"%("\n".join(ev_desc_init_lst))
533 f.write("%s"%s)
534
535 op_type_init_lst = _tup[0]
536 op_desc_init_lst = _tup[1]
537 cl_desc_init_lst = _tup[2]
538
539 f.write("%s\n\n"%("\n".join(op_type_init_lst)))
540
541 s_tmp = ",\n".join(op_desc_init_lst)
542 s_tmp = "static Op_Desc _eo_op_arr[] = {\n%s,\n\t{NULL, NULL, NULL, NULL, 0, 0, \"\", _null}\n};\n"%(s_tmp)
543 f.write("%s\n"%s_tmp)
544
545 s_tmp = ",\n".join(cl_desc_init_lst)
546 s_tmp = "static Cl_Prop _cl_arr[] = {\n%s,\n\t{NULL, NULL, NULL}\n};\n"%(s_tmp)
547 f.write("%s"%s_tmp)
548
549 f.write("\n#endif\n")
550 f.close();
551
552
553 def gui_type_resolve(self, t):
554 _t = t
555 gui_types = {
556 "int" : "GUI_TYPE_SINT",
557 "short" : "GUI_TYPE_SHORT",
558 "unsigned int" : "GUI_TYPE_UINT",
559 "size_t" : "GUI_TYPE_UINT",
560 "Eina_Bool" : "GUI_TYPE_BOOL",
561 "double" : "GUI_TYPE_DOUBLE",
562 "char*" : "GUI_TYPE_STRING",
563 "char**" : "GUI_TYPE_STRING*",
564 "void*" : "GUI_TYPE_VOID",
565 "Eina_Bool*" : "GUI_TYPE_POINTER",
566 "Evas_Object*" : "GUI_TYPE_OBJECT",
567 "Evas_Map*" : "GUI_TYPE_MAP*",
568 }
569
570 ret = "GUI_TYPE_UNKNOWN"
571 keep_searching = True
572 force_quit = False
573 while keep_searching:
574 if force_quit:
575 break
576 force_quit = True
577 if t in gui_types:
578 ret = gui_types[t]
579 keep_searching = False
580 force_quit = False
581 elif t in self.typedef_enum:
582 ret = "GUI_TYPE_ENUM"
583 keep_searching = False
584 force_quit = False
585 elif t in self.typedefs:
586 t = self.typedefs[t]
587 force_quit = False
588
589 if force_quit:
590 print "595 type: \"%s\" not found"%(_t)
591 return (ret, t)
592
593 def gui_parser_data_get(self):
594 op_types_init_lst = []
595 op_desc_init_lst = []
596 cl_desc_init_lst = []
597 enum_init_dict = {}
598
599 desc_lst = []
600
601 f = open('func_names.json', 'r')
602 all_json = f.read()
603 f.close()
604 o = json.loads(all_json)
605
606 # fetch list of classes to generate in DB
607 classes = o["CLASSES"]
608 for (i, cl) in enumerate(classes):
609 classes[i] = cl.lstrip().rstrip()
610 classes = filter(len, classes)
611 classes = list(set(classes))
612
613 # fetch list of operations to generate in DB
614 operations = o["OPERATIONS"]
615 for op in operations:
616 f_tokens = filter(len, op["tokens"])
617 f_alias = op["name"].strip()
618 f_display_name = op["display_name"].strip() if "display_name" in op else ""
619 f_flags = filter(len, op["flags"]) if "flags" in op else []
620
621 for (i,l) in enumerate(f_tokens):
622 f_tokens[i] = l.strip()
623 for (i,l) in enumerate(f_flags):
624 f_flags[i] = l.strip()
625
626 desc_lst.append((f_tokens, f_alias, f_flags, f_display_name))
627
628 # iterate over each class
629 for kl_id, kl in self.cl_data.iteritems():
630 #get funcs dict for current class
631 funcs_dict = kl["funcs"]
632
633 #for each func in class
634 for cur_f in funcs_dict.itervalues():
635 cur_f_name = cur_f[const.C_MACRO]
636 add_this_func = 0
637 type_str = []
638 found_desc = _func_name_check(cur_f_name, desc_lst)
639 if found_desc is None:
640 verbose_print("func \"%s\" wont be added"%(cur_f_name))
641 continue
642
643 for (n, m, t, dr) in cur_f[const.PARAMETERS]:
644 #t1 - it is typedef enum to look for
645 (gt, t1) = self.gui_type_resolve(t)
646
647 if gt == "GUI_TYPE_UNKNOWN":
648 add_this_func = 0
649 continue
650 elif gt == "GUI_TYPE_ENUM":
651 #need to add this enum into compilation file
652 enum_init_dict[t] = self.typedef_enum[t][1]
653 type_str.append("{%s, \"%s\"}"%(gt, t))
654 type_str.append("{GUI_TYPE_NONE, \"none\"}")
655
656 arr_name = "_%s_params"%(cur_f_name)
657 op_types = "static Gui_Type_Desc %s[] = {%s};"%(arr_name, ", ".join(type_str))
658
659 if "constructor" in cur_f_name:
660 found_desc[2].append("EGUI_EO_ADD_CALL")
661 else:
662 found_desc[2].append("EGUI_EO_DO_CALL")
663 #if alias name in database is empty, leave usual name
664 name = found_desc[1] if found_desc[1] != "" else cur_f_name
665 display_name = found_desc[3] if len(found_desc[3]) else name
666 op_desc = "\t{\"%s\", \"%s\", \"%s\", &%s, %s, %s, \"%s\", %s}"%(kl[const.C_NAME], name, display_name, kl[const.BASE_ID], cur_f[const.OP_ID], " | ".join(found_desc[2]), cur_f_name, arr_name)
667
668 op_types_init_lst.append(op_types);
669 op_desc_init_lst.append(op_desc)
670
671 #for each class
672 # if no classes, put everything
673 if ((kl[const.C_NAME] in classes) or (len(classes) == 0)):
674 cl_desc = "\t{\"%s\", \"%s\", %s}"%(kl[const.C_NAME], kl_id, kl[const.GET_FUNCTION])
675 cl_desc_init_lst.append(cl_desc)
676 return (op_types_init_lst, op_desc_init_lst, cl_desc_init_lst, enum_init_dict, self.gui_events)
677
678
679 #set internal variable for outdir
680 def outdir_set(self, _d):
681 self.outdir = _d
682
683# smart_split(tmp)
684#
685# tmp - string to split
686# Splits string with delimeter ',', but doesn't split data in brackets
687#
688# Returns list of tokens
689#
690##########
691
692def smart_split(tmp):
693 bracket = 0
694 pos_start = 0
695 l = []
696 for i in range(len(tmp)):
697 if tmp[i] == ',' and bracket == 0:
698 l.append(tmp[pos_start:i])
699 pos_start = i + 1
700 elif tmp[i] == '(':
701 bracket += 1
702 elif tmp[i] == ')':
703 bracket -= 1
704 l.append(tmp[pos_start : ])
705
706 return l
707
708
709def _func_name_check(_f_name, desc_lst):
710 # desc_list is a list of tuples
711 # (["evas_obj", "...", "set"], "alias")
712 for l in desc_lst:
713 tokens_lst = l[0]
714 ret = True
715 for token in tokens_lst:
716 if token not in _f_name:
717 ret = False
718 if ret:
719 return l
720 return None
diff --git a/py/func_names.json b/py/func_names.json
new file mode 100644
index 0000000..e6f65fe
--- /dev/null
+++ b/py/func_names.json
@@ -0,0 +1,291 @@
1{
2 "OPERATIONS" :
3 [
4 {
5 "tokens" : ["evas_obj_color", "set"],
6 "name" : "color_set"
7 },
8 {
9 "tokens" : ["evas_obj_size_set"],
10 "name" : "size_set" },
11 {
12 "tokens" : ["evas_obj_position", "set"],
13 "name" : "position_set"
14 },
15 {
16 "tokens" : ["evas_obj_size_hint_weight","set"],
17 "name" : "size_hint_weight_set"
18 },
19 {
20 "tokens" : ["evas_obj_size_hint_aspect","set"],
21 "name" : "size_hint_aspect_set"
22 },
23 {
24 "tokens" : ["evas_obj_size_hint_align","set"],
25 "name" : "size_hint_align_set"
26 },
27 {
28 "tokens" : ["evas_obj_visibility_set"],
29 "name" : "visibility_set",
30 "display_name" : "Visibility"
31 },
32 {
33 "tokens" : ["elm_obj_bg_color_set"],
34 "name" : "bg_color_set"
35 },
36 {
37 "tokens" : ["elm_obj_bg_file_set"],
38 "name" : "bg_file_set"
39 },
40 {
41 "tokens" : ["elm_obj_win_title_set"],
42 "name" : "title_set"
43 },
44 {
45 "tokens" : ["elm_obj_win","autodel_set"],
46 "name" : "autodel_set"
47 },
48 {
49 "tokens" : ["elm_obj_win_constructor"],
50 "name" : ""
51 },
52 {
53 "tokens" : ["elm_obj_win_resize_object_add"],
54 "name" : "resize_object_add",
55 "flags" : ["MULTI_PROPERTY", "CHANGE_ON_ACTIVATE", "UPDATE_PARENT"]
56 },
57 {
58 "tokens" : ["elm_wdg_style_set"],
59 "name" : "style_set"
60 },
61 {
62 "tokens" : ["elm_wdg_part_text_set"],
63 "name" : "part_text_set"
64 },
65 {
66 "tokens" : ["elm_wdg_disabled_set"],
67 "name" : "disabled"
68 },
69 {
70 "tokens" : ["elm_wdg_access_info_set"],
71 "name" : "access_info_set"
72 },
73 {
74 "tokens" : ["elm_obj_container_content_set"],
75 "name" : "content_set",
76 "flags" : ["CHANGE_ON_ACTIVATE", "UPDATE_PARENT"]
77 },
78 {
79 "tokens" : ["elm_obj_box_pack_end"],
80 "name" : "pack_end",
81 "flags" : ["MULTI_PROPERTY", "CHANGE_ON_ACTIVATE", "UPDATE_PARENT"]
82 },
83 {
84 "tokens" : ["elm_scrollable_interface_bounce_allow_set"],
85 "name" : "bounce_allow"
86 },
87 {
88 "tokens" : ["elm_scrollable_interface_policy_set"],
89 "name" : "policy"
90 },
91 {
92 "tokens" : ["elm_obj_image_file_set"],
93 "name" : "image_file_set"
94 },
95 {
96 "tokens" : ["elm_obj_image_resizable_set"],
97 "name" : "image_resizable_set"
98 },
99 {
100 "tokens" : ["elm_obj_button_autorepeat_set"],
101 "name" : "autorepeat_set"
102 },
103 {
104 "tokens" : ["elm_obj_button_autorepeat_initial_timeout_set"],
105 "name" : "autorepeat_initial_timeout_set"
106 },
107 {
108 "tokens" : ["elm_obj_button_autorepeat_gap_timeout_set"],
109 "name" : "autorepeat_gap_timeout_set"
110 },
111 {
112 "tokens" : ["elm_obj_check_state_set"],
113 "name" : "check_state"
114 },
115 {
116 "tokens" : ["elm_obj_entry_single_line_set"],
117 "name" : "single_line"
118 },
119 {
120 "tokens" : ["elm_obj_entry_scrollable_set"],
121 "name" : "scrollable"
122 },
123 {
124 "tokens" : ["elm_obj_frame_autocollapse_set"],
125 "name" : "autocollapse"
126 },
127 {
128 "tokens" : ["elm_obj_box_horizontal_set"],
129 "name" : "horizontal"
130 },
131 {
132 "tokens" : ["elm_obj_box_clear"],
133 "name" : "clear"
134 },
135 {
136 "tokens" : ["elm_obj_box_align_set"],
137 "name" : "box_align"
138 },
139 {
140 "tokens" : ["elm_obj_grid_size_set"],
141 "name" : "grid_size"
142 },
143 {
144 "tokens" : ["elm_obj_grid_pack"],
145 "name" : "grid_pack"
146 },
147 {
148 "tokens" : ["elm_obj_panel_hidden_set"],
149 "name" : "panel_hidden"
150 },
151 {
152 "tokens" : ["elm_obj_panel_orient_set"],
153 "name" : "panel_orient"
154 },
155 {
156 "tokens" : ["elm_obj_panes_horizontal_set"],
157 "name" : "panes_horizontal"
158 },
159 {
160 "tokens" : ["elm_obj_fileselector_path_set"],
161 "name" : "fileselector_path"
162 },
163 {
164 "tokens" : ["elm_obj_table_pack_set"],
165 "name" : "table_pack_set"
166 },
167 {
168 "tokens" : ["elm_obj_table_pack_get"],
169 "name" : "table_pack_get"
170 },
171 {
172 "tokens" : ["elm_obj_table_pack"],
173 "name" : "table_pack"
174 },
175 {
176 "tokens" : ["elm_obj_separator_horizontal_set"],
177 "name" : "horizontal"
178 },
179 {
180 "tokens" : ["elm_obj_flip_go"],
181 "name" : "flip_go"
182 },
183 {
184 "tokens" : ["elm_obj_layout_file_set"],
185 "name" : "layout_file_set"
186 },
187 {
188 "tokens" : ["elm_obj_win_focus_highlight_enabled_set"],
189 "name" : "win_focus_highlight_enabled_set"
190 }
191 ],
192
193"CLASSES" : [
194"elm_notify",
195"Scrollable_Interface",
196"elm_image",
197"elm_hover",
198"elm_layout",
199"elm_actionslider",
200"Selectable_Interface",
201"elm_spinner",
202"elm_calendar",
203"elm_toolbar",
204"elm_progressbar",
205"elm_panel",
206"elm_access",
207"elm_mapbuf",
208"elm_entry",
209"Evas_Object_Smart_Clipped",
210"elm_flipselector",
211"elm_video",
212"elm_index",
213"Evas_Object_Box",
214"elm_ctxpopup",
215"Evas",
216"elm_radio",
217"elm_diskselector",
218"elm_colorselector",
219"elm_prefs",
220"elm_web",
221"elm_interface_scrollable",
222"Evas_Object_Line",
223"Draggable_Interface",
224"elm_dayselector",
225"Evas_Object_Image",
226"elm_fileselector_button",
227"elm_thumb",
228"elm_systray",
229"Evas_Common_Interface",
230"elm_conformant",
231"Evas_Object_Textblock",
232"elm_map",
233"Clickable_Interface",
234"elm_route",
235"elm_pan",
236"Zoomable_Interface",
237"elm_check",
238"Evas_Object",
239"elm_widget",
240"elm_segment_control",
241"elm_frame",
242"elm_glview",
243"elm_naviframe",
244"elm_flip",
245"elm_gengrid_pan",
246"elm_datetime",
247"elm_button",
248"elm_photocam_pan",
249"elm_player",
250"Evas_Object_Text",
251"elm_icon",
252"elm_genlist",
253"elm_slider",
254"elm_table",
255"elm_panes",
256"elm_fileselector",
257"Evas_Object_Grid",
258"elm_slideshow",
259"elm_multibuttonentry",
260"evas_object_textgrid",
261"Evas_Object_Table",
262"elm_fileselector_entry",
263"Evas_Object_Rectangle",
264"elm_grid",
265"Evas_Out",
266"elm_clock",
267"elm_gesture_layer",
268"elm_menu",
269"elm_hoversel",
270"elm_bubble",
271"elm_list",
272"elm_container",
273"elm_photo",
274"elm_map_pan",
275"elm_scroller",
276"Evas_Object_Polygon",
277"elm_win",
278"elm_gengrid",
279"elm_box",
280"elm_plug",
281"elm_popup",
282"elm_bg",
283"elm_inwin",
284"elm_separator",
285"Signal_Interface",
286"Evas_Object_Smart",
287"elm_genlist_pan",
288"elm_label",
289"elm_photocam"]
290}
291
diff --git a/py/gui_db_gen.py b/py/gui_db_gen.py
new file mode 100755
index 0000000..dcf9ae9
--- /dev/null
+++ b/py/gui_db_gen.py
@@ -0,0 +1,89 @@
1#!/usr/bin/env python
2
3GUI_CPARSER = False
4
5from helper import dir_files_get, abs_path_get, isC, isH, isXML
6from helper import _const
7from cparser import Cparser
8from cparser import GUI_CPARSER
9from argparse import ArgumentParser
10import sys
11
12#creating instance to handle constants
13const = _const()
14
15def verbose_true(mes):
16 print mes
17def verbose_false(mes):
18 pass
19
20def main():
21 if not GUI_CPARSER:
22 print "Wrong cparser imported:"
23 exit()
24 print "Starting generation..."
25 parser = ArgumentParser()
26 parser.add_argument("-d", "--dir", dest="directory",
27 action="append", help="Source C-files to introspect", required=True)
28
29 parser.add_argument("-o", "--outdir", dest="outdir",
30 action="store", help="Output directory", required=True)
31
32 parser.add_argument("-v", "--verbose",
33 action="store_true", dest="verbose", default=False,
34 help="Verbose output")
35
36 args = parser.parse_args()
37 verbose_print = None
38
39 if args.verbose is True:
40 verbose_print = verbose_true
41 else:
42 verbose_print = verbose_false
43
44 directories = []
45 outdir = ""
46
47 directories = abs_path_get(args.directory)
48 outdir = abs_path_get([args.outdir])[0]
49
50 files = dir_files_get(directories)
51 c_files = filter(isC, files)
52 h_files = filter(isH, files)
53
54 cp = Cparser(args.verbose)
55 cp.outdir_set(outdir)
56
57 #fetching data from c-file
58 for f in c_files:
59 # cp.c_file_data_get(f)
60 cp.c_file_data_get2(f)
61
62 #fetching data from h-file
63 for f in h_files:
64 cp.h_file_data_get(f)
65
66 #remove records, which are not class, t.e. they don't have GET_FUNCTION key
67 cl_data_tmp = dict(cp.cl_data) #deep copy of dictionary
68 for k in cl_data_tmp:
69 if const.GET_FUNCTION not in cp.cl_data[k]:
70 print "Warning: no define for class: %s. Record will be excluded from tree"%k
71 cp.cl_data.pop(k)
72 del cl_data_tmp
73
74 #mapping #defines, comments(@def) and op_ids together, to parse parameters
75 for k in cp.cl_data:
76 cp.parse_op_func_params(k)
77
78 #cp.print_data()
79
80 tup = cp.gui_parser_data_get()
81 cp.enum_resolver_file_create(tup)
82
83 del cp
84
85if __name__ == "__main__":
86
87 main()
88
89
diff --git a/py/helper.py b/py/helper.py
new file mode 100644
index 0000000..18cf703
--- /dev/null
+++ b/py/helper.py
@@ -0,0 +1,178 @@
1import os
2from string import capwords
3
4class _const:
5 class ConstError(TypeError): pass
6 def __setattr__(self,name,value):
7 if self.__dict__.has_key(name):
8# raise self.ConstError("Can't rebind const(%s)"%name)
9 print "Can't rebind const: \"%s\""%name
10 return
11 self.__dict__[name]=value
12 def __init__(self):
13 # most of constants are used as internal dict keys,
14 # but some of them are also used as tags in XML
15 # Changing this constans will only spoil the view of XML
16 self.PREFIX = "eorepo" #used as xml-tag
17
18 self.NAME = "name" #used as xml-tag
19 self.C_NAME = "c_name" #used as xml-tag
20 self.MODIFIER = "modifier" #used as xml-tag
21 self.MODULE = "module" #used as xml-tag
22 self.PARSE_VERSION = "parse_version" #used as xml-tag
23 self.NUM = "num" #used as xml-tag
24 self.VER_NUM = "1.0.1"
25 self.TYPE = "type" #used as xml-tag
26 self.CLASS_CONSTRUCTOR = "class_constructor"
27 self.BASE_ID = "base_id"
28 self.FUNCS = "funcs"
29 self.PARAMETERS = "parameters"
30 self.OP_ID = "op_id"
31
32 self.OP_DESC = "op_desccc"
33 self.EV_DESC = "ev_desccc"
34
35 self.GET_FUNCTION = "get_function"#used as xml-tag
36 self.DEFINES = "defines"
37 self.PARENT = "parent"#used as xml-tag
38 self.PARENTS = "parents"
39 self.H_FILE = "h_file"
40 self.C_FILE = "c_file"
41 self.XML_FILE = "xml_file"
42 self.MACRO = "macro" #EO_CLASS #used as xml-tag
43 self.C_MACRO = "c_macro"#used as xml-tag
44 self.OP_MACROS = "op_macros" #dict of macros from @def with parameters
45
46 self.CLASS_TYPE_MIXIN = "EO_CLASS_TYPE_MIXIN"
47 self.CLASS_TYPE_REGULAR = "EO_CLASS_TYPE_REGULAR"
48 self.CLASS_DESC_OPS = "EO_CLASS_DESCRIPTION_OPS"
49 self.EO_DEFINE_CLASS = "EO_DEFINE_CLASS"
50 self.EO_DEFINE_CLASS_STATIC = "EO_DEFINE_CLASS_STATIC"
51 self.EO_OP_DESCRIPTION = "EO_OP_DESCRIPTION"
52 self.EO_OP_DESCRIPTION_SENTINEL = "EO_OP_DESCRIPTION_SENTINEL"
53 self.SUB_ID = "SUB_ID_"
54 self.EO_TYPECHECK = "EO_TYPECHECK"
55
56 self.SET_ONLY = 0
57 self.GET_ONLY = 1
58 self.SET_GET = 2
59 self.METHOD = "method" #used as type id for property; and as xml tag
60
61 self.EXTENSIONS = "extensions" #used as xml-tag
62 self.INSTANTIATEABLE = "instantiateable" #used as xml-tag
63 self.CLASS = "class" #used as xml-tag
64 self.INCLUDE = "include" #used as xml-tag
65 self.TYPENAME = "typename" #used as xml-tag
66 self.EXTERN_FUNCTION = "extern_function" #used as xml-tag
67 self.EVENT = "event" #used as xml-tag
68 self.EVENTS = "events" #used as xml-tag
69 self.METHODS = "methods" #used as xml-tag
70 self.XML_SUB_ID = "sub_id" #used as xml-tag
71 self.PARAMETER = "parameter" #used as xml-tag
72 self.C_TYPENAME = "c_typename" #used as xml-tag
73 self.PRIMARY_TYPE = "primary_type" #used as xml-tag
74 self.DIRECTION = "direction" #used as xml-tag
75
76
77def isC(_path):
78 #FIXME when parsing eobase we can catch "eo.c" with EO_DEFINE_CLASS
79 (d, f) = os.path.split(_path)
80 f_name = f.split('.')
81 if len(f_name) == 2:
82 return True if f_name[1] in ["c", "cc", "cpp"] else False
83 else:
84 return False
85
86def isH(_path):
87 (d, f) = os.path.split(_path)
88 f_name = f.split('.')
89 if len(f_name) == 2:
90 return True if f_name[1] in ["h"] else False
91 else:
92 return False
93
94def isXML(_path):
95 (d, f) = os.path.split(_path)
96 f_name = f.split('.')
97 if len(f_name) == 2:
98 return True if f_name[1] in ["xml"] else False
99 else:
100 return False
101
102# dir_files_get(_directories, func, recursive)
103#
104# _directories - input list of dirs,
105# recursive - recursive lookup or not
106#
107# Recursively(if True) walks through directories.
108# Builds abs path for files.
109#
110# Returns list of absolute paths
111
112def dir_files_get(_directories, recursive = True):
113 res = []
114 if recursive:
115 for d in _directories:
116 for root, dirs, files in os.walk(d):
117 tmp = []
118 for f in files:
119 tmp.append(os.path.join(root,f))
120 res += tmp
121 else:
122 for d in _directories:
123 tmp = []
124 for f in os.listdir(d):
125 tmp.append(os.path.join(d, f))
126 res += tmp
127
128 res = list(set(res))
129 return res
130
131
132# abs_path_get(_paths)
133#
134# _paths - list of dirs or files
135# _warning - boolean; exit if path doesn't exist
136#
137# Builds abs path and checks if it exists for each path in list.
138#
139# Returns list of abs paths
140#
141def abs_path_get(_paths, _warning = True):
142 if type(_paths) == list:
143 res = []
144 lst = list(set(_paths)) #remove multiple items from list
145 for d in lst:
146 path_tmp = d
147 path_tmp = os.path.expanduser(path_tmp)
148 path_tmp = os.path.abspath(path_tmp)
149 if os.path.exists(path_tmp):
150 res.append(path_tmp)
151 else:
152 if _warning:
153 print "ERROR: path %s doesn't exist... Aborting..."%path_tmp
154 exit(1)
155 else:
156 print "Warning: path %s doesn't exist..."%path_tmp
157 return res
158
159
160# normalize_names(_lst)
161#
162# _lst - list of class names
163#
164# Normalizes class names like following:
165# Some_class name --> SomeClassName
166#
167# Returns list of normalized names
168#
169def normalize_names(_lst):
170 res = []
171 for l in _lst:
172 l = l.replace("-"," ")
173 l = l.replace("_"," ")
174 l = capwords(l)
175 l = "".join(l.split())
176 res.append(l)
177 return res
178
diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt
index 251c588..20fdc79 100644
--- a/src/bin/CMakeLists.txt
+++ b/src/bin/CMakeLists.txt
@@ -1,9 +1,11 @@
1set(CMAKE_BUILD_TYPE Debug)
2
1include_directories (${CMAKE_SOURCE_DIR}/src/lib) 3include_directories (${CMAKE_SOURCE_DIR}/src/lib)
2 4
3link_directories (${CMAKE_SOURCE_DIR}/src/lib) 5link_directories (${CMAKE_SOURCE_DIR}/src/lib)
4link_directories (${PC_LIBELEMENTARY_LIBRARY_DIRS}) 6link_directories (${PC_LIBELEMENTARY_LIBRARY_DIRS})
5 7
6add_executable(egui main.c egui_layout.c egui_logic.c objtree.c propview.c editor.c) 8add_executable(egui main.c egui_layout.c egui_logic.c props_helper.c objtree.c propview.c seqview.c editor.c)
7 9
8add_definitions(${EGUI_COMMON_DEFINITIONS}) 10add_definitions(${EGUI_COMMON_DEFINITIONS})
9 11
diff --git a/src/bin/editor.c b/src/bin/editor.c
index 2bb0de6..b1eaa99 100644
--- a/src/bin/editor.c
+++ b/src/bin/editor.c
@@ -3,8 +3,10 @@
3#include "ffi_glue.h" 3#include "ffi_glue.h"
4#include "ffi_abstraction.h" 4#include "ffi_abstraction.h"
5#include "gui_widget.h" 5#include "gui_widget.h"
6#include "props_helper.h"
6#include "objtree.h" 7#include "objtree.h"
7#include "propview.h" 8#include "propview.h"
9#include "seqview.h"
8#include "editor.h" 10#include "editor.h"
9#include "egui_logic.h" 11#include "egui_logic.h"
10 12
@@ -12,6 +14,10 @@
12 14
13#define SELECTED_WDG "slctd_wdg" 15#define SELECTED_WDG "slctd_wdg"
14 16
17static void _prop_update_from_propview(void *data, Eo *obj, void *ev);
18static void _prop_del_from_propview(void *data, Eo *obj, void *ev);
19static void _widget_selected_from_objtree(void *data, Evas_Object *obj, void *event_info);
20
15int 21int
16which_border(Evas_Coord x, Evas_Coord y, Evas_Coord ow, Evas_Coord oh) 22which_border(Evas_Coord x, Evas_Coord y, Evas_Coord ow, Evas_Coord oh)
17{ 23{
@@ -117,7 +123,7 @@ void *event_info)
117} 123}
118 124
119static void 125static void
120_mouse_move_ui(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *fr, void *event_info) 126_frame_mouse_move(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *fr, void *event_info)
121{ 127{
122 Evas_Coord x, y, ox, oy, ow, oh, dx, dy; 128 Evas_Coord x, y, ox, oy, ow, oh, dx, dy;
123 Evas_Event_Mouse_Move *ev = event_info; 129 Evas_Event_Mouse_Move *ev = event_info;
@@ -170,7 +176,7 @@ _mouse_move_ui(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *fr, voi
170 eo_do(fr, eo_base_data_get("winwdg", (void**)(&wdg))); 176 eo_do(fr, eo_base_data_get("winwdg", (void**)(&wdg)));
171 177
172 manager_init(); 178 manager_init();
173 prop = wdg_prop_get(wdg, "size_set"); 179 prop = wdg_prop_get(wdg, SIZE_SET);
174 if (prop) 180 if (prop)
175 { 181 {
176 val = prop_value_nth_get(prop, 0); 182 val = prop_value_nth_get(prop, 0);
@@ -184,7 +190,7 @@ _mouse_move_ui(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *fr, voi
184 190
185 /* FIXME: Move frame here, because we don't know if win must have position property*/ 191 /* FIXME: Move frame here, because we don't know if win must have position property*/
186 eo_do(fr, evas_obj_position_set(ox, oy)); 192 eo_do(fr, evas_obj_position_set(ox, oy));
187 prop = wdg_prop_get(wdg, "position_set"); 193 prop = wdg_prop_get(wdg, POSITION_SET);
188 if (prop) 194 if (prop)
189 { 195 {
190 val = prop_value_nth_get(prop, 0); 196 val = prop_value_nth_get(prop, 0);
@@ -271,7 +277,8 @@ _mouse_out(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *
271void 277void
272editor_wdg_selected_set(const Gui_Widget *wdg) 278editor_wdg_selected_set(const Gui_Widget *wdg)
273{ 279{
274 gui_context_data_set(active_context_get(), SELECTED_WDG, (Gui_Widget *) wdg); 280 if (wdg) gui_context_data_set(wdg_context_get(wdg), SELECTED_WDG, (Gui_Widget *) wdg);
281 else gui_context_data_set(active_context_get(), SELECTED_WDG, NULL);
275 282
276 if (!wdg) return; 283 if (!wdg) return;
277 Eo *obj = wdg_eo_get(wdg); 284 Eo *obj = wdg_eo_get(wdg);
@@ -355,7 +362,7 @@ _mouse_up(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA
355} 362}
356 363
357static void 364static void
358_mouse_down_ui(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 365_frame_mouse_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
359{ 366{
360 Gui_Widget *wdg; 367 Gui_Widget *wdg;
361 eo_do(obj, evas_obj_raise()); 368 eo_do(obj, evas_obj_raise());
@@ -367,13 +374,13 @@ _mouse_down_ui(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, vo
367 editor_wdg_selected_set(wdg); 374 editor_wdg_selected_set(wdg);
368 objtree_item_selected_set(wdg); 375 objtree_item_selected_set(wdg);
369 376
370 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_ui, NULL); 377 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_MOVE, _frame_mouse_move, NULL);
371} 378}
372 379
373static Eina_Bool 380static Eina_Bool
374_mouse_up_ui(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) 381_frame_mouse_up(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
375{ 382{
376 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_ui); 383 evas_object_event_callback_del(obj, EVAS_CALLBACK_MOUSE_MOVE, _frame_mouse_move);
377 return EO_CALLBACK_CONTINUE; 384 return EO_CALLBACK_CONTINUE;
378} 385}
379 386
@@ -383,17 +390,13 @@ _iter_widget(Gui_Widget *wdg, const Eo *parent_win)
383{ 390{
384 Eina_List *children = NULL, *l; 391 Eina_List *children = NULL, *l;
385 Gui_Widget *w; 392 Gui_Widget *w;
386 static Evas_Coord ox = 0, oy = 0;
387 if (ox < 50)
388 ox = oy = 50;
389 393
390 if (wdg_state_get(wdg) < STATE_VALIDATED) 394 if (wdg_state_get(wdg) < STATE_VALIDATED)
391 { 395 {
392 ERR("Widget: \"%s\" was not validated, so can't be simulated.", wdg_name_get(wdg)); 396 ERR("Widget: \"%s\" was not validated, so can't be simulated.", wdg_name_get(wdg));
393 return; 397 return;
394 } 398 }
395 /* Windows are iterated separately, so if m_win == NULL, t.e. its parent is NULL 399 /* Windows are iterated separately. If parent is NULL, means that current object is not win.
396 * so current object is not win.
397 * If iterated object is win, I create it as inlined_image and add frame to simulate win.*/ 400 * If iterated object is win, I create it as inlined_image and add frame to simulate win.*/
398 Eina_Bool created; 401 Eina_Bool created;
399 created = manager_wdg_eo_add_call(wdg, MODE_EDITOR, (void *)parent_win); 402 created = manager_wdg_eo_add_call(wdg, MODE_EDITOR, (void *)parent_win);
@@ -406,14 +409,8 @@ _iter_widget(Gui_Widget *wdg, const Eo *parent_win)
406 children = wdg_children_list_get(wdg); 409 children = wdg_children_list_get(wdg);
407 EINA_LIST_FOREACH(children, l, w) 410 EINA_LIST_FOREACH(children, l, w)
408 { 411 {
409 /* if iterable widget is window, its parent can be only another window. 412 /* Window can not have child windows, so pass NULL. */
410 * So take parent's eo. */ 413 _iter_widget(w, NULL);
411 Eo *pw = NULL;
412 if (IS_WIN(w))
413 {
414 pw = wdg_eo_get(wdg_parent_get(w));
415 }
416 _iter_widget(w, pw);
417 } 414 }
418 } 415 }
419} 416}
@@ -425,6 +422,7 @@ _win_resize(void *data EINA_UNUSED, Eo *o, const Eo_Event_Description *desc EINA
425 Eo *fr = NULL; 422 Eo *fr = NULL;
426 eo_do(o, evas_obj_size_get(&ow, &oh)); 423 eo_do(o, evas_obj_size_get(&ow, &oh));
427 Eo *inwin_img = elm_win_inlined_image_object_get(o); 424 Eo *inwin_img = elm_win_inlined_image_object_get(o);
425 /* FIXME: comment it? */
428 evas_object_resize(inwin_img, ow, oh); 426 evas_object_resize(inwin_img, ow, oh);
429 eo_do(o, eo_base_data_get("frame", (void **) &fr)); 427 eo_do(o, eo_base_data_get("frame", (void **) &fr));
430 evas_object_resize(fr, ow, oh); 428 evas_object_resize(fr, ow, oh);
@@ -437,9 +435,9 @@ _editor_eo_do(const Gui_Widget *wdg, void *_prop, void *data EINA_UNUSED)
437 Eina_Bool ret; 435 Eina_Bool ret;
438 ret = _ffi_eo_do(wdg, _prop); 436 ret = _ffi_eo_do(wdg, _prop);
439 437
440 if (IS_WIN(wdg) && !strcmp(prop_name_get(_prop), "title_set")) 438 if (IS_WIN(wdg) && !strcmp(prop_name_get(_prop), TITLE_SET))
441 { 439 {
442 char *title = WDG_NTH_VALUE_STRING_GET(wdg, "title_set", 0); 440 char *title = WDG_NTH_VALUE_STRING_GET(wdg, TITLE_SET, 0);
443 Eo *fr = NULL, *o = wdg_eo_get(wdg); 441 Eo *fr = NULL, *o = wdg_eo_get(wdg);
444 eo_do(o, eo_base_data_get("frame", (void **) &fr)); 442 eo_do(o, eo_base_data_get("frame", (void **) &fr));
445 elm_object_text_set(fr, title); 443 elm_object_text_set(fr, title);
@@ -522,8 +520,8 @@ _widget_add(const Gui_Widget *wdg, void *data)
522 evas_obj_visibility_set(EINA_TRUE), 520 evas_obj_visibility_set(EINA_TRUE),
523 elm_obj_frame_autocollapse_set(EINA_TRUE)); 521 elm_obj_frame_autocollapse_set(EINA_TRUE));
524 522
525 evas_object_event_callback_add(fr, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_ui, NULL); 523 evas_object_event_callback_add(fr, EVAS_CALLBACK_MOUSE_DOWN, _frame_mouse_down, NULL);
526 eo_do(fr, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_UP, _mouse_up_ui, NULL)); 524 eo_do(fr, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_UP, _frame_mouse_up, NULL));
527 eo_do(fr, eo_base_data_set("winwdg", wdg, NULL)); 525 eo_do(fr, eo_base_data_set("winwdg", wdg, NULL));
528 elm_object_content_set(fr, io); 526 elm_object_content_set(fr, io);
529 527
@@ -547,6 +545,13 @@ editor_init()
547 funcs->wdg_add = _widget_add; 545 funcs->wdg_add = _widget_add;
548 funcs->wdg_del = _widget_del; 546 funcs->wdg_del = _widget_del;
549 funcs->prop_add = _editor_eo_do; 547 funcs->prop_add = _editor_eo_do;
548
549 PropViewCbs *prop_cbs = propview_cbs_get();
550 prop_cbs->property_update_cb_func = _prop_update_from_propview;
551 prop_cbs->property_delete_cb_func = _prop_del_from_propview;
552
553 ObjTreeViewCbs *objtree_cbs = objtree_cbs_get();
554 objtree_cbs->item_selection_cb_func = _widget_selected_from_objtree;
550} 555}
551 556
552Eina_Bool 557Eina_Bool
@@ -563,14 +568,18 @@ editor_ctx_call(const Gui_Context *ctx)
563 EINA_LIST_FOREACH(list, l, wdg) 568 EINA_LIST_FOREACH(list, l, wdg)
564 { 569 {
565 /* if window has parent widget, it will be iterated as child*/ 570 /* if window has parent widget, it will be iterated as child*/
566 if (wdg_parent_get(wdg)) continue; 571 if (wdg_parent_get(wdg))
572 {
573 ERR("Window: \"%s\" has parent. It should not happen. We have bug!", wdg_name_get(wdg));
574 continue;
575 }
567 576
568 /* if there is no parent window for widget, 577 /* All windows should be shown in main gui window. */
569 * it means it will be shown in main gui window. */
570 _iter_widget(wdg, canvas_get()); 578 _iter_widget(wdg, canvas_get());
571 } 579 }
572 /* Set context for objtree. */ 580 /* Set context for objtree. */
573 objtree_context_set(ctx); 581 objtree_context_set(ctx);
582 seqview_fill(ctx);
574 manager_shutdown(); 583 manager_shutdown();
575 return EINA_TRUE; 584 return EINA_TRUE;
576} 585}
@@ -617,10 +626,10 @@ editor_factory_wdg_create(const char *class_name)
617 return; 626 return;
618 } 627 }
619 628
620 if ((!focused_wdg) && (strcmp(class_name, DB_DEF_WIN_CLASS))) return; 629 /*If adding non window widget*/
621 630 if (strcmp(class_name, DB_DEF_WIN_CLASS))
622 if (focused_wdg)
623 { 631 {
632 if (!focused_wdg) return;
624 parent_win = wdg_parent_win_wdg_get(focused_wdg); 633 parent_win = wdg_parent_win_wdg_get(focused_wdg);
625 parent_name = wdg_name_get(parent_win); 634 parent_name = wdg_name_get(parent_win);
626 } 635 }
@@ -637,7 +646,7 @@ editor_factory_wdg_create(const char *class_name)
637 Gui_Widget_Property *prop; 646 Gui_Widget_Property *prop;
638 Gui_Value *val; 647 Gui_Value *val;
639 Eina_Bool b = EINA_TRUE; 648 Eina_Bool b = EINA_TRUE;
640 prop = prop_new("visibility_set"); 649 prop = prop_new(VISIBILITY_SET);
641 val = gui_value_new(); 650 val = gui_value_new();
642 gui_value_set(val, GUI_TYPE_BOOL, &b); 651 gui_value_set(val, GUI_TYPE_BOOL, &b);
643 prop_value_append(prop, val); 652 prop_value_append(prop, val);
@@ -645,13 +654,21 @@ editor_factory_wdg_create(const char *class_name)
645 654
646 if (IS_WIN(wdg)) 655 if (IS_WIN(wdg))
647 { 656 {
648 prop = prop_new("constructor"); 657 /* By default, the window is created in the first action */
658 Gui_Sequence *seq = sequence_get(ctx, "BigBang");
659 /* Generate BigBand action if does not exist */
660 if (!seq) seq = sequence_new(ctx, "BigBang");
661 Gui_Action *action = action_new(seq);
662 action_creation_set(action, wdg_name_get(wdg));
663 seqview_fill(ctx);
664
665 prop = prop_new(CONSTRUCTOR);
649 val = gui_value_new(); 666 val = gui_value_new();
650 gui_value_set(val, GUI_TYPE_STRING, "elm_obj_win_constructor"); 667 gui_value_set(val, GUI_TYPE_STRING, ELM_OBJ_WIN_CONSTRUCTOR);
651 prop_value_append(prop, val); 668 prop_value_append(prop, val);
652 wdg_prop_add(wdg, prop); 669 wdg_prop_add(wdg, prop);
653 670
654 prop = prop_new("elm_obj_win_constructor"); 671 prop = prop_new(ELM_OBJ_WIN_CONSTRUCTOR);
655 val = gui_value_new(); 672 val = gui_value_new();
656 gui_value_set(val, GUI_TYPE_NULL, NULL); 673 gui_value_set(val, GUI_TYPE_NULL, NULL);
657 prop_value_append(prop, val); 674 prop_value_append(prop, val);
@@ -661,7 +678,7 @@ editor_factory_wdg_create(const char *class_name)
661 wdg_prop_add(wdg, prop); 678 wdg_prop_add(wdg, prop);
662 679
663 int i = 200; 680 int i = 200;
664 prop = prop_new("size_set"); 681 prop = prop_new(SIZE_SET);
665 val = gui_value_new(); 682 val = gui_value_new();
666 gui_value_set(val, GUI_TYPE_SINT, &i); 683 gui_value_set(val, GUI_TYPE_SINT, &i);
667 prop_value_append(prop, val); 684 prop_value_append(prop, val);
@@ -670,7 +687,7 @@ editor_factory_wdg_create(const char *class_name)
670 prop_value_append(prop, val); 687 prop_value_append(prop, val);
671 wdg_prop_add(wdg, prop); 688 wdg_prop_add(wdg, prop);
672 689
673 prop = prop_new("title_set"); 690 prop = prop_new(TITLE_SET);
674 val = gui_value_new(); 691 val = gui_value_new();
675 gui_value_set(val, GUI_TYPE_STRING, wdg_name_get(wdg)); 692 gui_value_set(val, GUI_TYPE_STRING, wdg_name_get(wdg));
676 prop_value_append(prop, val); 693 prop_value_append(prop, val);
@@ -678,7 +695,7 @@ editor_factory_wdg_create(const char *class_name)
678 } 695 }
679 else 696 else
680 { 697 {
681 prop = prop_new("part_text_set"); 698 prop = prop_new(PART_TEXT_SET);
682 val = gui_value_new(); 699 val = gui_value_new();
683 gui_value_set(val, GUI_TYPE_NULL, NULL); 700 gui_value_set(val, GUI_TYPE_NULL, NULL);
684 prop_value_append(prop, val); 701 prop_value_append(prop, val);
@@ -688,7 +705,7 @@ editor_factory_wdg_create(const char *class_name)
688 wdg_prop_add(wdg, prop); 705 wdg_prop_add(wdg, prop);
689 706
690 int i = 255; 707 int i = 255;
691 prop = prop_new("color_set"); 708 prop = prop_new(COLOR_SET);
692 val = gui_value_new(); 709 val = gui_value_new();
693 gui_value_set(val, GUI_TYPE_SINT, &i); 710 gui_value_set(val, GUI_TYPE_SINT, &i);
694 prop_value_append(prop, val); 711 prop_value_append(prop, val);
@@ -704,7 +721,7 @@ editor_factory_wdg_create(const char *class_name)
704 wdg_prop_add(wdg, prop); 721 wdg_prop_add(wdg, prop);
705 722
706 i = 0; 723 i = 0;
707 prop = prop_new("position_set"); 724 prop = prop_new(POSITION_SET);
708 val = gui_value_new(); 725 val = gui_value_new();
709 gui_value_set(val, GUI_TYPE_SINT, &i); 726 gui_value_set(val, GUI_TYPE_SINT, &i);
710 prop_value_append(prop, val); 727 prop_value_append(prop, val);
@@ -714,7 +731,7 @@ editor_factory_wdg_create(const char *class_name)
714 wdg_prop_add(wdg, prop); 731 wdg_prop_add(wdg, prop);
715 732
716 double d = 1; 733 double d = 1;
717 prop = prop_new("size_hint_weight_set"); 734 prop = prop_new(SIZE_HINT_WEIGHT_SET);
718 val = gui_value_new(); 735 val = gui_value_new();
719 gui_value_set(val, GUI_TYPE_DOUBLE, &d); 736 gui_value_set(val, GUI_TYPE_DOUBLE, &d);
720 prop_value_append(prop, val); 737 prop_value_append(prop, val);
@@ -728,23 +745,9 @@ editor_factory_wdg_create(const char *class_name)
728 745
729 manager_init(); 746 manager_init();
730 747
731 if (!IS_WIN(wdg)) 748 Eo *pw = NULL;
732 { 749 if (IS_WIN(wdg)) pw = (Eo *)canvas_get();
733 manager_wdg_eo_add_call(wdg, MODE_EDITOR, NULL); 750 manager_wdg_eo_add_call(wdg, MODE_EDITOR, pw);
734 }
735 else
736 {
737 Eo *pw = NULL;
738 if (!parent_win)
739 {
740 pw = (Eo *)canvas_get();
741 }
742 else
743 {
744 pw = wdg_eo_get(wdg_parent_get(wdg));
745 }
746 manager_wdg_eo_add_call(wdg, MODE_EDITOR, pw);
747 }
748 751
749 objtree_item_contracted_set(NULL); 752 objtree_item_contracted_set(NULL);
750 753
@@ -762,3 +765,194 @@ editor_layout_refresh()
762 editor_ctx_call(ctx); 765 editor_ctx_call(ctx);
763} 766}
764 767
768/* onChange callback for all properties edit fields.
769 * If currently there is no such property in the widget, it will be added.
770 * The given object is the one created in the properties view for each parameter.
771 */
772static void
773_prop_update_from_propview(void *data EINA_UNUSED, Eo *obj, void *event_info)
774{
775 Par_Field_Data *pfd = NULL;
776 const Eo_Class *kl = eo_class_get(obj);
777 Op_Desc *op;
778 Gui_Widget *wdg;
779 Gui_Widget_Property *prop;
780 int idx;
781 Gui_Value *val;
782 Eina_Bool prop_add = EINA_FALSE;
783
784 /* Get data for changed field. */
785 eo_do(obj, eo_base_data_get("editor", (void **) &pfd));
786 op = pfd->it_data->op_desc;
787 wdg = pfd->it_data->wdg;
788 prop = pfd->it_data->prop;
789 idx = pfd->par_idx;
790
791 /* If property doesn't exist, create it with some default values. */
792 if (!prop)
793 {
794 prop = prop_create_for_op(op);
795 /* Raise flag, that property is newly created and must be added to widget. */
796 prop_add = EINA_TRUE;
797 }
798 /* Get value which need to be changed.*/
799 val = prop_value_nth_get(prop, idx);
800
801 /* Get new value from edit field.
802 * And update Gui_Value with new value. */
803 Gui_Type type = db_op_desc_nth_par_type_get(op, idx);
804 if (kl == ELM_OBJ_ENTRY_CLASS)
805 {
806 const char *entry_data = elm_entry_entry_get(obj);
807 if (type == GUI_TYPE_STRING)
808 {
809 /* FIXME: part_text_set can receive NULL as parameter.
810 * But because of this, I can't write "null"*/
811 if (!strcmp(entry_data, "null"))
812 {
813 gui_value_set(val, GUI_TYPE_NULL, NULL);
814 }
815 else
816 {
817 gui_value_type_set(val, type);
818 gui_value_string_set(val, entry_data);
819 }
820 }
821 /* FIXME: there is problem with content_set; because prev content must be unset; or need to redraw from the beginning*/
822 else if (type == GUI_TYPE_OBJECT)
823 {
824 const char *cur_param = gui_value_string_get(val);
825 Gui_Widget *cur_param_wdg = wdg_get(active_context_get(), cur_param);
826 Gui_Widget *new_param_wdg = wdg_get(active_context_get(), entry_data);
827 /* GUI_TYPE_OBJECT ops depend on other widgets, check that widget exists.
828 * or new one not equal old one.*/
829 if ((!new_param_wdg) || (cur_param_wdg == new_param_wdg))
830 {
831 goto end;
832 }
833
834 /* Update parent, if op supports it. */
835 if (db_op_desc_flag_get(op) & UPDATE_PARENT)
836 {
837 /* If I simply change value in prop: t.e. "but1"->"but2" change parent of "but1".*/
838 const Gui_Widget* parent_win = wdg_parent_win_wdg_get(new_param_wdg);
839 objtree_item_contracted_set(parent_win);
840 if (cur_param_wdg)
841 {
842 wdg_parent_set(cur_param_wdg, wdg_name_get(parent_win));
843 }
844 wdg_parent_set(new_param_wdg, wdg_name_get(wdg));
845 objtree_item_selected_set(wdg);
846 }
847
848 gui_value_type_set(val, type);
849 gui_value_string_set(val, entry_data);
850 }
851 else if (type == GUI_TYPE_SINT)
852 {
853 int number = atoi(entry_data);
854 gui_value_set(val, type, &number);
855 }
856 else if (type == GUI_TYPE_DOUBLE)
857 {
858 double number = atof(entry_data);
859 gui_value_set(val, type, &number);
860 }
861 }
862 if (kl == ELM_OBJ_CHECK_CLASS)
863 {
864 Eina_Bool state;
865 eo_do(obj, elm_obj_check_state_get(&state));
866 gui_value_set(val, type, &state);
867 }
868 if (kl == ELM_OBJ_HOVERSEL_CLASS)
869 {
870 const char *new_enum_value = elm_object_item_part_text_get(event_info, NULL);
871 /* Set selected string on hover */
872 elm_object_text_set(obj, new_enum_value);
873 /* Get new value depending on type of edit field.
874 * And update value. */
875 if (type == GUI_TYPE_ENUM || type == GUI_TYPE_OBJECT)
876 {
877 gui_value_set(val, type, (void *) new_enum_value);
878 }
879 if (type == GUI_TYPE_OBJECT)
880 {
881 /* Update parent, if op supports it. */
882 if (db_op_desc_flag_get(op) & UPDATE_PARENT)
883 {
884 /* If I simply change value in prop: t.e. "but1"->"but2" change parent of "but1".*/
885 Gui_Widget *new_param_wdg = wdg_get(active_context_get(), new_enum_value);
886 const Gui_Widget* parent_win = wdg_parent_win_wdg_get(new_param_wdg);
887 objtree_item_contracted_set(parent_win);
888 wdg_parent_set(new_param_wdg, wdg_name_get(wdg));
889 objtree_item_selected_set(wdg);
890 }
891 }
892 }
893
894 if (prop_add)
895 {
896 wdg_prop_add(wdg, prop);
897 pfd->it_data->prop = prop;
898 }
899 /* Validate widget and call for eo_func of current prop,
900 * in order to update layout. */
901 if (wdg_validate(wdg))
902 {
903 manager_init();
904 manager_wdg_prop_eo_do_call(wdg, prop, MODE_EDITOR, NULL);
905 manager_shutdown();
906 /* Rebuild view when property like "pack_end". */
907 if (db_op_desc_flag_get(op) & MULTI_PROPERTY)
908 propview_build(wdg);
909 return;
910 }
911end:
912 /* If property was newly created, delete it. */
913 if (prop_add) prop_del(prop);
914}
915
916static void
917_prop_del_from_propview(void *data, Eo *obj EINA_UNUSED, void *ev EINA_UNUSED)
918{
919 const Gui_Widget *wdg = editor_wdg_selected_get();
920 Gui_Widget_Property *prop = data;
921 const Op_Desc *op = prop_op_desc_get(prop);
922 Gui_Value *val;
923 Eina_List *l;
924
925 /* Change parent, when removing property like "pack_end". */
926 if (db_op_desc_flag_get(op) & UPDATE_PARENT)
927 {
928 EINA_LIST_FOREACH(prop_value_get(prop), l, val)
929 {
930 if (gui_value_type_get(val) == GUI_TYPE_OBJECT)
931 {
932 Gui_Widget *param_wdg = wdg_get(active_context_get(), gui_value_string_get(val));
933 if (param_wdg)
934 {
935 const Gui_Widget *parent_win = wdg_parent_win_wdg_get(param_wdg);
936 /* Do it to update list. */
937 objtree_item_contracted_set(parent_win);
938 wdg_parent_set(param_wdg, wdg_name_get(parent_win));
939 objtree_item_selected_set(wdg);
940 }
941 }
942 }
943 }
944
945 wdg_prop_del((Gui_Widget *) wdg, prop);
946 editor_layout_refresh();
947 editor_wdg_selected_set(wdg);
948 objtree_item_selected_set(wdg);
949}
950
951static void
952_widget_selected_from_objtree(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
953{
954 Gui_Widget *wdg = elm_object_item_data_get(event_info);
955 editor_wdg_selected_set(wdg);
956 if (wdg) propview_build(wdg);
957}
958
diff --git a/src/bin/egui.c b/src/bin/egui.c
deleted file mode 100644
index d1f201d..0000000
--- a/src/bin/egui.c
+++ /dev/null
@@ -1,388 +0,0 @@
1
2#include <Elementary.h>
3#include "simulator.h"
4#include "egui_private.h"
5
6#include "elm_widget.h"
7#include "elm_widget_container.h"
8#include "elm_interface_scrollable.h"
9
10static Eo *egui_win, *bt, *bt2, *bt3, *bg, *bx, *label;
11
12static void
13_main_win_del_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
14{
15 printf("win del\n");
16 elm_exit();
17}
18
19static Gui_Context *ctx;
20
21static Eina_Bool
22_btn_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
23{
24 INF("click");
25 char *filename = data;
26
27 ctx = gui_context_new();;
28 if (!ctx)
29 {
30 ERR("Can not create context: %p", ctx);
31 }
32
33 if (!gui_parser_json_file_read(ctx, filename))
34 {
35 gui_context_del(ctx);
36 return EO_CALLBACK_STOP;
37 }
38
39 gui_context_validate(ctx);
40 ctx_tree_gen(ctx);
41 simulator_ctx_call(ctx, MODE_EDITOR);
42 return EO_CALLBACK_CONTINUE;
43}
44
45static Eina_Bool
46_cls_ctx(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
47{
48 if (!data) return EO_CALLBACK_STOP;
49 Gui_Context *c = data;
50 gui_context_del(c);
51 return EO_CALLBACK_CONTINUE;
52}
53
54void
55egui_start(char *filename)
56{
57 /**
58 * @egui
59 * {
60 * "egui_win": {
61 * "Desc" : {
62 * "class" : "elm_win",
63 * "main" : true,
64 * "public" : true
65 * },
66 * "Properties" : {
67 * "constructor" : ["elm_obj_win_constructor"],
68 * "elm_obj_win_constructor" : [null, "ELM_WIN_BASIC"],
69 * "title_set" : ["Egui is Cool!"],
70 * "autodel_set" : [true],
71 * "size_set" : [1000, 650],
72 * "resize_object_add" : ["bg"],
73 * "visibility_set" : [true]
74 * }
75 * }
76 * }
77 * @!egui
78 */
79 egui_win = eo_add_custom(ELM_OBJ_WIN_CLASS, NULL, elm_obj_win_constructor("window", ELM_WIN_BASIC));
80
81 eo_do(egui_win,
82 elm_obj_win_title_set("Egui is Cool!"),
83 evas_obj_size_set(1000, 650),
84 evas_obj_visibility_set(EINA_TRUE)
85 );
86
87 evas_object_smart_callback_add(egui_win, "delete,request", _main_win_del_cb, NULL);
88
89 /**
90 * @egui
91 * {
92 * "bg" : {
93 * "Desc" : {
94 * "class" : "elm_bg",
95 * "parent" : "egui_win",
96 * "public" : true
97 * },
98 * "Properties" : {
99 * "bg_color_set" : [255,255,255],
100 * "size_hint_weight_set" : [1.0, 1.0],
101 * "visibility_set" : [true]
102 * }
103 * }
104 * }
105 * @!egui
106 */
107 bg = eo_add(ELM_OBJ_BG_CLASS, egui_win);
108 eo_do(bg, elm_obj_bg_color_set(255, 255, 255),
109 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
110 evas_obj_visibility_set(EINA_TRUE));
111 eo_do(egui_win, elm_obj_win_resize_object_add(bg));
112
113 //evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, NULL);
114 //evas_object_event_callback_add(bx, EVAS_CALLBACK_MOUSE_UP, _mouse_up, NULL);
115 //
116 //
117 Eo *box, *lst;
118/* @egui
119{
120 "box1":
121 {
122 "Desc" : {
123 "class" : "elm_box",
124 "parent" : "egui_win"
125 },
126 "Properties":
127 {
128 "visibility_set":[true],
129 "size_set" : [200, 400],
130 "position_set" : [650, 0],
131 "pack_end":["lst1"]
132 }
133 }
134 }
135@!egui */
136 box = eo_add(ELM_OBJ_BOX_CLASS, egui_win);
137 eo_unref(box);
138 eo_do(box,
139 evas_obj_visibility_set(EINA_TRUE),
140 evas_obj_position_set(650, 0),
141 evas_obj_size_set(200, 400)
142 );
143
144/* @egui
145{
146 "lst1":
147 {
148 "Desc" : {
149 "class" : "elm_genlist",
150 "parent" : "box1",
151 "public" : true
152 },
153 "Properties":
154 {
155 "visibility_set":[true],
156 "size_hint_weight_set" : [1.0, 1.0],
157 "size_hint_align_set" : [-1.0, -1.0]
158 }
159 }
160 }
161@!egui */
162 lst = eo_add(ELM_OBJ_GENLIST_CLASS, box);
163 eo_unref(lst);
164
165 eo_do(lst,
166 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
167 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
168 evas_obj_visibility_set(EINA_TRUE));
169
170 eo_do(box, elm_obj_box_pack_end(lst));
171 objtree_list_set(lst);
172
173/* @egui
174{
175 "box2":
176 {
177 "Desc" : {
178 "class" : "elm_box",
179 "parent" : "egui_win"
180 },
181 "Properties":
182 {
183 "visibility_set":[true],
184 "size_set" : [200, 200],
185 "position_set" : [650, 400],
186 "pack_end":["lst2"]
187 }
188 }
189 }
190@!egui */
191 box = eo_add(ELM_OBJ_BOX_CLASS, egui_win);
192 eo_unref(box);
193 eo_do(box,
194 evas_obj_visibility_set(EINA_TRUE),
195 evas_obj_position_set(650, 400),
196 evas_obj_size_set(200, 200)
197 );
198/* @egui
199{
200 "lst2":
201 {
202 "Desc" : {
203 "class" : "elm_genlist",
204 "parent" : "box2",
205 "public" : true
206 },
207 "Properties":
208 {
209 "visibility_set":[true],
210 "size_hint_weight_set" : [1.0, 1.0],
211 "size_hint_align_set" : [-1.0, -1.0]
212 }
213 }
214 }
215@!egui */
216 lst = eo_add(ELM_OBJ_GENLIST_CLASS, box);
217 eo_unref(lst);
218 eo_do(lst,
219 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
220 evas_obj_size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL),
221 evas_obj_visibility_set(EINA_TRUE));
222
223 eo_do(box, elm_obj_box_pack_end(lst));
224 propview_list_set(lst);
225
226/* @egui
227{
228 "bx":
229 {
230 "Desc" : {
231 "class" : "elm_box",
232 "parent" : "egui_win"
233 },
234 "Properties":
235 {
236 "visibility_set":[true],
237 "size_set" : [300, 400],
238 "position_set" : [50, 50],
239 "pack_end":["label"],
240 "pack_end":["bt"],
241 "pack_end":["bt2"],
242 "pack_end":["bt3"]
243 }
244 }
245 }
246@!egui */
247 bx = eo_add(ELM_OBJ_BOX_CLASS, egui_win);
248 eo_unref(bx);
249 eo_do(bx, evas_obj_visibility_set(EINA_TRUE),
250 evas_obj_position_set(50, 50),
251 evas_obj_size_set(300, 400));
252 /**
253 * @egui
254 * {
255 * "label" : {
256 * "Desc" : {
257 * "class" : "elm_label",
258 * "parent" : "bx",
259 * "public" : true
260 * },
261 * "Properties" : {
262 * "visibility_set" : [true],
263 * "part_text_set" : [null, "Box"],
264 * "size_set" : [60, 30],
265 * "position_set" : [100, 30]
266 * }
267 * }
268 * }
269 * @!egui
270 */
271 label = eo_add(ELM_OBJ_LABEL_CLASS, egui_win);
272 eo_unref(label);
273 eo_do(label, elm_wdg_part_text_set(NULL, "Box"));
274 eo_do(label, evas_obj_visibility_set(EINA_TRUE));
275
276 /**
277 * @egui
278 * {
279 * "bt" : {
280 * "Desc" : {
281 * "class" : "elm_button",
282 * "parent" : "bx",
283 * "public" : true
284 * },
285 * "Properties" : {
286 * "color_set" : [0,250, 0, 255],
287 * "visibility_set" : [true],
288 * "part_text_set" : [null, "open C file"],
289 * "size_set" : [50, 30]
290 * }
291 * }
292 * }
293 * @!egui
294 */
295 bt = eo_add(ELM_OBJ_BUTTON_CLASS, egui_win);
296 eo_unref(bt);
297 eo_do(bt,
298 evas_obj_color_set(0, 250, 0, 255),
299 evas_obj_size_set(50, 30),
300 evas_obj_visibility_set(EINA_TRUE));
301 elm_object_text_set(bt, "open C file");
302 eo_do(bt, eo_event_callback_add(&_CLICKED_EVENT, _btn_cb, filename));
303
304 /**
305 * @egui
306 * {
307 * "bt2" : {
308 * "Desc" : {
309 * "class" : "elm_button",
310 * "parent" : "bx",
311 * "public" : true
312 * },
313 * "Properties" : {
314 * "color_set" : [255, 0, 0, 255],
315 * "visibility_set" : [true],
316 * "part_text_set" : [null, "close (press twise -> segv)"],
317 * "size_set" : [150, 30]
318 * }
319 * }
320 * }
321 * @!egui
322 */
323 bt2 = eo_add(ELM_OBJ_BUTTON_CLASS, egui_win);
324 eo_unref(bt2);
325 eo_do(bt2,
326 evas_obj_color_set(250, 0, 0, 255),
327 evas_obj_size_set(150, 30),
328 evas_obj_visibility_set(EINA_TRUE));
329 elm_object_text_set(bt2, "close (press twice -> segv)");
330 eo_do(bt2, eo_event_callback_add(&_CLICKED_EVENT, _cls_ctx, NULL));
331
332
333 /**
334 * @egui
335 * {
336 * "bt3" : {
337 * "Desc" : {
338 * "class" : "elm_button",
339 * "parent" : "bx",
340 * "public" : true
341 * },
342 * "Properties" : {
343 * "color_set" : [0, 0, 250, 255],
344 * "visibility_set" : [true],
345 * "part_text_set" : [null, "show/hide box"],
346 * "size_set" : [150, 30]
347 * }
348 * }
349 * }
350 * @!egui
351 */
352 bt3 = eo_add(ELM_OBJ_BUTTON_CLASS, egui_win);
353 eo_unref(bt3);
354 eo_do(bt3,
355 evas_obj_color_set(0, 0, 250, 255),
356 evas_obj_size_set(150, 30),
357 evas_obj_visibility_set(EINA_TRUE));
358 elm_object_text_set(bt3, "show/hide box");
359
360 eo_do(bx,
361 elm_obj_box_pack_end(label),
362 elm_obj_box_pack_end(bt),
363 elm_obj_box_pack_end(bt2),
364 elm_obj_box_pack_end(bt3));
365
366#if (0)
367 Evas_Object *t_eo;
368 t_eo = eo_add(EVAS_OBJ_TEXT_CLASS, evas_object_evas_get(egui_win));
369 eo_unref(t_eo);
370 eo_do(t_eo, evas_obj_text_style_set(EVAS_TEXT_STYLE_PLAIN),
371 evas_obj_color_set(0, 0, 0,255),
372 evas_obj_size_set(500, 20),
373 evas_obj_text_font_set("Courier", 20),
374 evas_obj_text_text_set("evas_text"),
375 evas_obj_position_set(20, 20),
376 evas_obj_visibility_set(EINA_TRUE)
377 );
378#endif
379}
380
381void
382egui_stop()
383{
384 eo_del(bg);
385 eo_del(egui_win);
386}
387
388
diff --git a/src/bin/egui.h b/src/bin/egui.h
deleted file mode 100644
index f0d0f28..0000000
--- a/src/bin/egui.h
+++ /dev/null
@@ -1,19 +0,0 @@
1
2#ifndef _egui_h
3#define _egui_h
4
5
6/*
7 * Gui window init
8 * */
9void
10egui_start();
11
12/*
13 * Gui window cleanup
14 * */
15void
16egui_stop();
17
18
19#endif
diff --git a/src/bin/egui_layout.c b/src/bin/egui_layout.c
index 3db03a2..797eb03 100644
--- a/src/bin/egui_layout.c
+++ b/src/bin/egui_layout.c
@@ -8,6 +8,9 @@
8GUI *pub_widgets; 8GUI *pub_widgets;
9static Eo *egui_win; 9static Eo *egui_win;
10 10
11extern void
12_sequence_add_cb(void *data, Eo *obj, void *event_info EINA_UNUSED);
13
11static Eina_Bool 14static Eina_Bool
12_create_fs_win(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) 15_create_fs_win(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
13{ 16{
@@ -68,7 +71,7 @@ _create_fs_win(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Descr
68 */ 71 */
69 bg2 = eo_add(ELM_OBJ_BG_CLASS, fs_win); 72 bg2 = eo_add(ELM_OBJ_BG_CLASS, fs_win);
70 eo_unref(bg2); 73 eo_unref(bg2);
71 eo_do(bg2, elm_obj_bg_color_set(255, 255, 200)); 74 eo_do(bg2, elm_obj_bg_color_set(255, 255, 200, 255));
72 eo_do(bg2, evas_obj_size_hint_weight_set(1.000000, 1.000000)); 75 eo_do(bg2, evas_obj_size_hint_weight_set(1.000000, 1.000000));
73 eo_do(bg2, evas_obj_visibility_set(EINA_TRUE)); 76 eo_do(bg2, evas_obj_visibility_set(EINA_TRUE));
74 eo_do(fs_win, elm_obj_win_resize_object_add(bg2)); 77 eo_do(fs_win, elm_obj_win_resize_object_add(bg2));
@@ -126,6 +129,89 @@ _create_fs_win(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Descr
126 return EO_CALLBACK_CONTINUE; 129 return EO_CALLBACK_CONTINUE;
127} 130}
128 131
132static Eina_Bool
133_seq_add_win_create(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
134{
135 /* @egui
136 {
137 "seq_add_win":
138 {
139 "Desc":
140 {
141 "parent":null,
142 "class":"elm_win",
143 "main":true
144 },
145 "Properties":
146 {
147 "constructor":["elm_obj_win_constructor"],
148 "elm_obj_win_constructor":[null, "ELM_WIN_BASIC"],
149 "title_set":["Add Sequence"],
150 "autodel_set":[true],
151 "size_set":[100, 100],
152 "resize_object_add":["bg"],
153 "resize_object_add":["box"],
154 "visibility_set":[true]
155 }
156 }
157 }
158 @!egui */
159 Eo *seq_add_win = eo_add_custom(ELM_OBJ_WIN_CLASS, NULL, elm_obj_win_constructor("seq_add", ELM_WIN_BASIC));
160 eo_unref(seq_add_win);
161 eo_do(seq_add_win, elm_obj_win_title_set("Add sequence"));
162 eo_do(seq_add_win, elm_obj_win_autodel_set(EINA_TRUE));
163 eo_do(seq_add_win, evas_obj_size_set(100, 100));
164 eo_do(seq_add_win, evas_obj_visibility_set(EINA_TRUE));
165
166 /* @egui
167 {
168 "bg":
169 {
170 "Desc":
171 {
172 "parent":"seq_add_win",
173 "class":"elm_bg",
174 },
175 "Properties":
176 {
177 "bg_color_set":[255, 255, 255],
178 "size_hint_weight_set":[1, 1],
179 "visibility_set":[true]
180 }
181 }
182 }
183 @!egui */
184 Eo *bg = eo_add(ELM_OBJ_BG_CLASS, seq_add_win);
185 eo_unref(bg);
186 eo_do(bg, elm_obj_bg_color_set(230, 230, 230, 255));
187 eo_do(bg, evas_obj_size_hint_weight_set(1.000000, 1.000000));
188 eo_do(bg, evas_obj_visibility_set(EINA_TRUE));
189 eo_do(seq_add_win, elm_obj_win_resize_object_add(bg));
190
191 Eo *box;
192 box = eo_add(ELM_OBJ_BOX_CLASS, seq_add_win);
193 eo_unref(box);
194 eo_do(box, evas_obj_visibility_set(EINA_TRUE),
195 elm_obj_box_horizontal_set(EINA_TRUE));
196 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
197 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
198 eo_do(seq_add_win, elm_obj_win_resize_object_add(box));
199
200 Eo *en = eo_add(ELM_OBJ_ENTRY_CLASS, box);
201 eo_unref(en);
202 eo_do(en,
203 elm_obj_entry_scrollable_set(EINA_TRUE),
204 evas_obj_size_hint_weight_set(0.5, 0.0),
205 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 0.5),
206 elm_scrollable_interface_policy_set(ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF),
207 elm_obj_entry_single_line_set(EINA_TRUE),
208 evas_obj_visibility_set(EINA_TRUE));
209 elm_box_pack_end(box, en);
210 evas_object_smart_callback_add(en, "activated", _sequence_add_cb, NULL);
211 pub_widgets->seq_add_entry = en;
212 return EINA_TRUE;
213}
214
129extern Eina_Bool 215extern Eina_Bool
130_on_factory_item_down(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info); 216_on_factory_item_down(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
131 217
@@ -133,24 +219,13 @@ GUI* get_gui()
133{ 219{
134 Eo *grid; 220 Eo *grid;
135 Eo *bg; 221 Eo *bg;
136 Eo *box1;
137 Eo *lst1; 222 Eo *lst1;
138 Eo *box2;
139 Eo *lst2; 223 Eo *lst2;
140 Eo *bx; 224 Eo *seq_list;
141 Eo *new_project_but; 225 Eo *menu_box;
142 Eo *close_project_but;
143 Eo *refresh_but;
144 Eo *frame;
145 Eo *panes; 226 Eo *panes;
146 Eo *lpanel; 227 Eo *left_panel;
147 Eo *rpanel; 228 Eo *rpanel;
148 Eo *file_open_but;
149 Eo *file_save_but;
150 Eo *file_save_as_but;
151 Eo *del_wdg_but;
152
153 Eo *canvas;
154 229
155/* @egui 230/* @egui
156{ 231{
@@ -183,6 +258,7 @@ GUI* get_gui()
183 eo_do(egui_win, elm_obj_win_autodel_set(EINA_TRUE)); 258 eo_do(egui_win, elm_obj_win_autodel_set(EINA_TRUE));
184 eo_do(egui_win, evas_obj_size_set(1000, 650)); 259 eo_do(egui_win, evas_obj_size_set(1000, 650));
185 eo_do(egui_win, evas_obj_visibility_set(EINA_TRUE)); 260 eo_do(egui_win, evas_obj_visibility_set(EINA_TRUE));
261 eo_do(egui_win, elm_obj_win_maximized_set(EINA_TRUE));
186/* @egui 262/* @egui
187{ 263{
188 "bg": 264 "bg":
@@ -204,7 +280,7 @@ GUI* get_gui()
204@!egui */ 280@!egui */
205 bg = eo_add(ELM_OBJ_BG_CLASS, egui_win); 281 bg = eo_add(ELM_OBJ_BG_CLASS, egui_win);
206 eo_unref(bg); 282 eo_unref(bg);
207 eo_do(bg, elm_obj_bg_color_set(230, 230, 230)); 283 eo_do(bg, elm_obj_bg_color_set(230, 230, 230, 255));
208 eo_do(bg, evas_obj_size_hint_weight_set(1.000000, 1.000000)); 284 eo_do(bg, evas_obj_size_hint_weight_set(1.000000, 1.000000));
209 eo_do(bg, evas_obj_visibility_set(EINA_TRUE)); 285 eo_do(bg, evas_obj_visibility_set(EINA_TRUE));
210 eo_do(egui_win, elm_obj_win_resize_object_add(bg)); 286 eo_do(egui_win, elm_obj_win_resize_object_add(bg));
@@ -224,7 +300,7 @@ GUI* get_gui()
224 "grid_size":[100, 100], 300 "grid_size":[100, 100],
225 "size_hint_weight_set":[1, 1], 301 "size_hint_weight_set":[1, 1],
226 "grid_pack" : ["rpanel", 70, 5,30, 90], 302 "grid_pack" : ["rpanel", 70, 5,30, 90],
227 "grid_pack" : ["lpanel", 0, 15, 20, 50], 303 "grid_pack" : ["left_panel", 0, 15, 20, 50],
228 "visibility_set":[true] 304 "visibility_set":[true]
229 } 305 }
230 } 306 }
@@ -237,10 +313,18 @@ GUI* get_gui()
237 eo_do(grid, evas_obj_visibility_set(EINA_TRUE)); 313 eo_do(grid, evas_obj_visibility_set(EINA_TRUE));
238 eo_do(egui_win, elm_obj_win_resize_object_add(grid)); 314 eo_do(egui_win, elm_obj_win_resize_object_add(grid));
239 315
316 Eo *hor_box;
317 hor_box = eo_add(ELM_OBJ_BOX_CLASS, egui_win);
318 eo_unref(hor_box);
319 eo_do(hor_box, evas_obj_visibility_set(EINA_TRUE),
320 elm_obj_box_horizontal_set(EINA_TRUE));
321 evas_object_size_hint_weight_set(hor_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
322 evas_object_size_hint_align_set(hor_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
323 elm_grid_pack(grid, hor_box, 0, 10, 100, 90);
240 324
241/* @egui 325/* @egui
242{ 326{
243 "rpanel": 327 "left_panel":
244 { 328 {
245 "Desc": 329 "Desc":
246 { 330 {
@@ -250,129 +334,224 @@ GUI* get_gui()
250 }, 334 },
251 "Properties": 335 "Properties":
252 { 336 {
253 "panel_orient": ["ELM_PANEL_ORIENT_RIGHT"], 337 "panel_orient": ["ELM_PANEL_ORIENT_LEFT"],
254 "panel_hidden": [false], 338 "panel_hidden": [false],
255 "content_set" : [null, "panes", null], 339 "content_set" : [null, "fctr_table", null],
256 "visibility_set":[true] 340 "visibility_set":[true]
257 } 341 }
258 } 342 }
259 } 343 }
260@!egui */ 344@!egui */
261 rpanel = elm_panel_add(grid); 345 left_panel = elm_panel_add(hor_box);
262 elm_panel_orient_set(rpanel, ELM_PANEL_ORIENT_RIGHT); 346 elm_panel_orient_set(left_panel, ELM_PANEL_ORIENT_LEFT);
263 eo_do(rpanel, evas_obj_visibility_set(EINA_TRUE)); 347 eo_do(left_panel, evas_obj_visibility_set(EINA_TRUE));
264 elm_panel_hidden_set(rpanel, EINA_FALSE); 348 elm_panel_hidden_set(left_panel, EINA_FALSE);
265 elm_grid_pack(grid, rpanel, 70, 5, 30, 90); 349 evas_object_size_hint_weight_set(left_panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
350 evas_object_size_hint_align_set(left_panel, 0, -1);
351 elm_box_pack_end(hor_box, left_panel);
266 352
353 Eo *left_panel_box = eo_add(ELM_OBJ_BOX_CLASS, left_panel);
354 eo_unref(left_panel_box);
355 eo_do(left_panel_box, evas_obj_visibility_set(EINA_TRUE));
356 evas_object_size_hint_weight_set(left_panel_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
357 evas_object_size_hint_align_set(left_panel_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
358 elm_object_content_set(left_panel, left_panel_box);
267 359
268/* @egui 360/* @egui
269{ 361{
270 "panes": 362 "fctr_table":
271 { 363 {
272 "Desc": 364 "Desc":
273 { 365 {
274 "parent":"rpanel", 366 "parent":"left_panel",
275 "class":"elm_panes", 367 "class":"elm_table",
276 "public":true 368 "public":true
277 }, 369 },
278 "Properties": 370 "Properties":
279 { 371 {
280 "panes_horizontal": [true], 372 "table_pack" : ["vsp1", 1, 0, 1, 5],
281 "size_hint_weight_set":[1, 1], 373 "table_pack" : ["vsp2", 3, 0, 1, 5],
282 "size_hint_align_set":[-1, -1], 374 "table_pack" : ["hsp1", 0, 1, 5, 1],
283 "content_set" : ["left", "box1", null], 375 "table_pack" : ["hsp2", 0, 3, 5, 1],
284 "content_set" : ["right", "box2", null], 376
377 "table_pack" : ["win_it", 0, 0, 1, 1],
378 "table_pack" : ["bg_it", 2, 0, 1, 1],
379 "table_pack" : ["box_it", 4, 0, 1, 1],
380
381 "table_pack" : ["button_it", 0, 2, 1, 1],
382 "table_pack" : ["label_it", 2, 2, 1, 1],
383 "table_pack" : ["check_it", 4, 2, 1, 1],
384
385 "table_pack" : ["icon_it", 0, 4, 1, 1],
386 "table_pack" : ["image_it", 2, 4, 1, 1],
387 "table_pack" : ["pbar_it", 4, 4, 1, 1]
285 "visibility_set":[true] 388 "visibility_set":[true]
286 } 389 }
287 } 390 }
288 } 391 }
289@!egui */ 392@!egui */
290 panes = eo_add(ELM_OBJ_PANES_CLASS, rpanel); 393 Eo *fctr_table = eo_add(ELM_OBJ_TABLE_CLASS, left_panel);
291 eo_unref(panes); 394 eo_unref(fctr_table);
292 eo_do(panes, evas_obj_visibility_set(EINA_TRUE)); 395 eo_do(fctr_table, evas_obj_visibility_set(EINA_TRUE));
293 eo_do(panes, elm_obj_panes_horizontal_set(EINA_TRUE)); 396 elm_box_pack_end(left_panel_box, fctr_table);
294 evas_object_size_hint_weight_set(panes, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 397
295 evas_object_size_hint_align_set(panes, EVAS_HINT_FILL, EVAS_HINT_FILL); 398 Eo *sequence_buttons_box = eo_add(ELM_OBJ_BOX_CLASS, left_panel_box);
296 elm_object_content_set(rpanel, panes); 399 eo_unref(sequence_buttons_box);
400 eo_do(sequence_buttons_box, evas_obj_visibility_set(EINA_TRUE));
401 eo_do(sequence_buttons_box, elm_obj_box_horizontal_set(EINA_TRUE));
402 evas_object_size_hint_weight_set(sequence_buttons_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
403 evas_object_size_hint_align_set(sequence_buttons_box, EVAS_HINT_FILL, 1);
404 elm_box_pack_end(left_panel_box, sequence_buttons_box);
405
406 Eo *button_sequence_add = eo_add(ELM_OBJ_BUTTON_CLASS, sequence_buttons_box);
407 eo_unref(button_sequence_add);
408 eo_do(button_sequence_add, elm_wdg_part_text_set(NULL, "+"));
409 eo_do(button_sequence_add, evas_obj_visibility_set(EINA_TRUE));
410 elm_box_pack_end(sequence_buttons_box, button_sequence_add);
411 eo_do(button_sequence_add, eo_event_callback_add(&_CLICKED_EVENT, _seq_add_win_create, NULL));
412
413 Eo *button_sequence_del = eo_add(ELM_OBJ_BUTTON_CLASS, sequence_buttons_box);
414 eo_unref(button_sequence_del);
415 eo_do(button_sequence_del, elm_wdg_part_text_set(NULL, "-"));
416 eo_do(button_sequence_del, evas_obj_visibility_set(EINA_TRUE));
417 elm_box_pack_end(sequence_buttons_box, button_sequence_del);
297 418
419 Eo *seq_table = eo_add(ELM_OBJ_TABLE_CLASS, left_panel_box);
420 eo_unref(seq_table);
421 evas_object_size_hint_weight_set(seq_table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
422 evas_object_size_hint_align_set(seq_table, EVAS_HINT_FILL, EVAS_HINT_FILL);
423 eo_do(seq_table, evas_obj_visibility_set(EINA_TRUE));
424 elm_box_pack_end(left_panel_box, seq_table);
425
426 Evas_Object *seq_rect = evas_object_rectangle_add(evas_object_evas_get(seq_table));
427 evas_object_size_hint_min_set(seq_rect, 300, 1);
428 evas_object_size_hint_weight_set(seq_rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
429 evas_object_size_hint_align_set(seq_rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
430 elm_table_pack(seq_table, seq_rect, 0, 0, 1, 1);
298/* @egui 431/* @egui
299{ 432{
300 "box1": 433 "seq_list":
301 { 434 {
302 "Desc": 435 "Desc":
303 { 436 {
304 "parent":"panes", 437 "parent":"sequence_panel",
305 "class":"elm_box" 438 "class":"elm_genlist",
439 "public":true
306 }, 440 },
307 "Properties": 441 "Properties":
308 { 442 {
309 "visibility_set":[true], 443 "visibility_set":[true],
310 "pack_end":["lst1"] 444 "size_hint_weight_set":[1, 1],
445 "size_hint_align_set":[-1, -1]
311 } 446 }
312 } 447 }
313 } 448 }
314@!egui */ 449@!egui */
315 box1 = eo_add(ELM_OBJ_BOX_CLASS, panes); 450 seq_list = eo_add(ELM_OBJ_GENLIST_CLASS, seq_table);
316 eo_unref(box1); 451 eo_unref(seq_list);
317 eo_do(box1, evas_obj_visibility_set(EINA_TRUE)); 452 eo_do(seq_list, evas_obj_visibility_set(EINA_TRUE));
318 elm_object_part_content_set(panes, "left", box1); 453 eo_do(seq_list, evas_obj_size_hint_weight_set(1.000000, 1.000000));
454 eo_do(seq_list, evas_obj_size_hint_align_set(-1.000000, -1.000000));
455 elm_table_pack(seq_table, seq_list, 0, 0, 1, 1);
456#if 0
457 /*Try to add some border for canvas area*/
458 Eo *mid_box;
459 mid_box = eo_add(ELM_OBJ_BOX_CLASS, egui_win);
460 eo_unref(mid_box);
461 eo_do(mid_box, evas_obj_visibility_set(EINA_TRUE),
462 elm_obj_box_horizontal_set(EINA_TRUE));
463 evas_object_size_hint_weight_set(mid_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
464 evas_object_size_hint_align_set(mid_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
465 elm_box_pack_end(hor_box, mid_box);
466
467 Eo *b_bg;
468 b_bg = eo_add(ELM_OBJ_BG_CLASS, egui_win);
469 eo_unref(b_bg);
470 eo_do(b_bg, elm_obj_bg_color_set(230, 0, 230, 255));
471 eo_do(b_bg, evas_obj_visibility_set(EINA_TRUE));
472 evas_object_size_hint_weight_set(b_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
473 evas_object_size_hint_align_set(b_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
474 elm_box_pack_end(mid_box, b_bg);
475#endif
476
319 477
320/* @egui 478/* @egui
321{ 479{
322 "box2": 480 "rpanel":
323 { 481 {
324 "Desc": 482 "Desc":
325 { 483 {
326 "parent":"panes", 484 "parent":"hor_box",
327 "class":"elm_box" 485 "class":"elm_panel",
486 "public":true
328 }, 487 },
329 "Properties": 488 "Properties":
330 { 489 {
331 "visibility_set":[true], 490 "panel_orient": ["ELM_PANEL_ORIENT_RIGHT"],
332 "size_set":[200, 200], 491 "panel_hidden": [false],
333 "position_set":[650, 400], 492 "content_set" : [null, "panes", null],
334 "pack_end":["lst2"] 493 "visibility_set":[true]
335 } 494 }
336 } 495 }
337 } 496 }
338@!egui */ 497@!egui */
339 box2 = eo_add(ELM_OBJ_BOX_CLASS, panes); 498
340 eo_unref(box2); 499 rpanel = elm_panel_add(hor_box);
341 eo_do(box2, evas_obj_visibility_set(EINA_TRUE)); 500 elm_panel_orient_set(rpanel, ELM_PANEL_ORIENT_RIGHT);
342 elm_object_part_content_set(panes, "right", box2); 501 eo_do(rpanel, evas_obj_visibility_set(EINA_TRUE));
502 elm_panel_hidden_set(rpanel, EINA_FALSE);
503 evas_object_size_hint_weight_set(rpanel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
504 evas_object_size_hint_align_set(rpanel, 1, EVAS_HINT_FILL);
505 elm_box_pack_end(hor_box, rpanel);
343 506
344/* @egui 507/* @egui
345{ 508{
346 "lst1": 509 "panes":
347 { 510 {
348 "Desc": 511 "Desc":
349 { 512 {
350 "parent":"box1", 513 "parent":"rpanel",
351 "class":"elm_genlist", 514 "class":"elm_panes",
352 "public":true 515 "public":true
353 }, 516 },
354 "Properties": 517 "Properties":
355 { 518 {
356 "visibility_set":[true], 519 "panes_horizontal": [true],
357 "size_hint_weight_set":[1, 1], 520 "size_hint_weight_set":[1, 1],
358 "size_hint_align_set":[-1, -1] 521 "size_hint_align_set":[-1, -1],
522 "content_set" : ["right", "box2", null],
523 "visibility_set":[true]
359 } 524 }
360 } 525 }
361 } 526 }
362@!egui */ 527@!egui */
363 lst1 = eo_add(ELM_OBJ_GENLIST_CLASS, box1); 528 panes = eo_add(ELM_OBJ_PANES_CLASS, rpanel);
364 eo_unref(lst1); 529 eo_unref(panes);
365 eo_do(lst1, evas_obj_visibility_set(EINA_TRUE)); 530 eo_do(panes, evas_obj_visibility_set(EINA_TRUE));
366 eo_do(lst1, evas_obj_size_hint_weight_set(1.000000, 1.000000)); 531 eo_do(panes, elm_obj_panes_horizontal_set(EINA_TRUE));
367 eo_do(lst1, evas_obj_size_hint_align_set(-1.000000, -1.000000)); 532 evas_object_size_hint_weight_set(panes, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
368 eo_do(box1, elm_obj_box_pack_end(lst1)); 533 evas_object_size_hint_align_set(panes, EVAS_HINT_FILL, EVAS_HINT_FILL);
534 elm_object_content_set(rpanel, panes);
535
536 Eo *table1;
537 table1 = eo_add(ELM_OBJ_TABLE_CLASS, rpanel);
538 eo_unref(table1);
539 eo_do(table1, evas_obj_visibility_set(EINA_TRUE));
540 elm_object_part_content_set(panes, "left", table1);
541
542 Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(egui_win));
543 evas_object_size_hint_min_set(rect, 500, 100);
544 evas_object_size_hint_weight_set(rect, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
545 evas_object_size_hint_align_set(rect, EVAS_HINT_FILL, EVAS_HINT_FILL);
546 elm_table_pack(table1, rect, 0, 0, 1, 1);
547
369/* @egui 548/* @egui
370{ 549{
371 "lst2": 550 "lst1":
372 { 551 {
373 "Desc": 552 "Desc":
374 { 553 {
375 "parent":"box2", 554 "parent":"table1",
376 "class":"elm_genlist", 555 "class":"elm_genlist",
377 "public":true 556 "public":true
378 }, 557 },
@@ -385,44 +564,49 @@ GUI* get_gui()
385 } 564 }
386 } 565 }
387@!egui */ 566@!egui */
388 lst2 = eo_add(ELM_OBJ_GENLIST_CLASS, box2); 567 lst1 = eo_add(ELM_OBJ_GENLIST_CLASS, table1);
389 eo_unref(lst2); 568 eo_unref(lst1);
390 eo_do(lst2, evas_obj_visibility_set(EINA_TRUE)); 569 eo_do(lst1, evas_obj_visibility_set(EINA_TRUE));
391 eo_do(lst2, evas_obj_size_hint_weight_set(1.000000, 1.000000)); 570 eo_do(lst1, evas_obj_size_hint_weight_set(1.000000, 1.000000));
392 eo_do(lst2, evas_obj_size_hint_align_set(-1.000000, -1.000000)); 571 eo_do(lst1, evas_obj_size_hint_align_set(-1.000000, -1.000000));
393 eo_do(box2, elm_obj_box_pack_end(lst2)); 572 elm_table_pack(table1, lst1, 0, 0, 1, 1);
394 573
574 Eo *table2;
575 table2 = eo_add(ELM_OBJ_TABLE_CLASS, rpanel);
576 eo_unref(table2);
577 eo_do(table2, evas_obj_visibility_set(EINA_TRUE));
578 elm_object_part_content_set(panes, "right", table2);
395/* @egui 579/* @egui
396{ 580{
397 "frame": 581 "lst2":
398 { 582 {
399 "Desc": 583 "Desc":
400 { 584 {
401 "parent":"egui_win", 585 "parent":"box2",
402 "class":"elm_frame", 586 "class":"elm_genlist",
403 "public":true 587 "public":true
404 }, 588 },
405 "Properties": 589 "Properties":
406 { 590 {
407 "autocollapse" : [true], 591 "visibility_set":[true],
408 "size_set" : [600, 70], 592 "size_hint_weight_set":[1, 1],
409 "part_text_set":[null, "Controls"], 593 "size_hint_align_set":[-1, -1]
410 "content_set" : [null, "bx", null],
411 "visibility_set":[true]
412 } 594 }
413 } 595 }
414 } 596 }
415@!egui */ 597@!egui */
416 frame = eo_add(ELM_OBJ_FRAME_CLASS, egui_win); 598
417 eo_unref(frame); 599 lst2 = eo_add(ELM_OBJ_GENLIST_CLASS, table2);
418 elm_object_text_set(frame, "Controls"); 600 eo_unref(lst2);
419 eo_do(frame, 601 eo_do(lst2, evas_obj_visibility_set(EINA_TRUE));
420 evas_obj_size_set(600, 70), 602 eo_do(lst2, evas_obj_size_hint_weight_set(1.0, 1.000000));
421 evas_obj_visibility_set(EINA_TRUE), 603 eo_do(lst2, evas_obj_size_hint_align_set(-1.000000, -1.000000));
422 elm_obj_frame_autocollapse_set(EINA_TRUE)); 604 elm_table_pack(table2, lst2, 0, 0, 1, 1);
605
606
423/* @egui 607/* @egui
424{ 608{
425 "bx": 609 "menu_box":
426 { 610 {
427 "Desc": 611 "Desc":
428 { 612 {
@@ -443,292 +627,32 @@ GUI* get_gui()
443 } 627 }
444 } 628 }
445@!egui */ 629@!egui */
446 bx = eo_add(ELM_OBJ_BOX_CLASS, egui_win); 630 menu_box = eo_add(ELM_OBJ_BOX_CLASS, egui_win);
447 eo_unref(bx); 631 eo_unref(menu_box);
448 eo_do(bx, evas_obj_visibility_set(EINA_TRUE)); 632 eo_do(menu_box, evas_obj_visibility_set(EINA_TRUE));
449 eo_do(bx, elm_obj_box_horizontal_set(EINA_TRUE)); 633 eo_do(menu_box, elm_obj_box_horizontal_set(EINA_TRUE));
450 elm_object_content_set(frame, bx); 634 eo_do(menu_box, evas_obj_size_set(600, 20));
451/* @egui 635 evas_object_size_hint_weight_set(menu_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
452{ 636 evas_object_size_hint_align_set(menu_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
453 "new_project_but": 637 elm_grid_pack(grid, menu_box, 0, 0, 100, 10);
454 { 638 //eo_do(egui_win, elm_obj_win_resize_object_add(menu_box));
455 "Desc":
456 {
457 "parent":"bx",
458 "class":"elm_button",
459 "public":true
460 },
461 "Properties":
462 {
463 "color_set":[0, 255, 120, 255],
464 "visibility_set":[true],
465 "part_text_set":[null, "New Project"],
466 "size_set":[150, 30]
467 }
468 }
469 }
470@!egui */
471 new_project_but = eo_add(ELM_OBJ_BUTTON_CLASS, bx);
472 eo_unref(new_project_but);
473 eo_do(new_project_but, evas_obj_color_set(0, 255, 120, 255));
474 eo_do(new_project_but, evas_obj_visibility_set(EINA_TRUE));
475 eo_do(new_project_but, elm_wdg_part_text_set(NULL, "New Project"));
476 eo_do(bx, elm_obj_box_pack_end(new_project_but));
477 639
478/* @egui 640 Eo *toolbar;
479{ 641 toolbar = elm_toolbar_add(egui_win);
480 "close_project_but": 642 elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_MENU);
481 { 643 elm_toolbar_select_mode_set(toolbar, ELM_OBJECT_SELECT_MODE_ALWAYS);
482 "Desc": 644 elm_object_style_set(toolbar, "item_centered");
483 { 645 evas_object_size_hint_weight_set(toolbar, 1.0, 1.0);
484 "parent":"bx", 646 evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, -1.0);
485 "class":"elm_button", 647 eo_do(toolbar, evas_obj_visibility_set(EINA_TRUE));
486 "public":true
487 },
488 "Properties":
489 {
490 "color_set":[0, 170, 120, 255],
491 "visibility_set":[true],
492 "part_text_set":[null, "Close Project"],
493 "size_set":[150, 30]
494 }
495 }
496 }
497@!egui */
498 close_project_but = eo_add(ELM_OBJ_BUTTON_CLASS, bx);
499 eo_unref(close_project_but);
500 eo_do(close_project_but, evas_obj_color_set(0, 170, 120, 255));
501 eo_do(close_project_but, evas_obj_visibility_set(EINA_TRUE));
502 eo_do(close_project_but, elm_wdg_part_text_set(NULL, "Close Project"));
503 eo_do(bx, elm_obj_box_pack_end(close_project_but));
504
505/* @egui
506{
507 "refresh_but":
508 {
509 "Desc":
510 {
511 "parent":"bx",
512 "class":"elm_button",
513 "public":true
514 },
515 "Properties":
516 {
517 "color_set":[255, 0, 0, 255],
518 "visibility_set":[true],
519 "part_text_set":[null, "Refresh context"],
520 "size_set":[150, 30]
521 }
522 }
523 }
524@!egui */
525 refresh_but = eo_add(ELM_OBJ_BUTTON_CLASS, bx);
526 eo_unref(refresh_but);
527 eo_do(refresh_but, evas_obj_color_set(255, 0, 0, 255));
528 eo_do(refresh_but, evas_obj_visibility_set(EINA_TRUE));
529 eo_do(refresh_but, elm_wdg_part_text_set(NULL, "Reload context"));
530 eo_do(bx, elm_obj_box_pack_end(refresh_but));
531
532/* @egui
533{
534 "file_open_but":
535 {
536 "Desc":
537 {
538 "parent":"bx",
539 "class":"elm_button",
540 "public":true
541 },
542 "Properties":
543 {
544 "part_text_set":[null, "Open"],
545 "visibility_set":[true]
546 }
547 }
548 }
549@!egui */
550 file_open_but = eo_add(ELM_OBJ_BUTTON_CLASS, bx);
551 eo_unref(file_open_but);
552 eo_do(file_open_but, evas_obj_visibility_set(EINA_TRUE));
553 eo_do(file_open_but, elm_wdg_part_text_set(NULL, "Open"));
554 eo_do(bx, elm_obj_box_pack_end(file_open_but));
555
556/* @egui
557{
558 "file_save_but":
559 {
560 "Desc":
561 {
562 "parent":"bx",
563 "class":"elm_button",
564 "public":true
565 },
566 "Properties":
567 {
568 "part_text_set":[null, "Save"],
569 "visibility_set":[true]
570 }
571 }
572 }
573@!egui */
574 file_save_but = eo_add(ELM_OBJ_BUTTON_CLASS, bx);
575 eo_unref(file_save_but);
576 eo_do(file_save_but, evas_obj_visibility_set(EINA_TRUE));
577 eo_do(file_save_but, elm_wdg_part_text_set(NULL, "Save"));
578 eo_do(bx, elm_obj_box_pack_end(file_save_but));
579
580/* @egui
581{
582 "file_save_as_but":
583 {
584 "Desc":
585 {
586 "parent":"bx",
587 "class":"elm_button",
588 "public":true
589 },
590 "Properties":
591 {
592 "part_text_set":[null, "Save As"],
593 "visibility_set":[true]
594 }
595 }
596 }
597@!egui */
598 file_save_as_but = eo_add(ELM_OBJ_BUTTON_CLASS, bx);
599 eo_unref(file_save_as_but);
600 eo_do(file_save_as_but, evas_obj_visibility_set(EINA_TRUE));
601 eo_do(file_save_as_but, elm_wdg_part_text_set(NULL, "Save As"));
602 eo_do(bx, elm_obj_box_pack_end(file_save_as_but));
603
604/* @egui
605{
606 "del_wdg_but":
607 {
608 "Desc":
609 {
610 "parent":"bx",
611 "class":"elm_button",
612 "public":true
613 },
614 "Properties":
615 {
616 "part_text_set":[null, "Delete Widget"],
617 "visibility_set":[true]
618 }
619 }
620 }
621@!egui */
622 del_wdg_but = eo_add(ELM_OBJ_BUTTON_CLASS, bx);
623 eo_unref(del_wdg_but);
624 eo_do(del_wdg_but, evas_obj_visibility_set(EINA_TRUE));
625 eo_do(del_wdg_but, elm_wdg_part_text_set(NULL, "Delete Widget"));
626 eo_do(bx, elm_obj_box_pack_end(del_wdg_but));
627 648
649 //elm_toolbar_standard_priority_set(toolbar, 0);
650 elm_box_pack_end(menu_box, toolbar);
628 651
629 /* Factory.*/ 652 /* Factory.*/
630/* @egui
631{
632 "lpanel":
633 {
634 "Desc":
635 {
636 "parent":"grid",
637 "class":"elm_panel",
638 "public":true
639 },
640 "Properties":
641 {
642 "panel_orient": ["ELM_PANEL_ORIENT_LEFT"],
643 "panel_hidden": [false],
644 "content_set" : [null, "fctr_table", null],
645 "visibility_set":[true]
646 }
647 }
648 }
649@!egui */
650 lpanel = elm_panel_add(grid);
651 elm_panel_orient_set(lpanel, ELM_PANEL_ORIENT_LEFT);
652 eo_do(lpanel, evas_obj_visibility_set(EINA_TRUE));
653 elm_panel_hidden_set(lpanel, EINA_FALSE);
654 evas_object_size_hint_weight_set(lpanel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
655 evas_object_size_hint_align_set(lpanel, EVAS_HINT_FILL, EVAS_HINT_FILL);
656 elm_grid_pack(grid, lpanel, 0, 15, 20, 50);
657
658 Eo *canvas_fr;
659 Eo *canvas_win;
660 Eo *canvas_bg;
661 canvas_fr = eo_add(ELM_OBJ_FRAME_CLASS, egui_win);
662 eo_unref(canvas_fr);
663 elm_object_text_set(canvas_fr, "Canvas");
664 eo_do(canvas_fr,
665 evas_obj_visibility_set(EINA_FALSE),
666 elm_obj_frame_autocollapse_set(EINA_TRUE));
667 evas_object_resize(canvas_fr, 600, 600);
668 evas_object_move(canvas_fr, 150, 100);
669
670 canvas_win = eo_add_custom(ELM_OBJ_WIN_CLASS, egui_win, elm_obj_win_constructor(NULL, ELM_WIN_INLINED_IMAGE));
671 eo_unref(canvas_win);
672 eo_do(canvas_win, evas_obj_visibility_set(EINA_TRUE));
673 evas_object_resize(canvas_win, 600, 600);
674
675 canvas_bg = eo_add(ELM_OBJ_BG_CLASS, canvas_win);
676 eo_unref(canvas_bg);
677 eo_do(canvas_bg, elm_obj_bg_color_set(230, 230, 230));
678 eo_do(canvas_bg, evas_obj_size_hint_weight_set(1.000000, 1.000000));
679 eo_do(canvas_bg, evas_obj_visibility_set(EINA_TRUE));
680 eo_do(canvas_win, elm_obj_win_resize_object_add(canvas_bg));
681
682 canvas = elm_win_inlined_image_object_get(canvas_win);
683 eo_do(canvas, evas_obj_visibility_set(EINA_TRUE));
684 //evas_object_size_hint_weight_set(canvas, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
685 //evas_object_size_hint_align_set(canvas, EVAS_HINT_FILL, EVAS_HINT_FILL);
686 //evas_object_resize(canvas, 200, 200);
687 //evas_object_move(canvas, 200, 200);
688 //elm_box_pack_end(canvas_box, canvas);
689 evas_object_propagate_events_set(canvas, EINA_FALSE);
690 elm_object_content_set(canvas_fr, canvas);
691 eo_do(canvas_fr, eo_base_data_set("canvas_win", canvas_win, NULL));
692
693 Eo *fctr_table, *hsp1, *hsp2, *vsp1, *vsp2;
694
695/* @egui
696{
697 "fctr_table":
698 {
699 "Desc":
700 {
701 "parent":"lpanel",
702 "class":"elm_table",
703 "public":true
704 },
705 "Properties":
706 {
707 "table_pack" : ["vsp1", 1, 0, 1, 5],
708 "table_pack" : ["vsp2", 3, 0, 1, 5],
709 "table_pack" : ["hsp1", 0, 1, 5, 1],
710 "table_pack" : ["hsp2", 0, 3, 5, 1],
711
712 "table_pack" : ["win_it", 0, 0, 1, 1],
713 "table_pack" : ["bg_it", 2, 0, 1, 1],
714 "table_pack" : ["box_it", 4, 0, 1, 1],
715
716 "table_pack" : ["button_it", 0, 2, 1, 1],
717 "table_pack" : ["label_it", 2, 2, 1, 1],
718 "table_pack" : ["check_it", 4, 2, 1, 1],
719 653
720 "table_pack" : ["icon_it", 0, 4, 1, 1], 654 Eo *hsp1, *hsp2, *vsp1, *vsp2;
721 "table_pack" : ["image_it", 2, 4, 1, 1], 655 Eo *it_img, *it_label;
722 "table_pack" : ["pbar_it", 4, 4, 1, 1]
723 "visibility_set":[true]
724 }
725 }
726 }
727@!egui */
728 fctr_table = eo_add(ELM_OBJ_TABLE_CLASS, lpanel);
729 eo_unref(fctr_table);
730 eo_do(fctr_table, evas_obj_visibility_set(EINA_TRUE));
731 elm_object_content_set(lpanel, fctr_table);
732 656
733/* @egui 657/* @egui
734{ 658{
@@ -750,7 +674,6 @@ GUI* get_gui()
750 /* Vertical separator. */ 674 /* Vertical separator. */
751 vsp1 = elm_separator_add(fctr_table); 675 vsp1 = elm_separator_add(fctr_table);
752 eo_do(vsp1, evas_obj_visibility_set(EINA_TRUE)); 676 eo_do(vsp1, evas_obj_visibility_set(EINA_TRUE));
753 elm_table_pack(fctr_table, vsp1, 1, 0, 1, 5);
754 677
755/* @egui 678/* @egui
756{ 679{
@@ -772,7 +695,6 @@ GUI* get_gui()
772 /* Vertical separator. */ 695 /* Vertical separator. */
773 vsp2 = elm_separator_add(fctr_table); 696 vsp2 = elm_separator_add(fctr_table);
774 eo_do(vsp2, evas_obj_visibility_set(EINA_TRUE)); 697 eo_do(vsp2, evas_obj_visibility_set(EINA_TRUE));
775 elm_table_pack(fctr_table, vsp2, 3, 0, 1, 5);
776 698
777 699
778 /* Horizontal separator. */ 700 /* Horizontal separator. */
@@ -797,7 +719,6