1
0
Fork 0
forked from len0rd/rockbox

Added cancel options in settings menues.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3083 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Kjell Ericson 2003-01-14 13:49:28 +00:00
parent 5caec3ae2a
commit 5d75f7e718
2 changed files with 80 additions and 12 deletions

View file

@ -934,6 +934,7 @@ bool set_int(char* string,
{
bool done = false;
int button;
int org_value=*variable;
#ifdef HAVE_LCD_BITMAP
if(global_settings.statusbar)
@ -978,10 +979,30 @@ bool set_int(char* string,
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_LEFT:
case BUTTON_PLAY:
#else
case BUTTON_PLAY:
#endif
done = true;
if (*variable != org_value) {
lcd_stop_scroll();
lcd_puts(0, 0, str(LANG_MENU_SETTING_OK));
sleep(HZ/2);
}
break;
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_OFF:
#else
case BUTTON_STOP:
case BUTTON_MENU:
#endif
if (*variable != org_value) {
*variable=org_value;
lcd_stop_scroll();
lcd_puts(0, 0, str(LANG_MENU_SETTING_CANCEL));
sleep(HZ/2);
}
done = true;
break;
@ -1009,6 +1030,7 @@ bool set_option(char* string, int* variable, char* options[],
{
bool done = false;
int button;
int org_value=*variable;
#ifdef HAVE_LCD_BITMAP
if(global_settings.statusbar)
@ -1016,6 +1038,7 @@ bool set_option(char* string, int* variable, char* options[],
else
lcd_setmargins(0, 0);
#endif
lcd_clear_display();
lcd_puts_scroll(0, 0, string);
@ -1056,10 +1079,30 @@ bool set_option(char* string, int* variable, char* options[],
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_LEFT:
case BUTTON_PLAY:
#else
case BUTTON_PLAY:
#endif
done = true;
if (*variable != org_value) {
lcd_stop_scroll();
lcd_puts(0, 0, str(LANG_MENU_SETTING_OK));
sleep(HZ/2);
}
break;
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_OFF:
#else
case BUTTON_STOP:
case BUTTON_MENU:
#endif
if (*variable != org_value) {
*variable=org_value;
lcd_stop_scroll();
lcd_puts(0, 0, str(LANG_MENU_SETTING_CANCEL));
sleep(HZ/2);
}
done = true;
break;

View file

@ -29,6 +29,7 @@
#include "power.h"
#include "powermgmt.h"
#include "status.h"
#include "debug.h"
#include "lang.h"
@ -49,6 +50,8 @@ bool sleeptimer_screen(void)
char buf[32];
int oldtime, newtime;
int amount = 0;
int org_timer=get_sleep_timer();
bool changed=false;
#ifdef HAVE_LCD_BITMAP
lcd_setfont(FONT_UI);
@ -56,17 +59,40 @@ bool sleeptimer_screen(void)
lcd_setmargins(w, 8);
#endif
lcd_clear_display();
lcd_puts_scroll(0, 0, str(LANG_SLEEP_TIMER));
while(!done)
{
button = button_get_w_tmo(HZ/20);
button = button_get_w_tmo(HZ);
switch(button)
{
#ifdef HAVE_PLAYER_KEYPAD
case BUTTON_STOP:
#else
case BUTTON_OFF:
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_LEFT:
case BUTTON_PLAY:
#else
case BUTTON_PLAY:
#endif
done = true;
if (changed) {
lcd_stop_scroll();
lcd_puts(0, 0, str(LANG_MENU_SETTING_OK));
sleep(HZ/2);
}
break;
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_OFF:
#else
case BUTTON_STOP:
case BUTTON_MENU:
#endif
if (changed) {
lcd_stop_scroll();
lcd_puts(0, 0, str(LANG_MENU_SETTING_CANCEL));
set_sleep_timer(org_timer);
sleep(HZ/2);
}
done = true;
break;
@ -76,7 +102,6 @@ bool sleeptimer_screen(void)
case BUTTON_UP:
#endif
oldtime = (get_sleep_timer()+59) / 60;
if(oldtime < THRESHOLD)
amount = SMALL_STEP_SIZE;
else
@ -86,6 +111,7 @@ bool sleeptimer_screen(void)
if(newtime > MAX_TIME)
newtime = MAX_TIME;
changed=true;
set_sleep_timer(newtime);
break;
@ -95,7 +121,6 @@ bool sleeptimer_screen(void)
case BUTTON_DOWN:
#endif
oldtime = (get_sleep_timer()+59) / 60;
if(oldtime <= THRESHOLD)
amount = SMALL_STEP_SIZE;
else
@ -105,14 +130,13 @@ bool sleeptimer_screen(void)
if(newtime < 0)
newtime = 0;
changed=true;
set_sleep_timer(newtime);
break;
}
seconds = get_sleep_timer();
lcd_clear_display();
lcd_puts(0, 0, str(LANG_SLEEP_TIMER));
if(seconds)
{
seconds += 59; /* Round up for a "friendlier" display */
@ -131,5 +155,6 @@ bool sleeptimer_screen(void)
lcd_update();
}
lcd_stop_scroll();
return false;
}