1
0
Fork 0
forked from len0rd/rockbox

FS#10406 - split the statusbar setting into one for each display, and allow the bar to be at the top or bottom of the display

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21665 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2009-07-05 18:07:58 +00:00
parent 802743a061
commit f1034e00f6
12 changed files with 128 additions and 23 deletions

View file

@ -937,7 +937,14 @@ static void statusbar_toggle_handler(void *data)
}
else
{
vp->y = STATUSBAR_HEIGHT;
bool bar_at_top = true;
#ifdef HAVE_REMOTE_LCD
if (i == SCREEN_REMOTE)
bar_at_top = global_settings.remote_statusbar != STATUSBAR_BOTTOM;
else
#endif
bar_at_top = global_settings.statusbar != STATUSBAR_BOTTOM;
vp->y = bar_at_top?STATUSBAR_HEIGHT:0;
vp->height = screens[i].lcdheight - STATUSBAR_HEIGHT;
}
}

View file

@ -263,10 +263,20 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info)))
{
struct viewport vp;
bool bar_at_top = true;
viewport_set_defaults(&vp, display->screen_type);
vp.height = STATUSBAR_HEIGHT;
vp.x = STATUSBAR_X_POS;
vp.y = STATUSBAR_Y_POS;
#ifdef HAVE_REMOTE_LCD
if (display->screen_type == SCREEN_REMOTE)
bar_at_top = global_settings.remote_statusbar != STATUSBAR_BOTTOM;
else
#endif
bar_at_top = global_settings.statusbar != STATUSBAR_BOTTOM;
if (bar_at_top)
vp.y = 0;
else
vp.y = display->lcdheight - STATUSBAR_HEIGHT;
display->set_viewport(&vp);
display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
display->fillrect(0, 0, display->getwidth(), STATUSBAR_HEIGHT);
@ -814,7 +824,7 @@ void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars,
}
}
void gui_statusbar_changed(bool enabled)
void gui_statusbar_changed(int enabled)
{
(void)enabled;
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);

View file

@ -98,6 +98,6 @@ struct gui_syncstatusbar
extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars);
extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw);
void gui_statusbar_changed(bool enabled);
void gui_statusbar_changed(int enabled);
#endif /*_GUI_STATUSBAR_H_*/

View file

@ -49,30 +49,47 @@ int viewport_get_nb_lines(struct viewport *vp)
static bool showing_bars(enum screen_type screen)
{
bool ignore = statusbar_enabled & VP_SB_IGNORE_SETTING(screen);
if (statusbar_enabled & VP_SB_ONSCREEN(screen))
{
#ifdef HAVE_LCD_BITMAP
return global_settings.statusbar ||
(statusbar_enabled & VP_SB_IGNORE_SETTING(screen));
#ifdef HAVE_REMOTE_LCD
if (screen == SCREEN_REMOTE)
return global_settings.remote_statusbar || ignore;
#endif
return global_settings.statusbar || ignore;
#else
return true;
#endif
}
return false;
}
void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
{
bool bar_at_top = true;
vp->x = 0;
vp->width = screens[screen].lcdwidth;
#ifdef HAVE_LCD_BITMAP
vp->drawmode = DRMODE_SOLID;
vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */
#ifdef HAVE_REMOTE_LCD
if (screen == SCREEN_REMOTE)
bar_at_top = global_settings.remote_statusbar != STATUSBAR_BOTTOM;
else
#endif
bar_at_top = global_settings.statusbar != STATUSBAR_BOTTOM;
vp->y = showing_bars(screen)?STATUSBAR_HEIGHT:0;
vp->height = screens[screen].lcdheight;
if (bar_at_top && showing_bars(screen))
vp->y = STATUSBAR_HEIGHT;
else
vp->y = 0;
#else
vp->y = 0;
#endif
vp->height = screens[screen].lcdheight - vp->y;
vp->height = screens[screen].lcdheight - (showing_bars(screen)?STATUSBAR_HEIGHT:0);
#ifdef HAVE_REMOTE_LCD
/* We only need this test if there is a remote LCD */
@ -136,5 +153,12 @@ void viewportmanager_draw_statusbars(void* data)
void viewportmanager_statusbar_changed(void* data)
{
(void)data;
statusbar_enabled = 0;
if (global_settings.statusbar != STATUSBAR_OFF)
statusbar_enabled = VP_SB_ONSCREEN(SCREEN_MAIN);
#ifdef HAVE_REMOTE_LCD
if (global_settings.remote_statusbar != STATUSBAR_OFF)
statusbar_enabled |= VP_SB_ONSCREEN(SCREEN_REMOTE);
#endif
viewportmanager_set_statusbar(statusbar_enabled);
}

View file

@ -12559,3 +12559,48 @@
touchscreen: "Reset Calibration"
</voice>
</phrase>
<phrase>
id: LANG_STATUSBAR_TOP
desc: in Settings -> General -> Display -> statusbar
user: core
<source>
*: "Top"
</source>
<dest>
*: "Top"
</dest>
<voice>
*: "Top"
</voice>
</phrase>
<phrase>
id: LANG_STATUSBAR_BOTTOM
desc: in Settings -> General -> Display -> statusbar
user: core
<source>
*: "Bottom"
</source>
<dest>
*: "Bottom"
</dest>
<voice>
*: "Bottom"
</voice>
</phrase>
<phrase>
id: LANG_REMOTE_STATUSBAR
desc: in Settings -> General -> Display -> statusbar
user: core
<source>
*: none
remote: "Remote Statusbar"
</source>
<dest>
*: none
remote: "Remote Statusbar"
</dest>
<voice>
*: none
remote: "Remote Statusbar"
</voice>
</phrase>

View file

@ -321,6 +321,9 @@ static int statusbar_callback(int action,const struct menu_item_ex *this_item)
}
MENUITEM_SETTING(scrollbar_item, &global_settings.scrollbar, NULL);
MENUITEM_SETTING(statusbar, &global_settings.statusbar, statusbar_callback);
#ifdef HAVE_REMOTE_LCD
MENUITEM_SETTING(remote_statusbar, &global_settings.remote_statusbar, statusbar_callback);
#endif
#if CONFIG_KEYPAD == RECORDER_PAD
MENUITEM_SETTING(buttonbar, &global_settings.buttonbar, NULL);
#endif
@ -328,6 +331,9 @@ MENUITEM_SETTING(volume_type, &global_settings.volume_type, NULL);
MENUITEM_SETTING(battery_display, &global_settings.battery_display, NULL);
MAKE_MENU(bars_menu, ID2P(LANG_BARS_MENU), 0, Icon_NOICON,
&scrollbar_item, &statusbar,
#ifdef HAVE_REMOTE_LCD
&remote_statusbar,
#endif
#if CONFIG_KEYPAD == RECORDER_PAD
&buttonbar,
#endif

View file

@ -468,6 +468,7 @@ static const struct plugin_api rockbox_api = {
playlist_remove_all_tracks,
playlist_create,
playlist_insert_track,
playlist_insert_directory,
playlist_shuffle,
PREFIX(audio_play),
audio_stop,
@ -658,7 +659,6 @@ static const struct plugin_api rockbox_api = {
appsversion,
/* new stuff at the end, sort into place next time
the API gets incompatible */
playlist_insert_directory,
};
int plugin_load(const char* plugin, const void* parameter)

View file

@ -128,12 +128,12 @@ void* plugin_get_buffer(size_t *buffer_size);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 158
#define PLUGIN_API_VERSION 159
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 157
#define PLUGIN_MIN_API_VERSION 159
/* plugin return codes */
enum plugin_status {
@ -595,6 +595,9 @@ struct plugin_api {
int (*playlist_create)(const char *dir, const char *file);
int (*playlist_insert_track)(struct playlist_info* playlist,
const char *filename, int position, bool queue, bool sync);
int (*playlist_insert_directory)(struct playlist_info* playlist,
const char *dirname, int position, bool queue,
bool recurse);
int (*playlist_shuffle)(int random_seed, int start_index);
void (*audio_play)(long offset);
void (*audio_stop)(void);
@ -821,9 +824,6 @@ struct plugin_api {
const char *appsversion;
/* new stuff at the end, sort into place next time
the API gets incompatible */
int (*playlist_insert_directory)(struct playlist_info* playlist,
const char *dirname, int position, bool queue,
bool recurse);
};
/* plugin header */

View file

@ -1112,14 +1112,12 @@ bool recording_screen(bool no_source)
else
compact_view[i] = false;
}
vp_list[i] = *v; /* get a copy now so it can be sized more easily */
v->height = (font_get(v->font)->height)*(compact_view[i] ? 3 : 4);
/* list section, rest of the screen */
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 */
vp_list[i].y = vp_top[i].y + vp_top[i].height;
vp_list[i].height -= vp_list[i].y;
screens[i].set_viewport(&vp_top[i]); /* req for next calls */
screens[i].getstringsize("W", &w, &h);

View file

@ -981,6 +981,7 @@ void settings_apply(bool read_disk)
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
enc_global_settings_apply();
#endif
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);
list_init_viewports(NULL);
send_event(GUI_EVENT_ACTIONUPDATE, (void*)true);
}

View file

@ -149,6 +149,9 @@ enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE, REPLAYGAIN_OF
/* show path types */
enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL };
/* statusbar visilibility */
enum { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM };
/* Alarm settings */
#ifdef HAVE_RTC_ALARM
enum { ALARM_START_WPS = 0,
@ -535,7 +538,10 @@ struct user_settings
int volume_type; /* how volume is displayed: 0=graphic, 1=percent */
int battery_display; /* how battery is displayed: 0=graphic, 1=percent */
bool show_icons; /* 0=hide 1=show */
bool statusbar; /* 0=hide, 1=show */
int statusbar; /* STATUSBAR_* enum values */
#ifdef HAVE_REMOTE_LCD
int remote_statusbar;
#endif
#if CONFIG_KEYPAD == RECORDER_PAD
bool buttonbar; /* 0=hide, 1=show */

View file

@ -591,8 +591,16 @@ const struct settings_list settings[] = {
ID2P(LANG_INVERT_CURSOR_POINTER),
ID2P(LANG_INVERT_CURSOR_BAR)),
#endif
OFFON_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar,
LANG_STATUS_BAR, true,"statusbar", gui_statusbar_changed),
CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar,
LANG_STATUS_BAR, STATUSBAR_TOP, "statusbar","off,top,bottom",
gui_statusbar_changed, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP),
ID2P(LANG_STATUSBAR_BOTTOM)),
#ifdef HAVE_REMOTE_LCD
CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, remote_statusbar,
LANG_REMOTE_STATUSBAR, STATUSBAR_TOP, "remote statusbar","off,top,bottom",
gui_statusbar_changed, 3, ID2P(LANG_OFF), ID2P(LANG_STATUSBAR_TOP),
ID2P(LANG_STATUSBAR_BOTTOM)),
#endif
OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true,"scrollbar", NULL),
#if CONFIG_KEYPAD == RECORDER_PAD
OFFON_SETTING(0,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL),