2005-10-28 00:00:00 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2005-10-30 01:24:35 +00:00
|
|
|
* Copyright (C) Robert E. Hak (2002), Linus Nielsen Feltzing (2002)
|
2005-10-28 00:00:00 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2005-10-28 00:00:00 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2010-05-06 21:04:40 +00:00
|
|
|
#include <stdio.h>
|
2009-09-27 14:46:44 +00:00
|
|
|
#include "config.h"
|
2005-10-28 00:00:00 +00:00
|
|
|
#include "font.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "string.h" /* for memcmp oO*/
|
|
|
|
#include "sound.h"
|
|
|
|
#include "settings.h"
|
2008-11-28 03:10:35 +00:00
|
|
|
#include "viewport.h"
|
2008-10-15 06:38:51 +00:00
|
|
|
#include "metadata.h"
|
2005-10-28 00:00:00 +00:00
|
|
|
#include "icons.h"
|
|
|
|
#include "powermgmt.h"
|
2005-10-28 00:52:19 +00:00
|
|
|
#include "usb.h"
|
|
|
|
#include "led.h"
|
2009-08-23 23:44:31 +00:00
|
|
|
#include "screen_access.h"
|
2005-10-28 00:00:00 +00:00
|
|
|
|
|
|
|
#include "status.h" /* needed for battery_state global var */
|
2006-08-17 12:33:36 +00:00
|
|
|
#include "action.h" /* for keys_locked */
|
2005-10-28 00:00:00 +00:00
|
|
|
#include "statusbar.h"
|
2006-09-02 17:30:30 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
#include "audio.h"
|
2007-02-07 02:48:19 +00:00
|
|
|
#include "recording.h"
|
2008-10-14 11:43:32 +00:00
|
|
|
#include "pcm_record.h"
|
2006-09-02 17:30:30 +00:00
|
|
|
#endif
|
2008-12-31 05:59:26 +00:00
|
|
|
#include "appevents.h"
|
2009-03-08 20:28:15 +00:00
|
|
|
#include "timefuncs.h"
|
2005-10-28 00:00:00 +00:00
|
|
|
|
|
|
|
/* FIXME: should be removed from icon.h to avoid redefinition,
|
|
|
|
but still needed for compatibility with old system */
|
2005-11-22 21:55:05 +00:00
|
|
|
#define ICONS_SPACING 2
|
|
|
|
#define STATUSBAR_BATTERY_X_POS 0*ICONS_SPACING
|
2020-10-26 16:36:25 +00:00
|
|
|
#define STATUSBAR_BATTERY_WIDTH (2+(2*SYSFONT_WIDTH))
|
2005-10-28 00:00:00 +00:00
|
|
|
#define STATUSBAR_PLUG_X_POS STATUSBAR_X_POS + \
|
2005-11-22 21:55:05 +00:00
|
|
|
STATUSBAR_BATTERY_WIDTH + \
|
|
|
|
ICONS_SPACING
|
2021-03-03 02:23:38 +00:00
|
|
|
#define STATUSBAR_BATTERY_HEIGHT SB_ICON_HEIGHT - 1
|
2005-10-28 00:00:00 +00:00
|
|
|
#define STATUSBAR_PLUG_WIDTH 7
|
|
|
|
#define STATUSBAR_VOLUME_X_POS STATUSBAR_X_POS + \
|
|
|
|
STATUSBAR_BATTERY_WIDTH + \
|
2005-11-22 21:55:05 +00:00
|
|
|
STATUSBAR_PLUG_WIDTH + \
|
|
|
|
2*ICONS_SPACING
|
2020-10-26 16:36:25 +00:00
|
|
|
#define STATUSBAR_VOLUME_WIDTH (2+(2*SYSFONT_WIDTH))
|
2006-09-02 17:30:30 +00:00
|
|
|
#define STATUSBAR_ENCODER_X_POS STATUSBAR_X_POS + \
|
|
|
|
STATUSBAR_BATTERY_WIDTH + \
|
|
|
|
STATUSBAR_PLUG_WIDTH + \
|
|
|
|
2*ICONS_SPACING - 1
|
|
|
|
#define STATUSBAR_ENCODER_WIDTH 18
|
2005-10-28 00:00:00 +00:00
|
|
|
#define STATUSBAR_PLAY_STATE_X_POS STATUSBAR_X_POS + \
|
|
|
|
STATUSBAR_BATTERY_WIDTH + \
|
|
|
|
STATUSBAR_PLUG_WIDTH + \
|
2005-11-22 21:55:05 +00:00
|
|
|
STATUSBAR_VOLUME_WIDTH + \
|
|
|
|
3*ICONS_SPACING
|
2005-10-28 00:00:00 +00:00
|
|
|
#define STATUSBAR_PLAY_STATE_WIDTH 7
|
|
|
|
#define STATUSBAR_PLAY_MODE_X_POS STATUSBAR_X_POS + \
|
|
|
|
STATUSBAR_BATTERY_WIDTH + \
|
|
|
|
STATUSBAR_PLUG_WIDTH + \
|
|
|
|
STATUSBAR_VOLUME_WIDTH + \
|
|
|
|
STATUSBAR_PLAY_STATE_WIDTH + \
|
2005-11-22 21:55:05 +00:00
|
|
|
4*ICONS_SPACING
|
2005-10-28 00:00:00 +00:00
|
|
|
#define STATUSBAR_PLAY_MODE_WIDTH 7
|
2006-09-02 17:30:30 +00:00
|
|
|
#define STATUSBAR_RECFREQ_X_POS STATUSBAR_X_POS + \
|
|
|
|
STATUSBAR_BATTERY_WIDTH + \
|
|
|
|
STATUSBAR_PLUG_WIDTH + \
|
|
|
|
STATUSBAR_VOLUME_WIDTH + \
|
|
|
|
STATUSBAR_PLAY_STATE_WIDTH + \
|
2006-09-26 11:56:59 +00:00
|
|
|
3*ICONS_SPACING
|
2006-09-02 17:30:30 +00:00
|
|
|
#define STATUSBAR_RECFREQ_WIDTH 12
|
|
|
|
#define STATUSBAR_RECCHANNELS_X_POS STATUSBAR_X_POS + \
|
|
|
|
STATUSBAR_BATTERY_WIDTH + \
|
|
|
|
STATUSBAR_PLUG_WIDTH + \
|
|
|
|
STATUSBAR_VOLUME_WIDTH + \
|
|
|
|
STATUSBAR_PLAY_STATE_WIDTH + \
|
|
|
|
STATUSBAR_RECFREQ_WIDTH + \
|
|
|
|
4*ICONS_SPACING
|
|
|
|
#define STATUSBAR_RECCHANNELS_WIDTH 5
|
2005-10-28 00:00:00 +00:00
|
|
|
#define STATUSBAR_SHUFFLE_X_POS STATUSBAR_X_POS + \
|
|
|
|
STATUSBAR_BATTERY_WIDTH + \
|
|
|
|
STATUSBAR_PLUG_WIDTH + \
|
|
|
|
STATUSBAR_VOLUME_WIDTH + \
|
|
|
|
STATUSBAR_PLAY_STATE_WIDTH + \
|
|
|
|
STATUSBAR_PLAY_MODE_WIDTH + \
|
2005-11-22 21:55:05 +00:00
|
|
|
5*ICONS_SPACING
|
2005-10-28 00:00:00 +00:00
|
|
|
#define STATUSBAR_SHUFFLE_WIDTH 7
|
2005-11-22 21:55:05 +00:00
|
|
|
#define STATUSBAR_LOCKM_X_POS STATUSBAR_X_POS + \
|
|
|
|
STATUSBAR_BATTERY_WIDTH + \
|
|
|
|
STATUSBAR_PLUG_WIDTH + \
|
|
|
|
STATUSBAR_VOLUME_WIDTH + \
|
|
|
|
STATUSBAR_PLAY_STATE_WIDTH + \
|
|
|
|
STATUSBAR_PLAY_MODE_WIDTH + \
|
|
|
|
STATUSBAR_SHUFFLE_WIDTH + \
|
|
|
|
6*ICONS_SPACING
|
|
|
|
#define STATUSBAR_LOCKM_WIDTH 5
|
|
|
|
#define STATUSBAR_LOCKR_X_POS STATUSBAR_X_POS + \
|
2005-10-28 00:00:00 +00:00
|
|
|
STATUSBAR_BATTERY_WIDTH + \
|
|
|
|
STATUSBAR_PLUG_WIDTH + \
|
|
|
|
STATUSBAR_VOLUME_WIDTH + \
|
|
|
|
STATUSBAR_PLAY_STATE_WIDTH + \
|
|
|
|
STATUSBAR_PLAY_MODE_WIDTH + \
|
|
|
|
STATUSBAR_SHUFFLE_WIDTH + \
|
2005-11-22 21:55:05 +00:00
|
|
|
STATUSBAR_LOCKM_WIDTH + \
|
|
|
|
7*ICONS_SPACING
|
|
|
|
#define STATUSBAR_LOCKR_WIDTH 5
|
|
|
|
|
2007-02-18 05:07:19 +00:00
|
|
|
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
2005-10-28 00:00:00 +00:00
|
|
|
#define STATUSBAR_DISK_WIDTH 12
|
|
|
|
#define STATUSBAR_DISK_X_POS(statusbar_width) statusbar_width - \
|
|
|
|
STATUSBAR_DISK_WIDTH
|
2005-12-22 23:48:32 +00:00
|
|
|
#else
|
|
|
|
#define STATUSBAR_DISK_WIDTH 0
|
|
|
|
#endif
|
|
|
|
#define STATUSBAR_TIME_X_END(statusbar_width) statusbar_width - 1 - \
|
|
|
|
STATUSBAR_DISK_WIDTH
|
2005-10-30 22:34:51 +00:00
|
|
|
struct gui_syncstatusbar statusbars;
|
|
|
|
|
2007-02-24 11:07:21 +00:00
|
|
|
/* Prototypes */
|
|
|
|
static void gui_statusbar_icon_battery(struct screen * display, int percent,
|
|
|
|
int batt_charge_step);
|
|
|
|
static bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int volume);
|
|
|
|
static void gui_statusbar_icon_play_state(struct screen * display, int state);
|
|
|
|
static void gui_statusbar_icon_play_mode(struct screen * display, int mode);
|
|
|
|
static void gui_statusbar_icon_shuffle(struct screen * display);
|
|
|
|
static void gui_statusbar_icon_lock(struct screen * display);
|
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
|
|
|
static void gui_statusbar_icon_lock_remote(struct screen * display);
|
|
|
|
#endif
|
|
|
|
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
|
|
|
static void gui_statusbar_led(struct screen * display);
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
static void gui_statusbar_icon_recording_info(struct screen * display);
|
|
|
|
#endif
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2007-06-28 13:51:44 +00:00
|
|
|
static void gui_statusbar_time(struct screen * display, struct tm *time);
|
2007-02-24 11:07:21 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* End prototypes */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initializes a status bar
|
|
|
|
* - bar : the bar to initialize
|
|
|
|
*/
|
|
|
|
static void gui_statusbar_init(struct gui_statusbar * bar)
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
2006-06-06 22:23:52 +00:00
|
|
|
bar->redraw_volume = true;
|
|
|
|
bar->volume_icon_switch_tick = bar->battery_icon_switch_tick = current_tick;
|
2007-07-05 23:20:58 +00:00
|
|
|
memset((void*)&(bar->lastinfo), 0, sizeof(struct status_info));
|
|
|
|
#if CONFIG_RTC
|
|
|
|
bar->last_tm_min = 0;
|
2020-10-26 12:27:32 +00:00
|
|
|
#endif
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2009-08-23 23:44:31 +00:00
|
|
|
#define GET_RECT(vp, vals,display) do { \
|
2009-10-09 18:39:34 +00:00
|
|
|
viewport_set_fullscreen(&(vp), (display)->screen_type); \
|
2009-10-11 20:15:22 +00:00
|
|
|
(vp).flags &= ~VP_FLAG_ALIGN_RIGHT; \
|
2009-08-23 23:44:31 +00:00
|
|
|
(vp).height = STATUSBAR_HEIGHT; \
|
|
|
|
(vp).x = STATUSBAR_X_POS; \
|
|
|
|
if ((vals) != STATUSBAR_BOTTOM) \
|
|
|
|
(vp).y = 0; \
|
|
|
|
else \
|
|
|
|
(vp).y = (display)->lcdheight - STATUSBAR_HEIGHT; \
|
|
|
|
} while(0)
|
|
|
|
|
2010-03-06 00:29:46 +00:00
|
|
|
void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw, struct viewport *vp)
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
|
|
|
struct screen * display = bar->display;
|
2020-10-07 06:01:35 +00:00
|
|
|
struct viewport *last_vp = NULL;
|
2005-10-28 23:52:49 +00:00
|
|
|
|
2009-10-19 15:28:15 +00:00
|
|
|
if (!display)
|
|
|
|
return;
|
|
|
|
|
2006-06-06 22:23:52 +00:00
|
|
|
bar->info.battlevel = battery_level();
|
|
|
|
#ifdef HAVE_USB_POWER
|
2007-02-01 10:47:22 +00:00
|
|
|
bar->info.usb_inserted = usb_inserted();
|
2006-06-06 22:23:52 +00:00
|
|
|
#endif
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2006-01-19 07:47:34 +00:00
|
|
|
bar->info.inserted = (charger_input_state == CHARGER);
|
2006-06-06 22:23:52 +00:00
|
|
|
if (bar->info.inserted)
|
|
|
|
{
|
|
|
|
bar->info.battery_state = true;
|
|
|
|
|
|
|
|
#if CONFIG_CHARGING >= CHARGING_MONITOR
|
|
|
|
|
|
|
|
/* zero battery run time if charging */
|
|
|
|
if (charge_state > DISCHARGING)
|
|
|
|
lasttime = current_tick;
|
|
|
|
|
|
|
|
/* animate battery if charging */
|
|
|
|
if ((charge_state == DISCHARGING) || (charge_state == TRICKLE))
|
|
|
|
{
|
|
|
|
bar->info.batt_charge_step = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-04-06 22:55:00 +00:00
|
|
|
#else /* CONFIG_CHARGING < CHARGING_MONITOR */
|
2006-06-06 22:23:52 +00:00
|
|
|
lasttime = current_tick;
|
|
|
|
{
|
2007-04-06 22:55:00 +00:00
|
|
|
#endif /* CONFIG_CHARGING < CHARGING_MONITOR */
|
2006-06-06 22:23:52 +00:00
|
|
|
/* animate in (max.) 4 steps, starting near the current charge level */
|
2020-10-26 12:27:32 +00:00
|
|
|
if (TIME_AFTER(current_tick, bar->battery_icon_switch_tick))
|
2006-06-06 22:23:52 +00:00
|
|
|
{
|
|
|
|
if (++bar->info.batt_charge_step > 3)
|
|
|
|
bar->info.batt_charge_step = bar->info.battlevel / 34;
|
|
|
|
bar->battery_icon_switch_tick = current_tick + HZ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2007-04-06 22:55:00 +00:00
|
|
|
#endif /* CONFIG_CHARGING */
|
2006-06-06 22:23:52 +00:00
|
|
|
{
|
|
|
|
bar->info.batt_charge_step = -1;
|
|
|
|
if (battery_level_safe())
|
|
|
|
bar->info.battery_state = true;
|
|
|
|
else
|
|
|
|
/* blink battery if level is low */
|
|
|
|
if (TIME_AFTER(current_tick, bar->battery_icon_switch_tick) &&
|
|
|
|
(bar->info.battlevel > -1))
|
|
|
|
{
|
|
|
|
bar->info.battery_state = !bar->info.battery_state;
|
|
|
|
bar->battery_icon_switch_tick = current_tick + HZ;
|
|
|
|
}
|
|
|
|
}
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2007-02-24 11:49:52 +00:00
|
|
|
bar->info.volume = global_settings.volume;
|
2005-10-28 00:00:00 +00:00
|
|
|
bar->info.shuffle = global_settings.playlist_shuffle;
|
2005-11-22 21:55:05 +00:00
|
|
|
#ifdef HAS_BUTTON_HOLD
|
2005-10-28 00:00:00 +00:00
|
|
|
bar->info.keylock = button_hold();
|
|
|
|
#else
|
2006-08-17 12:33:36 +00:00
|
|
|
bar->info.keylock = is_keys_locked();
|
2005-11-22 21:55:05 +00:00
|
|
|
#endif /* HAS_BUTTON_HOLD */
|
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
|
|
|
bar->info.keylockremote = remote_button_hold();
|
|
|
|
#endif
|
2005-10-28 00:00:00 +00:00
|
|
|
bar->info.repeat = global_settings.repeat_mode;
|
|
|
|
bar->info.playmode = current_playmode();
|
2006-06-06 22:23:52 +00:00
|
|
|
|
2007-02-18 05:07:19 +00:00
|
|
|
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
2005-11-20 01:02:14 +00:00
|
|
|
if(!display->has_disk_led)
|
|
|
|
bar->info.led = led_read(HZ/2); /* delay should match polling interval */
|
2005-11-24 00:10:14 +00:00
|
|
|
#endif
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2007-07-05 23:20:58 +00:00
|
|
|
bar->time = get_time();
|
2006-06-06 22:23:52 +00:00
|
|
|
#endif /* CONFIG_RTC */
|
2005-10-28 00:00:00 +00:00
|
|
|
|
|
|
|
/* only redraw if forced to, or info has changed */
|
2006-06-06 22:23:52 +00:00
|
|
|
if (force_redraw || bar->redraw_volume ||
|
2007-07-05 23:20:58 +00:00
|
|
|
#if CONFIG_RTC
|
|
|
|
(bar->time->tm_min != bar->last_tm_min) ||
|
|
|
|
#endif
|
2005-10-28 00:00:00 +00:00
|
|
|
memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info)))
|
|
|
|
{
|
2020-10-07 06:01:35 +00:00
|
|
|
last_vp = display->set_viewport(vp);
|
2005-10-28 00:00:00 +00:00
|
|
|
display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
2010-10-11 01:19:55 +00:00
|
|
|
display->fill_viewport();
|
2005-10-28 00:00:00 +00:00
|
|
|
display->set_drawmode(DRMODE_SOLID);
|
|
|
|
|
2006-06-06 22:23:52 +00:00
|
|
|
if (bar->info.battery_state)
|
2020-10-26 12:27:32 +00:00
|
|
|
gui_statusbar_icon_battery(display, bar->info.battlevel,
|
2006-06-06 22:23:52 +00:00
|
|
|
bar->info.batt_charge_step);
|
2005-10-28 00:00:00 +00:00
|
|
|
#ifdef HAVE_USB_POWER
|
2007-02-01 10:47:22 +00:00
|
|
|
if (bar->info.usb_inserted)
|
2005-10-28 00:00:00 +00:00
|
|
|
display->mono_bitmap(bitmap_icons_7x8[Icon_USBPlug],
|
|
|
|
STATUSBAR_PLUG_X_POS,
|
|
|
|
STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH,
|
2020-10-26 16:36:25 +00:00
|
|
|
SB_ICON_HEIGHT);
|
2005-11-20 01:02:14 +00:00
|
|
|
#endif /* HAVE_USB_POWER */
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2006-06-21 18:41:57 +00:00
|
|
|
#ifdef HAVE_USB_POWER
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
/* draw power plug if charging */
|
2006-03-02 13:37:51 +00:00
|
|
|
if (bar->info.inserted)
|
|
|
|
display->mono_bitmap(bitmap_icons_7x8[Icon_Plug],
|
|
|
|
STATUSBAR_PLUG_X_POS,
|
|
|
|
STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH,
|
2020-10-26 16:36:25 +00:00
|
|
|
SB_ICON_HEIGHT);
|
2007-04-06 22:55:00 +00:00
|
|
|
#endif /* CONFIG_CHARGING */
|
2006-09-02 17:30:30 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
/* turn off volume display in recording screen */
|
2007-02-08 10:36:49 +00:00
|
|
|
bool recscreen_on = in_recording_screen();
|
|
|
|
if (!recscreen_on)
|
2006-09-02 17:30:30 +00:00
|
|
|
#endif
|
|
|
|
bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume);
|
2006-06-21 18:41:57 +00:00
|
|
|
gui_statusbar_icon_play_state(display, current_playmode() + Icon_Play);
|
2020-10-26 12:27:32 +00:00
|
|
|
|
2006-09-02 17:30:30 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
/* If in recording screen, replace repeat mode, volume
|
|
|
|
and shuffle icons with recording info */
|
2007-02-08 10:36:49 +00:00
|
|
|
if (recscreen_on)
|
2006-09-02 17:30:30 +00:00
|
|
|
gui_statusbar_icon_recording_info(display);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
switch (bar->info.repeat) {
|
2007-02-17 23:12:55 +00:00
|
|
|
#ifdef AB_REPEAT_ENABLE
|
2006-09-02 17:30:30 +00:00
|
|
|
case REPEAT_AB:
|
|
|
|
gui_statusbar_icon_play_mode(display, Icon_RepeatAB);
|
|
|
|
break;
|
2010-07-18 18:13:53 +00:00
|
|
|
#endif /* AB_REPEAT_ENABLE */
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2006-09-02 17:30:30 +00:00
|
|
|
case REPEAT_ONE:
|
|
|
|
gui_statusbar_icon_play_mode(display, Icon_RepeatOne);
|
|
|
|
break;
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2006-09-02 17:30:30 +00:00
|
|
|
case REPEAT_ALL:
|
|
|
|
case REPEAT_SHUFFLE:
|
|
|
|
gui_statusbar_icon_play_mode(display, Icon_Repeat);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (bar->info.shuffle)
|
|
|
|
gui_statusbar_icon_shuffle(display);
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
|
|
|
if (bar->info.keylock)
|
|
|
|
gui_statusbar_icon_lock(display);
|
2005-11-22 21:55:05 +00:00
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
|
|
|
if (bar->info.keylockremote)
|
|
|
|
gui_statusbar_icon_lock_remote(display);
|
|
|
|
#endif
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2007-07-05 23:20:58 +00:00
|
|
|
gui_statusbar_time(display, bar->time);
|
|
|
|
bar->last_tm_min = bar->time->tm_min;
|
2005-12-04 15:23:47 +00:00
|
|
|
#endif /* CONFIG_RTC */
|
2007-02-18 05:07:19 +00:00
|
|
|
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
2005-11-20 01:02:14 +00:00
|
|
|
if(!display->has_disk_led && bar->info.led)
|
|
|
|
gui_statusbar_led(display);
|
2005-11-24 00:10:14 +00:00
|
|
|
#endif
|
2009-01-03 13:27:19 +00:00
|
|
|
display->update_viewport();
|
2020-10-07 06:01:35 +00:00
|
|
|
display->set_viewport(last_vp);
|
2005-10-28 00:00:00 +00:00
|
|
|
bar->lastinfo = bar->info;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* from icon.c */
|
|
|
|
/*
|
|
|
|
* Print battery icon to status bar
|
|
|
|
*/
|
2020-10-26 12:27:32 +00:00
|
|
|
static void gui_statusbar_icon_battery(struct screen * display, int percent,
|
2007-02-24 11:07:21 +00:00
|
|
|
int batt_charge_step)
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
2006-03-13 16:11:30 +00:00
|
|
|
int fill, endfill;
|
2005-10-28 00:00:00 +00:00
|
|
|
char buffer[5];
|
|
|
|
unsigned int width, height;
|
2006-03-13 16:11:30 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2006-06-06 22:23:52 +00:00
|
|
|
unsigned int prevfg = 0;
|
2006-03-13 16:11:30 +00:00
|
|
|
#endif
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2006-06-06 22:23:52 +00:00
|
|
|
if (batt_charge_step >= 0)
|
|
|
|
{
|
|
|
|
fill = percent * (STATUSBAR_BATTERY_WIDTH-3) / 100;
|
|
|
|
endfill = 34 * batt_charge_step * (STATUSBAR_BATTERY_WIDTH-3) / 100;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#else
|
|
|
|
(void)batt_charge_step;
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
fill = endfill = (percent * (STATUSBAR_BATTERY_WIDTH-3) + 50) / 100;
|
|
|
|
}
|
|
|
|
|
2020-10-26 12:27:32 +00:00
|
|
|
#if CONFIG_CHARGING == CHARGING_MONITOR && !defined(SIMULATOR)
|
2006-06-06 22:23:52 +00:00
|
|
|
/* Certain charge controlled targets */
|
2005-10-28 00:00:00 +00:00
|
|
|
/* show graphical animation when charging instead of numbers */
|
|
|
|
if ((global_settings.battery_display) &&
|
2006-06-06 22:23:52 +00:00
|
|
|
(charge_state != CHARGING) &&
|
2018-12-06 05:44:47 +00:00
|
|
|
(percent > -1) &&
|
|
|
|
(percent <= 100)) {
|
2005-10-28 00:00:00 +00:00
|
|
|
#else /* all others */
|
2018-12-06 05:44:47 +00:00
|
|
|
if (global_settings.battery_display && (percent > -1) && (percent <= 100)) {
|
2005-10-28 00:00:00 +00:00
|
|
|
#endif
|
|
|
|
/* Numeric display */
|
|
|
|
display->setfont(FONT_SYSFIXED);
|
2006-06-06 22:23:52 +00:00
|
|
|
snprintf(buffer, sizeof(buffer), "%3d", percent);
|
2005-10-28 00:00:00 +00:00
|
|
|
display->getstringsize(buffer, &width, &height);
|
|
|
|
if (height <= STATUSBAR_HEIGHT)
|
|
|
|
display->putsxy(STATUSBAR_BATTERY_X_POS
|
|
|
|
+ STATUSBAR_BATTERY_WIDTH / 2
|
|
|
|
- width/2, STATUSBAR_Y_POS, buffer);
|
|
|
|
display->setfont(FONT_UI);
|
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* draw battery */
|
2021-03-03 02:23:38 +00:00
|
|
|
display->drawrect(STATUSBAR_BATTERY_X_POS, STATUSBAR_Y_POS,
|
|
|
|
STATUSBAR_BATTERY_WIDTH - 1, STATUSBAR_BATTERY_HEIGHT);
|
|
|
|
display->vline(STATUSBAR_BATTERY_X_POS + STATUSBAR_BATTERY_WIDTH - 1,
|
|
|
|
STATUSBAR_Y_POS + 2, STATUSBAR_Y_POS + 4);
|
2005-10-28 00:00:00 +00:00
|
|
|
|
|
|
|
display->fillrect(STATUSBAR_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1,
|
2021-03-03 02:23:38 +00:00
|
|
|
fill, STATUSBAR_BATTERY_HEIGHT - 2);
|
2006-03-13 16:11:30 +00:00
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
if (display->depth > 1)
|
|
|
|
{
|
|
|
|
prevfg = display->get_foreground();
|
|
|
|
display->set_foreground(LCD_DARKGRAY);
|
|
|
|
}
|
|
|
|
#endif
|
2021-03-03 02:23:38 +00:00
|
|
|
display->fillrect(STATUSBAR_BATTERY_X_POS + 1 + fill, STATUSBAR_Y_POS + 1,
|
|
|
|
endfill - fill, STATUSBAR_BATTERY_HEIGHT - 2);
|
2006-03-13 16:11:30 +00:00
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
if (display->depth > 1)
|
|
|
|
display->set_foreground(prevfg);
|
|
|
|
#endif
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2018-12-06 05:44:47 +00:00
|
|
|
if (percent == -1 || percent > 100) {
|
2005-10-28 00:00:00 +00:00
|
|
|
display->setfont(FONT_SYSFIXED);
|
|
|
|
display->putsxy(STATUSBAR_BATTERY_X_POS + STATUSBAR_BATTERY_WIDTH / 2
|
|
|
|
- 4, STATUSBAR_Y_POS, "?");
|
|
|
|
display->setfont(FONT_UI);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print volume gauge to status bar
|
|
|
|
*/
|
2007-02-24 11:07:21 +00:00
|
|
|
static bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int volume)
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int vol;
|
|
|
|
char buffer[4];
|
|
|
|
unsigned int width, height;
|
|
|
|
bool needs_redraw = false;
|
|
|
|
int type = global_settings.volume_type;
|
2020-10-26 12:27:32 +00:00
|
|
|
struct screen * display=bar->display;
|
2007-02-24 11:49:52 +00:00
|
|
|
const int minvol = sound_min(SOUND_VOLUME);
|
|
|
|
const int maxvol = sound_max(SOUND_VOLUME);
|
2020-10-26 12:27:32 +00:00
|
|
|
const int num_decimals = sound_numdecimals(SOUND_VOLUME);
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2005-12-07 23:07:07 +00:00
|
|
|
if (volume < minvol)
|
|
|
|
volume = minvol;
|
|
|
|
if (volume > maxvol)
|
|
|
|
volume = maxvol;
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2005-12-07 23:07:07 +00:00
|
|
|
if (volume == minvol) {
|
2005-10-28 00:00:00 +00:00
|
|
|
display->mono_bitmap(bitmap_icons_7x8[Icon_Mute],
|
|
|
|
STATUSBAR_VOLUME_X_POS + STATUSBAR_VOLUME_WIDTH / 2 - 4,
|
2020-10-26 16:36:25 +00:00
|
|
|
STATUSBAR_Y_POS, 7, SB_ICON_HEIGHT);
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* We want to redraw the icon later on */
|
2005-12-07 23:07:07 +00:00
|
|
|
if (bar->last_volume != volume && bar->last_volume >= minvol) {
|
2005-10-28 00:00:00 +00:00
|
|
|
bar->volume_icon_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,bar->volume_icon_switch_tick)) {
|
|
|
|
type = 1;
|
|
|
|
needs_redraw = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* display volume level numerical? */
|
|
|
|
if (type)
|
|
|
|
{
|
2020-10-26 12:27:32 +00:00
|
|
|
if (num_decimals)
|
|
|
|
volume /= 10 * num_decimals;
|
2005-10-28 00:00:00 +00:00
|
|
|
display->setfont(FONT_SYSFIXED);
|
2005-12-07 23:07:07 +00:00
|
|
|
snprintf(buffer, sizeof(buffer), "%2d", volume);
|
2005-10-28 00:00:00 +00:00
|
|
|
display->getstringsize(buffer, &width, &height);
|
|
|
|
if (height <= STATUSBAR_HEIGHT)
|
|
|
|
{
|
|
|
|
display->putsxy(STATUSBAR_VOLUME_X_POS
|
|
|
|
+ STATUSBAR_VOLUME_WIDTH / 2
|
|
|
|
- width/2, STATUSBAR_Y_POS, buffer);
|
|
|
|
}
|
|
|
|
display->setfont(FONT_UI);
|
|
|
|
} else {
|
|
|
|
/* display volume bar */
|
2005-12-07 23:07:07 +00:00
|
|
|
vol = (volume - minvol) * 14 / (maxvol - minvol);
|
2005-10-28 00:00:00 +00:00
|
|
|
for(i=0; i < vol; i++) {
|
|
|
|
display->vline(STATUSBAR_VOLUME_X_POS + i,
|
|
|
|
STATUSBAR_Y_POS + 6 - i / 2,
|
|
|
|
STATUSBAR_Y_POS + 6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bar->last_volume = volume;
|
|
|
|
|
|
|
|
return needs_redraw;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print play state to status bar
|
|
|
|
*/
|
2007-02-24 11:07:21 +00:00
|
|
|
static void gui_statusbar_icon_play_state(struct screen * display, int state)
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
|
|
|
display->mono_bitmap(bitmap_icons_7x8[state], STATUSBAR_PLAY_STATE_X_POS,
|
|
|
|
STATUSBAR_Y_POS, STATUSBAR_PLAY_STATE_WIDTH,
|
2020-10-26 16:36:25 +00:00
|
|
|
SB_ICON_HEIGHT);
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print play mode to status bar
|
|
|
|
*/
|
2007-02-24 11:07:21 +00:00
|
|
|
static void gui_statusbar_icon_play_mode(struct screen * display, int mode)
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
|
|
|
display->mono_bitmap(bitmap_icons_7x8[mode], STATUSBAR_PLAY_MODE_X_POS,
|
|
|
|
STATUSBAR_Y_POS, STATUSBAR_PLAY_MODE_WIDTH,
|
2020-10-26 16:36:25 +00:00
|
|
|
SB_ICON_HEIGHT);
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print shuffle mode to status bar
|
|
|
|
*/
|
2007-02-24 11:07:21 +00:00
|
|
|
static void gui_statusbar_icon_shuffle(struct screen * display)
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
|
|
|
display->mono_bitmap(bitmap_icons_7x8[Icon_Shuffle],
|
|
|
|
STATUSBAR_SHUFFLE_X_POS, STATUSBAR_Y_POS,
|
2020-10-26 16:36:25 +00:00
|
|
|
STATUSBAR_SHUFFLE_WIDTH, SB_ICON_HEIGHT);
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print lock when keys are locked
|
|
|
|
*/
|
2007-02-24 11:07:21 +00:00
|
|
|
static void gui_statusbar_icon_lock(struct screen * display)
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
2005-11-22 21:55:05 +00:00
|
|
|
display->mono_bitmap(bitmap_icons_5x8[Icon_Lock_Main],
|
|
|
|
STATUSBAR_LOCKM_X_POS, STATUSBAR_Y_POS,
|
2020-10-26 16:36:25 +00:00
|
|
|
STATUSBAR_LOCKM_WIDTH, SB_ICON_HEIGHT);
|
2005-11-22 21:55:05 +00:00
|
|
|
}
|
|
|
|
|
2006-06-06 22:23:52 +00:00
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
2005-11-22 21:55:05 +00:00
|
|
|
/*
|
|
|
|
* Print remote lock when remote hold is enabled
|
|
|
|
*/
|
2007-02-24 11:07:21 +00:00
|
|
|
static void gui_statusbar_icon_lock_remote(struct screen * display)
|
2005-11-22 21:55:05 +00:00
|
|
|
{
|
|
|
|
display->mono_bitmap(bitmap_icons_5x8[Icon_Lock_Remote],
|
|
|
|
STATUSBAR_LOCKR_X_POS, STATUSBAR_Y_POS,
|
2020-10-26 16:36:25 +00:00
|
|
|
STATUSBAR_LOCKR_WIDTH, SB_ICON_HEIGHT);
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
2006-06-06 22:23:52 +00:00
|
|
|
#endif
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2007-02-18 05:07:19 +00:00
|
|
|
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
2005-10-28 00:00:00 +00:00
|
|
|
/*
|
|
|
|
* no real LED: disk activity in status bar
|
|
|
|
*/
|
2007-02-24 11:07:21 +00:00
|
|
|
static void gui_statusbar_led(struct screen * display)
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
2005-10-28 00:52:19 +00:00
|
|
|
display->mono_bitmap(bitmap_icon_disk,
|
2008-06-28 20:45:21 +00:00
|
|
|
STATUSBAR_DISK_X_POS(display->getwidth()),
|
2005-10-28 00:52:19 +00:00
|
|
|
STATUSBAR_Y_POS, STATUSBAR_DISK_WIDTH,
|
2020-10-26 16:36:25 +00:00
|
|
|
SB_ICON_HEIGHT);
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
2005-11-24 00:10:14 +00:00
|
|
|
#endif
|
2005-10-28 00:00:00 +00:00
|
|
|
|
2007-03-16 23:47:03 +00:00
|
|
|
#if CONFIG_RTC
|
2005-10-28 00:00:00 +00:00
|
|
|
/*
|
|
|
|
* Print time to status bar
|
|
|
|
*/
|
2007-06-28 13:51:44 +00:00
|
|
|
static void gui_statusbar_time(struct screen * display, struct tm *time)
|
2005-10-28 00:00:00 +00:00
|
|
|
{
|
|
|
|
unsigned char buffer[6];
|
2009-10-10 07:17:27 +00:00
|
|
|
const unsigned char *p = buffer;
|
2005-10-28 00:00:00 +00:00
|
|
|
unsigned int width, height;
|
2007-06-28 13:51:44 +00:00
|
|
|
int hour, minute;
|
|
|
|
if ( valid_time(time) ) {
|
|
|
|
hour = time->tm_hour;
|
|
|
|
minute = time->tm_min;
|
2005-10-28 00:00:00 +00:00
|
|
|
if ( global_settings.timeformat ) { /* 12 hour clock */
|
|
|
|
hour %= 12;
|
|
|
|
if ( hour == 0 ) {
|
|
|
|
hour += 12;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute);
|
|
|
|
}
|
|
|
|
else {
|
2009-10-10 07:17:27 +00:00
|
|
|
p = "--:--";
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
|
|
|
display->setfont(FONT_SYSFIXED);
|
2009-10-10 07:17:27 +00:00
|
|
|
display->getstringsize(p, &width, &height);
|
2005-10-28 00:00:00 +00:00
|
|
|
if (height <= STATUSBAR_HEIGHT) {
|
2008-06-28 20:45:21 +00:00
|
|
|
display->putsxy(STATUSBAR_TIME_X_END(display->getwidth()) - width,
|
2009-10-10 07:17:27 +00:00
|
|
|
STATUSBAR_Y_POS, p);
|
2005-10-28 00:00:00 +00:00
|
|
|
}
|
|
|
|
display->setfont(FONT_UI);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-09-02 17:30:30 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
2006-11-06 18:07:30 +00:00
|
|
|
/**
|
|
|
|
* Write a number to the display using bitmaps and return new position
|
|
|
|
*/
|
|
|
|
static int write_bitmap_number(struct screen * display, int value,
|
|
|
|
int x, int y)
|
2006-09-02 17:30:30 +00:00
|
|
|
{
|
2006-11-06 18:07:30 +00:00
|
|
|
char buf[12], *ptr;
|
|
|
|
snprintf(buf, sizeof(buf), "%d", value);
|
|
|
|
|
|
|
|
for (ptr = buf; *ptr != '\0'; ptr++, x += BM_GLYPH_WIDTH)
|
|
|
|
display->mono_bitmap(bitmap_glyphs_4x8[*ptr - '0'], x, y,
|
2020-10-26 16:36:25 +00:00
|
|
|
BM_GLYPH_WIDTH, SB_ICON_HEIGHT);
|
2006-11-06 18:07:30 +00:00
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write format info bitmaps - right justified
|
|
|
|
*/
|
|
|
|
static void gui_statusbar_write_format_info(struct screen * display)
|
|
|
|
{
|
2020-10-26 12:27:32 +00:00
|
|
|
/* Can't fit info for sw codec targets in statusbar using FONT_SYSFIXED
|
2006-11-06 18:07:30 +00:00
|
|
|
so must use icons */
|
|
|
|
int rec_format = global_settings.rec_format;
|
|
|
|
unsigned bitrk = 0; /* compiler warns about unitialized use !! */
|
|
|
|
int xpos = STATUSBAR_ENCODER_X_POS;
|
|
|
|
int width = STATUSBAR_ENCODER_WIDTH;
|
|
|
|
const unsigned char *bm = bitmap_formats_18x8[rec_format];
|
|
|
|
|
|
|
|
if (rec_format == REC_FORMAT_MPA_L3)
|
|
|
|
{
|
|
|
|
/* Special handling for mp3 */
|
|
|
|
bitrk = global_settings.mp3_enc_config.bitrate;
|
|
|
|
bitrk = mp3_enc_bitr[bitrk];
|
|
|
|
|
|
|
|
width = BM_MPA_L3_M_WIDTH;
|
|
|
|
|
|
|
|
/* Slide 'M' to right if fewer than three digits used */
|
|
|
|
if (bitrk > 999)
|
|
|
|
bitrk = 999; /* neurotic safety check if corrupted */
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (bitrk < 100)
|
|
|
|
xpos += BM_GLYPH_WIDTH;
|
|
|
|
if (bitrk < 10)
|
|
|
|
xpos += BM_GLYPH_WIDTH;
|
|
|
|
}
|
|
|
|
}
|
2020-07-17 04:01:32 +00:00
|
|
|
|
2006-11-06 18:07:30 +00:00
|
|
|
|
|
|
|
/* Show bitmap - clipping right edge if needed */
|
|
|
|
display->mono_bitmap_part(bm, 0, 0, STATUSBAR_ENCODER_WIDTH,
|
2020-10-26 16:36:25 +00:00
|
|
|
xpos, STATUSBAR_Y_POS, width, SB_ICON_HEIGHT);
|
2006-11-06 18:07:30 +00:00
|
|
|
|
|
|
|
if (rec_format == REC_FORMAT_MPA_L3)
|
|
|
|
{
|
|
|
|
xpos += BM_MPA_L3_M_WIDTH; /* to right of 'M' */
|
|
|
|
write_bitmap_number(display, bitrk, xpos, STATUSBAR_Y_POS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write sample rate using bitmaps - left justified
|
|
|
|
*/
|
|
|
|
static void gui_statusbar_write_samplerate_info(struct screen * display)
|
|
|
|
{
|
|
|
|
unsigned long samprk;
|
|
|
|
int xpos;
|
|
|
|
|
|
|
|
#ifdef SIMULATOR
|
|
|
|
samprk = 44100;
|
|
|
|
#else
|
2007-05-20 20:26:36 +00:00
|
|
|
#ifdef HAVE_SPDIF_REC
|
2006-11-06 18:07:30 +00:00
|
|
|
if (global_settings.rec_source == AUDIO_SRC_SPDIF)
|
|
|
|
/* Use rate in use, not current measured rate if it changed */
|
|
|
|
samprk = pcm_rec_sample_rate();
|
|
|
|
else
|
2006-09-12 18:26:27 +00:00
|
|
|
#endif
|
2006-11-06 18:07:30 +00:00
|
|
|
samprk = rec_freq_sampr[global_settings.rec_frequency];
|
|
|
|
#endif /* SIMULATOR */
|
|
|
|
|
|
|
|
samprk /= 1000;
|
|
|
|
if (samprk > 99)
|
|
|
|
samprk = 99; /* Limit to 3 glyphs */
|
|
|
|
|
|
|
|
xpos = write_bitmap_number(display, (unsigned)samprk,
|
|
|
|
STATUSBAR_RECFREQ_X_POS, STATUSBAR_Y_POS);
|
|
|
|
|
|
|
|
/* write the 'k' */
|
2020-10-26 12:27:32 +00:00
|
|
|
display->mono_bitmap(bitmap_glyphs_4x8[Glyph_4x8_k], xpos,
|
2006-11-06 18:07:30 +00:00
|
|
|
STATUSBAR_Y_POS, BM_GLYPH_WIDTH,
|
2020-10-26 16:36:25 +00:00
|
|
|
SB_ICON_HEIGHT);
|
2006-11-06 18:07:30 +00:00
|
|
|
}
|
|
|
|
|
2007-02-24 11:07:21 +00:00
|
|
|
static void gui_statusbar_icon_recording_info(struct screen * display)
|
2006-11-06 18:07:30 +00:00
|
|
|
{
|
2006-09-02 17:30:30 +00:00
|
|
|
/* Display Codec info in statusbar */
|
2006-11-06 18:07:30 +00:00
|
|
|
gui_statusbar_write_format_info(display);
|
2006-09-02 17:30:30 +00:00
|
|
|
|
|
|
|
/* Display Samplerate info in statusbar */
|
2006-11-06 18:07:30 +00:00
|
|
|
gui_statusbar_write_samplerate_info(display);
|
2006-09-02 17:30:30 +00:00
|
|
|
|
|
|
|
/* Display Channel status in status bar */
|
|
|
|
if(global_settings.rec_channels)
|
|
|
|
{
|
|
|
|
display->mono_bitmap(bitmap_icons_5x8[Icon_Mono],
|
|
|
|
STATUSBAR_RECCHANNELS_X_POS , STATUSBAR_Y_POS,
|
2020-10-26 16:36:25 +00:00
|
|
|
STATUSBAR_RECCHANNELS_WIDTH, SB_ICON_HEIGHT);
|
2006-09-02 17:30:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
display->mono_bitmap(bitmap_icons_5x8[Icon_Stereo],
|
|
|
|
STATUSBAR_RECCHANNELS_X_POS, STATUSBAR_Y_POS,
|
2020-10-26 16:36:25 +00:00
|
|
|
STATUSBAR_RECCHANNELS_WIDTH, SB_ICON_HEIGHT);
|
2006-09-02 17:30:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* HAVE_RECORDING */
|
|
|
|
|
2005-10-28 00:00:00 +00:00
|
|
|
void gui_syncstatusbar_init(struct gui_syncstatusbar * bars)
|
|
|
|
{
|
2005-11-09 22:47:15 +00:00
|
|
|
FOR_NB_SCREENS(i) {
|
2005-10-28 00:00:00 +00:00
|
|
|
gui_statusbar_init( &(bars->statusbars[i]) );
|
|
|
|
gui_statusbar_set_screen( &(bars->statusbars[i]), &(screens[i]) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-23 23:44:31 +00:00
|
|
|
|
2009-07-08 00:51:03 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2009-08-24 00:03:59 +00:00
|
|
|
enum statusbar_values statusbar_position(int screen)
|
2009-07-08 00:51:03 +00:00
|
|
|
{
|
|
|
|
if (screen == SCREEN_REMOTE)
|
|
|
|
return global_settings.remote_statusbar;
|
|
|
|
return global_settings.statusbar;
|
|
|
|
}
|
|
|
|
#endif
|