diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2009-07-05 18:07:58 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2009-07-05 18:07:58 +0000 |
commit | f1034e00f6196c810466da66a9a24bf2e5f61272 (patch) | |
tree | 2e49089d421a75030c3a8e30503907a7f20eb511 | |
parent | 802743a061e01150db544c8e072cd794731b18a7 (diff) |
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
-rw-r--r-- | apps/gui/gwps.c | 9 | ||||
-rw-r--r-- | apps/gui/statusbar.c | 14 | ||||
-rw-r--r-- | apps/gui/statusbar.h | 2 | ||||
-rw-r--r-- | apps/gui/viewport.c | 34 | ||||
-rw-r--r-- | apps/lang/english.lang | 45 | ||||
-rw-r--r-- | apps/menus/display_menu.c | 6 | ||||
-rw-r--r-- | apps/plugin.c | 2 | ||||
-rw-r--r-- | apps/plugin.h | 10 | ||||
-rw-r--r-- | apps/recorder/recording.c | 8 | ||||
-rw-r--r-- | apps/settings.c | 1 | ||||
-rw-r--r-- | apps/settings.h | 8 | ||||
-rw-r--r-- | apps/settings_list.c | 12 |
12 files changed, 128 insertions, 23 deletions
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 0b41f88cdc..64b8939ee9 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c @@ -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; } } diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index ec804ab41f..dca4169603 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c @@ -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); diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h index f6203c22d9..db0ff9d780 100644 --- a/apps/gui/statusbar.h +++ b/apps/gui/statusbar.h @@ -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_*/ diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index 22d3eb3eb8..67f63e349b 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -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 */ - - vp->y = showing_bars(screen)?STATUSBAR_HEIGHT:0; +#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->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); } diff --git a/apps/lang/english.lang b/apps/lang/english.lang index f75cdae3a4..7d1e242c6c 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -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> diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c index aee9c1828d..05b5bd268d 100644 --- a/apps/menus/display_menu.c +++ b/apps/menus/display_menu.c @@ -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 diff --git a/apps/plugin.c b/apps/plugin.c index ff80776f7e..d6a5d067ce 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -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) diff --git a/apps/plugin.h b/apps/plugin.h index db16800309..f3d4c23e8a 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -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 */ diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 393bd356b8..d7ab9c795c 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -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); diff --git a/apps/settings.c b/apps/settings.c index 4616a7f49d..e2f40a1f44 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -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); } diff --git a/apps/settings.h b/apps/settings.h index e0ee4164bf..93a998ea1c 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -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 */ diff --git a/apps/settings_list.c b/apps/settings_list.c index 9e40cbd301..9cfd9aafc5 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -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), |