summaryrefslogtreecommitdiffstats
path: root/apps/recorder
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/icons.c181
-rw-r--r--apps/recorder/icons.h2
-rw-r--r--apps/recorder/keyboard.c20
-rw-r--r--apps/recorder/radio.c38
-rw-r--r--apps/recorder/recording.c6
5 files changed, 38 insertions, 209 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index baba77bc52..1306a1d770 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -73,11 +73,9 @@ const unsigned char bitmap_icons_7x8[][7] =
{0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */
};
-#if CONFIG_LED == LED_VIRTUAL
/* Disk/MMC activity */
const unsigned char bitmap_icon_disk[12] =
{0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f};
-#endif
#if LCD_WIDTH == 112 || LCD_WIDTH == 128 \
|| (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128)
@@ -341,130 +339,6 @@ const unsigned char rockbox160x53x2[] = {
#endif
/*
- * Print battery icon to status bar
- */
-void statusbar_icon_battery(int percent)
-{
- int fill;
- char buffer[5];
- unsigned int width, height;
-
- /* fill battery */
- fill = percent;
- if (fill < 0)
- fill = 0;
- if (fill > 100)
- fill = 100;
-
-#if defined(HAVE_CHARGE_CTRL) && !defined(SIMULATOR) /* Rec v1 target only */
- /* show graphical animation when charging instead of numbers */
- if ((global_settings.battery_display) &&
- (charge_state != 1) &&
- (percent > -1)) {
-#else /* all others */
- if (global_settings.battery_display && (percent > -1)) {
-#endif
- /* Numeric display */
- snprintf(buffer, sizeof(buffer), "%3d", fill);
- lcd_setfont(FONT_SYSFIXED);
- lcd_getstringsize(buffer, &width, &height);
- if (height <= STATUSBAR_HEIGHT)
- lcd_putsxy(ICON_BATTERY_X_POS + ICON_BATTERY_WIDTH / 2 -
- width/2, STATUSBAR_Y_POS, buffer);
- lcd_setfont(FONT_UI);
-
- }
- else {
- /* draw battery */
- lcd_drawrect(ICON_BATTERY_X_POS, STATUSBAR_Y_POS, 17, 7);
- lcd_vline(ICON_BATTERY_X_POS + 17, STATUSBAR_Y_POS + 2,
- STATUSBAR_Y_POS + 4);
-
- fill = fill * 15 / 100;
- lcd_fillrect(ICON_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1, fill, 5);
- }
-
- if (percent == -1) {
- lcd_setfont(FONT_SYSFIXED);
- lcd_putsxy(ICON_BATTERY_X_POS + ICON_BATTERY_WIDTH / 2 - 4,
- STATUSBAR_Y_POS, "?");
- lcd_setfont(FONT_UI);
- }
-}
-
-/*
- * Print volume gauge to status bar
- */
-bool statusbar_icon_volume(int percent)
-{
- int i;
- int volume;
- int vol;
- char buffer[4];
- unsigned int width, height;
- bool needs_redraw = false;
- int type = global_settings.volume_type;
- static long switch_tick;
- static int last_volume = -1; /* -1 means "first update ever" */
-
- volume = percent;
- if (volume < 0)
- volume = 0;
- if (volume > 100)
- volume = 100;
-
- if (volume == 0) {
- lcd_mono_bitmap(bitmap_icons_7x8[Icon_Mute],
- ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 4,
- STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT);
- }
- else {
- /* We want to redraw the icon later on */
- if (last_volume != volume && last_volume >= 0) {
- switch_tick = current_tick + HZ;
- }
-
- /* If the timeout hasn't yet been reached, we show it numerically
- and tell the caller that we want to be called again */
- if (TIME_BEFORE(current_tick,switch_tick)) {
- type = 1;
- needs_redraw = true;
- }
-
- /* display volume level numerical? */
- if (type)
- {
- snprintf(buffer, sizeof(buffer), "%2d", percent);
- lcd_setfont(FONT_SYSFIXED);
- lcd_getstringsize(buffer, &width, &height);
- if (height <= STATUSBAR_HEIGHT)
- lcd_putsxy(ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 -
- width/2, STATUSBAR_Y_POS, buffer);
- lcd_setfont(FONT_UI);
- } else {
- /* display volume bar */
- vol = volume * 14 / 100;
- for(i=0; i < vol; i++) {
- lcd_vline(ICON_VOLUME_X_POS + i, STATUSBAR_Y_POS + 6 - i / 2,
- STATUSBAR_Y_POS + 6);
- }
- }
- }
- last_volume = volume;
-
- return needs_redraw;
-}
-
-/*
- * Print play state to status bar
- */
-void statusbar_icon_play_state(int state)
-{
- lcd_mono_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS,
- STATUSBAR_Y_POS, ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
-}
-
-/*
* Print play mode to status bar
*/
void statusbar_icon_play_mode(int mode)
@@ -478,59 +352,6 @@ void statusbar_icon_play_mode(int mode)
*/
void statusbar_icon_shuffle(void)
{
- lcd_mono_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS,
+ lcd_mono_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS,
STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT);
}
-
-/*
- * Print lock when keys are locked
- */
-void statusbar_icon_lock(void)
-{
- lcd_mono_bitmap(bitmap_icons_5x8[Icon_Lock], LOCK_X_POS,
- STATUSBAR_Y_POS, 5, 8);
-}
-
-#if CONFIG_LED == LED_VIRTUAL
-/*
- * no real LED: disk activity in status bar
- */
-void statusbar_led(void)
-{
- lcd_mono_bitmap(bitmap_icon_disk, ICON_DISK_X_POS,
- STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT);
-}
-#endif
-
-#ifdef HAVE_RTC
-/*
- * Print time to status bar
- */
-void statusbar_time(int hour, int minute)
-{
- unsigned char buffer[6];
- unsigned int width, height;
-
- if ( hour >= 0 &&
- hour <= 23 &&
- minute >= 0 &&
- minute <= 59 ) {
- if ( global_settings.timeformat ) { /* 12 hour clock */
- hour %= 12;
- if ( hour == 0 ) {
- hour += 12;
- }
- }
- snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute);
- }
- else {
- strncpy(buffer, "--:--", sizeof buffer);
- }
-
- lcd_setfont(FONT_SYSFIXED);
- lcd_getstringsize(buffer, &width, &height);
- if (height <= STATUSBAR_HEIGHT)
- lcd_putsxy(TIME_X_END - width, STATUSBAR_Y_POS, buffer);
- lcd_setfont(FONT_UI);
-}
-#endif
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index 6ffcc9cb80..c996fd92aa 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -74,9 +74,7 @@ enum icons_7x8 {
extern const unsigned char bitmap_icons_5x8[1][5];
extern const unsigned char bitmap_icons_6x8[LastIcon][6];
extern const unsigned char bitmap_icons_7x8[Icon_Last][7];
-#if CONFIG_LED == LED_VIRTUAL
extern const unsigned char bitmap_icon_disk[];
-#endif
#if LCD_WIDTH == 112 || LCD_WIDTH == 128 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128)
extern const unsigned char rockbox112x37[];
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index 5ff340b596..31c0643e3c 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -26,10 +26,11 @@
#include <string.h>
#include "font.h"
#include "screens.h"
-#include "status.h"
+#include "statusbar.h"
#include "talk.h"
#include "settings.h"
#include "misc.h"
+#include "buttonbar.h"
#define KEYBOARD_MARGIN 3
@@ -177,7 +178,11 @@ int kbd_input(char* text, int buflen)
char outline[256];
struct font* font = font_get(FONT_SYSFIXED);
int button, lastbutton = 0;
-
+#ifdef HAS_BUTTONBAR
+ struct gui_buttonbar buttonbar;
+ gui_buttonbar_init(&buttonbar);
+ gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) );
+#endif
lcd_setfont(FONT_SYSFIXED);
font_w = font->maxwidth;
font_h = font->height;
@@ -229,10 +234,10 @@ int kbd_input(char* text, int buflen)
i = (curpos + 1) * font_w;
lcd_vline(i, main_y, main_y + font_h);
-#if CONFIG_KEYPAD == RECORDER_PAD
+#ifdef HAS_BUTTONBAR
/* draw the status bar */
- buttonbar_set("Shift", "OK", "Del");
- buttonbar_draw();
+ gui_buttonbar_set(&buttonbar, "Shift", "OK", "Del");
+ gui_buttonbar_draw(&buttonbar);
#endif
#ifdef KBD_MODES
@@ -245,8 +250,7 @@ int kbd_input(char* text, int buflen)
lcd_set_drawmode(DRMODE_SOLID);
}
- status_draw(true);
-
+ gui_syncstatusbar_draw(&statusbars, true);
lcd_update();
}
@@ -454,7 +458,7 @@ int kbd_input(char* text, int buflen)
#endif /* !KBD_MODES */
case BUTTON_NONE:
- status_draw(false);
+ gui_syncstatusbar_draw(&statusbars, false);
redraw = false;
break;
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index ff1d49bd2a..a6b540dd3d 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -56,6 +56,7 @@
#include "textarea.h"
#include "splash.h"
#include "yesno.h"
+#include "buttonbar.h"
#include "power.h"
#ifdef CONFIG_TUNER
@@ -298,9 +299,13 @@ bool radio_screen(void)
int hours, minutes;
bool keep_playing = false;
bool statusbar = global_settings.statusbar;
+#ifdef HAS_BUTTONBAR
+ struct gui_buttonbar buttonbar;
+ gui_buttonbar_init(&buttonbar);
+ gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) );
+#endif
/* always display status bar in radio screen for now */
global_settings.statusbar = true;
-
FOR_NB_SCREENS(i){
gui_textarea_clear(&screens[i]);
screen_set_xmargin(&screens[i],0);
@@ -377,8 +382,8 @@ bool radio_screen(void)
radio_mode = RADIO_PRESET_MODE;
#endif
-#if CONFIG_KEYPAD == RECORDER_PAD
- buttonbar_set(str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS),
+#ifdef HAS_BUTTONBAR
+ gui_buttonbar_set(&buttonbar, str(LANG_BUTTONBAR_MENU), str(LANG_FM_BUTTONBAR_PRESETS),
str(LANG_FM_BUTTONBAR_RECORD));
#endif
@@ -613,10 +618,10 @@ bool radio_screen(void)
gui_textarea_clear(&screens[i]);
screen_set_xmargin(&screens[i],0);
}
-#if CONFIG_KEYPAD == RECORDER_PAD
- buttonbar_set(str(LANG_BUTTONBAR_MENU),
- str(LANG_FM_BUTTONBAR_PRESETS),
- str(LANG_FM_BUTTONBAR_RECORD));
+#ifdef HAS_BUTTONBAR
+ gui_buttonbar_set(&buttonbar, str(LANG_BUTTONBAR_MENU),
+ str(LANG_FM_BUTTONBAR_PRESETS),
+ str(LANG_FM_BUTTONBAR_RECORD));
#endif
update_screen = true;
break;
@@ -646,10 +651,11 @@ bool radio_screen(void)
gui_textarea_clear(&screens[i]);
screen_set_xmargin(&screens[i],0);
}
-#if CONFIG_KEYPAD == RECORDER_PAD
- buttonbar_set(str(LANG_BUTTONBAR_MENU),
- str(LANG_FM_BUTTONBAR_PRESETS),
- str(LANG_FM_BUTTONBAR_RECORD));
+#ifdef HAS_BUTTONBAR
+ gui_buttonbar_set(&buttonbar,
+ str(LANG_BUTTONBAR_MENU),
+ str(LANG_FM_BUTTONBAR_PRESETS),
+ str(LANG_FM_BUTTONBAR_RECORD));
#endif
update_screen = true;
break;
@@ -807,16 +813,16 @@ bool radio_screen(void)
screens[i].puts_scroll(0, top_of_screen + 4, buf);
}
}
-
-#if CONFIG_KEYPAD == RECORDER_PAD
- buttonbar_draw();
-#endif
+
+#if HAS_BUTTONBAR
+ gui_buttonbar_draw(&buttonbar);
+#endif
FOR_NB_SCREENS(i)
gui_textarea_update(&screens[i]);
}
/* Only force the redraw if update_screen is true */
gui_syncstatusbar_draw(&statusbars,true);
-
+
update_screen = false;
}
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index eda56a5bf9..63cd513c78 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -45,7 +45,7 @@
#include "icons.h"
#include "screens.h"
#include "peakmeter.h"
-#include "status.h"
+#include "statusbar.h"
#include "menu.h"
#include "sound_menu.h"
#include "timefuncs.h"
@@ -831,7 +831,7 @@ bool recording_screen(void)
lcd_puts(0, 6, buf);
}
- status_draw(true);
+ gui_syncstatusbar_draw(&statusbars, true);
peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h);
lcd_update();
@@ -860,7 +860,7 @@ bool recording_screen(void)
if (audio_stat & AUDIO_STATUS_ERROR)
{
gui_syncsplash(0, true, str(LANG_DISK_FULL));
- status_draw(true);
+ gui_syncstatusbar_draw(&statusbars, true);
lcd_update();
audio_error_clear();