summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-08-03 04:43:34 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-08-03 04:43:34 +0000
commit3e7444ff8770678b563af6b3f9f6b05521cac959 (patch)
tree2cc650b7726639b51eee53d75a51515a255614a2 /apps
parent48b7e8ca2748afbf429dc691a37cb3f6f1252246 (diff)
downloadrockbox-3e7444ff8770678b563af6b3f9f6b05521cac959.tar.gz
rockbox-3e7444ff8770678b563af6b3f9f6b05521cac959.tar.bz2
rockbox-3e7444ff8770678b563af6b3f9f6b05521cac959.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/SOURCES10
-rw-r--r--apps/filetree.c6
-rw-r--r--apps/gui/skin_engine/wps_debug.c (renamed from apps/gui/wps_engine/wps_debug.c)0
-rw-r--r--apps/gui/skin_engine/wps_display.c (renamed from apps/gui/wps_engine/wps_display.c)89
-rw-r--r--apps/gui/skin_engine/wps_internals.h (renamed from apps/gui/wps_engine/wps_internals.h)11
-rw-r--r--apps/gui/skin_engine/wps_parser.c (renamed from apps/gui/wps_engine/wps_parser.c)106
-rw-r--r--apps/gui/skin_engine/wps_tokens.c (renamed from apps/gui/wps_engine/wps_tokens.c)2
-rw-r--r--apps/gui/wps_engine/wps_engine.h49
-rw-r--r--apps/iap.c2
-rw-r--r--apps/main.c2
-rw-r--r--apps/menus/main_menu.c2
-rw-r--r--apps/misc.c2
-rw-r--r--apps/recorder/albumart.h2
-rw-r--r--apps/root_menu.c2
-rw-r--r--apps/settings.c8
-rw-r--r--apps/tree.c2
16 files changed, 115 insertions, 180 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index e1d85a75f0..12ac54f38d 100644
--- a/apps/SOURCES
+++ b/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
diff --git a/apps/filetree.c b/apps/filetree.c
index 458d553e27..8e97a0d13c 100644
--- a/apps/filetree.c
+++ b/apps/filetree.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;
diff --git a/apps/gui/wps_engine/wps_debug.c b/apps/gui/skin_engine/wps_debug.c
index a89f61af9d..a89f61af9d 100644
--- a/apps/gui/wps_engine/wps_debug.c
+++ b/apps/gui/skin_engine/wps_debug.c
diff --git a/apps/gui/wps_engine/wps_display.c b/apps/gui/skin_engine/wps_display.c
index c74e2cedfa..98050093c4 100644
--- a/apps/gui/wps_engine/wps_display.c
+++ b/apps/gui/skin_engine/wps_display.c
@@ -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)
- show_remote_wps_backdrop();
- else if (screen == SCREEN_MAIN)
+ if (display->screen_type == SCREEN_REMOTE)
+ show_remote_wps_backdrop();
+ else if (display->screen_type == SCREEN_MAIN)
#endif
#if LCD_DEPTH > 1
- show_wps_backdrop();
+ 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++)
{
diff --git a/apps/gui/wps_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index ce9b4d3d46..2dcaa504bb 100644
--- a/apps/gui/wps_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -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);
diff --git a/apps/gui/wps_engine/wps_parser.c b/apps/gui/skin_engine/wps_parser.c
index 91c63059b0..a3e5f6861d 100644
--- a/apps/gui/wps_engine/wps_parser.c
+++ b/apps/gui/skin_engine/wps_parser.c
@@ -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|
@@ -1205,7 +1203,7 @@ static int parse_touchregion(const char *wps_bufptr,
/* Check there is a terminating | */
if (*ptr != '|')
return WPS_ERROR_INVALID_PARAM;
-
+
/* should probably do some bounds checking here with the viewport... but later */
region = &wps_data->touchregion[wps_data->touchregion_count];
region->action = ACTION_NONE;
@@ -1214,41 +1212,28 @@ 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
+ i = 0;
+ if (*action == '&')
{
- region->type = WPS_TOUCHREGION_ACTION;
-
- if (*action == '&')
- {
- action++;
- region->repeat = true;
- }
- else
- region->repeat = false;
-
- i = 0;
- imax = ARRAYLEN(touchactions);
- while ((region->action == ACTION_NONE) &&
- (i < imax))
- {
- /* try to match with one of our touchregion screens */
- int len = strlen(touchactions[i].s);
- if (!strncmp(touchactions[i].s, action, len)
- && *(action+len) == '|')
- region->action = touchactions[i].action;
- i++;
- }
- if (region->action == ACTION_NONE)
- return WPS_ERROR_INVALID_PARAM;
+ action++;
+ region->repeat = true;
}
+ else
+ region->repeat = false;
+ imax = ARRAYLEN(touchactions);
+ while ((region->action == ACTION_NONE) &&
+ (i < imax))
+ {
+ /* try to match with one of our touchregion screens */
+ int len = strlen(touchactions[i].s);
+ if (!strncmp(touchactions[i].s, action, len)
+ && *(action+len) == '|')
+ region->action = touchactions[i].action;
+ i++;
+ }
+ 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;
diff --git a/apps/gui/wps_engine/wps_tokens.c b/apps/gui/skin_engine/wps_tokens.c
index 3852251916..b1163aa88a 100644
--- a/apps/gui/wps_engine/wps_tokens.c
+++ b/apps/gui/skin_engine/wps_tokens.c
@@ -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)
{
diff --git a/apps/gui/wps_engine/wps_engine.h b/apps/gui/wps_engine/wps_engine.h
deleted file mode 100644
index fe034f9138..0000000000
--- a/apps/gui/wps_engine/wps_engine.h
+++ /dev/null
@@ -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
diff --git a/apps/iap.c b/apps/iap.c
index f7a808d8b2..8dfef9516f 100644
--- a/apps/iap.c
+++ b/apps/iap.c
@@ -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"
diff --git a/apps/main.c b/apps/main.c
index 2cf9ce7175..d0fba3fcce 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -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"
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index 4009566c44..b535662f13 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -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};
diff --git a/apps/misc.c b/apps/misc.c
index 2e7051cbd3..b091cc6a6f 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -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
diff --git a/apps/recorder/albumart.h b/apps/recorder/albumart.h
index 82e0b79aec..d1c2dfa7bd 100644
--- a/apps/recorder/albumart.h
+++ b/apps/recorder/albumart.h
@@ -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.
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 1c86b6fe23..03e63f9077 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -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"
diff --git a/apps/settings.c b/apps/settings.c
index 800cc59a56..8835b95b12 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -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
diff --git a/apps/tree.c b/apps/tree.c
index 71ec83ed1a..667aea0572 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -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"