summaryrefslogtreecommitdiff
path: root/apps/gui/statusbar.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/statusbar.c')
-rw-r--r--apps/gui/statusbar.c104
1 files changed, 101 insertions, 3 deletions
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index e082063a6f..157224f77d 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -33,6 +33,7 @@
33#include "action.h" /* for keys_locked */ 33#include "action.h" /* for keys_locked */
34#include "statusbar.h" 34#include "statusbar.h"
35#ifdef HAVE_RECORDING 35#ifdef HAVE_RECORDING
36#include "recording.h"
36#include "audio.h" 37#include "audio.h"
37#include "recording.h" 38#include "recording.h"
38#endif 39#endif
@@ -113,7 +114,11 @@
113#define STATUSBAR_LOCKR_WIDTH 5 114#define STATUSBAR_LOCKR_WIDTH 5
114 115
115#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) 116#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
117#ifdef HAVE_MMC
116#define STATUSBAR_DISK_WIDTH 12 118#define STATUSBAR_DISK_WIDTH 12
119#else
120#define STATUSBAR_DISK_WIDTH 7
121#endif
117#define STATUSBAR_DISK_X_POS(statusbar_width) statusbar_width - \ 122#define STATUSBAR_DISK_X_POS(statusbar_width) statusbar_width - \
118 STATUSBAR_DISK_WIDTH 123 STATUSBAR_DISK_WIDTH
119#else 124#else
@@ -121,6 +126,15 @@
121#endif 126#endif
122#define STATUSBAR_TIME_X_END(statusbar_width) statusbar_width - 1 - \ 127#define STATUSBAR_TIME_X_END(statusbar_width) statusbar_width - 1 - \
123 STATUSBAR_DISK_WIDTH 128 STATUSBAR_DISK_WIDTH
129#ifdef HAVE_RECORDING
130#define TIMER_ICON_WIDTH 7
131#if CONFIG_RTC
132#define CLOCK_WIDTH 35
133#else
134#define CLOCK_WIDTH 0
135#endif
136#endif
137
124struct gui_syncstatusbar statusbars; 138struct gui_syncstatusbar statusbars;
125 139
126/* Prototypes */ 140/* Prototypes */
@@ -140,9 +154,11 @@ static void gui_statusbar_led(struct screen * display);
140#endif 154#endif
141#ifdef HAVE_RECORDING 155#ifdef HAVE_RECORDING
142static void gui_statusbar_icon_recording_info(struct screen * display); 156static void gui_statusbar_icon_recording_info(struct screen * display);
157static void gui_statusbar_timer(struct screen * display, int dy, int hr, int mn, int sc, bool recscreen);
158static void gui_statusbar_timer_rep(struct screen * display);
143#endif 159#endif
144#if CONFIG_RTC 160#if CONFIG_RTC
145static void gui_statusbar_time(struct screen * display, int hour, int minute); 161static void gui_statusbar_time(struct screen * display, int hour, int minute, bool timer_display);
146#endif 162#endif
147#endif 163#endif
148 164
@@ -245,6 +261,21 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
245 bar->info.minute = tm->tm_min; 261 bar->info.minute = tm->tm_min;
246 } 262 }
247#endif /* CONFIG_RTC */ 263#endif /* CONFIG_RTC */
264#ifdef HAVE_RECORDING
265 struct timer* timer = get_timerstat();
266 bar->info.timer_day = timer->days;
267 bar->info.timer_hour = timer->hrs;
268 bar->info.timer_min = timer->mins;
269 /* avoid an update every second unless less than one
270 minute remains on the timer */
271 if (!bar->info.timer_day && !bar->info.timer_hour && !bar->info.timer_min)
272 bar->info.timer_sec = timer->secs;
273 else
274 bar->info.timer_sec = 0;
275
276 bar->info.timer_display = timer->timer_display;
277 bar->info.timer_repeat = timer->repeater;
278#endif
248 279
249 /* only redraw if forced to, or info has changed */ 280 /* only redraw if forced to, or info has changed */
250 if (force_redraw || bar->redraw_volume || 281 if (force_redraw || bar->redraw_volume ||
@@ -316,8 +347,16 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
316 if (bar->info.keylockremote) 347 if (bar->info.keylockremote)
317 gui_statusbar_icon_lock_remote(display); 348 gui_statusbar_icon_lock_remote(display);
318#endif 349#endif
350#ifdef HAVE_RECORDING
351 if (bar->info.timer_display)
352 gui_statusbar_timer(display, bar->info.timer_day, bar->info.timer_hour,
353 bar->info.timer_min, bar->info.timer_sec, recscreen_on);
354 else if ((bar->info.timer_repeat) && (recscreen_on))
355 gui_statusbar_timer_rep(display);
356#endif
319#if CONFIG_RTC 357#if CONFIG_RTC
320 gui_statusbar_time(display, bar->info.hour, bar->info.minute); 358 gui_statusbar_time(display, bar->info.hour, bar->info.minute,
359 bar->info.timer_display);
321#endif /* CONFIG_RTC */ 360#endif /* CONFIG_RTC */
322#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) 361#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
323 if(!display->has_disk_led && bar->info.led) 362 if(!display->has_disk_led && bar->info.led)
@@ -577,7 +616,8 @@ static void gui_statusbar_led(struct screen * display)
577/* 616/*
578 * Print time to status bar 617 * Print time to status bar
579 */ 618 */
580static void gui_statusbar_time(struct screen * display, int hour, int minute) 619static void gui_statusbar_time(struct screen * display, int hour, int minute,
620 bool timer_display)
581{ 621{
582 unsigned char buffer[6]; 622 unsigned char buffer[6];
583 unsigned int width, height; 623 unsigned int width, height;
@@ -599,15 +639,73 @@ static void gui_statusbar_time(struct screen * display, int hour, int minute)
599 display->setfont(FONT_SYSFIXED); 639 display->setfont(FONT_SYSFIXED);
600 display->getstringsize(buffer, &width, &height); 640 display->getstringsize(buffer, &width, &height);
601 if (height <= STATUSBAR_HEIGHT) { 641 if (height <= STATUSBAR_HEIGHT) {
642#ifdef HAVE_RECORDING
643 if (timer_display)
644 display->set_drawmode(DRMODE_INVERSEVID);
645#else
646 (void)timer_display;
647#endif
602 display->putsxy(STATUSBAR_TIME_X_END(display->width) - width, 648 display->putsxy(STATUSBAR_TIME_X_END(display->width) - width,
603 STATUSBAR_Y_POS, buffer); 649 STATUSBAR_Y_POS, buffer);
604 } 650 }
651 display->set_drawmode(DRMODE_SOLID);
605 display->setfont(FONT_UI); 652 display->setfont(FONT_UI);
606 653
607} 654}
608#endif 655#endif
609 656
610#ifdef HAVE_RECORDING 657#ifdef HAVE_RECORDING
658static void gui_statusbar_timer(struct screen * display, int dy, int hr, int mn,
659 int sc, bool recscreen)
660{
661 unsigned char buffer[8];
662 int width, height;
663
664 /* vary the display depending on the remaining time to save space */
665 if (dy)
666 snprintf(buffer, sizeof(buffer), " %dd%02dh", hr > 58 ? dy + 1 : dy,
667 hr > 58 ? 0 : hr + 1);
668 else if (!hr && !mn)
669 snprintf(buffer, sizeof(buffer), "%02ds", sc);
670 else
671 snprintf(buffer, sizeof(buffer), "%02dh%02dm", mn > 58 ? hr + 1: hr,
672 mn > 58 ? 0 : mn + 1);
673
674 display->setfont(FONT_SYSFIXED);
675 display->getstringsize(buffer, &width, &height);
676
677 if (height <= STATUSBAR_HEIGHT)
678 {
679 if(((display->width) >= (STATUSBAR_LOCKR_X_POS + STATUSBAR_LOCKR_WIDTH +
680 STATUSBAR_DISK_WIDTH + width + CLOCK_WIDTH + 1))
681 && !recscreen)
682 display->putsxy(STATUSBAR_TIME_X_END(display->width) - width -
683 CLOCK_WIDTH, STATUSBAR_Y_POS, buffer);
684 /* display only an icon for small screens or when in recording screen*/
685 else if ((display->width) >= (STATUSBAR_LOCKR_X_POS +
686 STATUSBAR_LOCKR_WIDTH +
687 STATUSBAR_DISK_WIDTH +
688 TIMER_ICON_WIDTH + CLOCK_WIDTH + 1))
689 display->mono_bitmap(bitmap_icons_7x7[Icon_Timer],
690 STATUSBAR_TIME_X_END(display->width) -
691 TIMER_ICON_WIDTH - CLOCK_WIDTH,
692 STATUSBAR_Y_POS,
693 TIMER_ICON_WIDTH, STATUSBAR_HEIGHT);
694 }
695
696 display->setfont(FONT_UI);
697
698}
699
700static void gui_statusbar_timer_rep(struct screen * display)
701{
702 display->mono_bitmap(bitmap_icons_7x7[Icon_Timer_rep],
703 STATUSBAR_TIME_X_END(display->width) -
704 TIMER_ICON_WIDTH - CLOCK_WIDTH,
705 STATUSBAR_Y_POS,
706 TIMER_ICON_WIDTH, STATUSBAR_HEIGHT);
707}
708
611#if CONFIG_CODEC == SWCODEC 709#if CONFIG_CODEC == SWCODEC
612/** 710/**
613 * Write a number to the display using bitmaps and return new position 711 * Write a number to the display using bitmaps and return new position