1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
32 #ifdef HAVE_LCD_BITMAP
33 #include "peakmeter.h"
35 #include "color_picker.h"
37 #include "lcd-remote.h"
39 #include "exported_menus.h"
40 #include "appevents.h"
45 * Menu to clear the backdrop image
47 static int clear_main_backdrop(void)
49 global_settings
.backdrop_file
[0]=0;
50 backdrop_unload(BACKDROP_MAIN
);
51 backdrop_show(BACKDROP_MAIN
);
55 MENUITEM_FUNCTION(clear_main_bd
, 0, ID2P(LANG_CLEAR_BACKDROP
),
56 clear_main_backdrop
, NULL
, NULL
, Icon_NOICON
);
68 static struct colour_info
72 } colors
[COLOR_COUNT
] = {
73 [COLOR_FG
] = {&global_settings
.fg_color
, LANG_FOREGROUND_COLOR
},
74 [COLOR_BG
] = {&global_settings
.bg_color
, LANG_BACKGROUND_COLOR
},
75 [COLOR_LSS
] = {&global_settings
.lss_color
, LANG_SELECTOR_START_COLOR
},
76 [COLOR_LSE
] = {&global_settings
.lse_color
, LANG_SELECTOR_END_COLOR
},
77 [COLOR_LST
] = {&global_settings
.lst_color
, LANG_SELECTOR_TEXT_COLOR
},
81 * Menu for fore/back/selection colors
83 static int set_color_func(void* color
)
85 int res
, c
= (intptr_t)color
, banned_color
=-1;
87 /* Don't let foreground be set the same as background and vice-versa */
89 banned_color
= *colors
[COLOR_FG
].setting
;
90 else if (c
== COLOR_FG
)
91 banned_color
= *colors
[COLOR_BG
].setting
;
93 res
= (int)set_color(&screens
[SCREEN_MAIN
],str(colors
[c
].lang_id
),
94 colors
[c
].setting
, banned_color
);
96 settings_apply(false);
97 send_event(GUI_EVENT_ACTIONUPDATE
, (void*)true);
101 static int reset_color(void)
103 global_settings
.fg_color
= LCD_DEFAULT_FG
;
104 global_settings
.bg_color
= LCD_DEFAULT_BG
;
105 global_settings
.lss_color
= LCD_DEFAULT_LS
;
106 global_settings
.lse_color
= LCD_DEFAULT_BG
;
107 global_settings
.lst_color
= LCD_DEFAULT_FG
;
110 settings_apply(false);
111 send_event(GUI_EVENT_ACTIONUPDATE
, (void*)true);
114 MENUITEM_FUNCTION(set_bg_col
, MENU_FUNC_USEPARAM
, ID2P(LANG_BACKGROUND_COLOR
),
115 set_color_func
, (void*)COLOR_BG
, NULL
, Icon_NOICON
);
116 MENUITEM_FUNCTION(set_fg_col
, MENU_FUNC_USEPARAM
, ID2P(LANG_FOREGROUND_COLOR
),
117 set_color_func
, (void*)COLOR_FG
, NULL
, Icon_NOICON
);
118 MENUITEM_FUNCTION(set_lss_col
, MENU_FUNC_USEPARAM
, ID2P(LANG_SELECTOR_START_COLOR
),
119 set_color_func
, (void*)COLOR_LSS
, NULL
, Icon_NOICON
);
120 MENUITEM_FUNCTION(set_lse_col
, MENU_FUNC_USEPARAM
, ID2P(LANG_SELECTOR_END_COLOR
),
121 set_color_func
, (void*)COLOR_LSE
, NULL
, Icon_NOICON
);
122 MENUITEM_FUNCTION(set_lst_col
, MENU_FUNC_USEPARAM
, ID2P(LANG_SELECTOR_TEXT_COLOR
),
123 set_color_func
, (void*)COLOR_LST
, NULL
, Icon_NOICON
);
124 MENUITEM_FUNCTION(reset_colors
, 0, ID2P(LANG_RESET_COLORS
),
125 reset_color
, NULL
, NULL
, Icon_NOICON
);
127 MAKE_MENU(lss_settings
, ID2P(LANG_SELECTOR_COLOR_MENU
),
129 &set_lss_col
, &set_lse_col
, &set_lst_col
132 /* now the actual menu */
133 MAKE_MENU(colors_settings
, ID2P(LANG_COLORS_MENU
),
134 NULL
, Icon_Display_menu
,
136 &set_bg_col
, &set_fg_col
, &reset_colors
139 #endif /* HAVE_LCD_COLOR */
141 /***********************************/
144 /************************************/
149 #ifdef HAVE_LCD_BITMAP
150 static int statusbar_callback_ex(int action
,const struct menu_item_ex
*this_item
,
151 enum screen_type screen
)
154 /* we save the old statusbar value here, so the old statusbars can get
155 * removed and cleared from the display properly on exiting
156 * (in gui_statusbar_changed() ) */
157 static enum statusbar_values old_bar
[NB_SCREENS
];
160 case ACTION_ENTER_MENUITEM
:
161 old_bar
[screen
] = statusbar_position(screen
);
163 case ACTION_EXIT_MENUITEM
:
164 send_event(GUI_EVENT_STATUSBAR_TOGGLE
, NULL
);
165 send_event(GUI_EVENT_ACTIONUPDATE
, (void*)true);
168 return ACTION_REDRAW
;
171 #ifdef HAVE_REMOTE_LCD
172 static int statusbar_callback_remote(int action
,const struct menu_item_ex
*this_item
)
174 return statusbar_callback_ex(action
, this_item
, SCREEN_REMOTE
);
177 static int statusbar_callback(int action
,const struct menu_item_ex
*this_item
)
179 return statusbar_callback_ex(action
, this_item
, SCREEN_MAIN
);
182 #ifdef HAVE_BUTTONBAR
183 static int buttonbar_callback(int action
, const struct menu_item_ex
*this_item
)
188 case ACTION_EXIT_MENUITEM
:
189 viewportmanager_theme_changed(THEME_BUTTONBAR
);
192 return ACTION_REDRAW
;
195 MENUITEM_SETTING(scrollbar_item
, &global_settings
.scrollbar
, NULL
);
196 MENUITEM_SETTING(scrollbar_width
, &global_settings
.scrollbar_width
, NULL
);
197 MENUITEM_SETTING(statusbar
, &global_settings
.statusbar
,
199 #ifdef HAVE_REMOTE_LCD
200 MENUITEM_SETTING(remote_statusbar
, &global_settings
.remote_statusbar
,
201 statusbar_callback_remote
);
203 #ifdef HAVE_BUTTONBAR
204 MENUITEM_SETTING(buttonbar
, &global_settings
.buttonbar
, buttonbar_callback
);
206 MENUITEM_SETTING(volume_type
, &global_settings
.volume_type
, NULL
);
207 MENUITEM_SETTING(battery_display
, &global_settings
.battery_display
, NULL
);
208 MAKE_MENU(bars_menu
, ID2P(LANG_BARS_MENU
), 0, Icon_NOICON
,
209 &scrollbar_item
, &scrollbar_width
, &statusbar
,
210 #ifdef HAVE_REMOTE_LCD
213 #if CONFIG_KEYPAD == RECORDER_PAD
216 &volume_type
, &battery_display
);
217 #endif /* HAVE_LCD_BITMAP */
221 /************************************/
223 #ifdef HAVE_LCD_BITMAP
224 static struct browse_folder_info fonts
= {FONT_DIR
, SHOW_FONT
};
225 static struct browse_folder_info sbs
= {SBS_DIR
, SHOW_SBS
};
227 static struct browse_folder_info wps
= {WPS_DIR
, SHOW_WPS
};
228 #ifdef HAVE_REMOTE_LCD
229 static struct browse_folder_info rwps
= {WPS_DIR
, SHOW_RWPS
};
230 static struct browse_folder_info rsbs
= {SBS_DIR
, SHOW_RSBS
};
232 static struct browse_folder_info themes
= {THEME_DIR
, SHOW_CFG
};
234 int browse_folder(void *param
)
236 const struct browse_folder_info
*info
=
237 (const struct browse_folder_info
*)param
;
238 return rockbox_browse(info
->dir
, info
->show_options
);
241 #ifdef HAVE_LCD_BITMAP
242 MENUITEM_FUNCTION(browse_fonts
, MENU_FUNC_USEPARAM
,
243 ID2P(LANG_CUSTOM_FONT
),
244 browse_folder
, (void*)&fonts
, NULL
, Icon_Font
);
246 MENUITEM_FUNCTION(browse_sbs
, MENU_FUNC_USEPARAM
,
247 ID2P(LANG_CUSTOM_STATUSBAR
),
248 browse_folder
, (void*)&sbs
, NULL
, Icon_Wps
);
250 MENUITEM_FUNCTION(browse_wps
, MENU_FUNC_USEPARAM
,
251 ID2P(LANG_WHILE_PLAYING
),
252 browse_folder
, (void*)&wps
, NULL
, Icon_Wps
);
253 #ifdef HAVE_REMOTE_LCD
254 MENUITEM_FUNCTION(browse_rwps
, MENU_FUNC_USEPARAM
,
255 ID2P(LANG_REMOTE_WHILE_PLAYING
),
256 browse_folder
, (void*)&rwps
, NULL
, Icon_Wps
);
257 MENUITEM_FUNCTION(browse_rsbs
, MENU_FUNC_USEPARAM
,
258 ID2P(LANG_REMOTE_CUSTOM_STATUSBAR
),
259 browse_folder
, (void*)&rsbs
, NULL
, Icon_Wps
);
262 MENUITEM_SETTING(show_icons
, &global_settings
.show_icons
, NULL
);
263 MENUITEM_FUNCTION(browse_themes
, MENU_FUNC_USEPARAM
,
264 ID2P(LANG_CUSTOM_THEME
),
265 browse_folder
, (void*)&themes
, NULL
, Icon_Config
);
266 #ifdef HAVE_LCD_BITMAP
267 MENUITEM_SETTING(cursor_style
, &global_settings
.cursor_style
, NULL
);
270 MAKE_MENU(theme_menu
, ID2P(LANG_THEME_MENU
),
273 #ifdef HAVE_LCD_BITMAP
277 #ifdef HAVE_REMOTE_LCD
280 #ifdef HAVE_LCD_BITMAP
283 #ifdef HAVE_REMOTE_LCD
290 #ifdef HAVE_LCD_BITMAP
294 #ifdef HAVE_LCD_COLOR