On Fri, Dec 3, 2010 at 5:58 AM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> From: samsung.
>
>  some added features to calendar. along with fixes of those features so
>  they work right.
>
>
>
> Author:       raster
> Date:         2010-12-02 23:58:43 -0800 (Thu, 02 Dec 2010)
> New Revision: 55177
> Trac:         http://trac.enlightenment.org/e/changeset/55177
>
> Modified:
>  trunk/TMP/st/elementary/src/lib/Elementary.h.in 
> trunk/TMP/st/elementary/src/lib/elm_calendar.c
>
> Modified: trunk/TMP/st/elementary/src/lib/Elementary.h.in
> ===================================================================
> --- trunk/TMP/st/elementary/src/lib/Elementary.h.in     2010-12-03 06:14:30 
> UTC (rev 55176)
> +++ trunk/TMP/st/elementary/src/lib/Elementary.h.in     2010-12-03 07:58:43 
> UTC (rev 55177)
> @@ -2309,6 +2309,10 @@
>    EAPI void         elm_calendar_marks_clear(Evas_Object *obj);
>    EAPI const Eina_List *elm_calendar_marks_get(const Evas_Object *obj);
>    EAPI void         elm_calendar_marks_draw(Evas_Object *obj);
> +   EAPI void         elm_calendar_text_saturday_color_set(Evas_Object *obj, 
> int pos);
> +   EAPI void         elm_calendar_text_sunday_color_set(Evas_Object *obj, 
> int pos);
> +   EAPI void         elm_calendar_text_weekday_color_set(Evas_Object *obj, 
> int pos);
> +

Why are you adding these fugly functions on elm_calendar API ?
If you need that the calendar displays customized colors you can do
this using a theme (you could use calendar items macro CIT to create
CIT_SUN, CIT_SAT and CIT_WEEKDAY with different texts parts). If you
need to
dynamically set colors sending a signal, ok, you can do this using
elm_object_signal_emit.

I honestly didn't understand why do you need this here. And would be
nice if you could split patches indenting, fixing stuff, and adding
new features, so I could revert stuff more easily.

Instead of removing stuff like elm_label_text_color_set you're adding
more stuff that should be changed on the theme =/

>    /* smart callbacks called:
>     * changed - emitted when the user select a day or change the displayed
>     * month.
>
> Modified: trunk/TMP/st/elementary/src/lib/elm_calendar.c
> ===================================================================
> --- trunk/TMP/st/elementary/src/lib/elm_calendar.c      2010-12-03 06:14:30 
> UTC (rev 55176)
> +++ trunk/TMP/st/elementary/src/lib/elm_calendar.c      2010-12-03 07:58:43 
> UTC (rev 55177)
> @@ -24,6 +24,13 @@
>  * changed - emitted when the user selects a day or changes the displayed
>  * month, what actually changes the selected day as well.
>  */
> +typedef enum _Day_Color
> +{
> +  DAY_WEEKDAY = 0,
> +  DAY_SATURDAY = 1,
> +  DAY_SUNDAY = 2
> +} Day_Color;
> +
>  typedef struct _Widget_Data Widget_Data;
>
>  struct _Widget_Data
> @@ -37,6 +44,7 @@
>    char * (*format_func) (struct tm *stime);
>    const char *weekdays[7];
>    struct tm current_time, selected_time;
> +   Day_Color day_color[42];
>    Eina_Bool selection_enabled : 1;
>  };
>
> @@ -107,14 +115,16 @@
>    month = time->tm_mon;
>    year = time->tm_year + 1900;
>
> -   return _days_in_month[((!(year % 4)) && ((!(year % 400)) || (year % 
> 100)))]
> -       [month];
> +   return _days_in_month[((!(year % 4)) &&
> +                          ((!(year % 400)) ||
> +                              (year % 100)))]
> +                        [month];
>  }
>
>  static inline void
>  _unselect(Widget_Data *wd, int selected)
>  {
> -   char emission[18];
> +   char emission[32];
>    snprintf(emission, sizeof(emission), "cit_%i,unselected", selected);
>    edje_object_signal_emit(wd->calendar, emission, "elm");
>  }
> @@ -122,7 +132,7 @@
>  static inline void
>  _select(Widget_Data *wd, int selected)
>  {
> -   char emission[16];
> +   char emission[32];
>    snprintf(emission, sizeof(emission), "cit_%i,selected", selected);
>    edje_object_signal_emit(wd->calendar, emission, "elm");
>  }
> @@ -130,7 +140,7 @@
>  static inline void
>  _not_today(Widget_Data *wd)
>  {
> -   char emission[17];
> +   char emission[32];
>    snprintf(emission, sizeof(emission), "cit_%i,not_today", wd->today_it);
>    edje_object_signal_emit(wd->calendar, emission, "elm");
>    wd->today_it = -1;
> @@ -139,7 +149,7 @@
>  static inline void
>  _today(Widget_Data *wd, int it)
>  {
> -   char emission[13];
> +   char emission[32];
>    snprintf(emission, sizeof(emission), "cit_%i,today", it);
>    edje_object_signal_emit(wd->calendar, emission, "elm");
>    wd->today_it = it;
> @@ -168,6 +178,38 @@
>  }
>
>  static void
> +_text_day_color_update(Widget_Data *wd, int pos)
> +{
> +   char emission[32];
> +
> +   switch (wd->day_color[pos])
> +    {
> +    case DAY_WEEKDAY:
> +      snprintf(emission, sizeof(emission), "cit_%i,weekday", pos);
> +      break;
> +    case DAY_SATURDAY:
> +      snprintf(emission, sizeof(emission), "cit_%i,saturday", pos);
> +      break;
> +    case DAY_SUNDAY:
> +      snprintf(emission, sizeof(emission), "cit_%i,sunday", pos);
> +      break;
> +    default:
> +      return;
> +    }
> +
> +   edje_object_signal_emit(wd->calendar, emission, "elm");
> +}
> +
> +static void
> +_text_day_color_set(Widget_Data *wd, Day_Color col, int pos)
> +{
> +   if ((pos < 0) || (pos >= 42)) return;
> +   if (wd->day_color[pos] == col) return;
> +   wd->day_color[pos] = col;
> +   _text_day_color_update(wd, pos);
> +}
> +
> +static void
>  _populate(Evas_Object *obj)
>  {
>    int maxdays, day, mon, year, i;
> @@ -176,6 +218,7 @@
>    struct tm first_day;
>    Eina_List *l;
>    char *buf;
> +   Eina_Bool last_row = EINA_TRUE;
>    Widget_Data *wd = elm_widget_data_get(obj);
>
>    if (!wd) return;
> @@ -188,10 +231,11 @@
>
>    /* Set selected month */
>    buf = wd->format_func(&wd->selected_time);
> -   if (buf) {
> -     edje_object_part_text_set(wd->calendar, "month_text", buf);
> -     free(buf);
> -   }
> +   if (buf)
> +     {
> +       edje_object_part_text_set(wd->calendar, "month_text", buf);
> +       free(buf);
> +     }
>    else
>      edje_object_part_text_set(wd->calendar, "month_text", "");
>
> @@ -201,13 +245,53 @@
>    first_day.tm_mday = 1;
>    mktime(&first_day);
>
> +   // Layout of the calendar is changed for removing the unfilled last row.
> +   wd->first_day_it = first_day.tm_wday;
> +
> +  if ((35 - wd->first_day_it) > (maxdays - 1)) last_row = EINA_FALSE;
> +
> +  if (!last_row)
> +    {
> +      char emission[32];
> +
> +      for (i = 0; i < 5; i++)
> +        {
> +          snprintf(emission, sizeof(emission), "cseph_%i,row_hide", i);
> +          edje_object_signal_emit(wd->calendar, emission, "elm");
> +        }
> +      snprintf(emission, sizeof(emission), "cseph_%i,row_invisible", 5);
> +      edje_object_signal_emit(wd->calendar, emission, "elm");
> +      for (i = 0; i < 35; i++)
> +        {
> +          snprintf(emission, sizeof(emission), "cit_%i,cell_expanded", i);
> +          edje_object_signal_emit(wd->calendar, emission, "elm");
> +        }
> +      for (i = 35; i < 42; i++)
> +        {
> +          snprintf(emission, sizeof(emission), "cit_%i,cell_invisible", i);
> +          edje_object_signal_emit(wd->calendar, emission, "elm");
> +        }
> +    }
> +  else
> +    {
> +      char emission[32];
> +
> +      for (i = 0; i < 6; i++)
> +        {
> +          snprintf(emission, sizeof(emission), "cseph_%i,row_show", i);
> +          edje_object_signal_emit(wd->calendar, emission, "elm");
> +        }
> +      for (i = 0; i < 42; i++)
> +        {
> +          snprintf(emission, sizeof(emission), "cit_%i,cell_default", i);
> +          edje_object_signal_emit(wd->calendar, emission, "elm");
> +        }
> +    }
> +
>    for (i = 0; i < 42; i++)
>      {
> -       if ((!day) && (i == first_day.tm_wday))
> -         {
> -            day = 1;
> -            wd->first_day_it = i;
> -         }
> +        _text_day_color_update(wd, i);
> +       if ((!day) && (i == first_day.tm_wday)) day = 1;
>
>        if ((day == wd->current_time.tm_mday)
>              && (mon == wd->current_time.tm_mon)
> @@ -225,9 +309,9 @@
>          }
>
>        if ((day) && (day <= maxdays))
> -         snprintf(day_s, sizeof(day_s), "%d", day++);
> +         snprintf(day_s, sizeof(day_s), "%i", day++);
>        else
> -            day_s[0] = 0;
> +          day_s[0] = 0;
>
>        snprintf(part, sizeof(part), "cit_%i.text", i);
>        edje_object_part_text_set(wd->calendar, part, day_s);
> @@ -317,10 +401,12 @@
>    if (wd->update_timer) ecore_timer_del(wd->update_timer);
>
>    if (wd->marks)
> +     {
>        EINA_LIST_FREE(wd->marks, mark)
> -       {
> +         {
>            _mark_free(mark);
> -       }
> +         }
> +     }
>
>    for (i = 0; i < 7; i++)
>      eina_stringshare_del(wd->weekdays[i]);
> @@ -351,12 +437,12 @@
>    Widget_Data *wd = elm_widget_data_get(obj);
>    if (!wd) return;
>    _elm_theme_object_set(obj, wd->calendar, "calendar", "base",
> -        elm_widget_style_get(obj));
> +                         elm_widget_style_get(obj));
>    _set_headers(obj);
>    _populate(obj);
>    edje_object_message_signal_process(wd->calendar);
>    edje_object_scale_set(wd->calendar,
> -        elm_widget_scale_get(obj) * _elm_config->scale);
> +                         elm_widget_scale_get(obj) * _elm_config->scale);
>    _sizing_eval(obj);
>  }
>
> @@ -374,13 +460,14 @@
>    Widget_Data *wd = elm_widget_data_get(obj);
>    if (!wd) return;
>    edje_object_signal_callback_add(wd->calendar, emission,
> -        source, func_cb, data);
> +                                   source, func_cb, data);
>  }
>
>  static void
>  _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char 
> *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, 
> const char *source), void *data)
>  {
>    Widget_Data *wd = elm_widget_data_get(obj);
> +   if (!wd) return;
>    edje_object_signal_callback_del_full(wd->calendar, emission, source, 
> func_cb,
>                                         data);
>  }
> @@ -533,7 +620,7 @@
>  static inline int
>  _time_to_next_day(struct tm *t)
>  {
> -  return (((24 - t->tm_hour) * 60) - t->tm_min) * 60 - t->tm_sec;
> +  return ((((24 - t->tm_hour) * 60) - t->tm_min) * 60) - t->tm_sec;
>  }
>
>  static Eina_Bool
> @@ -1100,3 +1187,54 @@
>    if (!wd) return;
>    _populate(obj);
>  }
> +
> +/**
> + * Set a text color to the saturday color.
> + *
> + * @param obj The calendar object
> + * @param pos The text position
> + *
> + * @ingroup Calendar
> + */
> +EAPI void
> +elm_calendar_text_saturday_color_set(Evas_Object *obj, int pos)
> +{
> +  ELM_CHECK_WIDTYPE(obj, widtype);
> +  Widget_Data *wd = elm_widget_data_get(obj);
> +  if (!wd) return;
> +  _text_day_color_set(wd, DAY_SATURDAY, pos);
> +}
> +
> +/**
> + * Set a text color to the sunday color.
> + *
> + * @param obj The calendar object
> + * @param pos The text position
> + *
> + * @ingroup Calendar
> + */
> +EAPI void
> +elm_calendar_text_sunday_color_set(Evas_Object *obj, int pos)
> +{
> +  ELM_CHECK_WIDTYPE(obj, widtype);
> +  Widget_Data *wd = elm_widget_data_get(obj);
> +  if (!wd) return;
> +  _text_day_color_set(wd, DAY_SUNDAY, pos);
> +}
> +
> +/**
> + * Set a text color to the weekday color.
> + *
> + * @param obj The calendar object
> + * @param pos The text position
> + *
> + * @ingroup Calendar
> + */
> +EAPI void
> +elm_calendar_text_weekday_color_set(Evas_Object *obj, int pos)
> +{
> +  ELM_CHECK_WIDTYPE(obj, widtype);
> +  Widget_Data *wd = elm_widget_data_get(obj);
> +  if (!wd) return;
> +  _text_day_color_set(wd, DAY_WEEKDAY, pos);
> +}
>
>
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to