From 9d2141b5a327dabae74c61c2cb179a14f82ca5aa Mon Sep 17 00:00:00 2001 From: Woochan Lee Date: Wed, 6 Dec 2017 17:32:13 +0900 Subject: [PATCH] efl_ui_multibuttonentry: Apply lazy edc, code clean up. Summary: Apply lazy edc, code clean up. Test Plan: elementary_test -> multibuttonentry sample. Reviewers: jpeg, taxi2se, Jaehyun_Cho Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5607 --- data/elementary/themes/Makefile.am | 1 - data/elementary/themes/default.edc | 1 - .../elementary/themes/edc/efl/multibuttonentry.edc | 332 ++++++++++++++++++++- .../elementary/themes/edc/elm/multibuttonentry.edc | 328 -------------------- src/lib/elementary/efl_ui_multibuttonentry.c | 9 +- 5 files changed, 332 insertions(+), 339 deletions(-) delete mode 100644 data/elementary/themes/edc/elm/multibuttonentry.edc diff --git a/data/elementary/themes/Makefile.am b/data/elementary/themes/Makefile.am index 4bc6ec9..8facbde 100644 --- a/data/elementary/themes/Makefile.am +++ b/data/elementary/themes/Makefile.am @@ -127,7 +127,6 @@ elementary/themes/edc/elm/layout.edc \ elementary/themes/edc/elm/list.edc \ elementary/themes/edc/elm/map.edc \ elementary/themes/edc/elm/menu.edc \ -elementary/themes/edc/elm/multibuttonentry.edc \ elementary/themes/edc/elm/naviframe.edc \ elementary/themes/edc/elm/notify.edc \ elementary/themes/edc/elm/panel.edc \ diff --git a/data/elementary/themes/default.edc b/data/elementary/themes/default.edc index 1bbd492..f33b960 100644 --- a/data/elementary/themes/default.edc +++ b/data/elementary/themes/default.edc @@ -45,7 +45,6 @@ collections { #include "edc/elm/slideshow.edc" #include "edc/elm/diskselector.edc" #include "edc/elm/ctxpopup.edc" -#include "edc/elm/multibuttonentry.edc" #include "edc/elm/dayselector.edc" #include "edc/elm/actionslider.edc" #include "edc/elm/photocam.edc" diff --git a/data/elementary/themes/edc/efl/multibuttonentry.edc b/data/elementary/themes/edc/efl/multibuttonentry.edc index 149f9e6..f667128 100644 --- a/data/elementary/themes/edc/efl/multibuttonentry.edc +++ b/data/elementary/themes/edc/efl/multibuttonentry.edc @@ -1,19 +1,341 @@ group { "efl/multibuttonentry"; - inherit: "elm/multibuttonentry/base/default"; + data.item: "horizontal_pad" 0; + data.item: "vertical_pad" 0; + data.item: "closed_height" 0; + parts { + rect { "bg"; + scale; + desc { "default"; + color_class: "multibuttonentry_bg"; + } + } + swallow { "elm.swallow.background"; + scale; + desc { "default"; + rel.to: "bg"; + } + } + swallow { "box.swallow"; + desc { "default"; + rel.to: "bg"; + } + } + } } group { "efl/multibuttonentry/label"; - inherit: "elm/multibuttonentry/label/default"; + parts { + text { "elm.text"; + nomouse; + effect: GLOW; + scale; + desc { "default"; + color: FN_COL_HIGHLIGHT; + color_class: "multibuttonentry_label"; + text { font: FNBD; size: 10; + min: 1 1; + ellipsis: -1; + align: 0.5 0.5; + text_class: "multibuttonentry_label"; + } + rel1.offset: 2 2; + rel2.offset: -5 -5; + } + } + } } group { "efl/multibuttonentry/guidetext"; - inherit: "elm/multibuttonentry/guidetext/default"; + parts { + text { "elm.text"; + scale; + effect: SHADOW BOTTOM; + desc { "default"; + rel1.offset: 2 2; + rel2.offset: -4 -4; + color: FN_COL_DISABLE; + text { font: FNBD; size: 10; + min: 0 1; + align: 0.0 0.5; + } + } + } + } } group { "efl/multibuttonentry/btn"; - inherit: "elm/multibuttonentry/btn/default"; + images.image: "button_normal.png" COMP; + images.image: "button_clicked.png" COMP; + images.image: "sym_close_dark_normal.png" COMP; + images.image: "sym_close_dark_selected.png" COMP; + images.image: "win_glow.png" COMP; + styles { + style { name: "multibuttonentry_textblock_style"; + base: "font="FN" align=0.5 font_size=10 color=#ffffffff style=shadow,bottom shadow_color=#00000080 text_class=multibuttonentry_item ellipsis=1.0"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "hilight" "+ font="FNBD; + tag: "b" "+ font="FNBD; + tag: "tab" "\t"; + } + } + + script { + public disabled = 0; + } + + parts { + rect { "bg"; + desc { "default"; + color_class: "multibuttonentry_item_bg"; + } + desc { "pressed"; + color_class: "multibuttonentry_item_bg_selected"; + } + } + image { "base"; + desc { "default"; + image.normal: "button_normal.png"; + image.border: 4 4 3 5; + image.middle: SOLID; + rel1.offset: -1 0; + rel2.offset: 0 1; + fill.smooth: 0; + } + desc { "pressed"; + inherit: "default"; + image.normal: "button_clicked.png"; + image.border: 5 5 4 6; + } + } + image { "glow"; + nomouse; + desc { "default"; + image.normal: "win_glow.png"; + image.border: 9 9 9 9; + image.middle: 0; + rel1.offset: -2 -3; + rel1.to: "base"; + rel2.offset: 1 0; + rel2.to: "base"; + fill.smooth: 0; + color: 255 255 255 0; + hid; + } + desc { "focused"; + inherit: "default"; + color: 255 255 255 255; + vis; + } + desc { "unfocused"; + inherit: "default"; + } + } + image { "close"; + nomouse; + desc { "default"; + image.normal: "sym_close_dark_normal.png"; + rel1.to: "del"; + rel2.to: "del"; + min: 15 15; + max: 15 15; + fixed: 1 1; + } + desc { "clicked"; + inherit: "default"; + image.normal: "sym_close_dark_selected.png"; + } + } + rect { "del"; + scale; + desc { "default"; + fixed: 1 0; + min: 4 4; + align: 1.0 0.5; + aspect: 1.0 1.0; aspect_preference: VERTICAL; + rel1.relative: 1.0 0.0; + rel1.to: "base"; + rel1.offset: -6 5; + rel2.offset: -6 -7; + rel2.to: "base"; + color: 0 0 0 0; + } + } + textblock { "elm.btn.text"; + nomouse; + scale; + desc { "default"; + color_class: "multibuttonentry_item_text"; + text { style: "multibuttonentry_textblock_style"; + min: 1 1; + ellipsis: -1; + text_class: "multibuttonentry_item_text"; + } + hid; + rel1.offset: 5 5; + rel1.to: "base"; + rel2.to_x: "del"; + rel2.to_y: "base"; + rel2.relative: 0.0 1.0; + rel2.offset: -3 -7; + } + } + textblock { "text"; + nomouse; + scale; + desc { "default"; + color_class: "multibuttonentry_item_text"; + text { style: "multibuttonentry_textblock_style"; + text_source: "elm.btn.text"; + min: 0 1; + align: 0.0 0.5; + text_class: "multibuttonentry_item_text"; + } + align: 0.0 0.5; + rel1.offset: 5 5; + rel1.to: "base"; + rel2.to_x: "del"; + rel2.to_y: "base"; + rel2.relative: 0.0 1.0; + rel2.offset: -3 -7; + } + desc { "pressed"; + inherit: "default"; + color_class: "multibuttonentry_item_text_pressed"; + text { + text_class: "multibuttonentry_item_text_pressed"; + } + } + desc { "disabled"; + inherit: "default"; + color_class: "multibuttonentry_item_text_disabled"; + text { + text_class: "multibuttonentry_item_text_disabled"; + } + } + } + } + programs { + program { + signal: "mouse,clicked,1"; + source: "base"; + script { + if (get_int(disabled) == 0) { + emit("clicked", ""); + } + } + } + program { + signal: "elm,state,default"; + source: "elm"; + action: STATE_SET "default"; + target: "glow"; + } + program { + signal: "elm,state,focused"; + source: "elm"; + action: STATE_SET "focused"; + target: "glow"; + } + program { + signal: "elm,state,enabled"; + source: "elm"; + script { + set_state(PART:"text", "default", 0.0); + set_int(disabled , 0); + } + } + program { + signal: "elm,state,disabled"; + source: "elm"; + script { + new st[31]; + new Float: vl; + get_state(PART:"glow", st, 30, vl); + if (!strcmp(st, "focused")) + set_state(PART:"glow", "default", 0.0); + set_state(PART:"text", "disabled", 0.0); + set_int(disabled , 1); + } + } + program { + signal: "elm,state,unfocused"; + source: "elm"; + action: STATE_SET "unfocused"; + target: "glow"; + } + program { + signal: "mouse,down,1"; + source: "base"; + script { + if (get_int(disabled) == 0) { + set_state(PART:"base", "pressed", 0.0); + set_state(PART:"bg", "pressed", 0.0); + set_state(PART:"text", "pressed", 0.0); + } + } + } + program { + signal: "mouse,up,1"; + source: "base"; + script { + if (get_int(disabled) == 0) { + set_state(PART:"base", "default", 0.0); + set_state(PART:"bg", "default", 0.0); + set_state(PART:"text", "default", 0.0); + } + } + } + program { + signal: "mouse,clicked,1"; + source: "del"; + action: SIGNAL_EMIT "elm,deleted" "elm"; + } + program { + signal: "mouse,down,1"; + source: "del"; + action: STATE_SET "clicked"; + target: "close"; + } + program { + signal: "mouse,up,1"; + source: "del"; + action: STATE_SET "default"; + target: "close"; + } + } } group { "efl/multibuttonentry/closedbutton"; - inherit: "elm/multibuttonentry/closedbutton/default"; + styles { + style { name: "textblock_style_multibuttonentry_default"; + base: "font="FNBD" font_size=10 text_class=multibuttonentry_closed style=glow color=#3399ffff glow_color=#3399ff18 align=center glow2_color=#3399ff12 wrap=char"; + tag: "br" "\n"; + tag: "ps" "ps"; + tag: "hilight" "+ font="FNBD; + tag: "b" "+ font="FNBD; + tag: "tab" "\t"; + } + } + parts { + rect { "bg"; + desc { "default"; + color: 0 0 0 0; + } + } + textblock { "elm.text"; + nomouse; + scale; + desc { "default"; + rel1.offset: 2 2; + rel1.to: "bg"; + rel2.offset: -3 -3; + rel2.to: "bg"; + text { style: "textblock_style_multibuttonentry_default"; + min: 1 1; + ellipsis: -1; + } + } + } + } } diff --git a/data/elementary/themes/edc/elm/multibuttonentry.edc b/data/elementary/themes/edc/elm/multibuttonentry.edc deleted file mode 100644 index cefb816..0000000 --- a/data/elementary/themes/edc/elm/multibuttonentry.edc +++ /dev/null @@ -1,328 +0,0 @@ -group { name: "elm/multibuttonentry/base/default"; - data.item: "horizontal_pad" 0; - data.item: "vertical_pad" 0; - data.item: "closed_height" 0; - parts { - part { name: "bg"; - type: RECT; - scale: 1; - description { state: "default" 0.0; - color_class: "multibuttonentry_bg"; - } - } - part { name: "elm.swallow.background"; - type: SWALLOW; - scale: 1; - description { state: "default" 0.0; - rel1.to: "bg"; - rel2.to: "bg"; - } - } - part { name: "box.swallow"; type: SWALLOW; - description { state: "default" 0.0; - rel1.to: "bg"; - rel2.to: "bg"; - } - } - } -} - -group { name: "elm/multibuttonentry/label/default"; - parts { - part { name: "elm.text"; type: TEXT; mouse_events: 0; - effect: GLOW; - scale: 1; - description { state: "default" 0.0; - color: FN_COL_HIGHLIGHT; - color_class: "multibuttonentry_label"; - text { font: FNBD; size: 10; - min: 1 1; - ellipsis: -1; - align: 0.5 0.5; - text_class: "multibuttonentry_label"; - } - rel1.offset: 2 2; - rel2.offset: -5 -5; - } - } - } -} - -group { name: "elm/multibuttonentry/guidetext/default"; - parts { - part { name: "elm.text"; type: TEXT; - scale: 1; - effect: SHADOW BOTTOM; - description { state: "default" 0.0; - rel1.offset: 2 2; - rel2.offset: -4 -4; - color: FN_COL_DISABLE; - text { font: FNBD; size: 10; - min: 0 1; - align: 0.0 0.5; - } - } - } - } -} - -group { name: "elm/multibuttonentry/btn/default"; - images.image: "button_normal.png" COMP; - images.image: "button_clicked.png" COMP; - images.image: "sym_close_dark_normal.png" COMP; - images.image: "sym_close_dark_selected.png" COMP; - images.image: "win_glow.png" COMP; - styles { - style { name: "multibuttonentry_textblock_style"; - base: "font="FN" align=0.5 font_size=10 color=#ffffffff style=shadow,bottom shadow_color=#00000080 text_class=multibuttonentry_item ellipsis=1.0"; - tag: "br" "\n"; - tag: "ps" "ps"; - tag: "hilight" "+ font="FNBD; - tag: "b" "+ font="FNBD; - tag: "tab" "\t"; - } - } - - script { - public disabled = 0; - } - - parts { - part { name: "bg"; type: RECT; - description { state: "default" 0.0; - color_class: "multibuttonentry_item_bg"; - } - description { state: "pressed" 0.0; - color_class: "multibuttonentry_item_bg_selected"; - } - } - part { name: "base"; - description { state: "default" 0.0; - image.normal: "button_normal.png"; - image.border: 4 4 3 5; - image.middle: SOLID; - rel1.offset: -1 0; - rel2.offset: 0 1; - fill.smooth: 0; - } - description { state: "pressed" 0.0; - inherit: "default" 0.0; - image.normal: "button_clicked.png"; - image.border: 5 5 4 6; - } - } - part { name: "glow"; mouse_events: 0; - description { state: "default" 0.0; - image.normal: "win_glow.png"; - image.border: 9 9 9 9; - image.middle: 0; - rel1.offset: -2 -3; - rel1.to: "base"; - rel2.offset: 1 0; - rel2.to: "base"; - fill.smooth: 0; - color: 255 255 255 0; - visible: 0; - } - description { state: "focused" 0.0; - inherit: "default" 0.0; - color: 255 255 255 255; - visible: 1; - } - description { state: "unfocused" 0.0; - inherit: "default" 0.0; - } - } - part { name: "close"; mouse_events: 0; - description { state: "default" 0.0; - image.normal: "sym_close_dark_normal.png"; - rel1.to: "del"; - rel2.to: "del"; - min: 15 15; - max: 15 15; - fixed: 1 1; - } - description { state: "clicked" 0.0; - inherit: "default" 0.0; - image.normal: "sym_close_dark_selected.png"; - } - } - part { name: "del"; type: RECT; - scale: 1; - description { state: "default" 0.0; - fixed: 1 0; - min: 4 4; - align: 1.0 0.5; - aspect: 1.0 1.0; aspect_preference: VERTICAL; - rel1.relative: 1.0 0.0; - rel1.to: "base"; - rel1.offset: -6 5; - rel2.offset: -6 -7; - rel2.to: "base"; - color: 0 0 0 0; - } - } - part { name: "elm.btn.text"; type: TEXTBLOCK; mouse_events: 0; - scale: 1; - description { state: "default" 0.0; - color_class: "multibuttonentry_item_text"; - text { style: "multibuttonentry_textblock_style"; - min: 1 1; - ellipsis: -1; - text_class: "multibuttonentry_item_text"; - } - visible: 0; - rel1.offset: 5 5; - rel1.to: "base"; - rel2.to_x: "del"; - rel2.to_y: "base"; - rel2.relative: 0.0 1.0; - rel2.offset: -3 -7; - } - } - part { name: "text"; type: TEXTBLOCK; mouse_events: 0; - scale: 1; - description { state: "default" 0.0; - color_class: "multibuttonentry_item_text"; - text { style: "multibuttonentry_textblock_style"; - text_source: "elm.btn.text"; - min: 0 1; - align: 0.0 0.5; - text_class: "multibuttonentry_item_text"; - } - align: 0.0 0.5; - rel1.offset: 5 5; - rel1.to: "base"; - rel2.to_x: "del"; - rel2.to_y: "base"; - rel2.relative: 0.0 1.0; - rel2.offset: -3 -7; - } - description { state: "pressed" 0.0; - inherit: "default"; - color_class: "multibuttonentry_item_text_pressed"; - text { - text_class: "multibuttonentry_item_text_pressed"; - } - } - description { state: "disabled" 0.0; - inherit: "default"; - color_class: "multibuttonentry_item_text_disabled"; - text { - text_class: "multibuttonentry_item_text_disabled"; - } - } - } - } - programs { - program { - signal: "mouse,clicked,1"; source: "base"; - script { - if (get_int(disabled) == 0) { - emit("clicked", ""); - } - } - } - program { - signal: "elm,state,default"; source: "elm"; - action: STATE_SET "default" 0.0; - target: "glow"; - } - program { - signal: "elm,state,focused"; source: "elm"; - action: STATE_SET "focused" 0.0; - target: "glow"; - } - program { - signal: "elm,state,enabled"; source: "elm"; - script { - set_state(PART:"text", "default", 0.0); - set_int(disabled , 0); - } - } - program { - signal: "elm,state,disabled"; source: "elm"; - script { - new st[31]; - new Float: vl; - get_state(PART:"glow", st, 30, vl); - if (!strcmp(st, "focused")) - set_state(PART:"glow", "default", 0.0); - set_state(PART:"text", "disabled", 0.0); - set_int(disabled , 1); - } - } - program { - signal: "elm,state,unfocused"; source: "elm"; - action: STATE_SET "unfocused" 0.0; - target: "glow"; - } - program { - signal: "mouse,down,1"; source: "base"; - script { - if (get_int(disabled) == 0) { - set_state(PART:"base", "pressed", 0.0); - set_state(PART:"bg", "pressed", 0.0); - set_state(PART:"text", "pressed", 0.0); - } - } - } - program { - signal: "mouse,up,1"; source: "base"; - script { - if (get_int(disabled) == 0) { - set_state(PART:"base", "default", 0.0); - set_state(PART:"bg", "default", 0.0); - set_state(PART:"text", "default", 0.0); - } - } - } - program { - signal: "mouse,clicked,1"; source: "del"; - action: SIGNAL_EMIT "elm,deleted" "elm"; - } - program { - signal: "mouse,down,1"; source: "del"; - action: STATE_SET "clicked" 0.0; - target: "close"; - } - program { - signal: "mouse,up,1"; source: "del"; - action: STATE_SET "default" 0.0; - target: "close"; - } - } -} - -group { name: "elm/multibuttonentry/closedbutton/default"; - styles { - style { name: "textblock_style_multibuttonentry_default"; - base: "font="FNBD" font_size=10 text_class=multibuttonentry_closed style=glow color=#3399ffff glow_color=#3399ff18 align=center glow2_color=#3399ff12 wrap=char"; - tag: "br" "\n"; - tag: "ps" "ps"; - tag: "hilight" "+ font="FNBD; - tag: "b" "+ font="FNBD; - tag: "tab" "\t"; - } - } - parts { - part { name: "bg"; type: RECT; - description { state: "default" 0.0; - color: 0 0 0 0; - } - } - part { name: "elm.text"; type: TEXTBLOCK; mouse_events: 0; - scale: 1; - description { state: "default" 0.0; - rel1.offset: 2 2; - rel1.to: "bg"; - rel2.offset: -3 -3; - rel2.to: "bg"; - text { style: "textblock_style_multibuttonentry_default"; - min: 1 1; - ellipsis: -1; - } - } - } - } -} diff --git a/src/lib/elementary/efl_ui_multibuttonentry.c b/src/lib/elementary/efl_ui_multibuttonentry.c index a1a7bde..c5304f1 100644 --- a/src/lib/elementary/efl_ui_multibuttonentry.c +++ b/src/lib/elementary/efl_ui_multibuttonentry.c @@ -36,10 +36,6 @@ static const char SIG_EXPANDED[] = "expanded"; static const char SIG_CONTRACTED[] = "contracted"; static const char SIG_EXPAND_STATE_CHANGED[] = "expand,state,changed"; -static const char PART_NAME_BUTTON[] = "btn"; -static const char PART_NAME_GUIDE_TEXT[] = "guidetext"; -static const char PART_NAME_LABEL[] = "label"; -static const char PART_NAME_CLOSED_BUTTON[] = "closedbutton"; static const Evas_Smart_Cb_Description _smart_callbacks[] = { {SIG_ITEM_SELECTED, ""}, {SIG_ITEM_ADDED, ""}, @@ -55,6 +51,11 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = { {NULL, NULL} }; +static const char PART_NAME_BUTTON[] = "btn"; +static const char PART_NAME_GUIDE_TEXT[] = "guidetext"; +static const char PART_NAME_LABEL[] = "label"; +static const char PART_NAME_CLOSED_BUTTON[] = "closedbutton"; + static Eina_Bool _efl_ui_multibuttonentry_smart_focus_next_enable = EINA_FALSE; static Eina_Bool _efl_ui_multibuttonentry_smart_focus_direction_enable = EINA_TRUE; -- 2.7.4