Add the config ELM_THUMBSCROLL_HOLD_THRESHOLD.
authorJaehwan Kim <jae.hwan.kim@samsung.com>
Thu, 7 Mar 2013 09:13:15 +0000 (18:13 +0900)
committerJaehwan Kim <jae.hwan.kim@samsung.com>
Thu, 7 Mar 2013 09:13:15 +0000 (18:13 +0900)
This is the number of pixels the range which can be scrolled, while the scroller is holed.
In case of mobile, this config is useful since the out of scroller area is too small.

ChangeLog
NEWS
config/default/base.src
config/mobile/base.src
config/standard/base.src
src/bin/config.c
src/lib/elm_config.c
src/lib/elm_config.h
src/lib/elm_interface_scrollable.c
src/lib/elm_priv.h

index 8da1b21..84f2df8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
         * Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del().
 
+2013-03-07  Jaehwan Kim
+
+        * Add the config ELM_THUMBSCROLL_HOLD_THRESHOLD.
+        This is the number of pixels the range which can be scrolled, while the scroller is holed.
diff --git a/NEWS b/NEWS
index 29c2154..b515fb9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,7 @@ Additions:
    * Add elm_transit_smooth_set(), elm_transit_smooth_get()
    * Add edje_object_message_signal_process before edje_object_size_min_restricted_calc.
    * Add elm_object_item_signal_callback_add(), elm_object_item_signal_callback_del().
+   * Add the config ELM_THUMBSCROLL_HOLD_THRESHOLD.
 
 Improvements:
 
index 61591e4..c928779 100644 (file)
@@ -4,6 +4,7 @@ group "Elm_Config" struct {
   value "vsync" uchar: 0;
   value "thumbscroll_enable" uchar: 1;
   value "thumbscroll_threshold" int: 24;
+  value "thumbscroll_hold_threshold" int: 24;
   value "thumbscroll_momentum_threshold" double: 100.0;
   value "thumbscroll_friction" double: 1.0;
   value "thumbscroll_bounce_friction" double: 0.5;
index d112cf7..604154e 100644 (file)
@@ -4,6 +4,7 @@ group "Elm_Config" struct {
   value "vsync" uchar: 0;
   value "thumbscroll_enable" uchar: 1;
   value "thumbscroll_threshold" int: 24;
+  value "thumbscroll_hold_threshold" int: 100;
   value "thumbscroll_momentum_threshold" double: 100.0;
   value "thumbscroll_friction" double: 1.0;
   value "thumbscroll_bounce_friction" double: 0.5;
index e1aa88c..4870f39 100644 (file)
@@ -4,6 +4,7 @@ group "Elm_Config" struct {
   value "vsync" uchar: 0;
   value "thumbscroll_enable" uchar: 0;
   value "thumbscroll_threshold" int: 4;
+  value "thumbscroll_hold_threshold" int: 4;
   value "thumbscroll_momentum_threshold" double: 100.0;
   value "thumbscroll_friction" double: 1.0;
   value "thumbscroll_bounce_friction" double: 0.5;
index 3386606..3d4b960 100644 (file)
@@ -297,6 +297,31 @@ tst_change(void *data       __UNUSED__,
 }
 
 static void
+tsht_round(void *data       __UNUSED__,
+          Evas_Object     *obj,
+          void *event_info __UNUSED__)
+{
+   double val = elm_slider_value_get(obj);
+   double v;
+
+   v = ((double)((int)(val * 10.0))) / 10.0;
+   if (v != val) elm_slider_value_set(obj, v);
+}
+
+static void
+tsht_change(void *data       __UNUSED__,
+           Evas_Object     *obj,
+           void *event_info __UNUSED__)
+{
+   double tst = elm_config_scroll_thumbscroll_hold_threshold_get();
+   double val = elm_slider_value_get(obj);
+
+   if (tst == val) return;
+   elm_config_scroll_thumbscroll_hold_threshold_set(val);
+   elm_config_all_flush();
+}
+
+static void
 tsmt_round(void *data       __UNUSED__,
            Evas_Object     *obj,
            void *event_info __UNUSED__)
@@ -948,7 +973,7 @@ _font_overlay_change(void *data       __UNUSED__,
 static void
 _config_display_update(Evas_Object *win)
 {
-   int flush_interval, font_c, image_c, edje_file_c, edje_col_c, ts_threshould;
+   int flush_interval, font_c, image_c, edje_file_c, edje_col_c, ts_threshould, ts_hold_threshold;
    double scale, s_bounce_friction, ts_momentum_threshold, ts_friction,
           ts_border_friction, ts_sensitivity_friction, page_friction, bring_in_friction, zoom_friction;
    const char *curr_theme, *curr_engine;
@@ -970,6 +995,7 @@ _config_display_update(Evas_Object *win)
    s_bounce_friction = elm_config_scroll_bounce_friction_get();
    ts = elm_config_scroll_thumbscroll_enabled_get();
    ts_threshould = elm_config_scroll_thumbscroll_threshold_get();
+   ts_hold_threshold = elm_config_scroll_thumbscroll_hold_threshold_get();
    ts_momentum_threshold = elm_config_scroll_thumbscroll_momentum_threshold_get();
    ts_friction = elm_config_scroll_thumbscroll_friction_get();
    ts_border_friction = elm_config_scroll_thumbscroll_border_friction_get();
@@ -1004,6 +1030,9 @@ _config_display_update(Evas_Object *win)
                                              "thumbscroll_threshold_slider"),
                         ts_threshould);
    elm_slider_value_set(evas_object_data_get(win,
+                                             "ts_hold_threshold_slider"),
+                        ts_hold_threshold);
+   elm_slider_value_set(evas_object_data_get(win,
                                              "ts_momentum_threshold_slider"),
                         ts_momentum_threshold);
    elm_slider_value_set(evas_object_data_get(win,
@@ -2618,6 +2647,26 @@ _status_config_scrolling(Evas_Object *win,
    evas_object_smart_callback_add(sl, "changed", tst_round, NULL);
    evas_object_smart_callback_add(sl, "delay,changed", tst_change, NULL);
 
+   LABEL_FRAME_ADD("<hilight>Thumb scroll hold threshold</>");
+
+   sl = elm_slider_add(win);
+   elm_object_tooltip_text_set(sl, "This is the number of pixels the range<br/>"
+                                   "which can be scrolled, while the scroller<br/>"
+                                   "is holed");
+   evas_object_data_set(win, "thumbscroll_hold_threshold_slider", sl);
+   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.0f pixels");
+   elm_slider_indicator_format_set(sl, "%1.0f");
+   elm_slider_min_max_set(sl, 4.0, 500.0);
+   elm_slider_value_set(sl, elm_config_scroll_thumbscroll_threshold_get());
+   elm_box_pack_end(bx, sl);
+   evas_object_show(sl);
+
+   evas_object_smart_callback_add(sl, "changed", tsht_round, NULL);
+   evas_object_smart_callback_add(sl, "delay,changed", tsht_change, NULL);
+
    LABEL_FRAME_ADD("<hilight>Thumb scroll momentum threshold</>");
 
    sl = elm_slider_add(win);
index 48f1c53..f5ff097 100644 (file)
@@ -350,6 +350,7 @@ _desc_init(void)
    ELM_CONFIG_VAL(D, T, vsync, T_UCHAR);
    ELM_CONFIG_VAL(D, T, thumbscroll_enable, T_UCHAR);
    ELM_CONFIG_VAL(D, T, thumbscroll_threshold, T_INT);
+   ELM_CONFIG_VAL(D, T, thumbscroll_hold_threshold, T_INT);
    ELM_CONFIG_VAL(D, T, thumbscroll_momentum_threshold, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, thumbscroll_friction, T_DOUBLE);
    ELM_CONFIG_VAL(D, T, thumbscroll_bounce_friction, T_DOUBLE);
@@ -1055,6 +1056,7 @@ _config_load(void)
    _elm_config->vsync = 0;
    _elm_config->thumbscroll_enable = EINA_TRUE;
    _elm_config->thumbscroll_threshold = 24;
+   _elm_config->thumbscroll_hold_threshold = 24;
    _elm_config->thumbscroll_momentum_threshold = 100.0;
    _elm_config->thumbscroll_friction = 1.0;
    _elm_config->thumbscroll_bounce_friction = 0.5;
@@ -1465,6 +1467,8 @@ _env_get(void)
    if (s) _elm_config->thumbscroll_enable = !!atoi(s);
    s = getenv("ELM_THUMBSCROLL_THRESHOLD");
    if (s) _elm_config->thumbscroll_threshold = atoi(s);
+   s = getenv("ELM_THUMBSCROLL_HOLD_THRESHOLD");
+   if (s) _elm_config->thumbscroll_hold_threshold = atoi(s);
    // FIXME: floatformat locale issues here 1.0 vs 1,0 - should just be 1.0
    s = getenv("ELM_THUMBSCROLL_MOMENTUM_THRESHOLD");
    if (s) _elm_config->thumbscroll_momentum_threshold = _elm_atof(s);
@@ -2100,6 +2104,18 @@ elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold)
    _elm_config->thumbscroll_threshold = threshold;
 }
 
+EAPI unsigned int
+elm_config_scroll_thumbscroll_hold_threshold_get(void)
+{
+   return _elm_config->thumbscroll_hold_threshold;
+}
+
+EAPI void
+elm_config_scroll_thumbscroll_hold_threshold_set(unsigned int threshold)
+{
+   _elm_config->thumbscroll_hold_threshold = threshold;
+}
+
 EAPI double
 elm_config_scroll_thumbscroll_momentum_threshold_get(void)
 {
index c8a0f26..ebd34fc 100644 (file)
@@ -306,6 +306,27 @@ EAPI unsigned int elm_config_scroll_thumbscroll_threshold_get(void);
 EAPI void         elm_config_scroll_thumbscroll_threshold_set(unsigned int threshold);
 
 /**
+ * Get the number of pixels the range which can be scrolled,
+ * while the scroller is holded.
+ *
+ * @return the thumb scroll hold threshold
+ *
+ * @ingroup Scrolling
+ */
+EAPI unsigned int elm_config_scroll_thumbscroll_hold_threshold_get(void);
+
+/**
+ * Set the number of pixels the range which can be scrolled,
+ * while the scroller is holded.
+ *
+ * @param threshold the thumb scroll hold threshold
+ *
+ * @see elm_config_thumbscroll_hold_threshold_get()
+ * @ingroup Scrolling
+ */
+EAPI void         elm_config_scroll_thumbscroll_hold_threshold_set(unsigned int threshold);
+
+/**
  * Get the minimum speed of mouse cursor movement which will trigger
  * list self scrolling animation after a mouse up event
  * (pixels/second).
index b4d5e84..1d0da0d 100644 (file)
@@ -2804,9 +2804,9 @@ _elm_scroll_on_hold_animator(void *data)
      {
         td = t - sid->down.onhold_tlast;
         vx = sid->down.onhold_vx * td *
-          (double)_elm_config->thumbscroll_threshold * 2.0;
+          (double)_elm_config->thumbscroll_hold_threshold * 2.0;
         vy = sid->down.onhold_vy * td *
-          (double)_elm_config->thumbscroll_threshold * 2.0;
+          (double)_elm_config->thumbscroll_hold_threshold * 2.0;
         eo_do(sid->obj, elm_scrollable_interface_content_pos_get(&ox, &oy));
         x = ox;
         y = oy;
@@ -3045,37 +3045,37 @@ _elm_scroll_mouse_move_event_cb(void *data,
 
                   x = ev->cur.canvas.x - sid->x;
                   y = ev->cur.canvas.y - sid->y;
-                  if (x < _elm_config->thumbscroll_threshold)
+                  if (x < _elm_config->thumbscroll_hold_threshold)
                     {
-                       if (_elm_config->thumbscroll_threshold > 0.0)
-                         vx = -(double)(_elm_config->thumbscroll_threshold - x)
-                           / _elm_config->thumbscroll_threshold;
+                       if (_elm_config->thumbscroll_hold_threshold > 0.0)
+                         vx = -(double)(_elm_config->thumbscroll_hold_threshold - x)
+                           / _elm_config->thumbscroll_hold_threshold;
                        else
                          vx = -1.0;
                     }
-                  else if (x > (sid->w - _elm_config->thumbscroll_threshold))
+                  else if (x > (sid->w - _elm_config->thumbscroll_hold_threshold))
                     {
-                       if (_elm_config->thumbscroll_threshold > 0.0)
-                         vx = (double)(_elm_config->thumbscroll_threshold -
+                       if (_elm_config->thumbscroll_hold_threshold > 0.0)
+                         vx = (double)(_elm_config->thumbscroll_hold_threshold -
                                        (sid->w - x)) /
-                           _elm_config->thumbscroll_threshold;
+                           _elm_config->thumbscroll_hold_threshold;
                        else
                          vx = 1.0;
                     }
-                  if (y < _elm_config->thumbscroll_threshold)
+                  if (y < _elm_config->thumbscroll_hold_threshold)
                     {
-                       if (_elm_config->thumbscroll_threshold > 0.0)
-                         vy = -(double)(_elm_config->thumbscroll_threshold - y)
-                           / _elm_config->thumbscroll_threshold;
+                       if (_elm_config->thumbscroll_hold_threshold > 0.0)
+                         vy = -(double)(_elm_config->thumbscroll_hold_threshold - y)
+                           / _elm_config->thumbscroll_hold_threshold;
                        else
                          vy = -1.0;
                     }
-                  else if (y > (sid->h - _elm_config->thumbscroll_threshold))
+                  else if (y > (sid->h - _elm_config->thumbscroll_hold_threshold))
                     {
-                       if (_elm_config->thumbscroll_threshold > 0.0)
-                         vy = (double)(_elm_config->thumbscroll_threshold -
+                       if (_elm_config->thumbscroll_hold_threshold > 0.0)
+                         vy = (double)(_elm_config->thumbscroll_hold_threshold -
                                        (sid->h - y)) /
-                           _elm_config->thumbscroll_threshold;
+                           _elm_config->thumbscroll_hold_threshold;
                        else
                          vy = 1.0;
                     }
index 3d12ebb..73d9ca0 100644 (file)
@@ -159,6 +159,7 @@ struct _Elm_Config
    unsigned char vsync;
    unsigned char thumbscroll_enable;
    int           thumbscroll_threshold;
+   int           thumbscroll_hold_threshold;
    double        thumbscroll_momentum_threshold;
    double        thumbscroll_friction;
    double        thumbscroll_bounce_friction;