part two of the grand overall wps/skinning engine cleanup work:
* rename wps_engine to skin_engine as that was agreed on * rename music_screen back to wps * clean up the skin display/update functions a bit * make skin_data_load setup the hardcoded default if a skin cant be loaded for whatever reason instead of doing it when it is first displayed ignore any gui_wps or wps_ or gwps_ nameing in skin_engine/ ... these will be renamed as this work gets finished git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22135 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
48b7e8ca27
commit
3e7444ff87
16 changed files with 115 additions and 180 deletions
10
apps/SOURCES
10
apps/SOURCES
|
@ -77,17 +77,17 @@ gui/pitchscreen.c
|
|||
gui/quickscreen.c
|
||||
#endif
|
||||
|
||||
gui/music_screen.c
|
||||
gui/wps.c
|
||||
gui/scrollbar.c
|
||||
gui/splash.c
|
||||
gui/statusbar.c
|
||||
gui/yesno.c
|
||||
gui/viewport.c
|
||||
|
||||
gui/wps_engine/wps_debug.c
|
||||
gui/wps_engine/wps_display.c
|
||||
gui/wps_engine/wps_parser.c
|
||||
gui/wps_engine/wps_tokens.c
|
||||
gui/skin_engine/wps_debug.c
|
||||
gui/skin_engine/wps_display.c
|
||||
gui/skin_engine/wps_parser.c
|
||||
gui/skin_engine/wps_tokens.c
|
||||
|
||||
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
|
||||
gui/backdrop.c
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#if CONFIG_TUNER
|
||||
#include "radio.h"
|
||||
#endif
|
||||
#include "wps_engine/wps_internals.h" /* FIXME: REMOVE ME */
|
||||
#include "skin_engine/skin_engine.h"
|
||||
#include "backdrop.h"
|
||||
|
||||
static int compare_sort_dir; /* qsort key for sorting directories */
|
||||
|
@ -484,7 +484,7 @@ int ft_enter(struct tree_context* c)
|
|||
#if LCD_DEPTH > 1
|
||||
unload_wps_backdrop();
|
||||
#endif
|
||||
wps_data_load(gui_wps[0].data, &screens[0], buf, true);
|
||||
skin_data_load(gui_wps[0].data, &screens[0], buf, true);
|
||||
set_file(buf, (char *)global_settings.wps_file,
|
||||
MAX_FILENAME);
|
||||
break;
|
||||
|
@ -496,7 +496,7 @@ int ft_enter(struct tree_context* c)
|
|||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
unload_remote_wps_backdrop();
|
||||
#endif
|
||||
wps_data_load(gui_wps[1].data, &screens[1], buf, true);
|
||||
skin_data_load(gui_wps[1].data, &screens[1], buf, true);
|
||||
set_file(buf, (char *)global_settings.rwps_file,
|
||||
MAX_FILENAME);
|
||||
break;
|
||||
|
|
|
@ -63,89 +63,52 @@
|
|||
|
||||
|
||||
#include "wps_internals.h"
|
||||
#include "wps_engine.h"
|
||||
#include "skin_engine.h"
|
||||
|
||||
static bool gui_wps_redraw(struct gui_wps *gwps, unsigned refresh_mode);
|
||||
|
||||
|
||||
bool gui_wps_display(struct gui_wps *gwps)
|
||||
{
|
||||
struct screen *display = gwps->display;
|
||||
struct wps_data *data = gwps->data;
|
||||
int screen = display->screen_type;
|
||||
|
||||
/* Update the values in the first (default) viewport - in case the user
|
||||
has modified the statusbar or colour settings */
|
||||
#if LCD_DEPTH > 1
|
||||
if (display->depth > 1)
|
||||
{
|
||||
data->viewports[0].vp.fg_pattern = display->get_foreground();
|
||||
data->viewports[0].vp.bg_pattern = display->get_background();
|
||||
gwps->data->viewports[0].vp.fg_pattern = display->get_foreground();
|
||||
gwps->data->viewports[0].vp.bg_pattern = display->get_background();
|
||||
}
|
||||
#endif
|
||||
display->clear_display();
|
||||
if (!data->wps_loaded) {
|
||||
if ( !data->num_tokens ) {
|
||||
/* set the default wps for the main-screen */
|
||||
if(screen == SCREEN_MAIN)
|
||||
{
|
||||
#if LCD_DEPTH > 1
|
||||
unload_wps_backdrop();
|
||||
#endif
|
||||
wps_data_load(data,
|
||||
display,
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
||||
"%s%?ia<%ia|%?d2<%d2|(root)>>\n"
|
||||
"%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n"
|
||||
"\n"
|
||||
"%al%pc/%pt%ar[%pp:%pe]\n"
|
||||
"%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
|
||||
"%pb\n"
|
||||
"%pm\n", false);
|
||||
#else
|
||||
"%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
|
||||
"%pc%?ps<*|/>%pt\n", false);
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
/* set the default wps for the remote-screen */
|
||||
else if(screen == SCREEN_REMOTE)
|
||||
{
|
||||
#if LCD_REMOTE_DEPTH > 1
|
||||
unload_remote_wps_backdrop();
|
||||
#endif
|
||||
wps_data_load(data,
|
||||
display,
|
||||
"%s%?ia<%ia|%?d2<%d2|(root)>>\n"
|
||||
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
||||
"%al%pc/%pt%ar[%pp:%pe]\n"
|
||||
"%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
|
||||
"%pb\n", false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||
if (screen == SCREEN_REMOTE)
|
||||
if (display->screen_type == SCREEN_REMOTE)
|
||||
show_remote_wps_backdrop();
|
||||
else if (screen == SCREEN_MAIN)
|
||||
else if (display->screen_type == SCREEN_MAIN)
|
||||
#endif
|
||||
#if LCD_DEPTH > 1
|
||||
show_wps_backdrop();
|
||||
#endif
|
||||
}
|
||||
return gui_wps_redraw(gwps, 0, WPS_REFRESH_ALL);
|
||||
return gui_wps_redraw(gwps, WPS_REFRESH_ALL);
|
||||
}
|
||||
|
||||
bool gui_wps_update(struct gui_wps *gwps)
|
||||
/* update a skinned screen, update_type is WPS_REFRESH_* values.
|
||||
* Usually it should only be WPS_REFRESH_NON_STATIC
|
||||
* A full update will be done if required (state.do_full_update == true)
|
||||
*/
|
||||
bool skin_update(struct gui_wps *gwps, unsigned int update_type)
|
||||
{
|
||||
struct mp3entry *id3 = gwps->state->id3;
|
||||
bool retval;
|
||||
/* This maybe shouldnt be here, but while the skin is only used to
|
||||
* display the music screen this is better than whereever we are being
|
||||
* called from. This is also safe for skined screen which dont use the id3 */
|
||||
struct mp3entry *id3 = gwps->state->id3;
|
||||
bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false);
|
||||
gwps->state->do_full_update = cuesheet_update || gwps->state->do_full_update;
|
||||
retval = gui_wps_redraw(gwps, 0,
|
||||
gwps->state->do_full_update ?
|
||||
WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC);
|
||||
|
||||
retval = gui_wps_redraw(gwps, gwps->state->do_full_update ?
|
||||
WPS_REFRESH_ALL : update_type);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -883,9 +846,7 @@ static void write_line(struct screen *display,
|
|||
}
|
||||
}
|
||||
|
||||
bool gui_wps_redraw(struct gui_wps *gwps,
|
||||
int ffwd_offset,
|
||||
unsigned refresh_mode)
|
||||
static bool gui_wps_redraw(struct gui_wps *gwps, unsigned refresh_mode)
|
||||
{
|
||||
struct wps_data *data = gwps->data;
|
||||
struct screen *display = gwps->display;
|
||||
|
@ -943,8 +904,6 @@ bool gui_wps_redraw(struct gui_wps *gwps,
|
|||
}
|
||||
#endif
|
||||
|
||||
state->ff_rewind_count = ffwd_offset;
|
||||
|
||||
/* disable any viewports which are conditionally displayed */
|
||||
for (v = 0; v < data->num_viewports; v++)
|
||||
{
|
|
@ -390,11 +390,6 @@ struct touchregion {
|
|||
short int y; /* y-pos */
|
||||
short int width; /* width */
|
||||
short int height; /* height */
|
||||
enum {
|
||||
WPS_TOUCHREGION_ACTION,
|
||||
WPS_TOUCHREGION_SCROLLBAR,
|
||||
WPS_TOUCHREGION_VOLUME
|
||||
} type; /* type of touch region */
|
||||
bool repeat; /* requires the area be held for the action */
|
||||
int action; /* action this button will return */
|
||||
};
|
||||
|
@ -478,12 +473,6 @@ struct wps_data
|
|||
/* initial setup of wps_data */
|
||||
void wps_data_init(struct wps_data *wps_data);
|
||||
|
||||
/* to setup up the wps-data from a format-buffer (isfile = false)
|
||||
from a (wps-)file (isfile = true)*/
|
||||
bool wps_data_load(struct wps_data *wps_data,
|
||||
struct screen *display,
|
||||
const char *buf,
|
||||
bool isfile);
|
||||
|
||||
/* Redraw statusbars if necessary */
|
||||
void gwps_draw_statusbars(void);
|
|
@ -1173,8 +1173,6 @@ static int parse_touchregion(const char *wps_bufptr,
|
|||
struct touchregion *region;
|
||||
const char *ptr = wps_bufptr;
|
||||
const char *action;
|
||||
const char pb_string[] = "progressbar";
|
||||
const char vol_string[] = "volume";
|
||||
int x,y,w,h;
|
||||
|
||||
/* format: %T|x|y|width|height|action|
|
||||
|
@ -1214,17 +1212,7 @@ static int parse_touchregion(const char *wps_bufptr,
|
|||
region->width = w;
|
||||
region->height = h;
|
||||
region->wvp = &wps_data->viewports[wps_data->num_viewports];
|
||||
|
||||
if(!strncmp(pb_string, action, sizeof(pb_string)-1)
|
||||
&& *(action + sizeof(pb_string)-1) == '|')
|
||||
region->type = WPS_TOUCHREGION_SCROLLBAR;
|
||||
else if(!strncmp(vol_string, action, sizeof(vol_string)-1)
|
||||
&& *(action + sizeof(vol_string)-1) == '|')
|
||||
region->type = WPS_TOUCHREGION_VOLUME;
|
||||
else
|
||||
{
|
||||
region->type = WPS_TOUCHREGION_ACTION;
|
||||
|
||||
i = 0;
|
||||
if (*action == '&')
|
||||
{
|
||||
action++;
|
||||
|
@ -1233,7 +1221,6 @@ static int parse_touchregion(const char *wps_bufptr,
|
|||
else
|
||||
region->repeat = false;
|
||||
|
||||
i = 0;
|
||||
imax = ARRAYLEN(touchactions);
|
||||
while ((region->action == ACTION_NONE) &&
|
||||
(i < imax))
|
||||
|
@ -1247,8 +1234,6 @@ static int parse_touchregion(const char *wps_bufptr,
|
|||
}
|
||||
if (region->action == ACTION_NONE)
|
||||
return WPS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
wps_data->touchregion_count++;
|
||||
return skip_end_of_line(wps_bufptr);
|
||||
}
|
||||
|
@ -1681,7 +1666,7 @@ static bool load_wps_bitmaps(struct wps_data *wps_data, char *bmpdir)
|
|||
|
||||
/* to setup up the wps-data from a format-buffer (isfile = false)
|
||||
from a (wps-)file (isfile = true)*/
|
||||
bool wps_data_load(struct wps_data *wps_data,
|
||||
static bool wps_data_load(struct wps_data *wps_data,
|
||||
struct screen *display,
|
||||
const char *buf,
|
||||
bool isfile)
|
||||
|
@ -1830,6 +1815,55 @@ bool wps_data_load(struct wps_data *wps_data,
|
|||
}
|
||||
}
|
||||
|
||||
void skin_data_load(struct wps_data *wps_data,
|
||||
struct screen *display,
|
||||
const char *buf,
|
||||
bool isfile)
|
||||
{
|
||||
bool loaded_ok = buf && wps_data_load(wps_data, display, buf, isfile);
|
||||
if (!loaded_ok) /* load the hardcoded default */
|
||||
{
|
||||
/* set the default wps for the main-screen */
|
||||
if(display->screen_type == SCREEN_MAIN)
|
||||
{
|
||||
#if LCD_DEPTH > 1
|
||||
unload_wps_backdrop();
|
||||
#endif
|
||||
wps_data_load(wps_data,
|
||||
display,
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
||||
"%s%?ia<%ia|%?d2<%d2|(root)>>\n"
|
||||
"%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>\n"
|
||||
"\n"
|
||||
"%al%pc/%pt%ar[%pp:%pe]\n"
|
||||
"%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
|
||||
"%pb\n"
|
||||
"%pm\n", false);
|
||||
#else
|
||||
"%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d2> - %?id<%id|%d1>\n"
|
||||
"%pc%?ps<*|/>%pt\n", false);
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
/* set the default wps for the remote-screen */
|
||||
else if(display->screen_type == SCREEN_REMOTE)
|
||||
{
|
||||
#if LCD_REMOTE_DEPTH > 1
|
||||
unload_remote_wps_backdrop();
|
||||
#endif
|
||||
wps_data_load(wps_data,
|
||||
display,
|
||||
"%s%?ia<%ia|%?d2<%d2|(root)>>\n"
|
||||
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
||||
"%al%pc/%pt%ar[%pp:%pe]\n"
|
||||
"%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>\n"
|
||||
"%pb\n", false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
int wps_subline_index(struct wps_data *data, int line, int subline)
|
||||
{
|
||||
return data->lines[line].first_subline_idx + subline;
|
|
@ -55,7 +55,7 @@
|
|||
#include "viewport.h"
|
||||
|
||||
#include "wps_internals.h"
|
||||
#include "music_screen.h"
|
||||
#include "wps.h"
|
||||
|
||||
static char* get_codectype(const struct mp3entry* id3)
|
||||
{
|
|
@ -1,49 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id: gwps.h 22003 2009-07-22 22:10:25Z kugel $
|
||||
*
|
||||
* Copyright (C) 2007 Nicolas Pennequin
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/** Use this for stuff which external code needs to include **/
|
||||
|
||||
#ifndef _WPS_ENGINE_H
|
||||
#define _WPS_ENGINE_H
|
||||
#include <stdbool.h>
|
||||
#include "wps_internals.h" /* TODO: remove this line.. shoudlnt be needed */
|
||||
|
||||
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
int wps_get_touchaction(struct wps_data *data);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ALBUMART
|
||||
/* gives back if WPS contains an albumart tag */
|
||||
bool gui_sync_wps_uses_albumart(void);
|
||||
#endif
|
||||
|
||||
/* setup and display a WPS for the first time */
|
||||
bool gui_wps_display(struct gui_wps *gwps);
|
||||
/* do a requested redraw */
|
||||
bool gui_wps_redraw(struct gui_wps *gwps,
|
||||
int ffwd_offset,
|
||||
unsigned refresh_mode);
|
||||
/* do a partial redraw, or full if required, also do any housekeeping
|
||||
* which might be needed */
|
||||
bool gui_wps_update(struct gui_wps *gwps);
|
||||
|
||||
#endif
|
|
@ -36,7 +36,7 @@
|
|||
#include "audio.h"
|
||||
#include "settings.h"
|
||||
#include "metadata.h"
|
||||
#include "wps_engine/wps_engine.h"
|
||||
#include "skin_engine/skin_engine.h"
|
||||
|
||||
#include "action.h"
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "sprintf.h"
|
||||
#include "font.h"
|
||||
#include "language.h"
|
||||
#include "music_screen.h"
|
||||
#include "wps.h"
|
||||
#include "playlist.h"
|
||||
#include "buffer.h"
|
||||
#include "rolo.h"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#endif
|
||||
#include "version.h"
|
||||
#include "time.h"
|
||||
#include "gui/wps_engine/wps_engine.h"
|
||||
#include "skin_engine/skin_engine.h"
|
||||
|
||||
static const struct browse_folder_info config = {ROCKBOX_DIR, SHOW_CFG};
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
#include "icons.h"
|
||||
#endif /* End HAVE_LCD_BITMAP */
|
||||
#include "bookmark.h"
|
||||
#include "music_screen.h"
|
||||
#include "wps.h"
|
||||
#include "playback.h"
|
||||
|
||||
#ifdef BOOTFILE
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include "metadata.h"
|
||||
#include "wps_engine/wps_engine.h"
|
||||
#include "skin_engine/skin_engine.h"
|
||||
|
||||
/* Look for albumart bitmap in the same dir as the track and in its parent dir.
|
||||
* Stores the found filename in the buf parameter.
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#ifdef HAVE_RECORDING
|
||||
#include "recording.h"
|
||||
#endif
|
||||
#include "music_screen.h"
|
||||
#include "wps.h"
|
||||
#include "bookmark.h"
|
||||
#include "playlist.h"
|
||||
#include "tagtree.h"
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
#if CONFIG_TUNER
|
||||
#include "radio.h"
|
||||
#endif
|
||||
#include "wps_engine/wps_engine.h"
|
||||
#include "skin_engine/skin_engine.h"
|
||||
|
||||
#if CONFIG_CODEC == MAS3507D
|
||||
void dac_line_in(bool enable);
|
||||
|
@ -848,11 +848,12 @@ void settings_apply(bool read_disk)
|
|||
global_settings.wps_file[0] != 0xff ) {
|
||||
snprintf(buf, sizeof buf, WPS_DIR "/%s.wps",
|
||||
global_settings.wps_file);
|
||||
wps_data_load(gui_wps[0].data, &screens[0], buf, true);
|
||||
skin_data_load(gui_wps[0].data, &screens[0], buf, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
wps_data_init(gui_wps[0].data);
|
||||
skin_data_load(gui_wps[0].data, &screens[0], NULL, true);
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
gui_wps[0].data->remote_wps = false;
|
||||
#endif
|
||||
|
@ -877,11 +878,12 @@ void settings_apply(bool read_disk)
|
|||
if ( global_settings.rwps_file[0]) {
|
||||
snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
|
||||
global_settings.rwps_file);
|
||||
wps_data_load(gui_wps[1].data, &screens[1], buf, true);
|
||||
skin_data_load(gui_wps[1].data, &screens[1], buf, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
wps_data_init(gui_wps[1].data);
|
||||
skin_data_load(gui_wps[1].data, &screens[1], NULL, true);
|
||||
gui_wps[1].data->remote_wps = true;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include "audio.h"
|
||||
#include "playlist.h"
|
||||
#include "menu.h"
|
||||
#include "wps_engine/wps_engine.h"
|
||||
#include "skin_engine/skin_engine.h"
|
||||
#include "settings.h"
|
||||
#include "debug.h"
|
||||
#include "storage.h"
|
||||
|
|
Loading…
Reference in a new issue