diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-10-02 21:05:32 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-10-18 12:56:28 +0100 |
commit | 14fbefdf390d397a13b31e2b58b4615d794ff709 (patch) | |
tree | 6718352d2d32505f6782c26348edec739aeaa0f9 /apps/gui/skin_engine | |
parent | 13da1ba785b1f06bacae06da422ac2cf2ea5eb76 (diff) | |
download | rockbox-14fbefdf390d397a13b31e2b58b4615d794ff709.tar.gz rockbox-14fbefdf390d397a13b31e2b58b4615d794ff709.zip |
Move skin global state to the WPS
This state is actually specific to the WPS and it makes more
sense to put it there.
Change-Id: I5dfee237fdcbae944806501ff3127a930820d68a
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 6 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_engine.c | 6 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_engine.h | 1 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_render.c | 5 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 9 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 22 |
6 files changed, 10 insertions, 39 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 3e3f203f9a..49375829e6 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -65,7 +65,7 @@ | |||
65 | #endif | 65 | #endif |
66 | #include "root_menu.h" | 66 | #include "root_menu.h" |
67 | 67 | ||
68 | 68 | #include "wps.h" | |
69 | #include "wps_internals.h" | 69 | #include "wps_internals.h" |
70 | #include "skin_engine.h" | 70 | #include "skin_engine.h" |
71 | #include "statusbar-skinned.h" | 71 | #include "statusbar-skinned.h" |
@@ -83,7 +83,7 @@ void skin_update(enum skinnable_screens skin, enum screen_type screen, | |||
83 | struct gui_wps *gwps = skin_get_gwps(skin, screen); | 83 | struct gui_wps *gwps = skin_get_gwps(skin, screen); |
84 | /* This maybe shouldnt be here, | 84 | /* This maybe shouldnt be here, |
85 | * This is also safe for skined screen which dont use the id3 */ | 85 | * This is also safe for skined screen which dont use the id3 */ |
86 | struct mp3entry *id3 = skin_get_global_state()->id3; | 86 | struct mp3entry *id3 = get_wps_state()->id3; |
87 | bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false); | 87 | bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false); |
88 | if (cuesheet_update) | 88 | if (cuesheet_update) |
89 | skin_request_full_update(skin); | 89 | skin_request_full_update(skin); |
@@ -162,7 +162,7 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) | |||
162 | { | 162 | { |
163 | struct screen *display = gwps->display; | 163 | struct screen *display = gwps->display; |
164 | struct viewport *vp = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->vp); | 164 | struct viewport *vp = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->vp); |
165 | struct wps_state *state = skin_get_global_state(); | 165 | struct wps_state *state = get_wps_state(); |
166 | struct mp3entry *id3 = state->id3; | 166 | struct mp3entry *id3 = state->id3; |
167 | int x = pb->x, y = pb->y, width = pb->width, height = pb->height; | 167 | int x = pb->x, y = pb->y, width = pb->width, height = pb->height; |
168 | unsigned long length, end; | 168 | unsigned long length, end; |
diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c index a3ad85fd6e..c007ed35d4 100644 --- a/apps/gui/skin_engine/skin_engine.c +++ b/apps/gui/skin_engine/skin_engine.c | |||
@@ -53,7 +53,6 @@ static bool skins_initialised = false; | |||
53 | static char* get_skin_filename(char *buf, size_t buf_size, | 53 | static char* get_skin_filename(char *buf, size_t buf_size, |
54 | enum skinnable_screens skin, enum screen_type screen); | 54 | enum skinnable_screens skin, enum screen_type screen); |
55 | 55 | ||
56 | struct wps_state wps_state = { .id3 = NULL }; | ||
57 | static struct gui_skin_helper { | 56 | static struct gui_skin_helper { |
58 | int (*preproccess)(enum screen_type screen, struct wps_data *data); | 57 | int (*preproccess)(enum screen_type screen, struct wps_data *data); |
59 | int (*postproccess)(enum screen_type screen, struct wps_data *data); | 58 | int (*postproccess)(enum screen_type screen, struct wps_data *data); |
@@ -310,11 +309,6 @@ struct gui_wps *skin_get_gwps(enum skinnable_screens skin, enum screen_type scre | |||
310 | return &skins[skin][screen].gui_wps; | 309 | return &skins[skin][screen].gui_wps; |
311 | } | 310 | } |
312 | 311 | ||
313 | struct wps_state *skin_get_global_state(void) | ||
314 | { | ||
315 | return &wps_state; | ||
316 | } | ||
317 | |||
318 | /* This is called to find out if we the screen needs a full update. | 312 | /* This is called to find out if we the screen needs a full update. |
319 | * if true you MUST do a full update as the next call will return false */ | 313 | * if true you MUST do a full update as the next call will return false */ |
320 | bool skin_do_full_update(enum skinnable_screens skin, | 314 | bool skin_do_full_update(enum skinnable_screens skin, |
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h index d7efb5b888..a685f4f072 100644 --- a/apps/gui/skin_engine/skin_engine.h +++ b/apps/gui/skin_engine/skin_engine.h | |||
@@ -85,7 +85,6 @@ int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout); | |||
85 | void skin_load(enum skinnable_screens skin, enum screen_type screen, | 85 | void skin_load(enum skinnable_screens skin, enum screen_type screen, |
86 | const char *buf, bool isfile); | 86 | const char *buf, bool isfile); |
87 | struct gui_wps *skin_get_gwps(enum skinnable_screens skin, enum screen_type screen); | 87 | struct gui_wps *skin_get_gwps(enum skinnable_screens skin, enum screen_type screen); |
88 | struct wps_state *skin_get_global_state(void); | ||
89 | void gui_sync_skin_init(void); | 88 | void gui_sync_skin_init(void); |
90 | 89 | ||
91 | void skin_unload_all(void); | 90 | void skin_unload_all(void); |
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c index 2238bd9bec..e5d2078177 100644 --- a/apps/gui/skin_engine/skin_render.c +++ b/apps/gui/skin_engine/skin_render.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include "root_menu.h" | 50 | #include "root_menu.h" |
51 | #include "misc.h" | 51 | #include "misc.h" |
52 | #include "list.h" | 52 | #include "list.h" |
53 | #include "wps.h" | ||
53 | 54 | ||
54 | 55 | ||
55 | #define MAX_LINE 1024 | 56 | #define MAX_LINE 1024 |
@@ -956,8 +957,8 @@ void skin_render_playlistviewer(struct playlistviewer* viewer, | |||
956 | else | 957 | else |
957 | #endif | 958 | #endif |
958 | { | 959 | { |
959 | struct cuesheet *cue = skin_get_global_state()->id3 ? | 960 | struct wps_state *state = get_wps_state(); |
960 | skin_get_global_state()->id3->cuesheet : NULL; | 961 | struct cuesheet *cue = state->id3 ? state->id3->cuesheet : NULL; |
961 | cur_pos = playlist_get_display_index(); | 962 | cur_pos = playlist_get_display_index(); |
962 | max = playlist_amount()+1; | 963 | max = playlist_amount()+1; |
963 | if (cue) | 964 | if (cue) |
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 0101a5e01e..a1d0a4b840 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -66,11 +66,10 @@ | |||
66 | #include "fixedpoint.h" | 66 | #include "fixedpoint.h" |
67 | #endif | 67 | #endif |
68 | #include "list.h" | 68 | #include "list.h" |
69 | #include "wps.h" | ||
69 | 70 | ||
70 | #define NOINLINE __attribute__ ((noinline)) | 71 | #define NOINLINE __attribute__ ((noinline)) |
71 | 72 | ||
72 | extern struct wps_state wps_state; | ||
73 | |||
74 | static const char* get_codectype(const struct mp3entry* id3) | 73 | static const char* get_codectype(const struct mp3entry* id3) |
75 | { | 74 | { |
76 | if (id3 && id3->codectype < AFMT_NUM_CODECS) { | 75 | if (id3 && id3->codectype < AFMT_NUM_CODECS) { |
@@ -228,7 +227,7 @@ static const char* get_filename_token(struct wps_token *token, char* filename, | |||
228 | const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, | 227 | const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, |
229 | char *filename, char *buf, int buf_size, int limit, int *intval) | 228 | char *filename, char *buf, int buf_size, int limit, int *intval) |
230 | { | 229 | { |
231 | struct wps_state *state = &wps_state; | 230 | struct wps_state *state = get_wps_state(); |
232 | if (id3) | 231 | if (id3) |
233 | { | 232 | { |
234 | unsigned long length = id3->length; | 233 | unsigned long length = id3->length; |
@@ -540,7 +539,7 @@ const char *get_radio_token(struct wps_token *token, int preset_offset, | |||
540 | static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename) | 539 | static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename) |
541 | { | 540 | { |
542 | struct mp3entry* pid3 = NULL; | 541 | struct mp3entry* pid3 = NULL; |
543 | struct wps_state *state = skin_get_global_state(); | 542 | struct wps_state *state = get_wps_state(); |
544 | struct cuesheet *cue = state->id3 ? state->id3->cuesheet : NULL; | 543 | struct cuesheet *cue = state->id3 ? state->id3->cuesheet : NULL; |
545 | const char *fname = NULL; | 544 | const char *fname = NULL; |
546 | if (cue && cue->curr_track_idx + offset < cue->track_count) | 545 | if (cue && cue->curr_track_idx + offset < cue->track_count) |
@@ -678,7 +677,7 @@ const char *get_token_value(struct gui_wps *gwps, | |||
678 | return NULL; | 677 | return NULL; |
679 | 678 | ||
680 | struct wps_data *data = gwps->data; | 679 | struct wps_data *data = gwps->data; |
681 | struct wps_state *state = skin_get_global_state(); | 680 | struct wps_state *state = get_wps_state(); |
682 | struct mp3entry *id3; /* Think very carefully about using this. | 681 | struct mp3entry *id3; /* Think very carefully about using this. |
683 | maybe get_id3_token() is the better place? */ | 682 | maybe get_id3_token() is the better place? */ |
684 | const char *out_text = NULL; | 683 | const char *out_text = NULL; |
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index 2aedff752b..0ae2e24235 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h | |||
@@ -393,28 +393,6 @@ static inline char* get_skin_buffer(struct wps_data* data) | |||
393 | 393 | ||
394 | /* wps_data end */ | 394 | /* wps_data end */ |
395 | 395 | ||
396 | /* wps_state | ||
397 | holds the data which belongs to the current played track, | ||
398 | the track which will be played afterwards, current path to the track | ||
399 | and some status infos */ | ||
400 | struct wps_state | ||
401 | { | ||
402 | struct mp3entry* id3; | ||
403 | struct mp3entry* nid3; | ||
404 | int ff_rewind_count; | ||
405 | bool paused; | ||
406 | }; | ||
407 | |||
408 | /* change the ff/rew-status | ||
409 | if ff_rew = true then we are in skipping mode | ||
410 | else we are in normal mode */ | ||
411 | /* void wps_state_update_ff_rew(bool ff_rew); Currently unused */ | ||
412 | |||
413 | /* change the tag-information of the current played track | ||
414 | and the following track */ | ||
415 | /* void wps_state_update_id3_nid3(struct mp3entry *id3, struct mp3entry *nid3); Currently unused */ | ||
416 | /* wps_state end*/ | ||
417 | |||
418 | /* gui_wps | 396 | /* gui_wps |
419 | defines a wps with its data, state, | 397 | defines a wps with its data, state, |
420 | and the screen on which the wps-content should be drawn */ | 398 | and the screen on which the wps-content should be drawn */ |