seoz pushed a commit to branch master.

commit ee735ae32c61f8a89f6a9ca569bdc4cd0585222b
Author: Daniel Juyung Seo <[email protected]>
Date:   Fri May 3 20:50:58 2013 +0900

    config tab_zoom: make the tab zoom animation time configurable.
    
    I prefer faster zoom for tab. Now you can configure the animation time from 
options -> behavior settings.
---
 src/bin/config.c           |  6 ++++++
 src/bin/config.h           |  1 +
 src/bin/options_behavior.c | 32 ++++++++++++++++++++++++++++++++
 src/bin/sel.c              | 13 +++++++++++--
 4 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/src/bin/config.c b/src/bin/config.c
index 01da612..379c40c 100644
--- a/src/bin/config.c
+++ b/src/bin/config.c
@@ -62,6 +62,8 @@ config_init(void)
    EET_DATA_DESCRIPTOR_ADD_BASIC
      (edd_base, Config, "scrollback", scrollback, EET_T_INT);
    EET_DATA_DESCRIPTOR_ADD_BASIC
+     (edd_base, Config, "tab_zoom", tab_zoom, EET_T_DOUBLE);
+   EET_DATA_DESCRIPTOR_ADD_BASIC
      (edd_base, Config, "vidmod", vidmod, EET_T_INT);
    EET_DATA_DESCRIPTOR_ADD_BASIC
      (edd_base, Config, "jump_on_change", jump_on_change, EET_T_UCHAR);
@@ -155,6 +157,7 @@ config_sync(const Config *config_src, Config *config)
    eina_stringshare_replace(&(config->theme), config_src->theme);
    eina_stringshare_replace(&(config->wordsep), config_src->wordsep);
    config->scrollback = config_src->scrollback;
+   config->tab_zoom = config_src->tab_zoom;
    config->vidmod = config_src->vidmod;
    config->jump_on_keypress = config_src->jump_on_keypress;
    config->jump_on_change = config_src->jump_on_change;
@@ -202,6 +205,7 @@ config_load(const char *key)
                {
                   LIM(config->font.size, 3, 400);
                   LIM(config->scrollback, 0, 200000);
+                  LIM(config->tab_zoom, 0.1, 1.0);
                   LIM(config->vidmod, 0, 3)
                }
           }
@@ -398,6 +402,7 @@ config_load(const char *key)
              config->helper.local.image = eina_stringshare_add("xdg-open");
              config->helper.inline_please = EINA_TRUE;
              config->scrollback = 2000;
+             config->tab_zoom = 0.5;
              config->theme = eina_stringshare_add("default.edj");
              config->background = NULL;
              config->translucent = EINA_FALSE;
@@ -453,6 +458,7 @@ config_fork(Config *config)
    SCPY(background);
    SCPY(wordsep);
    CPY(scrollback);
+   CPY(tab_zoom);
    CPY(vidmod);
    CPY(jump_on_change);
    CPY(jump_on_keypress);
diff --git a/src/bin/config.h b/src/bin/config.h
index 8a30c3e..cda50ff 100644
--- a/src/bin/config.h
+++ b/src/bin/config.h
@@ -29,6 +29,7 @@ struct _Config
    const char       *background;
    const char       *wordsep;
    int               scrollback;
+   double            tab_zoom;
    int               vidmod;
    Eina_Bool         jump_on_keypress;
    Eina_Bool         jump_on_change;
diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c
index 94820ef..959b461 100644
--- a/src/bin/options_behavior.c
+++ b/src/bin/options_behavior.c
@@ -110,6 +110,18 @@ _cb_op_behavior_sback_chg(void *data, Evas_Object *obj, 
void *event __UNUSED__)
 }
 
 static void
+_cb_op_behavior_tab_zoom_slider_chg(void *data, Evas_Object *obj,
+                                    void *event __UNUSED__)
+{
+   Evas_Object *term = data;
+   Config *config = termio_config_get(term);
+
+   config->tab_zoom = (double)(int)round(elm_slider_value_get(obj) * 10.0) / 
10.0;
+   termio_config_update(term);
+   config_save(config, NULL);
+}
+
+static void
 _cb_op_behavior_custom_geometry(void *data, Evas_Object *obj, void *event 
__UNUSED__)
 {
    Evas_Object *term = data;
@@ -362,6 +374,26 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
    evas_object_show(o);
    evas_object_smart_callback_add(o, "delay,changed",
                                   _cb_op_behavior_sback_chg, term);
+
+   o = elm_label_add(bx);
+   evas_object_size_hint_weight_set(o, 0.0, 0.0);
+   evas_object_size_hint_align_set(o, 0.0, 0.5);
+   elm_object_text_set(o, "Tab Zoom Animation:");
+   elm_box_pack_end(bx, o);
+   evas_object_show(o);
+
+   o = elm_slider_add(bx);
+   evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, 0.0);
+   evas_object_size_hint_align_set(o, EVAS_HINT_FILL, 0.0);
+   elm_slider_span_size_set(o, 40);
+   elm_slider_unit_format_set(o, "%1.1f");
+   elm_slider_indicator_format_set(o, "%1.1f");
+   elm_slider_min_max_set(o, 0.1, 1.0);
+   elm_slider_value_set(o, config->tab_zoom);
+   elm_box_pack_end(bx, o);
+   evas_object_show(o);
+   evas_object_smart_callback_add(o, "delay,changed",
+                                  _cb_op_behavior_tab_zoom_slider_chg, term);
    
    evas_object_size_hint_weight_set(opbox, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(opbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
diff --git a/src/bin/sel.c b/src/bin/sel.c
index 444c865..125c688 100644
--- a/src/bin/sel.c
+++ b/src/bin/sel.c
@@ -30,6 +30,7 @@ struct _Sel
       Evas_Coord x, y;
       Eina_Bool down : 1;
    } down;
+   Config *config;
    Eina_Bool select_me : 1;
    Eina_Bool exit_me : 1;
    Eina_Bool exit_on_sel : 1;
@@ -661,6 +662,7 @@ sel_entry_add(Evas_Object *obj, Evas_Object *entry, 
Eina_Bool selected, Eina_Boo
    Entry *en = calloc(1, sizeof(Entry));
    if (!en) return;
    sd->items = eina_list_append(sd->items, en);
+   sd->config = config;
    en->obj = entry;
    en->selected = selected;
    en->selected_before = selected;
@@ -726,8 +728,12 @@ sel_entry_selected_set(Evas_Object *obj, Evas_Object 
*entry, Eina_Bool keep_befo
    Sel *sd = evas_object_smart_data_get(obj);
    Eina_List *l;
    Entry *en;
+   Config *config;
    if (!sd) return;
 
+   config = sd->config;
+   if (!config) return;
+
    EINA_LIST_FOREACH(sd->items, l, en)
      {
         if (en->obj == entry)
@@ -757,7 +763,7 @@ sel_entry_selected_set(Evas_Object *obj, Evas_Object 
*entry, Eina_Bool keep_befo
         if (!keep_before) en->selected_before = EINA_FALSE;
      }
    sd->use_px = EINA_FALSE;
-   _transit(obj, 0.5);
+   _transit(obj, config->tab_zoom);
 }
 
 void
@@ -765,8 +771,11 @@ sel_zoom(Evas_Object *obj, double zoom)
 {
    Sel *sd = evas_object_smart_data_get(obj);
    if (!sd) return;
+   Config *config = sd->config;
+   if (!config) return;
+
    sd->zoom1 = zoom;
-   _transit(obj, 0.5);
+   _transit(obj, config->tab_zoom);
 }
 
 void

-- 

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2

Reply via email to