From 5e2b1dde68bc6f61ec20fde47f5c849348c25636 Mon Sep 17 00:00:00 2001 From: Jiwon Kim Date: Mon, 11 Jul 2016 16:10:34 +0900 Subject: [PATCH] elm_calendar: provides way for configuration of weekend text color Summary: Suggest new mark_type for elm_calendar_mark_add(). The mark names are "weekend/day1", "weekend/day2". It can be used for each country. Some country can apply to "weekend/day2" to friday if day rest only a day for a week. Until now, there is no way to separate holiday, saturday and sunday. Test Plan: 1. saturday ``` struct tm t = { 0, 0, 12, 6, 0, 0, 6, 6, -1 }; elm_calendar_mark_add(obj, "weekend/day1", &t, ELM_CALENDAR_WEEKLY); ``` 2. sunday ``` struct tm t = { 0, 0, 12, 7, 0, 0, 0, 0, -1 }; elm_calendar_mark_add(obj, "weekend/day2", &t, ELM_CALENDAR_WEEKLY); ``` Reviewers: CHAN, cedric, raster Reviewed By: raster Subscribers: raster, akanad, id213sin, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4148 --- data/elementary/themes/colorclasses.edc | 10 +++++ data/elementary/themes/edc/elm/calendar.edc | 49 +++++++++++++++++++++ src/lib/elementary/elm_removed.h | 4 +- 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/data/elementary/themes/colorclasses.edc b/data/elementary/themes/colorclasses.edc index dbfc3f8b08..ab6dc07835 100644 --- a/data/elementary/themes/colorclasses.edc +++ b/data/elementary/themes/colorclasses.edc @@ -170,6 +170,16 @@ color_classes { color3: 255 255 255 192; desc: "Disabled Day Text"; } + color_class { name: "calendar_day_text_weekend1"; + color: 128 128 128 255; + color3: 0 0 0 128; + desc: "Weekend Day1 Text"; + } + color_class { name: "calendar_day_text_weekend2"; + color: 128 128 128 255; + color3: 0 0 0 128; + desc: "Weekend Day2 Text"; + } color_class { name: "check_text"; color: FN_COL_DEFAULT; desc: "Text of a checkbox's label"; diff --git a/data/elementary/themes/edc/elm/calendar.edc b/data/elementary/themes/edc/elm/calendar.edc index e5edcba0b9..662bd51def 100644 --- a/data/elementary/themes/edc/elm/calendar.edc +++ b/data/elementary/themes/edc/elm/calendar.edc @@ -11,6 +11,12 @@ style { name: "calendar_date_disabled_style";\ base: "font="FN" font_size=10 color=#151515 style=shadow,bottom shadow_color=#ffffffc0 align=center text_class=calendar_day_text_disabled text_class=calendar_day_text_disabled";\ }\ + style { name: "calendar_date_weekend1_style";\ + base: "font="FN" font_size=10 color=#2020C0 style=shadow,bottom shadow_color=#ffffffc0 align=center text_class=calendar_day_text_weekend1 color_class=calendar_day_text_weekend1";\ + }\ + style { name: "calendar_date_weekend2_style";\ + base: "font="FN" font_size=10 color=#C02020 style=shadow,bottom shadow_color=#ffffffc0 align=center text_class=calendar_day_text_weekend2 color_class=calendar_day_text_weekend2";\ + }\ #define CAL_SPIN(_sufix, _text, _relative)\ part { name: "left_bt"#_sufix; type: SPACER;\ @@ -215,6 +221,14 @@ inherit: "default" 0.0; \ text.style: "calendar_date_disabled_style"; \ } \ + description { state: "weekend/day1" 0.0; \ + inherit: "default" 0.0; \ + text.style: "calendar_date_weekend1_style"; \ + } \ + description { state: "weekend/day2" 0.0; \ + inherit: "default" 0.0; \ + text.style: "calendar_date_weekend2_style"; \ + } \ } \ part { name: "cit_"#_pos".check"; mouse_events: 0; \ scale: 1; \ @@ -324,8 +338,19 @@ source: "elm"; \ action: STATE_SET "default" 0.0; \ target: "cit_"#_pos".check"; \ + after: "cit_"#_pos".weekends_clear"; \ after: "cit_"#_pos".holiday_clear"; \ } \ + program { \ + name: "cit_"#_pos".weekends_clear"; \ + script { \ + new st[31]; \ + new Float:vl; \ + get_state(PART:"cit_"#_pos".text", st, 30, vl); \ + if (!strcmp(st, "weekend/day1") || !strcmp(st, "weekend/day2")) \ + set_state(PART:"cit_"#_pos".text", "default", 0.0); \ + } \ + } \ program { \ name: "cit_"#_pos".holiday_clear"; \ script { \ @@ -355,6 +380,30 @@ set_state(PART:"cit_"#_pos".text", "holiday", 0.0); \ } \ } \ + program { \ + name: "cit_"#_pos".weekend/day1"; \ + signal: "cit_"#_pos",weekend/day1"; \ + source: "elm"; \ + script { \ + new st[31]; \ + new Float:vl; \ + get_state(PART:"cit_"#_pos".text", st, 30, vl); \ + if ((strcmp(st, "today")) && (strcmp(st, "holiday")) )\ + set_state(PART:"cit_"#_pos".text", "weekend/day1", 0.0); \ + } \ + } \ + program { \ + name: "cit_"#_pos".weekend/day2"; \ + signal: "cit_"#_pos",weekend/day2"; \ + source: "elm"; \ + script { \ + new st[31]; \ + new Float:vl; \ + get_state(PART:"cit_"#_pos".text", st, 30, vl); \ + if ((strcmp(st, "today")) && (strcmp(st, "holiday")) )\ + set_state(PART:"cit_"#_pos".text", "weekend/day2", 0.0); \ + } \ + } \ } group { name: "elm/calendar/base/default"; diff --git a/src/lib/elementary/elm_removed.h b/src/lib/elementary/elm_removed.h index e416cc47cc..2d0e0c25e4 100644 --- a/src/lib/elementary/elm_removed.h +++ b/src/lib/elementary/elm_removed.h @@ -1293,7 +1293,7 @@ EINA_DEPRECATED EAPI Evas_Object *elm_button_icon_unset(Evas_Object *obj); * * @code * struct tm t = { 0, 0, 12, 6, 0, 0, 6, 6, -1 }; - * elm_calendar_mark_add(obj, "sat", &t, ELM_CALENDAR_WEEKLY); + * elm_calendar_mark_add(obj, "weekend/day1", &t, ELM_CALENDAR_WEEKLY); * @endcode * * @see elm_calendar_mark_add() @@ -1313,7 +1313,7 @@ EINA_DEPRECATED EAPI void elm_calendar_text_saturday_color_set(Evas_Object *obj, * * @code * struct tm t = { 0, 0, 12, 7, 0, 0, 0, 0, -1 }; - * elm_calendar_mark_add(obj, "sat", &t, ELM_CALENDAR_WEEKLY); + * elm_calendar_mark_add(obj, "weekend/day2", &t, ELM_CALENDAR_WEEKLY); * @endcode * * @see elm_calendar_mark_add()