X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fgui%2Fmenu.c;h=432927895e28e03f63bf4243259378877cb50969;hb=4d8a6a97c6c0e15296b51d5f02674079bede1aa0;hp=146b3c1ffd0f6741d8a04bcb234db577aa71a8fc;hpb=4cc44c9888a0336b9d01121ec0b7ad95f4a76195;p=bertos.git diff --git a/bertos/gui/menu.c b/bertos/gui/menu.c index 146b3c1f..43292789 100644 --- a/bertos/gui/menu.c +++ b/bertos/gui/menu.c @@ -26,13 +26,11 @@ * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * - * Copyright 2003, 2004, 2006 Develer S.r.l. (http://www.develer.com/) + * Copyright 2003, 2004, 2006, 2010 Develer S.r.l. (http://www.develer.com/) * Copyright 2000 Bernie Innocenti * * --> * - * \version $Id$ - * * \author Bernie Innocenti * \author Stefano Fedrigo * @@ -41,7 +39,9 @@ #include "menu.h" -#include "cfg/cfg_gfx.h" +#include "cfg/cfg_menu.h" +#include "cfg/cfg_arch.h" + #include #include @@ -49,6 +49,8 @@ #include #include +#include + #include #include /* strcpy() */ @@ -57,10 +59,6 @@ #include /* strncpy_P() */ #endif -#if CONFIG_MENU_SMOOTH -#include -#endif - #if (CONFIG_MENU_TIMEOUT != 0) #include #endif @@ -168,9 +166,7 @@ static void menu_defaultRenderHook(struct Bitmap *bm, int ypos, bool selected, c } } -#warning FIXME:REVISE this code! -#if 0 -//#if CPU_HARVARD +#if CPU_HARVARD ((item->flags & MIF_RAMLABEL) ? text_xyprintf : text_xyprintf_P) #else text_xyprintf @@ -198,13 +194,11 @@ static void menu_layout( ypos = bm->cr.ymin; -#if 1 if (redraw) { /* Clear screen */ text_clear(menu->bitmap); } -#endif if (title) { @@ -277,7 +271,7 @@ static void menu_layout( /* Only print visible items */ if (!(item->flags & MIF_HIDDEN)) { - /* Check if a special render function is supplied, otherwise use defaults */ + #warning __FILTER_NEXT_WARNING__ RenderHook renderhook = (item->flags & MIF_RENDERHOOK) ? (RenderHook)item->label : menu_defaultRenderHook; /* Render menuitem */ @@ -293,7 +287,7 @@ static void menu_layout( /* Clear rest of area */ gfx_rectClear(bm, bm->cr.xmin, ypos, bm->cr.xmax, bm->cr.ymax); - lcd_blitBitmap(&lcd_bitmap); + menu->lcd_blitBitmap(bm); } /* Restore old cliprect */ @@ -440,7 +434,7 @@ iptr_t menu_handle(const struct Menu *menu) items_per_page = - (menu->bitmap->height / menu->bitmap->font->height) + (menu->bitmap->height / menu->bitmap->font->height - 1) #if CONFIG_MENU_MENUBAR - 1 /* menu bar labels */ #endif @@ -472,6 +466,7 @@ iptr_t menu_handle(const struct Menu *menu) #if CONFIG_MENU_SMOOTH || (CONFIG_MENU_TIMEOUT != 0) key = kbd_peek(); + cpu_relax(); #else key = kbd_get(); #endif @@ -540,6 +535,7 @@ iptr_t menu_handle(const struct Menu *menu) /* Store currently selected item before leaving. */ if (menu->flags & MF_SAVESEL) + #warning __FILTER_NEXT_WARNING__ CONST_CAST(struct Menu *, menu)->selected = selected; return result;