summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2014-12-01 12:22:11 +0200
committerYakov Goldberg <yakov.g@samsung.com>2014-12-23 10:13:29 +0200
commit19c5228acad35257376fd7431f39a8c795e08d53 (patch)
tree40bab87b2c7d54821e63d6f5bab1fa3d4c70ba05 /src/bin
parent2c4f24e61cde49f256124ec20560a54121606a60 (diff)
Naviframe refactoring.
UX was totally missing, making it unusable at all.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/egui_gui/cbview.c85
-rw-r--r--src/bin/egui_gui/editor.c55
-rw-r--r--src/bin/egui_gui/props_helper.c72
3 files changed, 159 insertions, 53 deletions
diff --git a/src/bin/egui_gui/cbview.c b/src/bin/egui_gui/cbview.c
index 716a7c2..246c897 100644
--- a/src/bin/egui_gui/cbview.c
+++ b/src/bin/egui_gui/cbview.c
@@ -241,6 +241,43 @@ _action_prop_selected(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Descriptio
241 return EO_CALLBACK_CONTINUE; 241 return EO_CALLBACK_CONTINUE;
242} 242}
243 243
244static Eina_Bool
245_action_item_selected(void *data, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
246{
247 It_Data *it_data = data;
248 Gui_Widget_Callback *cb = it_data->cb;
249 Gui_Context *ctx = (Gui_Context *) wdg_context_get(it_data->wdg);
250
251 Dep_Id *action_id = cb_action_id_get(cb);
252 Gui_Action *action = action_get(action_id);
253
254 Gui_Widget_Property *prop = action_property_get(action);
255 if (!prop)
256 {
257 ERR("no property");
258 return EO_CALLBACK_CONTINUE;
259 }
260
261 Gui_Widget_Property *new_prop = prop_copy(prop);
262 /* Get value which need to be changed.*/
263 Gui_Value *val = prop_value_nth_get(new_prop, 0);
264
265 const char *new_item_name = elm_object_item_part_text_get(event_info, NULL);
266 /* Set selected string on hover */
267 elm_object_text_set(obj, new_item_name);
268 Dep_Id *new_name_id = gui_context_dep_id_by_name_get(ctx, new_item_name);
269 gui_value_name_id_set(val, GUI_TYPE_OBJECT_ITEM, new_name_id);
270
271 Dep_Id *wdg_id = action_widget_id_get(action);
272 Gui_Action *new_action = action_copy(action_id);
273 Gui_Memento *memento = gui_memento_new(action_id, MEMENTO_ACTION, action, new_action);
274 gui_context_memento_add(ctx, memento);
275
276 action_modif_set(new_action, wdg_id, new_prop);
277 action_set(action_id, new_action);
278 return EO_CALLBACK_CONTINUE;
279}
280
244static void 281static void
245_action_prop_update(void *data, Eo *obj, void *event_info) 282_action_prop_update(void *data, Eo *obj, void *event_info)
246{ 283{
@@ -531,25 +568,43 @@ _item_content_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part EIN
531 const Op_Desc *op = prop_op_desc_get(prop); 568 const Op_Desc *op = prop_op_desc_get(prop);
532 eo_do(props_hover, elm_obj_widget_part_text_set(NULL, db_op_desc_op_name_full_get(op))); 569 eo_do(props_hover, elm_obj_widget_part_text_set(NULL, db_op_desc_op_name_full_get(op)));
533 570
534 unsigned int count, i; 571 /* We show the item name for pack operations. The info of the items are in the contents window. */
535 count = db_op_desc_param_number_get(op); 572 if (db_op_desc_container_type_get(op) == ITEM_CONTAINER &&
536 573 db_op_desc_container_behavior_get(op) == CONTAINER_PACK)
537 for (i = 0; i < count; i++) 574 {
575 Gui_Value *val = prop_value_nth_get(prop, 0);
576 if (val)
577 {
578 const Eina_List *items_list = item_container_item_subitems_get(wdg_item_container_root_get(wdg));
579 Dep_Id *cur_item = DEP_ID_GET(val);
580 const char *cur_item_name = dep_name_get(cur_item)?:" --- ";
581 Eo *items_hover = props_hoversel_objects_add(wdgs->cb_item, NULL, elm_widget_top_get(cb_list), cur_item_name, items_list, NULL);
582 it_data->cb_dyn_objs = eina_list_append(it_data->cb_dyn_objs, items_hover);
583 eo_do(items_hover, eo_event_callback_add(EVAS_SELECTABLE_INTERFACE_EVENT_SELECTED, _action_item_selected, it_data));
584 }
585 }
586 else
538 { 587 {
539 void *pi = (void *) (uintptr_t) i; 588 unsigned int count, i;
540 Gui_Value *value = ((prop && prop_value_get(prop)) ? prop_value_nth_get(prop, i) : NULL); 589 count = db_op_desc_param_number_get(op);
541 Eo *new_obj = props_value_add(wdgs->cb_item, wdg, value, op, i); 590
542 it_data->cb_dyn_objs = eina_list_append(it_data->cb_dyn_objs, new_obj); 591 for (i = 0; i < count; i++)
543 if (new_obj)
544 { 592 {
545 eo_do(new_obj, eo_key_data_set("cb_it_data", it_data, NULL)); 593 void *pi = (void *) (uintptr_t) i;
546 if (eo_isa(new_obj, ELM_HOVERSEL_CLASS)) 594 Gui_Value *value = ((prop && prop_value_get(prop)) ? prop_value_nth_get(prop, i) : NULL);
547 evas_object_smart_callback_add(new_obj, "selected", _action_prop_update, pi); 595 Eo *new_obj = props_value_add(wdgs->cb_item, wdg, value, op, i);
596 it_data->cb_dyn_objs = eina_list_append(it_data->cb_dyn_objs, new_obj);
597 if (new_obj)
598 {
599 eo_do(new_obj, eo_key_data_set("cb_it_data", it_data, NULL));
600 if (eo_isa(new_obj, ELM_HOVERSEL_CLASS))
601 evas_object_smart_callback_add(new_obj, "selected", _action_prop_update, pi);
602 else
603 evas_object_smart_callback_add(new_obj, "changed", _action_prop_update, pi);
604 }
548 else 605 else
549 evas_object_smart_callback_add(new_obj, "changed", _action_prop_update, pi); 606 return NULL;
550 } 607 }
551 else
552 return NULL;
553 } 608 }
554 } 609 }
555 } 610 }
diff --git a/src/bin/egui_gui/editor.c b/src/bin/egui_gui/editor.c
index f347146..2989aad 100644
--- a/src/bin/egui_gui/editor.c
+++ b/src/bin/egui_gui/editor.c
@@ -297,6 +297,11 @@ _wdg_border_draw(const Gui_Widget *wdg, Eina_Bool visibility, int border_type_co
297 evas_obj_size_get(&bw, &bh)); 297 evas_obj_size_get(&bw, &bh));
298 298
299 eo_do(obj, evas_obj_position_get(&ox, &oy)); 299 eo_do(obj, evas_obj_position_get(&ox, &oy));
300
301 /* In case the objects has been shifted outside of the window
302 * e.g with naviframe item push */
303 if (ox < 0 || oy < 0) return;
304
300 eo_do(obj, evas_obj_size_hint_min_get(&minw, &minh)); 305 eo_do(obj, evas_obj_size_hint_min_get(&minw, &minh));
301 eo_do(obj, evas_obj_size_get(&ow, &oh)); 306 eo_do(obj, evas_obj_size_get(&ow, &oh));
302 if (ow < minw) ow = minw; 307 if (ow < minw) ow = minw;
@@ -962,7 +967,6 @@ _frame_mouse_up(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *des
962static void 967static void
963_iter_widget_create(Gui_Widget *wdg, const Eo *parent_win) 968_iter_widget_create(Gui_Widget *wdg, const Eo *parent_win)
964{ 969{
965 const Eina_List *children = NULL, *l;
966 Dep_Id *wid; 970 Dep_Id *wid;
967 971
968 /* Windows are iterated separately. If parent is NULL, means that current object is not win. 972 /* Windows are iterated separately. If parent is NULL, means that current object is not win.
@@ -974,12 +978,19 @@ _iter_widget_create(Gui_Widget *wdg, const Eo *parent_win)
974 if (created) 978 if (created)
975 { 979 {
976 manager_widget_configure(session, wdg, MODE_EDITOR, NULL); 980 manager_widget_configure(session, wdg, MODE_EDITOR, NULL);
977 children = wdg_children_list_get(wdg); 981 /* We don't need to create children for items containers,
978 EINA_LIST_FOREACH(children, l, wid) 982 * as it will be done inside item_add.
983 * The reason is that, for e.g naviframe, not all the contents have
984 * to be created when the naviframe is created. */
985 if (!wdg_item_container_root_get(wdg))
979 { 986 {
980 Gui_Widget *w = wdg_get(wid); 987 const Eina_List *children = wdg_children_list_get(wdg), *l;
981 /* Window can not have child windows, so pass NULL. */ 988 EINA_LIST_FOREACH(children, l, wid)
982 if (w) _iter_widget_create(w, NULL); 989 {
990 Gui_Widget *w = wdg_get(wid);
991 /* Window can not have child windows, so pass NULL. */
992 if (w) _iter_widget_create(w, NULL);
993 }
983 } 994 }
984 } 995 }
985} 996}
@@ -1259,7 +1270,23 @@ _widget_item_add(Gui_Session *session, const Gui_Widget *wdg, const Item_Contain
1259{ 1270{
1260 Elm_Object_Item *it = NULL; 1271 Elm_Object_Item *it = NULL;
1261 Eina_List *itr; 1272 Eina_List *itr;
1262 it = _ffi_eo_item_add(session, wdg, wit, data); 1273 const Gui_Widget_Property *prop = item_container_item_prop_get(wit);
1274 /* Replace NULL ids with dummy for naviframe */
1275 if (IS_NAVIFRAME(wdg) && !strcmp(prop_name_get(prop), ITEM_PUSH))
1276 {
1277 Gui_Value *val = prop_value_nth_get(prop, 1);
1278 Dep_Id *wid = DEP_ID_GET(val);
1279 if (!wid) gui_value_name_id_set(val, GUI_TYPE_OBJECT, DUMMY_ID);
1280
1281 val = prop_value_nth_get(prop, 2);
1282 wid = DEP_ID_GET(val);
1283 if (!wid) gui_value_name_id_set(val, GUI_TYPE_OBJECT, DUMMY_ID);
1284
1285 val = prop_value_nth_get(prop, 3);
1286 wid = DEP_ID_GET(val);
1287 if (!wid) gui_value_name_id_set(val, GUI_TYPE_OBJECT, DUMMY_ID);
1288 }
1289 it = _ffi_eo_item_add(session, wdg, wit, data, _dummy_obj_get);
1263 session_item_set(session, wit, it); 1290 session_item_set(session, wit, it);
1264 1291
1265 /* FIXME: Delete together with call in manager_widget_configure */ 1292 /* FIXME: Delete together with call in manager_widget_configure */
@@ -1267,7 +1294,7 @@ _widget_item_add(Gui_Session *session, const Gui_Widget *wdg, const Item_Contain
1267 EINA_LIST_FOREACH(item_container_item_subitems_get(wit), itr, dep_id_itr) 1294 EINA_LIST_FOREACH(item_container_item_subitems_get(wit), itr, dep_id_itr)
1268 { 1295 {
1269 Item_Container_Item *witr = item_container_item_get(dep_id_itr); 1296 Item_Container_Item *witr = item_container_item_get(dep_id_itr);
1270 _widget_item_add(session, wdg, witr, data); 1297 manager_widget_items_add(session, wdg, witr, MODE_EDITOR, data);
1271 } 1298 }
1272 return EINA_TRUE; 1299 return EINA_TRUE;
1273} 1300}
@@ -3543,8 +3570,16 @@ _itemview_item_selected(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo
3543 const Gui_Context *ctx = _active_context_get(); 3570 const Gui_Context *ctx = _active_context_get();
3544 Item_Container_Item *wit = item_container_item_get((Dep_Id *)elm_object_item_data_get(event_info)); 3571 Item_Container_Item *wit = item_container_item_get((Dep_Id *)elm_object_item_data_get(event_info));
3545 Gui_Session *session = (Gui_Session *) gui_context_editor_session_get(ctx); 3572 Gui_Session *session = (Gui_Session *) gui_context_editor_session_get(ctx);
3546 Elm_Object_Item *menu_it = session_item_get(session, wit); 3573 Elm_Object_Item *it = session_item_get(session, wit);
3547 elm_menu_item_selected_set(menu_it, EINA_TRUE); 3574 if (eo_isa(it, ELM_MENU_ITEM_CLASS))
3575 {
3576 elm_menu_item_selected_set(it, EINA_TRUE);
3577 }
3578 Gui_Widget *wdg = (Gui_Widget *) _editor_wdg_selected_get();
3579 if (IS_NAVIFRAME(wdg))
3580 {
3581 manager_widget_items_add(session, wdg, wit, MODE_EDITOR, NULL);
3582 }
3548} 3583}
3549 3584
3550static Eina_Bool 3585static Eina_Bool
diff --git a/src/bin/egui_gui/props_helper.c b/src/bin/egui_gui/props_helper.c
index 6c9780d..e772432 100644
--- a/src/bin/egui_gui/props_helper.c
+++ b/src/bin/egui_gui/props_helper.c
@@ -290,7 +290,7 @@ props_hoversel_enums_add(Eo *box, Eo *hover_parent, const char *default_val, con
290} 290}
291 291
292Eo * 292Eo *
293props_hoversel_objects_add(Eo *box, Eo *hoversel, Eo *hover_parent, const char *default_val, const Eina_List *wdgs_list, const Gui_Widget *wdg) 293props_hoversel_objects_add(Eo *box, Eo *hoversel, Eo *hover_parent, const char *default_val, const Eina_List *list, const Gui_Widget *wdg)
294{ 294{
295 if (!hoversel) hoversel = eo_add(ELM_HOVERSEL_CLASS, box); 295 if (!hoversel) hoversel = eo_add(ELM_HOVERSEL_CLASS, box);
296 if (hover_parent) eo_do(hoversel, elm_obj_hoversel_hover_parent_set(hover_parent)); 296 if (hover_parent) eo_do(hoversel, elm_obj_hoversel_hover_parent_set(hover_parent));
@@ -311,35 +311,51 @@ props_hoversel_objects_add(Eo *box, Eo *hoversel, Eo *hover_parent, const char *
311 311
312 const Eina_List *itr; 312 const Eina_List *itr;
313 Dep_Id *wid; 313 Dep_Id *wid;
314 EINA_LIST_FOREACH(wdgs_list, itr, wid) 314 EINA_LIST_FOREACH(list, itr, wid)
315 { 315 {
316 Gui_Widget *w = wdg_get(wid); 316 switch (dep_type_get(wid))
317 if (!w) continue;
318 if (!wdg || ((w != wdg) &&
319 (wdg_main_wdg_get(wdg) == wdg_main_wdg_get(w)) &&
320 (!IS_WIN(w))))
321 { 317 {
322 /* w - iterated widget; 318 case DEP_TYPE_WIDGET:
323 * wdg - container 319 {
324 * If 320 Gui_Widget *w = wdg_get(wid);
325 * - wdg is direct container for w; 321 if (!w) continue;
326 * - w is container for wdg; 322 if (!wdg || ((w != wdg) &&
327 * don't add it to hoversel. */ 323 (wdg_main_wdg_get(wdg) == wdg_main_wdg_get(w)) &&
328 if (IS_CONTAINER(wdg)) 324 (!IS_WIN(w))))
329 { 325 {
330 /*check, if wdg is content of w on any level. */ 326 /* w - iterated widget;
331 Eina_Bool found = EINA_FALSE; 327 * wdg - container
332 if (wdg_is_content_of(w, wdg)) continue; 328 * If
333 Eina_List *itr2; 329 * - wdg is direct container for w;
334 Object_Container_Item *ci; 330 * - w is container for wdg;
335 EINA_LIST_FOREACH(wdg_obj_container_contents_list_get(wdg), itr2, ci) 331 * don't add it to hoversel. */
336 { 332 if (IS_CONTAINER(wdg))
337 if (obj_container_item_dep_id_get(ci) == wid) found = EINA_TRUE; 333 {
338 } 334 /*check, if wdg is content of w on any level. */
339 if (found) continue; 335 Eina_Bool found = EINA_FALSE;
340 } 336 if (wdg_is_content_of(w, wdg)) continue;
341 337 Eina_List *itr2;
342 eo_do(hoversel, elm_obj_hoversel_item_add(wdg_name_get(w), NULL, ELM_ICON_NONE, NULL, NULL)); 338 Object_Container_Item *ci;
339 EINA_LIST_FOREACH(wdg_obj_container_contents_list_get(wdg), itr2, ci)
340 {
341 if (obj_container_item_dep_id_get(ci) == wid) found = EINA_TRUE;
342 }
343 if (found) continue;
344 }
345
346 eo_do(hoversel, elm_obj_hoversel_item_add(wdg_name_get(w), NULL, ELM_ICON_NONE, NULL, NULL));
347 }
348 break;
349 }
350 case DEP_TYPE_ITEM:
351 {
352 Item_Container_Item *item = item_container_item_get(wid);
353 if (!item) continue;
354 eo_do(hoversel, elm_obj_hoversel_item_add(dep_name_get(wid), NULL, ELM_ICON_NONE, NULL, NULL));
355 break;
356 }
357 default:
358 break;
343 } 359 }
344 } 360 }
345 361