1
0
Fork 0
forked from len0rd/rockbox

Adapted to new event handling

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4958 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2004-07-27 06:19:01 +00:00
parent 6a635ce6ed
commit 98c7b81471

View file

@ -49,6 +49,8 @@ struct shown {
static bool use_system_font = false; static bool use_system_font = false;
static bool been_in_usb_mode = false;
/* leap year -- account for gregorian reformation in 1752 */ /* leap year -- account for gregorian reformation in 1752 */
static int is_leap_year(int yr) static int is_leap_year(int yr)
{ {
@ -410,6 +412,10 @@ static void add_memo(struct shown *shown, int type)
static bool edit_memo(int change, struct shown *shown) static bool edit_memo(int change, struct shown *shown)
{ {
bool exit = false; bool exit = false;
int button;
while (!exit)
{
rb->lcd_clear_display(); rb->lcd_clear_display();
if (memos_in_shown_memory > 0) if (memos_in_shown_memory > 0)
{ {
@ -430,9 +436,8 @@ static bool edit_memo(int change, struct shown *shown)
rb->lcd_puts(2,4,"one off : On"); rb->lcd_puts(2,4,"one off : On");
} }
rb->lcd_update(); rb->lcd_update();
while (!exit) button = rb->button_get(true);
{ switch (button)
switch (rb->button_get(true))
{ {
case BUTTON_OFF: case BUTTON_OFF:
return false; return false;
@ -473,8 +478,10 @@ static bool edit_memo(int change, struct shown *shown)
} }
break; break;
case SYS_USB_CONNECTED: default:
return true; if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
been_in_usb_mode = true;
break;
} }
} }
return false; return false;
@ -542,6 +549,8 @@ static bool any_events(struct shown *shown, bool force)
{ {
int lines_displayed = 0; int lines_displayed = 0;
bool exit=false; bool exit=false;
int button;
update_memos_shown(shown); update_memos_shown(shown);
if (memos_in_shown_memory > 0) if (memos_in_shown_memory > 0)
show_lines(lines_displayed,shown); show_lines(lines_displayed,shown);
@ -552,7 +561,8 @@ static bool any_events(struct shown *shown, bool force)
rb->lcd_update(); rb->lcd_update();
while (!exit) while (!exit)
{ {
switch (rb->button_get(true)) button = rb->button_get(true);
switch (button)
{ {
case BUTTON_DOWN: case BUTTON_DOWN:
if (memos_in_shown_memory > 0) if (memos_in_shown_memory > 0)
@ -582,8 +592,11 @@ static bool any_events(struct shown *shown, bool force)
case BUTTON_OFF: case BUTTON_OFF:
return false; return false;
case SYS_USB_CONNECTED: default:
return true; if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
been_in_usb_mode = true;
show_lines(lines_displayed,shown);
break;
} }
} }
return false; return false;
@ -648,6 +661,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
struct today today; struct today today;
struct shown shown; struct shown shown;
bool exit = false; bool exit = false;
int button;
TEST_PLUGIN_API(api); TEST_PLUGIN_API(api);
(void)(parameter); (void)(parameter);
@ -659,7 +674,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
draw_calendar(&shown); draw_calendar(&shown);
while (!exit) while (!exit)
{ {
switch (rb->button_get(true)) button = rb->button_get(true);
switch (button)
{ {
case BUTTON_OFF: case BUTTON_OFF:
return false; return false;
@ -700,13 +716,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
draw_calendar(&shown); draw_calendar(&shown);
break; break;
case SYS_USB_CONNECTED: default:
rb->usb_screen(); if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
been_in_usb_mode = true;
draw_calendar(&shown); draw_calendar(&shown);
break; break;
} }
} }
return false; return been_in_usb_mode?PLUGIN_USB_CONNECTED:PLUGIN_OK;
} }
#endif #endif