rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=79dcad432bf544cc851d3f5987397f8b18f586b6
commit 79dcad432bf544cc851d3f5987397f8b18f586b6 Author: Vitalii Vorobiov <vi.vorob...@samsung.com> Date: Wed Nov 25 16:06:16 2015 +0200 property_group: remake tweens and apply it according to new UI/UX requirements --- data/themes/default/widgets/frame.edc | 346 +---------------------- data/themes/default/widgets/layouts/property.edc | 39 +++ src/bin/ui/property_group.c | 120 ++++---- 3 files changed, 103 insertions(+), 402 deletions(-) diff --git a/data/themes/default/widgets/frame.edc b/data/themes/default/widgets/frame.edc index de40f9f..c57ed5f 100644 --- a/data/themes/default/widgets/frame.edc +++ b/data/themes/default/widgets/frame.edc @@ -132,6 +132,7 @@ group { name: "elm/frame/base/default"; clip_to: "clipper"; description { state: "default" 0.0; align: 0.5 0.0; + min: 0 150; rel1 { to: "clipper"; } @@ -752,348 +753,3 @@ group { name: "elm/frame/base/icon"; } } } - -group { name: "elm/frame/base/tween"; - images { - image: "icon-group-expand.png" COMP; - image: "icon-group-minimize.png" COMP; - image: "group-border-bg-upper.png" COMP; - } - parts { - part { name: "padding_top_left"; - type: SPACER; - scale: 1; - description { state: "default" 0.0; - align: 0.0 0.0; - FIXED_SIZE(3, 5); - } - } - part { name: "padding_bottom_right"; - type: SPACER; - scale: 1; - description { state: "default" 0.0; - align: 1.0 1.0; - FIXED_SIZE(3, 5); - } - } - part { name: "base"; - type: SPACER; - scale: 1; - description { state: "default" 0.0; - rel1 { - relative: 1.0 1.0; - to: "padding_top_left"; - } - rel2 { - relative: 0.0 0.0; - to: "padding_bottom_right"; - } - } - } - part { name: "elm.text"; - type: TEXT; - scale: 1; - description { state: "default" 0.0; - align: 0.0 0.0; - color: FN_COL_DEFAULT; - color2: 0 0 0 255; - fixed: 1 1; - rel1 { - relative: 1.0 1.0; - to_x: "button.area"; - to_y: "padding_top_left"; - } - text { - font: FN; - size: 13; - max: 1 1; - align: 0.0 0.5; - } - } - } - part { name: "elm.text.label"; - type: TEXT; - description { state: "default" 0.0; - align: 1.0 0.5; - color: FN_COL_DEFAULT; - color2: 0 0 0 255; - fixed: 1 1; - rel1.to_y: "elm.text"; - rel2 { - relative: 0.0 1.0; - to_x: "padding.right.swallow"; - to_y: "elm.text"; - } - text { - text: "Add"; - font: FN; - size: 13; - max: 1 1; - align: 0.0 0.5; - } - } - } - part { name: "bevel.upper.add"; - type: IMAGE; - description { state: "default" 0.0; - align: 1.0 0.5; - FIXED_SIZE(7, 2); - rel1 { - relative: 1.0 0.0; - to_y: "elm.text.label"; - } - rel2 { - relative: 0.0 1.0; - to_x: "padding_bottom_right"; - to_y: "elm.text.label"; - } - image { - normal: "group-border-bg-upper.png"; - border: 1 1 0 2; - } - } - } - part { name: "padding.right.swallow"; - type: SPACER; - description { state: "default" 0.0; - align: 1.0 0.5; - FIXED_SIZE(3, 3); - rel1 { - relative: 1.0 0.0; - to_y: "elm.text"; - } - rel2 { - relative: 0.0 1.0; - to_x: "elm.swallow.add"; - to_y: "elm.text"; - } - } - } - part { name: "padding_left_swallow"; - type: SPACER; - description { state: "default" 0.0; - align: 0.0 0.5; - FIXED_SIZE(3, 3); - rel1 { - relative: 1.0 0.0; - to: "elm.text"; - } - rel2.to_y: "elm.text"; - } - } - part { name: "elm.swallow.icon"; - type: SWALLOW; - description { state: "default" 0.0; - align: 0.0 0.5; - fixed: 1 1; - rel1 { - relative: 1.0 0.0; - to: "padding_left_swallow"; - } - rel2 { - relative: 0.0 1.0; - to_y: "elm.text"; - } - } - } - part { name: "padding_right_swallow"; - type: SPACER; - description { state: "default" 0.0; - align: 0.0 0.5; - FIXED_SIZE(9, 3); - rel1 { - relative: 1.0 0.0; - to: "elm.swallow.icon"; - } - rel2.to_y: "elm.text"; - } - } - part { name: "bevel_upper_right"; - type: IMAGE; - mouse_events: 0; - description { state: "default" 0.0; - align: 1.0 0.0; - max: -1 2; - fixed: 1 1; - image.normal: "group-border-bg-upper.png"; - rel1 { - relative: 1.0 0.5; - to_x: "padding_right_swallow"; - to_y: "elm.text"; - } - rel2 { - relative: 0.0 1.0; - to_x: "elm.text.label"; - to_y: "elm.text"; - } - } - } - part { name: "bevel_upper_left"; - type: IMAGE; - mouse_events: 0; - description { state: "default" 0.0; - align: 0.0 0.5; - FIXED_SIZE(7, 2); - image.normal: "group-border-bg-upper.png"; - rel1 { - to_x: "base"; - to_y: "button.area"; - } - rel2 { - to_x: "base"; - to_y: "button.area"; - } - } - } - part { name: "button.area"; - type: SPACER; - description { state: "default" 0.0; - align: 0.0 0.5; - FIXED_SIZE(12, 12); - rel1 { - relative: 1.0 0.0; - to_x: "bevel_upper_left"; - to_y: "elm.text"; - } - rel2 { - relative: 0.0 1.0; - to_x: "base"; - to_y: "elm.text"; - } - } - } - part { name: "button"; - type: IMAGE; - description { state: "default" 0.0; - FIXED_SIZE(6, 6); - image.normal: "icon-group-minimize.png"; - rel1.to: "button.area"; - rel2.to: "button.area"; - } - description { state: "collapsed" 0.0; - inherit: "default" 0.0; - image.normal: "icon-group-expand.png"; - } - } - part { name: "elm.swallow.content"; - type: SWALLOW; - clip_to: "clip"; - description { state: "default" 0.0; - min: 0 150; - rel1 { - relative: 0.0 1.0; - offset: 0 2; - to_x: "bevel_upper_left"; - to_y: "padding.content"; - } - rel2.offset: -2 -2; - } - description { state: "collapsed" 0.0; - minmul: 1 0; - rel1 { - relative: 0.0 1.0; - to_x: "bevel_upper_left"; - to_y: "padding.content"; - } - rel2.offset: -2 0; - } - } - part { name: "event"; - type: RECT; - ignore_flags: "ON_HOLD"; - description { state: "default" 0.0; - color: INVISIBLE_COLOR; - rel1.to_y: "elm.text"; - rel2.to_y: "elm.text"; - } - } - part { name: "clip"; - type: RECT; - description { state: "default" 0.0; - rel1 { - relative: 0.0 1.0; - offset: 0 1; - to_y: "padding.content"; - } - rel2.offset: 0 0; - } - } - part { name: "elm.swallow.add"; - type: SWALLOW; - description { state: "default" 0.0; - align: 1.0 0.5; - FIXED_SIZE(16, 16); - rel1 { - relative: 1.0 0.0; - to_y: "elm.text"; - } - rel2 { - relative: 0.0 1.0; - to_x: "bevel.upper.add"; - to_y: "elm.text"; - } - } - } - part { name: "padding.content"; - type: SPACER; - description { state: "default" 0.0; - align: 0.5 0.0; - FIXED_SIZE(5, 5) - rel1 { - relative: 0.0 1.0; - to_y: "elm.text"; - } - } - } - } - programs { - program { name: "mouse_up_event"; - signal: "mouse,up,1"; - source: "event"; - action: SIGNAL_EMIT "elm,action,click" "elm"; - } - program { name: "action_toggle"; - signal: "elm,action,toggle"; - source: "elm"; - script { - new st[31]; - new Float:vl; - get_state(PART:"elm.swallow.content", st, 30, vl); - if (!strcmp(st, "default")) - run_program(PROGRAM:"collapse"); - else - run_program(PROGRAM:"expand"); - } - } - program { name: "action_switch"; - signal: "elm,action,switch"; - source: "elm"; - script { - new st[31]; - new Float:vl; - get_state(PART:"elm.swallow.content", st, 30, vl); - if (!strcmp(st, "default")) - set_state(PART:"elm.swallow.content", "collapsed", 0.0); - else - set_state(PART:"elm.swallow.content", "default", 0.0); - } - } - program { name: "collapse"; - action: STATE_SET "collapsed" 0.00; - transition: ACCELERATE 0.3; - target: "elm.swallow.content"; - target: "button"; - after: "signal"; - } - program { name: "expand"; - action: STATE_SET "default" 0.00; - transition: DECELERATE 0.3; - target: "elm.swallow.content"; - target: "button"; - after: "signal"; - } - program { name: "signal"; - action: SIGNAL_EMIT "elm,anim,done" "elm"; - } - } -} diff --git a/data/themes/default/widgets/layouts/property.edc b/data/themes/default/widgets/layouts/property.edc index 1c756b8..3b567fc 100644 --- a/data/themes/default/widgets/layouts/property.edc +++ b/data/themes/default/widgets/layouts/property.edc @@ -1150,3 +1150,42 @@ group { name: "elm/layout/property/color"; } } } + +group { name: "elm/layout/property/tween"; + parts { + part { name: "elm.swallow.add"; + type: SWALLOW; + description { state: "default" 0.0; + align: 1.0 0.0; + min: 18 19; + max: 18 19; + rel2 { + relative: 0.0 1.0; + offset: -8 -1; + to_x: "elm.swallow.del"; + } + } + } + part { name: "elm.swallow.del"; + type: SWALLOW; + description { state: "default" 0.0; + align: 1.0 0.0; + min: 18 19; + max: 18 19; + } + } + part { name: "elm.swallow.content"; + type: SWALLOW; + description { state: "default" 0.0; + align: 1.0 0.0; + min: 0 120; + max: -1 150; + rel1 { + relative: 0.0 1.0; + offset: 0 8; + to_y: "elm.swallow.del"; + } + } + } + } +} diff --git a/src/bin/ui/property_group.c b/src/bin/ui/property_group.c index 8297dcc..55603e0 100644 --- a/src/bin/ui/property_group.c +++ b/src/bin/ui/property_group.c @@ -433,7 +433,7 @@ prop_part_item_padding_update(Group_Prop_Data *pd); static void prop_state_proxy_source_update(Group_Prop_Data *pd); -static Elm_Genlist_Item_Class *_itc_tween = NULL; +static Elm_Gengrid_Item_Class *_itc_tween = NULL; static void _on_spinner_mouse_wheel(void *data __UNUSED__, @@ -2892,7 +2892,7 @@ _on_state_image_choose(void *data, false); } -static void +static void __UNUSED__ _del_tween_image(void *data, Evas_Object *obj, void *event_info __UNUSED__) @@ -2944,7 +2944,7 @@ _on_image_editor_tween_done(void *data, edje_edit_string_list_free(selected); } -static void +static void __UNUSED__ _add_tween_image(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) @@ -2959,6 +2959,15 @@ _add_tween_image(void *data, return; } +static void +_item_del(void *data, + Evas_Object *obj __UNUSED__) +{ + assert(data != NULL); + + eina_stringshare_del(data); +} + static char * _item_label_get(void *data, Evas_Object *obj __UNUSED__, @@ -2973,43 +2982,33 @@ _item_content_get(void *data, Evas_Object *obj, const char *part) const char* buf = NULL; const char *file = NULL, *group = NULL; Evas_Load_Error err; - Evas_Object *button, *image; + Evas_Object *image; Group_Prop_Data *pd = NULL; if (!strcmp(part, "elm.swallow.icon")) - { - pd = evas_object_data_get(obj, GROUP_PROP_DATA); - - assert(pd != NULL); - - edje_object_file_get((const Eo*)pd->group->edit_object, &file, &group); - image = evas_object_image_add(evas_object_evas_get(obj)); - buf = eina_stringshare_printf("edje/images/%i", - edje_edit_image_id_get(pd->group->edit_object, (const char*)data)); - evas_object_image_file_set(image, file, buf); - err = evas_object_image_load_error_get(image); - if (err != EVAS_LOAD_ERROR_NONE) - { - WARN("Image [%s] from file [%s] loaded with errors", buf, file); - return NULL; - } - evas_object_image_filled_set(image, true); - return image; - } - if (!strcmp(part, "elm.swallow.end")) - { - BUTTON_ADD(obj, button, NULL) - ICON_STANDARD_ADD(button, image, true, "minus"); - elm_object_part_content_set(button, NULL, image); - evas_object_smart_callback_add(button, "clicked", _del_tween_image, - (const char*)data); - elm_object_style_set(button, "anchor"); - return button; - } - return NULL; + { + pd = evas_object_data_get(obj, GROUP_PROP_DATA); + + assert(pd != NULL); + + edje_object_file_get((const Eo*)pd->group->edit_object, &file, &group); + image = evas_object_image_add(evas_object_evas_get(obj)); + buf = eina_stringshare_printf("edje/images/%i", + edje_edit_image_id_get(pd->group->edit_object, (const char*)data)); + evas_object_image_file_set(image, file, buf); + err = evas_object_image_load_error_get(image); + if (err != EVAS_LOAD_ERROR_NONE) + { + WARN("Image [%s] from file [%s] loaded with errors", buf, file); + return NULL; + } + evas_object_image_filled_set(image, true); + return image; + } + return NULL; } -static void +static void __UNUSED__ _tween_image_moved(Evas_Object *data, Evas_Object *obj, Elm_Object_Item *item EINA_UNUSED) @@ -3049,8 +3048,7 @@ _tween_image_moved(Evas_Object *data, Evas_Object * prop_item_state_image_tween_add(Evas_Object *box, Group_Prop_Data *pd) { - Evas_Object *tween_frame, *tween_list; - Evas_Object *button, *icon; + Evas_Object *tween_frame, *tween_list, *item; Eina_List *images_list, *l; char *image_name; @@ -3058,21 +3056,30 @@ prop_item_state_image_tween_add(Evas_Object *box, Group_Prop_Data *pd) assert(pd != NULL); FRAME_PROPERTY_ADD(box, tween_frame, true, _("Tweens"), pd->scroller) - elm_object_style_set(tween_frame, "tween"); + elm_object_style_set(tween_frame, "outdent_top"); + + item = elm_layout_add(tween_frame); + elm_layout_theme_set(item, "layout", "property", "tween"); + evas_object_size_hint_weight_set(item, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(item, EVAS_HINT_FILL, 0.0); + evas_object_show(item); + elm_object_content_set(tween_frame, item); + + tween_list = elm_gengrid_add(tween_frame); + elm_gengrid_item_size_set(tween_list, 96, 111); + elm_gengrid_align_set(tween_list, 0.0, 0.0); + elm_gengrid_horizontal_set(tween_list, true); - tween_list = elm_genlist_add(tween_frame); - elm_genlist_longpress_timeout_set(tween_list, 0.2); - elm_genlist_reorder_mode_set(tween_list, true); evas_object_data_set(tween_list, GROUP_PROP_DATA, pd); if (!_itc_tween) { - _itc_tween = elm_genlist_item_class_new(); + _itc_tween = elm_gengrid_item_class_new(); _itc_tween->item_style = "default"; _itc_tween->func.text_get = _item_label_get; _itc_tween->func.content_get = _item_content_get; _itc_tween->func.state_get = NULL; - _itc_tween->func.del = NULL; + _itc_tween->func.del = _item_del; } images_list = edje_edit_state_tweens_list_get(pd->group->edit_object, @@ -3082,22 +3089,21 @@ prop_item_state_image_tween_add(Evas_Object *box, Group_Prop_Data *pd) if (!images_list) elm_frame_collapse_go(tween_frame, true); EINA_LIST_FOREACH(images_list, l, image_name) { - elm_genlist_item_append(tween_list, _itc_tween, - eina_stringshare_add(image_name), NULL, - ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_gengrid_item_append(tween_list, _itc_tween, + eina_stringshare_add(image_name), NULL, NULL); } edje_edit_string_list_free(images_list); - elm_object_content_set(tween_frame, tween_list); - - BUTTON_ADD(tween_frame, button, NULL) - ICON_STANDARD_ADD(button, icon, true, "plus"); - elm_object_part_content_set(button, NULL, icon); - evas_object_smart_callback_add(button, "clicked", _add_tween_image, - tween_list); - elm_object_style_set(button, "anchor"); - elm_object_part_content_set(tween_frame, "elm.swallow.add", button); - evas_object_smart_callback_add(tween_list, "moved", - (Evas_Smart_Cb)_tween_image_moved, pd); + elm_object_content_set(item, tween_list); + +// BUTTON_ADD(tween_frame, button, NULL) +// ICON_STANDARD_ADD(button, icon, true, "plus"); +// elm_object_part_content_set(button, NULL, icon); +// evas_object_smart_callback_add(button, "clicked", _add_tween_image, +// tween_list); +// elm_object_style_set(button, "anchor"); +// elm_object_part_content_set(tween_frame, "elm.swallow.add", button); +// evas_object_smart_callback_add(tween_list, "moved", +// (Evas_Smart_Cb)_tween_image_moved, pd); evas_object_show(tween_list); --