User definable UI viewport, to be able to restrict the UI into a viewport for all bitmap displays.

Flyspray: FS#8799

This will allow for pretty themes, for example those with nice glass effects on their backdrops (some might argue they're wasting screen space but it's upto them),
as well as allowing for future background WPS updates in the main UI.

Plugins are not converted yet, they simply use the full screen. Ideally, any plugin that does *not* want the UI viewport, should take care of that itself (i.e. plugins should normally use the UI viewport).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22365 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-08-16 22:20:11 +00:00
parent c0897a8002
commit 4c48b59be8
22 changed files with 355 additions and 104 deletions

View file

@ -48,9 +48,9 @@ enum {
/** Generic GUI class events **/
enum {
GUI_EVENT_THEME_CHANGED = (EVENT_CLASS_GUI|1),
GUI_EVENT_STATUSBAR_TOGGLE,
GUI_EVENT_STATUSBAR_TOGGLE = (EVENT_CLASS_GUI|1),
GUI_EVENT_ACTIONUPDATE,
GUI_EVENT_REFRESH,
};
#endif

View file

@ -100,6 +100,7 @@
#if CONFIG_RTC == RTC_PCF50605
#include "pcf50605.h"
#endif
#include "appevents.h"
#if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 \
|| CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525 || CONFIG_CPU == JZ4732
@ -2790,6 +2791,7 @@ static int menu_action_callback(int btn, struct gui_synclist *lists)
int oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
menuitems[gui_synclist_get_sel_pos(lists)].function();
btn = ACTION_REDRAW;
send_event(GUI_EVENT_REFRESH, NULL);
viewportmanager_set_statusbar(oldbars);
}
return btn;

View file

@ -181,6 +181,11 @@ static void check_file_thumbnails(struct tree_context* c)
closedir(dir);
}
static void filetree_drawlists(void)
{
gui_synclist_draw(&tree_lists);
}
/* support function for qsort() */
static int compare(const void* p1, const void* p2)
{
@ -508,7 +513,13 @@ int ft_enter(struct tree_context* c)
splash(0, ID2P(LANG_WAIT));
if (!settings_load_config(buf,true))
break;
gui_synclist_draw(&tree_lists);
/* do both steps seperately so that the redrawing after theme
* changing is independant of whether the theme has a custom ui
* vp or not */
send_event(GUI_EVENT_REFRESH, NULL);
/* for the statusbar */
send_event(GUI_EVENT_ACTIONUPDATE, (void*)true);
filetree_drawlists();
splash(HZ, ID2P(LANG_SETTINGS_LOADED));
break;
@ -618,6 +629,8 @@ int ft_enter(struct tree_context* c)
}
}
send_event(GUI_EVENT_REFRESH, filetree_drawlists);
if ( play ) {
/* the resume_index must always be the index in the
shuffled list in case shuffle is enabled */

View file

@ -55,29 +55,37 @@ static int offset_step = 16; /* pixels per screen scroll step */
/* should lines scroll out of the screen */
static bool offset_out_of_view = false;
#endif
static int force_list_reinit = false;
static void gui_list_select_at_offset(struct gui_synclist * gui_list,
int offset);
void list_draw(struct screen *display, struct gui_synclist *list);
#ifdef HAVE_LCD_BITMAP
static struct viewport parent[NB_SCREENS];
void list_init_viewports(struct gui_synclist *list)
static void list_init_viewports(struct gui_synclist *list)
{
struct viewport* vp;
int i;
struct viewport *vp;
FOR_NB_SCREENS(i)
bool parent_used = (*list->parent != NULL);
if (!parent_used)
{
vp = &parent[i];
if (!list || list->parent[i] == vp)
viewport_set_defaults(vp, i);
vp = viewport_get_current_vp();
FOR_NB_SCREENS(i)
list->parent[i] = &vp[i];
}
#ifdef HAVE_BUTTONBAR
if (list && (list->parent[0] == &parent[0]) && global_settings.buttonbar)
if (list && !parent_used[SCREEN_MAIN] && global_settings.buttonbar)
list->parent[0]->height -= BUTTONBAR_HEIGHT;
#endif
force_list_reinit = false;
}
#else
#define list_init_viewports(a)
#endif
#ifdef HAVE_LCD_BITMAP
bool list_display_title(struct gui_synclist *list, enum screen_type screen)
{
return list->title != NULL &&
viewport_get_nb_lines(list->parent[screen])>2;
}
#else
static struct viewport parent[NB_SCREENS] =
@ -90,20 +98,6 @@ static struct viewport parent[NB_SCREENS] =
.height = LCD_HEIGHT
},
};
void list_init_viewports(struct gui_synclist *list)
{
(void)list;
force_list_reinit = false;
}
#endif
#ifdef HAVE_LCD_BITMAP
bool list_display_title(struct gui_synclist *list, enum screen_type screen)
{
return list->title != NULL &&
viewport_get_nb_lines(list->parent[screen])>2;
}
#else
#define list_display_title(l, i) false
#endif
@ -141,9 +135,12 @@ void gui_synclist_init(struct gui_synclist * gui_list,
if (list_parent)
gui_list->parent[i] = &list_parent[i];
else
{
gui_list->parent[i] = &parent[i];
}
gui_list->parent[i] =
#ifdef HAVE_LCD_BITMAP
NULL;
#else
&parent[i];
#endif
}
list_init_viewports(gui_list);
gui_list->limit_scroll = false;
@ -162,7 +159,6 @@ void gui_synclist_init(struct gui_synclist * gui_list,
gui_list->title_color = -1;
gui_list->callback_get_item_color = NULL;
#endif
force_list_reinit = true;
}
/* this toggles the selection bar or cursor */
@ -218,7 +214,7 @@ void gui_synclist_draw(struct gui_synclist *gui_list)
#ifdef HAVE_BUTTONBAR
static bool last_buttonbar = false;
#endif
if (force_list_reinit ||
if (
#ifdef HAVE_BUTTONBAR
last_buttonbar != screens[SCREEN_MAIN].has_buttonbar ||
#endif
@ -436,7 +432,6 @@ void gui_synclist_set_title(struct gui_synclist * gui_list,
} else {
gui_list->title_width = 0;
}
force_list_reinit = true;
}

View file

@ -139,8 +139,6 @@ extern void gui_list_screen_scroll_step(int ofs);
extern void gui_list_screen_scroll_out_of_view(bool enable);
#endif /* HAVE_LCD_BITMAP */
void list_init_viewports(struct gui_synclist * lists);
extern void gui_synclist_init(
struct gui_synclist * lists,
list_get_name callback_get_item_name,

View file

@ -263,7 +263,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info)))
{
struct viewport vp;
viewport_set_defaults(&vp, display->screen_type);
viewport_set_fullscreen(&vp, display->screen_type);
vp.height = STATUSBAR_HEIGHT;
vp.x = STATUSBAR_X_POS;
if (statusbar_position(display->screen_type) != STATUSBAR_BOTTOM)

View file

@ -56,6 +56,22 @@
static int statusbar_enabled = 0;
#ifdef HAVE_LCD_BITMAP
static struct {
struct viewport* vp;
int active;
} ui_vp_info;
static struct viewport custom_vp[NB_SCREENS];
/* callbacks for GUI_EVENT_* events */
static void viewportmanager_ui_vp_changed(void *param);
static void statusbar_toggled(void* param);
static int viewport_init_ui_vp(void);
#endif
static void viewportmanager_redraw(void* data);
int viewport_get_nb_lines(struct viewport *vp)
{
#ifdef HAVE_LCD_BITMAP
@ -80,7 +96,7 @@ static bool showing_bars(enum screen_type screen)
return false;
}
void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen)
{
vp->x = 0;
vp->width = screens[screen].lcdwidth;
@ -120,6 +136,30 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
#endif
}
void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
{
#ifdef HAVE_LCD_BITMAP
if (ui_vp_info.active)
*vp = custom_vp[screen];
else
#endif
viewport_set_fullscreen(vp, screen);
}
void viewportmanager_init(void)
{
viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
#ifdef HAVE_LCD_BITMAP
add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggled);
ui_vp_info.active = viewport_init_ui_vp();
ui_vp_info.vp = custom_vp;
#endif
}
int viewportmanager_get_statusbar(void)
{
return statusbar_enabled;
}
int viewportmanager_set_statusbar(int enabled)
{
@ -133,29 +173,49 @@ int viewportmanager_set_statusbar(int enabled)
if (showing_bars(i))
gui_statusbar_draw(&statusbars.statusbars[i], true);
}
add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_draw_statusbars);
add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw);
}
else
{
remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_draw_statusbars);
remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw);
}
return old;
}
void viewportmanager_draw_statusbars(void* data)
static void viewportmanager_redraw(void* data)
{
int i;
FOR_NB_SCREENS(i)
{
if (showing_bars(i))
gui_statusbar_draw(&statusbars.statusbars[i], (bool)data);
gui_statusbar_draw(&statusbars.statusbars[i], NULL != data);
}
}
#ifdef HAVE_LCD_BITMAP
void viewportmanager_statusbar_changed(void* data)
static void statusbar_toggled(void* param)
{
(void)data;
(void)param;
/* update vp manager for the new setting and reposition vps
* if necessary */
viewportmanager_theme_changed(THEME_STATUSBAR);
}
void viewportmanager_theme_changed(int which)
{
if (which & THEME_UI_VIEWPORT)
{
/* reset the ui viewport */
if ((ui_vp_info.active = viewport_init_ui_vp()))
add_event(GUI_EVENT_REFRESH, false, viewportmanager_ui_vp_changed);
else
remove_event(GUI_EVENT_REFRESH, viewportmanager_ui_vp_changed);
/* and point to it */
ui_vp_info.vp = custom_vp;
}
if (which & THEME_STATUSBAR)
{
statusbar_enabled = 0;
if (global_settings.statusbar != STATUSBAR_OFF)
statusbar_enabled = VP_SB_ONSCREEN(SCREEN_MAIN);
@ -163,7 +223,51 @@ void viewportmanager_statusbar_changed(void* data)
if (global_settings.remote_statusbar != STATUSBAR_OFF)
statusbar_enabled |= VP_SB_ONSCREEN(SCREEN_REMOTE);
#endif
if (statusbar_enabled)
add_event(GUI_EVENT_ACTIONUPDATE, false, viewportmanager_redraw);
else
remove_event(GUI_EVENT_ACTIONUPDATE, viewportmanager_redraw);
/* reposition viewport to fit statusbar, only if not using the ui vp */
if (!ui_vp_info.active)
{
int i;
FOR_NB_SCREENS(i)
viewport_set_fullscreen(&custom_vp[i], i);
}
}
}
static void viewportmanager_ui_vp_changed(void *param)
{
/* if the user changed the theme, we need to initiate a full redraw */
int i;
/* cast param to a function */
void (*draw_func)(void) = ((void(*)(void))param);
/* start with clearing the screen */
FOR_NB_SCREENS(i)
screens[i].clear_display();
/* redraw the statusbar if it was enabled */
viewportmanager_set_statusbar(statusbar_enabled);
/* call the passed function which will redraw the content of
* the current screen */
if (param != NULL)
draw_func();
FOR_NB_SCREENS(i)
screens[i].update();
}
void viewport_set_current_vp(struct viewport* vp)
{
if (vp != NULL)
ui_vp_info.vp = vp;
else
ui_vp_info.vp = custom_vp;
}
struct viewport* viewport_get_current_vp(void)
{
return ui_vp_info.vp;
}
#ifdef HAVE_LCD_COLOR
@ -172,7 +276,6 @@ void viewportmanager_statusbar_changed(void* data)
#define ARG_STRING(_depth) "dddddgg"
#endif
#ifdef HAVE_LCD_BITMAP
const char* viewport_parse_viewport(struct viewport *vp,
enum screen_type screen,
const char *bufptr,
@ -213,9 +316,9 @@ const char* viewport_parse_viewport(struct viewport *vp,
return NULL;
}
else
#undef ARG_STRING
#endif
{}
#undef ARG_STRING
/* X and Y *must* be set */
if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y))
@ -259,4 +362,40 @@ const char* viewport_parse_viewport(struct viewport *vp,
return ptr;
}
/*
* (re)parse the UI vp from the settings
* - Returns
* 0 if no UI vp is used
* >0 if it's used at least partly (on multiscreen targets)
* NB_SCREENS if all screens have a UI vp
*/
static int viewport_init_ui_vp(void)
{
int screen, ret = NB_SCREENS;
FOR_NB_SCREENS(screen)
{
#ifdef HAVE_REMOTE_LCD
if ((screen == SCREEN_REMOTE))
{
if(!(viewport_parse_viewport(&custom_vp[screen], screen,
global_settings.remote_ui_vp_config, ',')))
{
viewport_set_fullscreen(&custom_vp[screen], screen);
ret--;
}
}
else
#endif
{
if (!(viewport_parse_viewport(&custom_vp[screen], screen,
global_settings.ui_vp_config, ',')))
{
viewport_set_fullscreen(&custom_vp[screen], screen);
ret--;
}
}
}
return ret;
}
#endif /* HAVE_LCD_BITMAP */

View file

@ -34,26 +34,6 @@ int viewport_get_nb_lines(struct viewport *vp);
void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
/* Parse a viewport definition (vp_def), which looks like:
*
* Screens with depth > 1:
* X|Y|width|height|font|foregorund color|background color
* Screens with depth = 1:
* X|Y|width|height|font
*
* | is a separator and can be specified via the parameter
*
* Returns the pointer to the char after the last character parsed
* if everything went OK or NULL if an error happened (some values
* not specified in the definition)
*/
#ifdef HAVE_LCD_BITMAP
const char* viewport_parse_viewport(struct viewport *vp,
enum screen_type screen,
const char *vp_def,
const char separator);
#endif
/* Used to specify which screens the statusbar (SB) should be displayed on.
*
* The parameter is a bit OR'ed combination of the following (screen is
@ -74,14 +54,70 @@ const char* viewport_parse_viewport(struct viewport *vp,
* Returns the status before the call. This value can be used to restore the
* SB "displaying rules".
*/
#define THEME_STATUSBAR (BIT_N(0))
#define THEME_UI_VIEWPORT (BIT_N(1))
#define THEME_ALL (~(0u))
#define VP_SB_HIDE_ALL 0
#define VP_SB_ONSCREEN(screen) BIT_N(screen)
#define VP_SB_IGNORE_SETTING(screen) BIT_N(4+screen)
#define VP_SB_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1))
/*
* Initialize the viewportmanager, which in turns initializes the UI vp and
* statusbar stuff
*/
void viewportmanager_init(void);
int viewportmanager_get_statusbar(void);
int viewportmanager_set_statusbar(int enabled);
/* callbacks for GUI_EVENT_* events */
void viewportmanager_draw_statusbars(void*data);
void viewportmanager_statusbar_changed(void* data);
/* call this when a theme changed */
void viewportmanager_theme_changed(int);
/*
* Initializes the given viewport with maximum dimensions minus status- and
* buttonbar
*/
void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen);
#ifdef HAVE_LCD_BITMAP
/*
* Parse a viewport definition (vp_def), which looks like:
*
* Screens with depth > 1:
* X|Y|width|height|font|foregorund color|background color
* Screens with depth = 1:
* X|Y|width|height|font
*
* | is a separator and can be specified via the parameter
*
* Returns the pointer to the char after the last character parsed
* if everything went OK or NULL if an error happened (some values
* not specified in the definition)
*/
const char* viewport_parse_viewport(struct viewport *vp,
enum screen_type screen,
const char *vp_def,
const char separator);
/*
* Returns a pointer to the current viewport
* - That could be the UI vp, or a viewport passed to do_menu() or the like
*/
struct viewport* viewport_get_current_vp(void);
/*
* Set the UI vp pointer to a different one - NULL to reset to the UI vp
*
* This is needed since the UI viewport needs is kept in RAM.
*/
void viewport_set_current_vp(struct viewport* vp);
#else /* HAVE_LCD_CHARCELL */
#define viewport_set_current_vp(a)
#define viewport_get_current_vp() NULL
#endif
#endif /* __VIEWPORT_H__ */

View file

@ -565,6 +565,7 @@ static void gwps_leave_wps(void)
/* Play safe and unregister the hook */
lcd_activation_set_hook(NULL);
#endif
send_event(GUI_EVENT_REFRESH, NULL);
}
void gwps_draw_statusbars(void)

View file

@ -72,6 +72,7 @@
#include "eeprom_settings.h"
#include "scrobbler.h"
#include "icon.h"
#include "viewport.h"
#ifdef IPOD_ACCESSORY_PROTOCOL
#include "iap.h"
@ -135,9 +136,8 @@ static void app_main(void)
screens[i].update();
}
tree_gui_init();
viewportmanager_set_statusbar(VP_SB_ALLSCREENS);
add_event(GUI_EVENT_STATUSBAR_TOGGLE, false,
viewportmanager_statusbar_changed);
gui_syncstatusbar_init(&statusbars);
viewportmanager_init();
#ifdef HAVE_USBSTACK
/* All threads should be created and public queues registered by now */
usb_start_monitoring();
@ -296,8 +296,6 @@ static void init(void)
#ifdef DEBUG
debug_init();
#endif
/* Must be done before any code uses the multi-screen APi */
gui_syncstatusbar_init(&statusbars);
storage_init();
settings_reset();
settings_load(SETTINGS_ALL);
@ -419,9 +417,6 @@ static void init(void)
radio_init();
#endif
/* Must be done before any code uses the multi-screen APi */
gui_syncstatusbar_init(&statusbars);
#if CONFIG_CHARGING && (CONFIG_CPU == SH7034)
/* charger_inserted() can't be used here because power_thread()
hasn't checked power_input_status() yet */

View file

@ -342,8 +342,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
const struct menu_item_ex *temp, *menu;
int ret = 0, i;
bool redraw_lists;
int oldbars = viewportmanager_set_statusbar(
hide_bars ? VP_SB_HIDE_ALL : VP_SB_ALLSCREENS);
int oldbars = viewportmanager_get_statusbar();
viewportmanager_set_statusbar(hide_bars ? VP_SB_HIDE_ALL : oldbars);
const struct menu_item_ex *menu_stack[MAX_MENUS];
int menu_stack_selected_item[MAX_MENUS];

View file

@ -39,6 +39,7 @@
#ifdef HAVE_TOUCHSCREEN
#include "screens.h"
#endif
#include "viewport.h"
#ifdef HAVE_BACKLIGHT
static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item)
@ -313,8 +314,7 @@ static int statusbar_callback(int action,const struct menu_item_ex *this_item)
{
case ACTION_EXIT_MENUITEM:
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);
/* this should be changed so only the viewports are reloaded */
settings_apply(false);
send_event(GUI_EVENT_ACTIONUPDATE, (void*)true);
break;
}
return action;

View file

@ -37,6 +37,7 @@
#include "lcd-remote.h"
#include "backdrop.h"
#include "exported_menus.h"
#include "appevents.h"
#if LCD_DEPTH > 1
/**
@ -47,6 +48,7 @@ static int clear_main_backdrop(void)
global_settings.backdrop_file[0]=0;
backdrop_unload(BACKDROP_MAIN);
backdrop_show(BACKDROP_MAIN);
send_event(GUI_EVENT_REFRESH, NULL);
settings_save();
return 0;
}

View file

@ -673,10 +673,10 @@ static const struct plugin_api rockbox_api = {
int plugin_load(const char* plugin, const void* parameter)
{
int rc;
int i;
int rc, i;
int oldbars;
struct plugin_header *hdr;
struct viewport plugin_vp[NB_SCREENS];
#ifdef SIMULATOR
void *pd;
#else /* !SIMULATOR */
@ -781,9 +781,15 @@ int plugin_load(const char* plugin, const void* parameter)
lcd_remote_update();
#endif
cpucache_invalidate();
oldbars = viewportmanager_set_statusbar(VP_SB_HIDE_ALL);
FOR_NB_SCREENS(i)
viewport_set_fullscreen(&plugin_vp[i], i);
viewport_set_current_vp(plugin_vp);
cpucache_invalidate();
#ifdef HAVE_TOUCHSCREEN
touchscreen_set_mode(TOUCHSCREEN_BUTTON);
#endif
@ -826,14 +832,11 @@ int plugin_load(const char* plugin, const void* parameter)
if (rc != PLUGIN_GOTO_WPS)
{
FOR_NB_SCREENS(i)
{
screens[i].clear_display();
screens[i].update();
}
send_event(GUI_EVENT_REFRESH, NULL);
}
viewportmanager_set_statusbar(oldbars);
viewport_set_current_vp(NULL);
if (pfn_tsr_exit == NULL)
plugin_loaded = false;

View file

@ -39,6 +39,7 @@
#include "viewport.h"
#include "file.h"
#include "splash.h"
#include "appevents.h"
#ifndef O_BINARY
#define O_BINARY 0
@ -1243,11 +1244,13 @@ int kbd_input(char* text, int buflen)
global_settings.buttonbar = buttonbar_config;
#endif
if (ret < 0)
splash(HZ/2, ID2P(LANG_CANCEL));
FOR_NB_SCREENS(l)
screens[l].setfont(FONT_UI);
viewportmanager_set_statusbar(oldbars);
send_event(GUI_EVENT_REFRESH, NULL);
if (ret < 0)
splash(HZ/2, ID2P(LANG_CANCEL));
return ret;
}

View file

@ -76,6 +76,7 @@
#include "viewport.h"
#include "list.h"
#include "general.h"
#include "appevents.h"
#ifdef HAVE_RECORDING
/* This array holds the record timer interval lengths, in seconds */
@ -1924,10 +1925,12 @@ rec_abort:
rec_status &= ~RCSTAT_IN_RECSCREEN;
sound_settings_apply();
viewportmanager_set_statusbar(oldbars);
FOR_NB_SCREENS(i)
screens[i].setfont(FONT_UI);
viewportmanager_set_statusbar(oldbars);
send_event(GUI_EVENT_REFRESH, NULL);
/* if the directory was created or recording happened, make sure the
browser is updated */
if (rec_status & (RCSTAT_CREATED_DIRECTORY | RCSTAT_HAVE_RECORDED))

View file

@ -192,6 +192,7 @@ static int browser(void* param)
}
}
}
send_event(GUI_EVENT_REFRESH, NULL);
if (!tagcache_is_usable())
return GO_TO_PREVIOUS;
filter = SHOW_ID3DB;

View file

@ -65,12 +65,12 @@
#include "filetypes.h"
#include "option_select.h"
#include "backdrop.h"
#include "appevents.h"
#if CONFIG_TUNER
#include "radio.h"
#endif
#include "wps.h"
#include "skin_engine/skin_engine.h"
#include "viewport.h"
#if CONFIG_CODEC == MAS3507D
void dac_line_in(bool enable);
@ -761,6 +761,7 @@ void settings_apply_skins(void)
void settings_apply(bool read_disk)
{
char buf[64];
#if CONFIG_CODEC == SWCODEC
int i;
@ -985,9 +986,9 @@ void settings_apply(bool read_disk)
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
enc_global_settings_apply();
#endif
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);
list_init_viewports(NULL);
send_event(GUI_EVENT_ACTIONUPDATE, (void*)true);
#ifdef HAVE_LCD_BITMAP
viewportmanager_theme_changed(THEME_ALL);
#endif
}
@ -1109,7 +1110,8 @@ bool set_int_ex(const unsigned char* string,
item.lang_id = -1;
item.cfg_vals = (char*)string;
item.setting = (void *)variable;
return option_screen(&item, NULL, false, NULL);
return option_screen(&item,
viewport_get_current_vp(), false, NULL);
}

View file

@ -762,6 +762,13 @@ struct user_settings
/* If values are just added to the end, no need to bump plugin API
version. */
/* new stuff to be added at the end */
#ifdef HAVE_LCD_BITMAP
unsigned char ui_vp_config[64]; /* viewport string for the lists */
#ifdef HAVE_REMOTE_LCD
unsigned char remote_ui_vp_config[64]; /* viewport string for the remote lists */
#endif
#endif
};
/** global variables **/

View file

@ -180,6 +180,10 @@
{.custom = (void*)default}, name, NULL, \
{.custom_setting = (struct custom_setting[]){ \
{load_from_cfg, write_to_cfg, is_change, set_default}}}}
#define VIEWPORT_SETTING(var,name,default) \
TEXT_SETTING(0,var,name,default, NULL, NULL)
/* some sets of values which are used more than once, to save memory */
static const char off_on[] = "off,on";
static const char off_on_ask[] = "off,on,ask";
@ -1539,6 +1543,13 @@ const struct settings_list settings[] = {
#endif
#endif
/* Customizable list */
#ifdef HAVE_LCD_BITMAP
VIEWPORT_SETTING(ui_vp_config, "ui viewport", ""),
#ifdef HAVE_REMOTE_LCD
VIEWPORT_SETTING(remote_ui_vp_config, "remote ui viewport", ""),
#endif
#endif
};
const int nb_settings = sizeof(settings)/sizeof(*settings);

View file

@ -69,6 +69,8 @@ backdrop:
iconset:
viewers iconset:
selector type: bar (inverse)
ui viewport: -
remote ui viewport: -
</wps>
<wps>
@ -81,6 +83,8 @@ backdrop:
iconset:
viewers iconset:
selector type: bar (inverse)
ui viewport: -
remote ui viewport: -
</wps>
<wps>
@ -93,6 +97,8 @@ iconset:
viewers iconset:
selector type: bar (inverse)
Statusbar: top
ui viewport: -
remote ui viewport: -
</wps>
<wps>
@ -105,6 +111,8 @@ backdrop:
iconset:
viewers iconset:
selector type: bar (inverse)
ui viewport:
remote ui viewport:
</wps>
<rwps>
@ -152,6 +160,8 @@ backdrop:
iconset:
viewers iconset:
selector type: bar (inverse)
ui viewport: -
remote ui viewport: -
</wps>
<rwps>
@ -159,6 +169,8 @@ Name: marquee.rwps
Author: Mike Sobel
Font: 13-Nimbus.fnt
Statusbar: top
ui viewport: -
remote ui viewport: -
</rwps>
<wps>
@ -173,6 +185,8 @@ backdrop:
iconset:
viewers iconset:
selector type: bar (inverse)
ui viewport: -
remote ui viewport: -
</wps>
<rwps>
@ -206,6 +220,8 @@ backdrop:
iconset:
viewers iconset:
selector type: bar (inverse)
ui viewport: -
remote ui viewport: -
</wps>
<rwps>
@ -228,6 +244,8 @@ backdrop:
iconset:
viewers iconset:
selector type: bar (inverse)
ui viewport: -
remote ui viewport: -
</wps>
<rwps>
@ -261,6 +279,8 @@ backdrop:
iconset:
viewers iconset:
selector type: bar (inverse)
ui viewport: -
remote ui viewport: -
</wps>
<wps>
@ -352,6 +372,10 @@ viewers iconset.240x400x16: /.rockbox/icons/tango_small_viewers.bmp
# Whether the WPS is designed to have the statusbar on or off
Statusbar: top
# list & remote ui viewports
ui viewport: -
remote ui viewport: -
</wps>
<rwps>

View file

@ -53,6 +53,8 @@ my $iconset;
my $viewericon;
my $lineselecttextcolor;
my $filetylecolor;
my $listviewport;
my $remotelistviewport;
# LCD sizes
my ($main_height, $main_width, $main_depth);
@ -293,6 +295,12 @@ MOO
if($rwps && $has_remote ) {
push @out, "rwps: /$rbdir/wps/$rwps\n";
}
if(defined($listviewport)) {
push @out, "ui viewport: $listviewport\n";
}
if(defined($remotelistviewport) && $has_remote) {
push @out, "remote ui viewport: $listviewport\n";
}
if(-f "$rbdir/wps/$cfg") {
print STDERR "wpsbuild warning: wps/$cfg already exists!\n";
}
@ -347,6 +355,8 @@ while(<WPS>) {
undef $viewericon;
undef $lineselecttextcolor;
undef $filetylecolor;
undef $listviewport;
undef $remotelistviewport;
next;
}
@ -513,6 +523,12 @@ while(<WPS>) {
elsif($l =~ /^filetype colours: *(.*)/i) {
$filetylecolor = $1;
}
elsif($l =~ /^ui viewport: *(.*)/i) {
$listviewport = $1;
}
elsif($l =~ /^remote ui viewport: *(.*)/i) {
$remotelistviewport = $1;
}
else{
#print "Unknown line: $l!\n";
}