summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoochan Lee <wc0917.lee@samsung.com>2018-07-23 15:49:10 +0900
committerHermet Park <hermetpark@gmail.com>2018-07-23 15:49:10 +0900
commit62a09f69a111892e9b5534c0c78c96c6db807622 (patch)
treeaa0595769df935e8eefaf6070a2426930a5c685a
parent3ca3f865fd14e1058cdf33feb6ed6f63c83d0c6f (diff)
Efl.Ui.Calendar, elm_calendar: Code fixed to support auto repeat feature.
Summary: 1. Why there is a edje signal callback in elm_calendar? and do we need to maintain? We used edje part like a button before (3 years ago?), So there is a callbacks to get edje signal. Im pretty sure it is not use anymore. but we need to maintain backward compatibility. 2. elm_calendar using using repeat feature in efl_ui_button for it. why did i change it to manual timer? We opend elm_calendar_interval_set() APIs. Support this API the manual timer is proper then using button's feature. 3. why scroll freeze? and why only elm_calendar does it? When the user long press calendar button area and then move the scroll will be activated. it can prevent that weird action. efl_ui_calendar using button's feature. i not sure scroll freeze is deserve to attached in button side as a feature or not. So i will consider more for this case. 4. Why efl_ui_calendar doesn't have year buttons (double spinner case) After interface work, we don't accept style change in the runtime. so that featrue will be supported as API. The year_button_set/get() property should be added. but i dont know is it really needed... If the app developer want use year inc/dec button for efl_ui_calendar. they can inherit the class and make it easily. Test Plan: View, Action, API test in the elementary-test sample App. Ps. The issue of the calendar2 crash when it closed. It's not relative with this commit. its focus. i will look around. Reviewers: Hermet, zmike, ManMower, segfaultxavi, devilhorns Reviewed By: Hermet Subscribers: cedric, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6626
-rw-r--r--src/lib/elementary/efl_ui_calendar.c138
-rw-r--r--src/lib/elementary/efl_ui_calendar_private.h8
-rw-r--r--src/lib/elementary/elm_calendar.c246
-rw-r--r--src/lib/elementary/elm_widget_calendar.h5
4 files changed, 103 insertions, 294 deletions
diff --git a/src/lib/elementary/efl_ui_calendar.c b/src/lib/elementary/efl_ui_calendar.c
index 7eedec1f1f..ae1e648c94 100644
--- a/src/lib/elementary/efl_ui_calendar.c
+++ b/src/lib/elementary/efl_ui_calendar.c
@@ -21,6 +21,9 @@
21#define EFL_UI_CALENDAR_BUTTON_YEAR_LEFT "efl.calendar.button_year.left" 21#define EFL_UI_CALENDAR_BUTTON_YEAR_LEFT "efl.calendar.button_year.left"
22#define EFL_UI_CALENDAR_BUTTON_YEAR_RIGHT "efl.calendar.button_year.right" 22#define EFL_UI_CALENDAR_BUTTON_YEAR_RIGHT "efl.calendar.button_year.right"
23 23
24#define FIRST_INTERVAL 0.85
25#define INTERVAL 0.2
26
24static const char PART_NAME_DEC_BUTTON[] = "dec_button"; 27static const char PART_NAME_DEC_BUTTON[] = "dec_button";
25static const char PART_NAME_INC_BUTTON[] = "inc_button"; 28static const char PART_NAME_INC_BUTTON[] = "inc_button";
26 29
@@ -36,20 +39,12 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
36}; 39};
37 40
38static void 41static void
39_button_widget_month_dec_start(void *data, 42_inc_dec_btn_clicked_cb(void *data,
40 const Efl_Event *ev EINA_UNUSED); 43 const Efl_Event *ev);
41
42static void
43_button_widget_month_dec_start_click(void *data,
44 const Efl_Event *ev EINA_UNUSED);
45
46static void
47_button_widget_month_inc_start(void *data,
48 const Efl_Event *ev EINA_UNUSED);
49 44
50static void 45static void
51_button_widget_month_inc_start_click(void *data, 46_inc_dec_btn_repeated_cb(void *data,
52 const Efl_Event *ev EINA_UNUSED); 47 const Efl_Event *ev);
53 48
54static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params); 49static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params);
55 50
@@ -253,7 +248,7 @@ _access_calendar_item_register(Evas_Object *obj)
253 { 248 {
254 snprintf(pname, sizeof(pname), "efl.cit_%d.access", i); 249 snprintf(pname, sizeof(pname), "efl.cit_%d.access", i);
255 _elm_access_edje_object_part_object_unregister 250 _elm_access_edje_object_part_object_unregister
256 (obj, elm_layout_edje_get(obj), pname); 251 (obj, elm_layout_edje_get(obj), pname);
257 } 252 }
258 } 253 }
259} 254}
@@ -282,9 +277,6 @@ _access_calendar_spinner_register(Evas_Object *obj)
282 ai = _elm_access_info_get(sd->month_access); 277 ai = _elm_access_info_get(sd->month_access);
283 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("calendar month")); 278 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("calendar month"));
284 279
285 ai = _elm_access_info_get(sd->year_access);
286 _elm_access_text_set(ai, ELM_ACCESS_TYPE, E_("calendar year"));
287
288 o = elm_layout_edje_get(obj); 280 o = elm_layout_edje_get(obj);
289 edje_object_freeze(o); 281 edje_object_freeze(o);
290 po = (Evas_Object *)edje_object_part_object_get(o, "month_text"); 282 po = (Evas_Object *)edje_object_part_object_get(o, "month_text");
@@ -311,7 +303,6 @@ _flush_calendar_composite_elements(Evas_Object *obj, Efl_Ui_Calendar_Data *sd)
311 EXTEND(sd->month_access); 303 EXTEND(sd->month_access);
312 EXTEND(sd->dec_btn_month); 304 EXTEND(sd->dec_btn_month);
313 EXTEND(sd->inc_btn_month); 305 EXTEND(sd->inc_btn_month);
314 EXTEND(sd->year_access);
315 306
316#undef EXTEND 307#undef EXTEND
317 308
@@ -461,6 +452,21 @@ _set_headers(Evas_Object *obj)
461 elm_layout_thaw(obj); 452 elm_layout_thaw(obj);
462} 453}
463 454
455static Eo *
456_btn_create(Eo *obj, const char *style, char *part)
457{
458 return efl_add(EFL_UI_BUTTON_CLASS, obj,
459 elm_widget_element_update(obj, efl_added, style),
460 efl_ui_autorepeat_enabled_set(efl_added, EINA_TRUE),
461 efl_ui_autorepeat_initial_timeout_set(efl_added, FIRST_INTERVAL),
462 efl_ui_autorepeat_gap_timeout_set(efl_added, INTERVAL),
463 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
464 _inc_dec_btn_clicked_cb, obj),
465 efl_event_callback_add(efl_added, EFL_UI_EVENT_REPEATED,
466 _inc_dec_btn_repeated_cb, obj),
467 efl_content_set(efl_part(obj, part), efl_added));
468}
469
464static void 470static void
465_spinner_buttons_add(Evas_Object *obj, Efl_Ui_Calendar_Data *sd) 471_spinner_buttons_add(Evas_Object *obj, Efl_Ui_Calendar_Data *sd)
466{ 472{
@@ -476,21 +482,9 @@ _spinner_buttons_add(Evas_Object *obj, Efl_Ui_Calendar_Data *sd)
476 } 482 }
477 483
478 if (!sd->dec_btn_month) 484 if (!sd->dec_btn_month)
479 { 485 sd->dec_btn_month = _btn_create(obj, PART_NAME_DEC_BUTTON, EFL_UI_CALENDAR_BUTTON_LEFT);
480 sd->dec_btn_month =
481 efl_add(EFL_UI_BUTTON_CLASS, obj,
482 elm_widget_element_update(obj, efl_added, PART_NAME_DEC_BUTTON),
483 efl_ui_autorepeat_enabled_set(efl_added, EINA_TRUE),
484 efl_ui_autorepeat_initial_timeout_set(efl_added, 0.5),
485 efl_ui_autorepeat_gap_timeout_set(efl_added, 0.2));
486
487 efl_event_callback_add(sd->dec_btn_month, EFL_UI_EVENT_CLICKED,
488 _button_widget_month_dec_start_click, obj);
489 efl_event_callback_add(sd->dec_btn_month, EFL_UI_EVENT_REPEATED,
490 _button_widget_month_dec_start, obj);
491 }
492 elm_layout_content_set(obj, EFL_UI_CALENDAR_BUTTON_LEFT, sd->dec_btn_month);
493 } 486 }
487
494 else if (sd->dec_btn_month && !efl_isa(sd->dec_btn_month, ELM_ACCESS_CLASS)) 488 else if (sd->dec_btn_month && !efl_isa(sd->dec_btn_month, ELM_ACCESS_CLASS))
495 { 489 {
496 evas_object_del(sd->dec_btn_month); 490 evas_object_del(sd->dec_btn_month);
@@ -507,20 +501,7 @@ _spinner_buttons_add(Evas_Object *obj, Efl_Ui_Calendar_Data *sd)
507 } 501 }
508 502
509 if (!sd->inc_btn_month) 503 if (!sd->inc_btn_month)
510 { 504 sd->inc_btn_month = _btn_create(obj, PART_NAME_INC_BUTTON, EFL_UI_CALENDAR_BUTTON_RIGHT);
511 sd->inc_btn_month =
512 efl_add(EFL_UI_BUTTON_CLASS, obj,
513 elm_widget_element_update(obj, efl_added, PART_NAME_INC_BUTTON),
514 efl_ui_autorepeat_enabled_set(efl_added, EINA_TRUE),
515 efl_ui_autorepeat_initial_timeout_set(efl_added, 0.5),
516 efl_ui_autorepeat_gap_timeout_set(efl_added, 0.2));
517
518 efl_event_callback_add(sd->inc_btn_month, EFL_UI_EVENT_CLICKED,
519 _button_widget_month_inc_start_click, obj);
520 efl_event_callback_add(sd->inc_btn_month, EFL_UI_EVENT_REPEATED,
521 _button_widget_month_inc_start, obj);
522 }
523 elm_layout_content_set(obj, EFL_UI_CALENDAR_BUTTON_RIGHT, sd->inc_btn_month);
524 } 505 }
525 else if (sd->inc_btn_month && !efl_isa(sd->inc_btn_month, ELM_ACCESS_CLASS)) 506 else if (sd->inc_btn_month && !efl_isa(sd->inc_btn_month, ELM_ACCESS_CLASS))
526 { 507 {
@@ -645,77 +626,35 @@ _update_data(Evas_Object *obj, int delta)
645 return EINA_TRUE; 626 return EINA_TRUE;
646} 627}
647 628
648static Eina_Bool 629static void
649_spin_month_value(void *data) 630_spin_value(void *data)
650{ 631{
651 EFL_UI_CALENDAR_DATA_GET(data, sd); 632 EFL_UI_CALENDAR_DATA_GET(data, sd);
652 633
653 if (_update_data(data, sd->spin_speed)) 634 if (_update_data(data, sd->spin_speed))
654 evas_object_smart_changed(data); 635 evas_object_smart_changed(data);
655
656 sd->interval = sd->interval / 1.05;
657 ecore_timer_interval_set(sd->spin_month, sd->interval);
658
659 return ECORE_CALLBACK_RENEW;
660}
661
662static void
663_button_widget_month_inc_start_click(void *data,
664 const Efl_Event *ev EINA_UNUSED)
665{
666 EFL_UI_CALENDAR_DATA_GET(data, sd);
667 if (sd->month_repeated)
668 {
669 sd->month_repeated = EINA_FALSE;
670 return;
671 }
672
673 sd->interval = sd->first_interval;
674 sd->spin_speed = 1;
675 _spin_month_value(data);
676} 636}
677 637
678static void 638static void
679_button_widget_month_inc_start(void *data, 639_inc_dec_btn_clicked_cb(void *data,
680 const Efl_Event *ev EINA_UNUSED) 640 const Efl_Event *ev)
681{ 641{
682 EFL_UI_CALENDAR_DATA_GET(data, sd); 642 EFL_UI_CALENDAR_DATA_GET(data, sd);
683 643
684 sd->spin_speed = 1; 644 sd->spin_speed = (ev->object == sd->inc_btn_month) ? 1 : -1;
685 if (!sd->month_repeated)
686 sd->interval = sd->first_interval;
687 sd->month_repeated = EINA_TRUE;
688 _spin_month_value(data);
689 645
646 _spin_value(data);
690} 647}
691 648
692static void 649static void
693_button_widget_month_dec_start_click(void *data, 650_inc_dec_btn_repeated_cb(void *data,
694 const Efl_Event *ev EINA_UNUSED) 651 const Efl_Event *ev)
695{ 652{
696 EFL_UI_CALENDAR_DATA_GET(data, sd); 653 EFL_UI_CALENDAR_DATA_GET(data, sd);
697 if (sd->month_repeated)
698 {
699 sd->month_repeated = EINA_FALSE;
700 return;
701 }
702 654
703 sd->interval = sd->first_interval; 655 sd->spin_speed = (ev->object == sd->inc_btn_month) ? 1 : -1;
704 sd->spin_speed = -1;
705 _spin_month_value(data);
706}
707
708static void
709_button_widget_month_dec_start(void *data,
710 const Efl_Event *ev EINA_UNUSED)
711{
712 EFL_UI_CALENDAR_DATA_GET(data, sd);
713 656
714 sd->spin_speed = -1; 657 _spin_value(data);
715 if (!sd->month_repeated)
716 sd->interval = sd->first_interval;
717 sd->month_repeated = EINA_TRUE;
718 _spin_month_value(data);
719} 658}
720 659
721static int 660static int
@@ -900,8 +839,6 @@ _efl_ui_calendar_efl_object_destructor(Eo *obj, Efl_Ui_Calendar_Data *sd)
900{ 839{
901 int i; 840 int i;
902 841
903 ecore_timer_del(sd->spin_month);
904 ecore_timer_del(sd->spin_year);
905 ecore_timer_del(sd->update_timer); 842 ecore_timer_del(sd->update_timer);
906 843
907 efl_ui_format_cb_set(obj, NULL, NULL, NULL); 844 efl_ui_format_cb_set(obj, NULL, NULL, NULL);
@@ -936,7 +873,7 @@ _access_obj_process(Evas_Object *obj, Eina_Bool is_access)
936 snprintf(pname, sizeof(pname), "efl.cit_%d.access", i); 873 snprintf(pname, sizeof(pname), "efl.cit_%d.access", i);
937 874
938 _elm_access_edje_object_part_object_unregister 875 _elm_access_edje_object_part_object_unregister
939 (obj, elm_layout_edje_get(obj), pname); 876 (obj, elm_layout_edje_get(obj), pname);
940 } 877 }
941 } 878 }
942 879
@@ -975,7 +912,6 @@ _efl_ui_calendar_constructor_internal(Eo *obj, Efl_Ui_Calendar_Data *priv)
975 912
976 elm_widget_sub_object_parent_add(obj); 913 elm_widget_sub_object_parent_add(obj);
977 914
978 priv->first_interval = 0.85;
979 priv->date_min.tm_year = 2; 915 priv->date_min.tm_year = 2;
980 priv->date_min.tm_mon = 0; 916 priv->date_min.tm_mon = 0;
981 priv->date_min.tm_mday = 1; 917 priv->date_min.tm_mday = 1;
diff --git a/src/lib/elementary/efl_ui_calendar_private.h b/src/lib/elementary/efl_ui_calendar_private.h
index 1341dd565e..6cce25d130 100644
--- a/src/lib/elementary/efl_ui_calendar_private.h
+++ b/src/lib/elementary/efl_ui_calendar_private.h
@@ -31,15 +31,12 @@ struct _Efl_Ui_Calendar_Data
31 double interval, first_interval; 31 double interval, first_interval;
32 int spin_speed; 32 int spin_speed;
33 int today_it, selected_it, focused_it; 33 int today_it, selected_it, focused_it;
34 Ecore_Timer *spin_month, *spin_year, *update_timer; 34 Ecore_Timer *update_timer;
35 const char *weekdays[ELM_DAY_LAST]; 35 const char *weekdays[ELM_DAY_LAST];
36 struct tm current_date, shown_date, date, date_min, date_max; 36 struct tm current_date, shown_date, date, date_min, date_max;
37 Evas_Object *inc_btn_month; 37 Evas_Object *inc_btn_month;
38 Evas_Object *dec_btn_month; 38 Evas_Object *dec_btn_month;
39 Evas_Object *month_access; 39 Evas_Object *month_access;
40 Evas_Object *inc_btn_year;
41 Evas_Object *dec_btn_year;
42 Evas_Object *year_access;
43 Eo *items[42]; 40 Eo *items[42];
44 41
45 Efl_Ui_Calendar_Weekday first_week_day; 42 Efl_Ui_Calendar_Weekday first_week_day;
@@ -51,11 +48,8 @@ struct _Efl_Ui_Calendar_Data
51 Eina_Strbuf *format_strbuf; 48 Eina_Strbuf *format_strbuf;
52 49
53 Eina_Bool selected : 1; 50 Eina_Bool selected : 1;
54 Eina_Bool double_spinners : 1;
55 Eina_Bool filling : 1; 51 Eina_Bool filling : 1;
56 Eina_Bool weekdays_set : 1; 52 Eina_Bool weekdays_set : 1;
57 Eina_Bool month_repeated : 1;
58 Eina_Bool year_repeated : 1;
59}; 53};
60 54
61/** 55/**
diff --git a/src/lib/elementary/elm_calendar.c b/src/lib/elementary/elm_calendar.c
index e8bf210c0f..5c3398a1f9 100644
--- a/src/lib/elementary/elm_calendar.c
+++ b/src/lib/elementary/elm_calendar.c
@@ -65,38 +65,19 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
65 * But, it is replaced by elm_button widget objects. The following 65 * But, it is replaced by elm_button widget objects. The following
66 * callback functions are also newly added for button objects. 66 * callback functions are also newly added for button objects.
67 * We still keep the old signal callback functions for backward compatibility. */ 67 * We still keep the old signal callback functions for backward compatibility. */
68
68static void 69static void
69_button_widget_month_inc_start_click(void *data, 70_inc_dec_button_clicked_cb(void *data, const Efl_Event *event EINA_UNUSED);
70 Evas_Object *obj EINA_UNUSED,
71 void *event_info EINA_UNUSED);
72static void
73_button_widget_month_inc_start(void *data,
74 Evas_Object *obj EINA_UNUSED,
75 void *event_info EINA_UNUSED);
76static void
77_button_widget_month_dec_start_click(void *data,
78 Evas_Object *obj EINA_UNUSED,
79 void *event_info EINA_UNUSED);
80static void
81_button_widget_month_dec_start(void *data,
82 Evas_Object *obj EINA_UNUSED,
83 void *event_info EINA_UNUSED);
84static void
85_button_widget_year_inc_start_click(void *data,
86 Evas_Object *obj EINA_UNUSED,
87 void *event_info EINA_UNUSED);
88static void
89_button_widget_year_inc_start(void *data,
90 Evas_Object *obj EINA_UNUSED,
91 void *event_info EINA_UNUSED);
92static void 71static void
93_button_widget_year_dec_start_click(void *data, 72_inc_dec_button_pressed_cb(void *data, const Efl_Event *event);
94 Evas_Object *obj EINA_UNUSED,
95 void *event_info EINA_UNUSED);
96static void 73static void
97_button_widget_year_dec_start(void *data, 74_inc_dec_button_unpressed_cb(void *data, const Efl_Event *event EINA_UNUSED);
98 Evas_Object *obj EINA_UNUSED, 75
99 void *event_info EINA_UNUSED); 76EFL_CALLBACKS_ARRAY_DEFINE( _inc_dec_button_cb,
77 { EFL_UI_EVENT_CLICKED, _inc_dec_button_clicked_cb},
78 { EFL_UI_EVENT_PRESSED, _inc_dec_button_pressed_cb},
79 { EFL_UI_EVENT_UNPRESSED, _inc_dec_button_unpressed_cb}
80);
100 81
101static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params); 82static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params);
102 83
@@ -776,11 +757,7 @@ _spinner_buttons_add(Evas_Object *obj, Elm_Calendar_Data *sd)
776 if (!sd->dec_btn_month) 757 if (!sd->dec_btn_month)
777 { 758 {
778 sd->dec_btn_month = elm_button_add(obj); 759 sd->dec_btn_month = elm_button_add(obj);
779 elm_button_autorepeat_set(sd->dec_btn_month, EINA_TRUE); 760 efl_event_callback_array_add(sd->dec_btn_month, _inc_dec_button_cb(), obj);
780 elm_button_autorepeat_initial_timeout_set(sd->dec_btn_month, 0.5);
781 elm_button_autorepeat_gap_timeout_set(sd->dec_btn_month, 0.2);
782 evas_object_smart_callback_add(sd->dec_btn_month, "clicked", _button_widget_month_dec_start_click, obj);
783 evas_object_smart_callback_add(sd->dec_btn_month, "repeated", _button_widget_month_dec_start, obj);
784 } 761 }
785 762
786 elm_object_style_set(sd->dec_btn_month, left_buf); 763 elm_object_style_set(sd->dec_btn_month, left_buf);
@@ -804,11 +781,7 @@ _spinner_buttons_add(Evas_Object *obj, Elm_Calendar_Data *sd)
804 if (!sd->inc_btn_month) 781 if (!sd->inc_btn_month)
805 { 782 {
806 sd->inc_btn_month = elm_button_add(obj); 783 sd->inc_btn_month = elm_button_add(obj);
807 elm_button_autorepeat_set(sd->inc_btn_month, EINA_TRUE); 784 efl_event_callback_array_add(sd->inc_btn_month, _inc_dec_button_cb(), obj);
808 elm_button_autorepeat_initial_timeout_set(sd->inc_btn_month, 0.5);
809 elm_button_autorepeat_gap_timeout_set(sd->inc_btn_month, 0.2);
810 evas_object_smart_callback_add(sd->inc_btn_month, "clicked", _button_widget_month_inc_start_click, obj);
811 evas_object_smart_callback_add(sd->inc_btn_month, "repeated", _button_widget_month_inc_start, obj);
812 } 785 }
813 786
814 elm_object_style_set(sd->inc_btn_month, right_buf); 787 elm_object_style_set(sd->inc_btn_month, right_buf);
@@ -832,12 +805,8 @@ _spinner_buttons_add(Evas_Object *obj, Elm_Calendar_Data *sd)
832 if (!sd->dec_btn_year) 805 if (!sd->dec_btn_year)
833 { 806 {
834 sd->dec_btn_year = elm_button_add(obj); 807 sd->dec_btn_year = elm_button_add(obj);
835 elm_button_autorepeat_set(sd->dec_btn_year, EINA_TRUE); 808 efl_event_callback_array_add(sd->dec_btn_year, _inc_dec_button_cb(), obj);
836 elm_button_autorepeat_initial_timeout_set(sd->dec_btn_year, 0.5); 809 }
837 elm_button_autorepeat_gap_timeout_set(sd->dec_btn_year, 0.2);
838 evas_object_smart_callback_add(sd->dec_btn_year, "clicked", _button_widget_year_dec_start_click, obj);
839 evas_object_smart_callback_add(sd->dec_btn_year, "repeated", _button_widget_year_dec_start, obj);
840 }
841 810
842 elm_object_style_set(sd->dec_btn_year, left_buf); 811 elm_object_style_set(sd->dec_btn_year, left_buf);
843 elm_layout_content_set(obj, ELM_CALENDAR_BUTTON_YEAR_LEFT, sd->dec_btn_year); 812 elm_layout_content_set(obj, ELM_CALENDAR_BUTTON_YEAR_LEFT, sd->dec_btn_year);
@@ -860,11 +829,7 @@ _spinner_buttons_add(Evas_Object *obj, Elm_Calendar_Data *sd)
860 if (!sd->inc_btn_year) 829 if (!sd->inc_btn_year)
861 { 830 {
862 sd->inc_btn_year = elm_button_add(obj); 831 sd->inc_btn_year = elm_button_add(obj);
863 elm_button_autorepeat_set(sd->inc_btn_year, EINA_TRUE); 832 efl_event_callback_array_add(sd->inc_btn_year, _inc_dec_button_cb(), obj);
864 elm_button_autorepeat_initial_timeout_set(sd->inc_btn_year, 0.5);
865 elm_button_autorepeat_gap_timeout_set(sd->inc_btn_year, 0.2);
866 evas_object_smart_callback_add(sd->inc_btn_year, "clicked", _button_widget_year_inc_start_click, obj);
867 evas_object_smart_callback_add(sd->inc_btn_year, "repeated", _button_widget_year_inc_start, obj);
868 } 833 }
869 834
870 elm_object_style_set(sd->inc_btn_year, right_buf); 835 elm_object_style_set(sd->inc_btn_year, right_buf);
@@ -1004,29 +969,15 @@ _update_data(Evas_Object *obj, Eina_Bool month,
1004} 969}
1005 970
1006static Eina_Bool 971static Eina_Bool
1007_spin_month_value(void *data) 972_spin_value(void *data)
1008{
1009 ELM_CALENDAR_DATA_GET(data, sd);
1010
1011 if (_update_data(data, EINA_TRUE, sd->spin_speed))
1012 evas_object_smart_changed(data);
1013
1014 sd->interval = sd->interval / 1.05;
1015 ecore_timer_interval_set(sd->spin_month, sd->interval);
1016
1017 return ECORE_CALLBACK_RENEW;
1018}
1019
1020static Eina_Bool
1021_spin_year_value(void *data)
1022{ 973{
1023 ELM_CALENDAR_DATA_GET(data, sd); 974 ELM_CALENDAR_DATA_GET(data, sd);
1024 975
1025 if (_update_data(data, EINA_FALSE, sd->spin_speed)) 976 if (_update_data(data, sd->month_btn_clicked, sd->spin_speed))
1026 evas_object_smart_changed(data); 977 evas_object_smart_changed(data);
1027 978
1028 sd->interval = sd->interval / 1.05; 979 sd->interval = sd->interval / 1.05;
1029 ecore_timer_interval_set(sd->spin_year, sd->interval); 980 ecore_timer_interval_set(sd->spin_timer, sd->interval);
1030 981
1031 return ECORE_CALLBACK_RENEW; 982 return ECORE_CALLBACK_RENEW;
1032} 983}
@@ -1042,10 +993,13 @@ _button_month_inc_start(void *data,
1042 993
1043 sd->interval = sd->first_interval; 994 sd->interval = sd->first_interval;
1044 sd->spin_speed = 1; 995 sd->spin_speed = 1;
1045 ecore_timer_del(sd->spin_month); 996 sd->month_btn_clicked = EINA_TRUE;
1046 sd->spin_month = ecore_timer_add(sd->interval, _spin_month_value, data); 997 ecore_timer_del(sd->spin_timer);
998 sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
1047 999
1048 _spin_month_value(data); 1000 elm_widget_scroll_freeze_push(data);
1001
1002 _spin_value(data);
1049} 1003}
1050 1004
1051/* Legacy callbacks for signals from edje */ 1005/* Legacy callbacks for signals from edje */
@@ -1059,10 +1013,13 @@ _button_month_dec_start(void *data,
1059 1013
1060 sd->interval = sd->first_interval; 1014 sd->interval = sd->first_interval;
1061 sd->spin_speed = -1; 1015 sd->spin_speed = -1;
1062 ecore_timer_del(sd->spin_month); 1016 sd->month_btn_clicked = EINA_TRUE;
1063 sd->spin_month = ecore_timer_add(sd->interval, _spin_month_value, data); 1017 ecore_timer_del(sd->spin_timer);
1018 sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
1019
1020 elm_widget_scroll_freeze_push(data);
1064 1021
1065 _spin_month_value(data); 1022 _spin_value(data);
1066} 1023}
1067 1024
1068/* Legacy callbacks for signals from edje */ 1025/* Legacy callbacks for signals from edje */
@@ -1075,7 +1032,9 @@ _button_month_stop(void *data,
1075 ELM_CALENDAR_DATA_GET(data, sd); 1032 ELM_CALENDAR_DATA_GET(data, sd);
1076 1033
1077 sd->interval = sd->first_interval; 1034 sd->interval = sd->first_interval;
1078 ELM_SAFE_FREE(sd->spin_month, ecore_timer_del); 1035 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
1036
1037 elm_widget_scroll_freeze_pop(obj);
1079} 1038}
1080 1039
1081/* Legacy callbacks for signals from edje */ 1040/* Legacy callbacks for signals from edje */
@@ -1089,10 +1048,13 @@ _button_year_inc_start(void *data,
1089 1048
1090 sd->interval = sd->first_interval; 1049 sd->interval = sd->first_interval;
1091 sd->spin_speed = 1; 1050 sd->spin_speed = 1;
1092 ecore_timer_del(sd->spin_year); 1051 sd->month_btn_clicked = EINA_FALSE;
1093 sd->spin_year = ecore_timer_add(sd->interval, _spin_year_value, data); 1052 ecore_timer_del(sd->spin_timer);
1053 sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
1094 1054
1095 _spin_year_value(data); 1055 elm_widget_scroll_freeze_push(data);
1056
1057 _spin_value(data);
1096} 1058}
1097 1059
1098/* Legacy callbacks for signals from edje */ 1060/* Legacy callbacks for signals from edje */
@@ -1106,10 +1068,13 @@ _button_year_dec_start(void *data,
1106 1068
1107 sd->interval = sd->first_interval; 1069 sd->interval = sd->first_interval;
1108 sd->spin_speed = -1; 1070 sd->spin_speed = -1;
1109 ecore_timer_del(sd->spin_year); 1071 sd->month_btn_clicked = EINA_FALSE;
1110 sd->spin_year = ecore_timer_add(sd->interval, _spin_year_value, data); 1072 ecore_timer_del(sd->spin_timer);
1073 sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
1074
1075 elm_widget_scroll_freeze_push(data);
1111 1076
1112 _spin_year_value(data); 1077 _spin_value(data);
1113} 1078}
1114 1079
1115/* Legacy callbacks for signals from edje */ 1080/* Legacy callbacks for signals from edje */
@@ -1122,132 +1087,48 @@ _button_year_stop(void *data,
1122 ELM_CALENDAR_DATA_GET(data, sd); 1087 ELM_CALENDAR_DATA_GET(data, sd);
1123 1088
1124 sd->interval = sd->first_interval; 1089 sd->interval = sd->first_interval;
1125 ELM_SAFE_FREE(sd->spin_year, ecore_timer_del); 1090 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
1126}
1127
1128static void
1129_button_widget_month_inc_start_click(void *data,
1130 Evas_Object *obj EINA_UNUSED,
1131 void *event_info EINA_UNUSED)
1132{
1133 ELM_CALENDAR_DATA_GET(data, sd);
1134 if (sd->month_repeated)
1135 {
1136 sd->month_repeated = EINA_FALSE;
1137 return;
1138 }
1139 1091
1140 sd->interval = sd->first_interval; 1092 elm_widget_scroll_freeze_pop(obj);
1141 sd->spin_speed = 1;
1142 _spin_month_value(data);
1143} 1093}
1144 1094
1145static void 1095static void
1146_button_widget_month_inc_start(void *data, 1096_inc_dec_button_clicked_cb(void *data, const Efl_Event *event EINA_UNUSED)
1147 Evas_Object *obj EINA_UNUSED,
1148 void *event_info EINA_UNUSED)
1149{ 1097{
1150 ELM_CALENDAR_DATA_GET(data, sd); 1098 ELM_CALENDAR_DATA_GET(data, sd);
1151 1099
1152 sd->spin_speed = 1;
1153 if (!sd->month_repeated)
1154 sd->interval = sd->first_interval;
1155 sd->month_repeated = EINA_TRUE;
1156 _spin_month_value(data);
1157
1158}
1159
1160static void
1161_button_widget_month_dec_start_click(void *data,
1162 Evas_Object *obj EINA_UNUSED,
1163 void *event_info EINA_UNUSED)
1164{
1165 ELM_CALENDAR_DATA_GET(data, sd);
1166 if (sd->month_repeated)
1167 {
1168 sd->month_repeated = EINA_FALSE;
1169 return;
1170 }
1171
1172 sd->interval = sd->first_interval; 1100 sd->interval = sd->first_interval;
1173 sd->spin_speed = -1; 1101 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
1174 _spin_month_value(data);
1175}
1176
1177static void
1178_button_widget_month_dec_start(void *data,
1179 Evas_Object *obj EINA_UNUSED,
1180 void *event_info EINA_UNUSED)
1181{
1182 ELM_CALENDAR_DATA_GET(data, sd);
1183 1102
1184 sd->spin_speed = -1; 1103 _spin_value(data);
1185 if (!sd->month_repeated)
1186 sd->interval = sd->first_interval;
1187 sd->month_repeated = EINA_TRUE;
1188 _spin_month_value(data);
1189} 1104}
1190
1191static void 1105static void
1192_button_widget_year_inc_start_click(void *data, 1106_inc_dec_button_pressed_cb(void *data, const Efl_Event *event)
1193 Evas_Object *obj EINA_UNUSED,
1194 void *event_info EINA_UNUSED)
1195{ 1107{
1196 ELM_CALENDAR_DATA_GET(data, sd); 1108 ELM_CALENDAR_DATA_GET(data, sd);
1197 if (sd->year_repeated)
1198 {
1199 sd->year_repeated = EINA_FALSE;
1200 return;
1201 }
1202 1109
1203 sd->interval = sd->first_interval; 1110 sd->interval = sd->first_interval;
1204 sd->spin_speed = 1; 1111 sd->spin_speed = ((sd->inc_btn_month == event->object) ||
1205 _spin_year_value(data); 1112 (sd->inc_btn_year == event->object)) ? 1 : -1;
1206}
1207 1113
1208static void 1114 sd->month_btn_clicked = ((sd->inc_btn_month == event->object) ||
1209_button_widget_year_inc_start(void *data, 1115 (sd->dec_btn_month == event->object)) ? EINA_TRUE : EINA_FALSE;
1210 Evas_Object *obj EINA_UNUSED,
1211 void *event_info EINA_UNUSED)
1212{
1213 ELM_CALENDAR_DATA_GET(data, sd);
1214 1116
1215 sd->spin_speed = 1; 1117 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
1216 if (!sd->year_repeated) 1118 sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
1217 sd->interval = sd->first_interval; 1119
1218 sd->year_repeated = EINA_TRUE; 1120 elm_widget_scroll_freeze_push(data);
1219 _spin_year_value(data);
1220} 1121}
1221 1122
1222static void 1123static void
1223_button_widget_year_dec_start_click(void *data, 1124_inc_dec_button_unpressed_cb(void *data, const Efl_Event *event EINA_UNUSED)
1224 Evas_Object *obj EINA_UNUSED,
1225 void *event_info EINA_UNUSED)
1226{ 1125{
1227 ELM_CALENDAR_DATA_GET(data, sd); 1126 ELM_CALENDAR_DATA_GET(data, sd);
1228 if (sd->year_repeated)
1229 {
1230 sd->year_repeated = EINA_FALSE;
1231 return;
1232 }
1233 1127
1234 sd->interval = sd->first_interval; 1128 sd->interval = sd->first_interval;
1235 sd->spin_speed = -1; 1129 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
1236 _spin_year_value(data);
1237}
1238 1130
1239static void 1131 elm_widget_scroll_freeze_pop(data);
1240_button_widget_year_dec_start(void *data,
1241 Evas_Object *obj EINA_UNUSED,
1242 void *event_info EINA_UNUSED)
1243{
1244 ELM_CALENDAR_DATA_GET(data, sd);
1245
1246 sd->spin_speed = -1;
1247 if (!sd->year_repeated)
1248 sd->interval = sd->first_interval;
1249 sd->year_repeated = EINA_TRUE;
1250 _spin_year_value(data);
1251} 1132}
1252 1133
1253static int 1134static int
@@ -1530,8 +1411,7 @@ _elm_calendar_efl_canvas_group_group_del(Eo *obj, Elm_Calendar_Data *sd)
1530 int i; 1411 int i;
1531 Elm_Calendar_Mark *mark; 1412 Elm_Calendar_Mark *mark;
1532 1413
1533 ecore_timer_del(sd->spin_month); 1414 ecore_timer_del(sd->spin_timer);
1534 ecore_timer_del(sd->spin_year);
1535 ecore_timer_del(sd->update_timer); 1415 ecore_timer_del(sd->update_timer);
1536 1416
1537 if (sd->marks) 1417 if (sd->marks)
diff --git a/src/lib/elementary/elm_widget_calendar.h b/src/lib/elementary/elm_widget_calendar.h
index e68c490f9d..e3d82480cc 100644
--- a/src/lib/elementary/elm_widget_calendar.h
+++ b/src/lib/elementary/elm_widget_calendar.h
@@ -39,7 +39,7 @@ struct _Elm_Calendar_Data
39 double interval, first_interval; 39 double interval, first_interval;
40 int spin_speed; 40 int spin_speed;
41 int today_it, selected_it, focused_it; 41 int today_it, selected_it, focused_it;
42 Ecore_Timer *spin_month, *spin_year, *update_timer; 42 Ecore_Timer *update_timer, *spin_timer;
43 Elm_Calendar_Format_Cb format_func; 43 Elm_Calendar_Format_Cb format_func;
44 const char *weekdays[ELM_DAY_LAST]; 44 const char *weekdays[ELM_DAY_LAST];
45 struct tm current_time, selected_time, shown_time, date_min, date_max; 45 struct tm current_time, selected_time, shown_time, date_min, date_max;
@@ -62,8 +62,7 @@ struct _Elm_Calendar_Data
62 Eina_Bool double_spinners : 1; 62 Eina_Bool double_spinners : 1;
63 Eina_Bool filling : 1; 63 Eina_Bool filling : 1;
64 Eina_Bool weekdays_set : 1; 64 Eina_Bool weekdays_set : 1;
65 Eina_Bool month_repeated : 1; 65 Eina_Bool month_btn_clicked : 1;
66 Eina_Bool year_repeated : 1;
67}; 66};
68 67
69struct _Elm_Calendar_Mark 68struct _Elm_Calendar_Mark