Index: apps/recorder/recording.c
===================================================================
--- apps/recorder/recording.c (Revision 19290)
+++ apps/recorder/recording.c (Arbeitskopie)
@@ -1087,26 +1087,24 @@
struct viewport *v;
/* top vp, 4 lines, force sys font if total screen < 6 lines
NOTE: one could limit the list to 1 line and get away with 5 lines */
+ customlist_init(&vp_top[i], i);
v = &vp_top[i];
- viewport_set_defaults(v, i); /*already takes care of statusbar*/
if (viewport_get_nb_lines(v) < 4)
{
/* compact needs 4 lines total */
v->font = FONT_SYSFIXED;
compact_view[i] = false;
}
+ /* check again with FONT_SYSFIXED, compact view if still too less space */
+ if (viewport_get_nb_lines(v) < (4+2)) /*top=4,list=2*/
+ compact_view[i] = true;
else
- {
- if (viewport_get_nb_lines(v) < (4+2)) /*top=4,list=2*/
- compact_view[i] = true;
- else
- compact_view[i] = false;
- }
+ compact_view[i] = false;
v->height = (font_get(v->font)->height)*(compact_view[i] ? 3 : 4);
/* list section, rest of the screen */
+ customlist_init(&vp_list[i], i);
v = &vp_list[i];
- viewport_set_defaults(v, i);
v->font = vp_top[i].font;
v->y = vp_top[i].y + vp_top[i].height;
v->height = screens[i].lcdheight - v->y; /* the rest */
@@ -1120,15 +1118,16 @@
}
/* init the bottom list */
- gui_synclist_init(&lists, reclist_get_name, NULL, false, 1, vp_list);
+ gui_synclist_init(&lists, reclist_get_name, NULL,
+ false, 1, vp_list);
gui_synclist_set_title(&lists, NULL, Icon_NOICON);
-
/* start of the loop: we stay in this loop until user quits recscreen */
while(done <= 0)
{
if(done < 0)
{
/* request to re-init stuff, done after settings screen */
+
done = 0;
#ifdef HAVE_FMRADIO_REC
/* If input changes away from FM Radio,
Index: apps/plugins/pictureflow.c
===================================================================
--- apps/plugins/pictureflow.c (Revision 19290)
+++ apps/plugins/pictureflow.c (Arbeitskopie)
@@ -128,6 +128,7 @@
#define ERROR_NO_ALBUMS -1
#define ERROR_BUFFER_FULL -2
+static struct viewport vp[NB_SCREENS];
/** structs we use */
@@ -1568,7 +1569,7 @@
"Rebuild cache");
do {
- selection=rb->do_menu(&settings_menu,&selection, NULL, false);
+ selection=rb->do_menu(&settings_menu,&selection, vp, false);
switch(selection) {
case 0:
rb->set_bool("Show FPS", &(config.show_fps));
@@ -1630,7 +1631,7 @@
"Settings", "Return", "Quit");
while (1) {
- switch (rb->do_menu(&main_menu,&selection, NULL, false)) {
+ switch (rb->do_menu(&main_menu,&selection, vp, false)) {
case 0:
result = settings_menu();
if ( result != 0 ) return result;
@@ -2132,6 +2133,9 @@
rb = api; /* copy to global api pointer */
(void) parameter;
+ int i;
+ FOR_NB_SCREENS(i)
+ rb->viewport_set_defaults(&vp[i], i);
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
Index: apps/plugins/text_editor.c
===================================================================
--- apps/plugins/text_editor.c (Revision 19290)
+++ apps/plugins/text_editor.c (Arbeitskopie)
@@ -36,6 +36,7 @@
static int line_count = 0;
static int last_action_line = 0;
static int last_char_index = 0;
+static struct viewport vp[NB_SCREENS];
#define ACTION_INSERT 0
#define ACTION_GET 1
@@ -205,7 +206,8 @@
void setup_lists(struct gui_synclist *lists, int sel)
{
- rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1, NULL);
+ rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1, vp);
+ /* we don't want custom list */
rb->gui_synclist_set_icon_callback(lists,NULL);
rb->gui_synclist_set_nb_items(lists,line_count);
rb->gui_synclist_limit_scroll(lists,true);
@@ -226,7 +228,7 @@
"Concat To Above", "Save",
"Show Playback Menu",);
- switch (rb->do_menu(&menu, NULL, NULL, false))
+ switch (rb->do_menu(&menu, NULL, vp, false))
{
case 0: /* cut */
rb->strcpy(copy_buffer,&buffer[do_action(ACTION_GET,0,cur_sel)]);
@@ -326,6 +328,9 @@
rb = api;
+ int i;
+ FOR_NB_SCREENS(i)
+ rb->viewport_set_defaults(&vp[i], i);
copy_buffer[0]='\0';
prev_show_statusbar = rb->global_settings->statusbar;
rb->global_settings->statusbar = false;
@@ -408,7 +413,7 @@
{
MENUITEM_STRINGLIST(menu, "Edit What?", NULL,
"Extension", "Color",);
- switch (rb->do_menu(&menu, NULL, NULL, false))
+ switch (rb->do_menu(&menu, NULL, vp, false))
{
case 0:
edit_text = true;
@@ -476,7 +481,7 @@
"Show Playback Menu", "Save Changes",
"Save As...", "Save and Exit",
"Ignore Changes and Exit");
- switch (rb->do_menu(&menu, NULL, NULL, false))
+ switch (rb->do_menu(&menu, NULL, vp, false))
{
case 0:
break;
Index: apps/gui/bitmap/list.c
===================================================================
--- apps/gui/bitmap/list.c (Revision 19290)
+++ apps/gui/bitmap/list.c (Arbeitskopie)
@@ -70,9 +70,9 @@
| | | |
------------------
*/
-static bool draw_title(struct screen *display, struct viewport *parent,
- struct gui_synclist *list)
+static bool draw_title(struct screen *display, struct gui_synclist *list)
{
+ struct viewport *parent = *(list->parent);
struct viewport *vp_icons = &title_icons[display->screen_type];
struct viewport *vp_text = &title_text[display->screen_type];
if (!list_display_title(list, parent))
@@ -86,9 +86,9 @@
+ ICON_PADDING*2;
vp_icons->x += ICON_PADDING;
- vp_text->width -= vp_icons->width + vp_icons->x;
- vp_text->x += vp_icons->width + vp_icons->x;
-
+ vp_text->x = vp_icons->width + vp_icons->x;
+ vp_text->width -= vp_text->x;
+
display->set_viewport(vp_icons);
screen_put_icon(display, 0, 0, list->title_icon);
}
@@ -104,9 +104,9 @@
return true;
}
-void list_draw(struct screen *display, struct viewport *parent,
- struct gui_synclist *list)
+void list_draw(struct screen *display, struct gui_synclist *list)
{
+ struct viewport *parent = *(list->parent);
int start, end, line_height, i;
int icon_width = get_icon_width(display->screen_type) + ICON_PADDING;
bool show_cursor = !global_settings.cursor_style &&
@@ -117,11 +117,17 @@
int item_offset;
bool show_title;
line_height = font_get(parent->font)->height;
+ /* clean up unused parts of the screen */
+ {
+ struct viewport fullscreen;
+ viewport_set_defaults(&fullscreen, display->screen_type);
+ display->set_viewport(&fullscreen);
+ display->clear_viewport();
+ }
+ display->stop_scroll();
display->set_viewport(parent);
- display->clear_viewport();
- display->stop_scroll();
list_text[display->screen_type] = *parent;
- if ((show_title = draw_title(display, parent, list)))
+ if ((show_title = draw_title(display, list)))
{
list_text[display->screen_type].y += list_title_height(list, parent);
list_text[display->screen_type].height -= list_title_height(list, parent);
@@ -278,10 +284,8 @@
screen_put_icon(display, 0, (i-start), Icon_Cursor);
}
}
-
display->set_viewport(parent);
- display->update_viewport();
- display->set_viewport(NULL);
+ display->update();
}
Index: apps/gui/charcell/list.c
===================================================================
--- apps/gui/charcell/list.c (Revision 19290)
+++ apps/gui/charcell/list.c (Arbeitskopie)
@@ -40,10 +40,8 @@
#include "misc.h"
#include "talk.h"
-void list_draw(struct screen *display, struct viewport *parent,
- struct gui_synclist *gui_list)
+void list_draw(struct screen *display, struct gui_synclist *gui_list)
{
- (void)parent;
int text_pos;
bool draw_icons = (gui_list->callback_get_item_icon != NULL &&
global_settings.show_icons);
Index: apps/gui/pitchscreen.c
===================================================================
--- apps/gui/pitchscreen.c (Revision 19290)
+++ apps/gui/pitchscreen.c (Arbeitskopie)
@@ -177,7 +177,6 @@
display->putsxy(0, h / 2, "-2%");
}
/* Lastly, a fullscreen update */
- display->set_viewport(NULL);
display->update();
}
@@ -270,7 +269,7 @@
FOR_NB_SCREENS(i)
{
screens[i].clear_display();
- viewport_set_defaults(&parent[i], i);
+ customlist_init(&parent[i], i);
max_lines[i] = viewport_get_nb_lines(&parent[i]);
pitchscreen_fix_viewports(&parent[i], pitch_viewports[i]);
@@ -360,6 +359,10 @@
delta = 0;
}
}
+ /* don't return from pitchscreen without setting a proper viewport */
+ i = 0;
+ FOR_NB_SCREENS(i)
+ screens[i].set_viewport(&parent[i]);
#if CONFIG_CODEC == SWCODEC
pcmbuf_set_low_latency(false);
#endif
Index: apps/gui/list.c
===================================================================
--- apps/gui/list.c (Revision 19290)
+++ apps/gui/list.c (Arbeitskopie)
@@ -57,28 +57,27 @@
/* should lines scroll out of the screen */
static bool offset_out_of_view = false;
#endif
-static int force_list_reinit = false;
+static bool 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 viewport *parent, struct gui_synclist *list);
+void list_draw(struct screen *display, struct gui_synclist *list);
#ifdef HAVE_LCD_BITMAP
-static struct viewport parent[NB_SCREENS];
+struct viewport parent[NB_SCREENS];
void list_init_viewports(struct gui_synclist *list)
{
int i;
struct viewport *vp;
FOR_NB_SCREENS(i)
{
- vp = &parent[i];
- if (!list)
+ vp = &(parent[i]);
+ if(!list)
viewport_set_defaults(vp, i);
+ /* list was initialized with NULL as parent */
else if (list->parent[i] == vp)
{
- viewport_set_defaults(vp, i);
- list->parent[i]->y = gui_statusbar_height();
- list->parent[i]->height = screens[i].lcdheight - list->parent[i]->y;
+ customlist_init(vp, i);
}
}
#ifdef HAVE_BUTTONBAR
@@ -148,9 +147,7 @@
if (list_parent)
gui_list->parent[i] = &list_parent[i];
else
- {
gui_list->parent[i] = &parent[i];
- }
}
list_init_viewports(gui_list);
gui_list->limit_scroll = false;
@@ -241,7 +238,7 @@
last_list = gui_list;
FOR_NB_SCREENS(i)
{
- list_draw(&screens[i], gui_list->parent[i], gui_list);
+ list_draw(&screens[i], gui_list);
}
}
@@ -855,7 +852,7 @@
getname = simplelist_static_getname;
FOR_NB_SCREENS(i)
{
- viewport_set_defaults(&vp[i], i);
+ customlist_init(&vp[i], i);
}
gui_synclist_init(&lists, getname, info->callback_data,
info->scroll_all, info->selection_size, vp);
Index: apps/gui/quickscreen.c
===================================================================
--- apps/gui/quickscreen.c (Revision 19290)
+++ apps/gui/quickscreen.c (Arbeitskopie)
@@ -70,7 +70,8 @@
/* center the icons VP first */
vp_icons[screen] = *parent;
vp_icons[screen].width = CENTER_ICONAREA_WIDTH; /* abosulte smallest allowed */
- vp_icons[screen].x = (parent->width-parent->x-CENTER_ICONAREA_WIDTH)/2;
+ vp_icons[screen].x = parent->x;
+ vp_icons[screen].x += (parent->width-CENTER_ICONAREA_WIDTH)/2;
vps[screen][QUICKSCREEN_BOTTOM] = *parent;
if (nb_lines <= MIN_LINES) /* make the bottom item use 1 line */
@@ -219,11 +220,8 @@
display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
(vp_icons[screen].width/2) - 4,
vp_icons[screen].height - 7, 7, 8);
- display->update_viewport();
-
display->set_viewport(parent);
- display->update_viewport();
- display->set_viewport(NULL);
+ display->update();
}
static void talk_qs_option(struct settings_list *opt, bool enqueue)
@@ -283,7 +281,7 @@
{
screens[i].set_viewport(NULL);
screens[i].stop_scroll();
- viewport_set_defaults(&vp[i], i);
+ customlist_init(&vp[i], i);
quickscreen_fix_viewports(qs, &screens[i], &vp[i]);
gui_quickscreen_draw(qs, &screens[i], &vp[i]);
}
Index: apps/gui/viewport.c
===================================================================
--- apps/gui/viewport.c (Revision 19290)
+++ apps/gui/viewport.c (Arbeitskopie)
@@ -33,7 +33,20 @@
#include "viewport.h"
#include "statusbar.h"
#include "screen_access.h"
+#include "debug.h"
+#define VP_STRUCTURE_PARAM_ERROR 0
+#warning REMOVE DEBUG HERE
+void DEBUG_VP(struct viewport vp, char* string)
+{
+ DEBUGF("%s debug:\n.x: %d\t.y: %d\n\r.width: %d\t.height: %d\n\n"\
+ ,string, vp.x,vp.y,vp.width,vp.height);
+}
+void DEBUG_VP_PTR(struct viewport *vp, char* string)
+{
+ DEBUGF("%s debug:\n->x: %d\t\t->y: %d\n\r->width: %d\t->height: %d\n\n",
+ string, vp->x,vp->y,vp->width,vp->height);
+}
int viewport_get_nb_lines(struct viewport *vp)
{
#ifdef HAVE_LCD_BITMAP
@@ -82,3 +95,125 @@
}
#endif
}
+
+#ifdef HAVE_LCD_BITMAP
+
+/* Generic viewport parsing function to parse viewports structures like
+ * the %V tag; basically just a wrapper for parse_list, so improvements
+ * should aim parse_list */
+const char* viewport_parse_viewport(struct viewport *vp,
+ const char *bufptr, const char seperator, enum screen_type screen)
+{
+ /* parse the list to the viewport struct */
+ const char *ptr = bufptr;
+ int depth;
+ uint32_t set = 0;
+
+ enum {
+ PL_X = 0,
+ PL_Y,
+ PL_WIDTH,
+ PL_HEIGHT,
+ PL_FONT,
+ PL_FG,
+ PL_BG,
+ };
+
+ /* set the defaults, the string might be incomplete */
+ viewport_set_defaults(vp, screen);
+
+ /* Work out the depth of this display */
+ depth = screens[screen].depth;
+#ifdef HAVE_LCD_COLOR
+ if (depth == 16)
+ {
+ if (!(ptr = parse_list("dddddcc", &set, seperator, ptr, &vp->x, &vp->y, &vp->width,
+ &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern)))
+ return VP_STRUCTURE_PARAM_ERROR;
+ }
+ else
+#endif
+#if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2)
+ if (depth == 2) {
+ if (!(ptr = parse_list("dddddgg", &set, seperator, ptr, &vp->x, &vp->y, &vp->width,
+ &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern)))
+ return VP_STRUCTURE_PARAM_ERROR;
+ }
+ else
+#endif
+#if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1)
+ if (depth == 1)
+ {
+ if (!(ptr = parse_list("ddddd", &set, seperator, ptr, &vp->x, &vp->y, &vp->width,
+ &vp->height, &vp->font)))
+ return VP_STRUCTURE_PARAM_ERROR;
+ }
+ else
+#endif
+ {}
+
+ if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y))
+ return VP_STRUCTURE_PARAM_ERROR;
+
+ /* fix defaults */
+ if (!LIST_VALUE_PARSED(set, PL_WIDTH))
+ vp->width = screens[screen].lcdwidth - vp->x;
+ if (!LIST_VALUE_PARSED(set, PL_HEIGHT))
+ vp->height = screens[screen].lcdheight - vp->y;
+
+#if (LCD_DEPTH == 16)
+ if (!LIST_VALUE_PARSED(set, PL_FG))
+ vp->fg_pattern = global_settings.fg_color;
+ if (!LIST_VALUE_PARSED(set, PL_BG))
+ vp->bg_pattern = global_settings.bg_color;
+#endif
+ /* Validate the viewport dimensions - we know that the numbers are
+ non-negative integers */
+ if ((vp->x >= screens[screen].lcdwidth) ||
+ ((vp->x + vp->width) > screens[screen].lcdwidth) ||
+ (vp->y >= screens[screen].lcdheight) ||
+ ((vp->y + vp->height) > screens[screen].lcdheight))
+ {
+ return VP_STRUCTURE_PARAM_ERROR;
+ }
+
+ /* Default to using the user font if the font was an invalid number */
+ if ((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI))
+ vp->font = FONT_UI;
+
+ /* Lastly, clip it to the statusbar */
+ if(global_settings.statusbar && vp->y < STATUSBAR_HEIGHT)
+ {
+ int offset = STATUSBAR_HEIGHT - vp->y;
+ vp->y += offset;
+ vp->height -= offset;
+ }
+ return ptr;
+}
+
+/* returns 0 if defaults are used, due to viewport_parse_viewport failure */
+int customlist_init(struct viewport *vp, enum screen_type screen)
+{
+#ifdef HAVE_REMOTE_LCD
+ if (screen= SCREEN_REMOTE)
+ {
+ if(!(viewport_parse_viewport(vp,
+ global_settings.remote_list_vp_config, ',', screen)))
+ {
+ viewport_set_defaults(vp, screen);
+ return 0;
+ }
+ }
+ else
+#endif
+ {
+ if (!(viewport_parse_viewport(vp,
+ global_settings.list_vp_config, ',', screen)))
+ {
+ viewport_set_defaults(vp,screen);
+ return 0;
+ }
+ }
+ return 1;
+}
+#endif
Index: apps/gui/viewport.h
===================================================================
--- apps/gui/viewport.h (Revision 19290)
+++ apps/gui/viewport.h (Arbeitskopie)
@@ -27,7 +27,11 @@
#include "system.h"
#include "misc.h"
#include "screen_access.h"
+#include "debug.h"
+void DEBUG_VP(struct viewport vp, char* string);
+void DEBUG_VP_PTR(struct viewport *vp, char* string);
+
/* return the number of text lines in the vp viewport */
int viewport_get_nb_lines(struct viewport *vp);
@@ -40,3 +44,7 @@
int viewport_load_config(const char *config, struct viewport *vp);
void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
+
+const char* viewport_parse_viewport(struct viewport *vp,
+ const char *ptr, char seperator, enum screen_type screen);
+int customlist_init(struct viewport *vp, enum screen_type screen);
Index: apps/gui/wps_parser.c
===================================================================
--- apps/gui/wps_parser.c (Revision 19290)
+++ apps/gui/wps_parser.c (Arbeitskopie)
@@ -26,6 +26,7 @@
#include "file.h"
#include "misc.h"
#include "plugin.h"
+#include "viewport.h"
#ifdef __PCTOOL__
#ifdef WPSEDITOR
@@ -579,26 +580,6 @@
{
(void)token; /* Kill warnings */
const char *ptr = wps_bufptr;
- struct viewport* vp;
- int depth;
- uint32_t set = 0;
- enum {
- PL_X = 0,
- PL_Y,
- PL_WIDTH,
- PL_HEIGHT,
- PL_FONT,
- PL_FG,
- PL_BG,
- };
- int lcd_width = LCD_WIDTH, lcd_height = LCD_HEIGHT;
-#ifdef HAVE_REMOTE_LCD
- if (wps_data->remote_wps)
- {
- lcd_width = LCD_REMOTE_WIDTH;
- lcd_height = LCD_REMOTE_HEIGHT;
- }
-#endif
if (wps_data->num_viewports >= WPS_MAX_VIEWPORTS)
return WPS_ERROR_INVALID_PARAM;
@@ -627,7 +608,7 @@
return WPS_ERROR_INVALID_PARAM;
ptr++;
- vp = &wps_data->viewports[wps_data->num_viewports].vp;
+ struct viewport *vp = &wps_data->viewports[wps_data->num_viewports].vp;
/* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */
/* Set the defaults for fields not user-specified */
@@ -635,80 +616,27 @@
/* Work out the depth of this display */
#ifdef HAVE_REMOTE_LCD
- depth = (wps_data->remote_wps ? LCD_REMOTE_DEPTH : LCD_DEPTH);
-#else
- depth = LCD_DEPTH;
-#endif
-
-#ifdef HAVE_LCD_COLOR
- if (depth == 16)
+ if (!(wps_data->remote_wps))
{
- if (!(ptr = parse_list("dddddcc", &set, '|', ptr, &vp->x, &vp->y, &vp->width,
- &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern)))
- return WPS_ERROR_INVALID_PARAM;
- }
- else
#endif
-#if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2)
- if (depth == 2) {
- /* Default to black on white */
- vp->fg_pattern = 0;
- vp->bg_pattern = 3;
- if (!(ptr = parse_list("dddddgg", &set, '|', ptr, &vp->x, &vp->y, &vp->width,
- &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern)))
+ if (!(ptr = viewport_parse_viewport(vp, ptr, '|', SCREEN_MAIN)))
return WPS_ERROR_INVALID_PARAM;
+#ifdef HAVE_REMOTE_LCD
}
- else
-#endif
-#if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1)
- if (depth == 1)
+ else
{
- if (!(ptr = parse_list("ddddd", &set, '|', ptr, &vp->x, &vp->y,
- &vp->width, &vp->height, &vp->font)))
+ if (!(ptr = viewport_parse_viewport(vp, ptr, '|', SCREEN_REMOTE)))
return WPS_ERROR_INVALID_PARAM;
}
- else
+
#endif
- {}
+
/* Check for trailing | */
if (*ptr != '|')
return WPS_ERROR_INVALID_PARAM;
- if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y))
- return WPS_ERROR_INVALID_PARAM;
-
- /* fix defaults */
- if (!LIST_VALUE_PARSED(set, PL_WIDTH))
- vp->width = lcd_width - vp->x;
- if (!LIST_VALUE_PARSED(set, PL_HEIGHT))
- vp->height = lcd_height - vp->y;
-
- /* Default to using the user font if the font was an invalid number */
- if (!LIST_VALUE_PARSED(set, PL_FONT) ||
- ((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI)))
- vp->font = FONT_UI;
- /* Validate the viewport dimensions - we know that the numbers are
- non-negative integers */
- if ((vp->x >= lcd_width) ||
- ((vp->x + vp->width) > lcd_width) ||
- (vp->y >= lcd_height) ||
- ((vp->y + vp->height) > lcd_height))
- {
- return WPS_ERROR_INVALID_PARAM;
- }
-
-#ifdef HAVE_LCD_COLOR
- if (depth == 16)
- {
- if (!LIST_VALUE_PARSED(set, PL_FG))
- vp->fg_pattern = global_settings.fg_color;
- if (!LIST_VALUE_PARSED(set, PL_BG))
- vp->bg_pattern = global_settings.bg_color;
- }
-#endif
-
wps_data->viewports[wps_data->num_viewports-1].last_line = wps_data->num_lines - 1;
wps_data->viewports[wps_data->num_viewports].first_line = wps_data->num_lines;
Index: apps/menu.c
===================================================================
--- apps/menu.c (Revision 19290)
+++ apps/menu.c (Arbeitskopie)
@@ -290,9 +290,8 @@
int i;
FOR_NB_SCREENS(i)
{
- viewport_set_defaults(&parent[i], i);
- /* viewport_set_defaults() fixes the vp for the bars, so resize */
- if (hide_bars)
+ /* fix the statusbar position if it's hidden, only if no customlist is used */
+ if ((!customlist_init(&parent[i], i)) && hide_bars)
{
if (global_settings.statusbar)
{
@@ -384,7 +383,7 @@
int stack_top = 0;
bool in_stringlist, done = false;
- struct viewport *vps, menu_vp[NB_SCREENS]; /* menu_vp will hopefully be phased out */
+ struct viewport vps[NB_SCREENS];
#ifdef HAVE_BUTTONBAR
struct gui_buttonbar buttonbar;
gui_buttonbar_init(&buttonbar);
@@ -397,17 +396,18 @@
menu = &main_menu_;
else menu = start_menu;
- init_default_menu_viewports(menu_vp, hide_bars);
- if (parent)
+ if (NULL == parent)
{
- vps = parent;
- /* if hide_bars == true we assume the viewport is correctly sized */
+ FOR_NB_SCREENS(i)
+ init_default_menu_viewports(&vps[i], hide_bars);
}
else
{
- vps = menu_vp;
+ FOR_NB_SCREENS(i)
+ vps[i] = parent[i];
}
+ /* if hide_bars == true we assume the viewport is correctly sized */
FOR_NB_SCREENS(i)
{
screens[i].set_viewport(&vps[i]);
@@ -657,7 +657,7 @@
case MT_SETTING:
case MT_SETTING_W_TEXT:
{
- if (do_setting_from_menu(temp, menu_vp))
+ if (do_setting_from_menu(temp, vps))
{
init_menu_lists(menu, &lists, selected, true,vps);
redraw_lists = false; /* above does the redraw */
Index: apps/settings.h
===================================================================
--- apps/settings.h (Revision 19290)
+++ apps/settings.h (Arbeitskopie)
@@ -449,7 +449,12 @@
#endif
unsigned char wps_file[MAX_FILENAME+1]; /* last wps */
unsigned char lang_file[MAX_FILENAME+1]; /* last language */
-
+#ifdef HAVE_LCD_BITMAP
+ unsigned char list_vp_config[50]; /* viewport string for the lists */
+#endif
+#ifdef HAVE_REMOTE_LCD
+ unsigned char remote_list_vp_config[50]; /* viewport file for the remote lists */
+#endif
/* misc options */
int repeat_mode; /* 0=off 1=repeat all 2=repeat one 3=shuffle 4=ab */
Index: apps/menus/theme_menu.c
===================================================================
--- apps/menus/theme_menu.c (Revision 19290)
+++ apps/menus/theme_menu.c (Arbeitskopie)
@@ -38,6 +38,8 @@
#include "lcd-remote.h"
#include "backdrop.h"
#include "exported_menus.h"
+#include "appevents.h"
+#include "debug.h"
#if LCD_DEPTH > 1
/**
@@ -153,6 +155,14 @@
return rockbox_browse(info->dir, info->show_options);
}
+
+static int browse_themes_callback(int action,const struct menu_item_ex *this_item)
+{
+ (void)this_item;
+ (void)action;
+ DEBUGF("callbackl 1\n");
+ return ACTION_REDRAW;
+}
#ifdef HAVE_LCD_BITMAP
MENUITEM_FUNCTION(browse_fonts, MENU_FUNC_USEPARAM,
ID2P(LANG_CUSTOM_FONT),
@@ -170,7 +180,7 @@
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);
+ browse_folder, (void*)&themes, browse_themes_callback, Icon_Config);
#ifdef HAVE_LCD_BITMAP
MENUITEM_SETTING(cursor_style, &global_settings.cursor_style, NULL);
#endif
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (Revision 19290)
+++ apps/settings_list.c (Arbeitskopie)
@@ -173,6 +173,9 @@
{.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";
@@ -1431,6 +1434,13 @@
qs_load_from_cfg, qs_write_to_cfg,
qs_is_changed, qs_set_default),
#endif
+ /* Customizable list */
+#ifdef HAVE_LCD_BITMAP
+ VIEWPORT_SETTING(list_vp_config, "list viewport", ""),
+#endif
+#ifdef HAVE_REMOTE_LCD
+ VIEWPORT_SETTING(remote_list_vp_config, "remote list viewport", ""),
+#endif
};
const int nb_settings = sizeof(settings)/sizeof(*settings);
Index: apps/plugin.c
===================================================================
--- apps/plugin.c (Revision 19290)
+++ apps/plugin.c (Arbeitskopie)
@@ -620,6 +620,7 @@
/* new stuff at the end, sort into place next time
the API gets incompatible */
get_settings_list,
+ customlist_init,
};
int plugin_load(const char* plugin, const void* parameter)
Index: apps/plugin.h
===================================================================
--- apps/plugin.h (Revision 19290)
+++ apps/plugin.h (Arbeitskopie)
@@ -783,6 +783,7 @@
/* new stuff at the end, sort into place next time
the API gets incompatible */
const struct settings_list* (*get_settings_list)(int*count);
+ int (*customlist_init)(struct viewport vp[NB_SCREENS], enum screen_type screen);
};
Index: wps/WPSLIST
===================================================================
--- wps/WPSLIST (Revision 19290)
+++ wps/WPSLIST (Arbeitskopie)
@@ -68,6 +68,8 @@
iconset:
viewers iconset:
selector type: bar (inverse)
+list viewport:
+remote list viewport:
@@ -80,6 +82,8 @@
iconset:
viewers iconset:
selector type: bar (inverse)
+list viewport:
+remote list viewport:
@@ -92,6 +96,8 @@
viewers iconset:
selector type: bar (inverse)
Statusbar: on
+list viewport:
+remote list viewport:
@@ -104,6 +110,8 @@
iconset:
viewers iconset:
selector type: bar (inverse)
+list viewport:
+remote list viewport:
@@ -151,6 +159,8 @@
iconset:
viewers iconset:
selector type: bar (inverse)
+list viewport:
+remote list viewport:
@@ -158,6 +168,8 @@
Author: Mike Sobel
Font: 13-Nimbus.fnt
Statusbar: on
+list viewport:
+remote list viewport:
@@ -172,6 +184,8 @@
iconset:
viewers iconset:
selector type: bar (inverse)
+list viewport:
+remote list viewport:
@@ -203,6 +217,8 @@
iconset:
viewers iconset:
selector type: bar (inverse)
+list viewport:
+remote list viewport:
@@ -225,6 +241,8 @@
iconset:
viewers iconset:
selector type: bar (inverse)
+list viewport:
+remote list viewport:
@@ -256,6 +274,8 @@
iconset:
viewers iconset:
selector type: bar (inverse)
+list viewport:
+remote list viewport:
@@ -341,6 +361,10 @@
# Whether the WPS is designed to have the statusbar on or off
Statusbar: on
+
+# list & remote list viewports
+list viewport:
+remote list viewport:
Index: wps/wpsbuild.pl
===================================================================
--- wps/wpsbuild.pl (Revision 19290)
+++ wps/wpsbuild.pl (Arbeitskopie)
@@ -51,6 +51,8 @@
my $viewericon;
my $lineselecttextcolor;
my $filetylecolor;
+my $listviewport;
+my $remotelistviewport;
# LCD sizes
my ($main_height, $main_width, $main_depth);
@@ -288,6 +290,16 @@
if($rwps && $has_remote ) {
push @out, "rwps: /$rbdir/wps/$rwps\n";
}
+ if(defined($listviewport)) {
+ if($listviewport eq '') {
+ push @out, "list viewport:\n";
+ }
+ }
+ if((defined($remotelistviewport)) && $has_remote) {
+ if($remotelistviewport eq '') {
+ push @out, "remote list viewport:\n";
+ }
+ }
if(-f "$rbdir/wps/$cfg") {
print STDERR "wpsbuild warning: wps/$cfg already exists!\n";
}
@@ -342,6 +354,8 @@
undef $viewericon;
undef $lineselecttextcolor;
undef $filetylecolor;
+ undef $listviewport;
+ undef $remotelistviewport;
next;
}
@@ -497,6 +511,12 @@
elsif($l =~ /^filetype colours: *(.*)/i) {
$filetylecolor = $1;
}
+ elsif($l =~ /^list viewport: *(.*)/i) {
+ $listviewport = $1;
+ }
+ elsif($l =~ /^remote list viewport: *(.*)/i) {
+ $remotelistviewport = $1;
+ }
else{
#print "Unknown line: $l!\n";
}