summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-10-26 10:27:00 +0200
committerYakov Goldberg <yakov.g@samsung.com>2014-10-27 10:27:32 +0200
commit6779a9e66b6bea463a2c125ea4381bf36b01d64c (patch)
treea848bf832392b3c1a07cb0c0a66d7c792b3fa78e
parent8eb961bbeae05fbe5154d347dbf81bc6593bce5c (diff)
Spit proview.c into prop_layout propview contentview and descview
-rw-r--r--src/bin/egui_gui/CMakeLists.txt3
-rw-r--r--src/bin/egui_gui/cbview.c38
-rw-r--r--src/bin/egui_gui/cbview.h3
-rw-r--r--src/bin/egui_gui/contentview.c266
-rw-r--r--src/bin/egui_gui/contentview.h14
-rw-r--r--src/bin/egui_gui/descview.c124
-rw-r--r--src/bin/egui_gui/descview.h14
-rw-r--r--src/bin/egui_gui/editor.c46
-rw-r--r--src/bin/egui_gui/egui_layout.json10
-rw-r--r--src/bin/egui_gui/prop_layout.c333
-rw-r--r--src/bin/egui_gui/prop_layout.h33
-rw-r--r--src/bin/egui_gui/props_helper.c105
-rw-r--r--src/bin/egui_gui/props_helper.h4
-rw-r--r--src/bin/egui_gui/propview.c833
-rw-r--r--src/bin/egui_gui/propview.h32
-rw-r--r--src/bin/egui_gui/propview_data.h11
-rw-r--r--src/bin/egui_gui/rmview.c8
17 files changed, 977 insertions, 900 deletions
diff --git a/src/bin/egui_gui/CMakeLists.txt b/src/bin/egui_gui/CMakeLists.txt
index 25986a3..7973272 100644
--- a/src/bin/egui_gui/CMakeLists.txt
+++ b/src/bin/egui_gui/CMakeLists.txt
@@ -61,6 +61,9 @@ add_executable(${TARGET}
61 objtree.c 61 objtree.c
62 propview.c 62 propview.c
63 cbview.c 63 cbview.c
64 descview.c
65 contentview.c
66 prop_layout.c
64 itemview.c 67 itemview.c
65 seqview.c 68 seqview.c
66 rmview.c 69 rmview.c
diff --git a/src/bin/egui_gui/cbview.c b/src/bin/egui_gui/cbview.c
index 8e4871e..8e8fe10 100644
--- a/src/bin/egui_gui/cbview.c
+++ b/src/bin/egui_gui/cbview.c
@@ -12,7 +12,10 @@
12#include "elm_widget_container.h" 12#include "elm_widget_container.h"
13 13
14static Elm_Genlist_Item_Class *_itc_cb = NULL; 14static Elm_Genlist_Item_Class *_itc_cb = NULL;
15static Elm_Genlist_Item_Class *_itc_class = NULL; 15
16extern Elm_Genlist_Item_Class *_itc_class;
17extern Elm_Genlist_Item_Class *_itc_notfound;
18
16static Eo *cb_list = NULL; 19static Eo *cb_list = NULL;
17static Eo *propview_table = NULL; 20static Eo *propview_table = NULL;
18 21
@@ -132,8 +135,7 @@ _callback_item_content_get(It_Data *it_data)
132 Dep_Id *dep_id = cb_sequence_id_get(cb); 135 Dep_Id *dep_id = cb_sequence_id_get(cb);
133 const char *default_str = NULL; 136 const char *default_str = NULL;
134 if (dep_id) 137 if (dep_id)
135 138 default_str = dep_name_get(dep_id);
136 default_str = dep_name_get(dep_id);
137 Eo *seqs_list = props_hoversel_seqs_add(box, elm_widget_top_get(propview_table), wdg_context_get(it_data->wdg), default_str, EINA_FALSE); 139 Eo *seqs_list = props_hoversel_seqs_add(box, elm_widget_top_get(propview_table), wdg_context_get(it_data->wdg), default_str, EINA_FALSE);
138 140
139 eo_do(seqs_list, evas_obj_size_hint_align_set(1, 0)); 141 eo_do(seqs_list, evas_obj_size_hint_align_set(1, 0));
@@ -346,7 +348,7 @@ cbview_build(const Gui_Widget *wdg)
346 } 348 }
347 //if filter search found nothing, yield an appropriate message to callbacks list 349 //if filter search found nothing, yield an appropriate message to callbacks list
348 if (filter && !elm_genlist_items_count(cb_list)) 350 if (filter && !elm_genlist_items_count(cb_list))
349 elm_genlist_item_append(cb_list, _itc_class, NULL, NULL, 351 elm_genlist_item_append(cb_list, _itc_notfound, NULL, NULL,
350 ELM_GENLIST_ITEM_NONE, NULL, NULL); 352 ELM_GENLIST_ITEM_NONE, NULL, NULL);
351} 353}
352 354
@@ -452,33 +454,11 @@ _callbacksview_del_btn_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, cons
452 return EO_CALLBACK_CONTINUE; 454 return EO_CALLBACK_CONTINUE;
453} 455}
454 456
455static char *
456_class_item_label_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
457{
458 Classname_Data *cl = data;
459 if (cl) return strdup(cl->classname);
460 else return strdup("No search results");
461}
462
463static void
464_class_item_del(void *data, Evas_Object *obj EINA_UNUSED)
465{
466 Classname_Data *cl = data;
467 free(cl->classname);
468 free(cl);
469}
470
471void 457void
472cbview_init() 458cbview_init()
473{ 459{
474 Egui_Layout_Widgets *g = egui_layout_gui_get(); 460 Egui_Layout_Widgets *g = egui_layout_gui_get();
475 if (!_itc_class) 461
476 {
477 _itc_class = elm_genlist_item_class_new();
478 _itc_class->item_style = "default";
479 _itc_class->func.text_get = _class_item_label_get;
480 _itc_class->func.del = _class_item_del;
481 }
482 if (!_itc_cb) 462 if (!_itc_cb)
483 { 463 {
484 _itc_cb = elm_genlist_item_class_new(); 464 _itc_cb = elm_genlist_item_class_new();
@@ -506,9 +486,5 @@ cbview_shutdown()
506 elm_genlist_item_class_free(_itc_cb); 486 elm_genlist_item_class_free(_itc_cb);
507 _itc_cb = NULL; 487 _itc_cb = NULL;
508 488
509 elm_genlist_item_class_free(_itc_class);
510 _itc_class = NULL;
511
512 eina_hash_free(expanded_classes); 489 eina_hash_free(expanded_classes);
513} 490}
514
diff --git a/src/bin/egui_gui/cbview.h b/src/bin/egui_gui/cbview.h
index ce1594a..3fd7119 100644
--- a/src/bin/egui_gui/cbview.h
+++ b/src/bin/egui_gui/cbview.h
@@ -11,4 +11,7 @@ cbview_build(const Gui_Widget *wdg);
11void 11void
12cbview_shutdown(void); 12cbview_shutdown(void);
13 13
14void
15cbview_item_selected_set(Dep_Id *cb_dep_id);
16
14#endif 17#endif
diff --git a/src/bin/egui_gui/contentview.c b/src/bin/egui_gui/contentview.c
new file mode 100644
index 0000000..97ea326
--- /dev/null
+++ b/src/bin/egui_gui/contentview.c
@@ -0,0 +1,266 @@
1#include <Elementary.h>
2#include <Eolian.h>
3
4#include "ffi_glue.h"
5#include "egui_log.h"
6#include "props_helper.h"
7#include "egui_logic_private.h"
8#include "propview_data.h"
9#include "contentview.h"
10
11#include "elm_widget_container.h"
12
13static Elm_Genlist_Item_Class *_itc_ctn = NULL;
14
15static Eo *ctn_list = NULL;
16
17extern PropViewCbs *_view_cbs;
18
19static Evas_Object *
20_content_item_content_get(It_Data *it_data)
21{
22 const Gui_Widget *wdg = it_data->wdg;
23 const Gui_Context *ctx = wdg_context_get(wdg);
24
25 unsigned int count, i;
26 count = db_op_desc_param_number_get(it_data->op_desc);
27
28 Eo *box = eo_add(ELM_BOX_CLASS, ctn_list);
29 eo_do(box, evas_obj_visibility_set(EINA_TRUE),
30 elm_obj_box_horizontal_set(EINA_TRUE),
31 elm_obj_box_padding_set(5, 0),
32 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0),
33 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 0)
34 );
35
36 it_data->box = box;
37
38 for (i = 0; i < count; i++)
39 {
40 /* Get value, for which we want to build field.
41 * If it is NULL, field will be build, for nth value in Op_Desc */
42 Gui_Value *val = ((it_data->prop) ? prop_value_nth_get(it_data->prop, i) : NULL);
43 Eo *obj = props_value_add(box, ctx, wdg, val, it_data->op_desc, i);
44 if (obj)
45 {
46 Par_Field_Data *pfd = calloc (1, sizeof(Par_Field_Data));
47 pfd->it_data = it_data;
48 pfd->par_idx = i;
49
50 eo_do(obj, eo_key_data_set(_STR_EDITOR, pfd, free));
51
52 if (eo_isa(obj, ELM_HOVERSEL_CLASS))
53 {
54 eo_do(obj, eo_event_callback_add(EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED,
55 _view_cbs->content_change_cb_func, NULL));
56 eo_do(obj, evas_obj_size_hint_weight_set(0, EVAS_HINT_EXPAND),
57 evas_obj_size_hint_align_set(0, EVAS_HINT_FILL));
58 }
59 else
60 {
61 eo_do(obj, eo_event_callback_add(ELM_ENTRY_EVENT_ACTIVATED, _view_cbs->content_change_cb_func, NULL));
62 }
63 }
64 else
65 {
66 ERR("Can't create field for %dnth parameter in \"%s\", \
67 probably this parameter is NULL pointer", i + 1, db_op_desc_op_name_get(it_data->op_desc));
68 }
69 }
70 return box;
71}
72
73void
74contentview_build(const Gui_Widget *wdg)
75{
76 Eina_List *ctn_items = NULL;
77 Eina_List *l;
78 int i = 0;
79 Object_Container_Item *ci;
80 It_Data *it_data;
81
82 eo_do(ctn_list, elm_obj_genlist_clear());
83
84 const char *wdg_name = wdg_obj_container_class_name_get(wdg);
85 Eina_Bool isbox = (wdg_name &&
86 (!strcmp(wdg_name, DB_DEF_BOX_CLASS) ||
87 !strcmp(wdg_name, DB_DEF_WIN_CLASS)));
88
89 Egui_Layout_Widgets *g = egui_layout_gui_get();
90 elm_object_disabled_set(g->main_win->contentview_down_btn, !isbox);
91 elm_object_disabled_set(g->main_win->contentview_up_btn, !isbox);
92
93 Eina_List *items_lst = wdg_obj_container_contents_list_get(wdg);
94
95 EINA_LIST_FOREACH(items_lst, l, ci)
96 {
97 Dep_Id *item_id = obj_container_item_dep_id_get(ci);
98 if (item_id && !wdg_get(item_id)) continue;
99
100 Gui_Widget_Property *prop = obj_container_item_prop_get(ci);
101 it_data = IT_DATA_BUILD(CONTENT_TYPE, wdg);
102 it_data->idx = i;
103 it_data->prop = prop;
104 it_data->op_desc = (Op_Desc *) prop_op_desc_get(prop);
105 i++;
106
107 ctn_items = eina_list_append(ctn_items, it_data);
108 }
109
110 /* Add empty fields. */
111 const char *wdg_class_name = wdg_class_name_get(wdg);
112 const char *name;
113 /* Add empty field for each type of container. */
114 EINA_LIST_FOREACH(db_class_inherit_containers_list_get(wdg_class_name), l, name)
115 {
116 const Op_Desc *op_desc = db_container_desc_op_desc_get(db_container_desc_get(name), CONTAINER_PACK);
117 it_data = IT_DATA_BUILD(CONTENT_TYPE, wdg);
118 it_data->idx = i;
119 it_data->op_desc = op_desc;
120 it_data->prop = NULL;
121
122 ctn_items = eina_list_append(ctn_items, it_data);
123 }
124
125 EINA_LIST_FREE(ctn_items, it_data)
126 elm_genlist_item_append(ctn_list, _itc_ctn, it_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
127}
128
129static void
130_content_select_item(const Gui_Widget_Property *prop)
131{
132 Elm_Object_Item *it = elm_genlist_first_item_get(ctn_list);
133 for (; it; it = elm_genlist_item_next_get(it))
134 {
135 It_Data *it_data = elm_object_item_data_get(it);
136 if (it_data->prop == prop)
137 {
138 elm_genlist_item_selected_set(it, EINA_TRUE);
139 break;
140 }
141 }
142}
143
144Eina_Bool
145_contentview_del_btn_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc, void *event_info)
146{
147 const Gui_Widget_Property *prev_prop = NULL;
148
149 Elm_Object_Item *glit = elm_genlist_selected_item_get(ctn_list);
150 if (!glit) return EO_CALLBACK_CONTINUE;
151
152 It_Data *it_data = elm_object_item_data_get(glit);
153 intptr_t idx = (intptr_t) it_data->idx;
154
155 it_data = elm_object_item_data_get(elm_genlist_item_next_get(glit));
156 if (it_data) prev_prop = it_data->prop;
157 if (!prev_prop)
158 {
159 it_data = elm_object_item_data_get(elm_genlist_item_prev_get(glit));
160 if (it_data) prev_prop = it_data->prop;
161 }
162
163 Eina_Bool ret = _view_cbs->content_delete_cb_func((void *)idx, obj, desc, event_info);
164 if (prev_prop) _content_select_item(prev_prop);
165
166 return ret;
167}
168
169Eina_Bool
170_contentview_up_btn_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc, void *event_info EINA_UNUSED)
171{
172 Elm_Object_Item *glit = elm_genlist_selected_item_get(ctn_list);
173 if (!glit) return EO_CALLBACK_CONTINUE;
174
175 It_Data *it_data = elm_object_item_data_get(glit);
176 const Gui_Widget_Property *prev_prop = it_data->prop;
177 intptr_t idx = it_data->idx;
178
179 Eina_Bool ret = _view_cbs->content_reorder_cb_func((void *)idx, obj, desc, (void *)(intptr_t)UP);
180 _content_select_item(prev_prop);
181
182 return ret;
183}
184
185Eina_Bool
186_contentview_down_btn_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc, void *event_info EINA_UNUSED)
187{
188 Elm_Object_Item *glit = elm_genlist_selected_item_get(ctn_list);
189 if (!glit) return EO_CALLBACK_CONTINUE;
190
191 It_Data *it_data = elm_object_item_data_get(glit);
192 const Gui_Widget_Property *prev_prop = it_data->prop;
193 intptr_t idx = it_data->idx;
194
195 Eina_Bool ret = _view_cbs->content_reorder_cb_func((void *)idx, obj, desc, (void *)(intptr_t)DOWN);
196 _content_select_item(prev_prop);
197
198 return ret;
199}
200
201static void
202_contents_item_del(void *data, Evas_Object *obj EINA_UNUSED)
203{
204 It_Data *it_data = data;
205
206 if (it_data->prop)
207 {
208 const char *fullname = db_op_desc_op_name_full_get(it_data->op_desc);
209 _mempool_cache_data_put(fullname, it_data->box);
210 }
211
212 _it_data_free(it_data);
213}
214
215static Evas_Object *
216_contents_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
217{
218 It_Data *it_data = data;
219
220 if (!it_data->prop) return _content_item_content_get(it_data);
221
222 if (it_data->box) return it_data->box;
223
224 const char *fullname = db_op_desc_op_name_full_get(it_data->op_desc);
225
226 Evas_Object * it_box = _mempool_cache_data_get(fullname);
227
228 if (!it_box)
229 {
230 it_box = _content_item_content_get(it_data);
231 eo_ref(it_box);
232 }
233 else
234 {
235 it_data->box = it_box;
236 _prop_field_update(it_data->prop, it_box, it_data);
237 }
238
239 return it_box;
240}
241
242void
243contentview_init(void)
244{
245 Egui_Layout_Widgets *g = egui_layout_gui_get();
246
247 ctn_list = g->main_win->contentview_list;
248
249 if (!_itc_ctn)
250 {
251 _itc_ctn = elm_genlist_item_class_new();
252 _itc_ctn->item_style = "full";
253 _itc_ctn->func.content_get = _contents_item_content_get;
254 _itc_ctn->func.del = _contents_item_del;
255 }
256}
257
258void
259contentview_shutdown(void)
260{
261 elm_genlist_item_class_free(_itc_ctn);
262 _itc_ctn = NULL;
263
264 eo_do(ctn_list, elm_obj_genlist_clear());
265 ctn_list = NULL;
266}
diff --git a/src/bin/egui_gui/contentview.h b/src/bin/egui_gui/contentview.h
new file mode 100644
index 0000000..cbd8662
--- /dev/null
+++ b/src/bin/egui_gui/contentview.h
@@ -0,0 +1,14 @@
1
2#ifndef _CONTENTVIEW_H
3#define _CONTENTVIEW_H
4
5void
6contentview_init(void);
7
8void
9contentview_build(const Gui_Widget *wdg);
10
11void
12contentview_shutdown(void);
13
14#endif \ No newline at end of file
diff --git a/src/bin/egui_gui/descview.c b/src/bin/egui_gui/descview.c
new file mode 100644
index 0000000..3c23d3e
--- /dev/null
+++ b/src/bin/egui_gui/descview.c
@@ -0,0 +1,124 @@
1#include <Elementary.h>
2#include <Eolian.h>
3
4#include "ffi_glue.h"
5#include "egui_log.h"
6#include "props_helper.h"
7#include "egui_logic_private.h"
8#include "propview_data.h"
9#include "descview.h"
10
11#include "elm_widget_container.h"
12
13static Elm_Genlist_Item_Class *_itc_desc = NULL;
14static Eo *desc_list = NULL;
15
16// Used to loop in _description_build function
17static char *descs[] = { DB_DEF_NAME, DB_DEF_CLASS, DB_DEF_PUBLIC, NULL };
18
19void
20descview_build(const Gui_Widget *wdg)
21{
22 eo_do(desc_list, elm_obj_genlist_clear());
23
24 int i;
25 for (i = 0; descs[i]; i++)
26 {
27 It_Data *it_data = IT_DATA_BUILD(DESCRIPTION_TYPE, wdg);
28 it_data->desc = descs[i];
29 elm_genlist_item_append(desc_list, _itc_desc, it_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
30 }
31}
32
33static Eina_Bool
34_wdg_public_change_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
35{
36 Eina_Bool state;
37 eo_do(obj, state = elm_obj_check_state_get());
38 wdg_public_set(data, state);
39
40 return EO_CALLBACK_CONTINUE;
41}
42
43static Eina_Bool
44_wdg_name_change_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
45{
46 Gui_Widget *wdg = data;
47 const char *str = NULL;
48 eo_do(obj, str = elm_obj_widget_part_text_get(NULL));
49 widget_name_change(wdg, str);
50
51 return EO_CALLBACK_CONTINUE;
52}
53
54static Evas_Object *
55_description_item_content_get(It_Data *it_data)
56{
57 Evas_Object *box = eo_add(ELM_BOX_CLASS, desc_list);
58 eo_do(box, evas_obj_visibility_set(EINA_TRUE),
59 elm_obj_box_horizontal_set(EINA_TRUE),
60 elm_obj_box_padding_set(5, 0),
61 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0),
62 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 0)
63 );
64
65 it_data->box = box;
66
67 Eo *label = eo_add(ELM_LABEL_CLASS, box);
68 eo_do(label, evas_obj_visibility_set(EINA_TRUE),
69 elm_obj_widget_part_text_set(NULL, it_data->desc));
70 eo_do(box, elm_obj_box_pack_end(label));
71
72 if (!strcmp(it_data->desc, DB_DEF_PUBLIC))
73 {
74 Eo *ck = props_check_add(box, wdg_public_get(it_data->wdg));
75 eo_do (ck, eo_event_callback_add(ELM_ENTRY_EVENT_CHANGED, _wdg_public_change_cb, it_data->wdg));
76 }
77 else if (!strcmp(it_data->desc, DB_DEF_NAME))
78 {
79 Eo *entry = props_entry_add(box, wdg_name_get(it_data->wdg), GUI_TYPE_STRING);
80 eo_do (entry, eo_event_callback_add(ELM_ENTRY_EVENT_ACTIVATED, _wdg_name_change_cb, it_data->wdg));
81 }
82 else if (!strcmp(it_data->desc, DB_DEF_CLASS))
83 {
84 Eo *entry = props_entry_add(box, wdg_class_name_get(it_data->wdg), GUI_TYPE_STRING);
85 elm_object_disabled_set(entry, EINA_TRUE);
86 }
87 return box;
88}
89
90static void
91_desc_item_del(void *data, Evas_Object *obj EINA_UNUSED)
92{
93 It_Data *it_data = data;
94 _it_data_free(it_data);
95}
96
97static Evas_Object *
98_desc_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
99{
100 return _description_item_content_get(data);
101}
102
103void
104descview_init(void)
105{
106 Egui_Layout_Widgets *g = egui_layout_gui_get();
107
108 desc_list = g->main_win->description_list;
109
110 if (!_itc_desc)
111 {
112 _itc_desc = elm_genlist_item_class_new();
113 _itc_desc->item_style = "full";
114 _itc_desc->func.content_get = _desc_item_content_get;
115 _itc_desc->func.del = _desc_item_del;
116 }
117}
118
119void
120descview_shutdown(void)
121{
122 eo_do(desc_list, elm_obj_genlist_clear());
123 desc_list = NULL;
124} \ No newline at end of file
diff --git a/src/bin/egui_gui/descview.h b/src/bin/egui_gui/descview.h
new file mode 100644
index 0000000..4c9d9ca
--- /dev/null
+++ b/src/bin/egui_gui/descview.h
@@ -0,0 +1,14 @@
1
2#ifndef _DESCVIEW_H
3#define _DESCVIEW_H
4
5void
6descview_init(void);
7
8void
9descview_build(const Gui_Widget *wdg);
10
11void
12descview_shutdown(void);
13
14#endif \ No newline at end of file
diff --git a/src/bin/egui_gui/editor.c b/src/bin/egui_gui/editor.c
index e3ea3f3..789ebf1 100644
--- a/src/bin/egui_gui/editor.c
+++ b/src/bin/egui_gui/editor.c
@@ -5,7 +5,7 @@
5#include "gui_widget.h" 5#include "gui_widget.h"
6#include "props_helper.h" 6#include "props_helper.h"
7#include "objtree.h" 7#include "objtree.h"
8#include "propview.h" 8#include "prop_layout.h"
9#include "itemview.h" 9#include "itemview.h"
10#include "gui_parser.h" 10#include "gui_parser.h"
11#include "egui_logic_private.h" 11#include "egui_logic_private.h"
@@ -1158,7 +1158,7 @@ _update_widget_on_undoredo(const Gui_Context *ctx, Dep_Id *wdg_id, Eina_Bool sta
1158 if (parent) _wdg_parent_win_reload(parent); 1158 if (parent) _wdg_parent_win_reload(parent);
1159 objtree_item_selected_set(wdg?wdg:parent); 1159 objtree_item_selected_set(wdg?wdg:parent);
1160 _editor_wdg_selected_set(wdg?wdg:parent); 1160 _editor_wdg_selected_set(wdg?wdg:parent);
1161 propview_build(wdg?wdg:parent); 1161 proplayout_build(wdg?wdg:parent);
1162} 1162}
1163 1163
1164/* Undo last action */ 1164/* Undo last action */
@@ -1194,7 +1194,7 @@ _editor_undo(const Gui_Context *ctx)
1194 wdg_prop_remove(wdg, new_prop); 1194 wdg_prop_remove(wdg, new_prop);
1195 } 1195 }
1196 1196
1197 propsview_view_switch(PROPERTY_TYPE); 1197 proplayout_view_switch(PROPERTY_TYPE);
1198 if (old_prop) 1198 if (old_prop)
1199 { 1199 {
1200 op_desc = prop_op_desc_get(old_prop); 1200 op_desc = prop_op_desc_get(old_prop);
@@ -1234,7 +1234,7 @@ _editor_undo(const Gui_Context *ctx)
1234 wdg_obj_container_unset(wdg); 1234 wdg_obj_container_unset(wdg);
1235 wdg_obj_container_set(wdg, old_container); 1235 wdg_obj_container_set(wdg, old_container);
1236 1236
1237 propsview_view_switch(CONTENT_TYPE); 1237 proplayout_view_switch(CONTENT_TYPE);
1238 _wdg_parent_win_reload(wdg); 1238 _wdg_parent_win_reload(wdg);
1239 _editor_wdg_selected_set(wdg); 1239 _editor_wdg_selected_set(wdg);
1240 objtree_item_selected_set(wdg); 1240 objtree_item_selected_set(wdg);
@@ -1257,7 +1257,7 @@ _editor_undo(const Gui_Context *ctx)
1257 Dep_Data *dep_data = gui_context_dep_data_get(item_container_item_dep_id_get(old_it)); 1257 Dep_Data *dep_data = gui_context_dep_data_get(item_container_item_dep_id_get(old_it));
1258 dep_data_item_set(dep_data, old_it); 1258 dep_data_item_set(dep_data, old_it);
1259 1259
1260 propsview_view_switch(CONTENT_TYPE); 1260 proplayout_view_switch(CONTENT_TYPE);
1261 _wdg_parent_win_reload(wdg); 1261 _wdg_parent_win_reload(wdg);
1262 _editor_wdg_selected_set(wdg); 1262 _editor_wdg_selected_set(wdg);
1263 objtree_item_selected_set(wdg); 1263 objtree_item_selected_set(wdg);
@@ -1281,7 +1281,7 @@ _editor_undo(const Gui_Context *ctx)
1281 Dep_Data *dep_data = gui_context_dep_data_get(cb_dep_id); 1281 Dep_Data *dep_data = gui_context_dep_data_get(cb_dep_id);
1282 dep_data_cb_set(dep_data, old_cb); 1282 dep_data_cb_set(dep_data, old_cb);
1283 1283
1284 propsview_view_switch(CALLBACK_TYPE); 1284 proplayout_view_switch(CALLBACK_TYPE);
1285 _editor_wdg_selected_set(wdg); 1285 _editor_wdg_selected_set(wdg);
1286 cbview_item_selected_set(cb_dep_id); 1286 cbview_item_selected_set(cb_dep_id);
1287 break; 1287 break;
@@ -1301,7 +1301,7 @@ _editor_undo(const Gui_Context *ctx)
1301 wdg_cb_container_unset(wdg); 1301 wdg_cb_container_unset(wdg);
1302 wdg_cb_container_set(wdg, old_cc); 1302 wdg_cb_container_set(wdg, old_cc);
1303 1303
1304 propsview_view_switch(CALLBACK_TYPE); 1304 proplayout_view_switch(CALLBACK_TYPE);
1305 _editor_wdg_selected_set(wdg); 1305 _editor_wdg_selected_set(wdg);
1306 break; 1306 break;
1307 } 1307 }
@@ -1362,7 +1362,7 @@ _editor_redo(const Gui_Context *ctx)
1362 op_desc = prop_op_desc_get(old_prop); 1362 op_desc = prop_op_desc_get(old_prop);
1363 } 1363 }
1364 1364
1365 propsview_view_switch(PROPERTY_TYPE); 1365 proplayout_view_switch(PROPERTY_TYPE);
1366 if (new_prop) 1366 if (new_prop)
1367 { 1367 {
1368 op_desc = prop_op_desc_get(new_prop); 1368 op_desc = prop_op_desc_get(new_prop);
@@ -1402,7 +1402,7 @@ _editor_redo(const Gui_Context *ctx)
1402 Dep_Data *dep_data = gui_context_dep_data_get(cb_dep_id); 1402 Dep_Data *dep_data = gui_context_dep_data_get(cb_dep_id);
1403 dep_data_cb_set(dep_data, new_cb); 1403 dep_data_cb_set(dep_data, new_cb);
1404 1404
1405 propsview_view_switch(CALLBACK_TYPE); 1405 proplayout_view_switch(CALLBACK_TYPE);
1406 _editor_wdg_selected_set(wdg); 1406 _editor_wdg_selected_set(wdg);
1407 cbview_item_selected_set(cb_dep_id); 1407 cbview_item_selected_set(cb_dep_id);
1408 break; 1408 break;
@@ -1422,7 +1422,7 @@ _editor_redo(const Gui_Context *ctx)
1422 wdg_cb_container_unset(wdg); 1422 wdg_cb_container_unset(wdg);
1423 wdg_cb_container_set(wdg, new_cc); 1423 wdg_cb_container_set(wdg, new_cc);
1424 1424
1425 propsview_view_switch(CALLBACK_TYPE); 1425 proplayout_view_switch(CALLBACK_TYPE);
1426 _editor_wdg_selected_set(wdg); 1426 _editor_wdg_selected_set(wdg);
1427 break; 1427 break;
1428 } 1428 }
@@ -1448,7 +1448,7 @@ _editor_redo(const Gui_Context *ctx)
1448 //manager_widget_content_unset_all(session, wdg, wdg_obj_container_class_name_get(wdg), MODE_EDITOR, NULL); 1448 //manager_widget_content_unset_all(session, wdg, wdg_obj_container_class_name_get(wdg), MODE_EDITOR, NULL);
1449 //manager_widget_content_add(session, wdg, MODE_EDITOR, NULL); 1449 //manager_widget_content_add(session, wdg, MODE_EDITOR, NULL);
1450 /* Update propview. */ 1450 /* Update propview. */
1451 propsview_view_switch(CONTENT_TYPE); 1451 proplayout_view_switch(CONTENT_TYPE);
1452 _wdg_parent_win_reload(wdg); 1452 _wdg_parent_win_reload(wdg);
1453 _editor_wdg_selected_set(wdg); 1453 _editor_wdg_selected_set(wdg);
1454 objtree_item_selected_set(wdg); 1454 objtree_item_selected_set(wdg);
@@ -1471,7 +1471,7 @@ _editor_redo(const Gui_Context *ctx)
1471 Dep_Data *dep_data = gui_context_dep_data_get(item_container_item_dep_id_get(new_it)); 1471 Dep_Data *dep_data = gui_context_dep_data_get(item_container_item_dep_id_get(new_it));
1472 dep_data_item_set(dep_data, new_it); 1472 dep_data_item_set(dep_data, new_it);
1473 1473
1474 propsview_view_switch(CONTENT_TYPE); 1474 proplayout_view_switch(CONTENT_TYPE);
1475 _wdg_parent_win_reload(wdg); 1475 _wdg_parent_win_reload(wdg);
1476 _editor_wdg_selected_set(wdg); 1476 _editor_wdg_selected_set(wdg);
1477 objtree_item_selected_set(wdg); 1477 objtree_item_selected_set(wdg);
@@ -1526,7 +1526,7 @@ _editor_ctx_call(const Gui_Context *ctx)
1526 * It will draw border around win, but widget was not selected yet. 1526 * It will draw border around win, but widget was not selected yet.
1527 * So need to hide border. */ 1527 * So need to hide border. */
1528 _editor_wdg_selected_set(NULL); 1528 _editor_wdg_selected_set(NULL);
1529 propview_build(NULL); 1529 proplayout_build(NULL);
1530 objtree_item_selected_set(NULL); 1530 objtree_item_selected_set(NULL);
1531 1531
1532 return EINA_TRUE; 1532 return EINA_TRUE;
@@ -1560,7 +1560,7 @@ _editor_selected_wdg_del_cb()
1560 { 1560 {
1561 _wdg_parent_win_reload(wdg); 1561 _wdg_parent_win_reload(wdg);
1562 } 1562 }
1563 propview_build(NULL); 1563 proplayout_build(NULL);
1564 1564
1565 /* Set selected widget: t.e. if I delete button, box will be selected after. 1565 /* Set selected widget: t.e. if I delete button, box will be selected after.
1566 * If I delete window, main item will be selected. */ 1566 * If I delete window, main item will be selected. */
@@ -1710,7 +1710,7 @@ editor_shutdown()
1710{ 1710{
1711 target_db_shutdown(); 1711 target_db_shutdown();
1712 seqview_shutdown(); 1712 seqview_shutdown();
1713 propview_shutdown(); 1713 proplayout_shutdown();
1714 itemview_shutdown(); 1714 itemview_shutdown();
1715 objtree_list_unset(); 1715 objtree_list_unset();
1716 1716
@@ -1917,7 +1917,7 @@ _prop_update_from_propview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Descr
1917 if (reload_win) 1917 if (reload_win)
1918 { 1918 {
1919 _wdg_parent_win_reload(wdg); 1919 _wdg_parent_win_reload(wdg);
1920 propview_build(NULL); 1920 proplayout_build(NULL);
1921 _editor_wdg_selected_set(wdg); 1921 _editor_wdg_selected_set(wdg);
1922 objtree_item_selected_set(wdg); 1922 objtree_item_selected_set(wdg);
1923 } 1923 }
@@ -1949,7 +1949,7 @@ _prop_del_from_propview(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Descript
1949 1949
1950 _wdg_parent_win_reload(wdg); 1950 _wdg_parent_win_reload(wdg);
1951 1951
1952 propview_build(NULL); 1952 proplayout_build(NULL);
1953 1953
1954 _editor_wdg_selected_set(wdg); 1954 _editor_wdg_selected_set(wdg);
1955 objtree_item_selected_set(wdg); 1955 objtree_item_selected_set(wdg);
@@ -1983,7 +1983,7 @@ _drop_property_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
1983 1983
1984 wdg_prop_remove((Gui_Widget *) wdg, (Gui_Widget_Property *) prop); 1984 wdg_prop_remove((Gui_Widget *) wdg, (Gui_Widget_Property *) prop);
1985 _wdg_parent_win_reload(wdg); 1985 _wdg_parent_win_reload(wdg);
1986 propview_build(NULL); 1986 proplayout_build(NULL);
1987 _editor_wdg_selected_set(wdg); 1987 _editor_wdg_selected_set(wdg);
1988 objtree_item_selected_set(wdg); 1988 objtree_item_selected_set(wdg);
1989 } 1989 }
@@ -2099,7 +2099,7 @@ _field_update_from_itemview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Desc
2099 2099
2100 /* Reloading all window. */ 2100 /* Reloading all window. */
2101 _wdg_parent_win_reload(wdg); 2101 _wdg_parent_win_reload(wdg);
2102 propview_build(NULL); 2102 proplayout_build(NULL);
2103 _editor_wdg_selected_set(wdg); 2103 _editor_wdg_selected_set(wdg);
2104 objtree_item_selected_set(wdg); 2104 objtree_item_selected_set(wdg);
2105 itemview_item_selected_set(new_wit); 2105 itemview_item_selected_set(new_wit);
@@ -2264,7 +2264,7 @@ _itemview_item_do_(unsigned int type)
2264 elm_object_item_disabled_set(g->main_win->toolbar_undo_it, EINA_FALSE); 2264 elm_object_item_disabled_set(g->main_win->toolbar_undo_it, EINA_FALSE);
2265 2265
2266 _wdg_parent_win_reload(wdg); 2266 _wdg_parent_win_reload(wdg);
2267 propview_build(NULL); 2267 proplayout_build(NULL);
2268 _editor_wdg_selected_set(wdg); 2268 _editor_wdg_selected_set(wdg);
2269 objtree_item_selected_set(wdg); 2269 objtree_item_selected_set(wdg);
2270 itemview_item_selected_set(it); 2270 itemview_item_selected_set(it);
@@ -2578,7 +2578,7 @@ _widget_selected_from_objtree(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUS
2578{ 2578{
2579 Gui_Widget *wdg = elm_object_item_data_get(event_info); 2579 Gui_Widget *wdg = elm_object_item_data_get(event_info);
2580 _editor_wdg_selected_set(wdg); 2580 _editor_wdg_selected_set(wdg);
2581 propview_build(wdg); 2581 proplayout_build(wdg);
2582 2582
2583 /* Make menu shown, when it is selected from objtree. */ 2583 /* Make menu shown, when it is selected from objtree. */
2584 if (wdg_is_container(wdg, DB_DEF_MENU_CLASS)) 2584 if (wdg_is_container(wdg, DB_DEF_MENU_CLASS))
@@ -2594,7 +2594,7 @@ _project_close(const Gui_Context *ctx)
2594{ 2594{
2595 /* Clear lists. */ 2595 /* Clear lists. */
2596 objtree_context_set(NULL); 2596 objtree_context_set(NULL);
2597 propview_build(NULL); 2597 proplayout_build(NULL);
2598 seqview_fill(NULL); 2598 seqview_fill(NULL);
2599 if (ctx) 2599 if (ctx)
2600 { 2600 {
@@ -2761,7 +2761,7 @@ editor_init(GuiLogicCbs *_guilogic_cbs)
2761 _guilogic_cbs->_project_new = _project_new; 2761 _guilogic_cbs->_project_new = _project_new;
2762 2762
2763 objtree_list_set(g->main_win->objtree_list); 2763 objtree_list_set(g->main_win->objtree_list);
2764 propview_init(); 2764 proplayout_init();
2765 seqview_init(g->main_win->seq_list); 2765 seqview_init(g->main_win->seq_list);
2766 itemview_init(g->main_win->itemview_list); 2766 itemview_init(g->main_win->itemview_list);
2767 target_db_init(); 2767 target_db_init();
diff --git a/src/bin/egui_gui/egui_layout.json b/src/bin/egui_gui/egui_layout.json
index 4f1f3db..2a74666 100644
--- a/src/bin/egui_gui/egui_layout.json
+++ b/src/bin/egui_gui/egui_layout.json
@@ -23,7 +23,7 @@
23 "_callbacksview_down_btn_clicked":"_callbacksview_down_btn_clicked", 23 "_callbacksview_down_btn_clicked":"_callbacksview_down_btn_clicked",
24 "_callbacksview_del_btn_clicked":"_callbacksview_del_btn_clicked", 24 "_callbacksview_del_btn_clicked":"_callbacksview_del_btn_clicked",
25 "_toolbar_item_sel_cb":"_toolbar_item_sel_cb", 25 "_toolbar_item_sel_cb":"_toolbar_item_sel_cb",
26 "_propsview_toolbar_clicked":"_propsview_toolbar_clicked", 26 "_proplayout_toolbar_clicked":"_proplayout_toolbar_clicked",
27 "_contentview_up_btn_clicked":"_contentview_up_btn_clicked", 27 "_contentview_up_btn_clicked":"_contentview_up_btn_clicked",
28 "_contentview_down_btn_clicked":"_contentview_down_btn_clicked", 28 "_contentview_down_btn_clicked":"_contentview_down_btn_clicked",
29 "_contentview_del_btn_clicked":"_contentview_del_btn_clicked" 29 "_contentview_del_btn_clicked":"_contentview_del_btn_clicked"
@@ -2540,7 +2540,7 @@
2540 "type":"regular", 2540 "type":"regular",
2541 "icon":"fonts", 2541 "icon":"fonts",
2542 "label":"Description", 2542 "label":"Description",
2543 "callback":"_propsview_toolbar_clicked" 2543 "callback":"_proplayout_toolbar_clicked"
2544 }, 2544 },
2545 "propsview_toolbar_prop_it": 2545 "propsview_toolbar_prop_it":
2546 { 2546 {
@@ -2548,7 +2548,7 @@
2548 "type":"regular", 2548 "type":"regular",
2549 "icon":"package_settings", 2549 "icon":"package_settings",
2550 "label":"Properties", 2550 "label":"Properties",
2551 "callback":"_propsview_toolbar_clicked" 2551 "callback":"_proplayout_toolbar_clicked"
2552 }, 2552 },
2553 "propsview_toolbar_cb_it": 2553 "propsview_toolbar_cb_it":
2554 { 2554 {
@@ -2556,7 +2556,7 @@
2556 "type":"regular", 2556 "type":"regular",
2557 "icon":"call-start", 2557 "icon":"call-start",
2558 "label":"Callbacks", 2558 "label":"Callbacks",
2559 "callback":"_propsview_toolbar_clicked" 2559 "callback":"_proplayout_toolbar_clicked"
2560 }, 2560 },
2561 "propsview_toolbar_cont_it": 2561 "propsview_toolbar_cont_it":
2562 { 2562 {
@@ -2564,7 +2564,7 @@
2564 "type":"regular", 2564 "type":"regular",
2565 "icon":"folder-open", 2565 "icon":"folder-open",
2566 "label":"Content", 2566 "label":"Content",
2567 "callback":"_propsview_toolbar_clicked" 2567 "callback":"_proplayout_toolbar_clicked"
2568 } 2568 }
2569 } 2569 }
2570 }, 2570 },
diff --git a/src/bin/egui_gui/prop_layout.c b/src/bin/egui_gui/prop_layout.c
new file mode 100644
index 0000000..761e605
--- /dev/null
+++ b/src/bin/egui_gui/prop_layout.c
@@ -0,0 +1,333 @@
1#include <Elementary.h>
2#include <Eolian.h>
3#include "ffi_glue.h"
4#include "egui_log.h"
5#include "props_helper.h"
6#include "egui_logic_private.h"
7#include "prop_layout.h"
8
9#include "elm_widget_container.h"
10
11Elm_Genlist_Item_Class *_itc_class = NULL;
12Elm_Genlist_Item_Class *_itc_notfound = NULL;
13
14extern Gui_Context *
15_active_context_get();
16
17PropViewCbs *_view_cbs = NULL;
18static It_Data_Type _proplayout_toolbar_selected_item_type = DESCRIPTION_TYPE;
19static It_Data_Type _new_type = DESCRIPTION_TYPE;
20
21void
22_it_data_free(void *data)
23{
24 It_Data *it_data = data;
25
26 if (!it_data) return;
27
28 /* If property wasn't assigned to any widget, this is property with default values.
29 * Delete it. */
30 if ((it_data->type == PROPERTY_TYPE) && (it_data->prop) && !prop_wdg_get(it_data->prop))
31 {
32 prop_ref((Gui_Widget_Property *) it_data->prop);
33 prop_unref((Gui_Widget_Property *) it_data->prop);
34 it_data->prop = NULL;
35 }
36
37 free(it_data);
38 it_data = NULL;
39}
40
41PropViewCbs *propview_cbs_get()
42{
43 if (!_view_cbs) _view_cbs = calloc(1, sizeof(*_view_cbs));
44 return _view_cbs;
45}
46
47static char *
48_class_item_label_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
49{
50 Classname_Data *cl = data;
51 return strdup(cl->classname);
52}
53
54static char *
55_notfound_item_text_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
56{
57 return strdup("No search results");
58}
59
60static void
61_class_item_del(void *data, Evas_Object *obj EINA_UNUSED)
62{
63 Classname_Data *cl = data;
64 free(cl->classname);
65 free(cl);
66}
67
68/* This callback is called in the end of propview_build()
69 * in order to switch between scrollbox for properties
70 * and genlist for items. */
71static void
72_proplayout_build_post_cb(const Gui_Widget *wdg, It_Data_Type new_type)
73{
74 Egui_Layout_Widgets *g = egui_layout_gui_get();
75 /* Unsetting view according to old selected toolbar's item. */
76 switch (_proplayout_toolbar_selected_item_type)
77 {
78 case DESCRIPTION_TYPE:
79 {
80 break;
81 }
82 case PROPERTY_TYPE:
83 {
84 break;
85 }
86 case CALLBACK_TYPE:
87 {
88 break;
89 }
90 case CONTENT_TYPE:
91 {
92 break;
93 }
94 case ITEM_TYPE:
95 {
96 eo_do(g->main_win->contentview_box, evas_obj_visibility_set(EINA_TRUE));
97 eo_do(g->main_win->itemview_box, evas_obj_visibility_set(EINA_FALSE));
98 break;
99 }
100 }
101
102 _proplayout_toolbar_selected_item_type = new_type;
103
104 /* Setting view according to new selected toolbar's item. */
105 eo_do(g->main_win->contentview_box, evas_obj_visibility_set(EINA_FALSE));
106 eo_do(g->main_win->properties_list, evas_obj_visibility_set(EINA_FALSE));
107 eo_do(g->main_win->itemview_box, evas_obj_visibility_set(EINA_FALSE));
108 eo_do(g->main_win->callbacksview_box, evas_obj_visibility_set(EINA_FALSE));
109 eo_do(g->main_win->description_list, evas_obj_visibility_set(EINA_FALSE));
110
111 switch (new_type)
112 {
113 case DESCRIPTION_TYPE:
114 {
115 eo_do(g->main_win->description_list, evas_obj_visibility_set(EINA_TRUE));
116 break;
117 }
118 case PROPERTY_TYPE:
119 {
120 eo_do(g->main_win->properties_list, evas_obj_visibility_set(EINA_TRUE));
121 break;
122 }
123 case CALLBACK_TYPE:
124 {
125 eo_do(g->main_win->callbacksview_box, evas_obj_visibility_set(EINA_TRUE));
126 break;
127 }
128 case CONTENT_TYPE:
129 {
130 eo_do(g->main_win->contentview_box, evas_obj_visibility_set(EINA_TRUE));
131 break;
132 }
133 case ITEM_TYPE:
134 {
135 eo_do(g->main_win->contentview_box, evas_obj_visibility_set(EINA_FALSE));
136 eo_do(g->main_win->itemview_box, evas_obj_visibility_set(EINA_TRUE));
137
138 if (wdg_is_container(wdg, DB_DEF_MENU_CLASS))
139 {
140 eo_do(g->main_win->itemview_add_item_nested_but, elm_obj_widget_disabled_set(EINA_FALSE));
141 eo_do(g->main_win->itemview_add_separator_but, elm_obj_widget_disabled_set(EINA_FALSE));
142 }
143 else if (wdg_is_container(wdg, DB_DEF_DISKSELECTOR_CLASS) ||
144 wdg_is_container(wdg, DB_DEF_CTXPOPUP_CLASS) ||
145 wdg_is_container(wdg, DB_DEF_TOOLBAR_CLASS) ||
146 wdg_is_container(wdg, DB_DEF_NAVIFRAME_CLASS))
147 {
148 eo_do(g->main_win->itemview_add_item_nested_but, elm_obj_widget_disabled_set(EINA_TRUE));
149 eo_do(g->main_win->itemview_add_separator_but, elm_obj_widget_disabled_set(EINA_TRUE));
150 }
151 break;
152 }
153 }
154}
155
156/* Build property view for current widget.
157 * Show propeties, which defined in class hyerarchy
158 * for current widget's class. And fill fields, if property
159 * is defined for current widget.(or put default values into fields.)
160 * Called, when item in objtree is selected. */
161void
162proplayout_build(const Gui_Widget *wdg)
163{
164 It_Data_Type type = _new_type;
165
166 if (!wdg) return;
167
168 /* type ITEM_TYPE not assigned to any toolbar's item.
169 * It's assigned when toolbar's item is CONTENT and widget is menu.
170 * So if current type is ITEM_TYPEm we need to assign it to CONTENT_TYPE,
171 * and it will be resolved according to widget's type. */
172 if (type == ITEM_TYPE) type = CONTENT_TYPE;
173
174 if ((type == CONTENT_TYPE) &&
175 (wdg_is_container(wdg, DB_DEF_MENU_CLASS) ||
176 wdg_is_container(wdg, DB_DEF_DISKSELECTOR_CLASS) ||
177 wdg_is_container(wdg, DB_DEF_CTXPOPUP_CLASS) ||
178 wdg_is_container(wdg, DB_DEF_TOOLBAR_CLASS) ||
179 wdg_is_container(wdg, DB_DEF_NAVIFRAME_CLASS)))
180 {
181 type = ITEM_TYPE;
182 }
183
184 switch(type)
185 {
186 case DESCRIPTION_TYPE:
187 {
188 descview_build(wdg);
189 break;
190 }
191 case PROPERTY_TYPE:
192 {
193 propview_build(wdg);
194 break;
195 }
196 case CALLBACK_TYPE:
197 {
198 cbview_build(wdg);
199 break;
200 }
201 case CONTENT_TYPE:
202 {
203 contentview_build(wdg);
204 break;
205 }
206 case ITEM_TYPE:
207 {
208 itemview_clear();
209 itemview_build(wdg);
210 break;
211 }
212 default:
213 ERR("switch default");
214 }
215 _proplayout_build_post_cb(wdg, type);
216}
217
218/* FIXME: need to change signature to Eo_Callback, when it will be supported.
219 * This callback is used in Egui Layout JSON. */
220void
221_proplayout_toolbar_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
222//(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
223{
224 Elm_Object_Item *it = event_info;
225 elm_toolbar_item_selected_set(it, EINA_TRUE);
226 const Gui_Context *ctx = _active_context_get();
227 if (!ctx) return;
228 const Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG);
229 _new_type = (int) (intptr_t) elm_object_item_data_get(it);
230 proplayout_build(wdg);
231}
232
233/* API to switch proplayout Description->Properties->Callbacks->Contents */
234void
235proplayout_view_switch(It_Data_Type type)
236{
237 Elm_Object_Item *it;
238 Egui_Layout_Widgets *g = egui_layout_gui_get();
239 switch (type)
240 {
241 case PROPERTY_TYPE:
242 {
243 it = g->main_win->propsview_toolbar_prop_it;
244 break;
245 }
246 case CALLBACK_TYPE:
247 {
248 it = g->main_win->propsview_toolbar_cb_it;
249 break;
250 }
251 case DESCRIPTION_TYPE:
252 {
253 it = g->main_win->propsview_toolbar_desc_it;
254 break;
255 }
256 /* Currently ITEM_TYPE cannot appear here.
257 * This case is only to shut compiler up. */
258 case ITEM_TYPE:
259 case CONTENT_TYPE:
260 {
261 it = g->main_win->propsview_toolbar_cont_it;
262 break;
263 }
264 }
265 _proplayout_toolbar_clicked(NULL, NULL, it);
266}
267
268static Eina_Bool
269_proplayout_filter_entry_changed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
270 const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
271{
272 const Gui_Context *ctx = _active_context_get();
273 if (!ctx) return EO_CALLBACK_CONTINUE;
274 const Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG);
275 proplayout_build(wdg);
276
277 return EO_CALLBACK_CONTINUE;
278}
279
280void
281proplayout_init()
282{
283 if (!_itc_class)
284 {
285 _itc_class = elm_genlist_item_class_new();
286 _itc_class->item_style = "default";
287 _itc_class->func.text_get = _class_item_label_get;
288 _itc_class->func.del = _class_item_del;
289 }
290
291 if (!_itc_notfound)
292 {
293 _itc_notfound = elm_genlist_item_class_new();
294 _itc_notfound->item_style = "default";
295 _itc_notfound->func.text_get = _notfound_item_text_get;
296 }
297
298 Egui_Layout_Widgets *g = egui_layout_gui_get();
299
300 cbview_init();
301 descview_init();
302 contentview_init();
303 propview_init();
304
305 /* Put it here, because it Enums defined in propsview.h */
306 elm_object_item_data_set(g->main_win->propsview_toolbar_desc_it, (void *) (intptr_t) DESCRIPTION_TYPE);
307 elm_object_item_data_set(g->main_win->propsview_toolbar_prop_it, (void *) (intptr_t) PROPERTY_TYPE);
308 elm_object_item_data_set(g->main_win->propsview_toolbar_cb_it, (void *) (intptr_t) CALLBACK_TYPE);
309 elm_object_item_data_set(g->main_win->propsview_toolbar_cont_it, (void *) (intptr_t) CONTENT_TYPE);
310
311 eo_do(g->main_win->propsview_filter_entry,
312 eo_event_callback_add(ELM_ENTRY_EVENT_CHANGED_USER,
313 _proplayout_filter_entry_changed_cb,
314 NULL));
315
316 _mempool_cache_init();
317}
318
319void
320proplayout_shutdown()
321{
322 elm_genlist_item_class_free(_itc_class);
323 _itc_class = NULL;
324 elm_genlist_item_class_free(_itc_notfound);
325 _itc_notfound = NULL;
326
327 cbview_shutdown();
328 descview_shutdown();
329 contentview_shutdown();
330 propview_shutdown();
331
332 _mempool_cache_free();
333} \ No newline at end of file
diff --git a/src/bin/egui_gui/prop_layout.h b/src/bin/egui_gui/prop_layout.h
new file mode 100644
index 0000000..1886b7a
--- /dev/null
+++ b/src/bin/egui_gui/prop_layout.h
@@ -0,0 +1,33 @@
1
2#ifndef _PROPLAYOUT_H
3#define _PROPLAYOUT_H
4
5#include <Eo.h>
6#include <Evas.h>
7
8#include "propview.h"
9#include "itemview.h"
10#include "cbview.h"
11#include "descview.h"
12#include "contentview.h"
13
14#include "propview_data.h"
15
16PropViewCbs *
17propview_cbs_get();
18
19void
20proplayout_init();
21
22void
23proplayout_shutdown();
24
25//Change
26void
27proplayout_build(const Gui_Widget *wdg);
28
29/* API to switch propsview Description->Properties->Callbacks->Contents */
30void
31proplayout_view_switch(It_Data_Type type);
32
33#endif
diff --git a/src/bin/egui_gui/props_helper.c b/src/bin/egui_gui/props_helper.c
index 2a7c029..d8f5675 100644
--- a/src/bin/egui_gui/props_helper.c
+++ b/src/bin/egui_gui/props_helper.c
@@ -41,6 +41,111 @@ _str_nocase_prefix(const char *str, const char *prefix)
41} 41}
42 42
43void 43void
44_prop_field_update(const Gui_Widget_Property *prop, Eo *item_box, It_Data *it_data)
45{
46 Eina_List *box_list, *box_list_itr, *par_list, *l;
47 Gui_Value *val;
48 int i = 0;
49
50 /* Need to free box_list in the end*/
51 eo_do(item_box, box_list = elm_obj_box_children_get());
52 box_list_itr = box_list;
53 par_list = prop_value_get(prop);
54
55 EINA_LIST_FOREACH(par_list, l, val)
56 {
57 Eo *o = NULL;
58 Par_Field_Data *pfd = NULL;
59
60 // Only fields that have a Par_Field_Data attached to them interest us.
61 // Iterate over the next elements of the box until such element is found
62 // and reassign it_data to it if needed.
63 while (box_list_itr)
64 {
65 o = eina_list_data_get(box_list_itr);
66 eo_do(o, pfd = (Par_Field_Data *) eo_key_data_get(_STR_EDITOR));
67 box_list_itr = eina_list_next(box_list_itr);
68 if (pfd)
69 {
70 if (it_data) pfd->it_data = it_data;
71 break;
72 }
73 }
74
75 if (!(box_list_itr || pfd)) break;
76
77 Gui_Type t = gui_value_type_get(val);
78
79 /* Create edit field for each parameter. */
80 switch (t)
81 {
82 case GUI_TYPE_SINT:
83 {
84 char str[15];
85 int int_v = INT_GET(prop_value_nth_get(prop, i));
86 sprintf(str, "%d", int_v);
87 /* Add this callback in order to avoid _prop_update_from_propview cb to be called. */
88 elm_entry_entry_set(o, str);
89 break;
90 }
91 case GUI_TYPE_STRING:
92 {
93 char *str = STRING_GET(prop_value_nth_get(prop, i));
94 elm_entry_entry_set(o, str);
95 break;
96 }
97 case GUI_TYPE_FILE:
98 {
99 eo_do(o, elm_obj_hoversel_clear());
100 props_hoversel_resource_files_add(NULL, o, NULL, NULL, wdg_context_get(it_data->wdg));
101
102 Dep_Id *dep_id = DEP_ID_GET(prop_value_nth_get(prop, i));
103 const char *default_str = PROP_HOVERSEL_NONE_VALUE;
104 if (dep_id)
105 default_str = dep_name_get(dep_id);
106 eo_do(o, elm_obj_widget_part_text_set(NULL, default_str));
107 break;
108 }
109 case GUI_TYPE_OBJECT:
110 {
111 eo_do(o, elm_obj_hoversel_clear());
112 props_hoversel_objects_add(NULL, o, NULL, NULL, gui_context_wdg_list_get(wdg_context_get(it_data->wdg)), it_data->wdg);
113 Dep_Id *dep_id = DEP_ID_GET(prop_value_nth_get(prop, i));
114 const char *default_str = PROP_HOVERSEL_NONE_VALUE;
115 if (dep_id)
116 default_str = dep_name_get(dep_id);
117 eo_do(o, elm_obj_widget_part_text_set(NULL, default_str));
118 break;
119 }
120 case GUI_TYPE_DOUBLE:
121 {
122 char str[30];
123 double d = DOUBLE_GET(prop_value_nth_get(prop, i));
124 sprintf(str, "%f", d);
125 elm_entry_entry_set(o, str);
126 break;
127 }
128 case GUI_TYPE_BOOL:
129 {
130 Eina_Bool state = BOOL_GET(prop_value_nth_get(prop, i));
131 elm_check_state_set(o, state);
132 break;
133 }
134 case GUI_TYPE_ENUM:
135 {
136 char *default_str = STRING_GET(prop_value_nth_get(prop, i));
137 elm_object_text_set(o, default_str);
138 break;
139 }
140 default:
141 ERR("switch default for type: %s of property %s", db_gui_type_name_get(t), prop_name_get(prop));
142 }
143 i++; /*Because first item in box list is label*/
144 }
145 eina_list_free(box_list);
146}
147
148void
44_mempool_hash_del(void* data) 149_mempool_hash_del(void* data)
45{ 150{
46 Eo* obj = NULL; 151 Eo* obj = NULL;
diff --git a/src/bin/egui_gui/props_helper.h b/src/bin/egui_gui/props_helper.h
index a840993..eca69da 100644
--- a/src/bin/egui_gui/props_helper.h
+++ b/src/bin/egui_gui/props_helper.h
@@ -3,6 +3,7 @@
3 3
4#include <Evas.h> 4#include <Evas.h>
5#include "gui_widget.h" 5#include "gui_widget.h"
6#include "propview_data.h"
6 7
7#define PROP_HOVERSEL_NONE_VALUE " " 8#define PROP_HOVERSEL_NONE_VALUE " "
8 9
@@ -43,6 +44,9 @@ Eina_Bool
43_str_nocase_prefix(const char *str, const char *prefix); 44_str_nocase_prefix(const char *str, const char *prefix);
44 45
45void 46void
47_prop_field_update(const Gui_Widget_Property *prop, Eo *item_box, It_Data *it_data);
48
49void
46_mempool_hash_del(void* data); 50_mempool_hash_del(void* data);
47void 51void
48_mempool_cache_init(); 52_mempool_cache_init();
diff --git a/src/bin/egui_gui/propview.c b/src/bin/egui_gui/propview.c
index 4d9de50..ee593f4 100644
--- a/src/bin/egui_gui/propview.c
+++ b/src/bin/egui_gui/propview.c
@@ -1,56 +1,19 @@
1
2#include <Elementary.h> 1#include <Elementary.h>
3#include <Eolian.h> 2#include <Eolian.h>
4#include "ffi_glue.h" 3#include "ffi_glue.h"
5#include "egui_log.h" 4#include "egui_log.h"
6#include "props_helper.h" 5#include "props_helper.h"
7#include "propview.h"
8#include "itemview.h"
9#include "egui_logic_private.h" 6#include "egui_logic_private.h"
10#include "cbview.h" 7#include "propview.h"
11 8
12#include "elm_widget_container.h" 9#include "elm_widget_container.h"
13 10
14static Elm_Genlist_Item_Class *_itc_class = NULL; 11extern Elm_Genlist_Item_Class *_itc_class;
12extern Elm_Genlist_Item_Class *_itc_notfound;
13
15static Elm_Genlist_Item_Class *_itc_prop = NULL; 14static Elm_Genlist_Item_Class *_itc_prop = NULL;
16static Elm_Genlist_Item_Class *_itc_notfound = NULL;
17static Elm_Genlist_Item_Class *_itc_desc = NULL;
18static Elm_Genlist_Item_Class *_itc_ctn = NULL;
19 15
20static Eo *propview_table = NULL;
21static Eo *prop_list = NULL; 16static Eo *prop_list = NULL;
22static Eo *desc_list = NULL;
23static Eo *ctn_list = NULL;
24
25extern Gui_Context *
26_active_context_get();
27
28static PropViewCbs *_view_cbs = NULL;
29static It_Data_Type _propsview_toolbar_selected_item_type = DESCRIPTION_TYPE;
30static It_Data_Type _new_type = DESCRIPTION_TYPE;
31
32void
33_it_data_free(void *data)
34{
35 It_Data *it_data = data;
36
37 if (!it_data) return;
38
39 /* If property wasn't assigned to any widget, this is property with default values.
40 * Delete it. */
41 if ((it_data->type == PROPERTY_TYPE) && (it_data->prop) && !prop_wdg_get(it_data->prop))
42 {
43 prop_ref((Gui_Widget_Property *) it_data->prop);
44 prop_unref((Gui_Widget_Property *) it_data->prop);
45 it_data->prop = NULL;
46 }
47
48 free(it_data);
49 it_data = NULL;
50}
51
52#define _PATH_ICON_UP_ARROW PACKAGE_DATA_DIR"/images/icon_up_arrow.png"
53#define _PATH_ICON_DOWN_ARROW PACKAGE_DATA_DIR"/images/icon_down_arrow.png"
54 17
55/* 18/*
56 * Hash table to map op to proplist's item. 19 * Hash table to map op to proplist's item.
@@ -61,53 +24,7 @@ static Eina_Hash *op_item_table = NULL;
61/* Hash table to keep the list of expanded classes */ 24/* Hash table to keep the list of expanded classes */
62static Eina_Hash *expanded_classes = NULL; 25static Eina_Hash *expanded_classes = NULL;
63 26
64static Evas_Object * 27extern PropViewCbs *_view_cbs;
65_item_content_get(It_Data *it_data);
66
67static Eina_Bool
68_content_item_content_get(It_Data *it_data)
69{
70 Eo *box = it_data->box;
71 const Gui_Widget *wdg = it_data->wdg;
72 const Gui_Context *ctx = wdg_context_get(wdg);
73
74 unsigned int count, i;
75 count = db_op_desc_param_number_get(it_data->op_desc);
76
77 for (i = 0; i < count; i++)
78 {
79 /* Get value, for which we want to build field.
80 * If it is NULL, field will be build, for nth value in Op_Desc */
81 Gui_Value *val = ((it_data->prop) ? prop_value_nth_get(it_data->prop, i) : NULL);
82 Eo *obj = props_value_add(box, ctx, wdg, val, it_data->op_desc, i);
83 if (obj)
84 {
85 Par_Field_Data *pfd = calloc (1, sizeof(Par_Field_Data));
86 pfd->it_data = it_data;
87 pfd->par_idx = i;
88
89 eo_do(obj, eo_key_data_set(_STR_EDITOR, pfd, free));
90
91 if (eo_isa(obj, ELM_HOVERSEL_CLASS))
92 {
93 eo_do(obj, eo_event_callback_add(EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED,
94 _view_cbs->content_change_cb_func, NULL));
95 eo_do(obj, evas_obj_size_hint_weight_set(0, EVAS_HINT_EXPAND),
96 evas_obj_size_hint_align_set(0, EVAS_HINT_FILL));
97 }
98 else
99 {
100 eo_do(obj, eo_event_callback_add(ELM_ENTRY_EVENT_ACTIVATED, _view_cbs->content_change_cb_func, NULL));
101 }
102 }
103 else
104 {
105 ERR("Can't create field for %dnth parameter in \"%s\", \
106 probably this parameter is NULL pointer", i + 1, db_op_desc_op_name_get(it_data->op_desc));
107 }
108 }
109 return EINA_TRUE;
110}
111 28
112static Eina_Bool 29static Eina_Bool
113_default_hover_selected_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info) 30_default_hover_selected_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
@@ -135,10 +52,19 @@ _default_hover_selected_cb(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Descr
135 return EO_CALLBACK_CONTINUE; 52 return EO_CALLBACK_CONTINUE;
136} 53}
137 54
138static Eina_Bool 55static Evas_Object *
139_property_item_content_get(It_Data *it_data) 56_property_item_content_get(It_Data *it_data)
140{ 57{
141 Eo *box = it_data->box; 58 Eo *box = eo_add(ELM_BOX_CLASS, prop_list);
59 eo_do(box, evas_obj_visibility_set(EINA_TRUE),
60 elm_obj_box_horizontal_set(EINA_TRUE),
61 elm_obj_box_padding_set(5, 0),
62 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0),
63 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 0)
64 );
65
66 it_data->box = box;
67
142 const Op_Desc *op = it_data->op_desc; 68 const Op_Desc *op = it_data->op_desc;
143 const Gui_Widget_Property *prop = it_data->prop; 69 const Gui_Widget_Property *prop = it_data->prop;
144 /* Add label with op name. */ 70 /* Add label with op name. */
@@ -205,223 +131,9 @@ _property_item_content_get(It_Data *it_data)
205 } 131 }
206 } 132 }
207 133
208 return EINA_TRUE;
209}
210
211static Eina_Bool
212_wdg_public_change_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
213{
214 Eina_Bool state;
215 eo_do(obj, state = elm_obj_check_state_get());
216 wdg_public_set(data, state);
217
218 return EO_CALLBACK_CONTINUE;
219}
220
221static Eina_Bool
222_wdg_name_change_cb(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
223{
224 Gui_Widget *wdg = data;
225 const char *str = NULL;
226 eo_do(obj, str = elm_obj_widget_part_text_get(NULL));
227 widget_name_change(wdg, str);
228
229 return EO_CALLBACK_CONTINUE;
230}
231
232// Updates property visual box according to the specified propertiy.
233// if it_data is given, also reassigns it to all of the fields
234static void
235_prop_field_update(const Gui_Widget_Property *prop, Eo *item_box, It_Data *it_data)
236{
237 Eina_List *box_list, *box_list_itr, *par_list, *l;
238 Gui_Value *val;
239 int i = 0;
240
241 /* Need to free box_list in the end*/
242 eo_do(item_box, box_list = elm_obj_box_children_get());
243 box_list_itr = box_list;
244 par_list = prop_value_get(prop);
245
246 EINA_LIST_FOREACH(par_list, l, val)
247 {
248 Eo *o = NULL;
249 Par_Field_Data *pfd = NULL;
250
251 // Only fields that have a Par_Field_Data attached to them interest us.
252 // Iterate over the next elements of the box until such element is found
253 // and reassign it_data to it if needed.
254 while (box_list_itr)
255 {
256 o = eina_list_data_get(box_list_itr);
257 eo_do(o, pfd = (Par_Field_Data *) eo_key_data_get(_STR_EDITOR));
258 box_list_itr = eina_list_next(box_list_itr);
259 if (pfd)
260 {
261 if (it_data) pfd->it_data = it_data;
262 break;
263 }
264 }
265
266 if (!(box_list_itr || pfd)) break;
267
268 Gui_Type t = gui_value_type_get(val);
269
270 /* Create edit field for each parameter. */
271 switch (t)
272 {
273 case GUI_TYPE_SINT:
274 {
275 char str[15];
276 int int_v = INT_GET(prop_value_nth_get(prop, i));
277 sprintf(str, "%d", int_v);
278 /* Add this callback in order to avoid _prop_update_from_propview cb to be called. */
279 elm_entry_entry_set(o, str);
280 break;
281 }
282 case GUI_TYPE_STRING:
283 {
284 char *str = STRING_GET(prop_value_nth_get(prop, i));
285 elm_entry_entry_set(o, str);
286 break;
287 }
288 case GUI_TYPE_FILE:
289 {
290 eo_do(o, elm_obj_hoversel_clear());
291 props_hoversel_resource_files_add(NULL, o, NULL, NULL, wdg_context_get(it_data->wdg));
292
293 Dep_Id *dep_id = DEP_ID_GET(prop_value_nth_get(prop, i));
294 const char *default_str = PROP_HOVERSEL_NONE_VALUE;
295 if (dep_id)
296 default_str = dep_name_get(dep_id);
297 eo_do(o, elm_obj_widget_part_text_set(NULL, default_str));
298 break;
299 }
300 case GUI_TYPE_OBJECT:
301 {
302 eo_do(o, elm_obj_hoversel_clear());
303 props_hoversel_objects_add(NULL, o, NULL, NULL, gui_context_wdg_list_get(wdg_context_get(it_data->wdg)), it_data->wdg);
304 Dep_Id *dep_id = DEP_ID_GET(prop_value_nth_get(prop, i));
305 const char *default_str = PROP_HOVERSEL_NONE_VALUE;
306 if (dep_id)
307 default_str = dep_name_get(dep_id);
308 eo_do(o, elm_obj_widget_part_text_set(NULL, default_str));
309 break;
310 }
311 case GUI_TYPE_DOUBLE:
312 {
313 char str[30];
314 double d = DOUBLE_GET(prop_value_nth_get(prop, i));
315 sprintf(str, "%f", d);
316 elm_entry_entry_set(o, str);
317 break;
318 }
319 case GUI_TYPE_BOOL:
320 {
321 Eina_Bool state = BOOL_GET(prop_value_nth_get(prop, i));
322 elm_check_state_set(o, state);
323 break;
324 }
325 case GUI_TYPE_ENUM:
326 {
327 char *default_str = STRING_GET(prop_value_nth_get(prop, i));
328 elm_object_text_set(o, default_str);
329 break;
330 }
331 default:
332 ERR("switch default for type: %s of property %s", db_gui_type_name_get(t), prop_name_get(prop));
333 }
334 i++; /*Because first item in box list is label*/
335 }
336 eina_list_free(box_list);
337}
338
339static Eina_Bool
340_description_item_content_get(It_Data *it_data)
341{
342 Eo *box = it_data->box;
343 Eo *label = eo_add(ELM_LABEL_CLASS, box);
344 eo_do(label, evas_obj_visibility_set(EINA_TRUE),
345 elm_obj_widget_part_text_set(NULL, it_data->desc));
346 eo_do(box, elm_obj_box_pack_end(label));
347
348 if (!strcmp(it_data->desc, DB_DEF_PUBLIC))
349 {
350 Eo *ck = props_check_add(box, wdg_public_get(it_data->wdg));
351 eo_do (ck, eo_event_callback_add(ELM_ENTRY_EVENT_CHANGED, _wdg_public_change_cb, it_data->wdg));
352 }
353 else if (!strcmp(it_data->desc, DB_DEF_NAME))
354 {
355 Eo *entry = props_entry_add(box, wdg_name_get(it_data->wdg), GUI_TYPE_STRING);
356 eo_do (entry, eo_event_callback_add(ELM_ENTRY_EVENT_ACTIVATED, _wdg_name_change_cb, it_data->wdg));
357 }
358 else if (!strcmp(it_data->desc, DB_DEF_CLASS))
359 {
360 Eo *entry = props_entry_add(box, wdg_class_name_get(it_data->wdg), GUI_TYPE_STRING);
361 elm_object_disabled_set(entry, EINA_TRUE);
362 }
363 return EINA_TRUE;
364}
365
366/* Content set for property view.
367 * Used to show properties and actions
368 */
369static Evas_Object *
370_item_content_get(It_Data *it_data)
371{
372 Eo *box = NULL;
373
374 box = eo_add(ELM_BOX_CLASS, propview_table);
375 eo_do(box, evas_obj_visibility_set(EINA_TRUE),
376 elm_obj_box_horizontal_set(EINA_TRUE),
377 elm_obj_box_padding_set(5, 0),
378 evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, 0),
379 evas_obj_size_hint_align_set(EVAS_HINT_FILL, 0)
380// evas_obj_size_hint_min_set(32 * elm_config_scale_get(),
381// 18 * elm_config_scale_get())
382 );
383
384 it_data->box = box;
385 switch (it_data->type)
386 {
387 case PROPERTY_TYPE:
388 _property_item_content_get(it_data);
389 break;
390 case DESCRIPTION_TYPE:
391 _description_item_content_get(it_data);
392 break;
393 /* Currently ITEM_TYPE cannot appear here.
394 * This case is only to shut compiler up. */
395 case ITEM_TYPE:
396 case CONTENT_TYPE:
397 _content_item_content_get(it_data);
398 break;
399 default:
400 break;
401 }
402
403 return box; 134 return box;
404} 135}
405 136
406PropViewCbs *propview_cbs_get()
407{
408 if (!_view_cbs) _view_cbs = calloc(1, sizeof(*_view_cbs));
409 return _view_cbs;
410}
411
412static char *
413_class_item_label_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
414{
415 Classname_Data *cl = data;
416 return strdup(cl->classname);
417}
418
419static char *
420_notfound_item_text_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
421{
422 return strdup("No search results");
423}
424
425static Evas_Object * 137static Evas_Object *
426_prop_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED) 138_prop_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
427{ 139{
@@ -443,7 +155,7 @@ _prop_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *par
443 155
444 if (!it_box) 156 if (!it_box)
445 { 157 {
446 it_box = _item_content_get(it_data); 158 it_box = _property_item_content_get(it_data);
447 159
448 Eo *prop_menu_button = props_button_add(it_box, NULL); 160 Eo *prop_menu_button = props_button_add(it_box, NULL);
449 eo_do(prop_menu_button, evas_obj_size_hint_align_set(1, 0)); 161 eo_do(prop_menu_button, evas_obj_size_hint_align_set(1, 0));
@@ -476,14 +188,6 @@ _prop_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *par
476} 188}
477 189
478static void 190static void
479_class_item_del(void *data, Evas_Object *obj EINA_UNUSED)
480{
481 Classname_Data *cl = data;
482 free(cl->classname);
483 free(cl);
484}
485
486static void
487_prop_item_del(void *data, Evas_Object *obj EINA_UNUSED) 191_prop_item_del(void *data, Evas_Object *obj EINA_UNUSED)
488{ 192{
489 It_Data *it_data = data; 193 It_Data *it_data = data;
@@ -576,10 +280,11 @@ _props_contracted_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *e
576 elm_genlist_item_subitems_clear(glit); 280 elm_genlist_item_subitems_clear(glit);
577} 281}
578 282
579static void 283void
580_properties_build(const Gui_Widget *wdg) 284propview_build(const Gui_Widget *wdg)
581{ 285{
582 op_item_table = eina_hash_string_superfast_new(NULL); 286 eo_do(prop_list, elm_obj_genlist_clear());
287
583 Eina_List *kl_list = NULL; 288 Eina_List *kl_list = NULL;
584 289
585 if (wdg) 290 if (wdg)
@@ -642,368 +347,6 @@ _properties_build(const Gui_Widget *wdg)
642 } 347 }
643} 348}
644 349
645static void
646_content_build(const Gui_Widget *wdg)
647{
648 Eina_List *ctn_items = NULL;
649 Eina_List *l;
650 int i = 0;
651 Object_Container_Item *ci;
652 It_Data *it_data;
653
654 const char *wdg_name = wdg_obj_container_class_name_get(wdg);
655 Eina_Bool isbox = (wdg_name &&
656 (!strcmp(wdg_name, DB_DEF_BOX_CLASS) ||
657 !strcmp(wdg_name, DB_DEF_WIN_CLASS)));
658
659 Egui_Layout_Widgets *g = egui_layout_gui_get();
660 elm_object_disabled_set(g->main_win->contentview_down_btn, !isbox);
661 elm_object_disabled_set(g->main_win->contentview_up_btn, !isbox);
662
663 Eina_List *items_lst = wdg_obj_container_contents_list_get(wdg);
664
665 EINA_LIST_FOREACH(items_lst, l, ci)
666 {
667 Dep_Id *item_id = obj_container_item_dep_id_get(ci);
668 if (item_id && !wdg_get(item_id)) continue;
669
670 Gui_Widget_Property *prop = obj_container_item_prop_get(ci);
671 it_data = IT_DATA_BUILD(CONTENT_TYPE, wdg);
672 it_data->idx = i;
673 it_data->prop = prop;
674 it_data->op_desc = (Op_Desc *) prop_op_desc_get(prop);
675 i++;
676
677 ctn_items = eina_list_append(ctn_items, it_data);
678 }
679
680 /* Add empty fields. */
681 const char *wdg_class_name = wdg_class_name_get(wdg);
682 const char *name;
683 /* Add empty field for each type of container. */
684 EINA_LIST_FOREACH(db_class_inherit_containers_list_get(wdg_class_name), l, name)
685 {
686 const Op_Desc *op_desc = db_container_desc_op_desc_get(db_container_desc_get(name), CONTAINER_PACK);
687 it_data = IT_DATA_BUILD(CONTENT_TYPE, wdg);
688 it_data->idx = i;
689 it_data->op_desc = op_desc;
690 it_data->prop = NULL;
691
692 ctn_items = eina_list_append(ctn_items, it_data);
693 }
694
695 EINA_LIST_FREE(ctn_items, it_data)
696 elm_genlist_item_append(ctn_list, _itc_ctn, it_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
697}
698
699static void
700_content_select_item(const Gui_Widget_Property *prop)
701{
702 Elm_Object_Item *it = elm_genlist_first_item_get(ctn_list);
703 for (; it; it = elm_genlist_item_next_get(it))
704 {
705 It_Data *it_data = elm_object_item_data_get(it);
706 if (it_data->prop == prop)
707 {
708 elm_genlist_item_selected_set(it, EINA_TRUE);
709 break;
710 }
711 }
712}
713
714Eina_Bool
715_contentview_del_btn_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc, void *event_info)
716{
717 const Gui_Widget_Property *prev_prop = NULL;
718
719 Elm_Object_Item *glit = elm_genlist_selected_item_get(ctn_list);
720 if (!glit) return EO_CALLBACK_CONTINUE;
721
722 It_Data *it_data = elm_object_item_data_get(glit);
723 intptr_t idx = (intptr_t) it_data->idx;
724
725 it_data = elm_object_item_data_get(elm_genlist_item_next_get(glit));
726 if (it_data) prev_prop = it_data->prop;
727 if (!prev_prop)
728 {
729 it_data = elm_object_item_data_get(elm_genlist_item_prev_get(glit));
730 if (it_data) prev_prop = it_data->prop;
731 }
732
733 Eina_Bool ret = _view_cbs->content_delete_cb_func((void *)idx, obj, desc, event_info);
734 if (prev_prop) _content_select_item(prev_prop);
735
736 return ret;
737}
738
739Eina_Bool
740_contentview_up_btn_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc, void *event_info EINA_UNUSED)
741{
742 Elm_Object_Item *glit = elm_genlist_selected_item_get(ctn_list);
743 if (!glit) return EO_CALLBACK_CONTINUE;
744
745 It_Data *it_data = elm_object_item_data_get(glit);
746 const Gui_Widget_Property *prev_prop = it_data->prop;
747 intptr_t idx = it_data->idx;
748
749 Eina_Bool ret = _view_cbs->content_reorder_cb_func((void *)idx, obj, desc, (void *)(intptr_t)UP);
750 _content_select_item(prev_prop);
751
752 return ret;
753}
754
755Eina_Bool
756_contentview_down_btn_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc, void *event_info EINA_UNUSED)
757{
758 Elm_Object_Item *glit = elm_genlist_selected_item_get(ctn_list);
759 if (!glit) return EO_CALLBACK_CONTINUE;
760
761 It_Data *it_data = elm_object_item_data_get(glit);
762 const Gui_Widget_Property *prev_prop = it_data->prop;
763 intptr_t idx = it_data->idx;
764
765 Eina_Bool ret = _view_cbs->content_reorder_cb_func((void *)idx, obj, desc, (void *)(intptr_t)DOWN);
766 _content_select_item(prev_prop);
767
768 return ret;
769}
770
771/* This function now is called for meny only */
772static void
773_item_build(const Gui_Widget *wdg)
774{
775 itemview_build(wdg);
776}
777
778static void
779_desc_item_del(void *data, Evas_Object *obj EINA_UNUSED)
780{
781 It_Data *it_data = data;
782 _it_data_free(it_data);
783}
784
785static Evas_Object *
786_desc_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
787{
788 return _item_content_get(data);
789}
790
791static void
792_contents_item_del(void *data, Evas_Object *obj EINA_UNUSED)
793{
794 It_Data *it_data = data;
795
796 if (it_data->prop)
797 {
798 const char *fullname = db_op_desc_op_name_full_get(it_data->op_desc);
799 _mempool_cache_data_put(fullname, it_data->box);
800 }
801
802 _it_data_free(it_data);
803}
804
805static Evas_Object *
806_contents_item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
807{
808 It_Data *it_data = data;
809
810 if (!it_data->prop) return _item_content_get(it_data);
811
812 if (it_data->box) return it_data->box;
813
814 const char *fullname = db_op_desc_op_name_full_get(it_data->op_desc);
815
816 Evas_Object * it_box = _mempool_cache_data_get(fullname);
817
818 if (!it_box)
819 {
820 it_box = _item_content_get(it_data);
821 eo_ref(it_box);
822 }
823 else
824 {
825 it_data->box = it_box;
826 _prop_field_update(it_data->prop, it_box, it_data);
827 }
828
829 return it_box;
830}
831
832// Used to loop in _description_build function
833static char *descs[] = { DB_DEF_NAME, DB_DEF_CLASS, DB_DEF_PUBLIC, NULL };
834
835static void
836_description_build(const Gui_Widget *wdg)
837{
838 int i;
839 for (i = 0; descs[i]; i++)
840 {
841 It_Data *it_data = IT_DATA_BUILD(DESCRIPTION_TYPE, wdg);
842 it_data->desc = descs[i];
843 elm_genlist_item_append(desc_list, _itc_desc, it_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
844 }
845}
846
847/* This callback is called in the end of propview_build()
848 * in order to switch between scrollbox for properties
849 * and genlist for items. */
850static void
851_propview_build_post_cb(const Gui_Widget *wdg, It_Data_Type new_type)
852{
853 Egui_Layout_Widgets *g = egui_layout_gui_get();
854 /* Unsetting view according to old selected toolbar's item. */
855 switch (_propsview_toolbar_selected_item_type)
856 {
857 case DESCRIPTION_TYPE:
858 {
859 break;
860 }
861 case PROPERTY_TYPE:
862 {
863 break;
864 }
865 case CALLBACK_TYPE:
866 {
867 break;
868 }
869 case CONTENT_TYPE:
870 {
871 break;
872 }
873 case ITEM_TYPE:
874 {
875 eo_do(g->main_win->contentview_box, evas_obj_visibility_set(EINA_TRUE));
876 eo_do(g->main_win->itemview_box, evas_obj_visibility_set(EINA_FALSE));
877 break;
878 }
879 }
880
881 _propsview_toolbar_selected_item_type = new_type;
882
883 /* Setting view according to new selected toolbar's item. */
884 eo_do(g->main_win->contentview_box, evas_obj_visibility_set(EINA_FALSE));
885 eo_do(g->main_win->properties_list, evas_obj_visibility_set(EINA_FALSE));
886 eo_do(g->main_win->itemview_box, evas_obj_visibility_set(EINA_FALSE));
887 eo_do(g->main_win->callbacksview_box, evas_obj_visibility_set(EINA_FALSE));
888 eo_do(g->main_win->description_list, evas_obj_visibility_set(EINA_FALSE));
889
890 switch (new_type)
891 {
892 case DESCRIPTION_TYPE:
893 {
894 eo_do(g->main_win->description_list, evas_obj_visibility_set(EINA_TRUE));
895 break;
896 }
897 case PROPERTY_TYPE:
898 {
899 eo_do(g->main_win->properties_list, evas_obj_visibility_set(EINA_TRUE));
900 break;
901 }
902 case CALLBACK_TYPE:
903 {
904 eo_do(g->main_win->callbacksview_box, evas_obj_visibility_set(EINA_TRUE));
905 break;
906 }
907 case CONTENT_TYPE:
908 {
909 eo_do(g->main_win->contentview_box, evas_obj_visibility_set(EINA_TRUE));
910 break;
911 }
912 case ITEM_TYPE:
913 {
914 eo_do(g->main_win->contentview_box, evas_obj_visibility_set(EINA_FALSE));
915 eo_do(g->main_win->itemview_box, evas_obj_visibility_set(EINA_TRUE));
916
917 if (wdg_is_container(wdg, DB_DEF_MENU_CLASS))
918 {
919 eo_do(g->main_win->itemview_add_item_nested_but, elm_obj_widget_disabled_set(EINA_FALSE));
920 eo_do(g->main_win->itemview_add_separator_but, elm_obj_widget_disabled_set(EINA_FALSE));
921 }
922 else if (wdg_is_container(wdg, DB_DEF_DISKSELECTOR_CLASS) ||
923 wdg_is_container(wdg, DB_DEF_CTXPOPUP_CLASS) ||
924 wdg_is_container(wdg, DB_DEF_TOOLBAR_CLASS) ||
925 wdg_is_container(wdg, DB_DEF_NAVIFRAME_CLASS))
926 {
927 eo_do(g->main_win->itemview_add_item_nested_but, elm_obj_widget_disabled_set(EINA_TRUE));
928 eo_do(g->main_win->itemview_add_separator_but, elm_obj_widget_disabled_set(EINA_TRUE));
929 }
930 break;
931 }
932 }
933}
934
935/* Build property view for current widget.
936 * Show propeties, which defined in class hyerarchy
937 * for current widget's class. And fill fields, if property
938 * is defined for current widget.(or put default values into fields.)
939 * Called, when item in objtree is selected. */
940void
941propview_build(const Gui_Widget *wdg)
942{
943 It_Data_Type type = _new_type;
944
945 eo_do(desc_list, elm_obj_genlist_clear());
946 eo_do(prop_list, elm_obj_genlist_clear());
947 eo_do(ctn_list, elm_obj_genlist_clear());
948
949 if (op_item_table)
950 {
951 eina_hash_free(op_item_table);
952 op_item_table = NULL;
953 }
954
955 if (!wdg) return;
956
957 /* type ITEM_TYPE not assigned to any toolbar's item.
958 * It's assigned when toolbar's item is CONTENT and widget is menu.
959 * So if current type is ITEM_TYPEm we need to assign it to CONTENT_TYPE,
960 * and it will be resolved according to widget's type. */
961 if (type == ITEM_TYPE) type = CONTENT_TYPE;
962
963 if ((type == CONTENT_TYPE) &&
964 (wdg_is_container(wdg, DB_DEF_MENU_CLASS) ||
965 wdg_is_container(wdg, DB_DEF_DISKSELECTOR_CLASS) ||
966 wdg_is_container(wdg, DB_DEF_CTXPOPUP_CLASS) ||
967 wdg_is_container(wdg, DB_DEF_TOOLBAR_CLASS) ||
968 wdg_is_container(wdg, DB_DEF_NAVIFRAME_CLASS)))
969 {
970 type = ITEM_TYPE;
971 }
972
973 switch(type)
974 {
975 case DESCRIPTION_TYPE:
976 {
977 _description_build(wdg);
978 break;
979 }
980 case PROPERTY_TYPE:
981 {
982 _properties_build(wdg);
983 break;
984 }
985 case CALLBACK_TYPE:
986 {
987 cbview_build(wdg);
988 break;
989 }
990 case CONTENT_TYPE:
991 {
992 _content_build(wdg);
993 break;
994 }
995 case ITEM_TYPE:
996 {
997 itemview_clear();
998 _item_build(wdg);
999 break;
1000 }
1001 default:
1002 ERR("switch default");
1003 }
1004 _propview_build_post_cb(wdg, type);
1005}
1006
1007/* API to select property in genlist. 350/* API to select property in genlist.
1008 * Op_Desc is used to be able to select empty property. */ 351 * Op_Desc is used to be able to select empty property. */
1009void 352void
@@ -1061,79 +404,9 @@ propview_item_update(const Gui_Widget_Property *prop)
1061 _prop_field_update(prop, item_box, it_data); 404 _prop_field_update(prop, item_box, it_data);
1062} 405}
1063 406
1064/* FIXME: need to change signature to Eo_Callback, when it will be supported.
1065 * This callback is used in Egui Layout JSON. */
1066void
1067_propsview_toolbar_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
1068//(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
1069{
1070 Elm_Object_Item *it = event_info;
1071 elm_toolbar_item_selected_set(it, EINA_TRUE);
1072 const Gui_Context *ctx = _active_context_get();
1073 if (!ctx) return;
1074 const Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG);
1075 _new_type = (int) (intptr_t) elm_object_item_data_get(it);
1076 propview_build(wdg);
1077}
1078
1079/* API to switch propsview Description->Properties->Callbacks->Contents */
1080void
1081propsview_view_switch(It_Data_Type type)
1082{
1083 Elm_Object_Item *it;
1084 Egui_Layout_Widgets *g = egui_layout_gui_get();
1085 switch (type)
1086 {
1087 case PROPERTY_TYPE:
1088 {
1089 it = g->main_win->propsview_toolbar_prop_it;
1090 break;
1091 }
1092 case CALLBACK_TYPE:
1093 {
1094 it = g->main_win->propsview_toolbar_cb_it;
1095 break;
1096 }
1097 case DESCRIPTION_TYPE:
1098 {
1099 it = g->main_win->propsview_toolbar_desc_it;
1100 break;
1101 }
1102 /* Currently ITEM_TYPE cannot appear here.
1103 * This case is only to shut compiler up. */
1104 case ITEM_TYPE:
1105 case CONTENT_TYPE:
1106 {
1107 it = g->main_win->propsview_toolbar_cont_it;
1108 break;
1109 }
1110 }
1111 _propsview_toolbar_clicked(NULL, NULL, it);
1112}
1113
1114static Eina_Bool
1115_propview_filter_entry_changed_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1116 const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
1117{
1118 const Gui_Context *ctx = _active_context_get();
1119 if (!ctx) return EO_CALLBACK_CONTINUE;
1120 const Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG);
1121 propview_build(wdg);
1122
1123 return EO_CALLBACK_CONTINUE;
1124}
1125
1126void 407void
1127propview_init() 408propview_init()
1128{ 409{
1129 if (!_itc_class)
1130 {
1131 _itc_class = elm_genlist_item_class_new();
1132 _itc_class->item_style = "default";
1133 _itc_class->func.text_get = _class_item_label_get;
1134 _itc_class->func.del = _class_item_del;
1135 }
1136
1137 if (!_itc_prop) 410 if (!_itc_prop)
1138 { 411 {
1139 _itc_prop = elm_genlist_item_class_new(); 412 _itc_prop = elm_genlist_item_class_new();
@@ -1142,84 +415,28 @@ propview_init()
1142 _itc_prop->func.del = _prop_item_del; 415 _itc_prop->func.del = _prop_item_del;
1143 } 416 }
1144 417
1145 if (!_itc_notfound)
1146 {
1147 _itc_notfound = elm_genlist_item_class_new();
1148 _itc_notfound->item_style = "default";
1149 _itc_notfound->func.text_get = _notfound_item_text_get;
1150 }
1151
1152 if (!_itc_desc)
1153 {
1154 _itc_desc = elm_genlist_item_class_new();
1155 _itc_desc->item_style = "full";
1156 _itc_desc->func.content_get = _desc_item_content_get;
1157 _itc_desc->func.del = _desc_item_del;
1158 }
1159
1160 if (!_itc_ctn)
1161 {
1162 _itc_ctn = elm_genlist_item_class_new();
1163 _itc_ctn->item_style = "full";
1164 _itc_ctn->func.content_get = _contents_item_content_get;
1165 _itc_ctn->func.del = _contents_item_del;
1166 }
1167
1168 Egui_Layout_Widgets *g = egui_layout_gui_get(); 418 Egui_Layout_Widgets *g = egui_layout_gui_get();
1169 419
1170 cbview_init();
1171 propview_table = g->main_win->propsview_table;
1172
1173 prop_list = g->main_win->properties_list; 420 prop_list = g->main_win->properties_list;
1174 421
1175 /* Put it here, because it Enums defined in propsview.h */
1176 elm_object_item_data_set(g->main_win->propsview_toolbar_desc_it, (void *) (intptr_t) DESCRIPTION_TYPE);
1177 elm_object_item_data_set(g->main_win->propsview_toolbar_prop_it, (void *) (intptr_t) PROPERTY_TYPE);
1178 elm_object_item_data_set(g->main_win->propsview_toolbar_cb_it, (void *) (intptr_t) CALLBACK_TYPE);
1179 elm_object_item_data_set(g->main_win->propsview_toolbar_cont_it, (void *) (intptr_t) CONTENT_TYPE);
1180
1181 evas_object_smart_callback_add(prop_list, "expand,request", _expand_request_cb, NULL); 422 evas_object_smart_callback_add(prop_list, "expand,request", _expand_request_cb, NULL);
1182 evas_object_smart_callback_add(prop_list, "contract,request", _contract_request_cb, NULL); 423 evas_object_smart_callback_add(prop_list, "contract,request", _contract_request_cb, NULL);
1183 evas_object_smart_callback_add(prop_list, "expanded", _props_expanded_cb, NULL); 424 evas_object_smart_callback_add(prop_list, "expanded", _props_expanded_cb, NULL);
1184 evas_object_smart_callback_add(prop_list, "contracted", _props_contracted_cb, NULL); 425 evas_object_smart_callback_add(prop_list, "contracted", _props_contracted_cb, NULL);
1185 426
1186 eo_do(g->main_win->propsview_filter_entry,
1187 eo_event_callback_add(ELM_ENTRY_EVENT_CHANGED_USER,
1188 _propview_filter_entry_changed_cb,
1189 NULL));
1190
1191 desc_list = g->main_win->description_list;
1192
1193 ctn_list = g->main_win->contentview_list;
1194
1195 _mempool_cache_init();
1196 expanded_classes = eina_hash_string_superfast_new(NULL); 427 expanded_classes = eina_hash_string_superfast_new(NULL);
428 op_item_table = eina_hash_string_superfast_new(NULL);
1197} 429}
1198 430
1199void 431void
1200propview_shutdown() 432propview_shutdown()
1201{ 433{
1202 elm_genlist_item_class_free(_itc_class);
1203 _itc_class = NULL;
1204 elm_genlist_item_class_free(_itc_prop); 434 elm_genlist_item_class_free(_itc_prop);
1205 _itc_prop = NULL; 435 _itc_prop = NULL;
1206 elm_genlist_item_class_free(_itc_notfound);
1207 _itc_notfound = NULL;
1208 elm_genlist_item_class_free(_itc_desc);
1209 _itc_desc = NULL;
1210 elm_genlist_item_class_free(_itc_ctn);
1211 _itc_ctn = NULL;
1212
1213 cbview_shutdown();
1214 436
1215 eo_do(prop_list, elm_obj_genlist_clear()); 437 eo_do(prop_list, elm_obj_genlist_clear());
1216 eo_do(desc_list, elm_obj_genlist_clear()); 438 prop_list = NULL;
1217 eo_do(ctn_list, elm_obj_genlist_clear());
1218
1219 prop_list = desc_list = ctn_list = NULL;
1220 439
1221 _mempool_cache_free(); 440 eina_hash_free(op_item_table);
1222
1223 if (op_item_table) eina_hash_free(op_item_table);
1224 eina_hash_free(expanded_classes); 441 eina_hash_free(expanded_classes);
1225} 442} \ No newline at end of file
diff --git a/src/bin/egui_gui/propview.h b/src/bin/egui_gui/propview.h
index 37b4b1d..5c2cae0 100644
--- a/src/bin/egui_gui/propview.h
+++ b/src/bin/egui_gui/propview.h
@@ -7,19 +7,6 @@
7#include "propview_data.h" 7#include "propview_data.h"
8 8
9#define CONTAINER_REORDER_BUTTON_DIR "container_reorder_button_dir" 9#define CONTAINER_REORDER_BUTTON_DIR "container_reorder_button_dir"
10#define _STR_EDITOR "editor"
11typedef struct
12{
13 Eina_Bool (*property_update_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
14 Eina_Bool (*property_delete_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
15 Eina_Bool (*property_ctx_menu_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
16 Eina_Bool (*content_delete_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
17 Eina_Bool (*content_reorder_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
18 Eina_Bool (*content_change_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
19} PropViewCbs;
20
21PropViewCbs *
22propview_cbs_get();
23 10
24void 11void
25propview_init(); 12propview_init();
@@ -27,27 +14,14 @@ propview_init();
27void 14void
28propview_shutdown(); 15propview_shutdown();
29 16
30/* Build property view for current widget.
31 * Show propeties, which defined in class hyerarchy
32 * for current widget's class. And fill fields, if property
33 * is defined for current widget.(or put default values into fields.)
34 * Called, when item in objtree is selected. */
35void 17void
36propview_build(const Gui_Widget *wdg); 18propview_build(const Gui_Widget *wdg);
37 19
38/* Update values in item in propview list. */
39void
40propview_item_update(const Gui_Widget_Property *prop);
41
42void
43cbview_item_selected_set(Dep_Id *cb_dep_id);
44
45/* API to switch propsview Description->Properties->Callbacks->Contents */
46void
47propsview_view_switch(It_Data_Type type);
48
49/* API to select property in genlist. */ 20/* API to select property in genlist. */
50void 21void
51propview_item_selected_set(const Op_Desc *op_desc); 22propview_item_selected_set(const Op_Desc *op_desc);
52 23
24void
25propview_item_update(const Gui_Widget_Property *prop);
26
53#endif 27#endif
diff --git a/src/bin/egui_gui/propview_data.h b/src/bin/egui_gui/propview_data.h
index 3b9915a..33bac83 100644
--- a/src/bin/egui_gui/propview_data.h
+++ b/src/bin/egui_gui/propview_data.h
@@ -21,6 +21,17 @@
21 }) 21 })
22 22
23#define CACHE_CALLBACKS "CALLBACKS" 23#define CACHE_CALLBACKS "CALLBACKS"
24#define _STR_EDITOR "editor"
25
26typedef struct
27{
28 Eina_Bool (*property_update_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
29 Eina_Bool (*property_delete_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
30 Eina_Bool (*property_ctx_menu_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
31 Eina_Bool (*content_delete_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
32 Eina_Bool (*content_reorder_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
33 Eina_Bool (*content_change_cb_func)(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
34} PropViewCbs;
24 35
25typedef enum 36typedef enum
26{ 37{
diff --git a/src/bin/egui_gui/rmview.c b/src/bin/egui_gui/rmview.c
index 5a2a450..0605b36 100644
--- a/src/bin/egui_gui/rmview.c
+++ b/src/bin/egui_gui/rmview.c
@@ -9,7 +9,7 @@
9#include "egui_logic_private.h" 9#include "egui_logic_private.h"
10#include "rmview.h" 10#include "rmview.h"
11#include "seqview.h" 11#include "seqview.h"
12#include "propview.h" 12#include "prop_layout.h"
13 13
14#include "elm_widget.h" 14#include "elm_widget.h"
15#include "elm_widget_container.h" 15#include "elm_widget_container.h"
@@ -375,7 +375,7 @@ _bt_save_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *de
375 eo_do(f_data->it_data->en2, elm_interface_fileselector_path_set(resource_value_get(res))); 375 eo_do(f_data->it_data->en2, elm_interface_fileselector_path_set(resource_value_get(res)));
376 } 376 }
377 const Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG); 377 const Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG);
378 propview_build(wdg); 378 proplayout_build(wdg);
379 } 379 }
380 /* For EDJE take data from fileselector. */ 380 /* For EDJE take data from fileselector. */
381 else if (res_type == RESOURCE_EDJE) 381 else if (res_type == RESOURCE_EDJE)
@@ -399,7 +399,7 @@ _bt_save_clicked(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *de
399 eo_do(f_data->it_data->en3, elm_interface_fileselector_path_set(resource_edc_path_get(res))); 399 eo_do(f_data->it_data->en3, elm_interface_fileselector_path_set(resource_edc_path_get(res)));
400 } 400 }
401 const Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG); 401 const Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG);
402 propview_build(wdg); 402 proplayout_build(wdg);
403 } 403 }
404 /* For CALLBACKS and STRINGS. */ 404 /* For CALLBACKS and STRINGS. */
405 else 405 else
@@ -843,7 +843,7 @@ _rm_add_button_clicked(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Eve
843 eo_do(g_rm_win->rm_edje_fs_edj, elm_obj_widget_part_text_set(NULL, NULL)); 843 eo_do(g_rm_win->rm_edje_fs_edj, elm_obj_widget_part_text_set(NULL, NULL));
844 } 844 }
845 const Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG); 845 const Gui_Widget *wdg = gui_context_data_get(ctx, SELECTED_WDG);
846 propview_build(wdg); 846 proplayout_build(wdg);
847 } 847 }
848 else 848 else
849 { 849 {