updates on encoder support
This commit is contained in:
@@ -366,7 +366,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
i->proc.long_pr_sent == 0 &&
|
||||
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME )
|
||||
{
|
||||
/*If edit mode is enabled and the focused obeject is editable then change between edit and navigate on long press*/
|
||||
/*On enter long press leave edit mode.*/
|
||||
lv_obj_t * focused = lv_group_get_focused(i->group);
|
||||
bool editable = false;
|
||||
focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable);
|
||||
@@ -374,7 +374,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
if (i->group->edit_mode_en && editable) {
|
||||
i->group->editing = i->group->editing ? 0 : 1;
|
||||
focused->signal_func(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again. Some object do something on navigate->edit change*/
|
||||
LV_LOG_INFO("Edit mode changed");
|
||||
LV_LOG_INFO("Edit mode changed (navigate)");
|
||||
if(focused) lv_obj_invalidate(focused);
|
||||
}
|
||||
/*If edit mode is disabled just send a long press signal*/
|
||||
@@ -401,16 +401,38 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
{
|
||||
lv_group_focus_prev(i->group);
|
||||
}
|
||||
else if(data->key == LV_GROUP_KEY_ENTER && i->group->edit_mode_en)
|
||||
else if(data->key == LV_GROUP_KEY_ENTER)
|
||||
{
|
||||
lv_obj_t * focused = lv_group_get_focused(i->group);
|
||||
bool editable = false;
|
||||
focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable);
|
||||
/* If an ENTER is released but not long pressed and we are in edit mode or the object is not editable then send the ENTER
|
||||
* In navigate mode to editable objects and after releasing the long press to change mode do not send ENTER*/
|
||||
if(!i->proc.long_pr_sent && (i->group->editing || !editable)) {
|
||||
lv_group_send_data(i->group, data->key);
|
||||
}
|
||||
lv_obj_t * focused = lv_group_get_focused(i->group);
|
||||
bool editable = false;
|
||||
focused->signal_func(focused, LV_SIGNAL_GET_EDITABLE, &editable);
|
||||
|
||||
/*Enter was released on a normal or non-editable object. Just send enter*/
|
||||
if (i->group->edit_mode_en == 0 || editable == 0) {
|
||||
lv_group_send_data(i->group, data->key);
|
||||
}
|
||||
/*An editable object (e.g. button matrix) is being edited and enter released*/
|
||||
else if (i->group->editing) {
|
||||
if(!i->proc.long_pr_sent) lv_group_send_data(i->group, data->key); /*Ignore long pressed enter release because it comes from mode switch*/
|
||||
}
|
||||
/*If the focused object is editable and now in navigate mode then enter edit mode*/
|
||||
else if(i->group->edit_mode_en && editable && !i->group->editing && !i->proc.long_pr_sent) {
|
||||
i->group->editing = i->group->editing ? 0 : 1;
|
||||
focused->signal_func(focused, LV_SIGNAL_FOCUS, NULL); /*Focus again. Some object do something on navigate->edit change*/
|
||||
LV_LOG_INFO("Edit mode changed (edit)");
|
||||
if(focused) lv_obj_invalidate(focused);
|
||||
}
|
||||
// else if (){
|
||||
// lv_group_send_data(i->group, data->key);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// /* If an ENTER is released but not long pressed and we are in edit mode or the object is not editable then send the ENTER
|
||||
// * In navigate mode to editable objects and after releasing the long press to change mode do not send ENTER*/
|
||||
// if(!i->proc.long_pr_sent && (i->group->editing || !editable)) {
|
||||
// lv_group_send_data(i->group, data->key);
|
||||
// }
|
||||
} else {
|
||||
lv_group_send_data(i->group, data->key);
|
||||
}
|
||||
|
||||
@@ -315,7 +315,18 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
refr_position(roller, false);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_FOCUS) {
|
||||
ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id;
|
||||
lv_group_t * g = lv_obj_get_group(roller);
|
||||
bool editing = true;
|
||||
if(lv_group_get_edit_enable(g)) editing = lv_group_get_editing(g);
|
||||
|
||||
if(editing) ext->ddlist.sel_opt_id_ori = ext->ddlist.sel_opt_id;
|
||||
else {
|
||||
/*Revert the original state. Important when moving from edit->navigate mode*/
|
||||
if(ext->ddlist.sel_opt_id != ext->ddlist.sel_opt_id_ori) {
|
||||
ext->ddlist.sel_opt_id = ext->ddlist.sel_opt_id_ori;
|
||||
refr_position(roller, true);
|
||||
}
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_DEFOCUS) {
|
||||
/*Revert the original state*/
|
||||
if(ext->ddlist.sel_opt_id != ext->ddlist.sel_opt_id_ori) {
|
||||
|
||||
Reference in New Issue
Block a user