2002-07-22 22:41:32 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2003-04-23 11:26:25 +00:00
|
|
|
#include "string.h"
|
2002-07-22 22:41:32 +00:00
|
|
|
#include "lcd.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "power.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "status.h"
|
2004-01-05 20:42:51 +00:00
|
|
|
#include "mp3_playback.h"
|
2005-04-04 12:06:29 +00:00
|
|
|
#include "audio.h"
|
2005-11-17 20:14:59 +00:00
|
|
|
#include "gwps.h"
|
2005-08-21 23:01:12 +00:00
|
|
|
#include "abrepeat.h"
|
2002-08-30 00:58:55 +00:00
|
|
|
#ifdef HAVE_RTC
|
2003-01-27 14:24:40 +00:00
|
|
|
#include "timefuncs.h"
|
2002-08-30 00:58:55 +00:00
|
|
|
#endif
|
2002-08-07 10:35:26 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#include "icons.h"
|
2003-11-04 13:17:29 +00:00
|
|
|
#include "font.h"
|
2002-08-07 10:35:26 +00:00
|
|
|
#endif
|
2002-08-07 11:41:31 +00:00
|
|
|
#include "powermgmt.h"
|
2005-02-19 00:34:15 +00:00
|
|
|
#include "led.h"
|
2005-04-01 13:41:03 +00:00
|
|
|
#include "sound.h"
|
2005-04-19 11:34:22 +00:00
|
|
|
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
|
|
|
#include "button.h"
|
|
|
|
#endif
|
2005-06-23 02:18:29 +00:00
|
|
|
#include "usb.h"
|
2005-11-19 19:50:04 +00:00
|
|
|
#ifdef CONFIG_TUNER
|
|
|
|
#include "radio.h"
|
|
|
|
#endif
|
2002-08-07 10:35:26 +00:00
|
|
|
|
2005-10-28 00:00:00 +00:00
|
|
|
enum playmode ff_mode;
|
2002-07-22 22:41:32 +00:00
|
|
|
|
2005-10-28 00:00:00 +00:00
|
|
|
long switch_tick;
|
|
|
|
bool battery_state = true;
|
2005-06-23 02:18:29 +00:00
|
|
|
#ifdef HAVE_CHARGING
|
2005-10-28 00:00:00 +00:00
|
|
|
int battery_charge_step = 0;
|
2005-06-23 02:18:29 +00:00
|
|
|
#endif
|
2002-08-07 10:35:26 +00:00
|
|
|
|
2003-04-23 11:26:25 +00:00
|
|
|
struct status_info {
|
|
|
|
int battlevel;
|
|
|
|
int volume;
|
|
|
|
int hour;
|
|
|
|
int minute;
|
|
|
|
int playmode;
|
|
|
|
int repeat;
|
|
|
|
bool inserted;
|
|
|
|
bool shuffle;
|
|
|
|
bool keylock;
|
|
|
|
bool battery_safe;
|
2004-07-13 06:59:11 +00:00
|
|
|
bool redraw_volume; /* true if the volume gauge needs updating */
|
2005-06-04 23:15:52 +00:00
|
|
|
#if CONFIG_LED == LED_VIRTUAL
|
2005-07-05 22:27:54 +00:00
|
|
|
bool led; /* disk LED simulation in the status bar */
|
2005-02-19 00:34:15 +00:00
|
|
|
#endif
|
2005-06-23 02:18:29 +00:00
|
|
|
#ifdef HAVE_USB_POWER
|
|
|
|
bool usb_power;
|
|
|
|
#endif
|
|
|
|
|
2003-04-23 11:26:25 +00:00
|
|
|
};
|
|
|
|
|
2002-07-22 22:41:32 +00:00
|
|
|
void status_init(void)
|
|
|
|
{
|
2004-06-27 01:05:40 +00:00
|
|
|
ff_mode = 0;
|
2002-07-22 22:41:32 +00:00
|
|
|
}
|
|
|
|
|
2004-06-27 01:05:40 +00:00
|
|
|
void status_set_ffmode(enum playmode mode)
|
2002-07-22 22:41:32 +00:00
|
|
|
{
|
2004-06-27 01:05:40 +00:00
|
|
|
ff_mode = mode; /* Either STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
|
2003-04-23 11:26:25 +00:00
|
|
|
status_draw(false);
|
2002-07-22 22:41:32 +00:00
|
|
|
}
|
|
|
|
|
2005-08-21 19:17:50 +00:00
|
|
|
enum playmode status_get_ffmode(void)
|
|
|
|
{
|
|
|
|
/* only use this function for STATUS_FASTFORWARD or STATUS_FASTBACKWARD */
|
|
|
|
/* use audio_status() for other modes */
|
|
|
|
return ff_mode;
|
|
|
|
}
|
|
|
|
|
2004-06-27 01:05:40 +00:00
|
|
|
int current_playmode(void)
|
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
int audio_stat = audio_status();
|
2004-06-27 01:05:40 +00:00
|
|
|
|
|
|
|
/* ff_mode can be either STATUS_FASTFORWARD or STATUS_FASTBACKWARD
|
|
|
|
and that supercedes the other modes */
|
|
|
|
if(ff_mode)
|
|
|
|
return ff_mode;
|
|
|
|
|
2005-04-04 12:06:29 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_PLAY)
|
2004-06-27 01:05:40 +00:00
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_PAUSE)
|
2004-06-27 01:05:40 +00:00
|
|
|
return STATUS_PAUSE;
|
|
|
|
else
|
|
|
|
return STATUS_PLAY;
|
|
|
|
}
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == MAS3587F
|
2004-06-27 01:05:40 +00:00
|
|
|
else
|
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_RECORD)
|
2004-06-27 01:05:40 +00:00
|
|
|
{
|
2005-04-04 12:06:29 +00:00
|
|
|
if(audio_stat & AUDIO_STATUS_PAUSE)
|
2004-06-27 01:05:40 +00:00
|
|
|
return STATUS_RECORD_PAUSE;
|
|
|
|
else
|
|
|
|
return STATUS_RECORD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2005-11-19 19:50:04 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_TUNER
|
|
|
|
audio_stat = get_radio_status();
|
|
|
|
|
|
|
|
if(audio_stat == FMRADIO_PLAYING)
|
|
|
|
return STATUS_PLAY;
|
|
|
|
|
|
|
|
if(audio_stat == FMRADIO_PAUSED)
|
|
|
|
return STATUS_PAUSE;
|
|
|
|
#endif
|
2004-06-27 01:05:40 +00:00
|
|
|
|
|
|
|
return STATUS_STOP;
|
|
|
|
}
|
|
|
|
|
2002-10-15 12:53:33 +00:00
|
|
|
#if defined(HAVE_LCD_CHARCELLS)
|
2005-10-28 00:00:00 +00:00
|
|
|
bool record = false;
|
|
|
|
bool audio = false;
|
|
|
|
bool param = false;
|
|
|
|
bool usb = false;
|
2002-10-15 12:53:33 +00:00
|
|
|
|
|
|
|
void status_set_record(bool b)
|
|
|
|
{
|
|
|
|
record = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void status_set_audio(bool b)
|
|
|
|
{
|
|
|
|
audio = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void status_set_param(bool b)
|
|
|
|
{
|
|
|
|
param = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void status_set_usb(bool b)
|
|
|
|
{
|
|
|
|
usb = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* HAVE_LCD_CHARCELLS */
|
|
|
|
|
2003-04-23 11:26:25 +00:00
|
|
|
void status_draw(bool force_redraw)
|
2002-07-22 22:41:32 +00:00
|
|
|
{
|
2005-08-26 08:20:29 +00:00
|
|
|
/* This is static because we use memcmp() below to check for changes, and
|
|
|
|
the unused bytes (due to struct member alignment) might change if
|
|
|
|
the struct is allocated on the stack. */
|
|
|
|
static struct status_info info;
|
2003-04-23 11:26:25 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
static struct status_info lastinfo;
|
2003-01-27 14:24:40 +00:00
|
|
|
struct tm* tm;
|
2002-09-30 21:27:53 +00:00
|
|
|
|
|
|
|
if ( !global_settings.statusbar )
|
|
|
|
return;
|
2003-04-23 11:26:25 +00:00
|
|
|
#else
|
|
|
|
(void)force_redraw; /* players always "redraw" */
|
|
|
|
#endif
|
|
|
|
|
2005-04-01 13:41:03 +00:00
|
|
|
info.volume = sound_val2phys(SOUND_VOLUME, global_settings.volume);
|
2003-04-23 11:26:25 +00:00
|
|
|
info.inserted = charger_inserted();
|
2003-06-04 12:03:23 +00:00
|
|
|
info.battlevel = battery_level();
|
|
|
|
info.battery_safe = battery_level_safe();
|
2002-09-30 21:27:53 +00:00
|
|
|
|
2002-08-07 10:35:26 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2003-04-23 11:26:25 +00:00
|
|
|
tm = get_time();
|
|
|
|
info.hour = tm->tm_hour;
|
|
|
|
info.minute = tm->tm_min;
|
|
|
|
info.shuffle = global_settings.playlist_shuffle;
|
2005-04-19 11:34:22 +00:00
|
|
|
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
|
|
|
info.keylock = button_hold();
|
|
|
|
#else
|
2003-04-23 11:26:25 +00:00
|
|
|
info.keylock = keys_locked;
|
2005-04-19 11:34:22 +00:00
|
|
|
#endif
|
2003-04-23 11:26:25 +00:00
|
|
|
info.repeat = global_settings.repeat_mode;
|
2004-06-27 01:05:40 +00:00
|
|
|
info.playmode = current_playmode();
|
2005-06-04 23:15:52 +00:00
|
|
|
#if CONFIG_LED == LED_VIRTUAL
|
2005-02-19 14:44:31 +00:00
|
|
|
info.led = led_read(HZ/2); /* delay should match polling interval */
|
2005-02-19 00:34:15 +00:00
|
|
|
#endif
|
2005-06-23 02:18:29 +00:00
|
|
|
#ifdef HAVE_USB_POWER
|
|
|
|
info.usb_power = usb_powered();
|
|
|
|
#endif
|
2003-04-23 11:26:25 +00:00
|
|
|
|
2003-06-04 12:03:23 +00:00
|
|
|
/* only redraw if forced to, or info has changed */
|
2003-04-23 11:26:25 +00:00
|
|
|
if (force_redraw ||
|
|
|
|
info.inserted ||
|
2004-07-13 06:59:11 +00:00
|
|
|
!info.battery_safe ||
|
|
|
|
info.redraw_volume ||
|
2003-06-04 12:03:23 +00:00
|
|
|
memcmp(&info, &lastinfo, sizeof(struct status_info)))
|
|
|
|
{
|
2005-06-24 22:33:21 +00:00
|
|
|
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
lcd_fillrect(0,0,LCD_WIDTH,8);
|
|
|
|
lcd_set_drawmode(DRMODE_SOLID);
|
2003-06-04 12:03:23 +00:00
|
|
|
#else
|
|
|
|
/* players always "redraw" */
|
|
|
|
{
|
|
|
|
#endif
|
2005-06-23 02:18:29 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CHARGING
|
2003-06-04 12:03:23 +00:00
|
|
|
if (info.inserted) {
|
2002-08-12 12:31:36 +00:00
|
|
|
battery_state = true;
|
2004-10-08 17:45:52 +00:00
|
|
|
#if defined(HAVE_CHARGE_CTRL) || CONFIG_BATTERY == BATT_LIION2200
|
2003-06-04 12:03:23 +00:00
|
|
|
/* zero battery run time if charging */
|
2003-10-17 13:54:48 +00:00
|
|
|
if (charge_state > 0) {
|
2002-12-04 11:25:56 +00:00
|
|
|
global_settings.runtime = 0;
|
2003-10-17 13:54:48 +00:00
|
|
|
lasttime = current_tick;
|
|
|
|
}
|
2003-06-04 12:03:23 +00:00
|
|
|
|
|
|
|
/* animate battery if charging */
|
2004-05-12 14:21:35 +00:00
|
|
|
if ((charge_state == 1) ||
|
2005-02-19 09:08:25 +00:00
|
|
|
(charge_state == 2)) {
|
2003-06-04 12:03:23 +00:00
|
|
|
#else
|
2003-10-17 13:54:48 +00:00
|
|
|
global_settings.runtime = 0;
|
|
|
|
lasttime = current_tick;
|
2003-06-04 12:03:23 +00:00
|
|
|
{
|
|
|
|
#endif
|
|
|
|
/* animate in three steps (34% per step for a better look) */
|
|
|
|
info.battlevel = battery_charge_step * 34;
|
2003-04-23 11:26:25 +00:00
|
|
|
if (info.battlevel > 100)
|
|
|
|
info.battlevel = 100;
|
2002-08-13 14:58:09 +00:00
|
|
|
if(TIME_AFTER(current_tick, switch_tick)) {
|
|
|
|
battery_charge_step=(battery_charge_step+1)%4;
|
|
|
|
switch_tick = current_tick + HZ;
|
|
|
|
}
|
2002-08-07 13:05:13 +00:00
|
|
|
}
|
|
|
|
}
|
2005-06-23 02:18:29 +00:00
|
|
|
else
|
|
|
|
#endif /* HAVE_CHARGING */
|
|
|
|
{
|
2003-06-04 12:03:23 +00:00
|
|
|
if (info.battery_safe)
|
2002-08-12 12:31:36 +00:00
|
|
|
battery_state = true;
|
2003-06-04 12:03:23 +00:00
|
|
|
else {
|
|
|
|
/* blink battery if level is low */
|
2003-12-03 23:21:13 +00:00
|
|
|
if(TIME_AFTER(current_tick, switch_tick) &&
|
|
|
|
(info.battlevel > -1)) {
|
2002-08-12 12:31:36 +00:00
|
|
|
switch_tick = current_tick+HZ;
|
|
|
|
battery_state =! battery_state;
|
2002-08-09 11:56:54 +00:00
|
|
|
}
|
2003-06-04 12:03:23 +00:00
|
|
|
}
|
2002-08-09 11:56:54 +00:00
|
|
|
}
|
2003-06-04 12:03:23 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2003-12-03 23:21:13 +00:00
|
|
|
if (battery_state)
|
2005-06-23 02:18:29 +00:00
|
|
|
statusbar_icon_battery(info.battlevel);
|
|
|
|
|
|
|
|
/* draw power plug if charging */
|
|
|
|
if (info.inserted)
|
2005-07-06 22:58:02 +00:00
|
|
|
lcd_mono_bitmap(bitmap_icons_7x8[Icon_Plug], ICON_PLUG_X_POS,
|
|
|
|
STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT);
|
2005-06-23 02:18:29 +00:00
|
|
|
#ifdef HAVE_USB_POWER
|
|
|
|
else if (info.usb_power)
|
2005-07-06 22:58:02 +00:00
|
|
|
lcd_mono_bitmap(bitmap_icons_7x8[Icon_USBPlug], ICON_PLUG_X_POS,
|
|
|
|
STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT);
|
2005-06-23 02:18:29 +00:00
|
|
|
#endif
|
|
|
|
|
2004-07-13 06:59:11 +00:00
|
|
|
info.redraw_volume = statusbar_icon_volume(info.volume);
|
2004-06-27 01:05:40 +00:00
|
|
|
statusbar_icon_play_state(current_playmode() + Icon_Play);
|
2003-04-23 11:26:25 +00:00
|
|
|
switch (info.repeat) {
|
2005-08-21 23:01:12 +00:00
|
|
|
#ifdef AB_REPEAT_ENABLE
|
|
|
|
case REPEAT_AB:
|
|
|
|
statusbar_icon_play_mode(Icon_RepeatAB);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
2002-10-08 10:24:29 +00:00
|
|
|
case REPEAT_ONE:
|
|
|
|
statusbar_icon_play_mode(Icon_RepeatOne);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REPEAT_ALL:
|
2005-06-25 04:46:25 +00:00
|
|
|
case REPEAT_SHUFFLE:
|
2002-10-08 10:24:29 +00:00
|
|
|
statusbar_icon_play_mode(Icon_Repeat);
|
|
|
|
break;
|
|
|
|
}
|
2003-06-04 12:03:23 +00:00
|
|
|
if (info.shuffle)
|
2002-08-12 12:31:36 +00:00
|
|
|
statusbar_icon_shuffle();
|
2003-04-23 11:26:25 +00:00
|
|
|
if (info.keylock)
|
2002-08-12 12:31:36 +00:00
|
|
|
statusbar_icon_lock();
|
2002-08-07 10:35:26 +00:00
|
|
|
#ifdef HAVE_RTC
|
2003-04-23 11:26:25 +00:00
|
|
|
statusbar_time(info.hour, info.minute);
|
2005-02-19 00:34:15 +00:00
|
|
|
#endif
|
2005-06-04 23:15:52 +00:00
|
|
|
#if CONFIG_LED == LED_VIRTUAL
|
2005-02-19 14:44:31 +00:00
|
|
|
if (info.led)
|
|
|
|
statusbar_led();
|
2002-08-20 14:33:02 +00:00
|
|
|
#endif
|
2002-08-20 19:40:35 +00:00
|
|
|
lcd_update_rect(0, 0, LCD_WIDTH, STATUSBAR_HEIGHT);
|
2003-06-04 12:03:23 +00:00
|
|
|
lastinfo = info;
|
|
|
|
#endif
|
2002-08-07 10:35:26 +00:00
|
|
|
}
|
2003-04-23 11:26:25 +00:00
|
|
|
|
2003-06-04 12:03:23 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_LCD_CHARCELLS)
|
2003-11-19 14:14:41 +00:00
|
|
|
if (info.battlevel > -1)
|
2003-06-04 12:03:23 +00:00
|
|
|
lcd_icon(ICON_BATTERY, battery_state);
|
|
|
|
lcd_icon(ICON_BATTERY_1, info.battlevel > 25);
|
|
|
|
lcd_icon(ICON_BATTERY_2, info.battlevel > 50);
|
|
|
|
lcd_icon(ICON_BATTERY_3, info.battlevel > 75);
|
|
|
|
|
|
|
|
lcd_icon(ICON_VOLUME, true);
|
|
|
|
lcd_icon(ICON_VOLUME_1, info.volume > 10);
|
|
|
|
lcd_icon(ICON_VOLUME_2, info.volume > 30);
|
|
|
|
lcd_icon(ICON_VOLUME_3, info.volume > 50);
|
|
|
|
lcd_icon(ICON_VOLUME_4, info.volume > 70);
|
|
|
|
lcd_icon(ICON_VOLUME_5, info.volume > 90);
|
|
|
|
|
2004-06-27 01:05:40 +00:00
|
|
|
lcd_icon(ICON_PLAY, current_playmode() == STATUS_PLAY);
|
|
|
|
lcd_icon(ICON_PAUSE, current_playmode() == STATUS_PAUSE);
|
2003-06-04 12:03:23 +00:00
|
|
|
|
|
|
|
lcd_icon(ICON_REPEAT, global_settings.repeat_mode != REPEAT_OFF);
|
|
|
|
lcd_icon(ICON_1, global_settings.repeat_mode == REPEAT_ONE);
|
|
|
|
|
|
|
|
lcd_icon(ICON_RECORD, record);
|
|
|
|
lcd_icon(ICON_AUDIO, audio);
|
|
|
|
lcd_icon(ICON_PARAM, param);
|
|
|
|
lcd_icon(ICON_USB, usb);
|
2002-08-07 10:35:26 +00:00
|
|
|
#endif
|
2003-06-04 12:03:23 +00:00
|
|
|
|
2002-07-22 22:41:32 +00:00
|
|
|
}
|
2003-06-04 12:03:23 +00:00
|
|
|
|
2004-10-09 20:54:15 +00:00
|
|
|
#if defined(HAVE_LCD_BITMAP) && (CONFIG_KEYPAD == RECORDER_PAD)
|
2004-08-18 01:09:31 +00:00
|
|
|
static void draw_buttonbar_btn(int num, const char* caption)
|
2003-11-04 13:17:29 +00:00
|
|
|
{
|
|
|
|
int xpos, ypos, button_width, text_width;
|
|
|
|
int fw, fh;
|
|
|
|
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
lcd_getstringsize("M", &fw, &fh);
|
|
|
|
|
|
|
|
button_width = LCD_WIDTH/3;
|
|
|
|
xpos = num * button_width;
|
|
|
|
ypos = LCD_HEIGHT - fh;
|
|
|
|
|
|
|
|
if(caption)
|
|
|
|
{
|
|
|
|
/* center the text */
|
|
|
|
text_width = fw * strlen(caption);
|
|
|
|
lcd_putsxy(xpos + (button_width - text_width)/2, ypos, caption);
|
|
|
|
}
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
lcd_set_drawmode(DRMODE_COMPLEMENT);
|
|
|
|
lcd_fillrect(xpos, ypos, button_width - 1, fh);
|
|
|
|
lcd_set_drawmode(DRMODE_SOLID);
|
2003-11-04 13:17:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static char stored_caption1[8];
|
|
|
|
static char stored_caption2[8];
|
|
|
|
static char stored_caption3[8];
|
|
|
|
|
2004-08-18 01:09:31 +00:00
|
|
|
void buttonbar_set(const char* caption1, const char *caption2,
|
|
|
|
const char *caption3)
|
2003-11-04 13:17:29 +00:00
|
|
|
{
|
2004-03-16 13:44:56 +00:00
|
|
|
buttonbar_unset();
|
|
|
|
if(caption1)
|
|
|
|
{
|
|
|
|
strncpy(stored_caption1, caption1, 7);
|
|
|
|
stored_caption1[7] = 0;
|
|
|
|
}
|
|
|
|
if(caption2)
|
|
|
|
{
|
|
|
|
strncpy(stored_caption2, caption2, 7);
|
|
|
|
stored_caption2[7] = 0;
|
|
|
|
}
|
|
|
|
if(caption3)
|
|
|
|
{
|
|
|
|
strncpy(stored_caption3, caption3, 7);
|
|
|
|
stored_caption3[7] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void buttonbar_unset(void)
|
|
|
|
{
|
|
|
|
stored_caption1[0] = 0;
|
|
|
|
stored_caption2[0] = 0;
|
|
|
|
stored_caption3[0] = 0;
|
2003-11-04 13:17:29 +00:00
|
|
|
}
|
|
|
|
|
2003-11-05 08:59:55 +00:00
|
|
|
void buttonbar_draw(void)
|
2003-11-04 13:17:29 +00:00
|
|
|
{
|
2005-06-24 22:33:21 +00:00
|
|
|
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
|
|
|
|
lcd_fillrect(0, LCD_HEIGHT-8, LCD_WIDTH, 8);
|
|
|
|
lcd_set_drawmode(DRMODE_SOLID);
|
2003-11-04 13:17:29 +00:00
|
|
|
draw_buttonbar_btn(0, stored_caption1);
|
|
|
|
draw_buttonbar_btn(1, stored_caption2);
|
|
|
|
draw_buttonbar_btn(2, stored_caption3);
|
|
|
|
}
|
2004-03-16 13:44:56 +00:00
|
|
|
|
|
|
|
bool buttonbar_isset(void)
|
|
|
|
{
|
|
|
|
/* If all buttons are unset, the button bar is considered disabled */
|
|
|
|
return (global_settings.buttonbar &&
|
|
|
|
((stored_caption1[0] != 0) ||
|
|
|
|
(stored_caption2[0] != 0) ||
|
|
|
|
(stored_caption3[0] != 0)));
|
|
|
|
}
|
|
|
|
|
2003-11-04 13:17:29 +00:00
|
|
|
#endif
|