summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/appevents.h4
-rw-r--r--apps/debug_menu.c2
-rw-r--r--apps/filetree.c15
-rw-r--r--apps/gui/list.c55
-rw-r--r--apps/gui/list.h2
-rw-r--r--apps/gui/statusbar.c2
-rw-r--r--apps/gui/viewport.c169
-rw-r--r--apps/gui/viewport.h82
-rw-r--r--apps/gui/wps.c1
-rw-r--r--apps/main.c11
-rw-r--r--apps/menu.c4
-rw-r--r--apps/menus/display_menu.c4
-rw-r--r--apps/menus/theme_menu.c2
-rw-r--r--apps/plugin.c19
-rw-r--r--apps/recorder/keyboard.c7
-rw-r--r--apps/recorder/recording.c5
-rw-r--r--apps/root_menu.c1
-rw-r--r--apps/settings.c12
-rw-r--r--apps/settings.h7
-rw-r--r--apps/settings_list.c11
-rw-r--r--wps/WPSLIST24
-rwxr-xr-xwps/wpsbuild.pl16
22 files changed, 353 insertions, 102 deletions
diff --git a/apps/appevents.h b/apps/appevents.h
index e3c4a92ff8..f7e695d4a9 100644
--- a/apps/appevents.h
+++ b/apps/appevents.h
@@ -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
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index a4a399d616..ea53d445fd 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -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;
diff --git a/apps/filetree.c b/apps/filetree.c
index 2d05bd54cf..ec7932435d 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -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 */
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 8a65d3f298..3627f12221 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -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;
}
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 50aaebe93a..23997e8a65 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -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,
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index 5e215090f5..024ade330f 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -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)
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index ef527d90cc..bb4c291cc0 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -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
@@ -78,9 +94,9 @@ static bool showing_bars(enum screen_type screen)
#endif
}
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,37 +173,101 @@ 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;
- statusbar_enabled = 0;
- if (global_settings.statusbar != STATUSBAR_OFF)
- statusbar_enabled = VP_SB_ONSCREEN(SCREEN_MAIN);
+ (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);
#ifdef HAVE_REMOTE_LCD
- if (global_settings.remote_statusbar != STATUSBAR_OFF)
- statusbar_enabled |= VP_SB_ONSCREEN(SCREEN_REMOTE);
+ 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 */
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h
index 6c3fb92998..2ed138b365 100644
--- a/apps/gui/viewport.h
+++ b/apps/gui/viewport.h
@@ -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__ */
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index b57f06d2b5..055f8d01e6 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -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)
diff --git a/apps/main.c b/apps/main.c
index d0fba3fcce..49542e8b01 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -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 */
diff --git a/apps/menu.c b/apps/menu.c
index 96140cf4f8..539dc900a5 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -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];
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index 05b5bd268d..3989a6381b 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -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;
diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c
index d71ca71928..233d673da1 100644
--- a/apps/menus/theme_menu.c
+++ b/apps/menus/theme_menu.c
@@ -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;
}
diff --git a/apps/plugin.c b/apps/plugin.c
index 238a01c322..e9acc97824 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -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,8 +781,14 @@ 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);
@@ -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;
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index 0fa1d32503..160779f7ae 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -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;
}
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 9bcbf8be68..2716d932b5 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -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,9 +1925,11 @@ 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 */
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 848440a40c..a06caba176 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -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;
diff --git a/apps/settings.c b/apps/settings.c
index 1b0abfbf46..48571db20e 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -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);
}
diff --git a/apps/settings.h b/apps/settings.h
index becf164a8f..998fdc1cd9 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -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 **/
diff --git a/apps/settings_list.c b/apps/settings_list.c
index c03731f2b7..98dd900e3c 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -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);
diff --git a/wps/WPSLIST b/wps/WPSLIST
index 663b681533..58fa5f1114 100644
--- a/wps/WPSLIST
+++ b/wps/WPSLIST
@@ -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>
diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl
index 735a63830a..e9e5c29a30 100755
--- a/wps/wpsbuild.pl
+++ b/wps/wpsbuild.pl
@@ -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";
}