mirror of
https://github.com/olikraus/u8g2.git
synced 2025-05-09 00:02:39 +08:00
issue #2468
This commit is contained in:
parent
5d85b7dc7f
commit
7959e14cfe
79
csrc/mui.c
79
csrc/mui.c
@ -298,6 +298,7 @@ void mui_Init(mui_t *ui, void *graphics_data, fds_t *fds, muif_t *muif_tlist, si
|
||||
ui->muif_tlist = muif_tlist;
|
||||
ui->muif_tcnt = muif_tcnt;
|
||||
ui->graphics_data = graphics_data;
|
||||
ui->last_form_stack_pos = -1;
|
||||
}
|
||||
|
||||
static int mui_find_uif(mui_t *ui, uint8_t id0, uint8_t id1)
|
||||
@ -676,6 +677,8 @@ static void mui_next_field(mui_t *ui)
|
||||
nth_token: The position of the token, which should be returned
|
||||
*/
|
||||
uint8_t mui_GetSelectableFieldTextOption(mui_t *ui, fds_t *fds, uint8_t nth_token)
|
||||
{
|
||||
if ( fds != NULL )
|
||||
{
|
||||
fds_t *fds_backup = ui->fds; // backup the current fds, so that this function can be called inside a task loop
|
||||
int len = ui->len; // backup length of the current command, 26 sep 2021: probably this is not required any more
|
||||
@ -691,8 +694,13 @@ uint8_t mui_GetSelectableFieldTextOption(mui_t *ui, fds_t *fds, uint8_t nth_toke
|
||||
// result is stored in ui->text
|
||||
return is_found;
|
||||
}
|
||||
ui->text[0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t mui_GetSelectableFieldOptionCnt(mui_t *ui, fds_t *fds)
|
||||
{
|
||||
if ( fds != NULL )
|
||||
{
|
||||
fds_t *fds_backup = ui->fds; // backup the current fds, so that this function can be called inside a task loop
|
||||
int len = ui->len; // backup length of the current command 26 sep 2021: probably this is not required any more
|
||||
@ -708,6 +716,9 @@ uint8_t mui_GetSelectableFieldOptionCnt(mui_t *ui, fds_t *fds)
|
||||
// result is stored in ui->text
|
||||
return cnt;
|
||||
}
|
||||
ui->text[0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -793,39 +804,91 @@ uint8_t mui_GotoForm(mui_t *ui, uint8_t form_id, uint8_t initial_cursor_position
|
||||
return 1;
|
||||
}
|
||||
|
||||
void mui_SaveForm(mui_t *ui)
|
||||
/*
|
||||
Save current form+cursor position. Used together with mui_RestoreForm
|
||||
*/
|
||||
void mui_SaveFormWithCursorPosition(mui_t *ui, uint8_t cursor_pos)
|
||||
{
|
||||
if ( mui_IsFormActive(ui) == 0 )
|
||||
return;
|
||||
|
||||
ui->last_form_fds = ui->cursor_focus_fds;
|
||||
ui->last_form_id = mui_get_fds_char(ui->current_form_fds+1);
|
||||
ui->last_form_cursor_focus_position = mui_GetCurrentCursorFocusPosition(ui);
|
||||
if ( ui->last_form_stack_pos < MUI_MENU_LAST_FORM_STACK_SIZE-1 )
|
||||
ui->last_form_stack_pos++;
|
||||
else // discard the oldes entry
|
||||
{
|
||||
uint8_t i;
|
||||
for( i = 0; i < ui->last_form_stack_pos; i++ )
|
||||
{
|
||||
ui->last_form_id[i] = ui->last_form_id[i+1];
|
||||
ui->last_form_cursor_focus_position[i] = ui->last_form_cursor_focus_position[i+1];
|
||||
}
|
||||
}
|
||||
|
||||
ui->last_form_fds = ui->cursor_focus_fds; // 25 Aug 2024: I think this is not required, u8g2 data function will store the value manually in last_form_fds
|
||||
ui->last_form_id[ui->last_form_stack_pos] = mui_get_fds_char(ui->current_form_fds+1);
|
||||
ui->last_form_cursor_focus_position[ui->last_form_stack_pos] = cursor_pos;
|
||||
}
|
||||
|
||||
/*
|
||||
if called from a field function, then the current field variables are destroyed, so that call should be the last call in the field callback.
|
||||
Save current form+cursor position. Simplified version, which will not work with pseudo scrolling forms
|
||||
*/
|
||||
void mui_RestoreForm(mui_t *ui)
|
||||
void mui_SaveForm(mui_t *ui)
|
||||
{
|
||||
mui_GotoForm(ui, ui->last_form_id, ui->last_form_cursor_focus_position);
|
||||
mui_SaveFormWithCursorPosition(ui, mui_GetCurrentCursorFocusPosition(ui));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Restore previous saved form and cursor position.
|
||||
if called from a field function, then the current field variables are destroyed, so that call should be the last call in the field callback.
|
||||
returns 0 if there is no form to restore
|
||||
*/
|
||||
uint8_t mui_RestoreForm(mui_t *ui)
|
||||
{
|
||||
MUI_DEBUG("mui_RestoreForm last_form_stack_pos=%d\n", ui->last_form_stack_pos);
|
||||
if ( ui->last_form_stack_pos >= 0 )
|
||||
{
|
||||
uint8_t form_id = ui->last_form_id[ui->last_form_stack_pos];
|
||||
uint8_t focus = ui->last_form_cursor_focus_position[ui->last_form_stack_pos];
|
||||
ui->last_form_stack_pos--;
|
||||
return mui_GotoForm(ui, form_id, focus);
|
||||
//ui->last_form_fds = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Save a cursor position for mui_GotoFormAutoCursorPosition command
|
||||
Two such positions is stored.
|
||||
*/
|
||||
void mui_SaveCursorPosition(mui_t *ui, uint8_t cursor_position)
|
||||
{
|
||||
uint8_t form_id = mui_get_fds_char(ui->current_form_fds+1);
|
||||
uint8_t i;
|
||||
MUI_DEBUG("mui_SaveCursorPosition form_id=%d cursor_position=%d\n", form_id, cursor_position);
|
||||
|
||||
for( i = 0; i < MUI_MENU_CACHE_CNT; i++ )
|
||||
{
|
||||
if ( form_id == ui->menu_form_id[i] )
|
||||
{
|
||||
ui->menu_form_last_added = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( i >= MUI_MENU_CACHE_CNT )
|
||||
{
|
||||
ui->menu_form_last_added++ ;
|
||||
if ( ui->menu_form_last_added >= MUI_MENU_CACHE_CNT )
|
||||
ui->menu_form_last_added = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
if ( form_id == ui->menu_form_id[0] )
|
||||
ui->menu_form_last_added = 0;
|
||||
else if ( form_id == ui->menu_form_id[1] )
|
||||
ui->menu_form_last_added = 1;
|
||||
else
|
||||
ui->menu_form_last_added ^= 1;
|
||||
*/
|
||||
ui->menu_form_id[ui->menu_form_last_added] = form_id;
|
||||
ui->menu_form_cursor_focus_position[ui->menu_form_last_added] = cursor_position;
|
||||
MUI_DEBUG("mui_SaveCursorPosition ui->menu_form_last_added=%d \n", ui->menu_form_last_added);
|
||||
|
17
csrc/mui.h
17
csrc/mui.h
@ -223,7 +223,9 @@ struct muif_struct
|
||||
#define MUI_MAX_TEXT_LEN 41
|
||||
#endif
|
||||
|
||||
#define MUI_MENU_CACHE_CNT 2
|
||||
#define MUI_MENU_CACHE_CNT 4
|
||||
|
||||
#define MUI_MENU_LAST_FORM_STACK_SIZE 4
|
||||
|
||||
struct mui_struct
|
||||
{
|
||||
@ -270,14 +272,16 @@ struct mui_struct
|
||||
fds_t *target_fds; // used by several task functions as a return / result value
|
||||
|
||||
/* last form and field, used by mui_SaveForm and mui_RestoreForm */
|
||||
uint8_t last_form_id;
|
||||
uint8_t last_form_cursor_focus_position;
|
||||
fds_t *last_form_fds; // not used by mui_RestoreForm, but can be used by field functions
|
||||
uint8_t last_form_id[MUI_MENU_LAST_FORM_STACK_SIZE];
|
||||
uint8_t last_form_cursor_focus_position[MUI_MENU_LAST_FORM_STACK_SIZE];
|
||||
fds_t *last_form_fds; // not used by mui_RestoreForm, but can be used by field functions, warning: this is the FDS of the field, from where the jump started to the child (cursor_focus_fds)
|
||||
int8_t last_form_stack_pos;
|
||||
|
||||
/* menu cursor position backup */
|
||||
/* idea is, to restore the cursor position if we jump to that form */
|
||||
uint8_t menu_form_last_added;
|
||||
uint8_t menu_form_id[MUI_MENU_CACHE_CNT];
|
||||
uint8_t menu_form_cursor_focus_position[MUI_MENU_CACHE_CNT];
|
||||
uint8_t menu_form_last_added;
|
||||
} ;
|
||||
|
||||
#define mui_IsCursorFocus(mui) ((mui)->dflags & MUIF_DFLAG_IS_CURSOR_FOCUS)
|
||||
@ -583,8 +587,9 @@ uint8_t mui_GetSelectableFieldOptionCnt(mui_t *ui, fds_t *fds);
|
||||
void mui_EnterForm(mui_t *ui, fds_t *fds, uint8_t initial_cursor_position);
|
||||
void mui_LeaveForm(mui_t *ui);
|
||||
uint8_t mui_GotoForm(mui_t *ui, uint8_t form_id, uint8_t initial_cursor_position);
|
||||
void mui_SaveFormWithCursorPosition(mui_t *ui, uint8_t cursor_pos); /* Save current form with manully provied cursor position, Used together with mui_RestoreForm */
|
||||
void mui_SaveForm(mui_t *ui); /* Save current form+cursor position. Used together with mui_RestoreForm */
|
||||
void mui_RestoreForm(mui_t *ui); /* Restore form and cursor position, previously saved with mui_SaveForm */
|
||||
uint8_t mui_RestoreForm(mui_t *ui); /* Restore form and cursor position, previously saved with mui_SaveForm */
|
||||
void mui_SaveCursorPosition(mui_t *ui, uint8_t cursor_position); /* stores a cursor position for use with mui_GotoFormAutoCursorPosition */
|
||||
uint8_t mui_GotoFormAutoCursorPosition(mui_t *ui, uint8_t form_id);
|
||||
|
||||
|
302
csrc/mui_u8g2.c
302
csrc/mui_u8g2.c
@ -568,6 +568,246 @@ uint8_t mui_u8g2_btn_goto_w2_if(mui_t *ui, uint8_t msg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t mui_u8g2_btn_goto_w1_pi(mui_t *ui, uint8_t msg)
|
||||
{
|
||||
u8g2_t *u8g2 = mui_get_U8g2(ui);
|
||||
switch(msg)
|
||||
{
|
||||
case MUIF_MSG_DRAW:
|
||||
mui_u8g2_draw_button_pi(ui, u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui) , ui->text);
|
||||
//mui_u8g2_draw_button_utf(ui, mui_u8g2_get_pi_flags(ui), u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui) , MUI_U8G2_V_PADDING, ui->text);
|
||||
break;
|
||||
case MUIF_MSG_FORM_START:
|
||||
break;
|
||||
case MUIF_MSG_FORM_END:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_ENTER:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
case MUIF_MSG_VALUE_INCREMENT:
|
||||
case MUIF_MSG_VALUE_DECREMENT:
|
||||
//return mui_GotoForm(ui, ui->arg, 0);
|
||||
return mui_GotoFormAutoCursorPosition(ui, ui->arg);
|
||||
case MUIF_MSG_CURSOR_LEAVE:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_DOWN:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_UP:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint8_t mui_u8g2_btn_goto_w1_fi(mui_t *ui, uint8_t msg)
|
||||
{
|
||||
u8g2_t *u8g2 = mui_get_U8g2(ui);
|
||||
switch(msg)
|
||||
{
|
||||
case MUIF_MSG_DRAW:
|
||||
mui_u8g2_draw_button_fi(ui, u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui)-1 , ui->text);
|
||||
//mui_u8g2_draw_button_utf(ui, mui_u8g2_get_pi_flags(ui), u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui) , MUI_U8G2_V_PADDING, ui->text);
|
||||
break;
|
||||
case MUIF_MSG_FORM_START:
|
||||
break;
|
||||
case MUIF_MSG_FORM_END:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_ENTER:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
case MUIF_MSG_VALUE_INCREMENT:
|
||||
case MUIF_MSG_VALUE_DECREMENT:
|
||||
//return mui_GotoForm(ui, ui->arg, 0);
|
||||
return mui_GotoFormAutoCursorPosition(ui, ui->arg);
|
||||
case MUIF_MSG_CURSOR_LEAVE:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_DOWN:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_UP:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Back buttons are used to jump back to a previously stored form/cursor position
|
||||
*/
|
||||
|
||||
uint8_t mui_u8g2_btn_back_wm_fi(mui_t *ui, uint8_t msg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case MUIF_MSG_DRAW:
|
||||
mui_u8g2_draw_button_utf(ui, U8G2_BTN_HCENTER |mui_u8g2_get_fi_flags(ui), 0, 1, MUI_U8G2_V_PADDING, ui->text);
|
||||
break;
|
||||
case MUIF_MSG_FORM_START:
|
||||
break;
|
||||
case MUIF_MSG_FORM_END:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_ENTER:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
case MUIF_MSG_VALUE_INCREMENT:
|
||||
case MUIF_MSG_VALUE_DECREMENT:
|
||||
return mui_RestoreForm(ui);
|
||||
case MUIF_MSG_CURSOR_LEAVE:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_DOWN:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_UP:
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t mui_u8g2_btn_back_wm_if(mui_t *ui, uint8_t msg)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case MUIF_MSG_DRAW:
|
||||
mui_u8g2_draw_button_utf(ui, U8G2_BTN_HCENTER |mui_u8g2_get_if_flags(ui), 0, 1, MUI_U8G2_V_PADDING, ui->text);
|
||||
break;
|
||||
case MUIF_MSG_FORM_START:
|
||||
break;
|
||||
case MUIF_MSG_FORM_END:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_ENTER:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
case MUIF_MSG_VALUE_INCREMENT:
|
||||
case MUIF_MSG_VALUE_DECREMENT:
|
||||
return mui_RestoreForm(ui);
|
||||
case MUIF_MSG_CURSOR_LEAVE:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_DOWN:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_UP:
|
||||
break;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t mui_u8g2_btn_back_w2_fi(mui_t *ui, uint8_t msg)
|
||||
{
|
||||
u8g2_t *u8g2 = mui_get_U8g2(ui);
|
||||
switch(msg)
|
||||
{
|
||||
case MUIF_MSG_DRAW:
|
||||
mui_u8g2_draw_button_utf(ui, U8G2_BTN_HCENTER | mui_u8g2_get_fi_flags(ui), u8g2_GetDisplayWidth(u8g2)/2 - 10, 0, MUI_U8G2_V_PADDING, ui->text);
|
||||
break;
|
||||
case MUIF_MSG_FORM_START:
|
||||
break;
|
||||
case MUIF_MSG_FORM_END:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_ENTER:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
case MUIF_MSG_VALUE_INCREMENT:
|
||||
case MUIF_MSG_VALUE_DECREMENT:
|
||||
return mui_RestoreForm(ui);
|
||||
case MUIF_MSG_CURSOR_LEAVE:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_DOWN:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_UP:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t mui_u8g2_btn_back_w2_if(mui_t *ui, uint8_t msg)
|
||||
{
|
||||
u8g2_t *u8g2 = mui_get_U8g2(ui);
|
||||
switch(msg)
|
||||
{
|
||||
case MUIF_MSG_DRAW:
|
||||
mui_u8g2_draw_button_utf(ui, U8G2_BTN_HCENTER | mui_u8g2_get_if_flags(ui), u8g2_GetDisplayWidth(u8g2)/2 - 10, 0, MUI_U8G2_V_PADDING, ui->text);
|
||||
break;
|
||||
case MUIF_MSG_FORM_START:
|
||||
break;
|
||||
case MUIF_MSG_FORM_END:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_ENTER:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
case MUIF_MSG_VALUE_INCREMENT:
|
||||
case MUIF_MSG_VALUE_DECREMENT:
|
||||
return mui_RestoreForm(ui);
|
||||
case MUIF_MSG_CURSOR_LEAVE:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_DOWN:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_UP:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t mui_u8g2_btn_back_w1_pi(mui_t *ui, uint8_t msg)
|
||||
{
|
||||
u8g2_t *u8g2 = mui_get_U8g2(ui);
|
||||
switch(msg)
|
||||
{
|
||||
case MUIF_MSG_DRAW:
|
||||
mui_u8g2_draw_button_pi(ui, u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui) , ui->text);
|
||||
//mui_u8g2_draw_button_utf(ui, mui_u8g2_get_pi_flags(ui), u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui) , MUI_U8G2_V_PADDING, ui->text);
|
||||
break;
|
||||
case MUIF_MSG_FORM_START:
|
||||
break;
|
||||
case MUIF_MSG_FORM_END:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_ENTER:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
case MUIF_MSG_VALUE_INCREMENT:
|
||||
case MUIF_MSG_VALUE_DECREMENT:
|
||||
return mui_RestoreForm(ui);
|
||||
case MUIF_MSG_CURSOR_LEAVE:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_DOWN:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_UP:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t mui_u8g2_btn_back_w1_fi(mui_t *ui, uint8_t msg)
|
||||
{
|
||||
u8g2_t *u8g2 = mui_get_U8g2(ui);
|
||||
switch(msg)
|
||||
{
|
||||
case MUIF_MSG_DRAW:
|
||||
mui_u8g2_draw_button_fi(ui, u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui)-1 , ui->text);
|
||||
//mui_u8g2_draw_button_utf(ui, mui_u8g2_get_pi_flags(ui), u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui) , MUI_U8G2_V_PADDING, ui->text);
|
||||
break;
|
||||
case MUIF_MSG_FORM_START:
|
||||
break;
|
||||
case MUIF_MSG_FORM_END:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_ENTER:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
case MUIF_MSG_VALUE_INCREMENT:
|
||||
case MUIF_MSG_VALUE_DECREMENT:
|
||||
return mui_RestoreForm(ui);
|
||||
case MUIF_MSG_CURSOR_LEAVE:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_DOWN:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_UP:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
uint8_t mui_u8g2_btn_exit_wm_fi(mui_t *ui, uint8_t msg)
|
||||
@ -630,67 +870,6 @@ uint8_t mui_u8g2_btn_exit_wm_fi(mui_t *ui, uint8_t msg)
|
||||
}
|
||||
|
||||
|
||||
uint8_t mui_u8g2_btn_goto_w1_pi(mui_t *ui, uint8_t msg)
|
||||
{
|
||||
u8g2_t *u8g2 = mui_get_U8g2(ui);
|
||||
switch(msg)
|
||||
{
|
||||
case MUIF_MSG_DRAW:
|
||||
mui_u8g2_draw_button_pi(ui, u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui) , ui->text);
|
||||
//mui_u8g2_draw_button_utf(ui, mui_u8g2_get_pi_flags(ui), u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui) , MUI_U8G2_V_PADDING, ui->text);
|
||||
break;
|
||||
case MUIF_MSG_FORM_START:
|
||||
break;
|
||||
case MUIF_MSG_FORM_END:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_ENTER:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
case MUIF_MSG_VALUE_INCREMENT:
|
||||
case MUIF_MSG_VALUE_DECREMENT:
|
||||
//return mui_GotoForm(ui, ui->arg, 0);
|
||||
return mui_GotoFormAutoCursorPosition(ui, ui->arg);
|
||||
case MUIF_MSG_CURSOR_LEAVE:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_DOWN:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_UP:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint8_t mui_u8g2_btn_goto_w1_fi(mui_t *ui, uint8_t msg)
|
||||
{
|
||||
u8g2_t *u8g2 = mui_get_U8g2(ui);
|
||||
switch(msg)
|
||||
{
|
||||
case MUIF_MSG_DRAW:
|
||||
mui_u8g2_draw_button_fi(ui, u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui)-1 , ui->text);
|
||||
//mui_u8g2_draw_button_utf(ui, mui_u8g2_get_pi_flags(ui), u8g2_GetDisplayWidth(u8g2)-mui_get_x(ui)*2, mui_get_x(ui) , MUI_U8G2_V_PADDING, ui->text);
|
||||
break;
|
||||
case MUIF_MSG_FORM_START:
|
||||
break;
|
||||
case MUIF_MSG_FORM_END:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_ENTER:
|
||||
break;
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
case MUIF_MSG_VALUE_INCREMENT:
|
||||
case MUIF_MSG_VALUE_DECREMENT:
|
||||
//return mui_GotoForm(ui, ui->arg, 0);
|
||||
return mui_GotoFormAutoCursorPosition(ui, ui->arg);
|
||||
case MUIF_MSG_CURSOR_LEAVE:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_DOWN:
|
||||
break;
|
||||
case MUIF_MSG_TOUCH_UP:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*===============================================================================*/
|
||||
|
||||
static void mui_u8g2_u8_vmm_draw_wm_pi(mui_t *ui) MUI_NOINLINE;
|
||||
@ -1946,6 +2125,7 @@ uint8_t mui_u8g2_goto_form_w1_pi(mui_t *ui, uint8_t msg)
|
||||
case MUIF_MSG_CURSOR_SELECT:
|
||||
if ( mui_GetSelectableFieldTextOption(ui, ui->last_form_fds, ui->arg + ui->form_scroll_top) )
|
||||
{
|
||||
mui_SaveFormWithCursorPosition(ui, ui->arg + ui->form_scroll_top);
|
||||
mui_SaveCursorPosition(ui, ui->arg + ui->form_scroll_top); // store the current cursor position, so that the user can jump back to the corresponding cursor position
|
||||
return mui_GotoFormAutoCursorPosition(ui, (uint8_t)ui->text[0]);
|
||||
}
|
||||
|
@ -182,14 +182,24 @@ void mui_u8g2_draw_button_if(mui_t *ui, u8g2_uint_t width, u8g2_uint_t padding_h
|
||||
/* ready to use field functions */
|
||||
|
||||
uint8_t mui_u8g2_draw_text(mui_t *ui, uint8_t msg);
|
||||
|
||||
uint8_t mui_u8g2_btn_goto_wm_fi(mui_t *ui, uint8_t msg); /* GIF */
|
||||
uint8_t mui_u8g2_btn_goto_wm_if(mui_t *ui, uint8_t msg);
|
||||
uint8_t mui_u8g2_btn_goto_w2_fi(mui_t *ui, uint8_t msg); /* GIF */
|
||||
uint8_t mui_u8g2_btn_goto_w2_if(mui_t *ui, uint8_t msg);
|
||||
|
||||
uint8_t mui_u8g2_btn_goto_w1_pi(mui_t *ui, uint8_t msg); /* GIF */
|
||||
uint8_t mui_u8g2_btn_goto_w1_fi(mui_t *ui, uint8_t msg); /* GIF */
|
||||
|
||||
uint8_t mui_u8g2_btn_back_wm_fi(mui_t *ui, uint8_t msg);
|
||||
uint8_t mui_u8g2_btn_back_wm_if(mui_t *ui, uint8_t msg);
|
||||
uint8_t mui_u8g2_btn_back_w2_fi(mui_t *ui, uint8_t msg);
|
||||
uint8_t mui_u8g2_btn_back_w2_if(mui_t *ui, uint8_t msg);
|
||||
uint8_t mui_u8g2_btn_back_w1_pi(mui_t *ui, uint8_t msg);
|
||||
uint8_t mui_u8g2_btn_back_w1_fi(mui_t *ui, uint8_t msg);
|
||||
|
||||
|
||||
|
||||
|
||||
uint8_t mui_u8g2_btn_exit_wm_fi(mui_t *ui, uint8_t msg); /* similar to 'mui_u8g2_btn_goto_wm_fi' but will exit the menu system */
|
||||
|
||||
uint8_t mui_u8g2_u8_chkbox_wm_pi(mui_t *ui, uint8_t msg); /* GIF, MUIF_VARIABLE, MUI_XY */
|
||||
|
@ -285,6 +285,8 @@ muif_t muif_list[] MUI_PROGMEM = {
|
||||
MUIF_RO("GP",mui_u8g2_goto_data),
|
||||
MUIF_BUTTON("GC", mui_u8g2_goto_form_w1_pi),
|
||||
|
||||
MUIF_BUTTON("BK", mui_u8g2_btn_back_wm_fi),
|
||||
|
||||
/* Form 10 */
|
||||
MUIF_GOTO(mui_u8g2_btn_goto_wm_fi),
|
||||
MUIF_BUTTON("G0", mui_u8g2_btn_goto_wm_fi),
|
||||
@ -413,6 +415,7 @@ MUI_XY("HR", 0,13)
|
||||
MUI_STYLE(0)
|
||||
MUI_DATA("GP",
|
||||
MUI_21 "u8_min_max_wm_mse_pi|"
|
||||
MUI_21 "u8_min_max_wm_mse_pi 2|"
|
||||
MUI_22 "u8_min_max_wm_mud_pi|"
|
||||
MUI_23 "u8_min_max_wm_mse_pf|"
|
||||
MUI_24 "u8_min_max_wm_mud_pf|"
|
||||
@ -432,7 +435,8 @@ MUI_XY("HR", 0,26)
|
||||
MUI_STYLE(0)
|
||||
MUI_LABEL(1,40, "Number: ")
|
||||
MUI_XY("N0",70, 40)
|
||||
MUI_GOTO(64, 59, 20, " Ok ")
|
||||
//MUI_GOTO(64, 59, 20, " Ok ")
|
||||
MUI_XYT("BK", 64, 59, " Ok ")
|
||||
|
||||
MUI_FORM(22)
|
||||
MUI_STYLE(2)
|
||||
@ -444,7 +448,8 @@ MUI_XY("HR", 0,26)
|
||||
MUI_STYLE(0)
|
||||
MUI_LABEL(1,40, "Number: ")
|
||||
MUI_XY("N1",70, 40)
|
||||
MUI_GOTO(64, 59, 20, " Ok ")
|
||||
//MUI_GOTO(64, 59, 20, " Ok ")
|
||||
MUI_XYT("BK", 64, 59, " Ok ")
|
||||
|
||||
MUI_FORM(23)
|
||||
MUI_STYLE(2)
|
||||
@ -456,7 +461,8 @@ MUI_XY("HR", 0,26)
|
||||
MUI_STYLE(0)
|
||||
MUI_LABEL(1,40, "Number: ")
|
||||
MUI_XY("N2",70, 40)
|
||||
MUI_GOTO(64, 59, 20, " Ok ")
|
||||
//MUI_GOTO(64, 59, 20, " Ok ")
|
||||
MUI_XYT("BK", 64, 59, " Ok ")
|
||||
|
||||
MUI_FORM(24)
|
||||
MUI_STYLE(2)
|
||||
@ -468,7 +474,8 @@ MUI_XY("HR", 0,26)
|
||||
MUI_STYLE(0)
|
||||
MUI_LABEL(1,40, "Number: ")
|
||||
MUI_XY("N3",70, 40)
|
||||
MUI_GOTO(64, 59, 20, " Ok ")
|
||||
//MUI_GOTO(64, 59, 20, " Ok ")
|
||||
MUI_XYT("BK", 64, 59, " Ok ")
|
||||
|
||||
|
||||
|
||||
@ -500,7 +507,8 @@ MUI_XY("C1",66, 40)
|
||||
MUI_LABEL(1,55, "Checkbox 2: ")
|
||||
MUI_XY("C2",66, 55)
|
||||
MUI_STYLE(3)
|
||||
MUI_GOTO(110, 54, 30, "\x31")
|
||||
//MUI_GOTO(110, 54, 30, "\x31")
|
||||
MUI_XYT("BK", 110, 54, "\x31")
|
||||
|
||||
MUI_FORM(32)
|
||||
MUI_STYLE(2)
|
||||
@ -513,7 +521,8 @@ MUI_STYLE(0)
|
||||
MUI_XYAT("RB", 1, 40, 1, "Radio 1")
|
||||
MUI_XYAT("RB", 1, 55, 2, "Radio 2")
|
||||
MUI_STYLE(3)
|
||||
MUI_GOTO(110, 54, 30, "\x31")
|
||||
//MUI_GOTO(110, 54, 30, "\x31")
|
||||
MUI_XYT("BK", 110, 54, "\x31")
|
||||
|
||||
|
||||
MUI_FORM(40)
|
||||
|
Loading…
x
Reference in New Issue
Block a user