forked from len0rd/rockbox
Decouple the statusbar drawing from the rest of the screen drawing. it is not drawn roughly 4x per second automatically.
viewport_Set_defaults() will setup the given viewport with the correct "full screen" dimensions (so start at 0,0 if statusbars are disabled or 0,8 if they are enabled.) All screens should keep the statusbar enabled, but if you really want to ignore the user setting you can disbaled it with viewportmanager_set_statusbar(false). This commit also includes some menu/list viewport cleanups from kugel in FS#9603 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19622 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
54919ae917
commit
e385ee18ce
46 changed files with 294 additions and 264 deletions
|
@ -193,7 +193,6 @@ bool alarm_screen(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_NONE:
|
case ACTION_NONE:
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
hour_wrapped = false;
|
hour_wrapped = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ enum {
|
||||||
enum {
|
enum {
|
||||||
GUI_EVENT_THEME_CHANGED = (EVENT_CLASS_GUI|1),
|
GUI_EVENT_THEME_CHANGED = (EVENT_CLASS_GUI|1),
|
||||||
GUI_EVENT_STATUSBAR_TOGGLE,
|
GUI_EVENT_STATUSBAR_TOGGLE,
|
||||||
|
GUI_EVENT_FOURHERTZ,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -198,7 +198,6 @@ bool bookmark_autobookmark(void)
|
||||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||||
show_remote_main_backdrop();
|
show_remote_main_backdrop();
|
||||||
#endif
|
#endif
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES)
|
if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES)
|
||||||
{
|
{
|
||||||
if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK)
|
if (global_settings.autocreatebookmark == BOOKMARK_RECENT_ONLY_ASK)
|
||||||
|
@ -680,11 +679,9 @@ static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resu
|
||||||
gui_synclist_set_voice_callback(&list, bookmark_list_voice_cb);
|
gui_synclist_set_voice_callback(&list, bookmark_list_voice_cb);
|
||||||
gui_synclist_set_title(&list, str(LANG_BOOKMARK_SELECT_BOOKMARK),
|
gui_synclist_set_title(&list, str(LANG_BOOKMARK_SELECT_BOOKMARK),
|
||||||
Icon_Bookmark);
|
Icon_Bookmark);
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
|
|
||||||
while (!exit)
|
while (!exit)
|
||||||
{
|
{
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
|
|
||||||
if (refresh)
|
if (refresh)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "splash.h"
|
#include "splash.h"
|
||||||
#include "dircache.h"
|
#include "dircache.h"
|
||||||
|
#include "viewport.h"
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
#include "tagcache.h"
|
#include "tagcache.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -232,6 +233,7 @@ static bool dbg_audio_thread(void)
|
||||||
struct audio_debug d;
|
struct audio_debug d;
|
||||||
|
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -269,6 +271,7 @@ static bool dbg_audio_thread(void)
|
||||||
|
|
||||||
lcd_update();
|
lcd_update();
|
||||||
}
|
}
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif /* !SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
|
@ -304,6 +307,7 @@ static bool dbg_buffering_thread(void)
|
||||||
tick_add_task(dbg_audio_task);
|
tick_add_task(dbg_audio_task);
|
||||||
|
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
while(!done)
|
while(!done)
|
||||||
{
|
{
|
||||||
button = get_action(CONTEXT_STD,HZ/5);
|
button = get_action(CONTEXT_STD,HZ/5);
|
||||||
|
@ -394,6 +398,7 @@ static bool dbg_buffering_thread(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
tick_remove_task(dbg_audio_task);
|
tick_remove_task(dbg_audio_task);
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -526,6 +531,7 @@ static bool dbg_hw_info(void)
|
||||||
|
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
lcd_puts(0, 0, "[Hardware info]");
|
lcd_puts(0, 0, "[Hardware info]");
|
||||||
|
|
||||||
|
@ -564,6 +570,7 @@ static bool dbg_hw_info(void)
|
||||||
int got_id; /* flag if we managed to get the flash IDs */
|
int got_id; /* flag if we managed to get the flash IDs */
|
||||||
int oldmode; /* saved memory guard mode */
|
int oldmode; /* saved memory guard mode */
|
||||||
int line = 0;
|
int line = 0;
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */
|
oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */
|
||||||
|
|
||||||
|
@ -626,6 +633,7 @@ static bool dbg_hw_info(void)
|
||||||
|
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
lcd_puts(0, line++, "[Hardware info]");
|
lcd_puts(0, line++, "[Hardware info]");
|
||||||
|
|
||||||
|
@ -679,10 +687,12 @@ static bool dbg_hw_info(void)
|
||||||
lcd_update();
|
lcd_update();
|
||||||
|
|
||||||
while (!(action_userabort(TIMEOUT_BLOCK)));
|
while (!(action_userabort(TIMEOUT_BLOCK)));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* Define this function in your target tree */
|
/* Define this function in your target tree */
|
||||||
return __dbg_hw_info();
|
return __dbg_hw_info();
|
||||||
#endif /* CONFIG_CPU */
|
#endif /* CONFIG_CPU */
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else /* !HAVE_LCD_BITMAP */
|
#else /* !HAVE_LCD_BITMAP */
|
||||||
|
@ -824,6 +834,7 @@ static bool dbg_spdif(void)
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
#ifdef HAVE_SPDIF_POWER
|
#ifdef HAVE_SPDIF_POWER
|
||||||
spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
|
spdif_power_enable(true); /* We need SPDIF power for both sending & receiving */
|
||||||
|
@ -976,6 +987,7 @@ static bool dbg_spdif(void)
|
||||||
spdif_power_enable(global_settings.spdif_enable);
|
spdif_power_enable(global_settings.spdif_enable);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif /* CPU_COLDFIRE */
|
#endif /* CPU_COLDFIRE */
|
||||||
|
@ -1033,6 +1045,7 @@ bool dbg_ports(void)
|
||||||
|
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -1057,7 +1070,10 @@ bool dbg_ports(void)
|
||||||
|
|
||||||
lcd_update();
|
lcd_update();
|
||||||
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
||||||
|
{
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#elif defined(CPU_COLDFIRE)
|
#elif defined(CPU_COLDFIRE)
|
||||||
unsigned int gpio_out;
|
unsigned int gpio_out;
|
||||||
|
@ -1075,6 +1091,7 @@ bool dbg_ports(void)
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -1140,7 +1157,10 @@ bool dbg_ports(void)
|
||||||
|
|
||||||
lcd_update();
|
lcd_update();
|
||||||
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
||||||
|
{
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(CPU_PP502x)
|
#elif defined(CPU_PP502x)
|
||||||
|
@ -1150,6 +1170,7 @@ bool dbg_ports(void)
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -1247,7 +1268,10 @@ extern unsigned char serbuf[];
|
||||||
#endif
|
#endif
|
||||||
lcd_update();
|
lcd_update();
|
||||||
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
||||||
|
{
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif CONFIG_CPU == PP5002
|
#elif CONFIG_CPU == PP5002
|
||||||
|
@ -1256,6 +1280,7 @@ extern unsigned char serbuf[];
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -1286,8 +1311,12 @@ extern unsigned char serbuf[];
|
||||||
|
|
||||||
lcd_update();
|
lcd_update();
|
||||||
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
||||||
|
{
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
#else
|
#else
|
||||||
return __dbg_ports();
|
return __dbg_ports();
|
||||||
#endif /* CPU */
|
#endif /* CPU */
|
||||||
|
@ -1302,6 +1331,7 @@ bool dbg_ports(void)
|
||||||
int currval = 0;
|
int currval = 0;
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -1337,7 +1367,6 @@ bool dbg_ports(void)
|
||||||
case 9:
|
case 9:
|
||||||
snprintf(buf, 32, "AN7: %03x", adc_read(7));
|
snprintf(buf, 32, "AN7: %03x", adc_read(7));
|
||||||
break;
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
lcd_puts(0, 0, buf);
|
lcd_puts(0, 0, buf);
|
||||||
|
|
||||||
|
@ -1367,6 +1396,7 @@ bool dbg_ports(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif /* !HAVE_LCD_BITMAP */
|
#endif /* !HAVE_LCD_BITMAP */
|
||||||
|
@ -1382,6 +1412,7 @@ static bool dbg_pcf(void)
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
#endif
|
#endif
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -1417,10 +1448,12 @@ static bool dbg_pcf(void)
|
||||||
lcd_update();
|
lcd_update();
|
||||||
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
||||||
{
|
{
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1436,6 +1469,7 @@ static bool dbg_cpufreq(void)
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
#endif
|
#endif
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -1467,10 +1501,11 @@ static bool dbg_cpufreq(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_STD_CANCEL:
|
case ACTION_STD_CANCEL:
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
|
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
|
||||||
|
@ -1563,6 +1598,7 @@ static bool view_battery(void)
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -1803,9 +1839,11 @@ static bool view_battery(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_STD_CANCEL:
|
case ACTION_STD_CANCEL:
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2434,6 +2472,7 @@ static bool cpu_boost_log(void)
|
||||||
bool done;
|
bool done;
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
str = cpu_boost_log_getlog_first();
|
str = cpu_boost_log_getlog_first();
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
while (i < count)
|
while (i < count)
|
||||||
{
|
{
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
@ -2467,6 +2506,7 @@ static bool cpu_boost_log(void)
|
||||||
}
|
}
|
||||||
get_action(CONTEXT_STD,TIMEOUT_BLOCK);
|
get_action(CONTEXT_STD,TIMEOUT_BLOCK);
|
||||||
lcd_setfont(FONT_UI);
|
lcd_setfont(FONT_UI);
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2485,11 +2525,12 @@ static bool dbg_scrollwheel(void)
|
||||||
unsigned int speed;
|
unsigned int speed;
|
||||||
|
|
||||||
lcd_setfont(FONT_SYSFIXED);
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (action_userabort(HZ/10))
|
if (action_userabort(HZ/10))
|
||||||
return false;
|
break;
|
||||||
|
|
||||||
lcd_clear_display();
|
lcd_clear_display();
|
||||||
|
|
||||||
|
@ -2514,6 +2555,7 @@ static bool dbg_scrollwheel(void)
|
||||||
|
|
||||||
lcd_update();
|
lcd_update();
|
||||||
}
|
}
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -295,7 +295,6 @@ static int enc_menuitem_callback(int action,
|
||||||
encoder_config_to_global(data->cfg);
|
encoder_config_to_global(data->cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
}
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,19 +45,13 @@
|
||||||
#define SCROLLBAR_WIDTH 6
|
#define SCROLLBAR_WIDTH 6
|
||||||
#define ICON_PADDING 1
|
#define ICON_PADDING 1
|
||||||
|
|
||||||
static struct viewport title_text[NB_SCREENS], title_icons[NB_SCREENS],
|
/* these are static to make scrolling work */
|
||||||
list_text[NB_SCREENS], list_icons[NB_SCREENS];
|
static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS];
|
||||||
|
|
||||||
/* should probably be moved somewhere else */
|
|
||||||
int list_title_height(struct gui_synclist *list, struct viewport *vp)
|
|
||||||
{
|
|
||||||
(void)list;
|
|
||||||
return font_get(vp->font)->height;
|
|
||||||
}
|
|
||||||
int gui_list_get_item_offset(struct gui_synclist * gui_list, int item_width,
|
int gui_list_get_item_offset(struct gui_synclist * gui_list, int item_width,
|
||||||
int text_pos, struct screen * display,
|
int text_pos, struct screen * display,
|
||||||
struct viewport *vp);
|
struct viewport *vp);
|
||||||
bool list_display_title(struct gui_synclist *list, struct viewport *vp);
|
bool list_display_title(struct gui_synclist *list, enum screen_type screen);
|
||||||
|
|
||||||
/* Draw the list...
|
/* Draw the list...
|
||||||
internal screen layout:
|
internal screen layout:
|
||||||
|
@ -70,47 +64,51 @@ bool list_display_title(struct gui_synclist *list, struct viewport *vp);
|
||||||
| | | |
|
| | | |
|
||||||
------------------
|
------------------
|
||||||
*/
|
*/
|
||||||
static bool draw_title(struct screen *display, struct viewport *parent,
|
static bool draw_title(struct screen *display, struct gui_synclist *list)
|
||||||
struct gui_synclist *list)
|
|
||||||
{
|
{
|
||||||
struct viewport *vp_icons = &title_icons[display->screen_type];
|
const int screen = display->screen_type;
|
||||||
struct viewport *vp_text = &title_text[display->screen_type];
|
if (!list_display_title(list, screen))
|
||||||
if (!list_display_title(list, parent))
|
|
||||||
return false;
|
return false;
|
||||||
*vp_text = *parent;
|
title_text[screen] = *(list->parent[screen]);
|
||||||
vp_text->height = list_title_height(list, parent);
|
title_text[screen].height
|
||||||
|
= font_get(title_text[screen].font)->height;
|
||||||
if (list->title_icon != Icon_NOICON && global_settings.show_icons)
|
if (list->title_icon != Icon_NOICON && global_settings.show_icons)
|
||||||
{
|
{
|
||||||
*vp_icons = *vp_text;
|
struct viewport title_icon = *(list->parent[screen]);
|
||||||
vp_icons->width = get_icon_width(display->screen_type)
|
title_icon = title_text[screen];
|
||||||
|
title_icon.width = get_icon_width(screen)
|
||||||
+ ICON_PADDING*2;
|
+ ICON_PADDING*2;
|
||||||
vp_icons->x += ICON_PADDING;
|
title_icon.x += ICON_PADDING;
|
||||||
|
|
||||||
vp_text->width -= vp_icons->width + vp_icons->x;
|
title_text[screen].width -= title_icon.width + title_icon.x;
|
||||||
vp_text->x += vp_icons->width + vp_icons->x;
|
title_text[screen].x += title_icon.width + title_icon.x;
|
||||||
|
|
||||||
display->set_viewport(vp_icons);
|
display->set_viewport(&title_icon);
|
||||||
screen_put_icon(display, 0, 0, list->title_icon);
|
screen_put_icon(display, 0, 0, list->title_icon);
|
||||||
}
|
}
|
||||||
display->set_viewport(vp_text);
|
title_text[screen].drawmode = STYLE_DEFAULT;
|
||||||
vp_text->drawmode = STYLE_DEFAULT;
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
if (list->title_color >= 0)
|
if (list->title_color >= 0)
|
||||||
{
|
{
|
||||||
vp_text->drawmode |= (STYLE_COLORED|list->title_color);}
|
title_text[screen].drawmode
|
||||||
|
|= (STYLE_COLORED|list->title_color);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
display->puts_scroll_style_offset(0, 0, list->title,
|
display->set_viewport(&title_text[screen]);
|
||||||
vp_text->drawmode, 0);
|
display->puts_scroll_style(0, 0, list->title,
|
||||||
|
title_text[screen].drawmode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void list_draw(struct screen *display, struct viewport *parent,
|
void list_draw(struct screen *display, struct gui_synclist *list)
|
||||||
struct gui_synclist *list)
|
|
||||||
{
|
{
|
||||||
|
struct viewport list_icons;
|
||||||
int start, end, line_height, i;
|
int start, end, line_height, i;
|
||||||
int icon_width = get_icon_width(display->screen_type) + ICON_PADDING;
|
const int screen = display->screen_type;
|
||||||
bool show_cursor = !global_settings.cursor_style &&
|
const int icon_width = get_icon_width(screen) + ICON_PADDING;
|
||||||
|
const bool show_cursor = !global_settings.cursor_style &&
|
||||||
list->show_selection_marker;
|
list->show_selection_marker;
|
||||||
|
struct viewport *parent = (list->parent[screen]);
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
unsigned char cur_line = 0;
|
unsigned char cur_line = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -120,55 +118,55 @@ void list_draw(struct screen *display, struct viewport *parent,
|
||||||
display->set_viewport(parent);
|
display->set_viewport(parent);
|
||||||
display->clear_viewport();
|
display->clear_viewport();
|
||||||
display->stop_scroll();
|
display->stop_scroll();
|
||||||
list_text[display->screen_type] = *parent;
|
list_text[screen] = *parent;
|
||||||
if ((show_title = draw_title(display, parent, list)))
|
if ((show_title = draw_title(display, list)))
|
||||||
{
|
{
|
||||||
list_text[display->screen_type].y += list_title_height(list, parent);
|
list_text[screen].y += line_height;
|
||||||
list_text[display->screen_type].height -= list_title_height(list, parent);
|
list_text[screen].height -= line_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
start = list->start_item[display->screen_type];
|
start = list->start_item[screen];
|
||||||
end = start + viewport_get_nb_lines(&list_text[display->screen_type]);
|
end = start + viewport_get_nb_lines(&list_text[screen]);
|
||||||
|
|
||||||
/* draw the scrollbar if its needed */
|
/* draw the scrollbar if its needed */
|
||||||
if (global_settings.scrollbar &&
|
if (global_settings.scrollbar &&
|
||||||
viewport_get_nb_lines(&list_text[display->screen_type]) < list->nb_items)
|
viewport_get_nb_lines(&list_text[screen]) < list->nb_items)
|
||||||
{
|
{
|
||||||
struct viewport vp;
|
struct viewport vp;
|
||||||
vp = list_text[display->screen_type];
|
vp = list_text[screen];
|
||||||
vp.width = SCROLLBAR_WIDTH;
|
vp.width = SCROLLBAR_WIDTH;
|
||||||
list_text[display->screen_type].width -= SCROLLBAR_WIDTH;
|
list_text[screen].width -= SCROLLBAR_WIDTH;
|
||||||
list_text[display->screen_type].x += SCROLLBAR_WIDTH;
|
list_text[screen].x += SCROLLBAR_WIDTH;
|
||||||
vp.height = line_height *
|
vp.height = line_height *
|
||||||
viewport_get_nb_lines(&list_text[display->screen_type]);
|
viewport_get_nb_lines(&list_text[screen]);
|
||||||
vp.x = parent->x;
|
vp.x = parent->x;
|
||||||
display->set_viewport(&vp);
|
display->set_viewport(&vp);
|
||||||
gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1,
|
gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1,
|
||||||
vp.height, list->nb_items,
|
vp.height, list->nb_items,
|
||||||
list->start_item[display->screen_type],
|
list->start_item[screen],
|
||||||
list->start_item[display->screen_type] + end-start,
|
list->start_item[screen] + end-start,
|
||||||
VERTICAL);
|
VERTICAL);
|
||||||
}
|
}
|
||||||
else if (show_title)
|
else if (show_title)
|
||||||
{
|
{
|
||||||
/* shift everything right a bit... */
|
/* shift everything right a bit... */
|
||||||
list_text[display->screen_type].width -= SCROLLBAR_WIDTH;
|
list_text[screen].width -= SCROLLBAR_WIDTH;
|
||||||
list_text[display->screen_type].x += SCROLLBAR_WIDTH;
|
list_text[screen].x += SCROLLBAR_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* setup icon placement */
|
/* setup icon placement */
|
||||||
list_icons[display->screen_type] = list_text[display->screen_type];
|
list_icons = list_text[screen];
|
||||||
int icon_count = global_settings.show_icons &&
|
int icon_count = global_settings.show_icons &&
|
||||||
(list->callback_get_item_icon != NULL) ? 1 : 0;
|
(list->callback_get_item_icon != NULL) ? 1 : 0;
|
||||||
if (show_cursor)
|
if (show_cursor)
|
||||||
icon_count++;
|
icon_count++;
|
||||||
if (icon_count)
|
if (icon_count)
|
||||||
{
|
{
|
||||||
list_icons[display->screen_type].width = icon_width * icon_count;
|
list_icons.width = icon_width * icon_count;
|
||||||
list_text[display->screen_type].width -=
|
list_text[screen].width -=
|
||||||
list_icons[display->screen_type].width + ICON_PADDING;
|
list_icons.width + ICON_PADDING;
|
||||||
list_text[display->screen_type].x +=
|
list_text[screen].x +=
|
||||||
list_icons[display->screen_type].width + ICON_PADDING;
|
list_icons.width + ICON_PADDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=start; i<end && i<list->nb_items; i++)
|
for (i=start; i<end && i<list->nb_items; i++)
|
||||||
|
@ -181,14 +179,14 @@ void list_draw(struct screen *display, struct viewport *parent,
|
||||||
s = list->callback_get_item_name(i, list->data, entry_buffer,
|
s = list->callback_get_item_name(i, list->data, entry_buffer,
|
||||||
sizeof(entry_buffer));
|
sizeof(entry_buffer));
|
||||||
entry_name = P2STR(s);
|
entry_name = P2STR(s);
|
||||||
display->set_viewport(&list_text[display->screen_type]);
|
display->set_viewport(&list_text[screen]);
|
||||||
list_text[display->screen_type].drawmode = STYLE_DEFAULT;
|
list_text[screen].drawmode = STYLE_DEFAULT;
|
||||||
/* position the string at the correct offset place */
|
/* position the string at the correct offset place */
|
||||||
int item_width,h;
|
int item_width,h;
|
||||||
display->getstringsize(entry_name, &item_width, &h);
|
display->getstringsize(entry_name, &item_width, &h);
|
||||||
item_offset = gui_list_get_item_offset(list, item_width,
|
item_offset = gui_list_get_item_offset(list, item_width,
|
||||||
text_pos, display,
|
text_pos, display,
|
||||||
&list_text[display->screen_type]);
|
&list_text[screen]);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
/* if the list has a color callback */
|
/* if the list has a color callback */
|
||||||
|
@ -198,73 +196,75 @@ void list_draw(struct screen *display, struct viewport *parent,
|
||||||
/* if color selected */
|
/* if color selected */
|
||||||
if (color >= 0)
|
if (color >= 0)
|
||||||
{
|
{
|
||||||
list_text[display->screen_type].drawmode |= STYLE_COLORED|color;
|
list_text[screen].drawmode |= STYLE_COLORED|color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if(i >= list->selected_item &&
|
if(i >= list->selected_item && i < list->selected_item
|
||||||
i < list->selected_item + list->selected_size && list->show_selection_marker)
|
+ list->selected_size && list->show_selection_marker)
|
||||||
{/* The selected item must be displayed scrolling */
|
{/* The selected item must be displayed scrolling */
|
||||||
if (global_settings.cursor_style == 1
|
if (global_settings.cursor_style == 1
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
/* the global_settings.cursor_style check is here to make sure
|
/* the global_settings.cursor_style check is here to make
|
||||||
if they want the cursor instead of bar it will work */
|
* sure if they want the cursor instead of bar it will work
|
||||||
|
*/
|
||||||
|| (display->depth < 16 && global_settings.cursor_style)
|
|| (display->depth < 16 && global_settings.cursor_style)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/* Display inverted-line-style */
|
/* Display inverted-line-style */
|
||||||
list_text[display->screen_type].drawmode = STYLE_INVERT;
|
list_text[screen].drawmode = STYLE_INVERT;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
else if (global_settings.cursor_style == 2)
|
else if (global_settings.cursor_style == 2)
|
||||||
{
|
{
|
||||||
/* Display colour line selector */
|
/* Display colour line selector */
|
||||||
list_text[display->screen_type].drawmode = STYLE_COLORBAR;
|
list_text[screen].drawmode = STYLE_COLORBAR;
|
||||||
}
|
}
|
||||||
else if (global_settings.cursor_style == 3)
|
else if (global_settings.cursor_style == 3)
|
||||||
{
|
{
|
||||||
/* Display gradient line selector */
|
/* Display gradient line selector */
|
||||||
list_text[display->screen_type].drawmode = STYLE_GRADIENT;
|
list_text[screen].drawmode = STYLE_GRADIENT;
|
||||||
|
|
||||||
/* Make the lcd driver know how many lines the gradient should
|
/* Make the lcd driver know how many lines the gradient should
|
||||||
cover and current line number */
|
cover and current line number */
|
||||||
/* number of selected lines */
|
/* number of selected lines */
|
||||||
list_text[display->screen_type].drawmode |= NUMLN_PACK(list->selected_size);
|
list_text[screen].drawmode |= NUMLN_PACK(list->selected_size);
|
||||||
/* current line number, zero based */
|
/* current line number, zero based */
|
||||||
list_text[display->screen_type].drawmode |= CURLN_PACK(cur_line);
|
list_text[screen].drawmode |= CURLN_PACK(cur_line);
|
||||||
cur_line++;
|
cur_line++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* if the text is smaller than the viewport size */
|
/* if the text is smaller than the viewport size */
|
||||||
if (item_offset > item_width - (list_text[display->screen_type].width - text_pos))
|
if (item_offset> item_width
|
||||||
|
- (list_text[screen].width - text_pos))
|
||||||
{
|
{
|
||||||
/* don't scroll */
|
/* don't scroll */
|
||||||
display->puts_style_offset(0, i-start, entry_name,
|
display->puts_style_offset(0, i-start, entry_name,
|
||||||
list_text[display->screen_type].drawmode, item_offset);
|
list_text[screen].drawmode, item_offset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
display->puts_scroll_style_offset(0, i-start, entry_name,
|
display->puts_scroll_style_offset(0, i-start, entry_name,
|
||||||
list_text[display->screen_type].drawmode, item_offset);
|
list_text[screen].drawmode, item_offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (list->scroll_all)
|
if (list->scroll_all)
|
||||||
display->puts_scroll_style_offset(0, i-start, entry_name,
|
display->puts_scroll_style_offset(0, i-start, entry_name,
|
||||||
list_text[display->screen_type].drawmode, item_offset);
|
list_text[screen].drawmode, item_offset);
|
||||||
else
|
else
|
||||||
display->puts_style_offset(0, i-start, entry_name,
|
display->puts_style_offset(0, i-start, entry_name,
|
||||||
list_text[display->screen_type].drawmode, item_offset);
|
list_text[screen].drawmode, item_offset);
|
||||||
}
|
}
|
||||||
/* do the icon */
|
/* do the icon */
|
||||||
if (list->callback_get_item_icon && global_settings.show_icons)
|
if (list->callback_get_item_icon && global_settings.show_icons)
|
||||||
{
|
{
|
||||||
display->set_viewport(&list_icons[display->screen_type]);
|
display->set_viewport(&list_icons);
|
||||||
screen_put_icon_with_offset(display, show_cursor?1:0,
|
screen_put_icon_with_offset(display, show_cursor?1:0,
|
||||||
(i-start),show_cursor?ICON_PADDING:0,0,
|
(i-start),show_cursor?ICON_PADDING:0,0,
|
||||||
list->callback_get_item_icon(i, list->data));
|
list->callback_get_item_icon(i, list->data));
|
||||||
if (show_cursor && i >= list->selected_item &&
|
if (show_cursor && i >= list->selected_item &&
|
||||||
i < list->selected_item + list->selected_size)
|
i < list->selected_item + list->selected_size)
|
||||||
{
|
{
|
||||||
|
@ -274,14 +274,12 @@ void list_draw(struct screen *display, struct viewport *parent,
|
||||||
else if (show_cursor && i >= list->selected_item &&
|
else if (show_cursor && i >= list->selected_item &&
|
||||||
i < list->selected_item + list->selected_size)
|
i < list->selected_item + list->selected_size)
|
||||||
{
|
{
|
||||||
display->set_viewport(&list_icons[display->screen_type]);
|
display->set_viewport(&list_icons);
|
||||||
screen_put_icon(display, 0, (i-start), Icon_Cursor);
|
screen_put_icon(display, 0, (i-start), Icon_Cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
display->set_viewport(parent);
|
display->set_viewport(parent);
|
||||||
display->update_viewport();
|
display->update_viewport();
|
||||||
display->set_viewport(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -292,10 +290,10 @@ void list_draw(struct screen *display, struct viewport *parent,
|
||||||
*/
|
*/
|
||||||
static bool scrolling=false;
|
static bool scrolling=false;
|
||||||
|
|
||||||
unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct viewport *parent)
|
unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list)
|
||||||
{
|
{
|
||||||
short x, y;
|
short x, y;
|
||||||
unsigned button = action_get_touchscreen_press(&x, &y);
|
int button = action_get_touchscreen_press(&x, &y);
|
||||||
int line;
|
int line;
|
||||||
struct screen *display = &screens[SCREEN_MAIN];
|
struct screen *display = &screens[SCREEN_MAIN];
|
||||||
if (button == BUTTON_NONE)
|
if (button == BUTTON_NONE)
|
||||||
|
@ -315,13 +313,15 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view
|
||||||
/* Scroll bar */
|
/* Scroll bar */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int nb_lines = viewport_get_nb_lines(&list_text[SCREEN_MAIN]);
|
int nb_lines = viewport_get_nb_lines(&list_text[screen]);
|
||||||
if (nb_lines < gui_list->nb_items)
|
if (nb_lines < gui_list->nb_items)
|
||||||
{
|
{
|
||||||
int scrollbar_size = nb_lines * font_get(parent->font)->height;
|
int scrollbar_size = nb_lines*
|
||||||
int actual_y = y - list_text[SCREEN_MAIN].y;
|
font_get(gui_list->parent[screen]->font)->height;
|
||||||
|
int actual_y = y - list_text[screen].y;
|
||||||
|
|
||||||
int new_selection = (actual_y * gui_list->nb_items) / scrollbar_size;
|
int new_selection = (actual_y * gui_list->nb_items)
|
||||||
|
/ scrollbar_size;
|
||||||
|
|
||||||
int start_item = new_selection - nb_lines/2;
|
int start_item = new_selection - nb_lines/2;
|
||||||
if(start_item < 0)
|
if(start_item < 0)
|
||||||
|
@ -329,7 +329,7 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view
|
||||||
else if(start_item > gui_list->nb_items - nb_lines)
|
else if(start_item > gui_list->nb_items - nb_lines)
|
||||||
start_item = gui_list->nb_items - nb_lines;
|
start_item = gui_list->nb_items - nb_lines;
|
||||||
|
|
||||||
gui_list->start_item[SCREEN_MAIN] = start_item;
|
gui_list->start_item[screen] = start_item;
|
||||||
gui_synclist_select_item(gui_list, new_selection);
|
gui_synclist_select_item(gui_list, new_selection);
|
||||||
|
|
||||||
return ACTION_REDRAW;
|
return ACTION_REDRAW;
|
||||||
|
@ -350,27 +350,31 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view
|
||||||
* | will bring up the context menu of it. |
|
* | will bring up the context menu of it. |
|
||||||
* |--------------------------------------------------------|
|
* |--------------------------------------------------------|
|
||||||
*/
|
*/
|
||||||
if (y > list_text[SCREEN_MAIN].y)
|
if (y > list_text[screen].y)
|
||||||
{
|
{
|
||||||
int line_height, actual_y;
|
int line_height, actual_y;
|
||||||
static int last_y = 0;
|
static int last_y = 0;
|
||||||
|
|
||||||
actual_y = y - list_text[SCREEN_MAIN].y;
|
actual_y = y - list_text[screen].y;
|
||||||
line_height = font_get(parent->font)->height;
|
line_height = font_get(gui_list->parent[screen]->font)->height;
|
||||||
line = actual_y / line_height;
|
line = actual_y / line_height;
|
||||||
|
|
||||||
if(actual_y%line_height == 0) /* Pressed a border */
|
if(actual_y%line_height == 0) /* Pressed a border */
|
||||||
return ACTION_NONE;
|
return ACTION_NONE;
|
||||||
|
|
||||||
if (gui_list->start_item[SCREEN_MAIN]+line > gui_list->nb_items) /* Pressed below the list*/
|
if (gui_list->start_item[screen]+line > gui_list->nb_items)
|
||||||
|
{
|
||||||
|
/* Pressed below the list*/
|
||||||
return ACTION_NONE;
|
return ACTION_NONE;
|
||||||
|
}
|
||||||
last_y = actual_y;
|
last_y = actual_y;
|
||||||
if (line != gui_list->selected_item - gui_list->start_item[SCREEN_MAIN] && button ^ BUTTON_REL)
|
if (line != gui_list->selected_item
|
||||||
|
- gui_list->start_item[screen] && button ^ BUTTON_REL)
|
||||||
{
|
{
|
||||||
if(button & BUTTON_REPEAT)
|
if(button & BUTTON_REPEAT)
|
||||||
scrolling = true;
|
scrolling = true;
|
||||||
gui_synclist_select_item(gui_list, gui_list->start_item[SCREEN_MAIN]+line);
|
gui_synclist_select_item(gui_list, gui_list->start_item[screen]
|
||||||
|
+ line);
|
||||||
return ACTION_REDRAW;
|
return ACTION_REDRAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,15 +382,17 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view
|
||||||
{
|
{
|
||||||
if(!scrolling)
|
if(!scrolling)
|
||||||
{
|
{
|
||||||
/* Pen was hold on the same line as the previously selected one
|
/* Pen was hold on the same line as the
|
||||||
* => simulate long button press
|
* previously selected one
|
||||||
|
* => simulate long button press
|
||||||
*/
|
*/
|
||||||
return ACTION_STD_CONTEXT;
|
return ACTION_STD_CONTEXT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Pen was moved across several lines and then released on this one
|
/* Pen was moved across several lines and then released on
|
||||||
* => do nothing
|
* this one
|
||||||
|
* => do nothing
|
||||||
*/
|
*/
|
||||||
scrolling = false;
|
scrolling = false;
|
||||||
return ACTION_NONE;
|
return ACTION_NONE;
|
||||||
|
@ -394,8 +400,8 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view
|
||||||
}
|
}
|
||||||
else if(button == BUTTON_REL)
|
else if(button == BUTTON_REL)
|
||||||
{
|
{
|
||||||
/* Pen was released on either the same line as the previously selected one
|
/* Pen was released on either the same line as the previously
|
||||||
* or an other one
|
* selected one or an other one
|
||||||
* => simulate short press
|
* => simulate short press
|
||||||
*/
|
*/
|
||||||
return ACTION_STD_OK;
|
return ACTION_STD_OK;
|
||||||
|
@ -404,11 +410,16 @@ unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct view
|
||||||
return ACTION_NONE;
|
return ACTION_NONE;
|
||||||
}
|
}
|
||||||
/* Title goes up one level (only on BUTTON_REL&~BUTTON_REPEAT) */
|
/* Title goes up one level (only on BUTTON_REL&~BUTTON_REPEAT) */
|
||||||
else if (y > title_text[SCREEN_MAIN].y && draw_title(display, parent, gui_list) && button == BUTTON_REL)
|
else if (y > title_text[screen].y && draw_title(display, gui_list)
|
||||||
|
&& button == BUTTON_REL)
|
||||||
|
{
|
||||||
return ACTION_STD_CANCEL;
|
return ACTION_STD_CANCEL;
|
||||||
|
}
|
||||||
/* Title or statusbar is cancel (only on BUTTON_REL&~BUTTON_REPEAT) */
|
/* Title or statusbar is cancel (only on BUTTON_REL&~BUTTON_REPEAT) */
|
||||||
else if (global_settings.statusbar && button == BUTTON_REL)
|
else if (global_settings.statusbar && button == BUTTON_REL)
|
||||||
|
{
|
||||||
return ACTION_STD_CANCEL;
|
return ACTION_STD_CANCEL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ACTION_NONE;
|
return ACTION_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,8 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "talk.h"
|
#include "talk.h"
|
||||||
|
|
||||||
void list_draw(struct screen *display, struct viewport *parent,
|
void list_draw(struct screen *display, struct gui_synclist *gui_list)
|
||||||
struct gui_synclist *gui_list)
|
|
||||||
{
|
{
|
||||||
(void)parent;
|
|
||||||
int text_pos;
|
int text_pos;
|
||||||
bool draw_icons = (gui_list->callback_get_item_icon != NULL &&
|
bool draw_icons = (gui_list->callback_get_item_icon != NULL &&
|
||||||
global_settings.show_icons);
|
global_settings.show_icons);
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
#include "playback.h"
|
#include "playback.h"
|
||||||
#endif
|
#endif
|
||||||
#include "backdrop.h"
|
#include "backdrop.h"
|
||||||
|
#include "viewport.h"
|
||||||
|
|
||||||
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
|
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
|
||||||
/* 3% of 30min file == 54s step size */
|
/* 3% of 30min file == 54s step size */
|
||||||
|
@ -78,17 +79,17 @@
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force)
|
static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force)
|
||||||
{
|
{
|
||||||
|
(void)force;
|
||||||
bool draw = global_settings.statusbar;
|
bool draw = global_settings.statusbar;
|
||||||
|
|
||||||
if (wps->data->wps_sb_tag)
|
if (wps->data->wps_sb_tag)
|
||||||
draw = wps->data->show_sb_on_wps;
|
draw = wps->data->show_sb_on_wps;
|
||||||
|
|
||||||
if (draw)
|
if (!draw)
|
||||||
gui_statusbar_draw(wps->statusbar, force);
|
viewportmanager_set_statusbar(false);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define gui_wps_statusbar_draw(wps, force) \
|
#define gui_wps_statusbar_draw(wps, force)
|
||||||
gui_statusbar_draw((wps)->statusbar, (force))
|
|
||||||
#endif
|
#endif
|
||||||
#include "pcmbuf.h"
|
#include "pcmbuf.h"
|
||||||
|
|
||||||
|
@ -335,9 +336,6 @@ bool gui_wps_display(void)
|
||||||
if (!wps_state.id3 && !(audio_status() & AUDIO_STATUS_PLAY))
|
if (!wps_state.id3 && !(audio_status() & AUDIO_STATUS_PLAY))
|
||||||
{
|
{
|
||||||
global_status.resume_index = -1;
|
global_status.resume_index = -1;
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
#endif
|
|
||||||
splash(HZ, ID2P(LANG_END_PLAYLIST));
|
splash(HZ, ID2P(LANG_END_PLAYLIST));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ static int force_list_reinit = false;
|
||||||
|
|
||||||
static void gui_list_select_at_offset(struct gui_synclist * gui_list,
|
static void gui_list_select_at_offset(struct gui_synclist * gui_list,
|
||||||
int offset);
|
int offset);
|
||||||
void list_draw(struct screen *display, struct viewport *parent, struct gui_synclist *list);
|
void list_draw(struct screen *display, struct gui_synclist *list);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
static struct viewport parent[NB_SCREENS];
|
static struct viewport parent[NB_SCREENS];
|
||||||
|
@ -106,12 +106,13 @@ void list_init_viewports(struct gui_synclist *list)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
bool list_display_title(struct gui_synclist *list, struct viewport *vp)
|
bool list_display_title(struct gui_synclist *list, enum screen_type screen)
|
||||||
{
|
{
|
||||||
return list->title != NULL && viewport_get_nb_lines(vp)>2;
|
return list->title != NULL &&
|
||||||
|
viewport_get_nb_lines(list->parent[screen])>2;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define list_display_title(l,v) false
|
#define list_display_title(l, i) false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -180,10 +181,11 @@ void gui_synclist_hide_selection_marker(struct gui_synclist * lists, bool hide)
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
int list_title_height(struct gui_synclist *list, struct viewport *vp);
|
int gui_list_get_item_offset(struct gui_synclist * gui_list,
|
||||||
|
int item_width,
|
||||||
int gui_list_get_item_offset(struct gui_synclist * gui_list, int item_width,
|
int text_pos,
|
||||||
int text_pos, struct screen * display, struct viewport *vp)
|
struct screen * display,
|
||||||
|
struct viewport *vp)
|
||||||
{
|
{
|
||||||
int item_offset;
|
int item_offset;
|
||||||
|
|
||||||
|
@ -241,7 +243,7 @@ void gui_synclist_draw(struct gui_synclist *gui_list)
|
||||||
last_list = gui_list;
|
last_list = gui_list;
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
list_draw(&screens[i], gui_list->parent[i], gui_list);
|
list_draw(&screens[i], gui_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,8 +255,8 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list,
|
||||||
int difference = gui_list->selected_item - gui_list->start_item[screen];
|
int difference = gui_list->selected_item - gui_list->start_item[screen];
|
||||||
struct viewport vp = *gui_list->parent[screen];
|
struct viewport vp = *gui_list->parent[screen];
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
if (list_display_title(gui_list, gui_list->parent[screen]))
|
if (list_display_title(gui_list, screen))
|
||||||
vp.height -= list_title_height(gui_list,gui_list->parent[screen]);
|
vp.height -= font_get(gui_list->parent[screen]->font)->height;
|
||||||
#endif
|
#endif
|
||||||
nb_lines = viewport_get_nb_lines(&vp);
|
nb_lines = viewport_get_nb_lines(&vp);
|
||||||
|
|
||||||
|
@ -273,7 +275,10 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list,
|
||||||
if (global_settings.scroll_paginated)
|
if (global_settings.scroll_paginated)
|
||||||
{
|
{
|
||||||
if (gui_list->start_item[screen] > gui_list->selected_item)
|
if (gui_list->start_item[screen] > gui_list->selected_item)
|
||||||
gui_list->start_item[screen] = (gui_list->selected_item/nb_lines)*nb_lines;
|
{
|
||||||
|
gui_list->start_item[screen] = (gui_list->selected_item/nb_lines)
|
||||||
|
*nb_lines;
|
||||||
|
}
|
||||||
if (gui_list->nb_items <= nb_lines)
|
if (gui_list->nb_items <= nb_lines)
|
||||||
gui_list->start_item[screen] = 0;
|
gui_list->start_item[screen] = 0;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +298,7 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list,
|
||||||
if (bottom < 0)
|
if (bottom < 0)
|
||||||
bottom = 0;
|
bottom = 0;
|
||||||
gui_list->start_item[screen] = MIN(bottom, gui_list->start_item[screen] +
|
gui_list->start_item[screen] = MIN(bottom, gui_list->start_item[screen] +
|
||||||
2*gui_list->selected_size);
|
2*gui_list->selected_size);
|
||||||
}
|
}
|
||||||
else if (global_settings.scroll_paginated)
|
else if (global_settings.scroll_paginated)
|
||||||
{
|
{
|
||||||
|
@ -351,8 +356,8 @@ static void gui_list_select_at_offset(struct gui_synclist * gui_list,
|
||||||
{
|
{
|
||||||
struct viewport vp = *gui_list->parent[i];
|
struct viewport vp = *gui_list->parent[i];
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
if (list_display_title(gui_list, gui_list->parent[i]))
|
if (list_display_title(gui_list, i))
|
||||||
vp.height -= list_title_height(gui_list,gui_list->parent[i]);
|
vp.height -= font_get(gui_list->parent[i]->font)->height;
|
||||||
#endif
|
#endif
|
||||||
nb_lines = viewport_get_nb_lines(&vp);
|
nb_lines = viewport_get_nb_lines(&vp);
|
||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
|
@ -578,11 +583,11 @@ void gui_synclist_speak_item(struct gui_synclist * lists)
|
||||||
extern intptr_t get_action_data(void);
|
extern intptr_t get_action_data(void);
|
||||||
#if defined(HAVE_TOUCHSCREEN)
|
#if defined(HAVE_TOUCHSCREEN)
|
||||||
/* this needs to be fixed if we ever get more than 1 touchscreen on a target */
|
/* this needs to be fixed if we ever get more than 1 touchscreen on a target */
|
||||||
unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list, struct viewport *parent);
|
unsigned gui_synclist_do_touchscreen(struct gui_synclist * gui_list);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool gui_synclist_do_button(struct gui_synclist * lists,
|
bool gui_synclist_do_button(struct gui_synclist * lists,
|
||||||
unsigned *actionptr, enum list_wrap wrap)
|
int *actionptr, enum list_wrap wrap)
|
||||||
{
|
{
|
||||||
int action = *actionptr;
|
int action = *actionptr;
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
@ -621,7 +626,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists,
|
||||||
|
|
||||||
#if defined(HAVE_TOUCHSCREEN)
|
#if defined(HAVE_TOUCHSCREEN)
|
||||||
if (action == ACTION_TOUCHSCREEN)
|
if (action == ACTION_TOUCHSCREEN)
|
||||||
action = *actionptr = gui_synclist_do_touchscreen(lists, &parent[SCREEN_MAIN]);
|
action = *actionptr = gui_synclist_do_touchscreen(lists);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (wrap)
|
switch (wrap)
|
||||||
|
@ -791,8 +796,8 @@ bool gui_synclist_item_is_onscreen(struct gui_synclist *lists,
|
||||||
{
|
{
|
||||||
struct viewport vp = *lists->parent[screen];
|
struct viewport vp = *lists->parent[screen];
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
if (list_display_title(lists, lists->parent[screen]))
|
if (list_display_title(lists, screen))
|
||||||
vp.height -= list_title_height(lists, lists->parent[screen]);
|
vp.height -= font_get(lists->parent[screen]->font)->height;
|
||||||
#endif
|
#endif
|
||||||
return item <= (lists->start_item[screen] + viewport_get_nb_lines(&vp));
|
return item <= (lists->start_item[screen] + viewport_get_nb_lines(&vp));
|
||||||
}
|
}
|
||||||
|
@ -888,7 +893,6 @@ bool simplelist_show_list(struct simplelist_info *info)
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
list_do_action(CONTEXT_STD, info->timeout,
|
list_do_action(CONTEXT_STD, info->timeout,
|
||||||
&lists, &action, wrap);
|
&lists, &action, wrap);
|
||||||
|
|
||||||
|
@ -900,14 +904,16 @@ bool simplelist_show_list(struct simplelist_info *info)
|
||||||
{
|
{
|
||||||
bool stdok = action==ACTION_STD_OK;
|
bool stdok = action==ACTION_STD_OK;
|
||||||
action = info->action_callback(action, &lists);
|
action = info->action_callback(action, &lists);
|
||||||
if (stdok && action == ACTION_STD_CANCEL) /* callback asked us to exit */
|
if (stdok && action == ACTION_STD_CANCEL)
|
||||||
{
|
{
|
||||||
|
/* callback asked us to exit */
|
||||||
info->selection = gui_synclist_get_sel_pos(&lists);
|
info->selection = gui_synclist_get_sel_pos(&lists);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->get_name == NULL)
|
if (info->get_name == NULL)
|
||||||
gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size);
|
gui_synclist_set_nb_items(&lists,
|
||||||
|
simplelist_line_count*info->selection_size);
|
||||||
}
|
}
|
||||||
if (action == ACTION_STD_CANCEL)
|
if (action == ACTION_STD_CANCEL)
|
||||||
{
|
{
|
||||||
|
@ -918,7 +924,10 @@ bool simplelist_show_list(struct simplelist_info *info)
|
||||||
(old_line_count != simplelist_line_count))
|
(old_line_count != simplelist_line_count))
|
||||||
{
|
{
|
||||||
if (info->get_name == NULL)
|
if (info->get_name == NULL)
|
||||||
gui_synclist_set_nb_items(&lists, simplelist_line_count*info->selection_size);
|
{
|
||||||
|
gui_synclist_set_nb_items(&lists,
|
||||||
|
simplelist_line_count*info->selection_size);
|
||||||
|
}
|
||||||
gui_synclist_draw(&lists);
|
gui_synclist_draw(&lists);
|
||||||
old_line_count = simplelist_line_count;
|
old_line_count = simplelist_line_count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ extern bool gui_synclist_item_is_onscreen(struct gui_synclist *lists,
|
||||||
* NOTE: *action may be changed regardless of return value
|
* NOTE: *action may be changed regardless of return value
|
||||||
*/
|
*/
|
||||||
extern bool gui_synclist_do_button(struct gui_synclist * lists,
|
extern bool gui_synclist_do_button(struct gui_synclist * lists,
|
||||||
unsigned *action,
|
int *action,
|
||||||
enum list_wrap);
|
enum list_wrap);
|
||||||
|
|
||||||
/* If the list has a pending postponed scheduled announcement, that
|
/* If the list has a pending postponed scheduled announcement, that
|
||||||
|
|
|
@ -508,7 +508,6 @@ bool option_screen(const struct settings_list *setting,
|
||||||
gui_synclist_draw(&lists);
|
gui_synclist_draw(&lists);
|
||||||
/* talk the item */
|
/* talk the item */
|
||||||
gui_synclist_speak_item(&lists);
|
gui_synclist_speak_item(&lists);
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
while (!done)
|
while (!done)
|
||||||
{
|
{
|
||||||
if (list_do_action(CONTEXT_LIST, TIMEOUT_BLOCK,
|
if (list_do_action(CONTEXT_LIST, TIMEOUT_BLOCK,
|
||||||
|
@ -562,7 +561,6 @@ bool option_screen(const struct settings_list *setting,
|
||||||
}
|
}
|
||||||
else if(default_event_handler(action) == SYS_USB_CONNECTED)
|
else if(default_event_handler(action) == SYS_USB_CONNECTED)
|
||||||
return true;
|
return true;
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
/* callback */
|
/* callback */
|
||||||
if ( function )
|
if ( function )
|
||||||
function(*variable);
|
function(*variable);
|
||||||
|
|
|
@ -286,7 +286,6 @@ int gui_syncpitchscreen_run(void)
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
pitchscreen_draw(&screens[i], max_lines[i],
|
pitchscreen_draw(&screens[i], max_lines[i],
|
||||||
pitch_viewports[i], pitch);
|
pitch_viewports[i], pitch);
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
button = get_action(CONTEXT_PITCHSCREEN,HZ);
|
button = get_action(CONTEXT_PITCHSCREEN,HZ);
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case ACTION_PS_INC_SMALL:
|
case ACTION_PS_INC_SMALL:
|
||||||
|
|
|
@ -278,7 +278,6 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_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_syncstatusbar_draw(&statusbars, true);
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
screens[i].set_viewport(NULL);
|
screens[i].set_viewport(NULL);
|
||||||
|
@ -315,8 +314,6 @@ bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter)
|
||||||
|
|
||||||
if(button==ACTION_STD_CANCEL)
|
if(button==ACTION_STD_CANCEL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
}
|
}
|
||||||
/* Notify that we're exiting this screen */
|
/* Notify that we're exiting this screen */
|
||||||
cond_talk_ids_fq(VOICE_OK);
|
cond_talk_ids_fq(VOICE_OK);
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
#include "pcm_record.h"
|
#include "pcm_record.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "appevents.h"
|
||||||
|
|
||||||
/* FIXME: should be removed from icon.h to avoid redefinition,
|
/* FIXME: should be removed from icon.h to avoid redefinition,
|
||||||
but still needed for compatibility with old system */
|
but still needed for compatibility with old system */
|
||||||
|
@ -817,3 +818,8 @@ int gui_statusbar_height(void)
|
||||||
return global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
|
return global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gui_statusbar_changed(bool enabled)
|
||||||
|
{
|
||||||
|
(void)enabled;
|
||||||
|
send_event(GUI_EVENT_STATUSBAR_TOGGLE, NULL);
|
||||||
|
}
|
||||||
|
|
|
@ -99,4 +99,6 @@ struct gui_syncstatusbar
|
||||||
extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars);
|
extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars);
|
||||||
extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw);
|
extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw);
|
||||||
extern int gui_statusbar_height(void);
|
extern int gui_statusbar_height(void);
|
||||||
|
void gui_statusbar_changed(bool enabled);
|
||||||
|
|
||||||
#endif /*_GUI_STATUSBAR_H_*/
|
#endif /*_GUI_STATUSBAR_H_*/
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
#include "viewport.h"
|
#include "viewport.h"
|
||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
#include "screen_access.h"
|
#include "screen_access.h"
|
||||||
|
#include "appevents.h"
|
||||||
|
|
||||||
|
static bool statusbar_enabled = true;
|
||||||
|
|
||||||
int viewport_get_nb_lines(struct viewport *vp)
|
int viewport_get_nb_lines(struct viewport *vp)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +53,7 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
|
||||||
vp->x = 0;
|
vp->x = 0;
|
||||||
vp->width = screens[screen].lcdwidth;
|
vp->width = screens[screen].lcdwidth;
|
||||||
|
|
||||||
vp->y = gui_statusbar_height();
|
vp->y = statusbar_enabled?gui_statusbar_height():0;
|
||||||
vp->height = screens[screen].lcdheight - vp->y;
|
vp->height = screens[screen].lcdheight - vp->y;
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
vp->drawmode = DRMODE_SOLID;
|
vp->drawmode = DRMODE_SOLID;
|
||||||
|
@ -82,3 +85,31 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void viewportmanager_set_statusbar(bool enabled)
|
||||||
|
{
|
||||||
|
if (enabled && global_settings.statusbar)
|
||||||
|
{
|
||||||
|
add_event(GUI_EVENT_FOURHERTZ, false, viewportmanager_draw_statusbars);
|
||||||
|
gui_syncstatusbar_draw(&statusbars, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
remove_event(GUI_EVENT_FOURHERTZ, viewportmanager_draw_statusbars);
|
||||||
|
}
|
||||||
|
statusbar_enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void viewportmanager_draw_statusbars(void* data)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
if (statusbar_enabled)
|
||||||
|
gui_syncstatusbar_draw(&statusbars, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void viewportmanager_statusbar_changed(void* data)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
viewportmanager_set_statusbar(statusbar_enabled);
|
||||||
|
}
|
||||||
|
|
|
@ -40,3 +40,9 @@ int viewport_get_nb_lines(struct viewport *vp);
|
||||||
int viewport_load_config(const char *config, struct viewport *vp);
|
int viewport_load_config(const char *config, struct viewport *vp);
|
||||||
|
|
||||||
void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
|
void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
|
||||||
|
|
||||||
|
void viewportmanager_set_statusbar(bool enabled);
|
||||||
|
/* callbacks for GUI_EVENT_* events */
|
||||||
|
void viewportmanager_draw_statusbars(void*data);
|
||||||
|
void viewportmanager_statusbar_changed(void* data);
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message,
|
||||||
const struct text_message * no_message)
|
const struct text_message * no_message)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned button;
|
int button;
|
||||||
int result=-1;
|
int result=-1;
|
||||||
bool result_displayed;
|
bool result_displayed;
|
||||||
struct gui_yesno yn[NB_SCREENS];
|
struct gui_yesno yn[NB_SCREENS];
|
||||||
|
|
14
apps/main.c
14
apps/main.c
|
@ -121,6 +121,16 @@ const char appsversion[]=APPSVERSION;
|
||||||
|
|
||||||
static void init(void);
|
static void init(void);
|
||||||
|
|
||||||
|
void fourhertz_tick_task(void)
|
||||||
|
{
|
||||||
|
static long last_fire = 0;
|
||||||
|
if (TIME_AFTER(current_tick, last_fire+HZ/4))
|
||||||
|
{
|
||||||
|
queue_post(&button_queue, SYS_FOURHERTZ, 0);
|
||||||
|
last_fire = current_tick;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
#else
|
#else
|
||||||
|
@ -138,6 +148,10 @@ static void app_main(void)
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
touchscreen_set_mode(TOUCHSCREEN_BUTTON);
|
touchscreen_set_mode(TOUCHSCREEN_BUTTON);
|
||||||
#endif
|
#endif
|
||||||
|
tick_add_task(fourhertz_tick_task);
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
|
add_event(GUI_EVENT_STATUSBAR_TOGGLE, false,
|
||||||
|
viewportmanager_statusbar_changed);
|
||||||
root_menu();
|
root_menu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
61
apps/menu.c
61
apps/menu.c
|
@ -283,29 +283,6 @@ static int talk_menu_item(int selected_item, void *data)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* this is used to reload the default menu viewports when the
|
|
||||||
theme changes. nothing happens if the menu is using a supplied parent vp */
|
|
||||||
static void init_default_menu_viewports(struct viewport parent[NB_SCREENS], bool hide_bars)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
{
|
|
||||||
viewport_set_defaults(&parent[i], i);
|
|
||||||
/* viewport_set_defaults() fixes the vp for the bars, so resize */
|
|
||||||
if (hide_bars)
|
|
||||||
{
|
|
||||||
if (global_settings.statusbar)
|
|
||||||
{
|
|
||||||
parent[i].y -= STATUSBAR_HEIGHT;
|
|
||||||
parent[i].height += STATUSBAR_HEIGHT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef HAVE_BUTTONBAR
|
|
||||||
if (!hide_bars && global_settings.buttonbar)
|
|
||||||
parent[0].height -= BUTTONBAR_HEIGHT;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool do_setting_from_menu(const struct menu_item_ex *temp,
|
bool do_setting_from_menu(const struct menu_item_ex *temp,
|
||||||
struct viewport parent[NB_SCREENS])
|
struct viewport parent[NB_SCREENS])
|
||||||
|
@ -383,8 +360,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
||||||
int menu_stack_selected_item[MAX_MENUS];
|
int menu_stack_selected_item[MAX_MENUS];
|
||||||
int stack_top = 0;
|
int stack_top = 0;
|
||||||
bool in_stringlist, done = false;
|
bool in_stringlist, done = false;
|
||||||
|
struct viewport *vps = NULL;
|
||||||
struct viewport *vps, menu_vp[NB_SCREENS]; /* menu_vp will hopefully be phased out */
|
|
||||||
#ifdef HAVE_BUTTONBAR
|
#ifdef HAVE_BUTTONBAR
|
||||||
struct gui_buttonbar buttonbar;
|
struct gui_buttonbar buttonbar;
|
||||||
gui_buttonbar_init(&buttonbar);
|
gui_buttonbar_init(&buttonbar);
|
||||||
|
@ -396,27 +372,12 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
||||||
if (start_menu == NULL)
|
if (start_menu == NULL)
|
||||||
menu = &main_menu_;
|
menu = &main_menu_;
|
||||||
else menu = start_menu;
|
else menu = start_menu;
|
||||||
|
|
||||||
init_default_menu_viewports(menu_vp, hide_bars);
|
/* if hide_bars is true, assume parent has been fixed before passed into
|
||||||
|
* this function, e.g. with viewport_set_defaults(parent, screen, true) */
|
||||||
if (parent)
|
init_menu_lists(menu, &lists, selected, true, parent);
|
||||||
{
|
vps = *(lists.parent);
|
||||||
vps = parent;
|
|
||||||
/* if hide_bars == true we assume the viewport is correctly sized */
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vps = menu_vp;
|
|
||||||
}
|
|
||||||
FOR_NB_SCREENS(i)
|
|
||||||
{
|
|
||||||
screens[i].set_viewport(&vps[i]);
|
|
||||||
screens[i].clear_viewport();
|
|
||||||
screens[i].set_viewport(NULL);
|
|
||||||
}
|
|
||||||
init_menu_lists(menu, &lists, selected, true, vps);
|
|
||||||
in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID);
|
in_stringlist = ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID);
|
||||||
|
|
||||||
/* load the callback, and only reload it if menu changes */
|
/* load the callback, and only reload it if menu changes */
|
||||||
get_menu_callback(menu, &menu_callback);
|
get_menu_callback(menu, &menu_callback);
|
||||||
|
|
||||||
|
@ -436,7 +397,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
||||||
#ifdef HAVE_BUTTONBAR
|
#ifdef HAVE_BUTTONBAR
|
||||||
gui_buttonbar_draw(&buttonbar);
|
gui_buttonbar_draw(&buttonbar);
|
||||||
#endif
|
#endif
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
}
|
}
|
||||||
action = get_action(CONTEXT_MAINMENU,
|
action = get_action(CONTEXT_MAINMENU,
|
||||||
list_do_action_timeout(&lists, HZ));
|
list_do_action_timeout(&lists, HZ));
|
||||||
|
@ -496,7 +456,7 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
||||||
else if (!in_stringlist)
|
else if (!in_stringlist)
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
selected = get_menu_selection(gui_synclist_get_sel_pos(&lists), menu);
|
selected = get_menu_selection(gui_synclist_get_sel_pos(&lists),menu);
|
||||||
temp = menu->submenus[selected];
|
temp = menu->submenus[selected];
|
||||||
type = (temp->flags&MENU_TYPE_MASK);
|
type = (temp->flags&MENU_TYPE_MASK);
|
||||||
if ((type == MT_SETTING_W_TEXT || type == MT_SETTING))
|
if ((type == MT_SETTING_W_TEXT || type == MT_SETTING))
|
||||||
|
@ -640,9 +600,9 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
||||||
temp->function->param);
|
temp->function->param);
|
||||||
else
|
else
|
||||||
return_value = temp->function->function();
|
return_value = temp->function->function();
|
||||||
if (!(menu->flags&MENU_EXITAFTERTHISMENU) || (temp->flags&MENU_EXITAFTERTHISMENU))
|
if (!(menu->flags&MENU_EXITAFTERTHISMENU) ||
|
||||||
|
(temp->flags&MENU_EXITAFTERTHISMENU))
|
||||||
{
|
{
|
||||||
init_default_menu_viewports(menu_vp, hide_bars);
|
|
||||||
init_menu_lists(menu, &lists, selected, true, vps);
|
init_menu_lists(menu, &lists, selected, true, vps);
|
||||||
}
|
}
|
||||||
if (temp->flags&MENU_FUNC_CHECK_RETVAL)
|
if (temp->flags&MENU_FUNC_CHECK_RETVAL)
|
||||||
|
@ -658,9 +618,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
||||||
case MT_SETTING:
|
case MT_SETTING:
|
||||||
case MT_SETTING_W_TEXT:
|
case MT_SETTING_W_TEXT:
|
||||||
{
|
{
|
||||||
if (do_setting_from_menu(temp, menu_vp))
|
if (do_setting_from_menu(temp, vps))
|
||||||
{
|
{
|
||||||
init_default_menu_viewports(menu_vp, hide_bars);
|
|
||||||
init_menu_lists(menu, &lists, selected, true,vps);
|
init_menu_lists(menu, &lists, selected, true,vps);
|
||||||
redraw_lists = false; /* above does the redraw */
|
redraw_lists = false; /* above does the redraw */
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,8 @@ static bool show_credits(void)
|
||||||
{
|
{
|
||||||
/* show the rockbox logo and version untill a button is pressed */
|
/* show the rockbox logo and version untill a button is pressed */
|
||||||
show_logo();
|
show_logo();
|
||||||
get_action(CONTEXT_STD, TIMEOUT_BLOCK);
|
while (IS_SYSEVENT(get_action(CONTEXT_STD, TIMEOUT_BLOCK)))
|
||||||
|
;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -537,7 +537,6 @@ int rectrigger(void)
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
gui_synclist_draw(&lists);
|
gui_synclist_draw(&lists);
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF);
|
peak_meter_trigger(global_settings.rec_trigger_mode!=TRIG_OFF);
|
||||||
settings_apply_trigger();
|
settings_apply_trigger();
|
||||||
changed = false;
|
changed = false;
|
||||||
|
|
|
@ -295,9 +295,7 @@ int time_screen(void* ignored)
|
||||||
if (global_settings.buttonbar)
|
if (global_settings.buttonbar)
|
||||||
menu[i].height -= BUTTONBAR_HEIGHT;
|
menu[i].height -= BUTTONBAR_HEIGHT;
|
||||||
#endif
|
#endif
|
||||||
screens[i].clear_display();
|
|
||||||
draw_timedate(&clock[i], &screens[i]);
|
draw_timedate(&clock[i], &screens[i]);
|
||||||
screens[i].update();
|
|
||||||
}
|
}
|
||||||
ret = do_menu(&time_menu, NULL, menu, false);
|
ret = do_menu(&time_menu, NULL, menu, false);
|
||||||
/* see comments above in the button callback */
|
/* see comments above in the button callback */
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
|
#include "appevents.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
#include "yesno.h"
|
#include "yesno.h"
|
||||||
|
#include "viewport.h"
|
||||||
|
|
||||||
#ifdef IPOD_ACCESSORY_PROTOCOL
|
#ifdef IPOD_ACCESSORY_PROTOCOL
|
||||||
#include "iap.h"
|
#include "iap.h"
|
||||||
|
@ -904,6 +906,9 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
|
||||||
{
|
{
|
||||||
switch(event)
|
switch(event)
|
||||||
{
|
{
|
||||||
|
case SYS_FOURHERTZ:
|
||||||
|
send_event(GUI_EVENT_FOURHERTZ, NULL);
|
||||||
|
break;
|
||||||
case SYS_BATTERY_UPDATE:
|
case SYS_BATTERY_UPDATE:
|
||||||
if(global_settings.talk_battery_level)
|
if(global_settings.talk_battery_level)
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,7 +212,6 @@ static bool add_to_playlist(int position, bool queue)
|
||||||
if (global_settings.playlist_shuffle)
|
if (global_settings.playlist_shuffle)
|
||||||
playlist_shuffle(current_tick, -1);
|
playlist_shuffle(current_tick, -1);
|
||||||
playlist_start(0,0);
|
playlist_start(0,0);
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
onplay_result = ONPLAY_START_PLAY;
|
onplay_result = ONPLAY_START_PLAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -295,10 +295,6 @@ static int display_playlists(char* playlist, bool view)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_NONE:
|
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -746,10 +746,6 @@ bool playlist_viewer_ex(const char* filename)
|
||||||
gui_synclist_draw(&playlist_lists);
|
gui_synclist_draw(&playlist_lists);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACTION_NONE:
|
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
if(default_event_handler(button) == SYS_USB_CONNECTED)
|
||||||
{
|
{
|
||||||
|
@ -834,7 +830,6 @@ bool search_playlist(void)
|
||||||
gui_synclist_draw(&playlist_lists);
|
gui_synclist_draw(&playlist_lists);
|
||||||
while (!exit)
|
while (!exit)
|
||||||
{
|
{
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
button = get_action(CONTEXT_LIST, HZ/4);
|
button = get_action(CONTEXT_LIST, HZ/4);
|
||||||
if (gui_synclist_do_button(&playlist_lists, &button, LIST_WRAP_UNLESS_HELD))
|
if (gui_synclist_do_button(&playlist_lists, &button, LIST_WRAP_UNLESS_HELD))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -621,6 +621,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
appsversion,
|
appsversion,
|
||||||
/* new stuff at the end, sort into place next time
|
/* new stuff at the end, sort into place next time
|
||||||
the API gets incompatible */
|
the API gets incompatible */
|
||||||
|
viewportmanager_set_statusbar,
|
||||||
};
|
};
|
||||||
|
|
||||||
int plugin_load(const char* plugin, const void* parameter)
|
int plugin_load(const char* plugin, const void* parameter)
|
||||||
|
@ -731,8 +732,11 @@ int plugin_load(const char* plugin, const void* parameter)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
invalidate_icache();
|
invalidate_icache();
|
||||||
|
viewportmanager_set_statusbar(false);
|
||||||
|
|
||||||
rc = hdr->entry_point(&rockbox_api, parameter);
|
rc = hdr->entry_point(&rockbox_api, parameter);
|
||||||
|
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
|
|
||||||
button_clear_queue();
|
button_clear_queue();
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* \/ \/ \/ \/ \/
|
* \/ \/ \/ \/ \/
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002 Björn Stenberg
|
* Copyright (C) 2002 Bj<EFBFBD>rn Stenberg
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -132,7 +132,7 @@ void* plugin_get_buffer(size_t *buffer_size);
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 131
|
#define PLUGIN_API_VERSION 132
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
|
@ -334,7 +334,7 @@ struct plugin_api {
|
||||||
void (*gui_synclist_del_item)(struct gui_synclist * lists);
|
void (*gui_synclist_del_item)(struct gui_synclist * lists);
|
||||||
void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll);
|
void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll);
|
||||||
bool (*gui_synclist_do_button)(struct gui_synclist * lists,
|
bool (*gui_synclist_do_button)(struct gui_synclist * lists,
|
||||||
unsigned *action, enum list_wrap wrap);
|
int *action, enum list_wrap wrap);
|
||||||
void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title, int icon);
|
void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title, int icon);
|
||||||
enum yesno_res (*gui_syncyesno_run)(const struct text_message * main_message,
|
enum yesno_res (*gui_syncyesno_run)(const struct text_message * main_message,
|
||||||
const struct text_message * yes_message,
|
const struct text_message * yes_message,
|
||||||
|
@ -785,6 +785,7 @@ struct plugin_api {
|
||||||
const char *appsversion;
|
const char *appsversion;
|
||||||
/* new stuff at the end, sort into place next time
|
/* new stuff at the end, sort into place next time
|
||||||
the API gets incompatible */
|
the API gets incompatible */
|
||||||
|
void (*viewportmanager_set_statusbar)(bool enabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* plugin header */
|
/* plugin header */
|
||||||
|
|
|
@ -674,7 +674,6 @@ static bool view_events(int selected, struct shown *shown)
|
||||||
|
|
||||||
while (!exit)
|
while (!exit)
|
||||||
{
|
{
|
||||||
rb->gui_syncstatusbar_draw(rb->statusbars, true);
|
|
||||||
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||||
rb->gui_synclist_do_button(&gui_memos,&button,LIST_WRAP_UNLESS_HELD);
|
rb->gui_synclist_do_button(&gui_memos,&button,LIST_WRAP_UNLESS_HELD);
|
||||||
|
|
||||||
|
|
|
@ -640,7 +640,6 @@ struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api,
|
||||||
rb->gui_synclist_select_item(&games_list, 0);
|
rb->gui_synclist_select_item(&games_list, 0);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
rb->gui_syncstatusbar_draw(rb->statusbars, true);
|
|
||||||
rb->gui_synclist_draw(&games_list);
|
rb->gui_synclist_draw(&games_list);
|
||||||
curr_selection = rb->gui_synclist_get_sel_pos(&games_list);
|
curr_selection = rb->gui_synclist_get_sel_pos(&games_list);
|
||||||
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
button = rb->get_action(CONTEXT_LIST,TIMEOUT_BLOCK);
|
||||||
|
|
|
@ -556,7 +556,6 @@ static int keybox(void)
|
||||||
|
|
||||||
while (!done)
|
while (!done)
|
||||||
{
|
{
|
||||||
rb->gui_syncstatusbar_draw(rb->statusbars, true);
|
|
||||||
rb->gui_synclist_draw(&kb_list);
|
rb->gui_synclist_draw(&kb_list);
|
||||||
button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
|
button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
|
||||||
if (rb->gui_synclist_do_button(&kb_list, &button, LIST_WRAP_ON))
|
if (rb->gui_synclist_do_button(&kb_list, &button, LIST_WRAP_ON))
|
||||||
|
|
|
@ -98,7 +98,6 @@ int menu_show(int m)
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
rb->gui_synclist_draw(&(menus[m].synclist));
|
rb->gui_synclist_draw(&(menus[m].synclist));
|
||||||
rb->gui_syncstatusbar_draw(rb->statusbars, true);
|
|
||||||
while (!exit) {
|
while (!exit) {
|
||||||
key = rb->get_action(CONTEXT_MAINMENU,HZ/2);
|
key = rb->get_action(CONTEXT_MAINMENU,HZ/2);
|
||||||
/*
|
/*
|
||||||
|
@ -126,7 +125,6 @@ int menu_show(int m)
|
||||||
return MENU_ATTACHED_USB;
|
return MENU_ATTACHED_USB;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rb->gui_syncstatusbar_draw(rb->statusbars, false);
|
|
||||||
}
|
}
|
||||||
return MENU_SELECTED_EXIT;
|
return MENU_SELECTED_EXIT;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +147,6 @@ bool menu_run(int m)
|
||||||
if (menus[m].items[selected].function &&
|
if (menus[m].items[selected].function &&
|
||||||
menus[m].items[selected].function())
|
menus[m].items[selected].function())
|
||||||
return true;
|
return true;
|
||||||
rb->gui_syncstatusbar_draw(rb->statusbars, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,6 @@ enum sc_list_action_type draw_sc_list(struct gui_synclist gui_sc)
|
||||||
rb->gui_synclist_draw(&gui_sc);
|
rb->gui_synclist_draw(&gui_sc);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
/* draw the statusbar, should be done often */
|
|
||||||
rb->gui_syncstatusbar_draw(rb->statusbars, true);
|
|
||||||
/* user input */
|
/* user input */
|
||||||
button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
|
button = rb->get_action(CONTEXT_LIST, TIMEOUT_BLOCK);
|
||||||
if (rb->gui_synclist_do_button(&gui_sc, &button,
|
if (rb->gui_synclist_do_button(&gui_sc, &button,
|
||||||
|
|
|
@ -1008,9 +1008,6 @@ static int star_menu(void)
|
||||||
FOR_NB_SCREENS(selection)
|
FOR_NB_SCREENS(selection)
|
||||||
{
|
{
|
||||||
rb->viewport_set_defaults(&vp[selection], selection);
|
rb->viewport_set_defaults(&vp[selection], selection);
|
||||||
/* we are hiding the statusbar so fix the height also */
|
|
||||||
vp[selection].y = 0;
|
|
||||||
vp[selection].height = rb->screens[selection]->lcdheight;
|
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
if (rb->screens[selection]->depth > 1)
|
if (rb->screens[selection]->depth > 1)
|
||||||
{
|
{
|
||||||
|
@ -1112,7 +1109,6 @@ static int star_menu(void)
|
||||||
level--;
|
level--;
|
||||||
star_run_game(level);
|
star_run_game(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -443,8 +443,6 @@ int zx_kbd_input(char* text/*, int buflen*/)
|
||||||
rb->screens[l]->set_drawmode(DRMODE_SOLID);
|
rb->screens[l]->set_drawmode(DRMODE_SOLID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* gui_syncstatusbar_draw(&statusbars, true);*/
|
|
||||||
FOR_NB_SCREENS(l)
|
FOR_NB_SCREENS(l)
|
||||||
rb->screens[l]->update();
|
rb->screens[l]->update();
|
||||||
|
|
||||||
|
@ -554,10 +552,6 @@ int zx_kbd_input(char* text/*, int buflen*/)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON_NONE:
|
|
||||||
/*gui_syncstatusbar_draw(&statusbars, false);*/
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
|
||||||
|
|
|
@ -743,7 +743,6 @@ int kbd_input(char* text, int buflen)
|
||||||
sc->set_drawmode(DRMODE_SOLID);
|
sc->set_drawmode(DRMODE_SOLID);
|
||||||
}
|
}
|
||||||
|
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
FOR_NB_SCREENS(l)
|
FOR_NB_SCREENS(l)
|
||||||
screens[l].update();
|
screens[l].update();
|
||||||
|
|
||||||
|
@ -1190,7 +1189,6 @@ int kbd_input(char* text, int buflen)
|
||||||
#endif /* !defined (KBD_MODES) || defined (KBD_CURSOR_KEYS) */
|
#endif /* !defined (KBD_MODES) || defined (KBD_CURSOR_KEYS) */
|
||||||
|
|
||||||
case BUTTON_NONE:
|
case BUTTON_NONE:
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
#ifdef KBD_MORSE_INPUT
|
#ifdef KBD_MORSE_INPUT
|
||||||
if (morse_reading)
|
if (morse_reading)
|
||||||
{
|
{
|
||||||
|
|
|
@ -489,7 +489,6 @@ int radio_screen(void)
|
||||||
/* always display status bar in radio screen for now */
|
/* always display status bar in radio screen for now */
|
||||||
global_status.statusbar_forced = statusbar?0:1;
|
global_status.statusbar_forced = statusbar?0:1;
|
||||||
global_settings.statusbar = true;
|
global_settings.statusbar = true;
|
||||||
gui_syncstatusbar_draw(&statusbars,true);
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
viewport_set_defaults(&vp[i], i);
|
viewport_set_defaults(&vp[i], i);
|
||||||
|
@ -986,8 +985,6 @@ int radio_screen(void)
|
||||||
gui_buttonbar_draw(&buttonbar);
|
gui_buttonbar_draw(&buttonbar);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* Only force the redraw if update_screen is true */
|
|
||||||
gui_syncstatusbar_draw(&statusbars,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_screen = false;
|
update_screen = false;
|
||||||
|
@ -1027,7 +1024,6 @@ int radio_screen(void)
|
||||||
if(audio_status() & AUDIO_STATUS_ERROR)
|
if(audio_status() & AUDIO_STATUS_ERROR)
|
||||||
{
|
{
|
||||||
splash(0, str(LANG_DISK_FULL));
|
splash(0, str(LANG_DISK_FULL));
|
||||||
gui_syncstatusbar_draw(&statusbars,true);
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
screens[i].set_viewport(&vp[i]);
|
screens[i].set_viewport(&vp[i]);
|
||||||
|
@ -1397,7 +1393,6 @@ static int handle_radio_presets(void)
|
||||||
while (result == 0)
|
while (result == 0)
|
||||||
{
|
{
|
||||||
gui_synclist_draw(&lists);
|
gui_synclist_draw(&lists);
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
list_do_action(CONTEXT_STD, TIMEOUT_BLOCK,
|
list_do_action(CONTEXT_STD, TIMEOUT_BLOCK,
|
||||||
&lists, &action, LIST_WRAP_UNLESS_HELD);
|
&lists, &action, LIST_WRAP_UNLESS_HELD);
|
||||||
switch (action)
|
switch (action)
|
||||||
|
|
|
@ -1038,7 +1038,6 @@ bool recording_screen(bool no_source)
|
||||||
bool statusbar = global_settings.statusbar;
|
bool statusbar = global_settings.statusbar;
|
||||||
global_status.statusbar_forced = statusbar?0:1;
|
global_status.statusbar_forced = statusbar?0:1;
|
||||||
global_settings.statusbar = true;
|
global_settings.statusbar = true;
|
||||||
gui_syncstatusbar_draw(&statusbars,true);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const unsigned char *byte_units[] = {
|
static const unsigned char *byte_units[] = {
|
||||||
|
@ -1102,7 +1101,7 @@ bool recording_screen(bool no_source)
|
||||||
/* top vp, 4 lines, force sys font if total screen < 6 lines
|
/* top vp, 4 lines, force sys font if total screen < 6 lines
|
||||||
NOTE: one could limit the list to 1 line and get away with 5 lines */
|
NOTE: one could limit the list to 1 line and get away with 5 lines */
|
||||||
v = &vp_top[i];
|
v = &vp_top[i];
|
||||||
viewport_set_defaults(v, i); /*already takes care of statusbar*/
|
viewport_set_defaults(v, i);
|
||||||
if (viewport_get_nb_lines(v) < 4)
|
if (viewport_get_nb_lines(v) < 4)
|
||||||
{
|
{
|
||||||
/* compact needs 4 lines total */
|
/* compact needs 4 lines total */
|
||||||
|
@ -1864,7 +1863,6 @@ bool recording_screen(bool no_source)
|
||||||
/* draw peakmeter again (check if this can be removed) */
|
/* draw peakmeter again (check if this can be removed) */
|
||||||
FOR_NB_ACTIVE_SCREENS(i)
|
FOR_NB_ACTIVE_SCREENS(i)
|
||||||
{
|
{
|
||||||
screens[i].set_viewport(NULL);
|
|
||||||
gui_statusbar_draw(&(statusbars.statusbars[i]), true);
|
gui_statusbar_draw(&(statusbars.statusbars[i]), true);
|
||||||
screens[i].set_viewport(&vp_top[i]);
|
screens[i].set_viewport(&vp_top[i]);
|
||||||
peak_meter_screen(&screens[i], pm_x[i], pm_y[i], pm_h[i]);
|
peak_meter_screen(&screens[i], pm_x[i], pm_y[i], pm_h[i]);
|
||||||
|
@ -1882,7 +1880,6 @@ bool recording_screen(bool no_source)
|
||||||
if (audio_stat & AUDIO_STATUS_ERROR)
|
if (audio_stat & AUDIO_STATUS_ERROR)
|
||||||
{
|
{
|
||||||
splash(0, str(LANG_DISK_FULL));
|
splash(0, str(LANG_DISK_FULL));
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
|
|
||||||
FOR_NB_SCREENS(i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].update();
|
screens[i].update();
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "buttonbar.h"
|
#include "buttonbar.h"
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
#include "yesno.h"
|
#include "yesno.h"
|
||||||
|
#include "viewport.h"
|
||||||
|
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#if CONFIG_TUNER
|
#if CONFIG_TUNER
|
||||||
|
@ -117,7 +118,6 @@ static int browser(void* param)
|
||||||
/* Now display progress until it's ready or the user exits */
|
/* Now display progress until it's ready or the user exits */
|
||||||
while(!tagcache_is_usable())
|
while(!tagcache_is_usable())
|
||||||
{
|
{
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
struct tagcache_stat *stat = tagcache_get_stat();
|
struct tagcache_stat *stat = tagcache_get_stat();
|
||||||
|
|
||||||
/* Allow user to exit */
|
/* Allow user to exit */
|
||||||
|
@ -262,6 +262,8 @@ static int wpsscrn(void* param)
|
||||||
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
||||||
show_remote_main_backdrop();
|
show_remote_main_backdrop();
|
||||||
#endif
|
#endif
|
||||||
|
/* always re-enable the statusbar after the WPS */
|
||||||
|
viewportmanager_set_statusbar(true);
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
#if CONFIG_TUNER
|
#if CONFIG_TUNER
|
||||||
|
|
|
@ -138,7 +138,6 @@ void usb_screen(void)
|
||||||
screens[i].update();
|
screens[i].update();
|
||||||
}
|
}
|
||||||
|
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
while (button_get(true) & BUTTON_REL);
|
while (button_get(true) & BUTTON_REL);
|
||||||
#else
|
#else
|
||||||
|
@ -355,7 +354,6 @@ int charging_screen(void)
|
||||||
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
|
||||||
#endif
|
#endif
|
||||||
backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
|
backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
logo_lock_patterns(true);
|
logo_lock_patterns(true);
|
||||||
|
@ -584,7 +582,6 @@ bool set_time_screen(const char* title, struct tm *tm)
|
||||||
screens[s].update_viewport();
|
screens[s].update_viewport();
|
||||||
screens[s].set_viewport(NULL);
|
screens[s].set_viewport(NULL);
|
||||||
}
|
}
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
|
|
||||||
/* set the most common numbers */
|
/* set the most common numbers */
|
||||||
min = 0;
|
min = 0;
|
||||||
|
@ -841,9 +838,7 @@ bool browse_id3(void)
|
||||||
gui_synclist_init(&id3_lists, &id3_get_info, &info, true, 2, NULL);
|
gui_synclist_init(&id3_lists, &id3_get_info, &info, true, 2, NULL);
|
||||||
gui_synclist_set_nb_items(&id3_lists, info.count*2);
|
gui_synclist_set_nb_items(&id3_lists, info.count*2);
|
||||||
gui_synclist_draw(&id3_lists);
|
gui_synclist_draw(&id3_lists);
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
while (true) {
|
while (true) {
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
key = get_action(CONTEXT_LIST,HZ/2);
|
key = get_action(CONTEXT_LIST,HZ/2);
|
||||||
if(key!=ACTION_NONE && key!=ACTION_UNKNOWN
|
if(key!=ACTION_NONE && key!=ACTION_UNKNOWN
|
||||||
&& !gui_synclist_do_button(&id3_lists, &key,LIST_WRAP_UNLESS_HELD))
|
&& !gui_synclist_do_button(&id3_lists, &key,LIST_WRAP_UNLESS_HELD))
|
||||||
|
@ -916,7 +911,6 @@ bool view_runtime(void)
|
||||||
}
|
}
|
||||||
lasttime = current_tick;
|
lasttime = current_tick;
|
||||||
gui_synclist_draw(&lists);
|
gui_synclist_draw(&lists);
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
list_do_action(CONTEXT_STD, HZ,
|
list_do_action(CONTEXT_STD, HZ,
|
||||||
&lists, &action, LIST_WRAP_UNLESS_HELD);
|
&lists, &action, LIST_WRAP_UNLESS_HELD);
|
||||||
if(action == ACTION_STD_CANCEL)
|
if(action == ACTION_STD_CANCEL)
|
||||||
|
|
|
@ -273,7 +273,7 @@ bool settings_load_config(const char* file, bool apply)
|
||||||
while (read_line(fd, line, sizeof line) > 0)
|
while (read_line(fd, line, sizeof line) > 0)
|
||||||
{
|
{
|
||||||
if (!settings_parseline(line, &name, &value))
|
if (!settings_parseline(line, &name, &value))
|
||||||
continue;
|
continue;
|
||||||
for(i=0; i<nb_settings; i++)
|
for(i=0; i<nb_settings; i++)
|
||||||
{
|
{
|
||||||
if (settings[i].cfg_name == NULL)
|
if (settings[i].cfg_name == NULL)
|
||||||
|
@ -316,6 +316,8 @@ bool settings_load_config(const char* file, bool apply)
|
||||||
int temp;
|
int temp;
|
||||||
if (cfg_string_to_int(i,&temp,value))
|
if (cfg_string_to_int(i,&temp,value))
|
||||||
*(bool*)settings[i].setting = (temp==0?false:true);
|
*(bool*)settings[i].setting = (temp==0?false:true);
|
||||||
|
if (settings[i].bool_setting->option_callback)
|
||||||
|
settings[i].bool_setting->option_callback(temp==0?false:true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case F_T_CHARPTR:
|
case F_T_CHARPTR:
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#ifdef IPOD_ACCESSORY_PROTOCOL
|
#ifdef IPOD_ACCESSORY_PROTOCOL
|
||||||
#include "iap.h"
|
#include "iap.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "statusbar.h"
|
||||||
|
|
||||||
#define NVRAM(bytes) (bytes<<F_NVRAM_MASK_SHIFT)
|
#define NVRAM(bytes) (bytes<<F_NVRAM_MASK_SHIFT)
|
||||||
/** NOTE: NVRAM_CONFIG_VERSION is in settings_list.h
|
/** NOTE: NVRAM_CONFIG_VERSION is in settings_list.h
|
||||||
|
@ -545,7 +546,7 @@ const struct settings_list settings[] = {
|
||||||
ID2P(LANG_INVERT_CURSOR_BAR)),
|
ID2P(LANG_INVERT_CURSOR_BAR)),
|
||||||
#endif
|
#endif
|
||||||
OFFON_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar,
|
OFFON_SETTING(F_THEMESETTING|F_TEMPVAR, statusbar,
|
||||||
LANG_STATUS_BAR, true,"statusbar", NULL),
|
LANG_STATUS_BAR, true,"statusbar", gui_statusbar_changed),
|
||||||
OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true,"scrollbar", NULL),
|
OFFON_SETTING(0,scrollbar, LANG_SCROLL_BAR, true,"scrollbar", NULL),
|
||||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||||
OFFON_SETTING(0,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL),
|
OFFON_SETTING(0,buttonbar, LANG_BUTTON_BAR ,true,"buttonbar", NULL),
|
||||||
|
|
|
@ -473,7 +473,6 @@ static int update_dir(void)
|
||||||
#endif
|
#endif
|
||||||
gui_synclist_draw(&tree_lists);
|
gui_synclist_draw(&tree_lists);
|
||||||
gui_synclist_speak_item(&tree_lists);
|
gui_synclist_speak_item(&tree_lists);
|
||||||
gui_syncstatusbar_draw(&statusbars, true);
|
|
||||||
return tc.filesindir;
|
return tc.filesindir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +599,7 @@ static int dirbrowse()
|
||||||
{
|
{
|
||||||
int numentries=0;
|
int numentries=0;
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
unsigned button, oldbutton;
|
int button, oldbutton;
|
||||||
bool reload_root = false;
|
bool reload_root = false;
|
||||||
int lastfilter = *tc.dirfilter;
|
int lastfilter = *tc.dirfilter;
|
||||||
bool lastsortcase = global_settings.sort_case;
|
bool lastsortcase = global_settings.sort_case;
|
||||||
|
@ -797,10 +796,6 @@ static int dirbrowse()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ACTION_NONE:
|
|
||||||
gui_syncstatusbar_draw(&statusbars, false);
|
|
||||||
break;
|
|
||||||
|
|
||||||
#ifdef HAVE_HOTSWAP
|
#ifdef HAVE_HOTSWAP
|
||||||
case SYS_FS_CHANGED:
|
case SYS_FS_CHANGED:
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
|
|
|
@ -368,7 +368,6 @@ long button_get_w_tmo(int ticks)
|
||||||
ev.id = BUTTON_NONE;
|
ev.id = BUTTON_NONE;
|
||||||
else
|
else
|
||||||
button_data = ev.data;
|
button_data = ev.data;
|
||||||
|
|
||||||
return ev.id;
|
return ev.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,7 @@
|
||||||
#define SYS_CAR_ADAPTER_RESUME MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 1)
|
#define SYS_CAR_ADAPTER_RESUME MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 1)
|
||||||
#define SYS_IAP_PERIODIC MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 2)
|
#define SYS_IAP_PERIODIC MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 2)
|
||||||
#define SYS_IAP_HANDLEPKT MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 3)
|
#define SYS_IAP_HANDLEPKT MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 3)
|
||||||
|
#define SYS_FOURHERTZ MAKE_SYS_EVENT(SYS_EVENT_CLS_MISC, 4)
|
||||||
|
|
||||||
#define IS_SYSEVENT(ev) ((ev & SYS_EVENT) == SYS_EVENT)
|
#define IS_SYSEVENT(ev) ((ev & SYS_EVENT) == SYS_EVENT)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue