2007-02-08 04:33:41 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2007-02-13 00:32:17 +00:00
|
|
|
* $Id$
|
2007-02-08 04:33:41 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Jonathan Gordon
|
|
|
|
*
|
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.
|
2007-02-08 04:33:41 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include "config.h"
|
2008-10-16 10:38:03 +00:00
|
|
|
#include "appevents.h"
|
2007-02-08 04:33:41 +00:00
|
|
|
#include "lang.h"
|
|
|
|
#include "action.h"
|
|
|
|
#include "settings.h"
|
|
|
|
#include "menu.h"
|
2007-02-17 14:02:48 +00:00
|
|
|
#include "tree.h"
|
|
|
|
#include "list.h"
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#include "peakmeter.h"
|
|
|
|
#endif
|
|
|
|
#include "talk.h"
|
|
|
|
#include "lcd.h"
|
|
|
|
#include "lcd-remote.h"
|
2009-06-16 17:04:47 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
#include "screens.h"
|
|
|
|
#endif
|
2009-08-16 22:20:11 +00:00
|
|
|
#include "viewport.h"
|
2009-08-23 23:44:31 +00:00
|
|
|
#include "statusbar.h" /* statusbar_vals enum*/
|
2007-02-17 14:02:48 +00:00
|
|
|
|
2007-04-12 22:12:13 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2008-05-03 08:35:14 +00:00
|
|
|
static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item)
|
2007-02-17 14:02:48 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM:
|
|
|
|
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
set_remote_backlight_filter_keypress(
|
|
|
|
global_settings.remote_bl_filter_first_keypress);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
#endif
|
2008-05-03 09:49:43 +00:00
|
|
|
#ifdef HAVE_LCD_FLIP
|
2008-05-03 08:35:14 +00:00
|
|
|
static int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
|
2007-02-17 14:02:48 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM:
|
2009-10-05 17:53:45 +00:00
|
|
|
button_set_flip(global_settings.flip_display);
|
2007-02-17 14:02:48 +00:00
|
|
|
lcd_set_flip(global_settings.flip_display);
|
2008-03-28 19:07:27 +00:00
|
|
|
lcd_update();
|
2007-02-17 14:02:48 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
lcd_remote_set_flip(global_settings.remote_flip_display);
|
|
|
|
lcd_remote_update();
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* LCD MENU */
|
2007-04-12 22:12:13 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL);
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(backlight_timeout_plugged,
|
|
|
|
&global_settings.backlight_timeout_plugged, NULL);
|
|
|
|
#endif
|
|
|
|
#ifdef HAS_BUTTON_HOLD
|
|
|
|
MENUITEM_SETTING(backlight_on_button_hold,
|
|
|
|
&global_settings.backlight_on_button_hold, NULL);
|
|
|
|
#endif
|
|
|
|
MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL);
|
2009-01-26 23:21:49 +00:00
|
|
|
#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
|
|
|
|
|| defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(backlight_fade_in, &global_settings.backlight_fade_in, NULL);
|
|
|
|
MENUITEM_SETTING(backlight_fade_out, &global_settings.backlight_fade_out, NULL);
|
|
|
|
#endif
|
|
|
|
MENUITEM_SETTING(bl_filter_first_keypress,
|
|
|
|
&global_settings.bl_filter_first_keypress,
|
|
|
|
filterfirstkeypress_callback);
|
2008-05-14 19:29:25 +00:00
|
|
|
#ifdef HAVE_LCD_SLEEP_SETTING
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(lcd_sleep_after_backlight_off,
|
|
|
|
&global_settings.lcd_sleep_after_backlight_off, NULL);
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
MENUITEM_SETTING(brightness_item, &global_settings.brightness, NULL);
|
|
|
|
#endif
|
2007-04-12 22:12:13 +00:00
|
|
|
#endif /* HAVE_BACKLIGHT */
|
2007-02-17 14:02:48 +00:00
|
|
|
#ifdef HAVE_LCD_CONTRAST
|
|
|
|
MENUITEM_SETTING(contrast, &global_settings.contrast, NULL);
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#ifdef HAVE_LCD_INVERT
|
|
|
|
MENUITEM_SETTING(invert, &global_settings.invert, NULL);
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_FLIP
|
|
|
|
MENUITEM_SETTING(flip_display, &global_settings.flip_display, flipdisplay_callback);
|
|
|
|
#endif
|
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
|
|
|
|
|
|
|
/* now the actual menu */
|
|
|
|
MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
|
2007-03-03 13:52:14 +00:00
|
|
|
NULL, Icon_Display_menu
|
2007-04-12 22:12:13 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT
|
2007-02-17 14:02:48 +00:00
|
|
|
,&backlight_timeout
|
2007-02-18 05:32:06 +00:00
|
|
|
# if CONFIG_CHARGING
|
2007-02-17 14:02:48 +00:00
|
|
|
,&backlight_timeout_plugged
|
|
|
|
# endif
|
|
|
|
# ifdef HAS_BUTTON_HOLD
|
|
|
|
,&backlight_on_button_hold
|
|
|
|
# endif
|
2007-03-21 07:26:07 +00:00
|
|
|
,&caption_backlight
|
2009-01-26 23:21:49 +00:00
|
|
|
#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
|
|
|
|
|| defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
|
2007-02-17 14:02:48 +00:00
|
|
|
,&backlight_fade_in, &backlight_fade_out
|
2008-11-26 08:26:13 +00:00
|
|
|
#endif
|
2007-02-17 14:02:48 +00:00
|
|
|
,&bl_filter_first_keypress
|
2008-05-14 19:29:25 +00:00
|
|
|
# ifdef HAVE_LCD_SLEEP_SETTING
|
2007-02-17 14:02:48 +00:00
|
|
|
,&lcd_sleep_after_backlight_off
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
,&brightness_item
|
|
|
|
# endif
|
2007-04-12 22:12:13 +00:00
|
|
|
#endif /* HAVE_BACKLIGHT */
|
2007-02-17 14:02:48 +00:00
|
|
|
#ifdef HAVE_LCD_CONTRAST
|
|
|
|
,&contrast
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
# ifdef HAVE_LCD_INVERT
|
|
|
|
,&invert
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_LCD_FLIP
|
|
|
|
,&flip_display
|
|
|
|
# endif
|
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
|
|
|
);
|
|
|
|
/* LCD MENU */
|
|
|
|
/***********************************/
|
|
|
|
|
|
|
|
|
|
|
|
/********************************/
|
|
|
|
/* Remote LCD settings menu */
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
MENUITEM_SETTING(remote_backlight_timeout,
|
|
|
|
&global_settings.remote_backlight_timeout, NULL);
|
|
|
|
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(remote_backlight_timeout_plugged,
|
|
|
|
&global_settings.remote_backlight_timeout_plugged, NULL);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
|
|
|
MENUITEM_SETTING(remote_backlight_on_button_hold,
|
|
|
|
&global_settings.remote_backlight_on_button_hold, NULL);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
MENUITEM_SETTING(remote_caption_backlight,
|
|
|
|
&global_settings.remote_caption_backlight, NULL);
|
|
|
|
MENUITEM_SETTING(remote_bl_filter_first_keypress,
|
|
|
|
&global_settings.remote_bl_filter_first_keypress,
|
|
|
|
filterfirstkeypress_callback);
|
|
|
|
MENUITEM_SETTING(remote_contrast,
|
|
|
|
&global_settings.remote_contrast, NULL);
|
|
|
|
MENUITEM_SETTING(remote_invert,
|
|
|
|
&global_settings.remote_invert, NULL);
|
2009-04-11 07:23:56 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_FLIP
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(remote_flip_display,
|
|
|
|
&global_settings.remote_flip_display, flipdisplay_callback);
|
2009-04-11 07:23:56 +00:00
|
|
|
#endif
|
2007-02-17 14:02:48 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_REMOTE_LCD_TICKING
|
2008-09-18 22:08:36 +00:00
|
|
|
static int ticking_callback(int action,const struct menu_item_ex *this_item)
|
2007-02-17 14:02:48 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM:
|
|
|
|
lcd_remote_emireduce(global_settings.remote_reduce_ticking);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
MENUITEM_SETTING(remote_reduce_ticking,
|
|
|
|
&global_settings.remote_reduce_ticking, ticking_callback);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
MAKE_MENU(lcd_remote_settings, ID2P(LANG_LCD_REMOTE_MENU),
|
2007-03-03 13:52:14 +00:00
|
|
|
NULL, Icon_Remote_Display_menu,
|
2007-02-17 14:02:48 +00:00
|
|
|
&remote_backlight_timeout,
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2007-02-17 14:02:48 +00:00
|
|
|
&remote_backlight_timeout_plugged,
|
|
|
|
#endif
|
|
|
|
#ifdef HAS_REMOTE_BUTTON_HOLD
|
|
|
|
&remote_backlight_on_button_hold,
|
|
|
|
#endif
|
|
|
|
&remote_caption_backlight, &remote_bl_filter_first_keypress,
|
2009-04-11 07:23:56 +00:00
|
|
|
&remote_contrast, &remote_invert
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_FLIP
|
|
|
|
,&remote_flip_display
|
|
|
|
#endif
|
2007-02-17 14:02:48 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD_TICKING
|
|
|
|
,&remote_reduce_ticking
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
|
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
|
|
|
/* Remote LCD settings menu */
|
|
|
|
/********************************/
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* SCROLL MENU */
|
2007-03-03 14:23:03 +00:00
|
|
|
MENUITEM_SETTING_W_TEXT(scroll_speed, &global_settings.scroll_speed,
|
|
|
|
ID2P(LANG_SCROLL), NULL);
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(scroll_delay, &global_settings.scroll_delay, NULL);
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2007-03-03 14:23:03 +00:00
|
|
|
MENUITEM_SETTING_W_TEXT(scroll_step, &global_settings.scroll_step,
|
|
|
|
ID2P(LANG_SCROLL_STEP_EXAMPLE), NULL);
|
2007-02-17 14:02:48 +00:00
|
|
|
#endif
|
|
|
|
MENUITEM_SETTING(bidir_limit, &global_settings.bidir_limit, NULL);
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2007-03-03 14:23:03 +00:00
|
|
|
MENUITEM_SETTING_W_TEXT(remote_scroll_speed, &global_settings.remote_scroll_speed,
|
|
|
|
ID2P(LANG_SCROLL), NULL);
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(remote_scroll_delay, &global_settings.remote_scroll_delay, NULL);
|
2007-03-03 14:23:03 +00:00
|
|
|
MENUITEM_SETTING_W_TEXT(remote_scroll_step, &global_settings.remote_scroll_step,
|
|
|
|
ID2P(LANG_SCROLL_STEP_EXAMPLE), NULL);
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(remote_bidir_limit, &global_settings.remote_bidir_limit, NULL);
|
2007-05-27 15:08:56 +00:00
|
|
|
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(remote_scroll_sets, ID2P(LANG_REMOTE_SCROLL_SETS), 0, Icon_NOICON,
|
2007-02-17 14:02:48 +00:00
|
|
|
&remote_scroll_speed, &remote_scroll_delay,
|
|
|
|
&remote_scroll_step, &remote_bidir_limit);
|
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
2010-06-05 11:59:43 +00:00
|
|
|
|
2007-05-27 15:08:56 +00:00
|
|
|
/* list acceleration */
|
2009-03-02 19:25:50 +00:00
|
|
|
#ifndef HAVE_WHEEL_ACCELERATION
|
2007-05-27 15:08:56 +00:00
|
|
|
MENUITEM_SETTING(list_accel_start_delay,
|
|
|
|
&global_settings.list_accel_start_delay, NULL);
|
|
|
|
MENUITEM_SETTING(list_accel_wait, &global_settings.list_accel_wait, NULL);
|
2009-03-02 19:25:50 +00:00
|
|
|
#endif /* HAVE_WHEEL_ACCELERATION */
|
2007-02-17 14:02:48 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2008-05-03 08:35:14 +00:00
|
|
|
static int screenscroll_callback(int action,const struct menu_item_ex *this_item)
|
2007-02-17 14:02:48 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM:
|
|
|
|
gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
MENUITEM_SETTING(offset_out_of_view, &global_settings.offset_out_of_view,
|
|
|
|
screenscroll_callback);
|
|
|
|
MENUITEM_SETTING(screen_scroll_step, &global_settings.screen_scroll_step, NULL);
|
|
|
|
#endif
|
|
|
|
MENUITEM_SETTING(scroll_paginated, &global_settings.scroll_paginated, NULL);
|
|
|
|
|
2007-03-03 13:52:14 +00:00
|
|
|
MAKE_MENU(scroll_settings_menu, ID2P(LANG_SCROLL_MENU), 0, Icon_NOICON,
|
2007-02-17 14:02:48 +00:00
|
|
|
&scroll_speed, &scroll_delay,
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
&scroll_step,
|
|
|
|
#endif
|
|
|
|
&bidir_limit,
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
&remote_scroll_sets,
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
&offset_out_of_view, &screen_scroll_step,
|
|
|
|
#endif
|
2007-05-27 15:08:56 +00:00
|
|
|
&scroll_paginated,
|
2009-03-02 19:25:50 +00:00
|
|
|
#ifndef HAVE_WHEEL_ACCELERATION
|
2007-05-27 15:08:56 +00:00
|
|
|
&list_accel_start_delay, &list_accel_wait
|
2007-07-22 21:02:24 +00:00
|
|
|
#endif
|
2007-02-17 14:02:48 +00:00
|
|
|
);
|
|
|
|
/* SCROLL MENU */
|
|
|
|
/***********************************/
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* PEAK METER MENU */
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2008-05-03 08:35:14 +00:00
|
|
|
static int peakmeter_callback(int action,const struct menu_item_ex *this_item)
|
2007-02-17 14:02:48 +00:00
|
|
|
{
|
|
|
|
(void)this_item;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM:
|
|
|
|
peak_meter_init_times(global_settings.peak_meter_release,
|
|
|
|
global_settings.peak_meter_hold,
|
|
|
|
global_settings.peak_meter_clip_hold);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
2007-03-04 00:44:34 +00:00
|
|
|
MENUITEM_SETTING(peak_meter_hold,
|
|
|
|
&global_settings.peak_meter_hold, peakmeter_callback);
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(peak_meter_clip_hold,
|
|
|
|
&global_settings.peak_meter_clip_hold, peakmeter_callback);
|
2007-08-26 21:34:36 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
MENUITEM_SETTING(peak_meter_clipcounter,
|
2007-08-25 15:53:54 +00:00
|
|
|
&global_settings.peak_meter_clipcounter, NULL);
|
2007-08-26 21:34:36 +00:00
|
|
|
#endif
|
2007-02-17 14:02:48 +00:00
|
|
|
MENUITEM_SETTING(peak_meter_release,
|
|
|
|
&global_settings.peak_meter_release, peakmeter_callback);
|
|
|
|
/**
|
|
|
|
* Menu to select wether the scale of the meter
|
|
|
|
* displays dBfs of linear values.
|
|
|
|
*/
|
|
|
|
static int peak_meter_scale(void) {
|
|
|
|
bool retval = false;
|
|
|
|
bool use_dbfs = global_settings.peak_meter_dbfs;
|
|
|
|
retval = set_bool_options(str(LANG_PM_SCALE),
|
|
|
|
&use_dbfs,
|
|
|
|
STR(LANG_PM_DBFS), STR(LANG_PM_LINEAR),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* has the user really changed the scale? */
|
|
|
|
if (use_dbfs != global_settings.peak_meter_dbfs) {
|
|
|
|
|
|
|
|
/* store the change */
|
|
|
|
global_settings.peak_meter_dbfs = use_dbfs;
|
|
|
|
peak_meter_set_use_dbfs(use_dbfs);
|
|
|
|
|
|
|
|
/* If the user changed the scale mode the meaning of
|
|
|
|
peak_meter_min (peak_meter_max) has changed. Thus we have
|
|
|
|
to convert the values stored in global_settings. */
|
|
|
|
if (use_dbfs) {
|
|
|
|
|
|
|
|
/* we only store -dBfs */
|
|
|
|
global_settings.peak_meter_min = -peak_meter_get_min() / 100;
|
|
|
|
global_settings.peak_meter_max = -peak_meter_get_max() / 100;
|
2007-06-24 00:17:28 +00:00
|
|
|
|
|
|
|
/* limit the returned value to the allowed range */
|
|
|
|
if(global_settings.peak_meter_min > 89)
|
|
|
|
global_settings.peak_meter_min = 89;
|
2007-02-17 14:02:48 +00:00
|
|
|
} else {
|
|
|
|
int max;
|
|
|
|
|
|
|
|
/* linear percent */
|
|
|
|
global_settings.peak_meter_min = peak_meter_get_min();
|
|
|
|
|
|
|
|
/* converting dBfs -> percent results in a precision loss.
|
|
|
|
I assume that the user doesn't bother that conversion
|
|
|
|
dBfs <-> percent isn't symmetrical for odd values but that
|
|
|
|
he wants 0 dBfs == 100%. Thus I 'correct' the percent value
|
|
|
|
resulting from dBfs -> percent manually here */
|
|
|
|
max = peak_meter_get_max();
|
|
|
|
global_settings.peak_meter_max = max < 99 ? max : 100;
|
|
|
|
}
|
|
|
|
settings_apply_pm_range();
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adjust the min value of the value range that
|
|
|
|
* the peak meter shall visualize.
|
|
|
|
*/
|
|
|
|
static int peak_meter_min(void) {
|
|
|
|
bool retval = false;
|
|
|
|
if (global_settings.peak_meter_dbfs) {
|
|
|
|
|
|
|
|
/* for dBfs scale */
|
|
|
|
int range_max = -global_settings.peak_meter_max;
|
|
|
|
int min = -global_settings.peak_meter_min;
|
|
|
|
|
|
|
|
retval = set_int(str(LANG_PM_MIN), str(LANG_PM_DBFS), UNIT_DB,
|
|
|
|
&min, NULL, 1, -89, range_max, NULL);
|
|
|
|
|
|
|
|
global_settings.peak_meter_min = - min;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* for linear scale */
|
|
|
|
else {
|
|
|
|
int min = global_settings.peak_meter_min;
|
|
|
|
|
|
|
|
retval = set_int(str(LANG_PM_MIN), "%", UNIT_PERCENT,
|
|
|
|
&min, NULL,
|
|
|
|
1, 0, global_settings.peak_meter_max - 1, NULL);
|
|
|
|
|
|
|
|
global_settings.peak_meter_min = (unsigned char)min;
|
|
|
|
}
|
|
|
|
|
|
|
|
settings_apply_pm_range();
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adjust the max value of the value range that
|
|
|
|
* the peak meter shall visualize.
|
|
|
|
*/
|
|
|
|
static int peak_meter_max(void) {
|
|
|
|
bool retval = false;
|
|
|
|
if (global_settings.peak_meter_dbfs) {
|
|
|
|
|
|
|
|
/* for dBfs scale */
|
|
|
|
int range_min = -global_settings.peak_meter_min;
|
2009-03-04 18:15:06 +00:00
|
|
|
int max = -global_settings.peak_meter_max;
|
2007-02-17 14:02:48 +00:00
|
|
|
|
|
|
|
retval = set_int(str(LANG_PM_MAX), str(LANG_PM_DBFS), UNIT_DB,
|
|
|
|
&max, NULL, 1, range_min, 0, NULL);
|
|
|
|
|
|
|
|
global_settings.peak_meter_max = - max;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* for linear scale */
|
|
|
|
else {
|
|
|
|
int max = global_settings.peak_meter_max;
|
|
|
|
|
|
|
|
retval = set_int(str(LANG_PM_MAX), "%", UNIT_PERCENT,
|
|
|
|
&max, NULL,
|
|
|
|
1, global_settings.peak_meter_min + 1, 100, NULL);
|
|
|
|
|
|
|
|
global_settings.peak_meter_max = (unsigned char)max;
|
|
|
|
}
|
|
|
|
|
|
|
|
settings_apply_pm_range();
|
|
|
|
return retval;
|
|
|
|
}
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION(peak_meter_scale_item, 0, ID2P(LANG_PM_SCALE),
|
2007-03-18 07:03:43 +00:00
|
|
|
peak_meter_scale, NULL, NULL, Icon_NOICON);
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN),
|
2007-03-18 07:03:43 +00:00
|
|
|
peak_meter_min, NULL, NULL, Icon_NOICON);
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION(peak_meter_max_item, 0, ID2P(LANG_PM_MAX),
|
2007-03-18 07:03:43 +00:00
|
|
|
peak_meter_max, NULL, NULL, Icon_NOICON);
|
2007-03-04 00:44:34 +00:00
|
|
|
MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON,
|
|
|
|
&peak_meter_release, &peak_meter_hold,
|
2007-08-26 21:34:36 +00:00
|
|
|
&peak_meter_clip_hold,
|
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
&peak_meter_clipcounter,
|
|
|
|
#endif
|
2007-02-17 14:02:48 +00:00
|
|
|
&peak_meter_scale_item, &peak_meter_min_item, &peak_meter_max_item);
|
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
|
|
|
/* PEAK METER MENU */
|
|
|
|
/***********************************/
|
|
|
|
|
|
|
|
|
2009-06-16 17:04:47 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
static int touch_mode_callback(int action,const struct menu_item_ex *this_item)
|
|
|
|
{
|
|
|
|
(void)this_item;
|
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case ACTION_EXIT_MENUITEM: /* on exit */
|
|
|
|
touchscreen_set_mode(global_settings.touch_mode);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return action;
|
|
|
|
}
|
|
|
|
MENUITEM_SETTING(touch_mode, &global_settings.touch_mode, touch_mode_callback);
|
|
|
|
|
|
|
|
MENUITEM_FUNCTION(touchscreen_menu_calibrate, 0, ID2P(LANG_TOUCHSCREEN_CALIBRATE), calibrate,
|
|
|
|
NULL, NULL, Icon_NOICON);
|
|
|
|
MENUITEM_FUNCTION(touchscreen_menu_reset_calibration, 0, ID2P(LANG_TOUCHSCREEN_RESET_CALIBRATION), reset_mapping,
|
|
|
|
NULL, NULL, Icon_NOICON);
|
|
|
|
|
|
|
|
MAKE_MENU(touchscreen_menu, ID2P(LANG_TOUCHSCREEN_SETTINGS), NULL, Icon_NOICON, &touch_mode,
|
|
|
|
&touchscreen_menu_calibrate, &touchscreen_menu_reset_calibration);
|
|
|
|
#endif
|
|
|
|
|
2007-02-17 14:02:48 +00:00
|
|
|
|
|
|
|
MENUITEM_SETTING(codepage_setting, &global_settings.default_codepage, NULL);
|
|
|
|
|
2007-02-08 04:33:41 +00:00
|
|
|
|
2007-02-17 14:02:48 +00:00
|
|
|
MAKE_MENU(display_menu, ID2P(LANG_DISPLAY),
|
2007-03-03 13:52:14 +00:00
|
|
|
NULL, Icon_Display_menu,
|
2007-02-17 14:02:48 +00:00
|
|
|
&lcd_settings,
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
&lcd_remote_settings,
|
|
|
|
#endif
|
2007-10-06 11:47:41 +00:00
|
|
|
&scroll_settings_menu,
|
2007-02-17 14:02:48 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2009-08-24 00:22:54 +00:00
|
|
|
&peak_meter_menu,
|
2007-02-17 14:02:48 +00:00
|
|
|
#endif
|
|
|
|
&codepage_setting,
|
2009-06-16 17:04:47 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
&touchscreen_menu,
|
|
|
|
#endif
|
2007-02-17 14:02:48 +00:00
|
|
|
);
|