summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShilpa Singh <shilpa.singh@samsung.com>2014-02-05 01:29:14 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-02-05 01:43:10 +0900
commit38962c52ba84148380617ea3ac3c86401fc47dca (patch)
tree89b9ac36604b4a7591105df7a6b2082b60345d65
parentb44bc5ed31a1f1c0810e3873ad278e63a2ea0560 (diff)
spinner: After long press of inc/dec buttons, start continuously increasing/decreasing
Summary: When inc/dec buttons are pressed, start changing value after longpress has happened on buttons and not immediately. Signed-off by: Mohammad Irfan (mohammad.i@samsung.com) Signed-off by: Shilpa Singh(shilpa.singh@samsung.com) Test Plan: Long press on inc/dec buttons of spinner. Reviewers: seoz, woohyun CC: Hermet, jchanwook, raster Differential Revision: https://phab.enlightenment.org/D365
-rw-r--r--AUTHORS1
-rw-r--r--src/lib/elm_authors.h1
-rw-r--r--src/lib/elm_spinner.c46
-rw-r--r--src/lib/elm_widget_spinner.h2
4 files changed, 38 insertions, 12 deletions
diff --git a/AUTHORS b/AUTHORS
index 59f64e3c3..c19025f1b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -88,3 +88,4 @@ Sanghyeon Lee <sh10233.lee@samsung.com>
88Anil Kumar Nahak <ak.nahak@samsung.com> 88Anil Kumar Nahak <ak.nahak@samsung.com>
89Michal Jagiello <m.jagiello@samsung.com> 89Michal Jagiello <m.jagiello@samsung.com>
90Chinmaya Panigrahi <c.panigrahi@samsung.com> 90Chinmaya Panigrahi <c.panigrahi@samsung.com>
91Mohammad Irfan <mohammad.i@samsung.com>
diff --git a/src/lib/elm_authors.h b/src/lib/elm_authors.h
index 7e9f0e564..5f4ce508c 100644
--- a/src/lib/elm_authors.h
+++ b/src/lib/elm_authors.h
@@ -90,6 +90,7 @@
90 * @author Anil Kumar Nahak <ak.nahak@@samsung.com> 90 * @author Anil Kumar Nahak <ak.nahak@@samsung.com>
91 * @author Michal Jagiello <m.jagiello@@samsung.com> 91 * @author Michal Jagiello <m.jagiello@@samsung.com>
92 * @author Chinmaya Panigrahi <c.panigrahi@@samsung.com> 92 * @author Chinmaya Panigrahi <c.panigrahi@@samsung.com>
93 * @author Mohammad Irfan <mohammad.i@@samsung.com>
93 * 94 *
94 * Please contact <enlightenment-devel@lists.sourceforge.net> to get in 95 * Please contact <enlightenment-devel@lists.sourceforge.net> to get in
95 * contact with the developers and maintainers. 96 * contact with the developers and maintainers.
diff --git a/src/lib/elm_spinner.c b/src/lib/elm_spinner.c
index 9c059b6dc..ffeb975dd 100644
--- a/src/lib/elm_spinner.c
+++ b/src/lib/elm_spinner.c
@@ -323,16 +323,18 @@ _spin_value(void *data)
323 return ECORE_CALLBACK_RENEW; 323 return ECORE_CALLBACK_RENEW;
324} 324}
325 325
326static void 326static Eina_Bool
327_val_inc_start(Evas_Object *obj) 327_val_inc_start(void *data)
328{ 328{
329 ELM_SPINNER_DATA_GET(obj, sd); 329 ELM_SPINNER_DATA_GET(data, sd);
330 330
331 sd->interval = sd->first_interval; 331 sd->interval = sd->first_interval;
332 sd->spin_speed = sd->step; 332 sd->spin_speed = sd->step;
333 sd->longpress_timer = NULL;
333 ecore_timer_del(sd->spin_timer); 334 ecore_timer_del(sd->spin_timer);
334 sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, obj); 335 sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
335 _spin_value(obj); 336 _spin_value(data);
337 return ECORE_CALLBACK_CANCEL;
336} 338}
337 339
338static void 340static void
@@ -345,16 +347,18 @@ _val_inc_stop(Evas_Object *obj)
345 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del); 347 ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
346} 348}
347 349
348static void 350static Eina_Bool
349_val_dec_start(Evas_Object *obj) 351_val_dec_start(void *data)
350{ 352{
351 ELM_SPINNER_DATA_GET(obj, sd); 353 ELM_SPINNER_DATA_GET(data, sd);
352 354
353 sd->interval = sd->first_interval; 355 sd->interval = sd->first_interval;
354 sd->spin_speed = -sd->step; 356 sd->spin_speed = -sd->step;
357 sd->longpress_timer = NULL;
355 ecore_timer_del(sd->spin_timer); 358 ecore_timer_del(sd->spin_timer);
356 sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, obj); 359 sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
357 _spin_value(obj); 360 _spin_value(data);
361 return ECORE_CALLBACK_CANCEL;
358} 362}
359 363
360static void 364static void
@@ -381,7 +385,9 @@ _button_inc_start_cb(void *data,
381 if ((sd->val_updated) && (sd->val == sd->val_min)) return; 385 if ((sd->val_updated) && (sd->val == sd->val_min)) return;
382 return; 386 return;
383 } 387 }
384 _val_inc_start(data); 388 ecore_timer_del(sd->longpress_timer);
389 sd->longpress_timer = ecore_timer_add
390 (_elm_config->longpress_timeout, _val_inc_start, data);
385} 391}
386 392
387static void 393static void
@@ -390,6 +396,13 @@ _button_inc_stop_cb(void *data,
390 const char *emission EINA_UNUSED, 396 const char *emission EINA_UNUSED,
391 const char *source EINA_UNUSED) 397 const char *source EINA_UNUSED)
392{ 398{
399 ELM_SPINNER_DATA_GET(data, sd);
400 if (sd->longpress_timer)
401 {
402 ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
403 sd->spin_speed = sd->step;
404 _spin_value(data);
405 }
393 _val_inc_stop(data); 406 _val_inc_stop(data);
394} 407}
395 408
@@ -406,7 +419,9 @@ _button_dec_start_cb(void *data,
406 _entry_value_apply(obj); 419 _entry_value_apply(obj);
407 if ((sd->val_updated) && (sd->val == sd->val_max)) return; 420 if ((sd->val_updated) && (sd->val == sd->val_max)) return;
408 } 421 }
409 _val_dec_start(data); 422 ecore_timer_del(sd->longpress_timer);
423 sd->longpress_timer = ecore_timer_add
424 (_elm_config->longpress_timeout, _val_dec_start, data);
410} 425}
411 426
412static void 427static void
@@ -415,6 +430,13 @@ _button_dec_stop_cb(void *data,
415 const char *emission EINA_UNUSED, 430 const char *emission EINA_UNUSED,
416 const char *source EINA_UNUSED) 431 const char *source EINA_UNUSED)
417{ 432{
433 ELM_SPINNER_DATA_GET(data, sd);
434 if (sd->longpress_timer)
435 {
436 ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
437 sd->spin_speed = -sd->step;
438 _spin_value(data);
439 }
418 _val_dec_stop(data); 440 _val_dec_stop(data);
419} 441}
420 442
diff --git a/src/lib/elm_widget_spinner.h b/src/lib/elm_widget_spinner.h
index b4225c2a9..0e9c30880 100644
--- a/src/lib/elm_widget_spinner.h
+++ b/src/lib/elm_widget_spinner.h
@@ -32,6 +32,8 @@ struct _Elm_Spinner_Smart_Data
32 int round; 32 int round;
33 Ecore_Timer *delay_change_timer; /*<< a timer for a delay,changed smart callback */ 33 Ecore_Timer *delay_change_timer; /*<< a timer for a delay,changed smart callback */
34 Ecore_Timer *spin_timer; /*<< a timer for a repeated spinner value change on mouse down */ 34 Ecore_Timer *spin_timer; /*<< a timer for a repeated spinner value change on mouse down */
35 Ecore_Timer *longpress_timer; /*<< a timer to detect long press. After lonpress timeout,
36 start continuous change of values until mouse up */
35 Eina_List *special_values; 37 Eina_List *special_values;
36 38
37 Eina_Bool entry_visible : 1; 39 Eina_Bool entry_visible : 1;