From 576f77d6e25f7593e2229ce67f54fd8192bf0824 Mon Sep 17 00:00:00 2001 From: "jiin.moon" Date: Fri, 26 Jun 2015 13:54:47 +0900 Subject: [PATCH] elm_config: Add feature to control transition scale for edje Summary: If the transition scale flag is enable in edje, this value affect the transition scale for edje. @feature Test Plan: test elementary_config with enventor tool Reviewers: raster, Hermet Subscribers: raster Differential Revision: https://phab.enlightenment.org/D2288 --- legacy/elementary/config/default/base.src.in | 3 +- legacy/elementary/config/mobile/base.src.in | 3 +- legacy/elementary/config/standard/base.src.in | 3 +- legacy/elementary/src/bin/config.c | 45 ++++++++++++++++++- legacy/elementary/src/lib/elm_config.c | 26 +++++++++++ legacy/elementary/src/lib/elm_config.h | 25 +++++++++++ legacy/elementary/src/lib/elm_priv.h | 3 +- 7 files changed, 102 insertions(+), 6 deletions(-) diff --git a/legacy/elementary/config/default/base.src.in b/legacy/elementary/config/default/base.src.in index a0245f3b94..48fab232ab 100644 --- a/legacy/elementary/config/default/base.src.in +++ b/legacy/elementary/config/default/base.src.in @@ -1,5 +1,5 @@ group "Elm_Config" struct { - value "config_version" int: 131074; + value "config_version" int: 131075; value "engine" string: ""; value "vsync" uchar: 0; value "thumbscroll_enable" uchar: 1; @@ -96,6 +96,7 @@ group "Elm_Config" struct { value "audio_mute_all" uchar: 0; value "win_auto_focus_enable" uchar: 1; value "win_auto_focus_animate" uchar: 1; + value "transition_duration_factor" double:1.0; group "color_palette" list { group "Elm_Custom_Palette" struct { value "palette_name" string: "default"; diff --git a/legacy/elementary/config/mobile/base.src.in b/legacy/elementary/config/mobile/base.src.in index e9db0a20d0..772aca06ad 100644 --- a/legacy/elementary/config/mobile/base.src.in +++ b/legacy/elementary/config/mobile/base.src.in @@ -1,5 +1,5 @@ group "Elm_Config" struct { - value "config_version" int: 131074; + value "config_version" int: 131075; value "engine" string: ""; value "vsync" uchar: 0; value "thumbscroll_enable" uchar: 1; @@ -100,6 +100,7 @@ group "Elm_Config" struct { value "audio_mute_all" uchar: 0; value "win_auto_focus_enable" uchar: 1; value "win_auto_focus_animate" uchar: 1; + value "transition_duration_factor" double: 1.0; group "color_palette" list { group "Elm_Custom_Palette" struct { value "palette_name" string: "default"; diff --git a/legacy/elementary/config/standard/base.src.in b/legacy/elementary/config/standard/base.src.in index 9cae3a1cda..af5ab67488 100644 --- a/legacy/elementary/config/standard/base.src.in +++ b/legacy/elementary/config/standard/base.src.in @@ -1,5 +1,5 @@ group "Elm_Config" struct { - value "config_version" int: 131074; + value "config_version" int: 131075; value "engine" string: ""; value "vsync" uchar: 0; value "thumbscroll_enable" uchar: 0; @@ -97,6 +97,7 @@ group "Elm_Config" struct { value "audio_mute_all" uchar: 0; value "win_auto_focus_enable" uchar: 1; value "win_auto_focus_animate" uchar: 1; + value "transition_duration_factor" double: 1.0; group "color_palette" list { group "Elm_Custom_Palette" struct { value "palette_name" string: "default"; diff --git a/legacy/elementary/src/bin/config.c b/legacy/elementary/src/bin/config.c index 1663d4d64e..d1740248dd 100644 --- a/legacy/elementary/src/bin/config.c +++ b/legacy/elementary/src/bin/config.c @@ -824,6 +824,20 @@ atspi_change(void *data EINA_UNUSED, elm_config_save(); } +static void +transition_duration_change(void *data EINA_UNUSED, + Evas_Object *obj, + void *event_info EINA_UNUSED) +{ + double val = elm_slider_value_get(obj); + Eina_Bool scale = elm_config_transition_duration_factor_get(); + + if (scale == val) return; + elm_config_transition_duration_factor_set(val); + elm_config_save(); + elm_config_all_flush(); +} + static void _status_basic(Evas_Object *win, Evas_Object *bx0) @@ -1177,7 +1191,7 @@ _config_display_update(Evas_Object *win) ts_min_friction, ts_friction_standard, ts_border_friction, ts_sensitivity_friction, ts_acceleration_threshold, ts_acceleration_time_limit, ts_acceleration_weight, page_friction, - bring_in_friction, zoom_friction; + bring_in_friction, zoom_friction, transition_duration; const char *curr_theme; Eina_Bool s_bounce, ts; Elm_Theme *th; @@ -1188,6 +1202,7 @@ _config_display_update(Evas_Object *win) flush_interval = elm_config_cache_flush_interval_get(); font_c = elm_config_cache_font_cache_size_get(); image_c = elm_config_cache_image_cache_size_get(); + transition_duration = elm_config_transition_duration_factor_get(); edje_file_c = elm_config_cache_edje_file_cache_size_get(); edje_col_c = elm_config_cache_edje_collection_cache_size_get(); @@ -1279,6 +1294,7 @@ _config_display_update(Evas_Object *win) elm_theme_set(th, curr_theme); elm_object_theme_set(evas_object_data_get(win, "theme_preview"), th); elm_theme_free(th); + elm_config_transition_duration_factor_set(transition_duration); eina_stringshare_del(curr_theme); } @@ -1718,7 +1734,7 @@ static void _status_config_etc(Evas_Object *win, Evas_Object *naviframe) { - Evas_Object *bx, *ck; + Evas_Object *bx, *ck, *sl, *fr, *bx2; bx = elm_box_add(win); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0); @@ -1741,6 +1757,31 @@ _status_config_etc(Evas_Object *win, CHECK_ADD("Enable ATSPI support", "Set atspi mode", atspi_change, NULL); elm_check_state_set(ck, elm_config_atspi_mode_get()); + // transition duration in edje + fr = elm_frame_add(bx); + elm_object_text_set(fr, "Edje Transition Duration Factor"); + evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0.5); + elm_box_pack_end(bx, fr); + evas_object_show(fr); + + bx2 = elm_box_add(fr); + elm_object_content_set(fr, bx2); + evas_object_show(bx2); + + sl = elm_slider_add(bx2); + evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0); + evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); + elm_slider_span_size_set(sl, 120); + elm_slider_unit_format_set(sl, "%1.1f"); + elm_slider_indicator_format_set(sl, "%1.1f"); + elm_slider_min_max_set(sl, 0, 20.0); + elm_slider_value_set(sl, elm_config_transition_duration_factor_get()); + elm_box_pack_end(bx2, sl); + evas_object_show(sl); + evas_object_smart_callback_add(sl, "changed", sc_round, NULL); + evas_object_smart_callback_add(sl, "delay,changed", transition_duration_change, NULL); + evas_object_data_set(win, "etc", bx); elm_naviframe_item_simple_push(naviframe, bx); diff --git a/legacy/elementary/src/lib/elm_config.c b/legacy/elementary/src/lib/elm_config.c index b447296922..c4a566ce73 100644 --- a/legacy/elementary/src/lib/elm_config.c +++ b/legacy/elementary/src/lib/elm_config.c @@ -437,6 +437,7 @@ _desc_init(void) ELM_CONFIG_VAL(D, T, atspi_mode, T_UCHAR); ELM_CONFIG_VAL(D, T, win_auto_focus_enable, T_UCHAR); ELM_CONFIG_VAL(D, T, win_auto_focus_animate, T_UCHAR); + ELM_CONFIG_VAL(D, T, transition_duration_factor, T_DOUBLE); #undef T #undef D #undef T_INT @@ -1221,6 +1222,7 @@ _config_sub_apply(void) edje_scale_set(_elm_config->scale); edje_password_show_last_set(_elm_config->password_show_last); edje_password_show_last_timeout_set(_elm_config->password_show_last_timeout); + edje_transition_duration_factor_set(_elm_config->transition_duration_factor); if (_elm_config->modules) _elm_module_parse(_elm_config->modules); edje_audio_channel_mute_set(EDJE_CHANNEL_EFFECT, _elm_config->audio_mute_effect); edje_audio_channel_mute_set(EDJE_CHANNEL_BACKGROUND, _elm_config->audio_mute_background); @@ -1464,6 +1466,7 @@ _config_load(void) _elm_config->gl_depth = 0; _elm_config->gl_msaa = 0; _elm_config->gl_stencil = 0; + _elm_config->transition_duration_factor = 1.0; } static void @@ -1750,6 +1753,10 @@ _config_update(void) _elm_config->win_auto_focus_animate = tcfg->win_auto_focus_animate; IFCFGEND + IFCFG(0x0003) + _elm_config->transition_duration_factor = tcfg->transition_duration_factor; + IFCFGEND + /** * Fix user config for current ELM_CONFIG_EPOCH here. **/ @@ -2099,6 +2106,9 @@ _env_get(void) if (s) _elm_config->magnifier_scale = _elm_atof(s); s = getenv("ELM_ATSPI_MODE"); if (s) _elm_config->atspi_mode = ELM_ATSPI_MODE_ON; + + s = getenv("ELM_TRANSITION_DURATION_FACTOR"); + if (s) _elm_config->transition_duration_factor = atof(s); } static void @@ -3514,6 +3524,22 @@ elm_config_indicator_service_get(int rotation) } } +EAPI void +elm_config_transition_duration_factor_set(double factor) +{ + if (factor < 0.0) return; + if (_elm_config->transition_duration_factor == factor) return; + _elm_config->transition_duration_factor = factor; + edje_transition_duration_factor_set(_elm_config->transition_duration_factor); +} + + +EAPI double +elm_config_transition_duration_factor_get(void) +{ + return _elm_config->transition_duration_factor; +} + void _elm_config_profile_set(const char *profile) { diff --git a/legacy/elementary/src/lib/elm_config.h b/legacy/elementary/src/lib/elm_config.h index 5718790d93..786174ea31 100644 --- a/legacy/elementary/src/lib/elm_config.h +++ b/legacy/elementary/src/lib/elm_config.h @@ -1838,6 +1838,31 @@ EAPI void elm_config_atspi_mode_set(Eina_Bool is_atspi); * @} */ +/** + * Set the transition duration factor + * + * This function sets the edje transition duration factor + * It will affect the duration of edje transitions + * + * @param factor The duration factor for transition in edje + * + * @note This value affect duration of transitions in edje + * + * @since 1.15 + * + * @see edje_transition_duration_set() for more details + */ +EAPI void elm_config_transition_duration_factor_set(double factor); + +/** + * Get the duration factor of transitions + * + * @return The duration factor of transition in edje + * + * @since 1.15 + */ +EAPI double elm_config_transition_duration_factor_get(void); + /** * @} */ diff --git a/legacy/elementary/src/lib/elm_priv.h b/legacy/elementary/src/lib/elm_priv.h index 9e7bc42ba9..1ed943726a 100644 --- a/legacy/elementary/src/lib/elm_priv.h +++ b/legacy/elementary/src/lib/elm_priv.h @@ -123,7 +123,7 @@ struct _Elm_Theme * the users config doesn't need to be wiped - simply new values need * to be put in */ -#define ELM_CONFIG_FILE_GENERATION 0x0002 +#define ELM_CONFIG_FILE_GENERATION 0x0003 #define ELM_CONFIG_VERSION_EPOCH_OFFSET 16 #define ELM_CONFIG_VERSION ((ELM_CONFIG_EPOCH << ELM_CONFIG_VERSION_EPOCH_OFFSET) | \ ELM_CONFIG_FILE_GENERATION) @@ -292,6 +292,7 @@ struct _Elm_Config unsigned char audio_mute_all; unsigned char win_auto_focus_enable; unsigned char win_auto_focus_animate; + double transition_duration_factor; Eina_List *bindings; Eina_Bool atspi_mode; int gl_depth;