summaryrefslogtreecommitdiff
path: root/apps/gui/gwps-common.c
diff options
context:
space:
mode:
authorKevin Ferrare <kevin@rockbox.org>2005-11-20 22:13:52 +0000
committerKevin Ferrare <kevin@rockbox.org>2005-11-20 22:13:52 +0000
commit0d9c7b5bcbc1fd90a810780b5b58835ee8590f54 (patch)
treeebb75c26a31d219a21ecc7aeba30f3c9956a0f62 /apps/gui/gwps-common.c
parent6707892151dbfe4f09901fd4f33d172aac5a5d56 (diff)
downloadrockbox-0d9c7b5bcbc1fd90a810780b5b58835ee8590f54.tar.gz
rockbox-0d9c7b5bcbc1fd90a810780b5b58835ee8590f54.zip
Applied Stephan Wezel's patch for the new wps %wd/%we tags (disable/enable statusbar in wps mode independantly from the global setting)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8015 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r--apps/gui/gwps-common.c81
1 files changed, 59 insertions, 22 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 92d7ded740..c2a4dff3b6 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -17,7 +17,6 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "gwps-common.h" 19#include "gwps-common.h"
20#include "gwps.h"
21#include "font.h" 20#include "font.h"
22#include <stdio.h> 21#include <stdio.h>
23#include <string.h> 22#include <string.h>
@@ -37,7 +36,6 @@
37#include "lang.h" 36#include "lang.h"
38#include "misc.h" 37#include "misc.h"
39 38
40#include "statusbar.h"
41#include "splash.h" 39#include "splash.h"
42#include "scrollbar.h" 40#include "scrollbar.h"
43#ifdef HAVE_LCD_BITMAP 41#ifdef HAVE_LCD_BITMAP
@@ -57,6 +55,24 @@ static void draw_player_fullbar(struct gui_wps *gwps,
57 /* 3% of 30min file == 54s step size */ 55 /* 3% of 30min file == 54s step size */
58#define MIN_FF_REWIND_STEP 500 56#define MIN_FF_REWIND_STEP 500
59 57
58/* draws the statusbar on the given wps-screen */
59#ifdef HAVE_LCD_BITMAP
60static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force)
61{
62 bool draw = global_settings.statusbar;
63 if(wps->data->wps_sb_tag
64 && gui_wps->data->show_sb_on_wps)
65 draw = true;
66 else if(wps->data->wps_sb_tag)
67 draw = false;
68 if(draw)
69 gui_statusbar_draw(wps->statusbar, force);
70}
71#else
72#define gui_wps_statusbar_draw(wps, force) \
73 gui_statusbar_draw((wps)->statusbar, (force))
74#endif
75
60/* Format time into buf. 76/* Format time into buf.
61 * 77 *
62 * buf - buffer to format to. 78 * buf - buffer to format to.
@@ -944,6 +960,11 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
944 subline = 0; 960 subline = 0;
945 data->format_lines[line][subline] = buf; 961 data->format_lines[line][subline] = buf;
946 962
963#ifdef HAVE_LCD_BITMAP
964 bool wps_tag_found = false;
965 data->wps_sb_tag = false;
966 data->show_sb_on_wps = false;
967#endif
947 while ((*buf) && (line < WPS_MAX_LINES)) 968 while ((*buf) && (line < WPS_MAX_LINES))
948 { 969 {
949 c = *buf; 970 c = *buf;
@@ -955,10 +976,19 @@ void gui_wps_format(struct wps_data *data, const char *bmpdir,
955 * don't skip %x lines (pre-load bitmaps) 976 * don't skip %x lines (pre-load bitmaps)
956 */ 977 */
957 case '%': 978 case '%':
979#ifdef HAVE_LCD_BITMAP
980 if(*(buf+1) == 'w' && (*(buf+2) == 'd' || *(buf+2) == 'e')
981 && !wps_tag_found)
982 {
983 data->wps_sb_tag = true;
984 if( *(buf+1) == 'w' && *(buf+2) == 'e' )
985 data->show_sb_on_wps = true;
986 wps_tag_found = true;
987 }
958 if (*(buf+1) != 'x') 988 if (*(buf+1) != 'x')
959 buf++; 989 buf++;
960 break; 990 break;
961 991#endif
962 case '\r': /* CR */ 992 case '\r': /* CR */
963 *buf = 0; 993 *buf = 0;
964 break; 994 break;
@@ -1177,7 +1207,13 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
1177 } 1207 }
1178#ifdef HAVE_LCD_BITMAP 1208#ifdef HAVE_LCD_BITMAP
1179 int h = font_get(FONT_UI)->height; 1209 int h = font_get(FONT_UI)->height;
1180 int offset = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; 1210 int offset = 0;
1211 gui_wps_statusbar_draw(gwps, true);
1212 if(data->wps_sb_tag && data->show_sb_on_wps)
1213 offset = STATUSBAR_HEIGHT;
1214 else if ( global_settings.statusbar && !data->wps_sb_tag)
1215 offset = STATUSBAR_HEIGHT;
1216
1181 /* to find out wether the peak meter is enabled we 1217 /* to find out wether the peak meter is enabled we
1182 assume it wasn't until we find a line that contains 1218 assume it wasn't until we find a line that contains
1183 the peak meter. We can't use peak_meter_enabled itself 1219 the peak meter. We can't use peak_meter_enabled itself
@@ -1774,24 +1810,26 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size)
1774} 1810}
1775#endif 1811#endif
1776 1812
1777/* set volume 1813/* set volume */
1778 return true if screen restore is needed 1814void setvol(void)
1779 return false otherwise
1780*/
1781bool setvol(void)
1782{ 1815{
1783 if (global_settings.volume < sound_min(SOUND_VOLUME)) 1816 if (global_settings.volume < sound_min(SOUND_VOLUME))
1784 global_settings.volume = sound_min(SOUND_VOLUME); 1817 global_settings.volume = sound_min(SOUND_VOLUME);
1785 if (global_settings.volume > sound_max(SOUND_VOLUME)) 1818 if (global_settings.volume > sound_max(SOUND_VOLUME))
1786 global_settings.volume = sound_max(SOUND_VOLUME); 1819 global_settings.volume = sound_max(SOUND_VOLUME);
1787 sound_set_volume(global_settings.volume); 1820 sound_set_volume(global_settings.volume);
1788 gui_syncstatusbar_draw(&statusbars, false);
1789 int i;
1790 FOR_NB_SCREENS(i)
1791 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_NON_STATIC);
1792 settings_save(); 1821 settings_save();
1822}
1823/* return true if screen restore is needed
1824 return false otherwise
1825*/
1826bool update_onvol_change(struct gui_wps * gwps)
1827{
1828 gui_wps_statusbar_draw(gwps, false);
1829 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC);
1830
1793#ifdef HAVE_LCD_CHARCELLS 1831#ifdef HAVE_LCD_CHARCELLS
1794 gui_syncsplash(0, false, "Vol: %d %% ", 1832 gui_splash(gwps->display,0, false, "Vol: %d %% ",
1795 sound_val2phys(SOUND_VOLUME, global_settings.volume)); 1833 sound_val2phys(SOUND_VOLUME, global_settings.volume));
1796 return true; 1834 return true;
1797#endif 1835#endif
@@ -1837,13 +1875,13 @@ bool ffwd_rew(int button)
1837 max_step = (wps_state.id3->length - 1875 max_step = (wps_state.id3->length -
1838 (wps_state.id3->elapsed + 1876 (wps_state.id3->elapsed +
1839 ff_rewind_count)) * 1877 ff_rewind_count)) *
1840 FF_REWIND_MAX_PERCENT / 100; 1878 FF_REWIND_MAX_PERCENT / 100;
1841 } 1879 }
1842 else 1880 else
1843 { 1881 {
1844 /* rewinding, calc max step relative to start */ 1882 /* rewinding, calc max step relative to start */
1845 max_step = (wps_state.id3->elapsed + ff_rewind_count) * 1883 max_step = (wps_state.id3->elapsed + ff_rewind_count) *
1846 FF_REWIND_MAX_PERCENT / 100; 1884 FF_REWIND_MAX_PERCENT / 100;
1847 } 1885 }
1848 1886
1849 max_step = MAX(max_step, MIN_FF_REWIND_STEP); 1887 max_step = MAX(max_step, MIN_FF_REWIND_STEP);
@@ -2003,10 +2041,9 @@ bool gui_wps_display(void)
2003 } 2041 }
2004 yield(); 2042 yield();
2005 FOR_NB_SCREENS(i) 2043 FOR_NB_SCREENS(i)
2006 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL);
2007 gui_syncstatusbar_draw(&statusbars, true);
2008 FOR_NB_SCREENS(i)
2009 { 2044 {
2045 gui_wps_refresh(&gui_wps[i], 0, WPS_REFRESH_ALL);
2046
2010#ifdef HAVE_LCD_BITMAP 2047#ifdef HAVE_LCD_BITMAP
2011 wps_display_images(&gui_wps[i]); 2048 wps_display_images(&gui_wps[i]);
2012 gui_wps[i].display->update(); 2049 gui_wps[i].display->update();
@@ -2039,9 +2076,9 @@ bool update(struct gui_wps *gwps)
2039 if (gwps->state->id3) 2076 if (gwps->state->id3)
2040 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); 2077 gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC);
2041 2078
2042 gui_syncstatusbar_draw(&statusbars, false); 2079 gui_wps_statusbar_draw(gwps, false);
2043 2080
2044 return retcode; 2081 return retcode;
2045} 2082}
2046 2083
2047#ifdef WPS_KEYLOCK 2084#ifdef WPS_KEYLOCK