From e5c5c9f3b2e4299d768cd098106b0ad8a2024ab8 Mon Sep 17 00:00:00 2001 From: asterix Date: Thu, 20 May 2010 16:41:11 +0000 Subject: [PATCH] Split menu configuration. Add callback for smooth. Clean up. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3751 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cfg/cfg_gfx.h | 1 - bertos/cfg/cfg_menu.h | 67 +++++++++++++++++++++++++++++++++++++++++++ bertos/gui/menu.c | 11 ++----- bertos/gui/menu.h | 5 ++-- 4 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 bertos/cfg/cfg_menu.h diff --git a/bertos/cfg/cfg_gfx.h b/bertos/cfg/cfg_gfx.h index 63454016..59dde04c 100644 --- a/bertos/cfg/cfg_gfx.h +++ b/bertos/cfg/cfg_gfx.h @@ -38,7 +38,6 @@ #ifndef CFG_GFX_H #define CFG_GFX_H - /** * Enable line clipping algorithm. * $WIZ$ type = "boolean" diff --git a/bertos/cfg/cfg_menu.h b/bertos/cfg/cfg_menu.h new file mode 100644 index 00000000..bbfa1e76 --- /dev/null +++ b/bertos/cfg/cfg_menu.h @@ -0,0 +1,67 @@ +/** + * \file + * + * + * \brief Configuration file for Menu module. + * + * \author Daniele Basile + */ + +#ifndef CFG_MENU_H +#define CFG_MENU_H + +/** + * Enable button bar behind menus + * $WIZ$ type = "boolean" + */ +#define CONFIG_MENU_MENUBAR 0 + +/** + * Level Edit Timeout + * $WIZ$ type = "boolean" + */ +#define CONFIG_LEVELEDIT_TIMEOUT 0 + +/** + * Menu timeout + * $WIZ$ type = "boolean" + */ +#define CONFIG_MENU_TIMEOUT 0 + +/** + * Enable smooth scrolling in menus + * $WIZ$ type = "boolean" + */ +#define CONFIG_MENU_SMOOTH 1 + + +#endif /* CFG_MENU_H */ + diff --git a/bertos/gui/menu.c b/bertos/gui/menu.c index 6c3f8d0d..556985f6 100644 --- a/bertos/gui/menu.c +++ b/bertos/gui/menu.c @@ -39,8 +39,9 @@ #include "menu.h" -#include "cfg/cfg_gfx.h" +#include "cfg/cfg_menu.h" #include "cfg/cfg_arch.h" + #include #include @@ -56,10 +57,6 @@ #include /* strncpy_P() */ #endif -#if CONFIG_MENU_SMOOTH -#include -#endif - #if (CONFIG_MENU_TIMEOUT != 0) #include #endif @@ -195,13 +192,11 @@ static void menu_layout( ypos = bm->cr.ymin; -#if 1 if (redraw) { /* Clear screen */ text_clear(menu->bitmap); } -#endif if (title) { @@ -293,7 +288,7 @@ static void menu_layout( /* Clear rest of area */ gfx_rectClear(bm, bm->cr.xmin, ypos, bm->cr.xmax, bm->cr.ymax); - lcd_blitBitmap(bm); + menu->lcd_blitBitmap(bm); } /* Restore old cliprect */ diff --git a/bertos/gui/menu.h b/bertos/gui/menu.h index d5b516ae..6e450d23 100644 --- a/bertos/gui/menu.h +++ b/bertos/gui/menu.h @@ -46,11 +46,11 @@ #include -/* Fwd decl */ -struct Bitmap; +#include /** Menu callback function */ typedef iptr_t (*MenuHook)(iptr_t userdata); +typedef void (*BlitBitmap)(const Bitmap *bm); /** * Menu item description. @@ -100,6 +100,7 @@ typedef struct Menu int flags; /**< See MF_#? definitions below */ struct Bitmap *bitmap; /**< Bitmap where the menu is rendered */ int selected; /**< Initial selection (written to if MF_SAVESEL is set). */ + BlitBitmap lcd_blitBitmap; /**< Callback to call to do smooth the display */ } Menu; /** -- 2.25.1