summaryrefslogtreecommitdiff
path: root/apps/status.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-06-27 01:05:40 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-06-27 01:05:40 +0000
commit32e27d93e883384cffb846998119ecdfd9b8fed7 (patch)
treeb5c26ee52a057c0edeeba25fa10056ab30c566b0 /apps/status.c
parent0690ac1966772975879540a4c614b497858ecfb7 (diff)
downloadrockbox-32e27d93e883384cffb846998119ecdfd9b8fed7.tar.gz
rockbox-32e27d93e883384cffb846998119ecdfd9b8fed7.zip
The status bar now keeps track of the mpeg status, instead of having to call status_set_playmode() all the time
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4805 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/status.c')
-rw-r--r--apps/status.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/apps/status.c b/apps/status.c
index 5ff7a92e75..af6eaa4e2a 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -25,6 +25,7 @@
25#include "settings.h" 25#include "settings.h"
26#include "status.h" 26#include "status.h"
27#include "mp3_playback.h" 27#include "mp3_playback.h"
28#include "mpeg.h"
28#include "wps.h" 29#include "wps.h"
29#ifdef HAVE_RTC 30#ifdef HAVE_RTC
30#include "timefuncs.h" 31#include "timefuncs.h"
@@ -35,7 +36,7 @@
35#endif 36#endif
36#include "powermgmt.h" 37#include "powermgmt.h"
37 38
38static enum playmode current_mode = STATUS_STOP; 39static enum playmode ff_mode;
39 40
40static long switch_tick; 41static long switch_tick;
41static int battery_charge_step = 0; 42static int battery_charge_step = 0;
@@ -57,15 +58,47 @@ struct status_info {
57 58
58void status_init(void) 59void status_init(void)
59{ 60{
60 status_set_playmode(STATUS_STOP); 61 ff_mode = 0;
61} 62}
62 63
63void status_set_playmode(enum playmode mode) 64void status_set_ffmode(enum playmode mode)
64{ 65{
65 current_mode = mode; 66 ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
66 status_draw(false); 67 status_draw(false);
67} 68}
68 69
70int current_playmode(void)
71{
72 int mpeg_stat = mpeg_status();
73
74 /* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
75 and that supercedes the other modes */
76 if(ff_mode)
77 return ff_mode;
78
79 if(mpeg_stat & MPEG_STATUS_PLAY)
80 {
81 if(mpeg_stat & MPEG_STATUS_PAUSE)
82 return STATUS_PAUSE;
83 else
84 return STATUS_PLAY;
85 }
86#ifdef HAVE_MAS3587F
87 else
88 {
89 if(mpeg_stat & MPEG_STATUS_RECORD)
90 {
91 if(mpeg_stat & MPEG_STATUS_PAUSE)
92 return STATUS_RECORD_PAUSE;
93 else
94 return STATUS_RECORD;
95 }
96 }
97#endif
98
99 return STATUS_STOP;
100}
101
69#if defined(HAVE_LCD_CHARCELLS) 102#if defined(HAVE_LCD_CHARCELLS)
70static bool record = false; 103static bool record = false;
71static bool audio = false; 104static bool audio = false;
@@ -120,7 +153,7 @@ void status_draw(bool force_redraw)
120 info.shuffle = global_settings.playlist_shuffle; 153 info.shuffle = global_settings.playlist_shuffle;
121 info.keylock = keys_locked; 154 info.keylock = keys_locked;
122 info.repeat = global_settings.repeat_mode; 155 info.repeat = global_settings.repeat_mode;
123 info.playmode = current_mode; 156 info.playmode = current_playmode();
124 157
125 /* only redraw if forced to, or info has changed */ 158 /* only redraw if forced to, or info has changed */
126 if (force_redraw || 159 if (force_redraw ||
@@ -181,7 +214,7 @@ void status_draw(bool force_redraw)
181 statusbar_icon_battery(info.battlevel, plug_state); 214 statusbar_icon_battery(info.battlevel, plug_state);
182 215
183 statusbar_icon_volume(info.volume); 216 statusbar_icon_volume(info.volume);
184 statusbar_icon_play_state(current_mode + Icon_Play); 217 statusbar_icon_play_state(current_playmode() + Icon_Play);
185 switch (info.repeat) { 218 switch (info.repeat) {
186 case REPEAT_ONE: 219 case REPEAT_ONE:
187 statusbar_icon_play_mode(Icon_RepeatOne); 220 statusbar_icon_play_mode(Icon_RepeatOne);
@@ -218,8 +251,8 @@ void status_draw(bool force_redraw)
218 lcd_icon(ICON_VOLUME_4, info.volume > 70); 251 lcd_icon(ICON_VOLUME_4, info.volume > 70);
219 lcd_icon(ICON_VOLUME_5, info.volume > 90); 252 lcd_icon(ICON_VOLUME_5, info.volume > 90);
220 253
221 lcd_icon(ICON_PLAY, current_mode == STATUS_PLAY); 254 lcd_icon(ICON_PLAY, current_playmode() == STATUS_PLAY);
222 lcd_icon(ICON_PAUSE, current_mode == STATUS_PAUSE); 255 lcd_icon(ICON_PAUSE, current_playmode() == STATUS_PAUSE);
223 256
224 lcd_icon(ICON_REPEAT, global_settings.repeat_mode != REPEAT_OFF); 257 lcd_icon(ICON_REPEAT, global_settings.repeat_mode != REPEAT_OFF);
225 lcd_icon(ICON_1, global_settings.repeat_mode == REPEAT_ONE); 258 lcd_icon(ICON_1, global_settings.repeat_mode == REPEAT_ONE);