forked from enlightenment/enlightenment
e: make some config vars in illume-keyboard. I hope limits will be good for you.
SVN revision: 61290
This commit is contained in:
parent
ad7ad9a092
commit
680c3eb7ac
|
@ -557,8 +557,9 @@ _e_kbd_int_zoomkey_up(E_Kbd_Int *ki)
|
||||||
e_layout_virtual_size_set(o, vw, vh);
|
e_layout_virtual_size_set(o, vw, vh);
|
||||||
e_layout_pack(ki->zoomkey.layout_obj, o);
|
e_layout_pack(ki->zoomkey.layout_obj, o);
|
||||||
e_layout_child_move(o, 0, 0);
|
e_layout_child_move(o, 0, 0);
|
||||||
// FIXME dimension * 4 is a magic number - make config
|
e_layout_child_resize(o,
|
||||||
e_layout_child_resize(o, vw * 4, vh * 4);
|
vw * il_kbd_cfg->zoom_level,
|
||||||
|
vh * il_kbd_cfg->zoom_level);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
ki->zoomkey.sublayout_obj = o;
|
ki->zoomkey.sublayout_obj = o;
|
||||||
|
|
||||||
|
@ -648,11 +649,12 @@ _e_kbd_int_zoomkey_update(E_Kbd_Int *ki)
|
||||||
evas_object_geometry_get(ki->zoomkey.layout_obj, NULL, NULL, &w, &h);
|
evas_object_geometry_get(ki->zoomkey.layout_obj, NULL, NULL, &w, &h);
|
||||||
evas_object_geometry_get(ki->layout_obj, NULL, NULL, &ww, &hh);
|
evas_object_geometry_get(ki->layout_obj, NULL, NULL, &ww, &hh);
|
||||||
e_layout_virtual_size_set(ki->zoomkey.layout_obj, w, h);
|
e_layout_virtual_size_set(ki->zoomkey.layout_obj, w, h);
|
||||||
// FIXME dimension * 4 is a magic number - make config
|
e_layout_child_resize(ki->zoomkey.sublayout_obj,
|
||||||
e_layout_child_resize(ki->zoomkey.sublayout_obj, ww * 4, hh * 4);
|
ww * il_kbd_cfg->zoom_level,
|
||||||
|
hh * il_kbd_cfg->zoom_level);
|
||||||
e_layout_child_move(ki->zoomkey.sublayout_obj,
|
e_layout_child_move(ki->zoomkey.sublayout_obj,
|
||||||
(w / 2) - (ki->down.cx * 4),
|
(w / 2) - (ki->down.cx * il_kbd_cfg->zoom_level),
|
||||||
(h / 2) - (ki->down.cy * 4));
|
(h / 2) - (ki->down.cy * il_kbd_cfg->zoom_level));
|
||||||
ky = _e_kbd_int_at_coord_get(ki, ki->down.clx, ki->down.cly);
|
ky = _e_kbd_int_at_coord_get(ki, ki->down.clx, ki->down.cly);
|
||||||
if (ky != ki->zoomkey.pressed)
|
if (ky != ki->zoomkey.pressed)
|
||||||
{
|
{
|
||||||
|
@ -729,8 +731,8 @@ _e_kbd_int_cb_mouse_down(void *data, Evas *evas __UNUSED__, Evas_Object *obj __U
|
||||||
ki->down.cly = y;
|
ki->down.cly = y;
|
||||||
|
|
||||||
if (ki->down.hold_timer) ecore_timer_del(ki->down.hold_timer);
|
if (ki->down.hold_timer) ecore_timer_del(ki->down.hold_timer);
|
||||||
// FIXME 0.25 - magic value. make config.
|
ki->down.hold_timer = ecore_timer_add(il_kbd_cfg->hold_timer,
|
||||||
ki->down.hold_timer = ecore_timer_add(0.25, _e_kbd_int_cb_hold_timeout, ki);
|
_e_kbd_int_cb_hold_timeout, ki);
|
||||||
|
|
||||||
ky = _e_kbd_int_at_coord_get(ki, x, y);
|
ky = _e_kbd_int_at_coord_get(ki, x, y);
|
||||||
ki->layout.pressed = ky;
|
ki->layout.pressed = ky;
|
||||||
|
@ -774,11 +776,14 @@ _e_kbd_int_cb_mouse_move(void *data, Evas *evas __UNUSED__, Evas_Object *obj __U
|
||||||
evas_object_geometry_get(ki->event_obj, &x, &y, &w, &h);
|
evas_object_geometry_get(ki->event_obj, &x, &y, &w, &h);
|
||||||
dx = (dx * ki->layout.w) / w;
|
dx = (dx * ki->layout.w) / w;
|
||||||
dy = (dy * ki->layout.h) / h;
|
dy = (dy * ki->layout.h) / h;
|
||||||
// FIXME: slide 1/4 of dimension is a magic number - make config
|
if ((dx > 0) && (dx > (ki->layout.w / il_kbd_cfg->slide_dim)))
|
||||||
if ((dx > 0) && (dx > (ki->layout.w / 4))) ki->down.stroke = 1;
|
ki->down.stroke = 1;
|
||||||
else if ((dx < 0) && (-dx > (ki->layout.w / 4))) ki->down.stroke = 1;
|
else if ((dx < 0) && (-dx > (ki->layout.w / il_kbd_cfg->slide_dim)))
|
||||||
if ((dy > 0) && (dy > (ki->layout.h / 4))) ki->down.stroke = 1;
|
ki->down.stroke = 1;
|
||||||
else if ((dy < 0) && (-dy > (ki->layout.w / 4))) ki->down.stroke = 1;
|
if ((dy > 0) && (dy > (ki->layout.h / il_kbd_cfg->slide_dim)))
|
||||||
|
ki->down.stroke = 1;
|
||||||
|
else if ((dy < 0) && (-dy > (ki->layout.w / il_kbd_cfg->slide_dim)))
|
||||||
|
ki->down.stroke = 1;
|
||||||
if ((ki->down.stroke) && (ki->down.hold_timer))
|
if ((ki->down.stroke) && (ki->down.hold_timer))
|
||||||
{
|
{
|
||||||
ecore_timer_del(ki->down.hold_timer);
|
ecore_timer_del(ki->down.hold_timer);
|
||||||
|
|
|
@ -29,6 +29,9 @@ il_kbd_config_init(E_Module *m)
|
||||||
E_CONFIG_VAL(D, T, use_internal, INT);
|
E_CONFIG_VAL(D, T, use_internal, INT);
|
||||||
E_CONFIG_VAL(D, T, run_keyboard, STR);
|
E_CONFIG_VAL(D, T, run_keyboard, STR);
|
||||||
E_CONFIG_VAL(D, T, dict, STR);
|
E_CONFIG_VAL(D, T, dict, STR);
|
||||||
|
E_CONFIG_VAL(D, T, zoom_level, INT);
|
||||||
|
E_CONFIG_VAL(D, T, hold_timer, DOUBLE);
|
||||||
|
E_CONFIG_VAL(D, T, slide_dim, INT);
|
||||||
|
|
||||||
il_kbd_cfg = e_config_domain_load("module.illume-keyboard", conf_edd);
|
il_kbd_cfg = e_config_domain_load("module.illume-keyboard", conf_edd);
|
||||||
if ((il_kbd_cfg) &&
|
if ((il_kbd_cfg) &&
|
||||||
|
@ -44,11 +47,21 @@ il_kbd_config_init(E_Module *m)
|
||||||
il_kbd_cfg->use_internal = 1;
|
il_kbd_cfg->use_internal = 1;
|
||||||
il_kbd_cfg->run_keyboard = NULL;
|
il_kbd_cfg->run_keyboard = NULL;
|
||||||
il_kbd_cfg->dict = eina_stringshare_add("English_(US).dic");
|
il_kbd_cfg->dict = eina_stringshare_add("English_(US).dic");
|
||||||
|
il_kbd_cfg->zoom_level = 4;
|
||||||
|
il_kbd_cfg->slide_dim = 4;
|
||||||
|
il_kbd_cfg->hold_timer = 0.25;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (il_kbd_cfg)
|
if (il_kbd_cfg)
|
||||||
{
|
{
|
||||||
/* Add new config variables here */
|
/* Add new config variables here */
|
||||||
/* if ((il_kbd_cfg->version & 0xffff) < 1) */
|
/* if ((il_kbd_cfg->version & 0xffff) < 1) */
|
||||||
|
if ((il_kbd_cfg->version >> 16) < IL_CONFIG_MAJ)
|
||||||
|
{
|
||||||
|
il_kbd_cfg->zoom_level = 4;
|
||||||
|
il_kbd_cfg->slide_dim = 4;
|
||||||
|
il_kbd_cfg->hold_timer = 0.25;
|
||||||
|
}
|
||||||
il_kbd_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
|
il_kbd_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +141,7 @@ _il_kbd_config_free(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdat
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_il_kbd_config_ui(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata __UNUSED__)
|
_il_kbd_config_ui(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata __UNUSED__)
|
||||||
{
|
{
|
||||||
Evas_Object *list, *of, *ow;
|
Evas_Object *list, *of, *ow, *sl, *ol;
|
||||||
E_Radio_Group *rg;
|
E_Radio_Group *rg;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
|
@ -193,6 +206,25 @@ _il_kbd_config_ui(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_D
|
||||||
nn++;
|
nn++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ol = e_widget_label_add(evas, _("Displacement ratio"));
|
||||||
|
e_widget_framelist_object_append(of, ol);
|
||||||
|
sl = e_widget_slider_add(evas, EINA_TRUE, 0, "1/%.0f", 1.0, 10.0, 1.0, 0,
|
||||||
|
NULL, &(il_kbd_cfg->slide_dim), 150);
|
||||||
|
e_widget_framelist_object_append(of, sl);
|
||||||
|
|
||||||
|
ol = e_widget_label_add(evas, _("Delay for zoom popup"));
|
||||||
|
e_widget_framelist_object_append(of, ol);
|
||||||
|
sl = e_widget_slider_add(evas, EINA_TRUE, 0, "%.2f second(s)", 0.0, 3.0, 0.01, 0,
|
||||||
|
&(il_kbd_cfg->hold_timer), NULL, 150);
|
||||||
|
e_widget_framelist_object_append(of, sl);
|
||||||
|
|
||||||
|
ol = e_widget_label_add(evas, _("Zoom level"));
|
||||||
|
e_widget_framelist_object_append(of, ol);
|
||||||
|
sl = e_widget_slider_add(evas, EINA_TRUE, 0, "%.0f", 1.0, 10.0, 1.0, 0,
|
||||||
|
NULL, &(il_kbd_cfg->zoom_level), 150);
|
||||||
|
e_widget_framelist_object_append(of, sl);
|
||||||
|
|
||||||
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
e_widget_list_object_append(list, of, 1, 0, 0.0);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define E_MOD_CONFIG_H
|
#define E_MOD_CONFIG_H
|
||||||
|
|
||||||
#define IL_CONFIG_MIN 0
|
#define IL_CONFIG_MIN 0
|
||||||
#define IL_CONFIG_MAJ 0
|
#define IL_CONFIG_MAJ 1
|
||||||
|
|
||||||
typedef struct _Il_Kbd_Config Il_Kbd_Config;
|
typedef struct _Il_Kbd_Config Il_Kbd_Config;
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ struct _Il_Kbd_Config
|
||||||
|
|
||||||
// Not User Configurable. Placeholders
|
// Not User Configurable. Placeholders
|
||||||
const char *mod_dir;
|
const char *mod_dir;
|
||||||
|
int zoom_level;
|
||||||
|
int slide_dim;
|
||||||
|
double hold_timer;
|
||||||
E_Config_Dialog *cfd;
|
E_Config_Dialog *cfd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue