Viewported quickscreen (take 2 :D) (FS#8553)

- no customization support
- no top item
- much better use of the screen
- deprecates 20 odd lang strings (the QS can now use the regular lang strings and user font)


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17315 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2008-05-03 12:30:40 +00:00
parent 6be91cdc8b
commit ea664e0647
11 changed files with 399 additions and 411 deletions

View file

@ -60,7 +60,9 @@ gui/bitmap/list.c
gui/charcell/list.c gui/charcell/list.c
#endif #endif
gui/option_select.c gui/option_select.c
#ifdef HAVE_QUICKSCREEN
gui/quickscreen.c gui/quickscreen.c
#endif
gui/scrollbar.c gui/scrollbar.c
gui/splash.c gui/splash.c
gui/statusbar.c gui/statusbar.c

View file

@ -57,6 +57,7 @@
#include "ata_idle_notify.h" #include "ata_idle_notify.h"
#include "root_menu.h" #include "root_menu.h"
#include "backdrop.h" #include "backdrop.h"
#include "quickscreen.h"
/* currently only on wps_state is needed */ /* currently only on wps_state is needed */
struct wps_state wps_state; struct wps_state wps_state;

View file

@ -60,7 +60,7 @@ static const char *unit_strings[] =
/* these two vars are needed so arbitrary values can be added to the /* these two vars are needed so arbitrary values can be added to the
TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */ TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */
static int table_setting_oldval = 0, table_setting_array_position = 0; static int table_setting_oldval = 0, table_setting_array_position = 0;
static char *option_get_valuestring(struct settings_list *setting, char *option_get_valuestring(struct settings_list *setting,
char *buffer, int buf_len, char *buffer, int buf_len,
intptr_t temp_var) intptr_t temp_var)
{ {
@ -210,56 +210,37 @@ static int option_talk(int selected_item, void * data)
} }
return 0; return 0;
} }
#if 0
int option_select_next_val(struct settings_list *setting,
intptr_t temp_var)
{
int val = 0;
if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
{
val = (bool)temp_var ? 0 : 1;
}
else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING)
{
struct int_setting *info = setting->int_setting;
val = (int)temp_var + info->step;
if (val > info->max)
val = info->min;
}
else if ((setting->flags & F_T_SOUND) == F_T_SOUND)
{
int setting_id = setting->sound_setting->setting;
int steps = sound_steps(setting_id);
int min = sound_min(setting_id);
int max = sound_max(setting_id);
val = (int)temp_var + steps;
if (val > max)
val = min;
}
else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING)
{
struct choice_setting *info = setting->choice_setting;
val = (int)temp_var;
if (val > info->count)
val = 0;
}
return val;
}
int option_select_prev_val(struct settings_list *setting, #ifdef HAVE_QUICKSCREEN /* only the quickscreen uses this so far */
intptr_t temp_var) void option_select_next_val(struct settings_list *setting,
bool previous, bool apply)
{ {
int val = 0; int val = 0;
int *value = setting->setting;
if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
{ {
val = (bool)temp_var ? 0 : 1; *(bool*)value = !*(bool*)value;
if (apply && setting->bool_setting->option_callback)
setting->bool_setting->option_callback(*(bool*)value);
return;
} }
else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING)
{ {
struct int_setting *info = setting->int_setting; struct int_setting *info = (struct int_setting *)setting->int_setting;
val = (int)temp_var - info->step; if (!previous)
if (val < info->min) {
val = info->max; val = *value + info->step;
if (val > info->max)
val = info->min;
}
else
{
val = *value - info->step;
if (val < info->min)
val = info->max;
}
if (apply && info->option_callback)
info->option_callback(*(int*)value);
} }
else if ((setting->flags & F_T_SOUND) == F_T_SOUND) else if ((setting->flags & F_T_SOUND) == F_T_SOUND)
{ {
@ -267,18 +248,39 @@ int option_select_prev_val(struct settings_list *setting,
int steps = sound_steps(setting_id); int steps = sound_steps(setting_id);
int min = sound_min(setting_id); int min = sound_min(setting_id);
int max = sound_max(setting_id); int max = sound_max(setting_id);
val = (int)temp_var -+ steps; if (!previous)
if (val < min) {
val = max; val = *value + steps;
if (val >= max)
val = min;
}
else
{
val = *value - steps;
if (val < min)
val = max;
}
} }
else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING)
{ {
struct choice_setting *info = setting->choice_setting; struct choice_setting *info = (struct choice_setting *)setting->choice_setting;
val = (int)temp_var; val = *value + 1;
if (val < 0) if (!previous)
val = info->count - 1; {
val = *value + 1;
if (val >= info->count)
val = 0;
}
else
{
val = *value - 1;
if (val < 0)
val = info->count-1;
}
if (apply && info->option_callback)
info->option_callback(*(int*)value);
} }
return val; *value = val;
} }
#endif #endif

View file

@ -69,4 +69,10 @@ extern void option_select_next(struct option_select * opt);
extern void option_select_prev(struct option_select * opt); extern void option_select_prev(struct option_select * opt);
void option_select_next_val(struct settings_list *setting,
bool previous, bool apply);
char *option_get_valuestring(struct settings_list *setting,
char *buffer, int buf_len,
intptr_t temp_var);
#endif /* _GUI_OPTION_SELECT_H_ */ #endif /* _GUI_OPTION_SELECT_H_ */

View file

@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/ * \/ \/ \/ \/ \/
* $Id$ * $Id$
* *
* Copyright (C) 2005 by Kevin Ferrare * Copyright (C) 2008 by Jonathan Gordon
* *
* All files in this archive are subject to the GNU General Public License. * All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement. * See the file COPYING in the source tree root for full license agreement.
@ -17,11 +17,9 @@
* *
****************************************************************************/ ****************************************************************************/
#include "quickscreen.h"
#ifdef HAVE_QUICKSCREEN
#include <stdio.h> #include <stdio.h>
#include "config.h"
#include "system.h" #include "system.h"
#include "icons.h" #include "icons.h"
#include "textarea.h" #include "textarea.h"
@ -30,109 +28,199 @@
#include "misc.h" #include "misc.h"
#include "statusbar.h" #include "statusbar.h"
#include "action.h" #include "action.h"
#include "settings_list.h"
#include "lang.h"
#include "playlist.h"
#include "dsp.h"
#include "viewport.h"
#include "audio.h"
#include "quickscreen.h"
void gui_quickscreen_init(struct gui_quickscreen * qs, static struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT];
struct option_select *left_option, static struct viewport vp_icons[NB_SCREENS];
struct option_select *bottom_option, /* vp_icons will be used like this:
struct option_select *right_option, the side icons will be aligned to the top of this vp and to their sides
quickscreen_callback callback) the bottom icon wil be aligned center and at the bottom of this vp */
#define MIN_LINES 4
#define MAX_NEEDED_LINES 8
#define CENTER_MARGIN 10 /* pixels between the 2 center items minimum */
#define CENTER_ICONAREA_WIDTH (CENTER_MARGIN+8*2)
static void quickscreen_fix_viewports(struct gui_quickscreen *qs,
struct screen *display,
struct viewport *parent)
{ {
qs->left_option=left_option; int char_height, i, screen = display->screen_type;
qs->bottom_option=bottom_option; int left_width, right_width, bottom_lines = 3;
qs->right_option=right_option; unsigned char *s;
qs->callback=callback; int nb_lines = viewport_get_nb_lines(parent);
char_height = parent->height/nb_lines;
vp_icons[screen] = *parent;
vps[screen][QUICKSCREEN_BOTTOM] = *parent;
if (nb_lines <= MIN_LINES) /* make the bottom item use 1 line */
bottom_lines = 1;
else
bottom_lines = 2;
vps[screen][QUICKSCREEN_BOTTOM].height = bottom_lines*char_height;
vps[screen][QUICKSCREEN_BOTTOM].y = parent->y + parent->height - bottom_lines*char_height;
if (nb_lines >= MAX_NEEDED_LINES)
{
vps[screen][QUICKSCREEN_BOTTOM].y -= char_height;
}
/* adjust the left/right items widths to fit the screen nicely */
s = P2STR(ID2P(qs->items[QUICKSCREEN_LEFT]->lang_id));
left_width = display->getstringsize(s, NULL, NULL);
s = P2STR(ID2P(qs->items[QUICKSCREEN_RIGHT]->lang_id));
right_width = display->getstringsize(s, NULL, NULL);
nb_lines -= bottom_lines;
vps[screen][QUICKSCREEN_LEFT] = *parent;
vps[screen][QUICKSCREEN_RIGHT] = *parent;
vps[screen][QUICKSCREEN_LEFT].x = parent->x;
if (nb_lines <= MIN_LINES)
i = 0;
else
i = nb_lines/2;
vps[screen][QUICKSCREEN_LEFT].y = parent->y + (i*char_height);
vps[screen][QUICKSCREEN_RIGHT].y = parent->y + (i*char_height);
if (nb_lines >= 3)
i = 3*char_height;
else
i = nb_lines*char_height;
vps[screen][QUICKSCREEN_LEFT].height = i;
vps[screen][QUICKSCREEN_RIGHT].height = i;
vp_icons[screen].y = vps[screen][QUICKSCREEN_LEFT].y + (char_height/2);
vp_icons[screen].height = vps[screen][QUICKSCREEN_BOTTOM].y - vp_icons[screen].y;
if (left_width + right_width > display->width - CENTER_MARGIN) /* scrolling needed */
{
int width = (parent->width - CENTER_ICONAREA_WIDTH)/2;
vps[screen][QUICKSCREEN_LEFT].width = width;
vps[screen][QUICKSCREEN_RIGHT].width = width;
vps[screen][QUICKSCREEN_RIGHT].x = parent->x+parent->width - width;
vp_icons[screen].x = parent->x + width;
vp_icons[screen].width = CENTER_ICONAREA_WIDTH;
}
else
{
int width, pad = 0;
if (left_width > right_width)
width = left_width;
else
width = right_width;
width += CENTER_MARGIN;
if (width*2 < parent->width/2)
{
width += parent->width/6;
/* add some padding on the edges */
pad = CENTER_MARGIN;
}
vps[screen][QUICKSCREEN_LEFT].width = width;
vps[screen][QUICKSCREEN_RIGHT].width = width;
vps[screen][QUICKSCREEN_RIGHT].x = parent->x + parent->width - width;
vp_icons[screen].x = parent->x + width;
if (pad)
{
vp_icons[screen].x += pad;
vps[screen][QUICKSCREEN_LEFT].x += pad;
vps[screen][QUICKSCREEN_RIGHT].x -= pad;
/* need to add the pad to the bottom to make it all centered nicely */
vps[screen][QUICKSCREEN_BOTTOM].x += pad;
vps[screen][QUICKSCREEN_BOTTOM].width -= pad;
}
vp_icons[screen].width = vps[screen][QUICKSCREEN_RIGHT].x - width;
}
} }
/* static void quickscreen_draw_text(char *s, int item, bool title,
* Draws the quickscreen on a given screen struct screen *display, struct viewport *vp)
* - qs : the quickscreen
* - display : the screen to draw on
*/
static void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display)
{ {
const unsigned char *option; int nb_lines = viewport_get_nb_lines(vp);
const unsigned char *title; int w, h, line = 0, x=0;
int w, font_h; display->getstringsize(s, &w, &h);
bool statusbar = global_settings.statusbar;
#ifdef HAS_BUTTONBAR if (nb_lines > 1 && !title)
display->has_buttonbar=false; line = 1;
#endif switch (item)
gui_textarea_clear(display);
if (display->height / display->char_height < 7) /* we need at leats 7 lines */
{ {
display->setfont(FONT_SYSFIXED); case QUICKSCREEN_BOTTOM:
} x = (vp->width - w)/2;
display->getstringsize("A", NULL, &font_h); break;
case QUICKSCREEN_LEFT:
/* do these calculations once */ x = 0;
const unsigned int puts_center = display->height/2/font_h; break;
const unsigned int puts_bottom = display->height/font_h; case QUICKSCREEN_RIGHT:
const unsigned int putsxy_center = display->height/2; x = vp->width - w;
const unsigned int putsxy_bottom = display->height; break;
/* Displays the first line of text */
option=(unsigned char *)option_select_get_text(qs->left_option);
title=(unsigned char *)qs->left_option->title;
display->puts_scroll(2, puts_center-4+!statusbar, title);
display->puts_scroll(2, puts_center-3+!statusbar, option);
display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 1,
putsxy_center-(font_h*3), 7, 8);
/* Displays the second line of text */
option=(unsigned char *)option_select_get_text(qs->right_option);
title=(unsigned char *)qs->right_option->title;
display->getstringsize(title, &w, NULL);
if(w > display->width - 8)
{
display->puts_scroll(2, puts_center-2+!statusbar, title);
display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], 1,
putsxy_center-font_h, 7, 8);
} }
if (w>vp->width)
display->puts_scroll(0,line,s);
else else
{ display->putsxy(x, line*h, s);
display->putsxy(display->width - w - 12, putsxy_center-font_h, title);
display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
display->width - 8, putsxy_center-font_h, 7, 8);
}
display->getstringsize(option, &w, NULL);
if(w > display->width)
display->puts_scroll(0, puts_center-1+!statusbar, option);
else
display->putsxy(display->width -w-12, putsxy_center, option);
/* Displays the third line of text */
option=(unsigned char *)option_select_get_text(qs->bottom_option);
title=(unsigned char *)qs->bottom_option->title;
display->getstringsize(title, &w, NULL);
if(w > display->width)
display->puts_scroll(0, puts_bottom-4+!statusbar, title);
else
display->putsxy(display->width/2-w/2, putsxy_bottom-(font_h*3), title);
display->getstringsize(option, &w, NULL);
if(w > display->width)
display->puts_scroll(0, puts_bottom-3+!statusbar, option);
else
display->putsxy(display->width/2-w/2, putsxy_bottom-(font_h*2), option);
display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], display->width/2-4,
putsxy_bottom-font_h, 7, 8);
gui_textarea_update(display);
display->setfont(FONT_UI);
} }
/* static void gui_quickscreen_draw(struct gui_quickscreen *qs,
* Draws the quickscreen on all available screens struct screen *display,
* - qs : the quickscreen struct viewport *parent)
*/
static void gui_syncquickscreen_draw(struct gui_quickscreen * qs)
{ {
int i; int i;
FOR_NB_SCREENS(i) char buf[MAX_PATH];
gui_quickscreen_draw(qs, &screens[i]); unsigned char *title, *value;
void *setting;
int temp;
display->set_viewport(parent);
display->clear_viewport();
for (i=0; i<QUICKSCREEN_ITEM_COUNT; i++)
{
if (!qs->items[i])
continue;
display->set_viewport(&vps[display->screen_type][i]);
display->scroll_stop(&vps[display->screen_type][i]);
title = P2STR(ID2P(qs->items[i]->lang_id));
setting = qs->items[i]->setting;
if ((qs->items[i]->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
temp = *(bool*)setting?1:0;
else
temp = *(int*)setting;
value = option_get_valuestring((struct settings_list*)qs->items[i], buf, MAX_PATH, temp);
if (vps[display->screen_type][i].height < display->char_height*2)
{
char text[MAX_PATH];
snprintf(text, MAX_PATH, "%s: %s", title, value);
quickscreen_draw_text(text, i, true, display, &vps[display->screen_type][i]);
}
else
{
quickscreen_draw_text(title, i, true, display, &vps[display->screen_type][i]);
quickscreen_draw_text(value, i, false, display, &vps[display->screen_type][i]);
}
display->update_viewport();
}
/* draw the icons */
display->set_viewport(&vp_icons[display->screen_type]);
display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
vp_icons[display->screen_type].width - 8, 0, 7, 8);
display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 0, 0, 7, 8);
display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
(vp_icons[display->screen_type].width/2) - 4,
vp_icons[display->screen_type].height - 7, 7, 8);
display->update_viewport();
display->set_viewport(parent);
display->update_viewport();
display->set_viewport(NULL);
} }
/* /*
* Does the actions associated to the given button if any * Does the actions associated to the given button if any
* - qs : the quickscreen * - qs : the quickscreen
@ -141,48 +229,60 @@ static void gui_syncquickscreen_draw(struct gui_quickscreen * qs)
*/ */
static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button)
{ {
int item;
switch(button) switch(button)
{ {
case ACTION_QS_LEFT: case ACTION_QS_LEFT:
option_select_next(qs->left_option); item = QUICKSCREEN_LEFT;
return(true); break;
case ACTION_QS_DOWN: case ACTION_QS_DOWN:
option_select_next(qs->bottom_option); case ACTION_QS_DOWNINV:
return(true); item = QUICKSCREEN_BOTTOM;
break;
case ACTION_QS_RIGHT: case ACTION_QS_RIGHT:
option_select_next(qs->right_option); item = QUICKSCREEN_RIGHT;
return(true); break;
case ACTION_QS_DOWNINV: default:
option_select_prev(qs->bottom_option); return false;
return(true);
} }
return(false); option_select_next_val((struct settings_list *)qs->items[item], false, true);
return true;
} }
bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter)
{ {
int button; int button, i;
struct viewport vp[NB_SCREENS];
bool changed = false;
/* To quit we need either : /* To quit we need either :
* - a second press on the button that made us enter * - a second press on the button that made us enter
* - an action taken while pressing the enter button, * - an action taken while pressing the enter button,
* then release the enter button*/ * then release the enter button*/
bool can_quit=false; bool can_quit=false;
gui_syncquickscreen_draw(qs);
gui_syncstatusbar_draw(&statusbars, true); gui_syncstatusbar_draw(&statusbars, true);
FOR_NB_SCREENS(i)
{
screens[i].set_viewport(NULL);
screens[i].stop_scroll();
viewport_set_defaults(&vp[i], i);
quickscreen_fix_viewports(qs, &screens[i], &vp[i]);
gui_quickscreen_draw(qs, &screens[i], &vp[i]);
}
while (true) { while (true) {
button = get_action(CONTEXT_QUICKSCREEN,TIMEOUT_BLOCK); button = get_action(CONTEXT_QUICKSCREEN,TIMEOUT_BLOCK);
if(default_event_handler(button) == SYS_USB_CONNECTED) if(default_event_handler(button) == SYS_USB_CONNECTED)
return(true); return(true);
if(gui_quickscreen_do_button(qs, button)) if(gui_quickscreen_do_button(qs, button))
{ {
changed = true;
can_quit=true; can_quit=true;
if(qs->callback) FOR_NB_SCREENS(i)
gui_quickscreen_draw(qs, &screens[i], &vp[i]);
if (qs->callback)
qs->callback(qs); qs->callback(qs);
gui_syncquickscreen_draw(qs);
} }
else if(button==button_enter) else if(button==button_enter)
can_quit=true; can_quit=true;
@ -195,8 +295,57 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter)
gui_syncstatusbar_draw(&statusbars, false); gui_syncstatusbar_draw(&statusbars, false);
} }
return false; return changed;
} }
#endif /* HAVE_QUICKSCREEN */ bool quick_screen_quick(int button_enter)
{
struct gui_quickscreen qs;
bool oldshuffle = global_settings.playlist_shuffle;
int oldrepeat = global_settings.repeat_mode;
qs.items[QUICKSCREEN_LEFT] = find_setting(&global_settings.playlist_shuffle, NULL);
qs.items[QUICKSCREEN_RIGHT] = find_setting(&global_settings.repeat_mode, NULL);
qs.items[QUICKSCREEN_BOTTOM] = find_setting(&global_settings.dirfilter, NULL);
qs.callback = NULL;
if (gui_syncquickscreen_run(&qs, button_enter))
{
settings_save();
settings_apply(false);
/* make sure repeat/shuffle/any other nasty ones get updated */
if ( oldrepeat != global_settings.repeat_mode &&
(audio_status() & AUDIO_STATUS_PLAY) )
{
audio_flush_and_reload_tracks();
}
if (oldshuffle != global_settings.playlist_shuffle
&& audio_status() & AUDIO_STATUS_PLAY)
{
#if CONFIG_CODEC == SWCODEC
dsp_set_replaygain();
#endif
if (global_settings.playlist_shuffle)
playlist_randomise(NULL, current_tick, true);
else
playlist_sort(NULL, true);
}
}
return(0);
}
#ifdef BUTTON_F3
bool quick_screen_f3(int button_enter)
{
struct gui_quickscreen qs;
qs.items[QUICKSCREEN_LEFT] = find_setting(&global_settings.scrollbar, NULL);
qs.items[QUICKSCREEN_RIGHT] = find_setting(&global_settings.statusbar, NULL);
qs.items[QUICKSCREEN_BOTTOM] = find_setting(&global_settings.flip_display, NULL);
qs.callback = NULL;
if (gui_syncquickscreen_run(&qs, button_enter))
{
settings_save();
settings_apply(false);
}
return(0);
}
#endif /* BUTTON_F3 */

View file

@ -27,45 +27,28 @@
#include "option_select.h" #include "option_select.h"
#include "screen_access.h" #include "screen_access.h"
struct gui_quickscreen; enum QUICKSCREEN_ITEM {
/* QUICKSCREEN_LEFT = 0,
* Callback function called each time the quickscreen gets modified QUICKSCREEN_RIGHT,
* - qs : the quickscreen that did the modification QUICKSCREEN_BOTTOM,
*/ QUICKSCREEN_ITEM_COUNT,
typedef void (quickscreen_callback)(struct gui_quickscreen * qs); };
struct gui_quickscreen struct gui_quickscreen
{ {
struct option_select *left_option; const struct settings_list *items[QUICKSCREEN_ITEM_COUNT];
struct option_select *bottom_option; void (*callback)(struct gui_quickscreen * qs); /* called after a
struct option_select *right_option; item is changed */
quickscreen_callback *callback;
}; };
/*
* Initializes a quickscreen
* - qs : the quickscreen
* - left_option, bottom_option, right_option : a list of choices
* for each option
* - left_right_title : the 2nd line of the title
* on the left and on the right
* - callback : a callback function called each time the quickscreen
* gets modified
*/
void gui_quickscreen_init(struct gui_quickscreen * qs,
struct option_select *left_option,
struct option_select *bottom_option,
struct option_select *right_option,
quickscreen_callback *callback);
/*
* Runs the quickscreen on all available screens, if button_enter is released, quits
* - qs : the quickscreen
* - button_enter : button pressed at the same time the quickscreen is displayed
* returns : true if usb was connected, false otherwise
*/
bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter); bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter);
#ifdef BUTTON_F3
extern bool quick_screen_f3(int button_enter);
#endif
extern bool quick_screen_quick(int button_enter);
#endif /*_GUI_QUICK_SCREEN_H_*/ #endif /*_GUI_QUICK_SCREEN_H_*/
#endif /* HAVE_QUICKSCREEN */ #endif /* HAVE_QUICKSCREEN */

View file

@ -10089,53 +10089,53 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_SET_BOOL_YES id: LANG_SYSFONT_SET_BOOL_YES
desc: bool true representation desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Yes" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Yes" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Yes" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_SET_BOOL_NO id: LANG_SYSFONT_SET_BOOL_NO
desc: bool false representation desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "No" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "No" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "No" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_ON id: LANG_SYSFONT_ON
desc: Used in a lot of places desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "On" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "On" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "On" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
@ -10208,206 +10208,206 @@
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_SHUFFLE id: LANG_SYSFONT_SHUFFLE
desc: in settings_menu desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Shuffle" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Shuffle" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Shuffle" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_REPEAT id: LANG_SYSFONT_REPEAT
desc: in settings_menu desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Repeat" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Repeat" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Repeat" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_ALL id: LANG_SYSFONT_ALL
desc: repeat playlist once all songs have completed desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "All" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "All" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "All" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_REPEAT_ONE id: LANG_SYSFONT_REPEAT_ONE
desc: repeat one song desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "One" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "One" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "One" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_REPEAT_AB id: LANG_SYSFONT_REPEAT_AB
desc: repeat range from point A to B desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "A-B" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "A-B" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "A-B" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_FILTER id: LANG_SYSFONT_FILTER
desc: setting name for dir filter desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Show Files" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Show Files" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Show Files" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_FILTER_SUPPORTED id: LANG_SYSFONT_FILTER_SUPPORTED
desc: show all file types supported by Rockbox desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Supported" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Supported" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Supported" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_FILTER_MUSIC id: LANG_SYSFONT_FILTER_MUSIC
desc: show only music-related files desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Music" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Music" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Music" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_FILTER_PLAYLIST id: LANG_SYSFONT_FILTER_PLAYLIST
desc: show only playlist desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Playlists" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Playlists" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Playlists" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_FLIP_DISPLAY id: LANG_SYSFONT_FLIP_DISPLAY
desc: in settings_menu, option to turn display+buttos by 180 degreed desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Upside Down" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Upside Down" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Upside Down" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_SCROLL_BAR id: LANG_SYSFONT_SCROLL_BAR
desc: display menu, F3 substitute desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Scroll Bar" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Scroll Bar" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Scroll Bar" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
id: LANG_SYSFONT_STATUS_BAR id: LANG_SYSFONT_STATUS_BAR
desc: display menu, F3 substitute desc: deprecated
user: user:
<source> <source>
*: none *: none
lcd_bitmap: "Status Bar" lcd_bitmap: ""
</source> </source>
<dest> <dest>
*: none *: none
lcd_bitmap: "Status Bar" lcd_bitmap: ""
</dest> </dest>
<voice> <voice>
*: none *: none
lcd_bitmap: "Status Bar" lcd_bitmap: ""
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>

View file

@ -51,6 +51,7 @@
#include "gwps-common.h" /* for fade() */ #include "gwps-common.h" /* for fade() */
#include "audio.h" #include "audio.h"
#include "viewport.h" #include "viewport.h"
#include "quickscreen.h"
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#include "icons.h" #include "icons.h"

View file

@ -633,158 +633,6 @@ bool pitch_screen(void)
} }
#endif /* HAVE_PITCHSCREEN */ #endif /* HAVE_PITCHSCREEN */
#ifdef HAVE_QUICKSCREEN
#define bool_to_int(b)\
b?1:0
#define int_to_bool(i)\
i==0?false:true
static void quick_screen_quick_apply(struct gui_quickscreen *qs)
{
global_settings.playlist_shuffle=int_to_bool(qs->left_option->option);
global_settings.dirfilter=qs->bottom_option->option;
global_settings.repeat_mode=qs->right_option->option;
}
bool quick_screen_quick(int button_enter)
{
bool res, oldshuffle;
struct option_select left_option;
struct option_select bottom_option;
struct option_select right_option;
int oldrepeat, old_x_margin, old_y_margin;
static const struct opt_items left_items[] = {
[0]={ STR(LANG_SYSFONT_OFF) },
[1]={ STR(LANG_SYSFONT_ON) }
};
static const struct opt_items bottom_items[] = {
[SHOW_ALL]={ STR(LANG_SYSFONT_ALL) },
[SHOW_SUPPORTED]={ STR(LANG_SYSFONT_FILTER_SUPPORTED) },
[SHOW_MUSIC]={ STR(LANG_SYSFONT_FILTER_MUSIC) },
[SHOW_PLAYLIST]={ STR(LANG_SYSFONT_FILTER_PLAYLIST) },
};
static const struct opt_items right_items[] = {
[REPEAT_OFF]={ STR(LANG_SYSFONT_OFF) },
[REPEAT_ALL]={ STR(LANG_SYSFONT_ALL) },
[REPEAT_ONE]={ STR(LANG_SYSFONT_REPEAT_ONE) },
[REPEAT_SHUFFLE]={ STR(LANG_SYSFONT_SHUFFLE) },
#ifdef AB_REPEAT_ENABLE
[REPEAT_AB]={ STR(LANG_SYSFONT_REPEAT_AB) }
#endif
};
struct gui_quickscreen qs;
old_x_margin = lcd_getxmargin();
old_y_margin = lcd_getymargin();
lcd_setmargins(0, 0);
option_select_init_items(&left_option,
(char *)str(LANG_SYSFONT_SHUFFLE),
bool_to_int(global_settings.playlist_shuffle),
left_items,
2);
option_select_init_items(&bottom_option,
(char *)str(LANG_SYSFONT_FILTER),
global_settings.dirfilter,
bottom_items,
sizeof(bottom_items)/sizeof(struct opt_items));
option_select_init_items(&right_option,
(char *)str(LANG_SYSFONT_REPEAT),
global_settings.repeat_mode,
right_items,
sizeof(right_items)/sizeof(struct opt_items));
gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option,
&quick_screen_quick_apply);
oldrepeat=global_settings.repeat_mode;
oldshuffle=global_settings.playlist_shuffle;
res=gui_syncquickscreen_run(&qs, button_enter);
if(!res)
{
if ( oldrepeat != global_settings.repeat_mode &&
(audio_status() & AUDIO_STATUS_PLAY) )
audio_flush_and_reload_tracks();
if(oldshuffle != global_settings.playlist_shuffle
&& audio_status() & AUDIO_STATUS_PLAY)
{
#if CONFIG_CODEC == SWCODEC
dsp_set_replaygain();
#endif
if (global_settings.playlist_shuffle)
playlist_randomise(NULL, current_tick, true);
else
playlist_sort(NULL, true);
}
settings_save();
}
lcd_setmargins(old_x_margin, old_y_margin);
return(res);
}
#ifdef BUTTON_F3
static void quick_screen_f3_apply(struct gui_quickscreen *qs)
{
global_settings.scrollbar=int_to_bool(qs->left_option->option);
global_settings.flip_display=int_to_bool(qs->bottom_option->option);
button_set_flip(global_settings.flip_display);
lcd_set_flip(global_settings.flip_display);
global_settings.statusbar=int_to_bool(qs->right_option->option);
gui_syncstatusbar_draw(&statusbars, true);
}
bool quick_screen_f3(int button_enter)
{
bool res;
struct option_select left_option;
struct option_select bottom_option;
struct option_select right_option;
int old_x_margin, old_y_margin;
static const struct opt_items onoff_items[] = {
[0]={ STR(LANG_SYSFONT_OFF) },
[1]={ STR(LANG_SYSFONT_ON) }
};
static const struct opt_items yesno_items[] = {
[0]={ STR(LANG_SYSFONT_SET_BOOL_NO) },
[1]={ STR(LANG_SYSFONT_SET_BOOL_YES) }
};
struct gui_quickscreen qs;
old_x_margin = lcd_getxmargin();
old_y_margin = lcd_getymargin();
lcd_setmargins(0, 0);
option_select_init_items(&left_option,
str(LANG_SYSFONT_SCROLL_BAR),
bool_to_int(global_settings.scrollbar),
onoff_items,
2);
option_select_init_items(&bottom_option,
str(LANG_SYSFONT_FLIP_DISPLAY),
bool_to_int(global_settings.flip_display),
yesno_items,
2);
option_select_init_items(&right_option,
str(LANG_SYSFONT_STATUS_BAR),
bool_to_int(global_settings.statusbar),
onoff_items,
2);
gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option,
&quick_screen_f3_apply);
res=gui_syncquickscreen_run(&qs, button_enter);
if(!res)
settings_save();
lcd_setmargins(old_x_margin, old_y_margin);
return(res);
}
#endif /* BUTTON_F3 */
#endif /* CONFIG_KEYPAD in (RECORDER_PAD |IRIVER_H100_PAD | IRIVER_H300_PAD) */
#if CONFIG_CHARGING #if CONFIG_CHARGING
void charging_splash(void) void charging_splash(void)
{ {

View file

@ -40,11 +40,6 @@ int mmc_remove_request(void);
bool pitch_screen(void); bool pitch_screen(void);
#endif #endif
#ifdef BUTTON_F3
extern bool quick_screen_f3(int button_enter);
#endif
extern bool quick_screen_quick(int button_enter);
#if CONFIG_RTC #if CONFIG_RTC
bool set_time_screen(const char* title, struct tm *tm); bool set_time_screen(const char* title, struct tm *tm);
#endif #endif

View file

@ -77,6 +77,7 @@
#include "buttonbar.h" #include "buttonbar.h"
#include "textarea.h" #include "textarea.h"
#include "action.h" #include "action.h"
#include "quickscreen.h"
#include "root_menu.h" #include "root_menu.h"
#include "backdrop.h" #include "backdrop.h"