summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/SOURCES3
-rw-r--r--apps/action.c466
-rw-r--r--apps/action.h102
-rw-r--r--apps/gui/mask_select.c287
-rw-r--r--apps/gui/mask_select.h41
-rw-r--r--apps/lang/english.lang168
-rw-r--r--apps/menus/display_menu.c123
-rw-r--r--apps/menus/settings_menu.c83
-rw-r--r--apps/settings.c40
-rw-r--r--apps/settings.h13
-rw-r--r--apps/settings_list.c69
-rw-r--r--apps/settings_list.h4
12 files changed, 1220 insertions, 179 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index faf7247fcc..521b920f69 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -95,6 +95,9 @@ gui/pitchscreen.c
gui/quickscreen.c
#endif
gui/folder_select.c
+#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
+gui/mask_select.c
+#endif
gui/wps.c
gui/scrollbar.c
diff --git a/apps/action.c b/apps/action.c
index eae00f5d18..d153bc6140 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -42,6 +42,16 @@
#include "statusbar-skinned.h"
#endif
+#ifdef HAVE_BACKLIGHT
+#include "backlight.h"
+#if CONFIG_CHARGING
+#include "power.h"
+#endif
+#endif /* HAVE_BACKLIGHT */
+
+#define LOGF_ENABLE
+#include "logf.h"
+
static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to
work on startup */
static intptr_t last_data = 0;
@@ -56,19 +66,34 @@ static bool short_press = false;
#define REPEAT_WINDOW_TICKS HZ/4
static int last_action_tick = 0;
+#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
+static inline bool is_action_normal(int action);
+static inline bool mask_has_flag(unsigned int mask, unsigned int flag);
+static inline bool is_action_completed(int button);
+#define LAST_FILTER_TICKS HZ/2 /* timeout between filtered actions */
+#endif /* defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) */
+
+#ifdef HAVE_BACKLIGHT
+static unsigned int backlight_mask = SEL_ACTION_NONE;
+static int do_backlight(int action, int context, bool is_pre_btn);
+static void handle_backlight(bool backlight, bool ignore_next);
+#endif /* HAVE_BACKLIGHT */
+
/* software keylock stuff */
#ifndef HAS_BUTTON_HOLD
static bool keys_locked = false;
-static int unlock_combo = BUTTON_NONE;
static bool screen_has_lock = false;
+static unsigned int softlock_mask = SEL_ACTION_NONE;
+static inline int do_softlock_unlock_combo(int button, int context);
+static int do_softlock(int button, int action, int context, bool is_pre_btn);
#endif /* HAVE_SOFTWARE_KEYLOCK */
-
/*
* do_button_check is the worker function for get_default_action.
* returns ACTION_UNKNOWN or the requested return value from the list.
+ * BE AWARE is_pre_button can miss pre buttons if a match is found first.
*/
-static inline int do_button_check(const struct button_mapping *items,
- int button, int last_button, int *start)
+static inline int do_button_check(const struct button_mapping *items,int button,
+ int last_button, int *start, bool *prebtn)
{
int i = 0;
int ret = ACTION_UNKNOWN;
@@ -88,6 +113,8 @@ static inline int do_button_check(const struct button_mapping *items,
break;
}
}
+ else if (items[i].pre_button_code & button)
+ *prebtn = true; /* determine if this could be another action */
i++;
}
*start = i;
@@ -164,7 +191,7 @@ static inline int get_next_context(const struct button_mapping *items, int i)
static void gui_boost(bool want_to_boost)
{
static bool boosted = false;
-
+
if (want_to_boost && !boosted)
{
cpu_boost(true);
@@ -177,7 +204,7 @@ static void gui_boost(bool want_to_boost)
}
}
-/* gui_unboost_callback() is called GUI_BOOST_TIMEOUT seconds after the
+/* gui_unboost_callback() is called GUI_BOOST_TIMEOUT seconds after the
* last wheel scrolling event. */
static int gui_unboost_callback(struct timeout *tmo)
{
@@ -188,8 +215,8 @@ static int gui_unboost_callback(struct timeout *tmo)
#endif
/*
- * int get_action_worker(int context, struct button_mapping *user_mappings,
- int timeout)
+ * int get_action_worker(int context, int timeout, bool *is_pre_button,
+ struct button_mapping *user_mappings)
This function searches the button list for the given context for the just
pressed button.
If there is a match it returns the value from the list.
@@ -197,12 +224,14 @@ static int gui_unboost_callback(struct timeout *tmo)
the last item in the list "points" to the next context in a chain
so the "chain" is followed until the button is found.
putting ACTION_NONE will get CONTEXT_STD which is always the last list checked.
-
+ BE AWARE is_pre_button can miss pre buttons if a match is found first.
+ it is more for actions that are not yet completed in the desired context
+ but are defined in a lower 'chained' context.
Timeout can be TIMEOUT_NOBLOCK to return immediatly
TIMEOUT_BLOCK to wait for a button press
Any number >0 to wait that many ticks for a press
*/
-static int get_action_worker(int context, int timeout,
+static int get_action_worker(int context, int timeout, bool *is_pre_button,
const struct button_mapping* (*get_context_map)(int) )
{
const struct button_mapping *items = NULL;
@@ -210,7 +239,7 @@ static int get_action_worker(int context, int timeout,
int i=0;
int ret = ACTION_UNKNOWN;
static int last_context = CONTEXT_STD;
-
+
send_event(GUI_EVENT_ACTIONUPDATE, NULL);
if (timeout == TIMEOUT_NOBLOCK)
@@ -222,7 +251,7 @@ static int get_action_worker(int context, int timeout,
#if defined(HAVE_GUI_BOOST) && defined(HAVE_ADJUSTABLE_CPU_FREQ)
static struct timeout gui_unboost;
- /* Boost the CPU in case of wheel scrolling activity in the defined contexts.
+ /* Boost the CPU in case of wheel scrolling activity in the defined contexts.
* Call unboost with a timeout of GUI_BOOST_TIMEOUT. */
if (button != BUTTON_NONE)
{
@@ -270,7 +299,7 @@ static int get_action_worker(int context, int timeout,
}
return ACTION_NONE;
}
-
+
if ((context != last_context) && ((last_button & BUTTON_REL) == 0)
#ifdef HAVE_SCROLLWHEEL
/* Scrollwheel doesn't generate release events */
@@ -288,39 +317,24 @@ static int get_action_worker(int context, int timeout,
return ACTION_NONE; /* "safest" return value */
}
last_context = context;
+
#ifndef HAS_BUTTON_HOLD
screen_has_lock = ((context & ALLOW_SOFTLOCK) == ALLOW_SOFTLOCK);
+ context &= ~ALLOW_SOFTLOCK;
if (is_keys_locked())
{
- if (button == unlock_combo)
- {
- last_button = BUTTON_NONE;
- keys_locked = false;
-#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
- /* enable back touch device */
- button_enable_touch(true);
-#endif
- splash(HZ/2, str(LANG_KEYLOCK_OFF));
- return ACTION_REDRAW;
- }
- else
-#if (BUTTON_REMOTE != 0)
- if ((button & BUTTON_REMOTE) == 0)
-#endif
- {
- if ((button & BUTTON_REL))
- splash(HZ/2, str(LANG_KEYLOCK_ON));
- return ACTION_REDRAW;
- }
+ ret = do_softlock_unlock_combo(button, context);
+ if (!is_keys_locked())
+ return ret;
}
#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
- else
+ else if (!mask_has_flag(softlock_mask, SEL_ACTION_NOTOUCH))
{
/* make sure touchpad get reactivated if we quit the screen */
button_enable_touch(true);
}
#endif
- context &= ~ALLOW_SOFTLOCK;
+
#endif /* HAS_BUTTON_HOLD */
#ifdef HAVE_TOUCHSCREEN
@@ -348,6 +362,7 @@ static int get_action_worker(int context, int timeout,
#endif
/* logf("%x,%x",last_button,button); */
+ *is_pre_button = false; /* could the button be another actions pre_button */
while (1)
{
/* logf("context = %x",context); */
@@ -363,7 +378,7 @@ static int get_action_worker(int context, int timeout,
if (items == NULL)
break;
- ret = do_button_check(items,button,last_button,&i);
+ ret = do_button_check(items, button, last_button, &i, is_pre_button);
if (ret == ACTION_UNKNOWN)
{
@@ -375,24 +390,13 @@ static int get_action_worker(int context, int timeout,
continue;
}
}
-
/* Action was found or STOPSEARCHING was specified */
break;
}
/* DEBUGF("ret = %x\n",ret); */
#ifndef HAS_BUTTON_HOLD
- if (screen_has_lock && (ret == ACTION_STD_KEYLOCK))
- {
- unlock_combo = button;
- keys_locked = true;
- splash(HZ/2, str(LANG_KEYLOCK_ON));
- #if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
- /* disable touch device on keylock */
- button_enable_touch(false);
- #endif
- button_clear_queue();
- return ACTION_REDRAW;
- }
+ if(screen_has_lock && is_action_normal(ret))
+ ret = do_softlock(button, ret, last_context & ~ALLOW_SOFTLOCK, is_pre_button);
#endif
if ((current_tick - last_action_tick < REPEAT_WINDOW_TICKS)
&& (ret == last_action))
@@ -411,42 +415,46 @@ static int get_action_worker(int context, int timeout,
#endif
return ret;
-}
+}/* get_action_worker */
int get_action(int context, int timeout)
{
- int button = get_action_worker(context,timeout,NULL);
+ bool is_pre_button = false;
+ int button = get_action_worker(context, timeout, &is_pre_button, NULL);
+
#ifdef HAVE_TOUCHSCREEN
if (button == ACTION_TOUCHSCREEN)
button = sb_touch_to_button(context);
#endif
+
+#ifdef HAVE_BACKLIGHT
+ if (mask_has_flag(backlight_mask, SEL_ACTION_ENABLED) &&
+ is_action_normal(button))
+ button = do_backlight(button, context & ~ALLOW_SOFTLOCK, is_pre_button);
+#endif
+
return button;
}
int get_custom_action(int context,int timeout,
const struct button_mapping* (*get_context_map)(int))
{
- return get_action_worker(context,timeout,get_context_map);
+ bool is_pre_button = false;
+ return get_action_worker(context,timeout, &is_pre_button, get_context_map);
}
bool action_userabort(int timeout)
{
- int action = get_action_worker(CONTEXT_STD,timeout,NULL);
+ bool is_pre_button = false;
+ int action = get_action_worker(CONTEXT_STD,timeout, &is_pre_button, NULL);
bool ret = (action == ACTION_STD_CANCEL);
- if(!ret)
+ if (!ret)
{
default_event_handler(action);
}
return ret;
}
-#ifndef HAS_BUTTON_HOLD
-bool is_keys_locked(void)
-{
- return (screen_has_lock && keys_locked);
-}
-#endif
-
intptr_t get_action_data(void)
{
return last_data;
@@ -532,4 +540,338 @@ void action_wait_for_release(void)
{
wait_for_release = true;
}
-
+
+#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
+/* HELPER FUNCTIONS
+* Selective softlock and backlight use this lookup based on mask to decide
+* which actions are filtered, or could be filtered but not currently set.
+* returns false if the action isn't found, true if the action is found
+*/
+static bool is_action_filtered(int action, unsigned int mask, int context)
+{
+ bool match = false;
+
+ switch (action)
+ {
+ case ACTION_NONE:
+ break;
+/*Actions that are not mapped will not turn on the backlight option NOUNMAPPED*/
+ case ACTION_UNKNOWN:
+ match = mask_has_flag(mask, SEL_ACTION_NOUNMAPPED);
+ break;
+ case ACTION_WPS_PLAY:
+ case ACTION_FM_PLAY:
+ match = mask_has_flag(mask, SEL_ACTION_PLAY);
+ break;
+ case ACTION_STD_PREVREPEAT:
+ case ACTION_STD_NEXTREPEAT:
+ case ACTION_WPS_SEEKBACK:
+ case ACTION_WPS_SEEKFWD:
+ case ACTION_WPS_STOPSEEK:
+ match = mask_has_flag(mask, SEL_ACTION_SEEK);
+ break;
+ case ACTION_STD_PREV:
+ case ACTION_STD_NEXT:
+ case ACTION_WPS_SKIPNEXT:
+ case ACTION_WPS_SKIPPREV:
+ case ACTION_FM_NEXT_PRESET:
+ case ACTION_FM_PREV_PRESET:
+ match = mask_has_flag(mask, SEL_ACTION_SKIP);
+ break;
+ case ACTION_WPS_VOLUP:
+ case ACTION_WPS_VOLDOWN:
+ match = mask_has_flag(mask, SEL_ACTION_VOL);
+ break;
+ case ACTION_SETTINGS_INC:/*FMS*/
+ case ACTION_SETTINGS_INCREPEAT:/*FMS*/
+ case ACTION_SETTINGS_DEC:/*FMS*/
+ case ACTION_SETTINGS_DECREPEAT:/*FMS*/
+ match = (context == CONTEXT_FM) && mask_has_flag(mask, SEL_ACTION_VOL);
+ break;
+ default:
+ /* display action code of unfiltered actions */
+ logf ("unfiltered actions: context: %d action: %d, last btn: %d, \
+ mask: %d", context, action, last_button, mask);
+ break;
+ }/*switch*/
+
+ return match;
+}
+/* compares mask to a flag return true if set false otherwise*/
+static inline bool mask_has_flag(unsigned int mask, unsigned int flag)
+{
+ return ((mask & flag) != 0);
+}
+/* returns true if the supplied context is to be filtered by selective BL/SL*/
+static inline bool is_context_filtered(int context)
+{
+ return (context == CONTEXT_FM || context == CONTEXT_WPS);
+}
+/* returns true if action can be passed on to selective backlight/softlock */
+static inline bool is_action_normal(int action)
+{
+ return (action != ACTION_REDRAW && (action & SYS_EVENT) == 0);
+}
+/*returns true if Button & released, repeated; or won't generate those events*/
+static inline bool is_action_completed(int button)
+{
+ return ((button & (BUTTON_REPEAT | BUTTON_REL)) != 0
+#ifdef HAVE_SCROLLWHEEL
+ /* Scrollwheel doesn't generate release events */
+ || (button & (BUTTON_SCROLL_BACK | BUTTON_SCROLL_FWD)) != 0
+#endif
+ );
+}
+
+/* most every action takes two rounds through get_action_worker,
+ * once for the keypress and once for the key release,
+ * actions with pre_button codes take even more, some actions however, only
+ * take once; actions defined with only a button and no release/repeat event,
+ * these actions should be acted upon immediately except when we have
+ * selective backlighting/softlock enabled and in this case we only act upon
+ * them immediately if there is no chance they have another event tied to them
+ * determined using is_pre_button and is_action_completed()
+ *returns true if event was not filtered and false if it was
+*/
+static bool is_action_unfiltered(int action,int button, bool is_pre_button,
+ bool filtered, int *tick)
+{
+ bool ret = false;
+ /*directly after a match a key release event may trigger another*/
+ if (filtered && action != ACTION_UNKNOWN)
+ *tick = current_tick + LAST_FILTER_TICKS;
+ /* has button been rel/rep or is this the only action it could be */
+ if (is_action_completed(button) || !is_pre_button)
+ {
+ /* reset last action , if the action is not filtered and
+ this isn't just a key release event then return true */
+ if (!filtered && *tick < current_tick)
+ {
+ *tick = 0;
+ ret = true;
+ }
+ }/*is_action_completed() || !is_pre_button*/
+ return ret;
+}
+#endif /*defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) HELPER FUNCTIONS*/
+
+#ifdef HAVE_BACKLIGHT
+static void handle_backlight(bool backlight, bool ignore_next)
+{
+ if (backlight)
+ {
+ backlight_on_ignore(false, 0);
+ backlight_on();
+#ifdef HAVE_BUTTON_LIGHT
+ buttonlight_on_ignore(false, 0);
+ buttonlight_on();
+ }
+ buttonlight_on_ignore(ignore_next, 5*HZ);/* as a precautionary fallback */
+#else
+ }
+#endif
+ backlight_on_ignore(ignore_next, 5*HZ);/*must be set everytime we handle bl*/
+}
+
+ /* Need to look up actions before we can decide to turn on backlight, if
+ * selective backlighting is true filter first keypress events need to be
+ * taken into account as well
+ */
+static int do_backlight(int action, int context, bool is_pre_btn)
+{
+ static int last_filtered_tick = 0;
+
+ bool bl_is_active = is_backlight_on(false);
+ bool bl_activate = false;
+ bool filtered;
+
+#if CONFIG_CHARGING /* disable if on external power */
+ if (!bl_is_active && is_context_filtered(context) &&
+ !(mask_has_flag(backlight_mask, SEL_ACTION_NOEXT) && power_input_present()))
+#else /* skip if backlight is on or incorrect context */
+ if (!bl_is_active && is_context_filtered(context))
+#endif
+ {
+ filtered = is_action_filtered(action, backlight_mask, context);
+ bl_activate = is_action_unfiltered(action, last_button, is_pre_btn,
+ filtered, &last_filtered_tick);
+ }/*is_context_filtered(context)*/
+ else
+ bl_activate = true;
+
+ if (action != ACTION_NONE && bl_activate)
+ {
+ handle_backlight(true, true);
+
+ if (mask_has_flag(backlight_mask, SEL_ACTION_FFKEYPRESS) && !bl_is_active)
+ {
+ action = ACTION_NONE;
+ last_button = BUTTON_NONE;
+ }
+ }
+ else
+ handle_backlight(false, true);/* set ignore next true */
+
+ return action;
+}
+
+/* Enable selected actions to leave the backlight off */
+void set_selective_backlight_actions(bool selective, unsigned int mask,
+ bool filter_fkp)
+{
+ handle_backlight(true, selective);
+ if (selective) /* we will handle filter_first_keypress here so turn it off*/
+ {
+ set_backlight_filter_keypress(false);/* turnoff ffkp in button.c */
+ backlight_mask = mask | SEL_ACTION_ENABLED;
+ if(filter_fkp)
+ backlight_mask |= SEL_ACTION_FFKEYPRESS;
+ }
+ else
+ {
+ set_backlight_filter_keypress(filter_fkp);
+ backlight_mask = SEL_ACTION_NONE;
+ }
+}
+#endif /* HAVE_BACKLIGHT */
+
+#ifndef HAS_BUTTON_HOLD
+bool is_keys_locked(void)
+{
+ return (screen_has_lock && keys_locked);
+}
+
+static inline void do_key_lock(bool lock)
+{
+ keys_locked = lock;
+ last_button = BUTTON_NONE;
+ button_clear_queue();
+#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
+ /* disable touch device on keylock if std behavior or selected disable touch */
+ if (!mask_has_flag(softlock_mask, SEL_ACTION_ENABLED) ||
+ mask_has_flag(softlock_mask, SEL_ACTION_NOTOUCH))
+ button_enable_touch(!lock);
+#endif
+}
+
+/* user selected autolock based on backlight timeout; toggles autolock on / off
+ by ACTION_STD_KEYLOCK presses, Activates autolock if set on backlight timeout
+*/
+#ifdef HAVE_BACKLIGHT
+static inline int do_auto_softlock(int button, int action, int *unlock_combo)
+{
+ if(mask_has_flag(softlock_mask, SEL_ACTION_ALOCK_OK) && !is_backlight_on(false))
+ do_key_lock(true);
+
+ else if (action == ACTION_STD_KEYLOCK)
+ {
+ *unlock_combo = button;/* set unlock combo to allow unlock */
+ softlock_mask ^= SEL_ACTION_ALOCK_OK;
+ handle_backlight(true, false);
+ /* If we don't wait for a moment for the backlight queue
+ * to process, the user will never see the message */
+ if (!is_backlight_on(false))
+ sleep(HZ/2);
+
+ if (mask_has_flag(softlock_mask, SEL_ACTION_ALOCK_OK))
+ {
+ splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_ON));
+ action = ACTION_REDRAW;
+ }
+ else
+ splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_OFF));
+ }
+ return action;
+}
+#endif
+
+/* Allows unlock softlock when action is not yet known but unlock_combo set*/
+static inline int do_softlock_unlock_combo(int button, int context)
+{
+return do_softlock(button, ACTION_NONE, context, false);
+}
+
+/* Handles softlock once action is known */
+static int do_softlock(int button, int action, int context, bool is_pre_btn)
+{
+ static int last_filtered_tick = 0;
+ static int unlock_combo = BUTTON_NONE; /*Moved from GLOBAL*/
+ bool filtered = true;
+ bool notify_user = false;
+ bool sl_activate = true; /* standard softlock behavior */
+
+#ifdef HAVE_BACKLIGHT
+ if (!keys_locked && mask_has_flag(softlock_mask, SEL_ACTION_AUTOLOCK))
+ action = do_auto_softlock(button, action, &unlock_combo);
+#endif
+ /* Lock/Unlock toggled by ACTION_STD_KEYLOCK presses*/
+ if ((action == ACTION_STD_KEYLOCK) || (keys_locked && unlock_combo == button))
+ {
+ unlock_combo = button;
+ do_key_lock(!keys_locked);
+ notify_user = true;
+ }
+#if (BUTTON_REMOTE != 0)/* Allow remote actions through */
+ else if (mask_has_flag(button, BUTTON_REMOTE))
+ notify_user = false;
+#endif
+ else if (keys_locked && action != ACTION_NONE && action != ACTION_REDRAW)
+ {
+ if (mask_has_flag(softlock_mask, SEL_ACTION_ENABLED))
+ {
+ filtered = is_action_filtered(action, softlock_mask, context);
+
+ sl_activate = is_action_unfiltered(action, button, is_pre_btn,
+ filtered, &last_filtered_tick);
+ }
+ /*All non-std softlock options are set to 0 if advanced sl is disabled*/
+ if (sl_activate)
+ {
+ if (!mask_has_flag(softlock_mask, SEL_ACTION_NONOTIFY))
+ { /* always true on standard softlock behavior*/
+ notify_user = mask_has_flag(button, BUTTON_REL);
+ action = ACTION_REDRAW;
+ }
+ else
+ action = ACTION_NONE;
+ }
+ else if (!filtered)/*catch blocked actions on fast repeated presses*/
+ action = ACTION_NONE;
+ } /* keys_locked */
+
+#ifdef BUTTON_POWER /*always notify if power button pressed while keys locked*/
+ notify_user |= (mask_has_flag(button, BUTTON_POWER) && keys_locked);
+#endif
+
+ if (notify_user)
+ {
+#ifdef HAVE_BACKLIGHT
+ handle_backlight(true, false);
+ /* If we don't wait for a moment for the backlight queue
+ * to process, the user will never see the message */
+ if (!is_backlight_on(false))
+ sleep(HZ/2);
+#endif
+ if (keys_locked)
+ splash(HZ/2, ID2P(LANG_KEYLOCK_ON));
+ else
+ splash(HZ/2, ID2P(LANG_KEYLOCK_OFF));
+
+ last_button = BUTTON_NONE;
+ action = ACTION_REDRAW;
+ button_clear_queue();
+ }
+
+ return action;
+}
+
+void set_selective_softlock_actions(bool selective, unsigned int mask)
+{
+ keys_locked = false;
+ if(selective)
+ softlock_mask = mask | SEL_ACTION_ENABLED;
+ else
+ softlock_mask = SEL_ACTION_NONE;
+}
+
+#endif /* HAS_BUTTON_HOLD */
diff --git a/apps/action.h b/apps/action.h
index e54d5deacf..3bc43c2190 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -41,37 +41,66 @@
#else
#define ALLOW_SOFTLOCK 0
#endif
+#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
+/* Selective action selection flags */
+#define SEL_ACTION_NONE 0
+#define SEL_ACTION_VOL 0x001U
+#define SEL_ACTION_PLAY 0x002U
+#define SEL_ACTION_SEEK 0x004U
+#define SEL_ACTION_SKIP 0x008U
+#define SEL_ACTION_NOUNMAPPED 0x010U/* disable backlight on unmapped buttons */
+ /* Available 0x020U*/
+ /* Available 0x040U*/
+#define SEL_ACTION_NOTOUCH 0x080U/* disable touch screen/pad on screen lock */
+#define SEL_ACTION_AUTOLOCK 0x100U/* autolock on backlight off */
+#define SEL_ACTION_NOEXT 0x200U/* disable selective backlight while charge*/
+#define SEL_ACTION_NONOTIFY 0x200U/* don't notify user softlock is active */
+/* Flags below are internal to selective functions */
+#define SEL_ACTION_ALOCK_OK 0x400U/*autolock only active after key lock once*/
+#define SEL_ACTION_FFKEYPRESS 0x400U/* backlight Filter First Keypress active*/
+#define SEL_ACTION_ENABLED 0x800U
+/* Selective Actions flags */
+#ifndef HAS_BUTTON_HOLD
+bool is_keys_locked(void);
+void set_selective_softlock_actions(bool selective, unsigned int mask);
+#endif
+
+#ifdef HAVE_BACKLIGHT
+void set_selective_backlight_actions(bool selective, unsigned int mask,
+ bool filter_fkp);
+#endif
+#endif /* defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) */
enum {
CONTEXT_STD = 0,
/* These CONTEXT_ values were here before me,
there values may have significance, so dont touch! */
CONTEXT_WPS = 1,
- CONTEXT_TREE = 2,
+ CONTEXT_TREE = 2,
CONTEXT_RECORD = 3,
CONTEXT_MAINMENU = 4, /* uses CONTEXT_TREE and ACTION_TREE_* */
CONTEXT_ID3DB = 5,
- /* Add new contexts here, no need to explicitly define a value for them */
+ /* Add new contexts here, no need to explicitly define a value for them */
CONTEXT_LIST,
CONTEXT_SETTINGS, /* regular setting screens (and debug screens) */
- /* bellow are setting screens which may need to redefine the standard
+ /* bellow are setting screens which may need to redefine the standard
setting screen keys, targets should return the CONTEXT_SETTINGS
keymap unless they are not adequate for the screen
- NOTE: uses ACTION_STD_[NEXT|PREV] so make sure they are there also
+ NOTE: uses ACTION_STD_[NEXT|PREV] so make sure they are there also
and (possibly) ACTION_SETTINGS_[INC|DEC] */
- CONTEXT_SETTINGS_EQ,
- CONTEXT_SETTINGS_COLOURCHOOSER,
- CONTEXT_SETTINGS_TIME,
+ CONTEXT_SETTINGS_EQ,
+ CONTEXT_SETTINGS_COLOURCHOOSER,
+ CONTEXT_SETTINGS_TIME,
CONTEXT_SETTINGS_RECTRIGGER,
-
+
/* The following contexts should use ACTION_STD_[NEXT|PREV]
- and (possibly) ACTION_SETTINGS_[INC|DEC]
+ and (possibly) ACTION_SETTINGS_[INC|DEC]
Also add any extra actions they need */
CONTEXT_BOOKMARKSCREEN, /* uses ACTION_BMS_ defines */
- CONTEXT_ALARMSCREEN, /* uses ACTION_AS_ defines */
+ CONTEXT_ALARMSCREEN, /* uses ACTION_AS_ defines */
CONTEXT_QUICKSCREEN, /* uses ACTION_QS_ defines below */
CONTEXT_PITCHSCREEN, /* uses ACTION_PS_ defines below */
-
+
CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */
CONTEXT_RECSCREEN,
CONTEXT_KEYBOARD,
@@ -86,7 +115,7 @@ enum {
enum {
-
+
ACTION_NONE = BUTTON_NONE,
ACTION_UNKNOWN,
ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */
@@ -95,11 +124,11 @@ enum {
ACTION_TOUCHSCREEN_IGNORE, /* used for the 'none' action in skins */
/* standard actions, use these first */
- ACTION_STD_PREV,
+ ACTION_STD_PREV,
ACTION_STD_PREVREPEAT,
ACTION_STD_NEXT,
ACTION_STD_NEXTREPEAT,
-
+
ACTION_STD_OK,
ACTION_STD_CANCEL,
ACTION_STD_CONTEXT,
@@ -108,10 +137,10 @@ enum {
ACTION_STD_KEYLOCK,
ACTION_STD_REC,
ACTION_STD_HOTKEY,
-
+
ACTION_F3, /* just so everything works again, possibly change me */
/* code context actions */
-
+
/* WPS codes */
ACTION_WPS_BROWSE,
ACTION_WPS_PLAY,
@@ -133,7 +162,7 @@ enum {
ACTION_WPS_CREATE_BOOKMARK,/* optional */
ACTION_WPS_REC,
#if 0
- ACTION_WPSAB_SINGLE, /* This needs to be #defined in
+ ACTION_WPSAB_SINGLE, /* This needs to be #defined in
the config-<target>.h to one of the ACTION_WPS_ actions
so it can be used */
#endif
@@ -141,23 +170,23 @@ enum {
ACTION_WPS_ABSETB_NEXTDIR, /* you shouldnt want to change dir in ab-mode */
ACTION_WPS_ABRESET,
ACTION_WPS_HOTKEY,
-
- /* list and tree page up/down */
+
+ /* list and tree page up/down */
ACTION_LISTTREE_PGUP,/* optional */
ACTION_LISTTREE_PGDOWN,/* optional */
#ifdef HAVE_VOLUME_IN_LIST
ACTION_LIST_VOLUP,
ACTION_LIST_VOLDOWN,
#endif
-
- /* tree */
+
+ /* tree */
ACTION_TREE_ROOT_INIT,
ACTION_TREE_PGLEFT,/* optional */
ACTION_TREE_PGRIGHT,/* optional */
ACTION_TREE_STOP,
ACTION_TREE_WPS,
ACTION_TREE_HOTKEY,
-
+
/* radio */
ACTION_FM_MENU,
ACTION_FM_PRESET,
@@ -177,7 +206,7 @@ enum {
ACTION_REC_NEWFILE,
ACTION_REC_F2,
ACTION_REC_F3,
-
+
/* main menu */
/* These are not strictly actions, but must be here
so they dont conflict with real actions in the menu code */
@@ -186,11 +215,11 @@ enum {
ACTION_EXIT_AFTER_THIS_MENUITEM, /* if a menu returns this the menu will exit
once the subitem returns */
ACTION_ENTER_MENUITEM,
-
+
/* id3db */
-
+
/* list */
-
+
/* settings */
ACTION_SETTINGS_INC,
ACTION_SETTINGS_INCREPEAT,
@@ -200,16 +229,16 @@ enum {
ACTION_SETTINGS_DECBIGSTEP,
ACTION_SETTINGS_RESET,
ACTION_SETTINGS_SET, /* Used by touchscreen targets */
-
+
/* bookmark screen */
ACTION_BMS_DELETE,
-
+
/* quickscreen */
ACTION_QS_LEFT,
ACTION_QS_RIGHT,
ACTION_QS_DOWN,
ACTION_QS_TOP,
-
+
/* pitchscreen */
/* obviously ignore if you dont have thise screen */
ACTION_PS_INC_SMALL,
@@ -225,10 +254,10 @@ enum {
ACTION_PS_EXIT, /* _STD_* isnt going to work here */
ACTION_PS_SLOWER,
ACTION_PS_FASTER,
-
+
/* yesno screen */
ACTION_YESNO_ACCEPT,
-
+
/* keyboard screen */
ACTION_KBD_LEFT,
ACTION_KBD_RIGHT,
@@ -243,7 +272,7 @@ enum {
ACTION_KBD_DOWN,
ACTION_KBD_MORSE_INPUT,
ACTION_KBD_MORSE_SELECT,
-
+
#ifdef HAVE_TOUCHSCREEN
/* the following are helper actions for touchscreen targets,
* These are for actions which are not doable or required if buttons are
@@ -255,7 +284,7 @@ enum {
ACTION_TOUCH_VOLUME,
ACTION_TOUCH_SOFTLOCK,
ACTION_TOUCH_SETTING,
-#endif
+#endif
/* USB HID codes */
ACTION_USB_HID_FIRST, /* Place holder */
@@ -347,11 +376,8 @@ bool action_userabort(int timeout);
/* no other code should need this apart from action.c */
const struct button_mapping* get_context_mapping(int context);
-#ifndef HAS_BUTTON_HOLD
-bool is_keys_locked(void);
-#endif
-/* returns the status code variable from action.c for the button just pressed
+/* returns the status code variable from action.c for the button just pressed
If button != NULL it will be set to the actual button code */
#define ACTION_REMOTE 0x1 /* remote was pressed */
#define ACTION_REPEAT 0x2 /* action was repeated (NOT button) */
@@ -378,7 +404,7 @@ int action_get_touchscreen_press(short *x, short *y);
* the press was within the viewport,
* ACTION_UNKNOWN (and x1, y1 untouched) if the press was outside
* BUTTON_NONE else
- *
+ *
**/
int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp);
#endif
diff --git a/apps/gui/mask_select.c b/apps/gui/mask_select.c
new file mode 100644
index 0000000000..e22ba7dd03
--- /dev/null
+++ b/apps/gui/mask_select.c
@@ -0,0 +1,287 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * Copyright (C) 2016 William Wilgus
+ * Derivative of folder_select.c by:
+ * Copyright (C) 2012 Jonathan Gordon
+ * Copyright (C) 2012 Thomas Martitz
+ *
+ * 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.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+/* TODO add language defines */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "lang.h"
+#include "language.h"
+#include "list.h"
+#include "plugin.h"
+#include "mask_select.h"
+#include "talk.h"
+
+/*
+ * Order for changing child states:
+ * 1) expand folder
+ * 2) collapse and select
+ * 3) deselect (skip to 1)
+ */
+
+enum child_state {
+ EXPANDED,
+ SELECTED,
+ COLLAPSED,
+ DESELECTED,
+};
+
+/* Children of main categories */
+struct child {
+ const char* name;
+ struct category *category;
+ enum child_state state;
+ int key_value;
+};
+
+/* Main Categories in root */
+struct category {
+ const char *name;
+ struct child *children;
+ int children_count;
+ int depth;
+ struct category* previous;
+ int key_value; /*values of all children OR|D*/
+};
+
+/* empty category for children of root only one level needed */
+static struct category empty = {
+ .name = "",
+ .children = NULL,
+ .children_count = 0,
+ .depth = 1,
+ .previous = NULL,
+};
+
+/* Or | all keyvalues that user selected */
+static int calculate_mask_r(struct category *root, int mask)
+{
+ int i = 0;
+ while (i < root->children_count)
+ {
+ struct child *this = &root->children[i];
+ if (this->state == SELECTED)
+ mask |= this->key_value;
+
+ else if (this->state == EXPANDED)
+ mask = calculate_mask_r(this->category, mask);
+ i++;
+ }
+return mask;
+}
+
+static int count_items(struct category *start)
+{
+ int count = 0;
+ int i;
+
+ for (i=0; i<start->children_count; i++)
+ {
+ struct child *foo = &start->children[i];
+ if (foo->state == EXPANDED)
+ count += count_items(foo->category);
+ count++;
+ }
+ return count;
+}
+
+static struct child* find_index(struct category *start,
+ int index,struct category **parent)
+{
+ int i = 0;
+
+ *parent = NULL;
+
+ while (i < start->children_count)
+ {
+ struct child *foo = &start->children[i];
+ if (i == index)
+ {
+ *parent = start;
+ return foo;
+ }
+ i++;
+ if (foo->state == EXPANDED)
+ {
+ struct child *bar = find_index(foo->category, index - i, parent);
+ if (bar)
+ {
+ return bar;
+ }
+ index -= count_items(foo->category);
+ }
+ }
+ return NULL;
+}
+
+/* simplelist uses this callback to change
+ the states of the categories/children */
+static int item_action_callback(int action, struct gui_synclist *list)
+{
+ struct category *root = (struct category*)list->data;
+ struct category *parent;
+ struct child *this = find_index(root, list->selected_item, &parent);
+
+ if (action == ACTION_STD_OK)
+ {
+ switch (this->state)
+ {
+ case EXPANDED:
+ this->state = SELECTED;
+ if (global_settings.talk_menu)
+ talk_id(LANG_ON, false);
+ break;
+ case SELECTED:
+ this->state = this->category->children_count == 0 ?
+ DESELECTED : COLLAPSED;
+ if (global_settings.talk_menu && this->category->children_count == 0)
+ talk_id(LANG_OFF, false);
+ break;
+ case COLLAPSED:
+ if (this->category == NULL)
+ this->category = root;
+ this->state = this->category->children_count == 0 ?
+ SELECTED : EXPANDED;
+ if (global_settings.talk_menu && this->category->children_count == 0)
+ talk_id(LANG_ON, false);
+ break;
+ case DESELECTED:
+ this->state = SELECTED;
+ if (global_settings.talk_menu)
+ talk_id(LANG_ON, false);
+ break;
+
+ default:
+ /* do nothing */
+ return action;
+ }
+ list->nb_items = count_items(root);
+ return ACTION_REDRAW;
+ }
+
+ return action;
+}
+
+static const char * item_get_name(int selected_item, void * data,
+ char * buffer, size_t buffer_len)
+{
+ struct category *root = (struct category*)data;
+ struct category *parent;
+ struct child *this = find_index(root, selected_item , &parent);
+
+ buffer[0] = '\0';
+
+ if (parent->depth >= 0)
+ for(int i = 0; i <= parent->depth; i++)
+ strcat(buffer, "\t\0");
+
+ /* state of selection needs icons so if icons are disabled use text*/
+ if (!global_settings.show_icons)
+ {
+ if (this->state == SELECTED)
+ strcat(buffer, "+\0");
+ else
+ strcat(buffer," \0");
+ }
+ strlcat(buffer, P2STR((const unsigned char *)this->name), buffer_len);
+
+ return buffer;
+}
+
+static int item_get_talk(int selected_item, void *data)
+{
+ struct category *root = (struct category*)data;
+ struct category *parent;
+ struct child *this = find_index(root, selected_item , &parent);
+ if (global_settings.talk_menu)
+ {
+ long id = P2ID((const unsigned char *)(this->name));
+ if(id>=0)
+ talk_id(id, true);
+ else
+ talk_spell(this->name, true);
+ talk_id(VOICE_PAUSE,true);
+ if (this->state == SELECTED)
+ talk_id(LANG_ON, true);
+ else if (this->state == DESELECTED)
+ talk_id(LANG_OFF, true);
+ }
+ return 0;
+}
+
+static enum themable_icons item_get_icon(int selected_item, void * data)
+{
+ struct category *root = (struct category*)data;
+ struct category *parent;
+ struct child *this = find_index(root, selected_item, &parent);
+
+ switch (this->state)
+ {
+ case SELECTED:
+ return Icon_Submenu;
+ case COLLAPSED:
+ return Icon_NOICON;
+ case EXPANDED:
+ return Icon_Submenu_Entered;
+ default:
+ return Icon_NOICON;
+ }
+ return Icon_NOICON;
+}
+
+/* supply your original mask,the page header (ie. User do this..), mask items
+ and count, they will be selected automatically if the mask includes
+ them. If user selects new items and chooses to save settings
+ new mask returned otherwise, original is returned
+*/
+int mask_select(int mask, const unsigned char* headermsg,
+ struct s_mask_items *mask_items, size_t items)
+{
+ struct simplelist_info info;
+
+ struct child action_child[items];
+ for (unsigned i = 0; i < items; i++)
+ {
+ action_child[i].name = mask_items[i].name;
+ action_child[i].category = &empty;
+ action_child[i].key_value = mask_items[i].bit_value;
+ action_child[i].state = mask_items[i].bit_value & mask ?
+ SELECTED : DESELECTED;
+ }
+
+ struct category root = {
+ .name = "",
+ .children = (struct child*) &action_child,
+ .children_count = items,
+ .depth = -1,
+ .previous = NULL,
+ };
+
+ simplelist_info_init(&info, P2STR(headermsg), count_items(&root), &root);
+ info.get_name = item_get_name;
+ info.action_callback = item_action_callback;
+ info.get_icon = item_get_icon;
+ info.get_talk = item_get_talk;
+ simplelist_show_list(&info);
+
+ return calculate_mask_r(&root,0);
+}
diff --git a/apps/gui/mask_select.h b/apps/gui/mask_select.h
new file mode 100644
index 0000000000..8578133b9c
--- /dev/null
+++ b/apps/gui/mask_select.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2016 William Wilgus
+ * Derivative of folder_select.h by:
+ * Copyright (C) 2011 Jonathan Gordon
+ *
+ * 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.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef __MASK_SELECT_H__
+#define __MASK_SELECT_H__
+
+/**
+ * A GUI browser to select masks on a target
+ *
+ * It reads an original mask supplied to function
+ * and pre-selects the corresponding actions in the UI. If the user is done it
+ * returns the new mask, assuming the user confirms the yesno dialog.
+ *
+ * Returns new mask if the selected options have changed, otherwise
+ * returns the mask originally supplied */
+struct s_mask_items {
+ const char* name;
+ const int bit_value;
+};
+int mask_select(int mask, const unsigned char* headermsg,
+ struct s_mask_items *mask_items, size_t items);
+#endif /* __MASK_SELECT_H__ */
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 8d2b579f3b..676516ec3d 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -13479,3 +13479,171 @@
ibassodx90: "Android Debug Bridge"
</voice>
</phrase>
+<phrase>
+ id: LANG_ACTION_ENABLED
+ desc: Selective Actions
+ user: core
+ <source>
+ *: "Enabled"
+ </source>
+ <dest>
+ *: "Enabled"
+ </dest>
+ <voice>
+ *: "Enabled"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_ACTION_PLAY
+ desc: Selective Actions
+ user: core
+ <source>
+ *: "Play"
+ </source>
+ <dest>
+ *: "Play"
+ </dest>
+ <voice>
+ *: "Play"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_ACTION_SEEK
+ desc: Selective Actions
+ user: core
+ <source>
+ *: "Seek"
+ </source>
+ <dest>
+ *: "Seek"
+ </dest>
+ <voice>
+ *: "Seek"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_ACTION_SKIP
+ desc: Selective Actions
+ user: core
+ <source>
+ *: "Skip"
+ </source>
+ <dest>
+ *: "Skip"
+ </dest>
+ <voice>
+ *: "Skip"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_BACKLIGHT_SELECTIVE
+ desc: Backlight behaviour setting
+ user: core
+ <source>
+ *: "Selective Backlight"
+ </source>
+ <dest>
+ *: "Selective Backlight"
+ </dest>
+ <voice>
+ *: "Selective Backlight"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_ACTION_DISABLE_EXT_POWER
+ desc: Backlight behaviour setting
+ user: core
+ <source>
+ *: "Disable on External Power"
+ </source>
+ <dest>
+ *: "Disable on External Power"
+ </dest>
+ <voice>
+ *: "Disable on External Power"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_ACTION_DISABLE_UNMAPPED
+ desc: Backlight behaviour setting
+ user: core
+ <source>
+ *: "Disable Unmapped Keys"
+ </source>
+ <dest>
+ *: "Disable Unmapped Keys"
+ </dest>
+ <voice>
+ *: "Disable Unmapped Keys"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_SOFTLOCK_SELECTIVE
+ desc: Softlock behaviour setting
+ user: core
+ <source>
+ *: "Advanced Key Lock"
+ </source>
+ <dest>
+ *: "Advanced Key Lock"
+ </dest>
+ <voice>
+ *: "Advanced Key Lock"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_ACTION_AUTOLOCK_ON
+ desc: Softlock behaviour setting
+ user: core
+ <source>
+ *: "Autolock On"
+ </source>
+ <dest>
+ *: "Autolock On"
+ </dest>
+ <voice>
+ *: "Autolock On"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_ACTION_AUTOLOCK_OFF
+ desc: Softlock behaviour setting
+ user: core
+ <source>
+ *: "Autolock Off"
+ </source>
+ <dest>
+ *: "Autolock Off"
+ </dest>
+ <voice>
+ *: "Autolock Off"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_ACTION_DISABLE_NOTIFY
+ desc: Softlock behaviour setting
+ user: core
+ <source>
+ *: "Disable Notify"
+ </source>
+ <dest>
+ *: "Disable Notify"
+ </dest>
+ <voice>
+ *: "Disable Notify"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_ACTION_DISABLE_TOUCH
+ desc: Softlock behaviour setting
+ user: core
+ <source>
+ *: "Disable Touch"
+ </source>
+ <dest>
+ *: "Disable Touch"
+ </dest>
+ <voice>
+ *: "Disable Touch"
+ </voice>
+</phrase>
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index 948dcede00..5d53cbfe16 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -38,6 +38,10 @@
#ifdef HAVE_REMOTE_LCD
#include "lcd-remote.h"
#endif
+#ifdef HAVE_BACKLIGHT
+#include "mask_select.h"
+#include "splash.h"
+#endif
#ifdef HAVE_TOUCHSCREEN
#include "screens.h"
#endif
@@ -46,9 +50,29 @@
#include "rbunicode.h"
#ifdef HAVE_BACKLIGHT
-static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item)
+static int selectivebacklight_callback(int action,const struct menu_item_ex *this_item)
{
(void)this_item;
+
+ switch (action)
+ {
+ case ACTION_EXIT_MENUITEM:
+ case ACTION_STD_MENU:
+ case ACTION_STD_CANCEL:
+ set_selective_backlight_actions(
+ global_settings.bl_selective_actions,
+ global_settings.bl_selective_actions_mask,
+ global_settings.bl_filter_first_keypress);
+ break;
+ }
+
+ return action;
+}
+
+static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item)
+{
+ /*(void)this_item;REMOVED*/
+
switch (action)
{
case ACTION_EXIT_MENUITEM:
@@ -56,13 +80,43 @@ static int filterfirstkeypress_callback(int action,const struct menu_item_ex *th
#ifdef HAVE_REMOTE_LCD
set_remote_backlight_filter_keypress(
global_settings.remote_bl_filter_first_keypress);
-#endif
-
+#endif /* HAVE_REMOTE_LCD */
+ selectivebacklight_callback(action,this_item);/*uses Filter First KP*/
break;
}
+
return action;
}
+
+static int selectivebacklight_set_mask(void* param)
+{
+ (void)param;
+ int mask = global_settings.bl_selective_actions_mask;
+ struct s_mask_items maskitems[]={
+ {ID2P(LANG_VOLUME) , SEL_ACTION_VOL},
+ {ID2P(LANG_ACTION_PLAY), SEL_ACTION_PLAY},
+ {ID2P(LANG_ACTION_SEEK), SEL_ACTION_SEEK},
+ {ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP},
+ {ID2P(LANG_ACTION_DISABLE_UNMAPPED), SEL_ACTION_NOUNMAPPED}
+#if CONFIG_CHARGING
+ ,{ID2P(LANG_ACTION_DISABLE_EXT_POWER), SEL_ACTION_NOEXT}
#endif
+ };
+
+ mask = mask_select(mask, ID2P(LANG_BACKLIGHT_SELECTIVE)
+ , maskitems, ARRAYLEN(maskitems));
+
+ if (mask == SEL_ACTION_NONE || mask == SEL_ACTION_NOEXT)
+ global_settings.bl_selective_actions = false;
+ else if (global_settings.bl_selective_actions_mask != mask)
+ global_settings.bl_selective_actions = true;
+
+ global_settings.bl_selective_actions_mask = mask;
+
+ return true;
+}
+
+#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_LCD_FLIP
static int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
{
@@ -88,11 +142,11 @@ static int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
#ifdef HAVE_BACKLIGHT
MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL);
#if CONFIG_CHARGING
-MENUITEM_SETTING(backlight_timeout_plugged,
+MENUITEM_SETTING(backlight_timeout_plugged,
&global_settings.backlight_timeout_plugged, NULL);
#endif
#ifdef HAS_BUTTON_HOLD
-MENUITEM_SETTING(backlight_on_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);
@@ -101,9 +155,21 @@ MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL);
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,
+MENUITEM_SETTING(bl_filter_first_keypress,
+ &global_settings.bl_filter_first_keypress,
filterfirstkeypress_callback);
+
+MENUITEM_SETTING(bl_selective_actions,
+ &global_settings.bl_selective_actions,
+ selectivebacklight_callback);
+
+MENUITEM_FUNCTION(sel_backlight_mask, 0, ID2P(LANG_SETTINGS),
+ selectivebacklight_set_mask, NULL,
+ selectivebacklight_callback, Icon_Menu_setting);
+
+MAKE_MENU(sel_backlight, ID2P(LANG_BACKLIGHT_SELECTIVE),
+ NULL, Icon_Menu_setting, &bl_selective_actions, &sel_backlight_mask);
+
#ifdef HAVE_LCD_SLEEP_SETTING
MENUITEM_SETTING(lcd_sleep_after_backlight_off,
&global_settings.lcd_sleep_after_backlight_off, NULL);
@@ -124,6 +190,8 @@ MENUITEM_SETTING(flip_display, &global_settings.flip_display, flipdisplay_callba
#endif
#endif /* HAVE_LCD_BITMAP */
+
+
/* now the actual menu */
MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
NULL, Icon_Display_menu
@@ -141,6 +209,7 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
,&backlight_fade_in, &backlight_fade_out
#endif
,&bl_filter_first_keypress
+ ,&sel_backlight
# ifdef HAVE_LCD_SLEEP_SETTING
,&lcd_sleep_after_backlight_off
# endif
@@ -167,31 +236,31 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
/********************************/
/* Remote LCD settings menu */
#ifdef HAVE_REMOTE_LCD
-MENUITEM_SETTING(remote_backlight_timeout,
+MENUITEM_SETTING(remote_backlight_timeout,
&global_settings.remote_backlight_timeout, NULL);
#if CONFIG_CHARGING
-MENUITEM_SETTING(remote_backlight_timeout_plugged,
+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,
+MENUITEM_SETTING(remote_backlight_on_button_hold,
&global_settings.remote_backlight_on_button_hold, NULL);
#endif
-MENUITEM_SETTING(remote_caption_backlight,
+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,
+MENUITEM_SETTING(remote_bl_filter_first_keypress,
+ &global_settings.remote_bl_filter_first_keypress,
filterfirstkeypress_callback);
-MENUITEM_SETTING(remote_contrast,
+MENUITEM_SETTING(remote_contrast,
&global_settings.remote_contrast, NULL);
-MENUITEM_SETTING(remote_invert,
+MENUITEM_SETTING(remote_invert,
&global_settings.remote_invert, NULL);
-
-#ifdef HAVE_LCD_FLIP
-MENUITEM_SETTING(remote_flip_display,
+
+#ifdef HAVE_LCD_FLIP
+MENUITEM_SETTING(remote_flip_display,
&global_settings.remote_flip_display, flipdisplay_callback);
#endif
@@ -207,7 +276,7 @@ static int ticking_callback(int action,const struct menu_item_ex *this_item)
}
return action;
}
-MENUITEM_SETTING(remote_reduce_ticking,
+MENUITEM_SETTING(remote_reduce_ticking,
&global_settings.remote_reduce_ticking, ticking_callback);
#endif
@@ -222,7 +291,7 @@ MAKE_MENU(lcd_remote_settings, ID2P(LANG_LCD_REMOTE_MENU),
#endif
&remote_caption_backlight, &remote_bl_filter_first_keypress,
&remote_contrast, &remote_invert
-
+
#ifdef HAVE_LCD_FLIP
,&remote_flip_display
#endif
@@ -319,15 +388,15 @@ static int peakmeter_callback(int action,const struct menu_item_ex *this_item)
}
return action;
}
-MENUITEM_SETTING(peak_meter_hold,
+MENUITEM_SETTING(peak_meter_hold,
&global_settings.peak_meter_hold, peakmeter_callback);
-MENUITEM_SETTING(peak_meter_clip_hold,
+MENUITEM_SETTING(peak_meter_clip_hold,
&global_settings.peak_meter_clip_hold, peakmeter_callback);
#ifdef HAVE_RECORDING
MENUITEM_SETTING(peak_meter_clipcounter,
&global_settings.peak_meter_clipcounter, NULL);
#endif
-MENUITEM_SETTING(peak_meter_release,
+MENUITEM_SETTING(peak_meter_release,
&global_settings.peak_meter_release, peakmeter_callback);
/**
* Menu to select wether the scale of the meter
@@ -356,7 +425,7 @@ static int peak_meter_scale(void) {
/* we only store -dBfs */
global_settings.peak_meter_min = -peak_meter_get_min() / 100;
global_settings.peak_meter_max = -peak_meter_get_max() / 100;
-
+
/* limit the returned value to the allowed range */
if(global_settings.peak_meter_min > 89)
global_settings.peak_meter_min = 89;
@@ -472,12 +541,12 @@ MENUITEM_FUNCTION(histogram, 0,
MENUITEM_FUNCTION(peak_meter_scale_item, 0, ID2P(LANG_PM_SCALE),
peak_meter_scale, NULL, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN),
+MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN),
peak_meter_min, NULL, NULL, Icon_NOICON);
-MENUITEM_FUNCTION(peak_meter_max_item, 0, ID2P(LANG_PM_MAX),
+MENUITEM_FUNCTION(peak_meter_max_item, 0, ID2P(LANG_PM_MAX),
peak_meter_max, NULL, NULL, Icon_NOICON);
MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON,
- &peak_meter_release, &peak_meter_hold,
+ &peak_meter_release, &peak_meter_hold,
&peak_meter_clip_hold,
#ifdef HAVE_RECORDING
&peak_meter_clipcounter,
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index f42550cc6a..5c99cb4cd4 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -49,12 +49,67 @@
#include "dircache.h"
#endif
#include "folder_select.h"
-
+#ifndef HAS_BUTTON_HOLD
+#include "mask_select.h"
+#endif
#if defined(DX50) || defined(DX90)
#include "governor-ibasso.h"
#include "usb-ibasso.h"
#endif
+#ifndef HAS_BUTTON_HOLD
+static int selectivesoftlock_callback(int action,
+ const struct menu_item_ex *this_item)
+{
+ (void)this_item;
+
+ switch (action)
+ {
+ case ACTION_STD_MENU:
+ case ACTION_STD_CANCEL:
+ case ACTION_EXIT_MENUITEM:
+ set_selective_softlock_actions(
+ global_settings.bt_selective_softlock_actions,
+ global_settings.bt_selective_softlock_actions_mask);
+ break;
+ }
+
+ return action;
+}
+
+static int selectivesoftlock_set_mask(void* param)
+{
+ (void)param;
+int mask = global_settings.bt_selective_softlock_actions_mask;
+ struct s_mask_items maskitems[]={
+ {ID2P(LANG_VOLUME) , SEL_ACTION_VOL},
+ {ID2P(LANG_ACTION_PLAY), SEL_ACTION_PLAY},
+ {ID2P(LANG_ACTION_SEEK), SEL_ACTION_SEEK},
+ {ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP},
+ #ifdef HAVE_BACKLIGHT
+ {ID2P(LANG_ACTION_AUTOLOCK_ON), SEL_ACTION_AUTOLOCK},
+ #endif
+ #if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
+ {ID2P(LANG_ACTION_DISABLE_TOUCH) , SEL_ACTION_NOTOUCH},
+ #endif
+ {ID2P(LANG_ACTION_DISABLE_NOTIFY), SEL_ACTION_NONOTIFY}
+ };
+
+ mask = mask_select(mask, ID2P(LANG_SOFTLOCK_SELECTIVE)
+ , maskitems,ARRAYLEN(maskitems));
+
+ if (mask == SEL_ACTION_NONE)
+ global_settings.bt_selective_softlock_actions = false;
+ else if (global_settings.bt_selective_softlock_actions_mask != mask)
+ global_settings.bt_selective_softlock_actions = true;
+
+ global_settings.bt_selective_softlock_actions_mask = mask;
+
+ return true;
+}
+
+#endif /* !HAS_BUTTON_HOLD */
+
/***********************************/
/* TAGCACHE MENU */
#ifdef HAVE_TAGCACHE
@@ -137,7 +192,7 @@ static int clear_start_directory(void)
splash(HZ, ID2P(LANG_RESET_DONE_CLEAR));
return false;
}
-MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR),
+MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR),
clear_start_directory, NULL, NULL, Icon_file_view_menu);
static int fileview_callback(int action,const struct menu_item_ex *this_item)
{
@@ -330,6 +385,19 @@ MENUITEM_SETTING(touchpad_deadzone, &global_settings.touchpad_deadzone, NULL);
MENUITEM_SETTING(shortcuts_replaces_quickscreen, &global_settings.shortcuts_replaces_qs, NULL);
#endif
+#ifndef HAS_BUTTON_HOLD
+
+MENUITEM_SETTING(bt_selective_actions,
+ &global_settings.bt_selective_softlock_actions,
+ selectivesoftlock_callback);
+MENUITEM_FUNCTION(sel_softlock_mask, 0, ID2P(LANG_SETTINGS),
+ selectivesoftlock_set_mask, NULL,
+ selectivesoftlock_callback, Icon_Menu_setting);
+
+MAKE_MENU(sel_softlock, ID2P(LANG_SOFTLOCK_SELECTIVE),
+ NULL, Icon_Menu_setting, &bt_selective_actions, &sel_softlock_mask);
+#endif /* !HAS_BUTTON_HOLD */
+
#if defined(DX50) || defined(DX90)
MENUITEM_SETTING(governor, &global_settings.governor, NULL);
MENUITEM_SETTING(usb_mode, &global_settings.usb_mode, NULL);
@@ -380,6 +448,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
#ifdef HAVE_TOUCHPAD_DEADZONE
&touchpad_deadzone,
#endif
+#ifndef HAS_BUTTON_HOLD
+ &sel_softlock,
+#endif
#ifdef USB_ENABLE_HID
&usb_hid,
&usb_keypad_mode,
@@ -544,7 +615,7 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
/***********************************/
/* AUTORESUME MENU */
#ifdef HAVE_TAGCACHE
-#if CONFIG_CODEC == SWCODEC
+#if CONFIG_CODEC == SWCODEC
static int autoresume_callback(int action, const struct menu_item_ex *this_item)
{
@@ -557,7 +628,7 @@ static int autoresume_callback(int action, const struct menu_item_ex *this_item)
static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY),
ID2P(LANG_TAGCACHE_FORCE_UPDATE)};
static const struct text_message message = {lines, 2};
-
+
if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES)
tagcache_rebuild_with_splash();
}
@@ -672,9 +743,9 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
&startup_shutdown_menu,
&bookmark_settings_menu,
#ifdef HAVE_TAGCACHE
-#if CONFIG_CODEC == SWCODEC
+#if CONFIG_CODEC == SWCODEC
&autoresume_menu,
-#endif
+#endif
#endif
&browse_langs, &voice_settings_menu,
#ifdef HAVE_HOTKEY
diff --git a/apps/settings.c b/apps/settings.c
index eed2b3a692..992cc1f391 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -146,7 +146,7 @@ static bool read_nvram_data(char* buf, int max_len)
buf[i] = rtc_read(0x14+i);
#endif
/* check magic, version */
- if ((buf[0] != 'R') || (buf[1] != 'b')
+ if ((buf[0] != 'R') || (buf[1] != 'b')
|| (buf[2] != NVRAM_CONFIG_VERSION))
return false;
/* check crc32 */
@@ -221,7 +221,7 @@ static bool write_nvram_data(char* buf, int max_len)
supports that, but this will have to do for now 8-) */
for (i=0; i < NVRAM_BLOCK_SIZE; i++ ) {
int r = rtc_write(0x14+i, buf[i]);
- if (r)
+ if (r)
return false;
}
#endif
@@ -307,8 +307,8 @@ bool settings_load_config(const char* file, bool apply)
#ifdef HAVE_LCD_COLOR
if (settings[i].flags&F_RGB)
hex_to_rgb(value, (int*)settings[i].setting);
- else
-#endif
+ else
+#endif
if (settings[i].cfg_vals == NULL)
{
*(int*)settings[i].setting = atoi(value);
@@ -392,7 +392,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
const char* start = settings[setting_id].cfg_vals;
char* end = NULL;
int count = 0;
-
+
if ((flags&F_T_MASK)==F_T_INT &&
flags&F_TABLE_SETTING)
{
@@ -404,7 +404,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
{
if (end == NULL)
strlcpy(buf, start, buf_len);
- else
+ else
{
int len = (buf_len > (end-start))? end-start: buf_len;
strlcpy(buf, start, len+1);
@@ -412,7 +412,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
return true;
}
count++;
-
+
if (end)
start = end+1;
else
@@ -420,7 +420,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
}
return false;
}
-
+
while (count < val)
{
start = strchr(start,',');
@@ -432,7 +432,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
end = strchr(start,',');
if (end == NULL)
strlcpy(buf, start, buf_len);
- else
+ else
{
int len = (buf_len > (end-start))? end-start: buf_len;
strlcpy(buf, start, len+1);
@@ -561,7 +561,7 @@ static bool settings_write_config(const char* filename, int options)
value[0] = '\0';
if (settings[i].flags & F_DEPRECATED)
continue;
-
+
switch (options)
{
case SETTINGS_SAVE_CHANGED:
@@ -939,7 +939,7 @@ void settings_apply(bool read_disk)
&& global_settings.font_file[0] != '-') {
int font_ui = screens[SCREEN_MAIN].getuifont();
const char* loaded_font = font_filename(font_ui);
-
+
snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
global_settings.font_file);
if (!loaded_font || strcmp(loaded_font, buf))
@@ -953,7 +953,7 @@ void settings_apply(bool read_disk)
screens[SCREEN_MAIN].setfont(rc);
}
}
-#ifdef HAVE_REMOTE_LCD
+#ifdef HAVE_REMOTE_LCD
if ( global_settings.remote_font_file[0]
&& global_settings.remote_font_file[0] != '-') {
int font_ui = screens[SCREEN_REMOTE].getuifont();
@@ -1064,17 +1064,27 @@ void settings_apply(bool read_disk)
#ifdef HAVE_BACKLIGHT
set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
+ set_selective_backlight_actions(global_settings.bl_selective_actions,
+ global_settings.bl_selective_actions_mask,
+ global_settings.bl_filter_first_keypress);
#ifdef HAVE_REMOTE_LCD
set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
#endif
#ifdef HAS_BUTTON_HOLD
backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
#endif
+
#ifdef HAVE_LCD_SLEEP_SETTING
lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
#endif
#endif /* HAVE_BACKLIGHT */
+#ifndef HAS_BUTTON_HOLD
+ set_selective_softlock_actions(
+ global_settings.bt_selective_softlock_actions,
+ global_settings.bt_selective_softlock_actions_mask);
+#endif
+
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
touchpad_set_sensitivity(global_settings.touchpad_sensitivity);
#endif
@@ -1243,7 +1253,7 @@ bool set_int_ex(const unsigned char* string,
(void)unit;
struct settings_list item;
struct int_setting data = {
- function, voice_unit, min, max, step,
+ function, voice_unit, min, max, step,
formatter, get_talk_id
};
item.int_setting = &data;
@@ -1269,7 +1279,7 @@ static int32_t set_option_get_talk_id(int value, int unit)
}
bool set_option(const char* string, const void* variable, enum optiontype type,
- const struct opt_items* options,
+ const struct opt_items* options,
int numoptions, void (*function)(int))
{
int temp;
@@ -1287,7 +1297,7 @@ bool set_option(const char* string, const void* variable, enum optiontype type,
item.setting = &temp;
if (type == BOOL)
temp = *(bool*)variable? 1: 0;
- else
+ else
temp = *(int*)variable;
if (!option_screen(&item, NULL, false, NULL))
{
diff --git a/apps/settings.h b/apps/settings.h
index e7388b4586..c79aeb37f4 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -529,7 +529,7 @@ struct user_settings
int statusbar; /* STATUSBAR_* enum values */
#ifdef HAVE_REMOTE_LCD
int remote_statusbar;
-#endif
+#endif
#if CONFIG_KEYPAD == RECORDER_PAD
bool buttonbar; /* 0=hide, 1=show */
@@ -670,7 +670,13 @@ struct user_settings
#if CONFIG_CHARGING
int backlight_timeout_plugged;
#endif
+#ifndef HAS_BUTTON_HOLD
+ bool bt_selective_softlock_actions;
+ int bt_selective_softlock_actions_mask;
+#endif
#ifdef HAVE_BACKLIGHT
+ bool bl_selective_actions; /* backlight disable on some actions */
+ int bl_selective_actions_mask;/* mask of actions that will not enable backlight */
#ifdef HAS_BUTTON_HOLD
int backlight_on_button_hold; /* what to do with backlight when hold
switch is on */
@@ -679,7 +685,8 @@ struct user_settings
int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight
has turned off */
#endif
-#endif
+#endif /* HAVE_BACKLIGHT */
+
#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
int backlight_fade_in; /* backlight fade in timing: 0..3 */
int backlight_fade_out; /* backlight fade in timing: 0..7 */
@@ -687,7 +694,7 @@ struct user_settings
bool backlight_fade_in;
bool backlight_fade_out;
#endif
-#ifdef HAVE_BACKLIGHT_BRIGHTNESS
+#ifdef HAVE_BACKLIGHT_BRIGHTNESS
int brightness;
#endif
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 62f232610c..58be3d2575 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -159,7 +159,7 @@
/* for settings which use the set_int() setting screen.
unit is the UNIT_ define to display/talk.
the first one saves a string to the config file,
- the second one saves the variable value to the config file */
+ the second one saves the variable value to the config file */
#define INT_SETTING_W_CFGVALS(flags, var, lang_id, default, name, cfg_vals, \
unit, min, max, step, formatter, get_talk_id, cb) \
{flags|F_INT_SETTING|F_T_INT, &global_settings.var, \
@@ -864,7 +864,7 @@ const struct settings_list settings[] = {
MAX_CONTRAST_SETTING, 1, NULL, NULL }}}},
#endif
#ifdef HAVE_BACKLIGHT
- TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_timeout, LANG_BACKLIGHT,
+ TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_timeout, LANG_BACKLIGHT,
DEFAULT_BACKLIGHT_TIMEOUT,
"backlight timeout", off_on, UNIT_SEC, backlight_formatter,
backlight_getlang, backlight_set_timeout, 20,
@@ -957,7 +957,7 @@ const struct settings_list settings[] = {
0,1,2,3,4,5,6,7,8,9,10,15,30,45,60),
SYSTEM_SETTING(NVRAM(4), runtime, 0),
SYSTEM_SETTING(NVRAM(4), topruntime, 0),
- INT_SETTING(F_BANFROMQS, max_files_in_playlist,
+ INT_SETTING(F_BANFROMQS, max_files_in_playlist,
LANG_MAX_FILES_IN_PLAYLIST,
#if MEMORYSIZE > 1
10000,
@@ -1071,9 +1071,26 @@ const struct settings_list settings[] = {
/** End of old RTC config block **/
+#ifndef HAS_BUTTON_HOLD
+ OFFON_SETTING(0, bt_selective_softlock_actions,
+ LANG_ACTION_ENABLED, false,
+ "No Screen Lock For Selected Actions", NULL),
+ INT_SETTING(0, bt_selective_softlock_actions_mask, LANG_SOFTLOCK_SELECTIVE,
+ 0, "Selective Screen Lock Actions", UNIT_INT,
+ 0, 2048,2, NULL, NULL, NULL),
+#endif /* !HAS_BUTTON_HOLD */
+
#ifdef HAVE_BACKLIGHT
OFFON_SETTING(0, caption_backlight, LANG_CAPTION_BACKLIGHT,
false, "caption backlight", NULL),
+
+ OFFON_SETTING(0, bl_selective_actions,
+ LANG_ACTION_ENABLED, false,
+ "No Backlight On Selected Actions", NULL),
+
+ INT_SETTING(0, bl_selective_actions_mask, LANG_BACKLIGHT_SELECTIVE,
+ 0, "Selective Backlight Actions", UNIT_INT,
+ 0, 2048,2, NULL, NULL, NULL),
#ifdef HAVE_REMOTE_LCD
OFFON_SETTING(0, remote_caption_backlight, LANG_CAPTION_BACKLIGHT,
false, "remote caption backlight", NULL),
@@ -1351,7 +1368,7 @@ const struct settings_list settings[] = {
ID2P(LANG_TIME), ID2P(LANG_FILESIZE)),
{F_T_INT|F_RECSETTING, &global_settings.rec_source, LANG_RECORDING_SOURCE,
INT(0), "rec source",
- &HAVE_MIC_REC_(",mic")
+ &HAVE_MIC_REC_(",mic")
HAVE_LINE_REC_(",line")
HAVE_SPDIF_REC_(",spdif")
HAVE_FMRADIO_REC_(",fmradio")[1],
@@ -1427,17 +1444,17 @@ const struct settings_list settings[] = {
INT_SETTING(F_RECSETTING, rec_stop_thres_linear, LANG_RECORD_STOP_THRESHOLD, 10,
"trigger stop threshold linear", UNIT_PERCENT, 0, 100, 1, NULL, NULL, NULL),
TABLE_SETTING(F_RECSETTING, rec_start_duration, LANG_MIN_DURATION, 0,
- "trigger start duration",
+ "trigger start duration",
"0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min",
UNIT_SEC, NULL, NULL, NULL, 13,
0,1,2,5,10,15,20,25,30,60,120,300,600),
TABLE_SETTING(F_RECSETTING, rec_stop_postrec, LANG_MIN_DURATION, 0,
- "trigger stop duration",
+ "trigger stop duration",
"0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min",
UNIT_SEC, NULL, NULL, NULL, 13,
0,1,2,5,10,15,20,25,30,60,120,300,600),
TABLE_SETTING(F_RECSETTING, rec_stop_gap, LANG_RECORD_STOP_GAP, 1,
- "trigger min gap",
+ "trigger min gap",
"0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min",
UNIT_SEC, NULL, NULL, NULL, 13,
0,1,2,5,10,15,20,25,30,60,120,300,600),
@@ -1469,7 +1486,7 @@ const struct settings_list settings[] = {
LANG_SET_BOOL_YES, LANG_SET_BOOL_NO, NULL),
#ifdef HAVE_TAGCACHE
-#if CONFIG_CODEC == SWCODEC
+#if CONFIG_CODEC == SWCODEC
BOOL_SETTING(0, autoresume_enable, LANG_AUTORESUME, false,
"autoresume enable", off_on,
LANG_SET_BOOL_YES, LANG_SET_BOOL_NO, NULL),
@@ -1482,7 +1499,7 @@ const struct settings_list settings[] = {
ID2P(LANG_AUTORESUME_CUSTOM)),
TEXT_SETTING(0, autoresume_paths, "autoresume next track paths",
"/podcast:/podcasts", NULL, NULL),
-#endif
+#endif
OFFON_SETTING(0, runtimedb, LANG_RUNTIMEDB_ACTIVE, false,
"gather runtime data", NULL),
@@ -1741,11 +1758,11 @@ const struct settings_list settings[] = {
CHOICE_SETTING(F_SOUNDSETTING|F_NO_WRAP, compressor_settings.knee,
LANG_COMPRESSOR_KNEE, 1, "compressor knee",
"hard knee,soft knee", compressor_set, 2,
- ID2P(LANG_COMPRESSOR_HARD_KNEE), ID2P(LANG_COMPRESSOR_SOFT_KNEE)),
+ ID2P(LANG_COMPRESSOR_HARD_KNEE), ID2P(LANG_COMPRESSOR_SOFT_KNEE)),
INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.attack_time,
LANG_COMPRESSOR_ATTACK, 5,
"compressor attack time", UNIT_MS, 0, 30,
- 5, NULL, NULL, compressor_set),
+ 5, NULL, NULL, compressor_set),
INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.release_time,
LANG_COMPRESSOR_RELEASE, 500,
"compressor release time", UNIT_MS, 100, 1000,
@@ -1933,38 +1950,38 @@ const struct settings_list settings[] = {
UNIT_SEC, formatter_unit_0_is_skip_track,
getlang_unit_0_is_skip_track, NULL,
19, -1,0,1,2,3,5,7,10,15,20,30,45,60,90,120,180,300,600,900),
- CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1,
+ CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1,
"start in screen", "previous,root,files,"
-#ifdef HAVE_TAGCACHE
+#ifdef HAVE_TAGCACHE
#define START_DB_COUNT 1
"db,"
-#else
+#else
#define START_DB_COUNT 0
#endif
"wps,menu,"
#ifdef HAVE_RECORDING
#define START_REC_COUNT 1
"recording,"
-#else
+#else
#define START_REC_COUNT 0
#endif
#if CONFIG_TUNER
#define START_TUNER_COUNT 1
"radio,"
-#else
+#else
#define START_TUNER_COUNT 0
#endif
"bookmarks"
#ifdef HAVE_PICTUREFLOW_INTEGRATION
#define START_PF_COUNT 1
",pictureflow"
-#else
+#else
#define START_PF_COUNT 0
#endif
, NULL,
(6 + START_DB_COUNT + START_REC_COUNT + START_TUNER_COUNT + START_PF_COUNT),
ID2P(LANG_PREVIOUS_SCREEN), ID2P(LANG_MAIN_MENU),
- ID2P(LANG_DIR_BROWSER),
+ ID2P(LANG_DIR_BROWSER),
#ifdef HAVE_TAGCACHE
ID2P(LANG_TAGCACHE),
#endif
@@ -2025,7 +2042,7 @@ const struct settings_list settings[] = {
2, "list_accel_start_delay", UNIT_SEC, 0, 10, 1,
formatter_unit_0_is_off, getlang_unit_0_is_off, NULL),
INT_SETTING(0, list_accel_wait, LANG_LISTACCEL_ACCEL_SPEED,
- 3, "list_accel_wait", UNIT_SEC, 1, 10, 1,
+ 3, "list_accel_wait", UNIT_SEC, 1, 10, 1,
scanaccel_formatter, getlang_unit_0_is_off, NULL),
#endif /* HAVE_WHEEL_ACCELERATION */
#if CONFIG_CODEC == SWCODEC
@@ -2108,7 +2125,7 @@ const struct settings_list settings[] = {
CHOICE_SETTING(0, touch_mode, LANG_TOUCHSCREEN_MODE, DEFAULT_TOUCHSCREEN_MODE,
"touchscreen mode", "point,grid", NULL, 2,
ID2P(LANG_TOUCHSCREEN_POINT), ID2P(LANG_TOUCHSCREEN_GRID)),
- CUSTOM_SETTING(0, ts_calibration_data, -1,
+ CUSTOM_SETTING(0, ts_calibration_data, -1,
&default_calibration_parameters, "touchscreen calibration",
tsc_load_from_cfg, tsc_write_to_cfg,
tsc_is_changed, tsc_set_default),
@@ -2165,21 +2182,21 @@ const struct settings_list settings[] = {
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_wps,
LANG_HOTKEY_WPS, HOTKEY_VIEW_PLAYLIST, "hotkey wps",
"off,view playlist,show track info,pitchscreen,open with,delete"
-#ifdef HAVE_PICTUREFLOW_INTEGRATION
+#ifdef HAVE_PICTUREFLOW_INTEGRATION
",pictureflow"
#endif
- ,UNIT_INT, hotkey_formatter, hotkey_getlang, NULL,
-#ifdef HAVE_PICTUREFLOW_INTEGRATION
- 7,
+ ,UNIT_INT, hotkey_formatter, hotkey_getlang, NULL,
+#ifdef HAVE_PICTUREFLOW_INTEGRATION
+ 7,
#else
6,
#endif
HOTKEY_OFF,
HOTKEY_VIEW_PLAYLIST, HOTKEY_SHOW_TRACK_INFO, HOTKEY_PITCHSCREEN,
HOTKEY_OPEN_WITH, HOTKEY_DELETE
-#ifdef HAVE_PICTUREFLOW_INTEGRATION
+#ifdef HAVE_PICTUREFLOW_INTEGRATION
, HOTKEY_PICTUREFLOW
-#endif
+#endif
),
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree,
LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree",
diff --git a/apps/settings_list.h b/apps/settings_list.h
index 2e63220da1..967d581c06 100644
--- a/apps/settings_list.h
+++ b/apps/settings_list.h
@@ -89,7 +89,7 @@ struct choice_setting {
#define F_CHOICE_SETTING 0x100
#define F_CHOICETALKS 0x200 /* uses .talks in the above struct for the talks */
/* and cfg_vals for the strings to display */
-
+
struct table_setting {
void (*option_callback)(int);
const char* (*formatter)(char*, size_t, int, const char*);
@@ -113,7 +113,7 @@ struct table_setting {
struct custom_setting {
/* load the saved value from the .cfg
setting: pointer into global_settings
- value: the text from the .cfg
+ value: the text from the .cfg
*/
void (*load_from_cfg)(void* setting, char*value);
/* store the value into a .cfg