diff options
Diffstat (limited to 'apps/menus')
-rw-r--r-- | apps/menus/display_menu.c | 159 | ||||
-rw-r--r-- | apps/menus/exported_menus.h | 10 | ||||
-rw-r--r-- | apps/menus/main_menu.c | 16 | ||||
-rw-r--r-- | apps/menus/theme_menu.c | 223 |
4 files changed, 234 insertions, 174 deletions
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index 11d1f25e7f..a68defdfd4 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -115,113 +115,7 @@ MENUITEM_SETTING(invert, &global_settings.invert, NULL); #ifdef HAVE_LCD_FLIP MENUITEM_SETTING(flip_display, &global_settings.flip_display, flipdisplay_callback); #endif -MENUITEM_SETTING(cursor_style, &global_settings.cursor_style, NULL); #endif /* HAVE_LCD_BITMAP */ -#if LCD_DEPTH > 1 -/** -* Menu to clear the backdrop image - */ -static int clear_main_backdrop(void) -{ - global_settings.backdrop_file[0]=0; - unload_main_backdrop(); - show_main_backdrop(); - settings_save(); - return 0; -} -MENUITEM_FUNCTION(clear_main_bd, 0, ID2P(LANG_CLEAR_BACKDROP), - clear_main_backdrop, NULL, NULL, Icon_NOICON); -#endif /* LCD_DEPTH > 1 */ -#ifdef HAVE_LCD_COLOR -/** - * Menu for fore/back colors - */ -static int set_fg_color(void) -{ - int res; - res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_FOREGROUND_COLOR), - &global_settings.fg_color,global_settings.bg_color); - - screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); - settings_save(); - return res; -} - -static int set_bg_color(void) -{ - int res; - res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_BACKGROUND_COLOR), - &global_settings.bg_color,global_settings.fg_color); - - screens[SCREEN_MAIN].set_background(global_settings.bg_color); - settings_save(); - return res; -} - -/* Line selector colour */ -static int set_lss_color(void) -{ - int res; - res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_START_COLOR), - &global_settings.lss_color,-1); - - screens[SCREEN_MAIN].set_selector_start(global_settings.lss_color); - settings_save(); - return res; -} - -static int set_lse_color(void) -{ - int res; - res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_END_COLOR), - &global_settings.lse_color,-1); - - screens[SCREEN_MAIN].set_selector_end(global_settings.lse_color); - settings_save(); - return res; -} - -/* Line selector text colour */ -static int set_lst_color(void) -{ - int res; - res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_TEXT_COLOR), - &global_settings.lst_color,global_settings.lss_color); - - screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color); - settings_save(); - return res; -} - -static int reset_color(void) -{ - global_settings.fg_color = LCD_DEFAULT_FG; - global_settings.bg_color = LCD_DEFAULT_BG; - global_settings.lss_color = LCD_DEFAULT_LS; - global_settings.lse_color = LCD_DEFAULT_BG; - global_settings.lst_color = LCD_DEFAULT_FG; - - screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); - screens[SCREEN_MAIN].set_background(global_settings.bg_color); - screens[SCREEN_MAIN].set_selector_start(global_settings.lss_color); - screens[SCREEN_MAIN].set_selector_end(global_settings.lse_color); - screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color); - settings_save(); - return 0; -} -MENUITEM_FUNCTION(set_bg_col, 0, ID2P(LANG_BACKGROUND_COLOR), - set_bg_color, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(set_fg_col, 0, ID2P(LANG_FOREGROUND_COLOR), - set_fg_color, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(set_lss_col, 0, ID2P(LANG_SELECTOR_START_COLOR), - set_lss_color, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(set_lse_col, 0, ID2P(LANG_SELECTOR_END_COLOR), - set_lse_color, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(set_lst_col, 0, ID2P(LANG_SELECTOR_TEXT_COLOR), - set_lst_color, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS), - reset_color, NULL, NULL, Icon_NOICON); -#endif /* now the actual menu */ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU), @@ -256,17 +150,7 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU), # ifdef HAVE_LCD_FLIP ,&flip_display # endif - ,&cursor_style #endif /* HAVE_LCD_BITMAP */ -#ifdef HAVE_LCD_COLOR - ,&set_lss_col, &set_lse_col, &set_lst_col -#endif -#if LCD_DEPTH > 1 - ,&clear_main_bd, -#endif -#ifdef HAVE_LCD_COLOR - &set_bg_col, &set_fg_col, &reset_colors -#endif ); /* LCD MENU */ /***********************************/ @@ -594,57 +478,16 @@ MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON, -struct browse_folder_info { - const char* dir; - int show_options; -}; -#ifdef HAVE_LCD_BITMAP -static struct browse_folder_info fonts = {FONT_DIR, SHOW_FONT}; -#endif -static struct browse_folder_info wps = {WPS_DIR, SHOW_WPS}; -#ifdef HAVE_REMOTE_LCD -static struct browse_folder_info rwps = {WPS_DIR, SHOW_RWPS}; -#endif - -static int browse_folder(void *param) -{ - const struct browse_folder_info *info = - (const struct browse_folder_info*)param; - return rockbox_browse(info->dir, info->show_options); -} - -#ifdef HAVE_LCD_BITMAP -MENUITEM_FUNCTION(browse_fonts, MENU_FUNC_USEPARAM, - ID2P(LANG_CUSTOM_FONT), - browse_folder, (void*)&fonts, NULL, Icon_NOICON); -#endif -MENUITEM_FUNCTION(browse_wps, MENU_FUNC_USEPARAM, - ID2P(LANG_WHILE_PLAYING), - browse_folder, (void*)&wps, NULL, Icon_NOICON); -#ifdef HAVE_REMOTE_LCD -MENUITEM_FUNCTION(browse_rwps, MENU_FUNC_USEPARAM, - ID2P(LANG_REMOTE_WHILE_PLAYING), - browse_folder, (void*)&rwps, NULL, Icon_NOICON); -#endif - -MENUITEM_SETTING(show_icons, &global_settings.show_icons, NULL); MENUITEM_SETTING(codepage_setting, &global_settings.default_codepage, NULL); MAKE_MENU(display_menu, ID2P(LANG_DISPLAY), NULL, Icon_Display_menu, -#ifdef HAVE_LCD_BITMAP - &browse_fonts, -#endif - &browse_wps, -#ifdef HAVE_REMOTE_LCD - &browse_rwps, -#endif &lcd_settings, #ifdef HAVE_REMOTE_LCD &lcd_remote_settings, #endif - &show_icons, &scroll_settings_menu, + &scroll_settings_menu, #ifdef HAVE_LCD_BITMAP &bars_menu, &peak_meter_menu, #endif diff --git a/apps/menus/exported_menus.h b/apps/menus/exported_menus.h index a4f8512a73..6318007c64 100644 --- a/apps/menus/exported_menus.h +++ b/apps/menus/exported_menus.h @@ -34,14 +34,20 @@ extern const struct menu_item_ex settings_menu_item, /* settings_menu.c */ playlist_settings, /* playlist_menu.c */ playlist_options, /* playlist_menu.c */ - equalizer_menu, /* eq_menu.c */ - info_menu; /* info_menu.c */ + equalizer_menu, /* eq_menu.c */ + info_menu, /* info_menu.c */ + theme_menu; /* theme_menu.c */ #ifdef HAVE_WM8758 extern const struct menu_item_ex hw_eq_menu; /* eq_menu.c */ #endif +struct browse_folder_info { + const char* dir; + int show_options; +}; +int browse_folder(void *param); /* in theme_menu.c as it is mostly used there */ #endif /* ! PLUGIN */ #endif /*_EXPORTED_MENUS_H */ diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 822301fe52..2dd0899a3b 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -49,18 +49,7 @@ -struct browse_folder_info { - const char* dir; - int show_options; -}; -static struct browse_folder_info theme = {THEME_DIR, SHOW_CFG}; static struct browse_folder_info config = {ROCKBOX_DIR, SHOW_CFG}; -int browse_folder(void *param) -{ - const struct browse_folder_info *info = - (const struct browse_folder_info*)param; - return rockbox_browse(info->dir, info->show_options); -} /***********************************/ /* MANAGE SETTINGS MENU */ @@ -454,8 +443,6 @@ MAKE_MENU(info_menu, ID2P(LANG_SYSTEM), 0, Icon_Questionmark, /***********************************/ /* MAIN MENU */ -MENUITEM_FUNCTION(browse_themes, MENU_FUNC_USEPARAM, ID2P(LANG_CUSTOM_THEME), - browse_folder, (void*)&theme, NULL, Icon_Folder); #ifdef HAVE_LCD_CHARCELLS int mainmenu_callback(int action,const struct menu_item_ex *this_item) @@ -478,10 +465,11 @@ int mainmenu_callback(int action,const struct menu_item_ex *this_item) MAKE_MENU(main_menu_, ID2P(LANG_SETTINGS), mainmenu_callback, Icon_Submenu_Entered, &sound_settings, - &settings_menu_item, &manage_settings, &browse_themes, + &settings_menu_item, &theme_menu, #ifdef HAVE_RECORDING &recording_settings, #endif + &manage_settings, ); /* MAIN MENU */ /***********************************/ diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c new file mode 100644 index 0000000000..723f9fe4ad --- /dev/null +++ b/apps/menus/theme_menu.c @@ -0,0 +1,223 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2007 Jonathan Gordon + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include <stdbool.h> +#include <stddef.h> +#include <limits.h> +#include "config.h" +#include "lang.h" +#include "action.h" +#include "settings.h" +#include "menu.h" +#include "tree.h" +#include "list.h" +#ifdef HAVE_LCD_BITMAP +#include "peakmeter.h" +#endif +#include "talk.h" +#include "color_picker.h" +#include "lcd.h" +#include "lcd-remote.h" + +#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) +#include "backdrop.h" +#endif +#include "exported_menus.h" + + +#if LCD_DEPTH > 1 +/** +* Menu to clear the backdrop image + */ +static int clear_main_backdrop(void) +{ + global_settings.backdrop_file[0]=0; + unload_main_backdrop(); + show_main_backdrop(); + settings_save(); + return 0; +} +MENUITEM_FUNCTION(clear_main_bd, 0, ID2P(LANG_CLEAR_BACKDROP), + clear_main_backdrop, NULL, NULL, Icon_NOICON); +#endif +#ifdef HAVE_LCD_COLOR +/** + * Menu for fore/back colors + */ +static int set_fg_color(void) +{ + int res; + res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_FOREGROUND_COLOR), + &global_settings.fg_color,global_settings.bg_color); + + screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); + settings_save(); + return res; +} + +static int set_bg_color(void) +{ + int res; + res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_BACKGROUND_COLOR), + &global_settings.bg_color,global_settings.fg_color); + + screens[SCREEN_MAIN].set_background(global_settings.bg_color); + settings_save(); + return res; +} + +/* Line selector colour */ +static int set_lss_color(void) +{ + int res; + res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_START_COLOR), + &global_settings.lss_color,-1); + + screens[SCREEN_MAIN].set_selector_start(global_settings.lss_color); + settings_save(); + return res; +} + +static int set_lse_color(void) +{ + int res; + res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_END_COLOR), + &global_settings.lse_color,-1); + + screens[SCREEN_MAIN].set_selector_end(global_settings.lse_color); + settings_save(); + return res; +} + +/* Line selector text colour */ +static int set_lst_color(void) +{ + int res; + res = (int)set_color(&screens[SCREEN_MAIN],str(LANG_SELECTOR_TEXT_COLOR), + &global_settings.lst_color,global_settings.lss_color); + + screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color); + settings_save(); + return res; +} + +static int reset_color(void) +{ + global_settings.fg_color = LCD_DEFAULT_FG; + global_settings.bg_color = LCD_DEFAULT_BG; + global_settings.lss_color = LCD_DEFAULT_LS; + global_settings.lse_color = LCD_DEFAULT_BG; + global_settings.lst_color = LCD_DEFAULT_FG; + + screens[SCREEN_MAIN].set_foreground(global_settings.fg_color); + screens[SCREEN_MAIN].set_background(global_settings.bg_color); + screens[SCREEN_MAIN].set_selector_start(global_settings.lss_color); + screens[SCREEN_MAIN].set_selector_end(global_settings.lse_color); + screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color); + settings_save(); + return 0; +} +MENUITEM_FUNCTION(set_bg_col, 0, ID2P(LANG_BACKGROUND_COLOR), + set_bg_color, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(set_fg_col, 0, ID2P(LANG_FOREGROUND_COLOR), + set_fg_color, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(set_lss_col, 0, ID2P(LANG_SELECTOR_START_COLOR), + set_lss_color, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(set_lse_col, 0, ID2P(LANG_SELECTOR_END_COLOR), + set_lse_color, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(set_lst_col, 0, ID2P(LANG_SELECTOR_TEXT_COLOR), + set_lst_color, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(reset_colors, 0, ID2P(LANG_RESET_COLORS), + reset_color, NULL, NULL, Icon_NOICON); + +MAKE_MENU(lss_settings, ID2P(LANG_SELECTOR_COLOR_MENU), + NULL, Icon_NOICON, + &set_lss_col, &set_lse_col, &set_lst_col + ); + +/* now the actual menu */ +MAKE_MENU(colors_settings, ID2P(LANG_COLORS_MENU), + NULL, Icon_Display_menu, + &lss_settings, + &set_bg_col, &set_fg_col, &reset_colors + ); + +#endif /* HAVE_LCD_COLOR */ +/* LCD MENU */ +/***********************************/ + +#ifdef HAVE_LCD_BITMAP +static struct browse_folder_info fonts = {FONT_DIR, SHOW_FONT}; +#endif +static struct browse_folder_info wps = {WPS_DIR, SHOW_WPS}; +#ifdef HAVE_REMOTE_LCD +static struct browse_folder_info rwps = {WPS_DIR, SHOW_RWPS}; +#endif +static struct browse_folder_info themes = {THEME_DIR, SHOW_CFG}; + +int browse_folder(void *param) +{ + const struct browse_folder_info *info = + (const struct browse_folder_info*)param; + return rockbox_browse(info->dir, info->show_options); +} + +#ifdef HAVE_LCD_BITMAP +MENUITEM_FUNCTION(browse_fonts, MENU_FUNC_USEPARAM, + ID2P(LANG_CUSTOM_FONT), + browse_folder, (void*)&fonts, NULL, Icon_Font); +#endif +MENUITEM_FUNCTION(browse_wps, MENU_FUNC_USEPARAM, + ID2P(LANG_WHILE_PLAYING), + browse_folder, (void*)&wps, NULL, Icon_Wps); +#ifdef HAVE_REMOTE_LCD +MENUITEM_FUNCTION(browse_rwps, MENU_FUNC_USEPARAM, + ID2P(LANG_REMOTE_WHILE_PLAYING), + browse_folder, (void*)&rwps, NULL, Icon_Wps); +#endif + +MENUITEM_SETTING(show_icons, &global_settings.show_icons, NULL); +MENUITEM_FUNCTION(browse_themes, MENU_FUNC_USEPARAM, + ID2P(LANG_CUSTOM_THEME), + browse_folder, (void*)&themes, NULL, Icon_Config); +#ifdef HAVE_LCD_BITMAP +MENUITEM_SETTING(cursor_style, &global_settings.cursor_style, NULL); +#endif + +MAKE_MENU(theme_menu, ID2P(LANG_THEME_MENU), + NULL, Icon_Wps, + &browse_themes, +#ifdef HAVE_LCD_BITMAP + &browse_fonts, +#endif + &browse_wps, +#ifdef HAVE_REMOTE_LCD + &browse_rwps, +#endif + &show_icons, +#if LCD_DEPTH > 1 + &clear_main_bd, +#endif +#ifdef HAVE_LCD_BITMAP + &cursor_style, +#endif +#ifdef HAVE_LCD_COLOR + &colors_settings, +#endif + ); |