mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Fixed a bug in the multi-screen menus, the statusbar wasn't refreshed when coming from some custom wps that erases it ; Initial support for options in the menus
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7747 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
12a4ba0d76
commit
cbbdc95d9c
5 changed files with 413 additions and 253 deletions
|
@ -37,6 +37,7 @@ gui/buttonbar.c
|
||||||
gui/icon.c
|
gui/icon.c
|
||||||
gui/list.c
|
gui/list.c
|
||||||
gui/scrollbar.c
|
gui/scrollbar.c
|
||||||
|
gui/select.c
|
||||||
gui/splash.c
|
gui/splash.c
|
||||||
gui/statusbar.c
|
gui/statusbar.c
|
||||||
gui/textarea.c
|
gui/textarea.c
|
||||||
|
|
143
apps/gui/select.c
Normal file
143
apps/gui/select.c
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 by Kevin Ferrare
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "select.h"
|
||||||
|
|
||||||
|
#include "lang.h"
|
||||||
|
#include "textarea.h"
|
||||||
|
#include "sprintf.h"
|
||||||
|
#include "kernel.h"
|
||||||
|
#include "screen_access.h"
|
||||||
|
|
||||||
|
void gui_select_init_numeric(struct gui_select * select,
|
||||||
|
const char * title,
|
||||||
|
int init_value,
|
||||||
|
int min_value,
|
||||||
|
int max_value,
|
||||||
|
int step,
|
||||||
|
const char * unit,
|
||||||
|
void (*formatter)(char* dest,
|
||||||
|
int dest_length,
|
||||||
|
int variable,
|
||||||
|
const char* unit)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
select->canceled=false;
|
||||||
|
select->validated=false;
|
||||||
|
select->title=title;
|
||||||
|
select->min_value=min_value;
|
||||||
|
select->max_value=max_value;
|
||||||
|
select->option=init_value;
|
||||||
|
select->step=step;
|
||||||
|
select->extra_string=unit;
|
||||||
|
select->formatter=formatter;
|
||||||
|
select->items=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_select_init_items(struct gui_select * select,
|
||||||
|
const char * title,
|
||||||
|
int selected,
|
||||||
|
const struct opt_items * items,
|
||||||
|
int nb_items)
|
||||||
|
{
|
||||||
|
select->canceled=false;
|
||||||
|
select->validated=false;
|
||||||
|
select->title=title;
|
||||||
|
select->min_value=0;
|
||||||
|
select->max_value=nb_items;
|
||||||
|
select->option=selected;
|
||||||
|
select->step=1;
|
||||||
|
select->formatter=NULL;
|
||||||
|
select->items=items;
|
||||||
|
}
|
||||||
|
//FIXME: si step>1, mettre d'abord au plus grand, ensuite passerau plus petit
|
||||||
|
void gui_select_next(struct gui_select * select)
|
||||||
|
{
|
||||||
|
select->option+=select->step;
|
||||||
|
if(select->option >= select->max_value)
|
||||||
|
select->option=select->min_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_select_prev(struct gui_select * select)
|
||||||
|
{
|
||||||
|
select->option-=select->step;
|
||||||
|
if(select->option < select->min_value)
|
||||||
|
select->option=select->max_value-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_select_draw(struct gui_select * select, struct screen * display)
|
||||||
|
{
|
||||||
|
screen_set_xmargin(display, 0);
|
||||||
|
gui_textarea_clear(display);
|
||||||
|
display->puts_scroll(0, 0, select->title);
|
||||||
|
|
||||||
|
if(gui_select_is_canceled(select))
|
||||||
|
display->puts_scroll(0, 0, str(LANG_MENU_SETTING_CANCEL));
|
||||||
|
if(select->items)
|
||||||
|
display->puts_scroll(0, 1, P2STR(select->items[select->option].string));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char buffer[30];
|
||||||
|
if(!select->formatter)
|
||||||
|
snprintf(buffer, sizeof buffer,"%d %s", select->option, select->extra_string);
|
||||||
|
else
|
||||||
|
select->formatter(buffer, sizeof buffer, select->option, select->extra_string);
|
||||||
|
display->puts_scroll(0, 1, buffer);
|
||||||
|
}
|
||||||
|
gui_textarea_update(display);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gui_syncselect_draw(struct gui_select * select)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i=0;i<NB_SCREENS;i++)
|
||||||
|
gui_select_draw(select, &(screens[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gui_syncselect_do_button(struct gui_select * select, int button)
|
||||||
|
{
|
||||||
|
bool moved=false;
|
||||||
|
switch(button)
|
||||||
|
{
|
||||||
|
case SELECT_INC :
|
||||||
|
case SELECT_INC | BUTTON_REPEAT :
|
||||||
|
gui_select_next(select);
|
||||||
|
moved=true;
|
||||||
|
break;
|
||||||
|
case SELECT_DEC :
|
||||||
|
case SELECT_DEC | BUTTON_REPEAT :
|
||||||
|
gui_select_prev(select);
|
||||||
|
moved=true;
|
||||||
|
break;
|
||||||
|
case SELECT_OK :
|
||||||
|
#ifdef SELECT_OK2
|
||||||
|
case SELECT_OK2 :
|
||||||
|
#endif
|
||||||
|
gui_select_validate(select);
|
||||||
|
break;
|
||||||
|
case SELECT_CANCEL :
|
||||||
|
case SELECT_CANCEL2 :
|
||||||
|
gui_select_cancel(select);
|
||||||
|
gui_syncselect_draw(select);
|
||||||
|
sleep(HZ/2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return(moved);
|
||||||
|
}
|
||||||
|
|
130
apps/gui/select.h
Normal file
130
apps/gui/select.h
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 by Kevin Ferrare
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _GUI_SELECT_H_
|
||||||
|
#define _GUI_SELECT_H_
|
||||||
|
#include "screen_access.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
||||||
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
||||||
|
#define SELECT_INC BUTTON_UP
|
||||||
|
#define SELECT_DEC BUTTON_DOWN
|
||||||
|
#define SELECT_OK BUTTON_SELECT
|
||||||
|
#define SELECT_OK2 BUTTON_LEFT
|
||||||
|
#define SELECT_CANCEL BUTTON_OFF
|
||||||
|
#define SELECT_CANCEL2 BUTTON_MODE
|
||||||
|
|
||||||
|
#elif CONFIG_KEYPAD == RECORDER_PAD
|
||||||
|
#define SELECT_INC BUTTON_UP
|
||||||
|
#define SELECT_DEC BUTTON_DOWN
|
||||||
|
#define SELECT_OK BUTTON_PLAY
|
||||||
|
#define SELECT_OK2 BUTTON_LEFT
|
||||||
|
#define SELECT_CANCEL BUTTON_OFF
|
||||||
|
#define SELECT_CANCEL2 BUTTON_F1
|
||||||
|
|
||||||
|
#elif CONFIG_KEYPAD == PLAYER_PAD
|
||||||
|
#define SELECT_INC BUTTON_RIGHT
|
||||||
|
#define SELECT_DEC BUTTON_LEFT
|
||||||
|
#define SELECT_OK BUTTON_PLAY
|
||||||
|
#define SELECT_CANCEL BUTTON_STOP
|
||||||
|
#define SELECT_CANCEL2 BUTTON_MENU
|
||||||
|
|
||||||
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
||||||
|
#define SELECT_INC BUTTON_UP
|
||||||
|
#define SELECT_DEC BUTTON_DOWN
|
||||||
|
#define SELECT_OK BUTTON_RIGHT
|
||||||
|
#define SELECT_OK2 BUTTON_LEFT
|
||||||
|
#define SELECT_CANCEL BUTTON_MENU
|
||||||
|
#define SELECT_CANCEL2 BUTTON_OFF
|
||||||
|
|
||||||
|
#elif CONFIG_KEYPAD == GMINI100_PAD
|
||||||
|
#define SELECT_INC BUTTON_UP
|
||||||
|
#define SELECT_DEC BUTTON_DOWN
|
||||||
|
#define SELECT_OK BUTTON_PLAY
|
||||||
|
#define SELECT_OK2 BUTTON_LEFT
|
||||||
|
#define SELECT_CANCEL BUTTON_OFF
|
||||||
|
#define SELECT_CANCEL2 BUTTON_MENU
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct gui_select
|
||||||
|
{
|
||||||
|
bool canceled;
|
||||||
|
bool validated;
|
||||||
|
const char * title;
|
||||||
|
int min_value;
|
||||||
|
int max_value;
|
||||||
|
int step;
|
||||||
|
int option;
|
||||||
|
const char * extra_string;
|
||||||
|
/* In the case the option is a number */
|
||||||
|
void (*formatter)(char* dest,
|
||||||
|
int dest_length,
|
||||||
|
int variable,
|
||||||
|
const char* unit);
|
||||||
|
const struct opt_items * items;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern void gui_select_init_numeric(struct gui_select * select,
|
||||||
|
const char * title,
|
||||||
|
int init_value,
|
||||||
|
int min_value,
|
||||||
|
int max_value,
|
||||||
|
int step,
|
||||||
|
const char * unit,
|
||||||
|
void (*formatter)(char* dest,
|
||||||
|
int dest_length,
|
||||||
|
int variable,
|
||||||
|
const char* unit));
|
||||||
|
|
||||||
|
extern void gui_select_init_items(struct gui_select * select,
|
||||||
|
const char * title,
|
||||||
|
int selected,
|
||||||
|
const struct opt_items * items,
|
||||||
|
int nb_items
|
||||||
|
);
|
||||||
|
|
||||||
|
extern void gui_select_next(struct gui_select * select);
|
||||||
|
|
||||||
|
extern void gui_select_prev(struct gui_select * select);
|
||||||
|
|
||||||
|
extern void gui_select_draw(struct gui_select * select, struct screen * display);
|
||||||
|
|
||||||
|
#define gui_select_get_selected(select) \
|
||||||
|
(select)->option
|
||||||
|
|
||||||
|
#define gui_select_cancel(select) \
|
||||||
|
(select)->canceled=true
|
||||||
|
|
||||||
|
#define gui_select_is_canceled(select) \
|
||||||
|
(select)->canceled
|
||||||
|
|
||||||
|
#define gui_select_validate(select) \
|
||||||
|
(select)->validated=true
|
||||||
|
|
||||||
|
#define gui_select_is_validated(select) \
|
||||||
|
(select)->validated
|
||||||
|
|
||||||
|
extern void gui_syncselect_draw(struct gui_select * select);
|
||||||
|
|
||||||
|
extern bool gui_syncselect_do_button(struct gui_select * select, int button);
|
||||||
|
|
||||||
|
#endif /* _GUI_SELECT_H_ */
|
|
@ -125,6 +125,7 @@ int menu_show(int m)
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
gui_synclist_draw(&(menus[m].synclist));
|
gui_synclist_draw(&(menus[m].synclist));
|
||||||
|
gui_syncstatusbar_draw(&statusbars, true);
|
||||||
menu_talk_selected(m);
|
menu_talk_selected(m);
|
||||||
while (!exit) {
|
while (!exit) {
|
||||||
key = button_get_w_tmo(HZ/2);
|
key = button_get_w_tmo(HZ/2);
|
||||||
|
|
257
apps/settings.c
257
apps/settings.c
|
@ -68,6 +68,8 @@
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "dircache.h"
|
#include "dircache.h"
|
||||||
|
#include "select.h"
|
||||||
|
#include "statusbar.h"
|
||||||
|
|
||||||
#if CONFIG_CODEC == MAS3507D
|
#if CONFIG_CODEC == MAS3507D
|
||||||
void dac_line_in(bool enable);
|
void dac_line_in(bool enable);
|
||||||
|
@ -1388,102 +1390,42 @@ bool set_int(const char* string,
|
||||||
int max,
|
int max,
|
||||||
void (*formatter)(char*, int, int, const char*) )
|
void (*formatter)(char*, int, int, const char*) )
|
||||||
{
|
{
|
||||||
bool done = false;
|
|
||||||
int button;
|
int button;
|
||||||
int org_value=*variable;
|
int oldvalue=*variable;
|
||||||
int last_value = INT_MAX; /* out of range init */
|
struct gui_select select;
|
||||||
|
gui_select_init_numeric(&select, string, *variable, min, max, step, unit, formatter);
|
||||||
#ifdef HAVE_LCD_BITMAP
|
gui_syncselect_draw(&select);
|
||||||
if(global_settings.statusbar)
|
while (!gui_select_is_validated(&select))
|
||||||
lcd_setmargins(0, STATUSBAR_HEIGHT);
|
{
|
||||||
else
|
|
||||||
lcd_setmargins(0, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lcd_clear_display();
|
|
||||||
lcd_puts_scroll(0, 0, string);
|
|
||||||
|
|
||||||
while (!done) {
|
|
||||||
char str[32];
|
|
||||||
|
|
||||||
if (formatter)
|
|
||||||
{
|
|
||||||
formatter(str, sizeof str, *variable, unit);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf(str,sizeof str,"%d %s ", *variable, unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
lcd_puts(0, 1, str);
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
status_draw(true);
|
|
||||||
#endif
|
|
||||||
lcd_update();
|
|
||||||
|
|
||||||
if (global_settings.talk_menu && *variable != last_value)
|
|
||||||
{
|
|
||||||
if (voice_unit < UNIT_LAST)
|
|
||||||
{ /* use the available unit definition */
|
|
||||||
talk_value(*variable, voice_unit, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ /* say the number, followed by an arbitrary voice ID */
|
|
||||||
talk_number(*variable, false);
|
|
||||||
talk_id(voice_unit, true);
|
|
||||||
}
|
|
||||||
last_value = *variable;
|
|
||||||
}
|
|
||||||
|
|
||||||
button = button_get_w_tmo(HZ/2);
|
button = button_get_w_tmo(HZ/2);
|
||||||
switch(button) {
|
if(gui_syncselect_do_button(&select, button))
|
||||||
case SETTINGS_INC:
|
{
|
||||||
case SETTINGS_INC | BUTTON_REPEAT:
|
*variable=gui_select_get_selected(&select);
|
||||||
*variable += step;
|
if (global_settings.talk_menu)
|
||||||
break;
|
{
|
||||||
|
gui_syncselect_draw(&select);
|
||||||
case SETTINGS_DEC:
|
if (voice_unit < UNIT_LAST)
|
||||||
case SETTINGS_DEC | BUTTON_REPEAT:
|
{ /* use the available unit definition */
|
||||||
*variable -= step;
|
talk_value(*variable, voice_unit, false);
|
||||||
break;
|
|
||||||
|
|
||||||
case SETTINGS_OK:
|
|
||||||
#ifdef SETTINGS_OK2
|
|
||||||
case SETTINGS_OK2:
|
|
||||||
#endif
|
|
||||||
done = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETTINGS_CANCEL:
|
|
||||||
#ifdef SETTINGS_CANCEL2
|
|
||||||
case SETTINGS_CANCEL2:
|
|
||||||
#endif
|
|
||||||
if (*variable != org_value) {
|
|
||||||
*variable=org_value;
|
|
||||||
lcd_stop_scroll();
|
|
||||||
lcd_puts(0, 0, str(LANG_MENU_SETTING_CANCEL));
|
|
||||||
lcd_update();
|
|
||||||
sleep(HZ/2);
|
|
||||||
}
|
}
|
||||||
done = true;
|
else
|
||||||
break;
|
{ /* say the number, followed by an arbitrary voice ID */
|
||||||
|
talk_number(*variable, false);
|
||||||
default:
|
talk_id(voice_unit, true);
|
||||||
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
}
|
||||||
return true;
|
}
|
||||||
break;
|
if ( function )
|
||||||
|
function(gui_select_get_selected(&select));
|
||||||
}
|
}
|
||||||
if(*variable > max )
|
gui_syncstatusbar_draw(&statusbars, false);
|
||||||
*variable = max;
|
if(gui_select_is_canceled(&select))
|
||||||
|
{
|
||||||
if(*variable < min )
|
*variable=oldvalue;
|
||||||
*variable = min;
|
return false;
|
||||||
|
}
|
||||||
if ( function && button != BUTTON_NONE)
|
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
||||||
function(*variable);
|
return true;
|
||||||
}
|
}
|
||||||
lcd_stop_scroll();
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1495,109 +1437,52 @@ bool set_int(const char* string,
|
||||||
different and bit-incompatible types and can not share the same access
|
different and bit-incompatible types and can not share the same access
|
||||||
code. */
|
code. */
|
||||||
|
|
||||||
|
#define set_type_fromint(type, dest, value) \
|
||||||
|
if (type == INT) \
|
||||||
|
*(int *)dest=value; \
|
||||||
|
else \
|
||||||
|
*(bool *)dest=value?true:false
|
||||||
|
|
||||||
|
#define set_int_fromtype(type, dest, var) \
|
||||||
|
if (type == INT) \
|
||||||
|
dest=*(int *)var; \
|
||||||
|
else \
|
||||||
|
dest=*(bool *)var?1:0
|
||||||
|
|
||||||
bool set_option(const char* string, void* variable, enum optiontype type,
|
bool set_option(const char* string, void* variable, enum optiontype type,
|
||||||
const struct opt_items* options, int numoptions, void (*function)(int))
|
const struct opt_items* options, int numoptions, void (*function)(int))
|
||||||
{
|
{
|
||||||
bool done = false;
|
|
||||||
int button;
|
int button;
|
||||||
int* intvar = (int*)variable;
|
int oldvalue;
|
||||||
bool* boolvar = (bool*)variable;
|
/* oldvalue=*variable; */
|
||||||
int oldval = 0;
|
set_int_fromtype(type, oldvalue, variable);
|
||||||
int index, oldindex = -1; /* remember what we said */
|
struct gui_select select;
|
||||||
|
gui_select_init_items(&select, string, oldvalue, options, numoptions);
|
||||||
if (type==INT)
|
gui_syncselect_draw(&select);
|
||||||
oldval=*intvar;
|
while ( !gui_select_is_validated(&select) )
|
||||||
else
|
{
|
||||||
oldval=*boolvar;
|
gui_syncstatusbar_draw(&statusbars, true);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
if(global_settings.statusbar)
|
|
||||||
lcd_setmargins(0, STATUSBAR_HEIGHT);
|
|
||||||
else
|
|
||||||
lcd_setmargins(0, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lcd_clear_display();
|
|
||||||
lcd_puts_scroll(0, 0, string);
|
|
||||||
|
|
||||||
while ( !done ) {
|
|
||||||
index = type==INT ? *intvar : (int)*boolvar;
|
|
||||||
lcd_puts(0, 1, P2STR(options[index].string));
|
|
||||||
if (global_settings.talk_menu && index != oldindex)
|
|
||||||
{
|
|
||||||
talk_id(options[index].voice_id, false);
|
|
||||||
oldindex = index;
|
|
||||||
}
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
status_draw(true);
|
|
||||||
#endif
|
|
||||||
lcd_update();
|
|
||||||
|
|
||||||
button = button_get_w_tmo(HZ/2);
|
button = button_get_w_tmo(HZ/2);
|
||||||
switch (button) {
|
if(gui_syncselect_do_button(&select, button))
|
||||||
case SETTINGS_INC:
|
{
|
||||||
case SETTINGS_INC | BUTTON_REPEAT:
|
/* *variable = gui_select_get_selected(&select) */
|
||||||
if (type == INT) {
|
set_type_fromint(type, variable, gui_select_get_selected(&select));
|
||||||
if ( *intvar < (numoptions-1) )
|
gui_syncselect_draw(&select);
|
||||||
(*intvar)++;
|
if (global_settings.talk_menu)
|
||||||
else
|
talk_id(options[gui_select_get_selected(&select)].voice_id, false);
|
||||||
(*intvar) -= (numoptions-1);
|
if ( function )
|
||||||
}
|
function(*(int *)variable);
|
||||||
else
|
|
||||||
*boolvar = !*boolvar;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETTINGS_DEC:
|
|
||||||
case SETTINGS_DEC | BUTTON_REPEAT:
|
|
||||||
if (type == INT) {
|
|
||||||
if ( *intvar > 0 )
|
|
||||||
(*intvar)--;
|
|
||||||
else
|
|
||||||
(*intvar) += (numoptions-1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*boolvar = !*boolvar;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETTINGS_OK:
|
|
||||||
#ifdef SETTINGS_OK2
|
|
||||||
case SETTINGS_OK2:
|
|
||||||
#endif
|
|
||||||
done = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SETTINGS_CANCEL:
|
|
||||||
#ifdef SETTINGS_CANCEL2
|
|
||||||
case SETTINGS_CANCEL2:
|
|
||||||
#endif
|
|
||||||
if (((type==INT) && (*intvar != oldval)) ||
|
|
||||||
((type==BOOL) && (*boolvar != (bool)oldval))) {
|
|
||||||
if (type==INT)
|
|
||||||
*intvar=oldval;
|
|
||||||
else
|
|
||||||
*boolvar=oldval;
|
|
||||||
lcd_stop_scroll();
|
|
||||||
lcd_puts(0, 0, str(LANG_MENU_SETTING_CANCEL));
|
|
||||||
lcd_update();
|
|
||||||
sleep(HZ/2);
|
|
||||||
}
|
|
||||||
done = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
gui_syncstatusbar_draw(&statusbars, false);
|
||||||
if ( function && button != BUTTON_NONE) {
|
if(gui_select_is_canceled(&select))
|
||||||
if (type == INT)
|
{
|
||||||
function(*intvar);
|
/* *variable=oldvalue; */
|
||||||
else
|
set_type_fromint(type, variable, oldvalue);
|
||||||
function(*boolvar);
|
return false;
|
||||||
}
|
}
|
||||||
|
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
lcd_stop_scroll();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue