X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fgui%2Fmenu.c;h=432927895e28e03f63bf4243259378877cb50969;hb=39e200e1f43474a96888f97e2271728c9605ccbe;hp=f02324ecf2c2b02e4738cb500dcc5f8b18a73fdd;hpb=791e167e053bdd9250d34a9a5ccae6ccde4d6679;p=bertos.git diff --git a/bertos/gui/menu.c b/bertos/gui/menu.c index f02324ec..43292789 100644 --- a/bertos/gui/menu.c +++ b/bertos/gui/menu.c @@ -26,83 +26,39 @@ * 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 2000 Bernardo Innocenti + * Copyright 2003, 2004, 2006, 2010 Develer S.r.l. (http://www.develer.com/) + * Copyright 2000 Bernie Innocenti * * --> * - * \version $Id$ - * - * \author Bernardo Innocenti + * \author Bernie Innocenti * \author Stefano Fedrigo * * \brief General pourpose menu handling functions */ -/*#* - *#* $Log$ - *#* Revision 1.8 2006/09/13 13:58:32 bernie - *#* Add RenderHook support. - *#* - *#* Revision 1.7 2006/08/01 12:22:46 bernie - *#* Mention DevLib license. - *#* - *#* Revision 1.6 2006/07/19 12:56:27 bernie - *#* Convert to new Doxygen style. - *#* - *#* Revision 1.5 2006/06/03 13:58:01 bernie - *#* Fix recursive timeout and add exit status information. - *#* - *#* Revision 1.4 2006/06/02 12:26:18 bernie - *#* Draw graphical checkmarks. - *#* - *#* Revision 1.3 2006/05/28 15:03:31 bernie - *#* Avoid unnecessary rendering. - *#* - *#* Revision 1.2 2006/05/25 23:34:38 bernie - *#* Implement menu timeouts. - *#* - *#* Revision 1.1 2006/05/15 07:20:54 bernie - *#* Move menu to gui/. - *#* - *#* Revision 1.7 2006/04/27 05:39:24 bernie - *#* Enhance text rendering to arbitrary x,y coords. - *#* - *#* Revision 1.6 2006/04/11 00:07:32 bernie - *#* Implemenent MF_SAVESEL flag. - *#* - *#* Revision 1.5 2006/03/22 09:49:51 bernie - *#* Simplifications from project_grl. - *#* - *#* Revision 1.4 2006/03/20 17:48:35 bernie - *#* Implement support for ROM menus. - *#* - *#* Revision 1.3 2006/02/20 14:34:32 bernie - *#* Include appconfig.h before using its definitions. - *#* - *#* Revision 1.2 2006/02/15 09:10:51 bernie - *#* Make title bold; Fix height when we have no menubar. - *#*/ - #include "menu.h" +#include "cfg/cfg_menu.h" +#include "cfg/cfg_arch.h" + +#include +#include + #include #include #include + +#include + #include -#include -#include -#include + #include /* strcpy() */ #if CPU_HARVARD #include /* strncpy_P() */ #endif -#if CONFIG_MENU_SMOOTH -#include -#endif - #if (CONFIG_MENU_TIMEOUT != 0) #include #endif @@ -238,13 +194,11 @@ static void menu_layout( ypos = bm->cr.ymin; -#if 0 if (redraw) { /* Clear screen */ text_clear(menu->bitmap); } -#endif if (title) { @@ -317,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 */ @@ -333,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 */ @@ -480,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 @@ -512,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 @@ -580,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;