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.
This commit is contained in:
Daniel Juyung Seo 2013-05-03 20:50:58 +09:00
parent a927ace445
commit ee735ae32c
4 changed files with 50 additions and 2 deletions

View File

@ -61,6 +61,8 @@ config_init(void)
(edd_base, Config, "wordsep", wordsep, EET_T_STRING);
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
@ -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);

View File

@ -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;

View File

@ -109,6 +109,18 @@ _cb_op_behavior_sback_chg(void *data, Evas_Object *obj, void *event __UNUSED__)
config_save(config, NULL);
}
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__)
{
@ -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);

View File

@ -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