2007-01-23 13:40:44 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2007-02-13 00:32:17 +00:00
|
|
|
* $Id$
|
2007-01-23 13:40:44 +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-01-23 13:40:44 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef __SETTINGSLIST_H
|
|
|
|
#define __SETTINGSLIST_H
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include "inttypes.h"
|
|
|
|
|
2007-01-24 03:14:07 +00:00
|
|
|
typedef int (*_isfunc_type)(void);
|
|
|
|
|
2007-01-23 13:40:44 +00:00
|
|
|
union storage_type {
|
|
|
|
int int_;
|
|
|
|
unsigned int uint_;
|
|
|
|
bool bool_;
|
|
|
|
char *charptr;
|
|
|
|
unsigned char *ucharptr;
|
2007-01-24 03:14:07 +00:00
|
|
|
_isfunc_type func;
|
2008-11-03 10:43:37 +00:00
|
|
|
void* custom;
|
2007-01-23 13:40:44 +00:00
|
|
|
};
|
|
|
|
/* the variable type for the setting */
|
|
|
|
#define F_T_INT 1
|
|
|
|
#define F_T_UINT 2
|
|
|
|
#define F_T_BOOL 3
|
|
|
|
#define F_T_CHARPTR 4
|
|
|
|
#define F_T_UCHARPTR 5
|
2008-11-03 10:43:37 +00:00
|
|
|
#define F_T_CUSTOM 6 /* MUST use struct custom_setting below */
|
2007-01-23 13:40:44 +00:00
|
|
|
#define F_T_MASK 0x7
|
|
|
|
|
|
|
|
struct sound_setting {
|
|
|
|
int setting; /* from the enum in firmware/sound.h */
|
|
|
|
};
|
|
|
|
#define F_T_SOUND 0x8 /* this variable uses the set_sound stuff, \
|
|
|
|
| with one of the above types (usually F_T_INT) \
|
|
|
|
These settings get the default from sound_default(setting); */
|
|
|
|
struct bool_setting {
|
|
|
|
void (*option_callback)(bool);
|
|
|
|
int lang_yes;
|
|
|
|
int lang_no;
|
|
|
|
};
|
2007-02-08 04:33:41 +00:00
|
|
|
#define F_BOOL_SETTING (F_T_BOOL|0x10)
|
2007-01-23 13:40:44 +00:00
|
|
|
#define F_RGB 0x20
|
|
|
|
|
2007-01-24 03:14:07 +00:00
|
|
|
struct filename_setting {
|
|
|
|
const char* prefix;
|
|
|
|
const char* suffix;
|
|
|
|
int max_len;
|
|
|
|
};
|
|
|
|
#define F_FILENAME 0x40
|
|
|
|
|
2007-01-23 13:40:44 +00:00
|
|
|
struct int_setting {
|
2007-02-08 10:28:42 +00:00
|
|
|
void (*option_callback)(int);
|
2022-11-14 02:32:59 +00:00
|
|
|
int16_t unit;
|
|
|
|
int16_t step;
|
2007-02-08 10:28:42 +00:00
|
|
|
int min;
|
|
|
|
int max;
|
2022-11-14 02:32:59 +00:00
|
|
|
|
2009-08-20 16:47:44 +00:00
|
|
|
const char* (*formatter)(char*, size_t, int, const char*);
|
2007-11-26 23:10:20 +00:00
|
|
|
int32_t (*get_talk_id)(int, int);
|
2007-01-23 13:40:44 +00:00
|
|
|
};
|
2007-02-08 04:33:41 +00:00
|
|
|
#define F_INT_SETTING 0x80
|
|
|
|
|
|
|
|
struct choice_setting {
|
2007-02-08 10:28:42 +00:00
|
|
|
void (*option_callback)(int);
|
|
|
|
int count;
|
|
|
|
union {
|
2007-11-25 17:36:21 +00:00
|
|
|
const unsigned char **desc;
|
|
|
|
const int *talks;
|
2007-02-08 10:28:42 +00:00
|
|
|
};
|
2007-02-08 04:33:41 +00:00
|
|
|
};
|
|
|
|
#define F_CHOICE_SETTING 0x100
|
2007-02-08 10:28:42 +00:00
|
|
|
#define F_CHOICETALKS 0x200 /* uses .talks in the above struct for the talks */
|
|
|
|
/* and cfg_vals for the strings to display */
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
|
2007-11-25 17:36:21 +00:00
|
|
|
struct table_setting {
|
|
|
|
void (*option_callback)(int);
|
2009-08-20 16:47:44 +00:00
|
|
|
const char* (*formatter)(char*, size_t, int, const char*);
|
2007-11-26 23:10:20 +00:00
|
|
|
int32_t (*get_talk_id)(int, int);
|
2007-11-25 17:36:21 +00:00
|
|
|
int unit;
|
|
|
|
int count;
|
|
|
|
const int * values;
|
|
|
|
};
|
|
|
|
#define F_TABLE_SETTING 0x2000
|
|
|
|
#define F_ALLOW_ARBITRARY_VALS 0x4000
|
2020-08-01 02:45:10 +00:00
|
|
|
#define F_CB_ON_SELECT_ONLY 0x20000
|
2007-01-24 03:14:07 +00:00
|
|
|
/* these use the _isfunc_type type for the function */
|
|
|
|
/* typedef int (*_isfunc_type)(void); */
|
|
|
|
#define F_MIN_ISFUNC 0x100000 /* min(above) is function pointer to above type */
|
|
|
|
#define F_MAX_ISFUNC 0x200000 /* max(above) is function pointer to above type */
|
|
|
|
#define F_DEF_ISFUNC 0x400000 /* default_val is function pointer to above type */
|
|
|
|
|
2008-11-03 10:43:37 +00:00
|
|
|
/* The next stuff is used when none of the other types work.
|
|
|
|
Should really only be used if the value you want to store in global_settings
|
|
|
|
is very different to the string you want to use in the config. */
|
|
|
|
#define F_CUSTOM_SETTING 0x8000
|
|
|
|
struct custom_setting {
|
|
|
|
/* load the saved value from the .cfg
|
|
|
|
setting: pointer into global_settings
|
Selective Backlight/Advanced Softlock - Selective actions based on context
Selective backlight allows the user to choose actions that will not
enable the backlight when pressed.
Advanced softlock allows user to choose actions that will not be
blocked by screenlock on devices without a hold button.
Both only occur in FM and WPS Contexts.
Update:
Back from the dead
-Cleaned up code, removed unnecessary calls, re-arranged last filter action
timeout conditional to work in case last_filtered_action_tick was never set
-Added entries to the manual
-Fixed back button on some menus not activating backlight
-Made menus more intuitive, no actions selected now changes menu item to off.
-Added talk fuctionality.
-Added option to disable selective backlight while on external power.
-Rewrote backlight and softlock handling code to fix issue with scrollwheels
-Menu changed to have toggle(yes/no) and settings
-Optimized selective actions lookup
-Added option to disable notification of 'buttons locked' while softlocked
-Removed uneeded code, consolidated action lookup to single function
-Fixed incorrect name on selective softlock menu
-Added option to disable touch on touchscreen devices
-Fixed backlight on original screenlock without selective screenlock active
-Added text selection in mask_select for when show_icons is off
-Fixed voice in mask_select to speak if voice is defined instead of spelling
-Added more lang defines (play skip seek)
-Added option to disable unknown keys turning on backlight
-Fixed Conditional argument In wrong place causing players without
backlight to fail to build
-Fixed Disable Unknown blocking detection of context change
-Fixed canceling menu didn't update new settings
-Added Autolock on backlight off
-Removed backlight_on_force from backlight.c, Now sets ignore next to false
and uses backlight_on
-Cleaned up autolock code added strings to lang file
-Fixed issue where rapid presses would bypass softlock
-Removed old softlock code, Cleaned selective actions code
-Changed menu to match existing RB menus
-Fixed Backlight_on_Hold blocked by backlight_ignore_next
-Fixed ignore_next for ipod
-Fixed bug allowing context with softlock to bypass selective backlight
-Changed mask_select to no longer prompt for changes to be saved
-Changed menu names
-Added ignore timeout to allow ipod scroll wheel to work properly and other
players to still work properly, removed some previous code including
ignore_event
-Increased ignore timeout to prevent sd card accesses from interrupting action
code and turning on backlight
-Changed Unknown action to unmapped action in menu, changed handling code
-Removed unneeded logic and variables for handling unfiltered actions
-Reverted unmapped action code to previous functionality
-Added manual entries (thanks JohnB)
-Removed elusive unhandled unicode character from manual, changed formatting slightly
Actions:
Volume,Play,Seek,Skip
Extras:
Disable unmapped actions
Disable selective backlight on external power
Disable touch during softlock on touchscreen devices
Disable softlock notifications (power button still notifies)
Autolock on backlight off
Method:
Adds a function to ignore backlight on next call
If selected action occurs backlight is forced on,
Filter_first_keypress stays intact.
Selective softlock allows selected actions through, bypasses the normal
softlock routine.
ToDo:
DONE
previous commit (#1) has attribution for folder_select.c which mask_select
is based from.
Change-Id: I08132ddcfd64c81751ef23b720f3ec6d68695fe4
2016-11-22 05:21:31 +00:00
|
|
|
value: the text from the .cfg
|
2008-11-03 10:43:37 +00:00
|
|
|
*/
|
|
|
|
void (*load_from_cfg)(void* setting, char*value);
|
|
|
|
/* store the value into a .cfg
|
|
|
|
setting: pointer into global_settings
|
|
|
|
buf/buf_len: buffer and length to write the string into.
|
|
|
|
Returns the string.
|
|
|
|
*/
|
|
|
|
char* (*write_to_cfg)(void* setting, char*buf, int buf_len);
|
|
|
|
/* Check if the setting has been changed from the default.
|
|
|
|
setting: pointer into global_settings
|
|
|
|
defaultval: the value given in the settings_list.c macro
|
|
|
|
Return true if the setting was changed
|
|
|
|
*/
|
|
|
|
bool (*is_changed)(void* setting, void* defaultval);
|
|
|
|
/* Set the setting back to its default value.
|
|
|
|
setting: pointer into global_settings
|
|
|
|
defaultval: the value given in the settings_list.c macro
|
|
|
|
*/
|
|
|
|
void (*set_default)(void* setting, void* defaultval);
|
|
|
|
};
|
|
|
|
|
Auto-Ranging Time Formatting For Menus (hh:mm:ss:mss)
Unifies time formatting in settings_list.c allows time format to
display as HH:MM:SS.MSS or any consecutive combination thereof
(hh:mm:ss, mm:ss, mm:ss.mss, ss.mss, hh, mm, ss ,mss)
works in INT and TABLE settings with the addition of flag 'F_TIME_SETTING'
Time is auto-ranged dependent on value
Adds talk_time_intervals to allow time values to be spoken similar to
display format: x Hours, x Minutes, x Seconds, x Milliseconds
Table lookups merged or removed from recording, clip meter and lcd timeout
-String_Choice replaced with TABLE_SETTING or INT_SETTING for these
functions as well, cleaned-up cfg_vals that get saved to cfgfile
RTL Languages ARE supported
Negative values ARE supported
Backlight on/off are now Always and Never to share formatter with LCD
Timeout
Added flag to allow ranged units to be locked to a minimum index
Added flag to allow leading zero to be supressed from the largest unit
merged talk_time_unit() and talk_time_intervals()
optimized time_split()
optimized format_time_auto()
Backlight time-out list same as original
Change-Id: I59027c62d3f2956bd16fdcc1a48b2ac32c084abd
2018-12-18 04:27:55 +00:00
|
|
|
#define F_TIME_SETTING 0x10000 /* int,table format hh:mm:ss.mss auto ranged */
|
2007-05-29 04:39:11 +00:00
|
|
|
#define F_THEMESETTING 0x0800000
|
|
|
|
#define F_RECSETTING 0x1000000
|
2007-12-07 10:59:07 +00:00
|
|
|
#define F_EQSETTING 0x2000000
|
2007-12-24 22:35:31 +00:00
|
|
|
#define F_SOUNDSETTING 0x4000000
|
2007-02-08 04:33:41 +00:00
|
|
|
|
2007-11-25 17:36:21 +00:00
|
|
|
#define F_NVRAM_BYTES_MASK 0xE0000 /*0-4 bytes can be stored */
|
|
|
|
#define F_NVRAM_MASK_SHIFT 17
|
2013-07-14 11:59:39 +00:00
|
|
|
#define NVRAM_CONFIG_VERSION 8
|
2007-01-23 13:40:44 +00:00
|
|
|
/* Above define should be bumped if
|
|
|
|
- a new NVRAM setting is added between 2 other NVRAM settings
|
|
|
|
- number of bytes for a NVRAM setting is changed
|
|
|
|
- a NVRAM setting is removed
|
|
|
|
*/
|
2007-09-15 17:29:15 +00:00
|
|
|
#define F_TEMPVAR 0x0400 /* used if the setting should be set using a temp var */
|
2007-11-05 13:15:35 +00:00
|
|
|
#define F_PADTITLE 0x800 /* pad the title with spaces to force it to scroll */
|
2007-09-15 17:29:15 +00:00
|
|
|
#define F_NO_WRAP 0x1000 /* used if the list should not wrap */
|
2007-01-24 03:14:07 +00:00
|
|
|
|
2013-02-05 12:20:17 +00:00
|
|
|
#define F_BANFROMQS 0x80000000 /* ban the setting from the quickscreen items */
|
|
|
|
#define F_DEPRECATED 0x40000000 /* DEPRECATED setting, don't write to .cfg */
|
2007-01-23 13:40:44 +00:00
|
|
|
struct settings_list {
|
2013-02-05 12:20:17 +00:00
|
|
|
uint32_t flags; /* BD__ _SER TFFF NNN_ _ATW PTVC IFRB STTT */
|
2007-01-23 13:40:44 +00:00
|
|
|
void *setting;
|
2007-01-26 05:45:06 +00:00
|
|
|
int lang_id; /* -1 for none */
|
2007-01-23 13:40:44 +00:00
|
|
|
union storage_type default_val;
|
|
|
|
const char *cfg_name; /* this settings name in the cfg file */
|
2022-11-30 01:32:19 +00:00
|
|
|
const char *cfg_vals; /* comma seperated symbolic values for bool
|
|
|
|
* or choice/table settings -- the i'th value
|
|
|
|
* maps to the integer i */
|
2007-01-23 13:40:44 +00:00
|
|
|
union {
|
2007-11-25 17:36:21 +00:00
|
|
|
const void *RESERVED; /* to stop compile errors, will be removed */
|
|
|
|
const struct sound_setting *sound_setting; /* use F_T_SOUND for this */
|
|
|
|
const struct bool_setting *bool_setting; /* F_BOOL_SETTING */
|
|
|
|
const struct filename_setting *filename_setting; /* use F_FILENAME */
|
|
|
|
const struct int_setting *int_setting; /* use F_INT_SETTING */
|
|
|
|
const struct choice_setting *choice_setting; /* F_CHOICE_SETTING */
|
|
|
|
const struct table_setting *table_setting; /* F_TABLE_SETTING */
|
2008-11-03 10:43:37 +00:00
|
|
|
const struct custom_setting *custom_setting; /* F_CUSTOM_SETTING */
|
2007-01-23 13:40:44 +00:00
|
|
|
};
|
|
|
|
};
|
2008-10-26 11:44:21 +00:00
|
|
|
const struct settings_list* get_settings_list(int*count);
|
2007-01-23 13:40:44 +00:00
|
|
|
#ifndef PLUGIN
|
|
|
|
/* not needed for plugins and just causes compile error,
|
|
|
|
possibly fix proberly later */
|
|
|
|
extern const struct settings_list settings[];
|
|
|
|
extern const int nb_settings;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|