menu: correctly show the entry at the bottom of the display.
[bertos.git] / bertos / gui / menu.c
index 8241f1a0aa36cd90ee2a10ff39ff6129c2b18174..c3fc3d2b916c365303f7326409731cbf8b5d13c3 100644 (file)
  * the GNU General Public License.
  *
  * Copyright 2003, 2004, 2006 Develer S.r.l. (http://www.develer.com/)
- * Copyright 2000 Bernardo Innocenti <bernie@codewiz.org>
+ * Copyright 2000 Bernie Innocenti <bernie@codewiz.org>
  *
  * -->
  *
  * \version $Id$
  *
- * \author Bernardo Innocenti <bernie@develer.com>
+ * \author Bernie Innocenti <bernie@codewiz.org>
  * \author Stefano Fedrigo <aleph@develer.com>
  *
  * \brief General pourpose menu handling functions
@@ -42,6 +42,7 @@
 #include "menu.h"
 
 #include "cfg/cfg_gfx.h"
+#include "cfg/cfg_arch.h"
 #include <cfg/compiler.h>
 #include <cfg/debug.h>
 
@@ -168,9 +169,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,7 +197,7 @@ static void menu_layout(
 
        ypos = bm->cr.ymin;
 
-#if 0
+#if 1
        if (redraw)
        {
                /* Clear screen */
@@ -278,6 +277,9 @@ static void menu_layout(
                if (!(item->flags & MIF_HIDDEN))
                {
                        /* Check if a special render function is supplied, otherwise use defaults */
+                       #if (ARCH & ARCH_NIGHTTEST)
+                               #warning __FILTER_NEXT_WARNING__
+                       #endif
                        RenderHook renderhook = (item->flags & MIF_RENDERHOOK) ? (RenderHook)item->label : menu_defaultRenderHook;
 
                        /* Render menuitem */
@@ -440,7 +442,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
@@ -540,6 +542,9 @@ iptr_t menu_handle(const struct Menu *menu)
 
        /* Store currently selected item before leaving. */
        if (menu->flags & MF_SAVESEL)
+               #if (ARCH & ARCH_NIGHTTEST)
+                       #warning __FILTER_NEXT_WARNING__
+               #endif
                CONST_CAST(struct Menu *, menu)->selected = selected;
 
        return result;