From 5d8b6971565c4cb21d58b73bc03b816417949c61 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Fri, 30 Apr 2010 20:23:28 +0000 Subject: [PATCH] attempt to make composite effects suck less. Introducing the styles: * fast: does not have focus-in/out effect, similar to "slow", but runs in 0.1 second, so quite fast. * focus-out-colored: the focus-out has a color applied to it, the color is gray by now, but can be changed with conf_colors (last item), one can go crazy and make the focused out yellow or make them semi-transparent; The "comp" configure dialog now the focus in/out effects as well, to make user know what is happening a boring label is overlaid in the preview. SVN revision: 48491 --- data/themes/default.edc | 357 ++++++++++++++++++ src/modules/comp/e_mod_config.c | 84 +++-- .../conf_colors/e_int_config_color_classes.c | 1 + 3 files changed, 421 insertions(+), 21 deletions(-) diff --git a/data/themes/default.edc b/data/themes/default.edc index f9ae6d6ce..7661d50fb 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -257,6 +257,10 @@ color_classes { name: "label_text_disabled"; color: 0 0 0 128; } + color_class { + name: "comp_focus-out_color"; + color: 180 180 180 255; + } } /* @@ -35132,6 +35136,34 @@ collections { ///////////////////////////////////////////////////////////////////////////// /*** MOD: COMP ***/ + group { name: "e/modules/comp/preview"; + parts { + part { name: "e.swallow.preview"; + type: SWALLOW; + mouse_events: 0; + description { state: "default" 0.0; } + } + part { name: "e.text.label"; + type: TEXT; + effect: SOFT_SHADOW; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + fixed: 0 1; + color: 224 224 224 255; + color3: 0 0 0 32; + text { + font: "Sans:style=Bold"; + size: 10; + min: 1 1; + align: 0.5 0.5; + text_class: "fileman_icon"; + } + } + } + } + } + group { name: "e/comp/default"; images { image: "comp-sh1.png" COMP; @@ -35480,5 +35512,330 @@ collections { } } } +//---- + group { name: "e/comp/fast"; + images { + image: "comp-sh1.png" COMP; + } + parts { + part { name: "clipper"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + rel1 { + relative: -1.0 -1.0; + offset: -9999 -9999; + } + rel2 { + relative: 2.0 2.0; + offset: 9999 9999; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { name: "shadow"; + mouse_events: 0; + clip_to: "clipper"; + description { state: "default" 0.0; + image { + normal: "comp-sh1.png"; + border: 18 18 18 18; + middle: 0; + } + fill { + smooth: 0; + } + rel1 { + to: "e.swallow.content"; + relative: 0.0 0.0; + offset: -16 -14; + } + rel2 { + to: "e.swallow.content"; + relative: 1.0 1.0; + offset: 15 17; + } + } + description { state: "hidden" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + part { name: "e.swallow.content"; + type: SWALLOW; + clip_to: "clipper"; + mouse_events: 0; + description { state: "default" 0.0; + rel1 { + relative: 0.05 0.05; + offset: 0 0; + } + rel2 { + relative: 0.95 0.95; + offset: -1 -1; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 0.0; + } + rel2 { + relative: 1.0 1.0; + } + } + } + } + programs { + program { name: "shadow-on"; + signal: "e,state,shadow,on"; + source: "e"; + action: STATE_SET "default" 0.0; + target: "shadow"; + } + program { name: "shadow-off"; + signal: "e,state,shadow,off"; + source: "e"; + action: STATE_SET "hidden" 0.0; + target: "shadow"; + } + program { name: "show1"; + signal: "e,state,visible,on"; + source: "e"; + action: STATE_SET "visible" 0.0; + transition: DECELERATE 0.1; + target: "clipper"; + target: "e.swallow.content"; + after: "show2"; + } + program { name: "show2"; + action: SIGNAL_EMIT "e,action,show,done" "e"; + } + program { name: "hide1"; + signal: "e,state,visible,off"; + source: "e"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.1; + target: "clipper"; + target: "e.swallow.content"; + after: "hide2"; + } + program { name: "hide2"; + action: SIGNAL_EMIT "e,action,hide,done" "e"; + } + } + } +//---- + group { name: "e/comp/focus-out-colored"; + images { + image: "comp-sh1.png" COMP; + image: "bt_glow.png" COMP; + } + parts { + part { name: "clipper"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + color: 255 255 255 0; + rel1 { + relative: -1.0 -1.0; + offset: -9999 -9999; + } + rel2 { + relative: 2.0 2.0; + offset: 9999 9999; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + } + part { name: "shadow"; + mouse_events: 0; + clip_to: "clipper"; + description { state: "default" 0.0; + image { + normal: "comp-sh1.png"; + border: 18 18 18 18; + middle: 0; + } + fill.smooth: 0; + rel1 { + to: "e.swallow.content"; + relative: 0.0 0.0; + offset: -16 -14; + } + rel2 { + to: "e.swallow.content"; + relative: 1.0 1.0; + offset: 15 17; + } + } + description { state: "hidden" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + part { name: "shower"; + type: RECT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + rel1 { + relative: 0.05 0.05; + offset: 0 0; + } + rel2 { + relative: 0.95 0.95; + offset: -1 -1; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + rel1 { + relative: 0.0 0.0; + } + rel2 { + relative: 1.0 1.0; + } + } + } + part { name: "clipper-content"; + type: RECT; + clip_to: "clipper"; + mouse_events: 0; + description { state: "default" 0.0; + color: 255 255 255 255; + } + description { state: "unfocus" 0.0; + inherit: "default" 0.0; + color: 180 180 180 255; + color_class: "comp_focus-out_color"; + } + } + part { name: "e.swallow.content"; + type: SWALLOW; + clip_to: "clipper-content"; + mouse_events: 0; + description { state: "default" 0.0; + rel1 { + to: "shower"; + } + rel2 { + to: "shower"; + } + } + } + part { name: "glow"; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + rel1.to: "e.swallow.content"; + rel1.offset: -3 -3; + rel2.to: "e.swallow.content"; + rel2.offset: 2 2; + color: 255 255 255 0; + image { + normal: "bt_glow.png"; + border: 8 8 8 8; + middle: 0; + } + fill.smooth: 0; + } + description { state: "active" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + } + description { state: "faded" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 0; + rel1.offset: -23 -22; + rel2.offset: 22 22; + } + } + } + programs { + program { name: "shadow-on"; + signal: "e,state,shadow,on"; + source: "e"; + action: STATE_SET "default" 0.0; + target: "shadow"; + } + program { name: "shadow-off"; + signal: "e,state,shadow,off"; + source: "e"; + action: STATE_SET "hidden" 0.0; + target: "shadow"; + } + program { name: "show1"; + signal: "e,state,visible,on"; + source: "e"; + action: STATE_SET "visible" 0.0; + transition: DECELERATE 0.15; + target: "clipper"; + target: "shower"; + after: "show2"; + } + program { name: "show2"; + action: SIGNAL_EMIT "e,action,show,done" "e"; + } + program { name: "hide1"; + signal: "e,state,visible,off"; + source: "e"; + action: STATE_SET "default" 0.0; + transition: DECELERATE 0.30; + target: "clipper"; + target: "shower"; + after: "hide2"; + } + program { name: "hide2"; + action: SIGNAL_EMIT "e,action,hide,done" "e"; + } + program { name: "unfocus"; + signal: "e,state,focus,off"; + source: "e"; + action: STATE_SET "unfocus" 0.0; + transition: ACCELERATE 0.2; + target: "clipper-content"; + } + program { name: "focus"; + signal: "e,state,focus,on"; + source: "e"; + action: STATE_SET "default" 0.0; + transition: ACCELERATE 0.2; + target: "clipper-content"; + } + program { name: "urgent-on"; + signal: "e,state,urgent,on"; + source: "e"; + action: STATE_SET "active" 0.0; + target: "glow"; + after: "urgent2"; + } + program { name: "urgent2"; + action: STATE_SET "faded" 0.0; + transition: DECELERATE 0.5; + target: "glow"; + after: "urgent-on"; + } + program { name: "urgent-off"; + signal: "e,state,urgent,off"; + source: "e"; + action: STATE_SET "default" 0.0; + target: "glow"; + } + } + } } diff --git a/src/modules/comp/e_mod_config.c b/src/modules/comp/e_mod_config.c index 718f2de16..08d557dd4 100644 --- a/src/modules/comp/e_mod_config.c +++ b/src/modules/comp/e_mod_config.c @@ -4,6 +4,12 @@ #include "e_mod_comp.h" #include "config.h" +typedef struct _E_Demo_Style_Item +{ + Evas_Object *preview; + Evas_Object *frame; +} E_Demo_Style_Item; + struct _E_Config_Dialog_Data { int use_shadow; @@ -100,10 +106,19 @@ _create_data(E_Config_Dialog *cfd) static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { + E_Demo_Style_Item *ds_it; + _comp_mod->config_dialog = NULL; if (cfdata->shadow_style) eina_stringshare_del(cfdata->shadow_style); if (cfdata->style_demo_timer) ecore_timer_del(cfdata->style_demo_timer); - if (cfdata->style_shadows) eina_list_free(cfdata->style_shadows); + + EINA_LIST_FREE(cfdata->style_shadows, ds_it) + { + evas_object_del(ds_it->preview); + evas_object_del(ds_it->frame); + free(ds_it); + } + free(cfdata); } @@ -111,18 +126,36 @@ static int _demo_styles(void *data) { E_Config_Dialog_Data *cfdata = data; - Eina_List *l; - Evas_Object *ob; + const E_Demo_Style_Item *it; + const Eina_List *l; - if (cfdata->style_demo_state) cfdata->style_demo_state = 0; - else cfdata->style_demo_state = 1; - - EINA_LIST_FOREACH(cfdata->style_shadows, l, ob) + cfdata->style_demo_state = (cfdata->style_demo_state + 1) % 4; + EINA_LIST_FOREACH(cfdata->style_shadows, l, it) { - if (cfdata->style_demo_state) - edje_object_signal_emit(ob, "e,state,visible,on", "e"); - else - edje_object_signal_emit(ob, "e,state,visible,off", "e"); + Evas_Object *ob = it->preview; + Evas_Object *of = it->frame; + switch (cfdata->style_demo_state) + { + case 0: + edje_object_signal_emit(ob, "e,state,visible,on", "e"); + edje_object_signal_emit(ob, "e,state,focus,on", "e"); + edje_object_part_text_set(of, "e.text.label", _("Visible")); + break; + case 1: + edje_object_signal_emit(ob, "e,state,focus,off", "e"); + edje_object_part_text_set(of, "e.text.label", _("Focus-Out")); + break; + case 2: + edje_object_signal_emit(ob, "e,state,focus,on", "e"); + edje_object_part_text_set(of, "e.text.label", _("Focus-In")); + break; + case 3: + edje_object_signal_emit(ob, "e,state,visible,off", "e"); + edje_object_part_text_set(of, "e.text.label", _("Hidden")); + break; + default: + break; + } } return 1; } @@ -131,15 +164,15 @@ static void _shadow_changed(void *data, Evas_Object *obj, void *event_info) { E_Config_Dialog_Data *cfdata = data; - Eina_List *l; - Evas_Object *ob; + const E_Demo_Style_Item *it; + const Eina_List *l; - EINA_LIST_FOREACH(cfdata->style_shadows, l, ob) + EINA_LIST_FOREACH(cfdata->style_shadows, l, it) { - if (cfdata->use_shadow) - edje_object_signal_emit(ob, "e,state,shadow,on", "e"); - else - edje_object_signal_emit(ob, "e,state,shadow,off", "e"); + if (cfdata->use_shadow) + edje_object_signal_emit(it->preview, "e,state,shadow,on", "e"); + else + edje_object_signal_emit(it->preview, "e,state,shadow,off", "e"); } } @@ -173,8 +206,9 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf n = 0; EINA_LIST_FOREACH(styles, l, style) { + E_Demo_Style_Item *ds_it; char buf[PATH_MAX]; - + ob = e_livethumb_add(evas); e_livethumb_vsize_set(ob, 240, 240); @@ -192,8 +226,16 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf if (cfdata->use_shadow) edje_object_signal_emit(oo, "e,state,shadow,on", "e"); edje_object_signal_emit(oo, "e,state,visible,on", "e"); - cfdata->style_shadows = eina_list_append(cfdata->style_shadows, oo); evas_object_show(oo); + + ds_it = malloc(sizeof(E_Demo_Style_Item)); + ds_it->preview = oo; + ds_it->frame = edje_object_add(evas); + e_theme_edje_object_set + (ds_it->frame, "base/theme/modules/comp", "e/modules/comp/preview"); + edje_object_part_swallow(ds_it->frame, "e.swallow.preview", ob); + evas_object_show(ds_it->frame); + cfdata->style_shadows = eina_list_append(cfdata->style_shadows, ds_it); obd = edje_object_add(e_livethumb_evas_get(ob)); e_theme_edje_object_set(obd, "base/theme/borders", @@ -208,7 +250,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf edje_object_part_swallow(obd, "e.swallow.client", orec); evas_object_show(orec); - e_widget_ilist_append(oi, ob, style, NULL, NULL, style); + e_widget_ilist_append(oi, ds_it->frame, style, NULL, NULL, style); evas_object_show(ob); if (cfdata->shadow_style) { diff --git a/src/modules/conf_colors/e_int_config_color_classes.c b/src/modules/conf_colors/e_int_config_color_classes.c index 23c576770..de2c7db85 100644 --- a/src/modules/conf_colors/e_int_config_color_classes.c +++ b/src/modules/conf_colors/e_int_config_color_classes.c @@ -125,6 +125,7 @@ static const CFColor_Class_Description _color_classes_widgets[] = static const CFColor_Class_Description _color_classes_modules[] = { CCDESC_T("module_label", N_("Module Label")), + CCDESC_S("comp_focus-out_color", N_("Composite Focus-out Color")), {NULL, 0, NULL, COLOR_CLASS_UNKNOWN} }; #undef CCDESC_S