summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2016-11-22 06:21:31 +0100
committerWilliam Wilgus <me.theuser@yahoo.com>2017-01-17 23:06:17 +0100
commitdc87e9e9f3c383b63c3cb3713886a6c93b6a79d1 (patch)
tree47a6c0d49e7741f91fa74d7230b1267f60617902
parent16a9f84571276a13f4cfd5c66db8cd63ce4e2e7f (diff)
downloadrockbox-dc87e9e9f3c383b63c3cb3713886a6c93b6a79d1.tar.gz
rockbox-dc87e9e9f3c383b63c3cb3713886a6c93b6a79d1.zip
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
-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
-rw-r--r--docs/CREDITS1
-rw-r--r--firmware/backlight.c54
-rw-r--r--firmware/export/backlight.h3
-rwxr-xr-x[-rw-r--r--]manual/advanced_topics/main.tex243
-rwxr-xr-x[-rw-r--r--]manual/configure_rockbox/display_options.tex66
-rwxr-xr-x[-rw-r--r--]manual/configure_rockbox/system_options.tex71
18 files changed, 1504 insertions, 333 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
95gui/quickscreen.c 95gui/quickscreen.c
96#endif 96#endif
97gui/folder_select.c 97gui/folder_select.c
98#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
99gui/mask_select.c
100#endif
98 101
99gui/wps.c 102gui/wps.c
100gui/scrollbar.c 103gui/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 @@
42#include "statusbar-skinned.h" 42#include "statusbar-skinned.h"
43#endif 43#endif
44 44
45#ifdef HAVE_BACKLIGHT
46#include "backlight.h"
47#if CONFIG_CHARGING
48#include "power.h"
49#endif
50#endif /* HAVE_BACKLIGHT */
51
52#define LOGF_ENABLE
53#include "logf.h"
54
45static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to 55static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to
46 work on startup */ 56 work on startup */
47static intptr_t last_data = 0; 57static intptr_t last_data = 0;
@@ -56,19 +66,34 @@ static bool short_press = false;
56#define REPEAT_WINDOW_TICKS HZ/4 66#define REPEAT_WINDOW_TICKS HZ/4
57static int last_action_tick = 0; 67static int last_action_tick = 0;
58 68
69#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
70static inline bool is_action_normal(int action);
71static inline bool mask_has_flag(unsigned int mask, unsigned int flag);
72static inline bool is_action_completed(int button);
73#define LAST_FILTER_TICKS HZ/2 /* timeout between filtered actions */
74#endif /* defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) */
75
76#ifdef HAVE_BACKLIGHT
77static unsigned int backlight_mask = SEL_ACTION_NONE;
78static int do_backlight(int action, int context, bool is_pre_btn);
79static void handle_backlight(bool backlight, bool ignore_next);
80#endif /* HAVE_BACKLIGHT */
81
59/* software keylock stuff */ 82/* software keylock stuff */
60#ifndef HAS_BUTTON_HOLD 83#ifndef HAS_BUTTON_HOLD
61static bool keys_locked = false; 84static bool keys_locked = false;
62static int unlock_combo = BUTTON_NONE;
63static bool screen_has_lock = false; 85static bool screen_has_lock = false;
86static unsigned int softlock_mask = SEL_ACTION_NONE;
87static inline int do_softlock_unlock_combo(int button, int context);
88static int do_softlock(int button, int action, int context, bool is_pre_btn);
64#endif /* HAVE_SOFTWARE_KEYLOCK */ 89#endif /* HAVE_SOFTWARE_KEYLOCK */
65
66/* 90/*
67 * do_button_check is the worker function for get_default_action. 91 * do_button_check is the worker function for get_default_action.
68 * returns ACTION_UNKNOWN or the requested return value from the list. 92 * returns ACTION_UNKNOWN or the requested return value from the list.
93 * BE AWARE is_pre_button can miss pre buttons if a match is found first.
69 */ 94 */
70static inline int do_button_check(const struct button_mapping *items, 95static inline int do_button_check(const struct button_mapping *items,int button,
71 int button, int last_button, int *start) 96 int last_button, int *start, bool *prebtn)
72{ 97{
73 int i = 0; 98 int i = 0;
74 int ret = ACTION_UNKNOWN; 99 int ret = ACTION_UNKNOWN;
@@ -88,6 +113,8 @@ static inline int do_button_check(const struct button_mapping *items,
88 break; 113 break;
89 } 114 }
90 } 115 }
116 else if (items[i].pre_button_code & button)
117 *prebtn = true; /* determine if this could be another action */
91 i++; 118 i++;
92 } 119 }
93 *start = i; 120 *start = i;
@@ -164,7 +191,7 @@ static inline int get_next_context(const struct button_mapping *items, int i)
164static void gui_boost(bool want_to_boost) 191static void gui_boost(bool want_to_boost)
165{ 192{
166 static bool boosted = false; 193 static bool boosted = false;
167 194
168 if (want_to_boost && !boosted) 195 if (want_to_boost && !boosted)
169 { 196 {
170 cpu_boost(true); 197 cpu_boost(true);
@@ -177,7 +204,7 @@ static void gui_boost(bool want_to_boost)
177 } 204 }
178} 205}
179 206
180/* gui_unboost_callback() is called GUI_BOOST_TIMEOUT seconds after the 207/* gui_unboost_callback() is called GUI_BOOST_TIMEOUT seconds after the
181 * last wheel scrolling event. */ 208 * last wheel scrolling event. */
182static int gui_unboost_callback(struct timeout *tmo) 209static int gui_unboost_callback(struct timeout *tmo)
183{ 210{
@@ -188,8 +215,8 @@ static int gui_unboost_callback(struct timeout *tmo)
188#endif 215#endif
189 216
190/* 217/*
191 * int get_action_worker(int context, struct button_mapping *user_mappings, 218 * int get_action_worker(int context, int timeout, bool *is_pre_button,
192 int timeout) 219 struct button_mapping *user_mappings)
193 This function searches the button list for the given context for the just 220 This function searches the button list for the given context for the just
194 pressed button. 221 pressed button.
195 If there is a match it returns the value from the list. 222 If there is a match it returns the value from the list.
@@ -197,12 +224,14 @@ static int gui_unboost_callback(struct timeout *tmo)
197 the last item in the list "points" to the next context in a chain 224 the last item in the list "points" to the next context in a chain
198 so the "chain" is followed until the button is found. 225 so the "chain" is followed until the button is found.
199 putting ACTION_NONE will get CONTEXT_STD which is always the last list checked. 226 putting ACTION_NONE will get CONTEXT_STD which is always the last list checked.
200 227 BE AWARE is_pre_button can miss pre buttons if a match is found first.
228 it is more for actions that are not yet completed in the desired context
229 but are defined in a lower 'chained' context.
201 Timeout can be TIMEOUT_NOBLOCK to return immediatly 230 Timeout can be TIMEOUT_NOBLOCK to return immediatly
202 TIMEOUT_BLOCK to wait for a button press 231 TIMEOUT_BLOCK to wait for a button press
203 Any number >0 to wait that many ticks for a press 232 Any number >0 to wait that many ticks for a press
204 */ 233 */
205static int get_action_worker(int context, int timeout, 234static int get_action_worker(int context, int timeout, bool *is_pre_button,
206 const struct button_mapping* (*get_context_map)(int) ) 235 const struct button_mapping* (*get_context_map)(int) )
207{ 236{
208 const struct button_mapping *items = NULL; 237 const struct button_mapping *items = NULL;
@@ -210,7 +239,7 @@ static int get_action_worker(int context, int timeout,
210 int i=0; 239 int i=0;
211 int ret = ACTION_UNKNOWN; 240 int ret = ACTION_UNKNOWN;
212 static int last_context = CONTEXT_STD; 241 static int last_context = CONTEXT_STD;
213 242
214 send_event(GUI_EVENT_ACTIONUPDATE, NULL); 243 send_event(GUI_EVENT_ACTIONUPDATE, NULL);
215 244
216 if (timeout == TIMEOUT_NOBLOCK) 245 if (timeout == TIMEOUT_NOBLOCK)
@@ -222,7 +251,7 @@ static int get_action_worker(int context, int timeout,
222 251
223#if defined(HAVE_GUI_BOOST) && defined(HAVE_ADJUSTABLE_CPU_FREQ) 252#if defined(HAVE_GUI_BOOST) && defined(HAVE_ADJUSTABLE_CPU_FREQ)
224 static struct timeout gui_unboost; 253 static struct timeout gui_unboost;
225 /* Boost the CPU in case of wheel scrolling activity in the defined contexts. 254 /* Boost the CPU in case of wheel scrolling activity in the defined contexts.
226 * Call unboost with a timeout of GUI_BOOST_TIMEOUT. */ 255 * Call unboost with a timeout of GUI_BOOST_TIMEOUT. */
227 if (button != BUTTON_NONE) 256 if (button != BUTTON_NONE)
228 { 257 {
@@ -270,7 +299,7 @@ static int get_action_worker(int context, int timeout,
270 } 299 }
271 return ACTION_NONE; 300 return ACTION_NONE;
272 } 301 }
273 302
274 if ((context != last_context) && ((last_button & BUTTON_REL) == 0) 303 if ((context != last_context) && ((last_button & BUTTON_REL) == 0)
275#ifdef HAVE_SCROLLWHEEL 304#ifdef HAVE_SCROLLWHEEL
276 /* Scrollwheel doesn't generate release events */ 305 /* Scrollwheel doesn't generate release events */
@@ -288,39 +317,24 @@ static int get_action_worker(int context, int timeout,
288 return ACTION_NONE; /* "safest" return value */ 317 return ACTION_NONE; /* "safest" return value */
289 } 318 }
290 last_context = context; 319 last_context = context;
320
291#ifndef HAS_BUTTON_HOLD 321#ifndef HAS_BUTTON_HOLD
292 screen_has_lock = ((context & ALLOW_SOFTLOCK) == ALLOW_SOFTLOCK); 322 screen_has_lock = ((context & ALLOW_SOFTLOCK) == ALLOW_SOFTLOCK);
323 context &= ~ALLOW_SOFTLOCK;
293 if (is_keys_locked()) 324 if (is_keys_locked())
294 { 325 {
295 if (button == unlock_combo) 326 ret = do_softlock_unlock_combo(button, context);
296 { 327 if (!is_keys_locked())
297 last_button = BUTTON_NONE; 328 return ret;
298 keys_locked = false;
299#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
300 /* enable back touch device */
301 button_enable_touch(true);
302#endif
303 splash(HZ/2, str(LANG_KEYLOCK_OFF));
304 return ACTION_REDRAW;
305 }
306 else
307#if (BUTTON_REMOTE != 0)
308 if ((button & BUTTON_REMOTE) == 0)
309#endif
310 {
311 if ((button & BUTTON_REL))
312 splash(HZ/2, str(LANG_KEYLOCK_ON));
313 return ACTION_REDRAW;
314 }
315 } 329 }
316#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN) 330#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
317 else 331 else if (!mask_has_flag(softlock_mask, SEL_ACTION_NOTOUCH))
318 { 332 {
319 /* make sure touchpad get reactivated if we quit the screen */ 333 /* make sure touchpad get reactivated if we quit the screen */
320 button_enable_touch(true); 334 button_enable_touch(true);
321 } 335 }
322#endif 336#endif
323 context &= ~ALLOW_SOFTLOCK; 337
324#endif /* HAS_BUTTON_HOLD */ 338#endif /* HAS_BUTTON_HOLD */
325 339
326#ifdef HAVE_TOUCHSCREEN 340#ifdef HAVE_TOUCHSCREEN
@@ -348,6 +362,7 @@ static int get_action_worker(int context, int timeout,
348#endif 362#endif
349 363
350 /* logf("%x,%x",last_button,button); */ 364 /* logf("%x,%x",last_button,button); */
365 *is_pre_button = false; /* could the button be another actions pre_button */
351 while (1) 366 while (1)
352 { 367 {
353 /* logf("context = %x",context); */ 368 /* logf("context = %x",context); */
@@ -363,7 +378,7 @@ static int get_action_worker(int context, int timeout,
363 if (items == NULL) 378 if (items == NULL)
364 break; 379 break;
365 380
366 ret = do_button_check(items,button,last_button,&i); 381 ret = do_button_check(items, button, last_button, &i, is_pre_button);
367 382
368 if (ret == ACTION_UNKNOWN) 383 if (ret == ACTION_UNKNOWN)
369 { 384 {
@@ -375,24 +390,13 @@ static int get_action_worker(int context, int timeout,
375 continue; 390 continue;
376 } 391 }
377 } 392 }
378
379 /* Action was found or STOPSEARCHING was specified */ 393 /* Action was found or STOPSEARCHING was specified */
380 break; 394 break;
381 } 395 }
382 /* DEBUGF("ret = %x\n",ret); */ 396 /* DEBUGF("ret = %x\n",ret); */
383#ifndef HAS_BUTTON_HOLD 397#ifndef HAS_BUTTON_HOLD
384 if (screen_has_lock && (ret == ACTION_STD_KEYLOCK)) 398 if(screen_has_lock && is_action_normal(ret))
385 { 399 ret = do_softlock(button, ret, last_context & ~ALLOW_SOFTLOCK, is_pre_button);
386 unlock_combo = button;
387 keys_locked = true;
388 splash(HZ/2, str(LANG_KEYLOCK_ON));
389 #if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
390 /* disable touch device on keylock */
391 button_enable_touch(false);
392 #endif
393 button_clear_queue();
394 return ACTION_REDRAW;
395 }
396#endif 400#endif
397 if ((current_tick - last_action_tick < REPEAT_WINDOW_TICKS) 401 if ((current_tick - last_action_tick < REPEAT_WINDOW_TICKS)
398 && (ret == last_action)) 402 && (ret == last_action))
@@ -411,42 +415,46 @@ static int get_action_worker(int context, int timeout,
411#endif 415#endif
412 416
413 return ret; 417 return ret;
414} 418}/* get_action_worker */
415 419
416int get_action(int context, int timeout) 420int get_action(int context, int timeout)
417{ 421{
418 int button = get_action_worker(context,timeout,NULL); 422 bool is_pre_button = false;
423 int button = get_action_worker(context, timeout, &is_pre_button, NULL);
424
419#ifdef HAVE_TOUCHSCREEN 425#ifdef HAVE_TOUCHSCREEN
420 if (button == ACTION_TOUCHSCREEN) 426 if (button == ACTION_TOUCHSCREEN)
421 button = sb_touch_to_button(context); 427 button = sb_touch_to_button(context);
422#endif 428#endif
429
430#ifdef HAVE_BACKLIGHT
431 if (mask_has_flag(backlight_mask, SEL_ACTION_ENABLED) &&
432 is_action_normal(button))
433 button = do_backlight(button, context & ~ALLOW_SOFTLOCK, is_pre_button);
434#endif
435
423 return button; 436 return button;
424} 437}
425 438
426int get_custom_action(int context,int timeout, 439int get_custom_action(int context,int timeout,
427 const struct button_mapping* (*get_context_map)(int)) 440 const struct button_mapping* (*get_context_map)(int))
428{ 441{
429 return get_action_worker(context,timeout,get_context_map); 442 bool is_pre_button = false;
443 return get_action_worker(context,timeout, &is_pre_button, get_context_map);
430} 444}
431 445
432bool action_userabort(int timeout) 446bool action_userabort(int timeout)
433{ 447{
434 int action = get_action_worker(CONTEXT_STD,timeout,NULL); 448 bool is_pre_button = false;
449 int action = get_action_worker(CONTEXT_STD,timeout, &is_pre_button, NULL);
435 bool ret = (action == ACTION_STD_CANCEL); 450 bool ret = (action == ACTION_STD_CANCEL);
436 if(!ret) 451 if (!ret)
437 { 452 {
438 default_event_handler(action); 453 default_event_handler(action);
439 } 454 }
440 return ret; 455 return ret;
441} 456}
442 457
443#ifndef HAS_BUTTON_HOLD
444bool is_keys_locked(void)
445{
446 return (screen_has_lock && keys_locked);
447}
448#endif
449
450intptr_t get_action_data(void) 458intptr_t get_action_data(void)
451{ 459{
452 return last_data; 460 return last_data;
@@ -532,4 +540,338 @@ void action_wait_for_release(void)
532{ 540{
533 wait_for_release = true; 541 wait_for_release = true;
534} 542}
535 543
544#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
545/* HELPER FUNCTIONS
546* Selective softlock and backlight use this lookup based on mask to decide
547* which actions are filtered, or could be filtered but not currently set.
548* returns false if the action isn't found, true if the action is found
549*/
550static bool is_action_filtered(int action, unsigned int mask, int context)
551{
552 bool match = false;
553
554 switch (action)
555 {
556 case ACTION_NONE:
557 break;
558/*Actions that are not mapped will not turn on the backlight option NOUNMAPPED*/
559 case ACTION_UNKNOWN:
560 match = mask_has_flag(mask, SEL_ACTION_NOUNMAPPED);
561 break;
562 case ACTION_WPS_PLAY:
563 case ACTION_FM_PLAY:
564 match = mask_has_flag(mask, SEL_ACTION_PLAY);
565 break;
566 case ACTION_STD_PREVREPEAT:
567 case ACTION_STD_NEXTREPEAT:
568 case ACTION_WPS_SEEKBACK:
569 case ACTION_WPS_SEEKFWD:
570 case ACTION_WPS_STOPSEEK:
571 match = mask_has_flag(mask, SEL_ACTION_SEEK);
572 break;
573 case ACTION_STD_PREV:
574 case ACTION_STD_NEXT:
575 case ACTION_WPS_SKIPNEXT:
576 case ACTION_WPS_SKIPPREV:
577 case ACTION_FM_NEXT_PRESET:
578 case ACTION_FM_PREV_PRESET:
579 match = mask_has_flag(mask, SEL_ACTION_SKIP);
580 break;
581 case ACTION_WPS_VOLUP:
582 case ACTION_WPS_VOLDOWN:
583 match = mask_has_flag(mask, SEL_ACTION_VOL);
584 break;
585 case ACTION_SETTINGS_INC:/*FMS*/
586 case ACTION_SETTINGS_INCREPEAT:/*FMS*/
587 case ACTION_SETTINGS_DEC:/*FMS*/
588 case ACTION_SETTINGS_DECREPEAT:/*FMS*/
589 match = (context == CONTEXT_FM) && mask_has_flag(mask, SEL_ACTION_VOL);
590 break;
591 default:
592 /* display action code of unfiltered actions */
593 logf ("unfiltered actions: context: %d action: %d, last btn: %d, \
594 mask: %d", context, action, last_button, mask);
595 break;
596 }/*switch*/
597
598 return match;
599}
600/* compares mask to a flag return true if set false otherwise*/
601static inline bool mask_has_flag(unsigned int mask, unsigned int flag)
602{
603 return ((mask & flag) != 0);
604}
605/* returns true if the supplied context is to be filtered by selective BL/SL*/
606static inline bool is_context_filtered(int context)
607{
608 return (context == CONTEXT_FM || context == CONTEXT_WPS);
609}
610/* returns true if action can be passed on to selective backlight/softlock */
611static inline bool is_action_normal(int action)
612{
613 return (action != ACTION_REDRAW && (action & SYS_EVENT) == 0);
614}
615/*returns true if Button & released, repeated; or won't generate those events*/
616static inline bool is_action_completed(int button)
617{
618 return ((button & (BUTTON_REPEAT | BUTTON_REL)) != 0
619#ifdef HAVE_SCROLLWHEEL
620 /* Scrollwheel doesn't generate release events */
621 || (button & (BUTTON_SCROLL_BACK | BUTTON_SCROLL_FWD)) != 0
622#endif
623 );
624}
625
626/* most every action takes two rounds through get_action_worker,
627 * once for the keypress and once for the key release,
628 * actions with pre_button codes take even more, some actions however, only
629 * take once; actions defined with only a button and no release/repeat event,
630 * these actions should be acted upon immediately except when we have
631 * selective backlighting/softlock enabled and in this case we only act upon
632 * them immediately if there is no chance they have another event tied to them
633 * determined using is_pre_button and is_action_completed()
634 *returns true if event was not filtered and false if it was
635*/
636static bool is_action_unfiltered(int action,int button, bool is_pre_button,
637 bool filtered, int *tick)
638{
639 bool ret = false;
640 /*directly after a match a key release event may trigger another*/
641 if (filtered && action != ACTION_UNKNOWN)
642 *tick = current_tick + LAST_FILTER_TICKS;
643 /* has button been rel/rep or is this the only action it could be */
644 if (is_action_completed(button) || !is_pre_button)
645 {
646 /* reset last action , if the action is not filtered and
647 this isn't just a key release event then return true */
648 if (!filtered && *tick < current_tick)
649 {
650 *tick = 0;
651 ret = true;
652 }
653 }/*is_action_completed() || !is_pre_button*/
654 return ret;
655}
656#endif /*defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) HELPER FUNCTIONS*/
657
658#ifdef HAVE_BACKLIGHT
659static void handle_backlight(bool backlight, bool ignore_next)
660{
661 if (backlight)
662 {
663 backlight_on_ignore(false, 0);
664 backlight_on();
665#ifdef HAVE_BUTTON_LIGHT
666 buttonlight_on_ignore(false, 0);
667 buttonlight_on();
668 }
669 buttonlight_on_ignore(ignore_next, 5*HZ);/* as a precautionary fallback */
670#else
671 }
672#endif
673 backlight_on_ignore(ignore_next, 5*HZ);/*must be set everytime we handle bl*/
674}
675
676 /* Need to look up actions before we can decide to turn on backlight, if
677 * selective backlighting is true filter first keypress events need to be
678 * taken into account as well
679 */
680static int do_backlight(int action, int context, bool is_pre_btn)
681{
682 static int last_filtered_tick = 0;
683
684 bool bl_is_active = is_backlight_on(false);
685 bool bl_activate = false;
686 bool filtered;
687
688#if CONFIG_CHARGING /* disable if on external power */
689 if (!bl_is_active && is_context_filtered(context) &&
690 !(mask_has_flag(backlight_mask, SEL_ACTION_NOEXT) && power_input_present()))
691#else /* skip if backlight is on or incorrect context */
692 if (!bl_is_active && is_context_filtered(context))
693#endif
694 {
695 filtered = is_action_filtered(action, backlight_mask, context);
696 bl_activate = is_action_unfiltered(action, last_button, is_pre_btn,
697 filtered, &last_filtered_tick);
698 }/*is_context_filtered(context)*/
699 else
700 bl_activate = true;
701
702 if (action != ACTION_NONE && bl_activate)
703 {
704 handle_backlight(true, true);
705
706 if (mask_has_flag(backlight_mask, SEL_ACTION_FFKEYPRESS) && !bl_is_active)
707 {
708 action = ACTION_NONE;
709 last_button = BUTTON_NONE;
710 }
711 }
712 else
713 handle_backlight(false, true);/* set ignore next true */
714
715 return action;
716}
717
718/* Enable selected actions to leave the backlight off */
719void set_selective_backlight_actions(bool selective, unsigned int mask,
720 bool filter_fkp)
721{
722 handle_backlight(true, selective);
723 if (selective) /* we will handle filter_first_keypress here so turn it off*/
724 {
725 set_backlight_filter_keypress(false);/* turnoff ffkp in button.c */
726 backlight_mask = mask | SEL_ACTION_ENABLED;
727 if(filter_fkp)
728 backlight_mask |= SEL_ACTION_FFKEYPRESS;
729 }
730 else
731 {
732 set_backlight_filter_keypress(filter_fkp);
733 backlight_mask = SEL_ACTION_NONE;
734 }
735}
736#endif /* HAVE_BACKLIGHT */
737
738#ifndef HAS_BUTTON_HOLD
739bool is_keys_locked(void)
740{
741 return (screen_has_lock && keys_locked);
742}
743
744static inline void do_key_lock(bool lock)
745{
746 keys_locked = lock;
747 last_button = BUTTON_NONE;
748 button_clear_queue();
749#if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
750 /* disable touch device on keylock if std behavior or selected disable touch */
751 if (!mask_has_flag(softlock_mask, SEL_ACTION_ENABLED) ||
752 mask_has_flag(softlock_mask, SEL_ACTION_NOTOUCH))
753 button_enable_touch(!lock);
754#endif
755}
756
757/* user selected autolock based on backlight timeout; toggles autolock on / off
758 by ACTION_STD_KEYLOCK presses, Activates autolock if set on backlight timeout
759*/
760#ifdef HAVE_BACKLIGHT
761static inline int do_auto_softlock(int button, int action, int *unlock_combo)
762{
763 if(mask_has_flag(softlock_mask, SEL_ACTION_ALOCK_OK) && !is_backlight_on(false))
764 do_key_lock(true);
765
766 else if (action == ACTION_STD_KEYLOCK)
767 {
768 *unlock_combo = button;/* set unlock combo to allow unlock */
769 softlock_mask ^= SEL_ACTION_ALOCK_OK;
770 handle_backlight(true, false);
771 /* If we don't wait for a moment for the backlight queue
772 * to process, the user will never see the message */
773 if (!is_backlight_on(false))
774 sleep(HZ/2);
775
776 if (mask_has_flag(softlock_mask, SEL_ACTION_ALOCK_OK))
777 {
778 splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_ON));
779 action = ACTION_REDRAW;
780 }
781 else
782 splash(HZ/2, ID2P(LANG_ACTION_AUTOLOCK_OFF));
783 }
784 return action;
785}
786#endif
787
788/* Allows unlock softlock when action is not yet known but unlock_combo set*/
789static inline int do_softlock_unlock_combo(int button, int context)
790{
791return do_softlock(button, ACTION_NONE, context, false);
792}
793
794/* Handles softlock once action is known */
795static int do_softlock(int button, int action, int context, bool is_pre_btn)
796{
797 static int last_filtered_tick = 0;
798 static int unlock_combo = BUTTON_NONE; /*Moved from GLOBAL*/
799 bool filtered = true;
800 bool notify_user = false;
801 bool sl_activate = true; /* standard softlock behavior */
802
803#ifdef HAVE_BACKLIGHT
804 if (!keys_locked && mask_has_flag(softlock_mask, SEL_ACTION_AUTOLOCK))
805 action = do_auto_softlock(button, action, &unlock_combo);
806#endif
807 /* Lock/Unlock toggled by ACTION_STD_KEYLOCK presses*/
808 if ((action == ACTION_STD_KEYLOCK) || (keys_locked && unlock_combo == button))
809 {
810 unlock_combo = button;
811 do_key_lock(!keys_locked);
812 notify_user = true;
813 }
814#if (BUTTON_REMOTE != 0)/* Allow remote actions through */
815 else if (mask_has_flag(button, BUTTON_REMOTE))
816 notify_user = false;
817#endif
818 else if (keys_locked && action != ACTION_NONE && action != ACTION_REDRAW)
819 {
820 if (mask_has_flag(softlock_mask, SEL_ACTION_ENABLED))
821 {
822 filtered = is_action_filtered(action, softlock_mask, context);
823
824 sl_activate = is_action_unfiltered(action, button, is_pre_btn,
825 filtered, &last_filtered_tick);
826 }
827 /*All non-std softlock options are set to 0 if advanced sl is disabled*/
828 if (sl_activate)
829 {
830 if (!mask_has_flag(softlock_mask, SEL_ACTION_NONOTIFY))
831 { /* always true on standard softlock behavior*/
832 notify_user = mask_has_flag(button, BUTTON_REL);
833 action = ACTION_REDRAW;
834 }
835 else
836 action = ACTION_NONE;
837 }
838 else if (!filtered)/*catch blocked actions on fast repeated presses*/
839 action = ACTION_NONE;
840 } /* keys_locked */
841
842#ifdef BUTTON_POWER /*always notify if power button pressed while keys locked*/
843 notify_user |= (mask_has_flag(button, BUTTON_POWER) && keys_locked);
844#endif
845
846 if (notify_user)
847 {
848#ifdef HAVE_BACKLIGHT
849 handle_backlight(true, false);
850 /* If we don't wait for a moment for the backlight queue
851 * to process, the user will never see the message */
852 if (!is_backlight_on(false))
853 sleep(HZ/2);
854#endif
855 if (keys_locked)
856 splash(HZ/2, ID2P(LANG_KEYLOCK_ON));
857 else
858 splash(HZ/2, ID2P(LANG_KEYLOCK_OFF));
859
860 last_button = BUTTON_NONE;
861 action = ACTION_REDRAW;
862 button_clear_queue();
863 }
864
865 return action;
866}
867
868void set_selective_softlock_actions(bool selective, unsigned int mask)
869{
870 keys_locked = false;
871 if(selective)
872 softlock_mask = mask | SEL_ACTION_ENABLED;
873 else
874 softlock_mask = SEL_ACTION_NONE;
875}
876
877#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 @@
41#else 41#else
42#define ALLOW_SOFTLOCK 0 42#define ALLOW_SOFTLOCK 0
43#endif 43#endif
44#if defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD)
45/* Selective action selection flags */
46#define SEL_ACTION_NONE 0
47#define SEL_ACTION_VOL 0x001U
48#define SEL_ACTION_PLAY 0x002U
49#define SEL_ACTION_SEEK 0x004U
50#define SEL_ACTION_SKIP 0x008U
51#define SEL_ACTION_NOUNMAPPED 0x010U/* disable backlight on unmapped buttons */
52 /* Available 0x020U*/
53 /* Available 0x040U*/
54#define SEL_ACTION_NOTOUCH 0x080U/* disable touch screen/pad on screen lock */
55#define SEL_ACTION_AUTOLOCK 0x100U/* autolock on backlight off */
56#define SEL_ACTION_NOEXT 0x200U/* disable selective backlight while charge*/
57#define SEL_ACTION_NONOTIFY 0x200U/* don't notify user softlock is active */
58/* Flags below are internal to selective functions */
59#define SEL_ACTION_ALOCK_OK 0x400U/*autolock only active after key lock once*/
60#define SEL_ACTION_FFKEYPRESS 0x400U/* backlight Filter First Keypress active*/
61#define SEL_ACTION_ENABLED 0x800U
62/* Selective Actions flags */
44 63
64#ifndef HAS_BUTTON_HOLD
65bool is_keys_locked(void);
66void set_selective_softlock_actions(bool selective, unsigned int mask);
67#endif
68
69#ifdef HAVE_BACKLIGHT
70void set_selective_backlight_actions(bool selective, unsigned int mask,
71 bool filter_fkp);
72#endif
73#endif /* defined(HAVE_BACKLIGHT) || !defined(HAS_BUTTON_HOLD) */
45enum { 74enum {
46 CONTEXT_STD = 0, 75 CONTEXT_STD = 0,
47 /* These CONTEXT_ values were here before me, 76 /* These CONTEXT_ values were here before me,
48 there values may have significance, so dont touch! */ 77 there values may have significance, so dont touch! */
49 CONTEXT_WPS = 1, 78 CONTEXT_WPS = 1,
50 CONTEXT_TREE = 2, 79 CONTEXT_TREE = 2,
51 CONTEXT_RECORD = 3, 80 CONTEXT_RECORD = 3,
52 CONTEXT_MAINMENU = 4, /* uses CONTEXT_TREE and ACTION_TREE_* */ 81 CONTEXT_MAINMENU = 4, /* uses CONTEXT_TREE and ACTION_TREE_* */
53 CONTEXT_ID3DB = 5, 82 CONTEXT_ID3DB = 5,
54 /* Add new contexts here, no need to explicitly define a value for them */ 83 /* Add new contexts here, no need to explicitly define a value for them */
55 CONTEXT_LIST, 84 CONTEXT_LIST,
56 CONTEXT_SETTINGS, /* regular setting screens (and debug screens) */ 85 CONTEXT_SETTINGS, /* regular setting screens (and debug screens) */
57 /* bellow are setting screens which may need to redefine the standard 86 /* bellow are setting screens which may need to redefine the standard
58 setting screen keys, targets should return the CONTEXT_SETTINGS 87 setting screen keys, targets should return the CONTEXT_SETTINGS
59 keymap unless they are not adequate for the screen 88 keymap unless they are not adequate for the screen
60 NOTE: uses ACTION_STD_[NEXT|PREV] so make sure they are there also 89 NOTE: uses ACTION_STD_[NEXT|PREV] so make sure they are there also
61 and (possibly) ACTION_SETTINGS_[INC|DEC] */ 90 and (possibly) ACTION_SETTINGS_[INC|DEC] */
62 CONTEXT_SETTINGS_EQ, 91 CONTEXT_SETTINGS_EQ,
63 CONTEXT_SETTINGS_COLOURCHOOSER, 92 CONTEXT_SETTINGS_COLOURCHOOSER,
64 CONTEXT_SETTINGS_TIME, 93 CONTEXT_SETTINGS_TIME,
65 CONTEXT_SETTINGS_RECTRIGGER, 94 CONTEXT_SETTINGS_RECTRIGGER,
66 95
67 /* The following contexts should use ACTION_STD_[NEXT|PREV] 96 /* The following contexts should use ACTION_STD_[NEXT|PREV]
68 and (possibly) ACTION_SETTINGS_[INC|DEC] 97 and (possibly) ACTION_SETTINGS_[INC|DEC]
69 Also add any extra actions they need */ 98 Also add any extra actions they need */
70 CONTEXT_BOOKMARKSCREEN, /* uses ACTION_BMS_ defines */ 99 CONTEXT_BOOKMARKSCREEN, /* uses ACTION_BMS_ defines */
71 CONTEXT_ALARMSCREEN, /* uses ACTION_AS_ defines */ 100 CONTEXT_ALARMSCREEN, /* uses ACTION_AS_ defines */
72 CONTEXT_QUICKSCREEN, /* uses ACTION_QS_ defines below */ 101 CONTEXT_QUICKSCREEN, /* uses ACTION_QS_ defines below */
73 CONTEXT_PITCHSCREEN, /* uses ACTION_PS_ defines below */ 102 CONTEXT_PITCHSCREEN, /* uses ACTION_PS_ defines below */
74 103
75 CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */ 104 CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */
76 CONTEXT_RECSCREEN, 105 CONTEXT_RECSCREEN,
77 CONTEXT_KEYBOARD, 106 CONTEXT_KEYBOARD,
@@ -86,7 +115,7 @@ enum {
86 115
87 116
88enum { 117enum {
89 118
90 ACTION_NONE = BUTTON_NONE, 119 ACTION_NONE = BUTTON_NONE,
91 ACTION_UNKNOWN, 120 ACTION_UNKNOWN,
92 ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */ 121 ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */
@@ -95,11 +124,11 @@ enum {
95 ACTION_TOUCHSCREEN_IGNORE, /* used for the 'none' action in skins */ 124 ACTION_TOUCHSCREEN_IGNORE, /* used for the 'none' action in skins */
96 125
97 /* standard actions, use these first */ 126 /* standard actions, use these first */
98 ACTION_STD_PREV, 127 ACTION_STD_PREV,
99 ACTION_STD_PREVREPEAT, 128 ACTION_STD_PREVREPEAT,
100 ACTION_STD_NEXT, 129 ACTION_STD_NEXT,
101 ACTION_STD_NEXTREPEAT, 130 ACTION_STD_NEXTREPEAT,
102 131
103 ACTION_STD_OK, 132 ACTION_STD_OK,
104 ACTION_STD_CANCEL, 133 ACTION_STD_CANCEL,
105 ACTION_STD_CONTEXT, 134 ACTION_STD_CONTEXT,
@@ -108,10 +137,10 @@ enum {
108 ACTION_STD_KEYLOCK, 137 ACTION_STD_KEYLOCK,
109 ACTION_STD_REC, 138 ACTION_STD_REC,
110 ACTION_STD_HOTKEY, 139 ACTION_STD_HOTKEY,
111 140
112 ACTION_F3, /* just so everything works again, possibly change me */ 141 ACTION_F3, /* just so everything works again, possibly change me */
113 /* code context actions */ 142 /* code context actions */
114 143
115 /* WPS codes */ 144 /* WPS codes */
116 ACTION_WPS_BROWSE, 145 ACTION_WPS_BROWSE,
117 ACTION_WPS_PLAY, 146 ACTION_WPS_PLAY,
@@ -133,7 +162,7 @@ enum {
133 ACTION_WPS_CREATE_BOOKMARK,/* optional */ 162 ACTION_WPS_CREATE_BOOKMARK,/* optional */
134 ACTION_WPS_REC, 163 ACTION_WPS_REC,
135#if 0 164#if 0
136 ACTION_WPSAB_SINGLE, /* This needs to be #defined in 165 ACTION_WPSAB_SINGLE, /* This needs to be #defined in
137 the config-<target>.h to one of the ACTION_WPS_ actions 166 the config-<target>.h to one of the ACTION_WPS_ actions
138 so it can be used */ 167 so it can be used */
139#endif 168#endif
@@ -141,23 +170,23 @@ enum {
141 ACTION_WPS_ABSETB_NEXTDIR, /* you shouldnt want to change dir in ab-mode */ 170 ACTION_WPS_ABSETB_NEXTDIR, /* you shouldnt want to change dir in ab-mode */
142 ACTION_WPS_ABRESET, 171 ACTION_WPS_ABRESET,
143 ACTION_WPS_HOTKEY, 172 ACTION_WPS_HOTKEY,
144 173
145 /* list and tree page up/down */ 174 /* list and tree page up/down */
146 ACTION_LISTTREE_PGUP,/* optional */ 175 ACTION_LISTTREE_PGUP,/* optional */
147 ACTION_LISTTREE_PGDOWN,/* optional */ 176 ACTION_LISTTREE_PGDOWN,/* optional */
148#ifdef HAVE_VOLUME_IN_LIST 177#ifdef HAVE_VOLUME_IN_LIST
149 ACTION_LIST_VOLUP, 178 ACTION_LIST_VOLUP,
150 ACTION_LIST_VOLDOWN, 179 ACTION_LIST_VOLDOWN,
151#endif 180#endif
152 181
153 /* tree */ 182 /* tree */
154 ACTION_TREE_ROOT_INIT, 183 ACTION_TREE_ROOT_INIT,
155 ACTION_TREE_PGLEFT,/* optional */ 184 ACTION_TREE_PGLEFT,/* optional */
156 ACTION_TREE_PGRIGHT,/* optional */ 185 ACTION_TREE_PGRIGHT,/* optional */
157 ACTION_TREE_STOP, 186 ACTION_TREE_STOP,
158 ACTION_TREE_WPS, 187 ACTION_TREE_WPS,
159 ACTION_TREE_HOTKEY, 188 ACTION_TREE_HOTKEY,
160 189
161 /* radio */ 190 /* radio */
162 ACTION_FM_MENU, 191 ACTION_FM_MENU,
163 ACTION_FM_PRESET, 192 ACTION_FM_PRESET,
@@ -177,7 +206,7 @@ enum {
177 ACTION_REC_NEWFILE, 206 ACTION_REC_NEWFILE,
178 ACTION_REC_F2, 207 ACTION_REC_F2,
179 ACTION_REC_F3, 208 ACTION_REC_F3,
180 209
181 /* main menu */ 210 /* main menu */
182 /* These are not strictly actions, but must be here 211 /* These are not strictly actions, but must be here
183 so they dont conflict with real actions in the menu code */ 212 so they dont conflict with real actions in the menu code */
@@ -186,11 +215,11 @@ enum {
186 ACTION_EXIT_AFTER_THIS_MENUITEM, /* if a menu returns this the menu will exit 215 ACTION_EXIT_AFTER_THIS_MENUITEM, /* if a menu returns this the menu will exit
187 once the subitem returns */ 216 once the subitem returns */
188 ACTION_ENTER_MENUITEM, 217 ACTION_ENTER_MENUITEM,
189 218
190 /* id3db */ 219 /* id3db */
191 220
192 /* list */ 221 /* list */
193 222
194 /* settings */ 223 /* settings */
195 ACTION_SETTINGS_INC, 224 ACTION_SETTINGS_INC,
196 ACTION_SETTINGS_INCREPEAT, 225 ACTION_SETTINGS_INCREPEAT,
@@ -200,16 +229,16 @@ enum {
200 ACTION_SETTINGS_DECBIGSTEP, 229 ACTION_SETTINGS_DECBIGSTEP,
201 ACTION_SETTINGS_RESET, 230 ACTION_SETTINGS_RESET,
202 ACTION_SETTINGS_SET, /* Used by touchscreen targets */ 231 ACTION_SETTINGS_SET, /* Used by touchscreen targets */
203 232
204 /* bookmark screen */ 233 /* bookmark screen */
205 ACTION_BMS_DELETE, 234 ACTION_BMS_DELETE,
206 235
207 /* quickscreen */ 236 /* quickscreen */
208 ACTION_QS_LEFT, 237 ACTION_QS_LEFT,
209 ACTION_QS_RIGHT, 238 ACTION_QS_RIGHT,
210 ACTION_QS_DOWN, 239 ACTION_QS_DOWN,
211 ACTION_QS_TOP, 240 ACTION_QS_TOP,
212 241
213 /* pitchscreen */ 242 /* pitchscreen */
214 /* obviously ignore if you dont have thise screen */ 243 /* obviously ignore if you dont have thise screen */
215 ACTION_PS_INC_SMALL, 244 ACTION_PS_INC_SMALL,
@@ -225,10 +254,10 @@ enum {
225 ACTION_PS_EXIT, /* _STD_* isnt going to work here */ 254 ACTION_PS_EXIT, /* _STD_* isnt going to work here */
226 ACTION_PS_SLOWER, 255 ACTION_PS_SLOWER,
227 ACTION_PS_FASTER, 256 ACTION_PS_FASTER,
228 257
229 /* yesno screen */ 258 /* yesno screen */
230 ACTION_YESNO_ACCEPT, 259 ACTION_YESNO_ACCEPT,
231 260
232 /* keyboard screen */ 261 /* keyboard screen */
233 ACTION_KBD_LEFT, 262 ACTION_KBD_LEFT,
234 ACTION_KBD_RIGHT, 263 ACTION_KBD_RIGHT,
@@ -243,7 +272,7 @@ enum {
243 ACTION_KBD_DOWN, 272 ACTION_KBD_DOWN,
244 ACTION_KBD_MORSE_INPUT, 273 ACTION_KBD_MORSE_INPUT,
245 ACTION_KBD_MORSE_SELECT, 274 ACTION_KBD_MORSE_SELECT,
246 275
247#ifdef HAVE_TOUCHSCREEN 276#ifdef HAVE_TOUCHSCREEN
248 /* the following are helper actions for touchscreen targets, 277 /* the following are helper actions for touchscreen targets,
249 * These are for actions which are not doable or required if buttons are 278 * These are for actions which are not doable or required if buttons are
@@ -255,7 +284,7 @@ enum {
255 ACTION_TOUCH_VOLUME, 284 ACTION_TOUCH_VOLUME,
256 ACTION_TOUCH_SOFTLOCK, 285 ACTION_TOUCH_SOFTLOCK,
257 ACTION_TOUCH_SETTING, 286 ACTION_TOUCH_SETTING,
258#endif 287#endif
259 288
260 /* USB HID codes */ 289 /* USB HID codes */
261 ACTION_USB_HID_FIRST, /* Place holder */ 290 ACTION_USB_HID_FIRST, /* Place holder */
@@ -347,11 +376,8 @@ bool action_userabort(int timeout);
347 376
348/* no other code should need this apart from action.c */ 377/* no other code should need this apart from action.c */
349const struct button_mapping* get_context_mapping(int context); 378const struct button_mapping* get_context_mapping(int context);
350#ifndef HAS_BUTTON_HOLD
351bool is_keys_locked(void);
352#endif
353 379
354/* returns the status code variable from action.c for the button just pressed 380/* returns the status code variable from action.c for the button just pressed
355 If button != NULL it will be set to the actual button code */ 381 If button != NULL it will be set to the actual button code */
356#define ACTION_REMOTE 0x1 /* remote was pressed */ 382#define ACTION_REMOTE 0x1 /* remote was pressed */
357#define ACTION_REPEAT 0x2 /* action was repeated (NOT button) */ 383#define ACTION_REPEAT 0x2 /* action was repeated (NOT button) */
@@ -378,7 +404,7 @@ int action_get_touchscreen_press(short *x, short *y);
378 * the press was within the viewport, 404 * the press was within the viewport,
379 * ACTION_UNKNOWN (and x1, y1 untouched) if the press was outside 405 * ACTION_UNKNOWN (and x1, y1 untouched) if the press was outside
380 * BUTTON_NONE else 406 * BUTTON_NONE else
381 * 407 *
382 **/ 408 **/
383int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp); 409int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp);
384#endif 410#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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * Copyright (C) 2016 William Wilgus
9 * Derivative of folder_select.c by:
10 * Copyright (C) 2012 Jonathan Gordon
11 * Copyright (C) 2012 Thomas Martitz
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22/* TODO add language defines */
23
24#include <stdio.h>
25#include <stdlib.h>
26#include <string.h>
27#include "lang.h"
28#include "language.h"
29#include "list.h"
30#include "plugin.h"
31#include "mask_select.h"
32#include "talk.h"
33
34/*
35 * Order for changing child states:
36 * 1) expand folder
37 * 2) collapse and select
38 * 3) deselect (skip to 1)
39 */
40
41enum child_state {
42 EXPANDED,
43 SELECTED,
44 COLLAPSED,
45 DESELECTED,
46};
47
48/* Children of main categories */
49struct child {
50 const char* name;
51 struct category *category;
52 enum child_state state;
53 int key_value;
54};
55
56/* Main Categories in root */
57struct category {
58 const char *name;
59 struct child *children;
60 int children_count;
61 int depth;
62 struct category* previous;
63 int key_value; /*values of all children OR|D*/
64};
65
66/* empty category for children of root only one level needed */
67static struct category empty = {
68 .name = "",
69 .children = NULL,
70 .children_count = 0,
71 .depth = 1,
72 .previous = NULL,
73};
74
75/* Or | all keyvalues that user selected */
76static int calculate_mask_r(struct category *root, int mask)
77{
78 int i = 0;
79 while (i < root->children_count)
80 {
81 struct child *this = &root->children[i];
82 if (this->state == SELECTED)
83 mask |= this->key_value;
84
85 else if (this->state == EXPANDED)
86 mask = calculate_mask_r(this->category, mask);
87 i++;
88 }
89return mask;
90}
91
92static int count_items(struct category *start)
93{
94 int count = 0;
95 int i;
96
97 for (i=0; i<start->children_count; i++)
98 {
99 struct child *foo = &start->children[i];
100 if (foo->state == EXPANDED)
101 count += count_items(foo->category);
102 count++;
103 }
104 return count;
105}
106
107static struct child* find_index(struct category *start,
108 int index,struct category **parent)
109{
110 int i = 0;
111
112 *parent = NULL;
113
114 while (i < start->children_count)
115 {
116 struct child *foo = &start->children[i];
117 if (i == index)
118 {
119 *parent = start;
120 return foo;
121 }
122 i++;
123 if (foo->state == EXPANDED)
124 {
125 struct child *bar = find_index(foo->category, index - i, parent);
126 if (bar)
127 {
128 return bar;
129 }
130 index -= count_items(foo->category);
131 }
132 }
133 return NULL;
134}
135
136/* simplelist uses this callback to change
137 the states of the categories/children */
138static int item_action_callback(int action, struct gui_synclist *list)
139{
140 struct category *root = (struct category*)list->data;
141 struct category *parent;
142 struct child *this = find_index(root, list->selected_item, &parent);
143
144 if (action == ACTION_STD_OK)
145 {
146 switch (this->state)
147 {
148 case EXPANDED:
149 this->state = SELECTED;
150 if (global_settings.talk_menu)
151 talk_id(LANG_ON, false);
152 break;
153 case SELECTED:
154 this->state = this->category->children_count == 0 ?
155 DESELECTED : COLLAPSED;
156 if (global_settings.talk_menu && this->category->children_count == 0)
157 talk_id(LANG_OFF, false);
158 break;
159 case COLLAPSED:
160 if (this->category == NULL)
161 this->category = root;
162 this->state = this->category->children_count == 0 ?
163 SELECTED : EXPANDED;
164 if (global_settings.talk_menu && this->category->children_count == 0)
165 talk_id(LANG_ON, false);
166 break;
167 case DESELECTED:
168 this->state = SELECTED;
169 if (global_settings.talk_menu)
170 talk_id(LANG_ON, false);
171 break;
172
173 default:
174 /* do nothing */
175 return action;
176 }
177 list->nb_items = count_items(root);
178 return ACTION_REDRAW;
179 }
180
181 return action;
182}
183
184static const char * item_get_name(int selected_item, void * data,
185 char * buffer, size_t buffer_len)
186{
187 struct category *root = (struct category*)data;
188 struct category *parent;
189 struct child *this = find_index(root, selected_item , &parent);
190
191 buffer[0] = '\0';
192
193 if (parent->depth >= 0)
194 for(int i = 0; i <= parent->depth; i++)
195 strcat(buffer, "\t\0");
196
197 /* state of selection needs icons so if icons are disabled use text*/
198 if (!global_settings.show_icons)
199 {
200 if (this->state == SELECTED)
201 strcat(buffer, "+\0");
202 else
203 strcat(buffer," \0");
204 }
205 strlcat(buffer, P2STR((const unsigned char *)this->name), buffer_len);
206
207 return buffer;
208}
209
210static int item_get_talk(int selected_item, void *data)
211{
212 struct category *root = (struct category*)data;
213 struct category *parent;
214 struct child *this = find_index(root, selected_item , &parent);
215 if (global_settings.talk_menu)
216 {
217 long id = P2ID((const unsigned char *)(this->name));
218 if(id>=0)
219 talk_id(id, true);
220 else
221 talk_spell(this->name, true);
222 talk_id(VOICE_PAUSE,true);
223 if (this->state == SELECTED)
224 talk_id(LANG_ON, true);
225 else if (this->state == DESELECTED)
226 talk_id(LANG_OFF, true);
227 }
228 return 0;
229}
230
231static enum themable_icons item_get_icon(int selected_item, void * data)
232{
233 struct category *root = (struct category*)data;
234 struct category *parent;
235 struct child *this = find_index(root, selected_item, &parent);
236
237 switch (this->state)
238 {
239 case SELECTED:
240 return Icon_Submenu;
241 case COLLAPSED:
242 return Icon_NOICON;
243 case EXPANDED:
244 return Icon_Submenu_Entered;
245 default:
246 return Icon_NOICON;
247 }
248 return Icon_NOICON;
249}
250
251/* supply your original mask,the page header (ie. User do this..), mask items
252 and count, they will be selected automatically if the mask includes
253 them. If user selects new items and chooses to save settings
254 new mask returned otherwise, original is returned
255*/
256int mask_select(int mask, const unsigned char* headermsg,
257 struct s_mask_items *mask_items, size_t items)
258{
259 struct simplelist_info info;
260
261 struct child action_child[items];
262 for (unsigned i = 0; i < items; i++)
263 {
264 action_child[i].name = mask_items[i].name;
265 action_child[i].category = &empty;
266 action_child[i].key_value = mask_items[i].bit_value;
267 action_child[i].state = mask_items[i].bit_value & mask ?
268 SELECTED : DESELECTED;
269 }
270
271 struct category root = {
272 .name = "",
273 .children = (struct child*) &action_child,
274 .children_count = items,
275 .depth = -1,
276 .previous = NULL,
277 };
278
279 simplelist_info_init(&info, P2STR(headermsg), count_items(&root), &root);
280 info.get_name = item_get_name;
281 info.action_callback = item_action_callback;
282 info.get_icon = item_get_icon;
283 info.get_talk = item_get_talk;
284 simplelist_show_list(&info);
285
286 return calculate_mask_r(&root,0);
287}
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 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2016 William Wilgus
10 * Derivative of folder_select.h by:
11 * Copyright (C) 2011 Jonathan Gordon
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22
23#ifndef __MASK_SELECT_H__
24#define __MASK_SELECT_H__
25
26/**
27 * A GUI browser to select masks on a target
28 *
29 * It reads an original mask supplied to function
30 * and pre-selects the corresponding actions in the UI. If the user is done it
31 * returns the new mask, assuming the user confirms the yesno dialog.
32 *
33 * Returns new mask if the selected options have changed, otherwise
34 * returns the mask originally supplied */
35struct s_mask_items {
36 const char* name;
37 const int bit_value;
38};
39int mask_select(int mask, const unsigned char* headermsg,
40 struct s_mask_items *mask_items, size_t items);
41#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 @@
13479 ibassodx90: "Android Debug Bridge" 13479 ibassodx90: "Android Debug Bridge"
13480 </voice> 13480 </voice>
13481</phrase> 13481</phrase>
13482<phrase>
13483 id: LANG_ACTION_ENABLED
13484 desc: Selective Actions
13485 user: core
13486 <source>
13487 *: "Enabled"
13488 </source>
13489 <dest>
13490 *: "Enabled"
13491 </dest>
13492 <voice>
13493 *: "Enabled"
13494 </voice>
13495</phrase>
13496<phrase>
13497 id: LANG_ACTION_PLAY
13498 desc: Selective Actions
13499 user: core
13500 <source>
13501 *: "Play"
13502 </source>
13503 <dest>
13504 *: "Play"
13505 </dest>
13506 <voice>
13507 *: "Play"
13508 </voice>
13509</phrase>
13510<phrase>
13511 id: LANG_ACTION_SEEK
13512 desc: Selective Actions
13513 user: core
13514 <source>
13515 *: "Seek"
13516 </source>
13517 <dest>
13518 *: "Seek"
13519 </dest>
13520 <voice>
13521 *: "Seek"
13522 </voice>
13523</phrase>
13524<phrase>
13525 id: LANG_ACTION_SKIP
13526 desc: Selective Actions
13527 user: core
13528 <source>
13529 *: "Skip"
13530 </source>
13531 <dest>
13532 *: "Skip"
13533 </dest>
13534 <voice>
13535 *: "Skip"
13536 </voice>
13537</phrase>
13538<phrase>
13539 id: LANG_BACKLIGHT_SELECTIVE
13540 desc: Backlight behaviour setting
13541 user: core
13542 <source>
13543 *: "Selective Backlight"
13544 </source>
13545 <dest>
13546 *: "Selective Backlight"
13547 </dest>
13548 <voice>
13549 *: "Selective Backlight"
13550 </voice>
13551</phrase>
13552<phrase>
13553 id: LANG_ACTION_DISABLE_EXT_POWER
13554 desc: Backlight behaviour setting
13555 user: core
13556 <source>
13557 *: "Disable on External Power"
13558 </source>
13559 <dest>
13560 *: "Disable on External Power"
13561 </dest>
13562 <voice>
13563 *: "Disable on External Power"
13564 </voice>
13565</phrase>
13566<phrase>
13567 id: LANG_ACTION_DISABLE_UNMAPPED
13568 desc: Backlight behaviour setting
13569 user: core
13570 <source>
13571 *: "Disable Unmapped Keys"
13572 </source>
13573 <dest>
13574 *: "Disable Unmapped Keys"
13575 </dest>
13576 <voice>
13577 *: "Disable Unmapped Keys"
13578 </voice>
13579</phrase>
13580<phrase>
13581 id: LANG_SOFTLOCK_SELECTIVE
13582 desc: Softlock behaviour setting
13583 user: core
13584 <source>
13585 *: "Advanced Key Lock"
13586 </source>
13587 <dest>
13588 *: "Advanced Key Lock"
13589 </dest>
13590 <voice>
13591 *: "Advanced Key Lock"
13592 </voice>
13593</phrase>
13594<phrase>
13595 id: LANG_ACTION_AUTOLOCK_ON
13596 desc: Softlock behaviour setting
13597 user: core
13598 <source>
13599 *: "Autolock On"
13600 </source>
13601 <dest>
13602 *: "Autolock On"
13603 </dest>
13604 <voice>
13605 *: "Autolock On"
13606 </voice>
13607</phrase>
13608<phrase>
13609 id: LANG_ACTION_AUTOLOCK_OFF
13610 desc: Softlock behaviour setting
13611 user: core
13612 <source>
13613 *: "Autolock Off"
13614 </source>
13615 <dest>
13616 *: "Autolock Off"
13617 </dest>
13618 <voice>
13619 *: "Autolock Off"
13620 </voice>
13621</phrase>
13622<phrase>
13623 id: LANG_ACTION_DISABLE_NOTIFY
13624 desc: Softlock behaviour setting
13625 user: core
13626 <source>
13627 *: "Disable Notify"
13628 </source>
13629 <dest>
13630 *: "Disable Notify"
13631 </dest>
13632 <voice>
13633 *: "Disable Notify"
13634 </voice>
13635</phrase>
13636<phrase>
13637 id: LANG_ACTION_DISABLE_TOUCH
13638 desc: Softlock behaviour setting
13639 user: core
13640 <source>
13641 *: "Disable Touch"
13642 </source>
13643 <dest>
13644 *: "Disable Touch"
13645 </dest>
13646 <voice>
13647 *: "Disable Touch"
13648 </voice>
13649</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 @@
38#ifdef HAVE_REMOTE_LCD 38#ifdef HAVE_REMOTE_LCD
39#include "lcd-remote.h" 39#include "lcd-remote.h"
40#endif 40#endif
41#ifdef HAVE_BACKLIGHT
42#include "mask_select.h"
43#include "splash.h"
44#endif
41#ifdef HAVE_TOUCHSCREEN 45#ifdef HAVE_TOUCHSCREEN
42#include "screens.h" 46#include "screens.h"
43#endif 47#endif
@@ -46,9 +50,29 @@
46#include "rbunicode.h" 50#include "rbunicode.h"
47 51
48#ifdef HAVE_BACKLIGHT 52#ifdef HAVE_BACKLIGHT
49static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) 53static int selectivebacklight_callback(int action,const struct menu_item_ex *this_item)
50{ 54{
51 (void)this_item; 55 (void)this_item;
56
57 switch (action)
58 {
59 case ACTION_EXIT_MENUITEM:
60 case ACTION_STD_MENU:
61 case ACTION_STD_CANCEL:
62 set_selective_backlight_actions(
63 global_settings.bl_selective_actions,
64 global_settings.bl_selective_actions_mask,
65 global_settings.bl_filter_first_keypress);
66 break;
67 }
68
69 return action;
70}
71
72static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item)
73{
74 /*(void)this_item;REMOVED*/
75
52 switch (action) 76 switch (action)
53 { 77 {
54 case ACTION_EXIT_MENUITEM: 78 case ACTION_EXIT_MENUITEM:
@@ -56,13 +80,43 @@ static int filterfirstkeypress_callback(int action,const struct menu_item_ex *th
56#ifdef HAVE_REMOTE_LCD 80#ifdef HAVE_REMOTE_LCD
57 set_remote_backlight_filter_keypress( 81 set_remote_backlight_filter_keypress(
58 global_settings.remote_bl_filter_first_keypress); 82 global_settings.remote_bl_filter_first_keypress);
59#endif 83#endif /* HAVE_REMOTE_LCD */
60 84 selectivebacklight_callback(action,this_item);/*uses Filter First KP*/
61 break; 85 break;
62 } 86 }
87
63 return action; 88 return action;
64} 89}
90
91static int selectivebacklight_set_mask(void* param)
92{
93 (void)param;
94 int mask = global_settings.bl_selective_actions_mask;
95 struct s_mask_items maskitems[]={
96 {ID2P(LANG_VOLUME) , SEL_ACTION_VOL},
97 {ID2P(LANG_ACTION_PLAY), SEL_ACTION_PLAY},
98 {ID2P(LANG_ACTION_SEEK), SEL_ACTION_SEEK},
99 {ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP},
100 {ID2P(LANG_ACTION_DISABLE_UNMAPPED), SEL_ACTION_NOUNMAPPED}
101#if CONFIG_CHARGING
102 ,{ID2P(LANG_ACTION_DISABLE_EXT_POWER), SEL_ACTION_NOEXT}
65#endif 103#endif
104 };
105
106 mask = mask_select(mask, ID2P(LANG_BACKLIGHT_SELECTIVE)
107 , maskitems, ARRAYLEN(maskitems));
108
109 if (mask == SEL_ACTION_NONE || mask == SEL_ACTION_NOEXT)
110 global_settings.bl_selective_actions = false;
111 else if (global_settings.bl_selective_actions_mask != mask)
112 global_settings.bl_selective_actions = true;
113
114 global_settings.bl_selective_actions_mask = mask;
115
116 return true;
117}
118
119#endif /* HAVE_BACKLIGHT */
66#ifdef HAVE_LCD_FLIP 120#ifdef HAVE_LCD_FLIP
67static int flipdisplay_callback(int action,const struct menu_item_ex *this_item) 121static int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
68{ 122{
@@ -88,11 +142,11 @@ static int flipdisplay_callback(int action,const struct menu_item_ex *this_item)
88#ifdef HAVE_BACKLIGHT 142#ifdef HAVE_BACKLIGHT
89MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL); 143MENUITEM_SETTING(backlight_timeout, &global_settings.backlight_timeout, NULL);
90#if CONFIG_CHARGING 144#if CONFIG_CHARGING
91MENUITEM_SETTING(backlight_timeout_plugged, 145MENUITEM_SETTING(backlight_timeout_plugged,
92 &global_settings.backlight_timeout_plugged, NULL); 146 &global_settings.backlight_timeout_plugged, NULL);
93#endif 147#endif
94#ifdef HAS_BUTTON_HOLD 148#ifdef HAS_BUTTON_HOLD
95MENUITEM_SETTING(backlight_on_button_hold, 149MENUITEM_SETTING(backlight_on_button_hold,
96 &global_settings.backlight_on_button_hold, NULL); 150 &global_settings.backlight_on_button_hold, NULL);
97#endif 151#endif
98MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL); 152MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL);
@@ -101,9 +155,21 @@ MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL);
101MENUITEM_SETTING(backlight_fade_in, &global_settings.backlight_fade_in, NULL); 155MENUITEM_SETTING(backlight_fade_in, &global_settings.backlight_fade_in, NULL);
102MENUITEM_SETTING(backlight_fade_out, &global_settings.backlight_fade_out, NULL); 156MENUITEM_SETTING(backlight_fade_out, &global_settings.backlight_fade_out, NULL);
103#endif 157#endif
104MENUITEM_SETTING(bl_filter_first_keypress, 158MENUITEM_SETTING(bl_filter_first_keypress,
105 &global_settings.bl_filter_first_keypress, 159 &global_settings.bl_filter_first_keypress,
106 filterfirstkeypress_callback); 160 filterfirstkeypress_callback);
161
162MENUITEM_SETTING(bl_selective_actions,
163 &global_settings.bl_selective_actions,
164 selectivebacklight_callback);
165
166MENUITEM_FUNCTION(sel_backlight_mask, 0, ID2P(LANG_SETTINGS),
167 selectivebacklight_set_mask, NULL,
168 selectivebacklight_callback, Icon_Menu_setting);
169
170MAKE_MENU(sel_backlight, ID2P(LANG_BACKLIGHT_SELECTIVE),
171 NULL, Icon_Menu_setting, &bl_selective_actions, &sel_backlight_mask);
172
107#ifdef HAVE_LCD_SLEEP_SETTING 173#ifdef HAVE_LCD_SLEEP_SETTING
108MENUITEM_SETTING(lcd_sleep_after_backlight_off, 174MENUITEM_SETTING(lcd_sleep_after_backlight_off,
109 &global_settings.lcd_sleep_after_backlight_off, NULL); 175 &global_settings.lcd_sleep_after_backlight_off, NULL);
@@ -124,6 +190,8 @@ MENUITEM_SETTING(flip_display, &global_settings.flip_display, flipdisplay_callba
124#endif 190#endif
125#endif /* HAVE_LCD_BITMAP */ 191#endif /* HAVE_LCD_BITMAP */
126 192
193
194
127/* now the actual menu */ 195/* now the actual menu */
128MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU), 196MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
129 NULL, Icon_Display_menu 197 NULL, Icon_Display_menu
@@ -141,6 +209,7 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
141 ,&backlight_fade_in, &backlight_fade_out 209 ,&backlight_fade_in, &backlight_fade_out
142#endif 210#endif
143 ,&bl_filter_first_keypress 211 ,&bl_filter_first_keypress
212 ,&sel_backlight
144# ifdef HAVE_LCD_SLEEP_SETTING 213# ifdef HAVE_LCD_SLEEP_SETTING
145 ,&lcd_sleep_after_backlight_off 214 ,&lcd_sleep_after_backlight_off
146# endif 215# endif
@@ -167,31 +236,31 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
167/********************************/ 236/********************************/
168/* Remote LCD settings menu */ 237/* Remote LCD settings menu */
169#ifdef HAVE_REMOTE_LCD 238#ifdef HAVE_REMOTE_LCD
170MENUITEM_SETTING(remote_backlight_timeout, 239MENUITEM_SETTING(remote_backlight_timeout,
171 &global_settings.remote_backlight_timeout, NULL); 240 &global_settings.remote_backlight_timeout, NULL);
172 241
173#if CONFIG_CHARGING 242#if CONFIG_CHARGING
174MENUITEM_SETTING(remote_backlight_timeout_plugged, 243MENUITEM_SETTING(remote_backlight_timeout_plugged,
175 &global_settings.remote_backlight_timeout_plugged, NULL); 244 &global_settings.remote_backlight_timeout_plugged, NULL);
176#endif 245#endif
177 246
178#ifdef HAS_REMOTE_BUTTON_HOLD 247#ifdef HAS_REMOTE_BUTTON_HOLD
179MENUITEM_SETTING(remote_backlight_on_button_hold, 248MENUITEM_SETTING(remote_backlight_on_button_hold,
180 &global_settings.remote_backlight_on_button_hold, NULL); 249 &global_settings.remote_backlight_on_button_hold, NULL);
181#endif 250#endif
182 251
183MENUITEM_SETTING(remote_caption_backlight, 252MENUITEM_SETTING(remote_caption_backlight,
184 &global_settings.remote_caption_backlight, NULL); 253 &global_settings.remote_caption_backlight, NULL);
185MENUITEM_SETTING(remote_bl_filter_first_keypress, 254MENUITEM_SETTING(remote_bl_filter_first_keypress,
186 &global_settings.remote_bl_filter_first_keypress, 255 &global_settings.remote_bl_filter_first_keypress,
187 filterfirstkeypress_callback); 256 filterfirstkeypress_callback);
188MENUITEM_SETTING(remote_contrast, 257MENUITEM_SETTING(remote_contrast,
189 &global_settings.remote_contrast, NULL); 258 &global_settings.remote_contrast, NULL);
190MENUITEM_SETTING(remote_invert, 259MENUITEM_SETTING(remote_invert,
191 &global_settings.remote_invert, NULL); 260 &global_settings.remote_invert, NULL);
192 261
193#ifdef HAVE_LCD_FLIP 262#ifdef HAVE_LCD_FLIP
194MENUITEM_SETTING(remote_flip_display, 263MENUITEM_SETTING(remote_flip_display,
195 &global_settings.remote_flip_display, flipdisplay_callback); 264 &global_settings.remote_flip_display, flipdisplay_callback);
196#endif 265#endif
197 266
@@ -207,7 +276,7 @@ static int ticking_callback(int action,const struct menu_item_ex *this_item)
207 } 276 }
208 return action; 277 return action;
209} 278}
210MENUITEM_SETTING(remote_reduce_ticking, 279MENUITEM_SETTING(remote_reduce_ticking,
211 &global_settings.remote_reduce_ticking, ticking_callback); 280 &global_settings.remote_reduce_ticking, ticking_callback);
212#endif 281#endif
213 282
@@ -222,7 +291,7 @@ MAKE_MENU(lcd_remote_settings, ID2P(LANG_LCD_REMOTE_MENU),
222#endif 291#endif
223 &remote_caption_backlight, &remote_bl_filter_first_keypress, 292 &remote_caption_backlight, &remote_bl_filter_first_keypress,
224 &remote_contrast, &remote_invert 293 &remote_contrast, &remote_invert
225 294
226#ifdef HAVE_LCD_FLIP 295#ifdef HAVE_LCD_FLIP
227 ,&remote_flip_display 296 ,&remote_flip_display
228#endif 297#endif
@@ -319,15 +388,15 @@ static int peakmeter_callback(int action,const struct menu_item_ex *this_item)
319 } 388 }
320 return action; 389 return action;
321} 390}
322MENUITEM_SETTING(peak_meter_hold, 391MENUITEM_SETTING(peak_meter_hold,
323 &global_settings.peak_meter_hold, peakmeter_callback); 392 &global_settings.peak_meter_hold, peakmeter_callback);
324MENUITEM_SETTING(peak_meter_clip_hold, 393MENUITEM_SETTING(peak_meter_clip_hold,
325 &global_settings.peak_meter_clip_hold, peakmeter_callback); 394 &global_settings.peak_meter_clip_hold, peakmeter_callback);
326#ifdef HAVE_RECORDING 395#ifdef HAVE_RECORDING
327MENUITEM_SETTING(peak_meter_clipcounter, 396MENUITEM_SETTING(peak_meter_clipcounter,
328 &global_settings.peak_meter_clipcounter, NULL); 397 &global_settings.peak_meter_clipcounter, NULL);
329#endif 398#endif
330MENUITEM_SETTING(peak_meter_release, 399MENUITEM_SETTING(peak_meter_release,
331 &global_settings.peak_meter_release, peakmeter_callback); 400 &global_settings.peak_meter_release, peakmeter_callback);
332/** 401/**
333 * Menu to select wether the scale of the meter 402 * Menu to select wether the scale of the meter
@@ -356,7 +425,7 @@ static int peak_meter_scale(void) {
356 /* we only store -dBfs */ 425 /* we only store -dBfs */
357 global_settings.peak_meter_min = -peak_meter_get_min() / 100; 426 global_settings.peak_meter_min = -peak_meter_get_min() / 100;
358 global_settings.peak_meter_max = -peak_meter_get_max() / 100; 427 global_settings.peak_meter_max = -peak_meter_get_max() / 100;
359 428
360 /* limit the returned value to the allowed range */ 429 /* limit the returned value to the allowed range */
361 if(global_settings.peak_meter_min > 89) 430 if(global_settings.peak_meter_min > 89)
362 global_settings.peak_meter_min = 89; 431 global_settings.peak_meter_min = 89;
@@ -472,12 +541,12 @@ MENUITEM_FUNCTION(histogram, 0,
472 541
473MENUITEM_FUNCTION(peak_meter_scale_item, 0, ID2P(LANG_PM_SCALE), 542MENUITEM_FUNCTION(peak_meter_scale_item, 0, ID2P(LANG_PM_SCALE),
474 peak_meter_scale, NULL, NULL, Icon_NOICON); 543 peak_meter_scale, NULL, NULL, Icon_NOICON);
475MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN), 544MENUITEM_FUNCTION(peak_meter_min_item, 0, ID2P(LANG_PM_MIN),
476 peak_meter_min, NULL, NULL, Icon_NOICON); 545 peak_meter_min, NULL, NULL, Icon_NOICON);
477MENUITEM_FUNCTION(peak_meter_max_item, 0, ID2P(LANG_PM_MAX), 546MENUITEM_FUNCTION(peak_meter_max_item, 0, ID2P(LANG_PM_MAX),
478 peak_meter_max, NULL, NULL, Icon_NOICON); 547 peak_meter_max, NULL, NULL, Icon_NOICON);
479MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON, 548MAKE_MENU(peak_meter_menu, ID2P(LANG_PM_MENU), NULL, Icon_NOICON,
480 &peak_meter_release, &peak_meter_hold, 549 &peak_meter_release, &peak_meter_hold,
481 &peak_meter_clip_hold, 550 &peak_meter_clip_hold,
482#ifdef HAVE_RECORDING 551#ifdef HAVE_RECORDING
483 &peak_meter_clipcounter, 552 &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 @@
49#include "dircache.h" 49#include "dircache.h"
50#endif 50#endif
51#include "folder_select.h" 51#include "folder_select.h"
52 52#ifndef HAS_BUTTON_HOLD
53#include "mask_select.h"
54#endif
53#if defined(DX50) || defined(DX90) 55#if defined(DX50) || defined(DX90)
54#include "governor-ibasso.h" 56#include "governor-ibasso.h"
55#include "usb-ibasso.h" 57#include "usb-ibasso.h"
56#endif 58#endif
57 59
60#ifndef HAS_BUTTON_HOLD
61static int selectivesoftlock_callback(int action,
62 const struct menu_item_ex *this_item)
63{
64 (void)this_item;
65
66 switch (action)
67 {
68 case ACTION_STD_MENU:
69 case ACTION_STD_CANCEL:
70 case ACTION_EXIT_MENUITEM:
71 set_selective_softlock_actions(
72 global_settings.bt_selective_softlock_actions,
73 global_settings.bt_selective_softlock_actions_mask);
74 break;
75 }
76
77 return action;
78}
79
80static int selectivesoftlock_set_mask(void* param)
81{
82 (void)param;
83int mask = global_settings.bt_selective_softlock_actions_mask;
84 struct s_mask_items maskitems[]={
85 {ID2P(LANG_VOLUME) , SEL_ACTION_VOL},
86 {ID2P(LANG_ACTION_PLAY), SEL_ACTION_PLAY},
87 {ID2P(LANG_ACTION_SEEK), SEL_ACTION_SEEK},
88 {ID2P(LANG_ACTION_SKIP), SEL_ACTION_SKIP},
89 #ifdef HAVE_BACKLIGHT
90 {ID2P(LANG_ACTION_AUTOLOCK_ON), SEL_ACTION_AUTOLOCK},
91 #endif
92 #if defined(HAVE_TOUCHPAD) || defined(HAVE_TOUCHSCREEN)
93 {ID2P(LANG_ACTION_DISABLE_TOUCH) , SEL_ACTION_NOTOUCH},
94 #endif
95 {ID2P(LANG_ACTION_DISABLE_NOTIFY), SEL_ACTION_NONOTIFY}
96 };
97
98 mask = mask_select(mask, ID2P(LANG_SOFTLOCK_SELECTIVE)
99 , maskitems,ARRAYLEN(maskitems));
100
101 if (mask == SEL_ACTION_NONE)
102 global_settings.bt_selective_softlock_actions = false;
103 else if (global_settings.bt_selective_softlock_actions_mask != mask)
104 global_settings.bt_selective_softlock_actions = true;
105
106 global_settings.bt_selective_softlock_actions_mask = mask;
107
108 return true;
109}
110
111#endif /* !HAS_BUTTON_HOLD */
112
58/***********************************/ 113/***********************************/
59/* TAGCACHE MENU */ 114/* TAGCACHE MENU */
60#ifdef HAVE_TAGCACHE 115#ifdef HAVE_TAGCACHE
@@ -137,7 +192,7 @@ static int clear_start_directory(void)
137 splash(HZ, ID2P(LANG_RESET_DONE_CLEAR)); 192 splash(HZ, ID2P(LANG_RESET_DONE_CLEAR));
138 return false; 193 return false;
139} 194}
140MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR), 195MENUITEM_FUNCTION(clear_start_directory_item, 0, ID2P(LANG_RESET_START_DIR),
141 clear_start_directory, NULL, NULL, Icon_file_view_menu); 196 clear_start_directory, NULL, NULL, Icon_file_view_menu);
142static int fileview_callback(int action,const struct menu_item_ex *this_item) 197static int fileview_callback(int action,const struct menu_item_ex *this_item)
143{ 198{
@@ -330,6 +385,19 @@ MENUITEM_SETTING(touchpad_deadzone, &global_settings.touchpad_deadzone, NULL);
330MENUITEM_SETTING(shortcuts_replaces_quickscreen, &global_settings.shortcuts_replaces_qs, NULL); 385MENUITEM_SETTING(shortcuts_replaces_quickscreen, &global_settings.shortcuts_replaces_qs, NULL);
331#endif 386#endif
332 387
388#ifndef HAS_BUTTON_HOLD
389
390MENUITEM_SETTING(bt_selective_actions,
391 &global_settings.bt_selective_softlock_actions,
392 selectivesoftlock_callback);
393MENUITEM_FUNCTION(sel_softlock_mask, 0, ID2P(LANG_SETTINGS),
394 selectivesoftlock_set_mask, NULL,
395 selectivesoftlock_callback, Icon_Menu_setting);
396
397MAKE_MENU(sel_softlock, ID2P(LANG_SOFTLOCK_SELECTIVE),
398 NULL, Icon_Menu_setting, &bt_selective_actions, &sel_softlock_mask);
399#endif /* !HAS_BUTTON_HOLD */
400
333#if defined(DX50) || defined(DX90) 401#if defined(DX50) || defined(DX90)
334MENUITEM_SETTING(governor, &global_settings.governor, NULL); 402MENUITEM_SETTING(governor, &global_settings.governor, NULL);
335MENUITEM_SETTING(usb_mode, &global_settings.usb_mode, NULL); 403MENUITEM_SETTING(usb_mode, &global_settings.usb_mode, NULL);
@@ -380,6 +448,9 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
380#ifdef HAVE_TOUCHPAD_DEADZONE 448#ifdef HAVE_TOUCHPAD_DEADZONE
381 &touchpad_deadzone, 449 &touchpad_deadzone,
382#endif 450#endif
451#ifndef HAS_BUTTON_HOLD
452 &sel_softlock,
453#endif
383#ifdef USB_ENABLE_HID 454#ifdef USB_ENABLE_HID
384 &usb_hid, 455 &usb_hid,
385 &usb_keypad_mode, 456 &usb_keypad_mode,
@@ -544,7 +615,7 @@ MAKE_MENU(bookmark_settings_menu, ID2P(LANG_BOOKMARK_SETTINGS), 0,
544/***********************************/ 615/***********************************/
545/* AUTORESUME MENU */ 616/* AUTORESUME MENU */
546#ifdef HAVE_TAGCACHE 617#ifdef HAVE_TAGCACHE
547#if CONFIG_CODEC == SWCODEC 618#if CONFIG_CODEC == SWCODEC
548 619
549static int autoresume_callback(int action, const struct menu_item_ex *this_item) 620static int autoresume_callback(int action, const struct menu_item_ex *this_item)
550{ 621{
@@ -557,7 +628,7 @@ static int autoresume_callback(int action, const struct menu_item_ex *this_item)
557 static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY), 628 static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY),
558 ID2P(LANG_TAGCACHE_FORCE_UPDATE)}; 629 ID2P(LANG_TAGCACHE_FORCE_UPDATE)};
559 static const struct text_message message = {lines, 2}; 630 static const struct text_message message = {lines, 2};
560 631
561 if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES) 632 if (gui_syncyesno_run(&message, NULL, NULL) == YESNO_YES)
562 tagcache_rebuild_with_splash(); 633 tagcache_rebuild_with_splash();
563 } 634 }
@@ -672,9 +743,9 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
672 &startup_shutdown_menu, 743 &startup_shutdown_menu,
673 &bookmark_settings_menu, 744 &bookmark_settings_menu,
674#ifdef HAVE_TAGCACHE 745#ifdef HAVE_TAGCACHE
675#if CONFIG_CODEC == SWCODEC 746#if CONFIG_CODEC == SWCODEC
676 &autoresume_menu, 747 &autoresume_menu,
677#endif 748#endif
678#endif 749#endif
679 &browse_langs, &voice_settings_menu, 750 &browse_langs, &voice_settings_menu,
680#ifdef HAVE_HOTKEY 751#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)
146 buf[i] = rtc_read(0x14+i); 146 buf[i] = rtc_read(0x14+i);
147#endif 147#endif
148 /* check magic, version */ 148 /* check magic, version */
149 if ((buf[0] != 'R') || (buf[1] != 'b') 149 if ((buf[0] != 'R') || (buf[1] != 'b')
150 || (buf[2] != NVRAM_CONFIG_VERSION)) 150 || (buf[2] != NVRAM_CONFIG_VERSION))
151 return false; 151 return false;
152 /* check crc32 */ 152 /* check crc32 */
@@ -221,7 +221,7 @@ static bool write_nvram_data(char* buf, int max_len)
221 supports that, but this will have to do for now 8-) */ 221 supports that, but this will have to do for now 8-) */
222 for (i=0; i < NVRAM_BLOCK_SIZE; i++ ) { 222 for (i=0; i < NVRAM_BLOCK_SIZE; i++ ) {
223 int r = rtc_write(0x14+i, buf[i]); 223 int r = rtc_write(0x14+i, buf[i]);
224 if (r) 224 if (r)
225 return false; 225 return false;
226 } 226 }
227#endif 227#endif
@@ -307,8 +307,8 @@ bool settings_load_config(const char* file, bool apply)
307#ifdef HAVE_LCD_COLOR 307#ifdef HAVE_LCD_COLOR
308 if (settings[i].flags&F_RGB) 308 if (settings[i].flags&F_RGB)
309 hex_to_rgb(value, (int*)settings[i].setting); 309 hex_to_rgb(value, (int*)settings[i].setting);
310 else 310 else
311#endif 311#endif
312 if (settings[i].cfg_vals == NULL) 312 if (settings[i].cfg_vals == NULL)
313 { 313 {
314 *(int*)settings[i].setting = atoi(value); 314 *(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)
392 const char* start = settings[setting_id].cfg_vals; 392 const char* start = settings[setting_id].cfg_vals;
393 char* end = NULL; 393 char* end = NULL;
394 int count = 0; 394 int count = 0;
395 395
396 if ((flags&F_T_MASK)==F_T_INT && 396 if ((flags&F_T_MASK)==F_T_INT &&
397 flags&F_TABLE_SETTING) 397 flags&F_TABLE_SETTING)
398 { 398 {
@@ -404,7 +404,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
404 { 404 {
405 if (end == NULL) 405 if (end == NULL)
406 strlcpy(buf, start, buf_len); 406 strlcpy(buf, start, buf_len);
407 else 407 else
408 { 408 {
409 int len = (buf_len > (end-start))? end-start: buf_len; 409 int len = (buf_len > (end-start))? end-start: buf_len;
410 strlcpy(buf, start, len+1); 410 strlcpy(buf, start, len+1);
@@ -412,7 +412,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
412 return true; 412 return true;
413 } 413 }
414 count++; 414 count++;
415 415
416 if (end) 416 if (end)
417 start = end+1; 417 start = end+1;
418 else 418 else
@@ -420,7 +420,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
420 } 420 }
421 return false; 421 return false;
422 } 422 }
423 423
424 while (count < val) 424 while (count < val)
425 { 425 {
426 start = strchr(start,','); 426 start = strchr(start,',');
@@ -432,7 +432,7 @@ bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
432 end = strchr(start,','); 432 end = strchr(start,',');
433 if (end == NULL) 433 if (end == NULL)
434 strlcpy(buf, start, buf_len); 434 strlcpy(buf, start, buf_len);
435 else 435 else
436 { 436 {
437 int len = (buf_len > (end-start))? end-start: buf_len; 437 int len = (buf_len > (end-start))? end-start: buf_len;
438 strlcpy(buf, start, len+1); 438 strlcpy(buf, start, len+1);
@@ -561,7 +561,7 @@ static bool settings_write_config(const char* filename, int options)
561 value[0] = '\0'; 561 value[0] = '\0';
562 if (settings[i].flags & F_DEPRECATED) 562 if (settings[i].flags & F_DEPRECATED)
563 continue; 563 continue;
564 564
565 switch (options) 565 switch (options)
566 { 566 {
567 case SETTINGS_SAVE_CHANGED: 567 case SETTINGS_SAVE_CHANGED:
@@ -939,7 +939,7 @@ void settings_apply(bool read_disk)
939 && global_settings.font_file[0] != '-') { 939 && global_settings.font_file[0] != '-') {
940 int font_ui = screens[SCREEN_MAIN].getuifont(); 940 int font_ui = screens[SCREEN_MAIN].getuifont();
941 const char* loaded_font = font_filename(font_ui); 941 const char* loaded_font = font_filename(font_ui);
942 942
943 snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt", 943 snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
944 global_settings.font_file); 944 global_settings.font_file);
945 if (!loaded_font || strcmp(loaded_font, buf)) 945 if (!loaded_font || strcmp(loaded_font, buf))
@@ -953,7 +953,7 @@ void settings_apply(bool read_disk)
953 screens[SCREEN_MAIN].setfont(rc); 953 screens[SCREEN_MAIN].setfont(rc);
954 } 954 }
955 } 955 }
956#ifdef HAVE_REMOTE_LCD 956#ifdef HAVE_REMOTE_LCD
957 if ( global_settings.remote_font_file[0] 957 if ( global_settings.remote_font_file[0]
958 && global_settings.remote_font_file[0] != '-') { 958 && global_settings.remote_font_file[0] != '-') {
959 int font_ui = screens[SCREEN_REMOTE].getuifont(); 959 int font_ui = screens[SCREEN_REMOTE].getuifont();
@@ -1064,17 +1064,27 @@ void settings_apply(bool read_disk)
1064 1064
1065#ifdef HAVE_BACKLIGHT 1065#ifdef HAVE_BACKLIGHT
1066 set_backlight_filter_keypress(global_settings.bl_filter_first_keypress); 1066 set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
1067 set_selective_backlight_actions(global_settings.bl_selective_actions,
1068 global_settings.bl_selective_actions_mask,
1069 global_settings.bl_filter_first_keypress);
1067#ifdef HAVE_REMOTE_LCD 1070#ifdef HAVE_REMOTE_LCD
1068 set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress); 1071 set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
1069#endif 1072#endif
1070#ifdef HAS_BUTTON_HOLD 1073#ifdef HAS_BUTTON_HOLD
1071 backlight_set_on_button_hold(global_settings.backlight_on_button_hold); 1074 backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
1072#endif 1075#endif
1076
1073#ifdef HAVE_LCD_SLEEP_SETTING 1077#ifdef HAVE_LCD_SLEEP_SETTING
1074 lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off); 1078 lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
1075#endif 1079#endif
1076#endif /* HAVE_BACKLIGHT */ 1080#endif /* HAVE_BACKLIGHT */
1077 1081
1082#ifndef HAS_BUTTON_HOLD
1083 set_selective_softlock_actions(
1084 global_settings.bt_selective_softlock_actions,
1085 global_settings.bt_selective_softlock_actions_mask);
1086#endif
1087
1078#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING 1088#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
1079 touchpad_set_sensitivity(global_settings.touchpad_sensitivity); 1089 touchpad_set_sensitivity(global_settings.touchpad_sensitivity);
1080#endif 1090#endif
@@ -1243,7 +1253,7 @@ bool set_int_ex(const unsigned char* string,
1243 (void)unit; 1253 (void)unit;
1244 struct settings_list item; 1254 struct settings_list item;
1245 struct int_setting data = { 1255 struct int_setting data = {
1246 function, voice_unit, min, max, step, 1256 function, voice_unit, min, max, step,
1247 formatter, get_talk_id 1257 formatter, get_talk_id
1248 }; 1258 };
1249 item.int_setting = &data; 1259 item.int_setting = &data;
@@ -1269,7 +1279,7 @@ static int32_t set_option_get_talk_id(int value, int unit)
1269} 1279}
1270 1280
1271bool set_option(const char* string, const void* variable, enum optiontype type, 1281bool set_option(const char* string, const void* variable, enum optiontype type,
1272 const struct opt_items* options, 1282 const struct opt_items* options,
1273 int numoptions, void (*function)(int)) 1283 int numoptions, void (*function)(int))
1274{ 1284{
1275 int temp; 1285 int temp;
@@ -1287,7 +1297,7 @@ bool set_option(const char* string, const void* variable, enum optiontype type,
1287 item.setting = &temp; 1297 item.setting = &temp;
1288 if (type == BOOL) 1298 if (type == BOOL)
1289 temp = *(bool*)variable? 1: 0; 1299 temp = *(bool*)variable? 1: 0;
1290 else 1300 else
1291 temp = *(int*)variable; 1301 temp = *(int*)variable;
1292 if (!option_screen(&item, NULL, false, NULL)) 1302 if (!option_screen(&item, NULL, false, NULL))
1293 { 1303 {
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
529 int statusbar; /* STATUSBAR_* enum values */ 529 int statusbar; /* STATUSBAR_* enum values */
530#ifdef HAVE_REMOTE_LCD 530#ifdef HAVE_REMOTE_LCD
531 int remote_statusbar; 531 int remote_statusbar;
532#endif 532#endif
533 533
534#if CONFIG_KEYPAD == RECORDER_PAD 534#if CONFIG_KEYPAD == RECORDER_PAD
535 bool buttonbar; /* 0=hide, 1=show */ 535 bool buttonbar; /* 0=hide, 1=show */
@@ -670,7 +670,13 @@ struct user_settings
670#if CONFIG_CHARGING 670#if CONFIG_CHARGING
671 int backlight_timeout_plugged; 671 int backlight_timeout_plugged;
672#endif 672#endif
673#ifndef HAS_BUTTON_HOLD
674 bool bt_selective_softlock_actions;
675 int bt_selective_softlock_actions_mask;
676#endif
673#ifdef HAVE_BACKLIGHT 677#ifdef HAVE_BACKLIGHT
678 bool bl_selective_actions; /* backlight disable on some actions */
679 int bl_selective_actions_mask;/* mask of actions that will not enable backlight */
674#ifdef HAS_BUTTON_HOLD 680#ifdef HAS_BUTTON_HOLD
675 int backlight_on_button_hold; /* what to do with backlight when hold 681 int backlight_on_button_hold; /* what to do with backlight when hold
676 switch is on */ 682 switch is on */
@@ -679,7 +685,8 @@ struct user_settings
679 int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight 685 int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight
680 has turned off */ 686 has turned off */
681#endif 687#endif
682#endif 688#endif /* HAVE_BACKLIGHT */
689
683#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) 690#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
684 int backlight_fade_in; /* backlight fade in timing: 0..3 */ 691 int backlight_fade_in; /* backlight fade in timing: 0..3 */
685 int backlight_fade_out; /* backlight fade in timing: 0..7 */ 692 int backlight_fade_out; /* backlight fade in timing: 0..7 */
@@ -687,7 +694,7 @@ struct user_settings
687 bool backlight_fade_in; 694 bool backlight_fade_in;
688 bool backlight_fade_out; 695 bool backlight_fade_out;
689#endif 696#endif
690#ifdef HAVE_BACKLIGHT_BRIGHTNESS 697#ifdef HAVE_BACKLIGHT_BRIGHTNESS
691 int brightness; 698 int brightness;
692#endif 699#endif
693 700
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 @@
159/* for settings which use the set_int() setting screen. 159/* for settings which use the set_int() setting screen.
160 unit is the UNIT_ define to display/talk. 160 unit is the UNIT_ define to display/talk.
161 the first one saves a string to the config file, 161 the first one saves a string to the config file,
162 the second one saves the variable value to the config file */ 162 the second one saves the variable value to the config file */
163#define INT_SETTING_W_CFGVALS(flags, var, lang_id, default, name, cfg_vals, \ 163#define INT_SETTING_W_CFGVALS(flags, var, lang_id, default, name, cfg_vals, \
164 unit, min, max, step, formatter, get_talk_id, cb) \ 164 unit, min, max, step, formatter, get_talk_id, cb) \
165 {flags|F_INT_SETTING|F_T_INT, &global_settings.var, \ 165 {flags|F_INT_SETTING|F_T_INT, &global_settings.var, \
@@ -864,7 +864,7 @@ const struct settings_list settings[] = {
864 MAX_CONTRAST_SETTING, 1, NULL, NULL }}}}, 864 MAX_CONTRAST_SETTING, 1, NULL, NULL }}}},
865#endif 865#endif
866#ifdef HAVE_BACKLIGHT 866#ifdef HAVE_BACKLIGHT
867 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_timeout, LANG_BACKLIGHT, 867 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_timeout, LANG_BACKLIGHT,
868 DEFAULT_BACKLIGHT_TIMEOUT, 868 DEFAULT_BACKLIGHT_TIMEOUT,
869 "backlight timeout", off_on, UNIT_SEC, backlight_formatter, 869 "backlight timeout", off_on, UNIT_SEC, backlight_formatter,
870 backlight_getlang, backlight_set_timeout, 20, 870 backlight_getlang, backlight_set_timeout, 20,
@@ -957,7 +957,7 @@ const struct settings_list settings[] = {
957 0,1,2,3,4,5,6,7,8,9,10,15,30,45,60), 957 0,1,2,3,4,5,6,7,8,9,10,15,30,45,60),
958 SYSTEM_SETTING(NVRAM(4), runtime, 0), 958 SYSTEM_SETTING(NVRAM(4), runtime, 0),
959 SYSTEM_SETTING(NVRAM(4), topruntime, 0), 959 SYSTEM_SETTING(NVRAM(4), topruntime, 0),
960 INT_SETTING(F_BANFROMQS, max_files_in_playlist, 960 INT_SETTING(F_BANFROMQS, max_files_in_playlist,
961 LANG_MAX_FILES_IN_PLAYLIST, 961 LANG_MAX_FILES_IN_PLAYLIST,
962#if MEMORYSIZE > 1 962#if MEMORYSIZE > 1
963 10000, 963 10000,
@@ -1071,9 +1071,26 @@ const struct settings_list settings[] = {
1071 1071
1072/** End of old RTC config block **/ 1072/** End of old RTC config block **/
1073 1073
1074#ifndef HAS_BUTTON_HOLD
1075 OFFON_SETTING(0, bt_selective_softlock_actions,
1076 LANG_ACTION_ENABLED, false,
1077 "No Screen Lock For Selected Actions", NULL),
1078 INT_SETTING(0, bt_selective_softlock_actions_mask, LANG_SOFTLOCK_SELECTIVE,
1079 0, "Selective Screen Lock Actions", UNIT_INT,
1080 0, 2048,2, NULL, NULL, NULL),
1081#endif /* !HAS_BUTTON_HOLD */
1082
1074#ifdef HAVE_BACKLIGHT 1083#ifdef HAVE_BACKLIGHT
1075 OFFON_SETTING(0, caption_backlight, LANG_CAPTION_BACKLIGHT, 1084 OFFON_SETTING(0, caption_backlight, LANG_CAPTION_BACKLIGHT,
1076 false, "caption backlight", NULL), 1085 false, "caption backlight", NULL),
1086
1087 OFFON_SETTING(0, bl_selective_actions,
1088 LANG_ACTION_ENABLED, false,
1089 "No Backlight On Selected Actions", NULL),
1090
1091 INT_SETTING(0, bl_selective_actions_mask, LANG_BACKLIGHT_SELECTIVE,
1092 0, "Selective Backlight Actions", UNIT_INT,
1093 0, 2048,2, NULL, NULL, NULL),
1077#ifdef HAVE_REMOTE_LCD 1094#ifdef HAVE_REMOTE_LCD
1078 OFFON_SETTING(0, remote_caption_backlight, LANG_CAPTION_BACKLIGHT, 1095 OFFON_SETTING(0, remote_caption_backlight, LANG_CAPTION_BACKLIGHT,
1079 false, "remote caption backlight", NULL), 1096 false, "remote caption backlight", NULL),
@@ -1351,7 +1368,7 @@ const struct settings_list settings[] = {
1351 ID2P(LANG_TIME), ID2P(LANG_FILESIZE)), 1368 ID2P(LANG_TIME), ID2P(LANG_FILESIZE)),
1352 {F_T_INT|F_RECSETTING, &global_settings.rec_source, LANG_RECORDING_SOURCE, 1369 {F_T_INT|F_RECSETTING, &global_settings.rec_source, LANG_RECORDING_SOURCE,
1353 INT(0), "rec source", 1370 INT(0), "rec source",
1354 &HAVE_MIC_REC_(",mic") 1371 &HAVE_MIC_REC_(",mic")
1355 HAVE_LINE_REC_(",line") 1372 HAVE_LINE_REC_(",line")
1356 HAVE_SPDIF_REC_(",spdif") 1373 HAVE_SPDIF_REC_(",spdif")
1357 HAVE_FMRADIO_REC_(",fmradio")[1], 1374 HAVE_FMRADIO_REC_(",fmradio")[1],
@@ -1427,17 +1444,17 @@ const struct settings_list settings[] = {
1427 INT_SETTING(F_RECSETTING, rec_stop_thres_linear, LANG_RECORD_STOP_THRESHOLD, 10, 1444 INT_SETTING(F_RECSETTING, rec_stop_thres_linear, LANG_RECORD_STOP_THRESHOLD, 10,
1428 "trigger stop threshold linear", UNIT_PERCENT, 0, 100, 1, NULL, NULL, NULL), 1445 "trigger stop threshold linear", UNIT_PERCENT, 0, 100, 1, NULL, NULL, NULL),
1429 TABLE_SETTING(F_RECSETTING, rec_start_duration, LANG_MIN_DURATION, 0, 1446 TABLE_SETTING(F_RECSETTING, rec_start_duration, LANG_MIN_DURATION, 0,
1430 "trigger start duration", 1447 "trigger start duration",
1431 "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min", 1448 "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min",
1432 UNIT_SEC, NULL, NULL, NULL, 13, 1449 UNIT_SEC, NULL, NULL, NULL, 13,
1433 0,1,2,5,10,15,20,25,30,60,120,300,600), 1450 0,1,2,5,10,15,20,25,30,60,120,300,600),
1434 TABLE_SETTING(F_RECSETTING, rec_stop_postrec, LANG_MIN_DURATION, 0, 1451 TABLE_SETTING(F_RECSETTING, rec_stop_postrec, LANG_MIN_DURATION, 0,
1435 "trigger stop duration", 1452 "trigger stop duration",
1436 "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min", 1453 "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min",
1437 UNIT_SEC, NULL, NULL, NULL, 13, 1454 UNIT_SEC, NULL, NULL, NULL, 13,
1438 0,1,2,5,10,15,20,25,30,60,120,300,600), 1455 0,1,2,5,10,15,20,25,30,60,120,300,600),
1439 TABLE_SETTING(F_RECSETTING, rec_stop_gap, LANG_RECORD_STOP_GAP, 1, 1456 TABLE_SETTING(F_RECSETTING, rec_stop_gap, LANG_RECORD_STOP_GAP, 1,
1440 "trigger min gap", 1457 "trigger min gap",
1441 "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min", 1458 "0s,1s,2s,5s,10s,15s,20s,25s,30s,1min,2min,5min,10min",
1442 UNIT_SEC, NULL, NULL, NULL, 13, 1459 UNIT_SEC, NULL, NULL, NULL, 13,
1443 0,1,2,5,10,15,20,25,30,60,120,300,600), 1460 0,1,2,5,10,15,20,25,30,60,120,300,600),
@@ -1469,7 +1486,7 @@ const struct settings_list settings[] = {
1469 LANG_SET_BOOL_YES, LANG_SET_BOOL_NO, NULL), 1486 LANG_SET_BOOL_YES, LANG_SET_BOOL_NO, NULL),
1470 1487
1471#ifdef HAVE_TAGCACHE 1488#ifdef HAVE_TAGCACHE
1472#if CONFIG_CODEC == SWCODEC 1489#if CONFIG_CODEC == SWCODEC
1473 BOOL_SETTING(0, autoresume_enable, LANG_AUTORESUME, false, 1490 BOOL_SETTING(0, autoresume_enable, LANG_AUTORESUME, false,
1474 "autoresume enable", off_on, 1491 "autoresume enable", off_on,
1475 LANG_SET_BOOL_YES, LANG_SET_BOOL_NO, NULL), 1492 LANG_SET_BOOL_YES, LANG_SET_BOOL_NO, NULL),
@@ -1482,7 +1499,7 @@ const struct settings_list settings[] = {
1482 ID2P(LANG_AUTORESUME_CUSTOM)), 1499 ID2P(LANG_AUTORESUME_CUSTOM)),
1483 TEXT_SETTING(0, autoresume_paths, "autoresume next track paths", 1500 TEXT_SETTING(0, autoresume_paths, "autoresume next track paths",
1484 "/podcast:/podcasts", NULL, NULL), 1501 "/podcast:/podcasts", NULL, NULL),
1485#endif 1502#endif
1486 1503
1487 OFFON_SETTING(0, runtimedb, LANG_RUNTIMEDB_ACTIVE, false, 1504 OFFON_SETTING(0, runtimedb, LANG_RUNTIMEDB_ACTIVE, false,
1488 "gather runtime data", NULL), 1505 "gather runtime data", NULL),
@@ -1741,11 +1758,11 @@ const struct settings_list settings[] = {
1741 CHOICE_SETTING(F_SOUNDSETTING|F_NO_WRAP, compressor_settings.knee, 1758 CHOICE_SETTING(F_SOUNDSETTING|F_NO_WRAP, compressor_settings.knee,
1742 LANG_COMPRESSOR_KNEE, 1, "compressor knee", 1759 LANG_COMPRESSOR_KNEE, 1, "compressor knee",
1743 "hard knee,soft knee", compressor_set, 2, 1760 "hard knee,soft knee", compressor_set, 2,
1744 ID2P(LANG_COMPRESSOR_HARD_KNEE), ID2P(LANG_COMPRESSOR_SOFT_KNEE)), 1761 ID2P(LANG_COMPRESSOR_HARD_KNEE), ID2P(LANG_COMPRESSOR_SOFT_KNEE)),
1745 INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.attack_time, 1762 INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.attack_time,
1746 LANG_COMPRESSOR_ATTACK, 5, 1763 LANG_COMPRESSOR_ATTACK, 5,
1747 "compressor attack time", UNIT_MS, 0, 30, 1764 "compressor attack time", UNIT_MS, 0, 30,
1748 5, NULL, NULL, compressor_set), 1765 5, NULL, NULL, compressor_set),
1749 INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.release_time, 1766 INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.release_time,
1750 LANG_COMPRESSOR_RELEASE, 500, 1767 LANG_COMPRESSOR_RELEASE, 500,
1751 "compressor release time", UNIT_MS, 100, 1000, 1768 "compressor release time", UNIT_MS, 100, 1000,
@@ -1933,38 +1950,38 @@ const struct settings_list settings[] = {
1933 UNIT_SEC, formatter_unit_0_is_skip_track, 1950 UNIT_SEC, formatter_unit_0_is_skip_track,
1934 getlang_unit_0_is_skip_track, NULL, 1951 getlang_unit_0_is_skip_track, NULL,
1935 19, -1,0,1,2,3,5,7,10,15,20,30,45,60,90,120,180,300,600,900), 1952 19, -1,0,1,2,3,5,7,10,15,20,30,45,60,90,120,180,300,600,900),
1936 CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, 1953 CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1,
1937 "start in screen", "previous,root,files," 1954 "start in screen", "previous,root,files,"
1938#ifdef HAVE_TAGCACHE 1955#ifdef HAVE_TAGCACHE
1939#define START_DB_COUNT 1 1956#define START_DB_COUNT 1
1940 "db," 1957 "db,"
1941#else 1958#else
1942#define START_DB_COUNT 0 1959#define START_DB_COUNT 0
1943#endif 1960#endif
1944 "wps,menu," 1961 "wps,menu,"
1945#ifdef HAVE_RECORDING 1962#ifdef HAVE_RECORDING
1946#define START_REC_COUNT 1 1963#define START_REC_COUNT 1
1947 "recording," 1964 "recording,"
1948#else 1965#else
1949#define START_REC_COUNT 0 1966#define START_REC_COUNT 0
1950#endif 1967#endif
1951#if CONFIG_TUNER 1968#if CONFIG_TUNER
1952#define START_TUNER_COUNT 1 1969#define START_TUNER_COUNT 1
1953 "radio," 1970 "radio,"
1954#else 1971#else
1955#define START_TUNER_COUNT 0 1972#define START_TUNER_COUNT 0
1956#endif 1973#endif
1957 "bookmarks" 1974 "bookmarks"
1958#ifdef HAVE_PICTUREFLOW_INTEGRATION 1975#ifdef HAVE_PICTUREFLOW_INTEGRATION
1959#define START_PF_COUNT 1 1976#define START_PF_COUNT 1
1960 ",pictureflow" 1977 ",pictureflow"
1961#else 1978#else
1962#define START_PF_COUNT 0 1979#define START_PF_COUNT 0
1963#endif 1980#endif
1964 , NULL, 1981 , NULL,
1965 (6 + START_DB_COUNT + START_REC_COUNT + START_TUNER_COUNT + START_PF_COUNT), 1982 (6 + START_DB_COUNT + START_REC_COUNT + START_TUNER_COUNT + START_PF_COUNT),
1966 ID2P(LANG_PREVIOUS_SCREEN), ID2P(LANG_MAIN_MENU), 1983 ID2P(LANG_PREVIOUS_SCREEN), ID2P(LANG_MAIN_MENU),
1967 ID2P(LANG_DIR_BROWSER), 1984 ID2P(LANG_DIR_BROWSER),
1968#ifdef HAVE_TAGCACHE 1985#ifdef HAVE_TAGCACHE
1969 ID2P(LANG_TAGCACHE), 1986 ID2P(LANG_TAGCACHE),
1970#endif 1987#endif
@@ -2025,7 +2042,7 @@ const struct settings_list settings[] = {
2025 2, "list_accel_start_delay", UNIT_SEC, 0, 10, 1, 2042 2, "list_accel_start_delay", UNIT_SEC, 0, 10, 1,
2026 formatter_unit_0_is_off, getlang_unit_0_is_off, NULL), 2043 formatter_unit_0_is_off, getlang_unit_0_is_off, NULL),
2027 INT_SETTING(0, list_accel_wait, LANG_LISTACCEL_ACCEL_SPEED, 2044 INT_SETTING(0, list_accel_wait, LANG_LISTACCEL_ACCEL_SPEED,
2028 3, "list_accel_wait", UNIT_SEC, 1, 10, 1, 2045 3, "list_accel_wait", UNIT_SEC, 1, 10, 1,
2029 scanaccel_formatter, getlang_unit_0_is_off, NULL), 2046 scanaccel_formatter, getlang_unit_0_is_off, NULL),
2030#endif /* HAVE_WHEEL_ACCELERATION */ 2047#endif /* HAVE_WHEEL_ACCELERATION */
2031#if CONFIG_CODEC == SWCODEC 2048#if CONFIG_CODEC == SWCODEC
@@ -2108,7 +2125,7 @@ const struct settings_list settings[] = {
2108 CHOICE_SETTING(0, touch_mode, LANG_TOUCHSCREEN_MODE, DEFAULT_TOUCHSCREEN_MODE, 2125 CHOICE_SETTING(0, touch_mode, LANG_TOUCHSCREEN_MODE, DEFAULT_TOUCHSCREEN_MODE,
2109 "touchscreen mode", "point,grid", NULL, 2, 2126 "touchscreen mode", "point,grid", NULL, 2,
2110 ID2P(LANG_TOUCHSCREEN_POINT), ID2P(LANG_TOUCHSCREEN_GRID)), 2127 ID2P(LANG_TOUCHSCREEN_POINT), ID2P(LANG_TOUCHSCREEN_GRID)),
2111 CUSTOM_SETTING(0, ts_calibration_data, -1, 2128 CUSTOM_SETTING(0, ts_calibration_data, -1,
2112 &default_calibration_parameters, "touchscreen calibration", 2129 &default_calibration_parameters, "touchscreen calibration",
2113 tsc_load_from_cfg, tsc_write_to_cfg, 2130 tsc_load_from_cfg, tsc_write_to_cfg,
2114 tsc_is_changed, tsc_set_default), 2131 tsc_is_changed, tsc_set_default),
@@ -2165,21 +2182,21 @@ const struct settings_list settings[] = {
2165 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_wps, 2182 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_wps,
2166 LANG_HOTKEY_WPS, HOTKEY_VIEW_PLAYLIST, "hotkey wps", 2183 LANG_HOTKEY_WPS, HOTKEY_VIEW_PLAYLIST, "hotkey wps",
2167 "off,view playlist,show track info,pitchscreen,open with,delete" 2184 "off,view playlist,show track info,pitchscreen,open with,delete"
2168#ifdef HAVE_PICTUREFLOW_INTEGRATION 2185#ifdef HAVE_PICTUREFLOW_INTEGRATION
2169 ",pictureflow" 2186 ",pictureflow"
2170#endif 2187#endif
2171 ,UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, 2188 ,UNIT_INT, hotkey_formatter, hotkey_getlang, NULL,
2172#ifdef HAVE_PICTUREFLOW_INTEGRATION 2189#ifdef HAVE_PICTUREFLOW_INTEGRATION
2173 7, 2190 7,
2174#else 2191#else
2175 6, 2192 6,
2176#endif 2193#endif
2177 HOTKEY_OFF, 2194 HOTKEY_OFF,
2178 HOTKEY_VIEW_PLAYLIST, HOTKEY_SHOW_TRACK_INFO, HOTKEY_PITCHSCREEN, 2195 HOTKEY_VIEW_PLAYLIST, HOTKEY_SHOW_TRACK_INFO, HOTKEY_PITCHSCREEN,
2179 HOTKEY_OPEN_WITH, HOTKEY_DELETE 2196 HOTKEY_OPEN_WITH, HOTKEY_DELETE
2180#ifdef HAVE_PICTUREFLOW_INTEGRATION 2197#ifdef HAVE_PICTUREFLOW_INTEGRATION
2181 , HOTKEY_PICTUREFLOW 2198 , HOTKEY_PICTUREFLOW
2182#endif 2199#endif
2183 ), 2200 ),
2184 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree, 2201 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree,
2185 LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree", 2202 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 {
89#define F_CHOICE_SETTING 0x100 89#define F_CHOICE_SETTING 0x100
90#define F_CHOICETALKS 0x200 /* uses .talks in the above struct for the talks */ 90#define F_CHOICETALKS 0x200 /* uses .talks in the above struct for the talks */
91 /* and cfg_vals for the strings to display */ 91 /* and cfg_vals for the strings to display */
92 92
93struct table_setting { 93struct table_setting {
94 void (*option_callback)(int); 94 void (*option_callback)(int);
95 const char* (*formatter)(char*, size_t, int, const char*); 95 const char* (*formatter)(char*, size_t, int, const char*);
@@ -113,7 +113,7 @@ struct table_setting {
113struct custom_setting { 113struct custom_setting {
114 /* load the saved value from the .cfg 114 /* load the saved value from the .cfg
115 setting: pointer into global_settings 115 setting: pointer into global_settings
116 value: the text from the .cfg 116 value: the text from the .cfg
117 */ 117 */
118 void (*load_from_cfg)(void* setting, char*value); 118 void (*load_from_cfg)(void* setting, char*value);
119 /* store the value into a .cfg 119 /* store the value into a .cfg
diff --git a/docs/CREDITS b/docs/CREDITS
index 85487d3611..c18c444a18 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -654,6 +654,7 @@ Udo Schläpfer
654Thomas White 654Thomas White
655Karl Huber 655Karl Huber
656Adam Sampson 656Adam Sampson
657William Wilgus
657 658
658The libmad team 659The libmad team
659The wavpack team 660The wavpack team
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 19a1d21eb5..25c295197f 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -103,6 +103,8 @@ static void backlight_thread(void);
103static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)]; 103static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)];
104static const char backlight_thread_name[] = "backlight"; 104static const char backlight_thread_name[] = "backlight";
105static struct event_queue backlight_queue SHAREDBSS_ATTR; 105static struct event_queue backlight_queue SHAREDBSS_ATTR;
106static bool ignore_backlight_on = false;
107static int backlight_ignored_timer = 0;
106#ifdef BACKLIGHT_DRIVER_CLOSE 108#ifdef BACKLIGHT_DRIVER_CLOSE
107static unsigned int backlight_thread_id = 0; 109static unsigned int backlight_thread_id = 0;
108#endif 110#endif
@@ -123,6 +125,8 @@ static void backlight_timeout_handler(void);
123#ifdef HAVE_BUTTON_LIGHT 125#ifdef HAVE_BUTTON_LIGHT
124static int buttonlight_timer; 126static int buttonlight_timer;
125static int buttonlight_timeout = 5*HZ; 127static int buttonlight_timeout = 5*HZ;
128static bool ignore_buttonlight_on = false;
129static int buttonlight_ignored_timer = 0;
126 130
127/* Update state of buttonlight according to timeout setting */ 131/* Update state of buttonlight according to timeout setting */
128static void buttonlight_update_state(void) 132static void buttonlight_update_state(void)
@@ -140,10 +144,20 @@ static void buttonlight_update_state(void)
140} 144}
141 145
142/* external interface */ 146/* external interface */
147
143void buttonlight_on(void) 148void buttonlight_on(void)
144{ 149{
145 queue_remove_from_head(&backlight_queue, BUTTON_LIGHT_ON); 150 if(!ignore_buttonlight_on)
146 queue_post(&backlight_queue, BUTTON_LIGHT_ON, 0); 151 {
152 queue_remove_from_head(&backlight_queue, BUTTON_LIGHT_ON);
153 queue_post(&backlight_queue, BUTTON_LIGHT_ON, 0);
154 }
155}
156
157void buttonlight_on_ignore(bool value, int timeout)
158{
159 ignore_buttonlight_on = value;
160 buttonlight_ignored_timer = timeout;
147} 161}
148 162
149void buttonlight_off(void) 163void buttonlight_off(void)
@@ -232,7 +246,7 @@ static int backlight_fading_state = NOT_FADING;
232/* s15.16 fixed point variables */ 246/* s15.16 fixed point variables */
233static int32_t bl_fade_in_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16)/300; 247static int32_t bl_fade_in_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16)/300;
234static int32_t bl_fade_out_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16)/2000; 248static int32_t bl_fade_out_step = ((BL_PWM_INTERVAL*BL_PWM_COUNT)<<16)/2000;
235static int32_t bl_dim_fraction = 0; 249static int32_t bl_dim_fraction = 0;
236 250
237static int bl_dim_target = 0; 251static int bl_dim_target = 0;
238static int bl_dim_current = 0; 252static int bl_dim_current = 0;
@@ -642,7 +656,7 @@ void backlight_thread(void)
642 buttonlight_hw_off(); 656 buttonlight_hw_off();
643 break; 657 break;
644#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS 658#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
645 case BUTTON_LIGHT_BRIGHTNESS_CHANGED: 659 case BUTTON_LIGHT_BRIGHTNESS_CHANGED:
646 buttonlight_hw_brightness((int)ev.data); 660 buttonlight_hw_brightness((int)ev.data);
647 break; 661 break;
648#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ 662#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
@@ -723,7 +737,19 @@ static void backlight_timeout_handler(void)
723 buttonlight_hw_off(); 737 buttonlight_hw_off();
724 } 738 }
725 } 739 }
740 if (buttonlight_ignored_timer > 0)
741 {
742 buttonlight_ignored_timer -= BACKLIGHT_THREAD_TIMEOUT;
743 if (buttonlight_ignored_timer <= 0)
744 ignore_buttonlight_on = false;
745 }
726#endif /* HAVE_BUTTON_LIGHT */ 746#endif /* HAVE_BUTTON_LIGHT */
747 if (backlight_ignored_timer > 0)
748 {
749 backlight_ignored_timer -= BACKLIGHT_THREAD_TIMEOUT;
750 if (backlight_ignored_timer <= 0)
751 ignore_backlight_on = false;
752 }
727} 753}
728 754
729void backlight_init(void) 755void backlight_init(void)
@@ -768,8 +794,17 @@ void backlight_close(void)
768 794
769void backlight_on(void) 795void backlight_on(void)
770{ 796{
771 queue_remove_from_head(&backlight_queue, BACKLIGHT_ON); 797 if(!ignore_backlight_on)
772 queue_post(&backlight_queue, BACKLIGHT_ON, 0); 798 {
799 queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
800 queue_post(&backlight_queue, BACKLIGHT_ON, 0);
801 }
802}
803
804void backlight_on_ignore(bool value, int timeout)
805{
806 ignore_backlight_on = value;
807 backlight_ignored_timer = timeout;
773} 808}
774 809
775void backlight_off(void) 810void backlight_off(void)
@@ -829,8 +864,13 @@ void backlight_set_timeout_plugged(int value)
829void backlight_hold_changed(bool hold_button) 864void backlight_hold_changed(bool hold_button)
830{ 865{
831 if (!hold_button || (backlight_on_button_hold > 0)) 866 if (!hold_button || (backlight_on_button_hold > 0))
867 {
832 /* if unlocked or override in effect */ 868 /* if unlocked or override in effect */
833 backlight_on(); 869
870 /*backlight_on(); REMOVED*/
871 queue_remove_from_head(&backlight_queue, BACKLIGHT_ON);
872 queue_post(&backlight_queue, BACKLIGHT_ON, 0);
873 }
834} 874}
835 875
836void backlight_set_on_button_hold(int index) 876void backlight_set_on_button_hold(int index)
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index 40efd63e17..19e5f9b91b 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -31,6 +31,7 @@
31#endif 31#endif
32 32
33bool is_backlight_on(bool ignore_always_off); 33bool is_backlight_on(bool ignore_always_off);
34void backlight_on_ignore(bool value, int timeout);
34void backlight_on(void); 35void backlight_on(void);
35void backlight_off(void); 36void backlight_off(void);
36void backlight_set_timeout(int value); 37void backlight_set_timeout(int value);
@@ -38,7 +39,6 @@ void backlight_set_timeout(int value);
38#ifdef HAVE_BACKLIGHT 39#ifdef HAVE_BACKLIGHT
39void backlight_init(void) INIT_ATTR; 40void backlight_init(void) INIT_ATTR;
40void backlight_close(void); 41void backlight_close(void);
41
42int backlight_get_current_timeout(void); 42int backlight_get_current_timeout(void);
43 43
44#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) 44#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
@@ -99,6 +99,7 @@ void buttonlight_set_brightness(int val);
99#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ 99#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
100 100
101#ifdef HAVE_BUTTON_LIGHT 101#ifdef HAVE_BUTTON_LIGHT
102void buttonlight_on_ignore(bool value, int timeout);
102void buttonlight_on(void); 103void buttonlight_on(void);
103void buttonlight_off(void); 104void buttonlight_off(void);
104void buttonlight_set_timeout(int value); 105void buttonlight_set_timeout(int value);
diff --git a/manual/advanced_topics/main.tex b/manual/advanced_topics/main.tex
index 9ddf680106..92dddb33db 100644..100755
--- a/manual/advanced_topics/main.tex
+++ b/manual/advanced_topics/main.tex
@@ -62,12 +62,12 @@ in the font package at \url{http://www.rockbox.org/daily.shtml}.}
62 62
63\subsection{\label{ref:Loadinglanguages}Loading Languages} 63\subsection{\label{ref:Loadinglanguages}Loading Languages}
64\index{Language files}% 64\index{Language files}%
65Rockbox can load language files at runtime. Simply copy the \fname{.lng} file 65Rockbox can load language files at runtime. Simply copy the \fname{.lng} file
66\emph{(do not use the .lang file)} to the \dap\ and ``play'' it in the 66\emph{(do not use the .lang file)} to the \dap\ and ``play'' it in the
67Rockbox directory browser or select \setting{Settings $\rightarrow$ 67Rockbox directory browser or select \setting{Settings $\rightarrow$
68General Settings $\rightarrow$ Language }from the \setting{Main Menu}.\\ 68General Settings $\rightarrow$ Language }from the \setting{Main Menu}.\\
69 69
70\note{If you want a language to be loaded automatically every time you start 70\note{If you want a language to be loaded automatically every time you start
71up, it must be located in the \fname{/.rockbox/langs} directory and the filename 71up, it must be located in the \fname{/.rockbox/langs} directory and the filename
72must be a maximum of 24 characters long.\\} 72must be a maximum of 24 characters long.\\}
73 73
@@ -78,7 +78,7 @@ file find the instructions on the Rockbox website:
78\opt{lcd_color}{ 78\opt{lcd_color}{
79 \subsection{\label{ref:ChangingFiletypeColours}Changing Filetype Colours} 79 \subsection{\label{ref:ChangingFiletypeColours}Changing Filetype Colours}
80 Rockbox has the capability to modify the \setting{File Browser} to show 80 Rockbox has the capability to modify the \setting{File Browser} to show
81 files of different types in different colours, depending on the file extension. 81 files of different types in different colours, depending on the file extension.
82 82
83 \subsubsection{Set-up} 83 \subsubsection{Set-up}
84 There are two steps to changing the filetype colours -- creating 84 There are two steps to changing the filetype colours -- creating
@@ -100,7 +100,7 @@ file find the instructions on the Rockbox website:
100 \config{???:FFFFFF}\\* 100 \config{???:FFFFFF}\\*
101 101
102 The permissible extensions are as follows:\\* 102 The permissible extensions are as follows:\\*
103 \\ 103 \\
104 \config{folder, m3u, m3u8, cfg, wps, lng, rock, bmark, cue, colours, mpa, 104 \config{folder, m3u, m3u8, cfg, wps, lng, rock, bmark, cue, colours, mpa,
105 \firmwareextension{}, % 105 \firmwareextension{}, %
106 \opt{swcodec}{mp1, }mp2, mp3% 106 \opt{swcodec}{mp1, }mp2, mp3%
@@ -140,7 +140,7 @@ file find the instructions on the Rockbox website:
140 automatically understands the 140 automatically understands the
141 \fname{.colours} file format, but an external text editor can 141 \fname{.colours} file format, but an external text editor can
142 also be used. To edit the \fname{.colours} file using Rockbox, 142 also be used. To edit the \fname{.colours} file using Rockbox,
143 ``play'' it in the \setting{File Browser}. The file will open in 143 ``play'' it in the \setting{File Browser}. The file will open in
144 the \setting{Text Editor}. Upon selecting a line, the following choices 144 the \setting{Text Editor}. Upon selecting a line, the following choices
145 will appear:\\* 145 will appear:\\*
146 \\ 146 \\
@@ -172,7 +172,7 @@ file find the instructions on the Rockbox website:
172 \subsection{UI Viewport} 172 \subsection{UI Viewport}
173 By default, the UI is drawn on the whole screen. This can be changed so that 173 By default, the UI is drawn on the whole screen. This can be changed so that
174 the UI is confined to a specific area of the screen, by use of a UI 174 the UI is confined to a specific area of the screen, by use of a UI
175 viewport. This is done by adding the following line to the 175 viewport. This is done by adding the following line to the
176 \fname{.cfg} file for a theme:\\* 176 \fname{.cfg} file for a theme:\\*
177 177
178 \nopt{lcd_non-mono}{\config{ui viewport: X,Y,[width],[height],[font]}} 178 \nopt{lcd_non-mono}{\config{ui viewport: X,Y,[width],[height],[font]}}
@@ -196,7 +196,7 @@ file find the instructions on the Rockbox website:
196 } 196 }
197 197
198 Only the first two parameters \emph{have} to be specified, the others can 198 Only the first two parameters \emph{have} to be specified, the others can
199 be omitted using `-' as a placeholder. The syntax is very similar to WPS 199 be omitted using `-' as a placeholder. The syntax is very similar to WPS
200 viewports (see \reference{ref:Viewports}). Briefly: 200 viewports (see \reference{ref:Viewports}). Briefly:
201 201
202 \nopt{lcd_non-mono}{\input{advanced_topics/viewports/mono-uivp-syntax.tex}} 202 \nopt{lcd_non-mono}{\input{advanced_topics/viewports/mono-uivp-syntax.tex}}
@@ -226,7 +226,7 @@ file find the instructions on the Rockbox website:
226 226
227\subsection{\label{ref:CreateYourOwnWPS}Themes -- Create Your Own} 227\subsection{\label{ref:CreateYourOwnWPS}Themes -- Create Your Own}
228The theme files are simple text files, and can be created (or edited) in your 228The theme files are simple text files, and can be created (or edited) in your
229favourite text editor. To make sure non-English characters 229favourite text editor. To make sure non-English characters
230display correctly in your theme you must save the theme files with UTF-8 230display correctly in your theme you must save the theme files with UTF-8
231character encoding. This can be done in most editors, for example Notepad in 231character encoding. This can be done in most editors, for example Notepad in
232Windows 2000 or XP (but not in 9x/ME) can do this. 232Windows 2000 or XP (but not in 9x/ME) can do this.
@@ -236,7 +236,7 @@ Windows 2000 or XP (but not in 9x/ME) can do this.
236 WPS files have the extension \fname{.wps}, FM screen files have the extension 236 WPS files have the extension \fname{.wps}, FM screen files have the extension
237 \fname{.fms}, and SBS files have the extension \fname{.sbs}. The main theme 237 \fname{.fms}, and SBS files have the extension \fname{.sbs}. The main theme
238 file has the extension \fname{.cfg}. All files should have the same name. 238 file has the extension \fname{.cfg}. All files should have the same name.
239 239
240 The theme \fname{.cfg} file should be placed in the \fname{/.rockbox/themes} 240 The theme \fname{.cfg} file should be placed in the \fname{/.rockbox/themes}
241 directory, while the \fname{.wps}, \fname{.fms} and \fname{.sbs} files should 241 directory, while the \fname{.wps}, \fname{.fms} and \fname{.sbs} files should
242 be placed in the \fname{/.rockbox/wps} directory. Any images used by the 242 be placed in the \fname{/.rockbox/wps} directory. Any images used by the
@@ -269,19 +269,19 @@ are discussed below.
269\subsubsection{\label{ref:Viewports}Viewports} 269\subsubsection{\label{ref:Viewports}Viewports}
270 270
271By default, a viewport filling the whole screen contains all the elements 271By default, a viewport filling the whole screen contains all the elements
272defined in each theme file. The 272defined in each theme file. The
273\opt{lcd_non-mono}{elements in this viewport are displayed 273\opt{lcd_non-mono}{elements in this viewport are displayed
274 with the same background/\linebreak{}foreground 274 with the same background/\linebreak{}foreground
275 \opt{lcd_color}{colours}\nopt{lcd_color}{shades} and the} 275 \opt{lcd_color}{colours}\nopt{lcd_color}{shades} and the}
276text is rendered in the 276text is rendered in the
277same font as in the main menu. To change this behaviour a custom viewport can 277same font as in the main menu. To change this behaviour a custom viewport can
278be defined. A viewport is a rectangular window on the screen% 278be defined. A viewport is a rectangular window on the screen%
279\opt{lcd_non-mono}{ with its own foreground/background 279\opt{lcd_non-mono}{ with its own foreground/background
280\opt{lcd_color}{colours}\nopt{lcd_color}{shades}}. 280\opt{lcd_color}{colours}\nopt{lcd_color}{shades}}.
281This window also has variable dimensions. To 281This window also has variable dimensions. To
282define a viewport a line starting \config{{\%V(\dots}} has to be 282define a viewport a line starting \config{{\%V(\dots}} has to be
283present in the theme file. The full syntax will be explained later in 283present in the theme file. The full syntax will be explained later in
284this section. All elements placed before the 284this section. All elements placed before the
285line defining a viewport are displayed in the default viewport. Elements 285line defining a viewport are displayed in the default viewport. Elements
286defined after a viewport declaration are drawn within that viewport. 286defined after a viewport declaration are drawn within that viewport.
287\opt{lcd_bitmap}{Loading images (see Appendix \reference{ref:wps_images}) 287\opt{lcd_bitmap}{Loading images (see Appendix \reference{ref:wps_images})
@@ -390,25 +390,25 @@ and the WPS, but you can use multiple fonts in each of the individual screens.\\
390\item[If/else: ] 390\item[If/else: ]
391Syntax: \config{\%?xx{\textless}true{\textbar}false{\textgreater}} 391Syntax: \config{\%?xx{\textless}true{\textbar}false{\textgreater}}
392 392
393If the tag specified by ``\config{xx}'' has a value, the text between the 393If the tag specified by ``\config{xx}'' has a value, the text between the
394``\config{{\textless}}'' and the ``\config{{\textbar}}'' is displayed (the true 394``\config{{\textless}}'' and the ``\config{{\textbar}}'' is displayed (the true
395part), else the text between the ``\config{{\textbar}}'' and the 395part), else the text between the ``\config{{\textbar}}'' and the
396``\config{{\textgreater}}'' is displayed (the false part). 396``\config{{\textgreater}}'' is displayed (the false part).
397The else part is optional, so the ``\config{{\textbar}}'' does not have to be 397The else part is optional, so the ``\config{{\textbar}}'' does not have to be
398specified if no else part is desired. The conditionals nest, so the text in the 398specified if no else part is desired. The conditionals nest, so the text in the
399if and else part can contain all \config{\%} commands, including conditionals. 399if and else part can contain all \config{\%} commands, including conditionals.
400 400
401\item[Enumerations: ] 401\item[Enumerations: ]
402Syntax: \config{\%?xx{\textless}alt1{\textbar}alt2{\textbar}alt3{\textbar}\dots{\textbar}else{\textgreater}} 402Syntax: \config{\%?xx{\textless}alt1{\textbar}alt2{\textbar}alt3{\textbar}\dots{\textbar}else{\textgreater}}
403 403
404For tags with multiple values, like Play status, the conditional can hold a 404For tags with multiple values, like Play status, the conditional can hold a
405list of alternatives, one for each value the tag can have. 405list of alternatives, one for each value the tag can have.
406Example enumeration: 406Example enumeration:
407\begin{example} 407\begin{example}
408 \%?mp{\textless}Stop{\textbar}Play{\textbar}Pause{\textbar}Ffwd{\textbar}Rew{\textgreater} 408 \%?mp{\textless}Stop{\textbar}Play{\textbar}Pause{\textbar}Ffwd{\textbar}Rew{\textgreater}
409\end{example} 409\end{example}
410 410
411The last else part is optional, and will be displayed if the tag has no value. 411The last else part is optional, and will be displayed if the tag has no value.
412The WPS parser will always display the last part if the tag has no value, or if 412The WPS parser will always display the last part if the tag has no value, or if
413the list of alternatives is too short. 413the list of alternatives is too short.
414\end{description} 414\end{description}
@@ -419,8 +419,8 @@ about to play after the one currently playing (unless you change the
419plan). 419plan).
420 420
421If you use the upper-case versions of the 421If you use the upper-case versions of the
422three tags: \config{F}, \config{I} and \config{D}, they will instead refer to 422three tags: \config{F}, \config{I} and \config{D}, they will instead refer to
423the next song instead of the current one. Example: \config{\%Ig} is the genre 423the next song instead of the current one. Example: \config{\%Ig} is the genre
424name used in the next song and \config{\%Ff} is the mp3 frequency.\\ 424name used in the next song and \config{\%Ff} is the mp3 frequency.\\
425 425
426\note{The next song information \emph{will not} be available at all 426\note{The next song information \emph{will not} be available at all
@@ -430,8 +430,8 @@ name used in the next song and \config{\%Ff} is the mp3 frequency.\\
430 430
431\subsubsection{\label{ref:AlternatingSublines}Alternating Sublines} 431\subsubsection{\label{ref:AlternatingSublines}Alternating Sublines}
432 432
433It is possible to group items on each line into 2 or more groups or 433It is possible to group items on each line into 2 or more groups or
434``sublines''. Each subline will be displayed in succession on the line for a 434``sublines''. Each subline will be displayed in succession on the line for a
435specified time, alternating continuously through each defined subline. 435specified time, alternating continuously through each defined subline.
436 436
437Items on a line are broken into sublines with the semicolon 437Items on a line are broken into sublines with the semicolon
@@ -439,9 +439,9 @@ Items on a line are broken into sublines with the semicolon
439each subline defaults to 2 seconds unless modified by using the 439each subline defaults to 2 seconds unless modified by using the
440`\config{\%t}' tag to specify an alternate 440`\config{\%t}' tag to specify an alternate
441time (in seconds and optional tenths of a second) for the subline to be 441time (in seconds and optional tenths of a second) for the subline to be
442displayed. 442displayed.
443 443
444Subline related special characters and tags: 444Subline related special characters and tags:
445\begin{description} 445\begin{description}
446\item[;] Split items on a line into separate sublines 446\item[;] Split items on a line into separate sublines
447\item[\%t] Set the subline display time. The 447\item[\%t] Set the subline display time. The
@@ -469,7 +469,7 @@ Example subline with conditionals:
469 %?it{\textless}%t(8)%s%it{\textbar}%s%fn{\textgreater};%?ia{\textless}%t(3)%s%ia{\textbar}%t(0){\textgreater}\\ 469 %?it{\textless}%t(8)%s%it{\textbar}%s%fn{\textgreater};%?ia{\textless}%t(3)%s%ia{\textbar}%t(0){\textgreater}\\
470\end{example} 470\end{example}
471 471
472The format above will do two different things depending if ID3 tags are 472The format above will do two different things depending if ID3 tags are
473present. If the ID3 artist and title are present: 473present. If the ID3 artist and title are present:
474\begin{itemize} 474\begin{itemize}
475\item Display id3 title for 8 seconds, 475\item Display id3 title for 8 seconds,
@@ -481,17 +481,17 @@ If the ID3 artist and title are not present:
481\item Display the filename continuously. 481\item Display the filename continuously.
482\end{itemize} 482\end{itemize}
483Note that by using a subline display time of 0 in one branch of a conditional, 483Note that by using a subline display time of 0 in one branch of a conditional,
484a subline can be skipped (not displayed) when that condition is met. 484a subline can be skipped (not displayed) when that condition is met.
485 485
486\subsubsection{Using Images} 486\subsubsection{Using Images}
487You can have as many as 52 images in your WPS. There are various ways of 487You can have as many as 52 images in your WPS. There are various ways of
488displaying images: 488displaying images:
489\begin{enumerate} 489\begin{enumerate}
490 \item Load and always show the image, using the \config{\%x} tag 490 \item Load and always show the image, using the \config{\%x} tag
491 \item Preload the image with \config{\%xl} and show it with \config{\%xd}. 491 \item Preload the image with \config{\%xl} and show it with \config{\%xd}.
492 This way you can have your images displayed conditionally. 492 This way you can have your images displayed conditionally.
493 \nopt{archos}{% 493 \nopt{archos}{%
494 \item Load an image and show as backdrop using the \config{\%X} tag. The 494 \item Load an image and show as backdrop using the \config{\%X} tag. The
495 image must be of the same exact dimensions as your display. 495 image must be of the same exact dimensions as your display.
496 }% 496 }%
497\end{enumerate} 497\end{enumerate}
@@ -514,12 +514,12 @@ Example on bitmap preloading and use:
514 %xl(e,rep\_shuffle.bmp,16,64) 514 %xl(e,rep\_shuffle.bmp,16,64)
515 %?mm<%xd(b)|%xd(c)|%xd(d)|%xd(e)> 515 %?mm<%xd(b)|%xd(c)|%xd(d)|%xd(e)>
516\end{example} 516\end{example}
517Four images at the same x and y position are preloaded in the example. Which 517Four images at the same x and y position are preloaded in the example. Which
518image to display is determined by the \config{\%mm} tag (the repeat mode). 518image to display is determined by the \config{\%mm} tag (the repeat mode).
519 519
520\subsubsection{Example File} 520\subsubsection{Example File}
521\begin{example} 521\begin{example}
522 %s%?in<%in - >%?it<%it|%fn> %?ia<[%ia%?id<, %id>]> 522 %s%?in<%in - >%?it<%it|%fn> %?ia<[%ia%?id<, %id>]>
523 %pb%pc/%pt 523 %pb%pc/%pt
524\end{example} 524\end{example}
525That is, ``tracknum -- title [artist, album]'', where most fields are only 525That is, ``tracknum -- title [artist, album]'', where most fields are only
@@ -531,7 +531,7 @@ title [artist]''.
531% %s%?it<%?in<%in. |>%it|%fn> 531% %s%?it<%?in<%in. |>%it|%fn>
532% %s%?ia<%ia|%?d2<%d(2)|(root)>> 532% %s%?ia<%ia|%?d2<%d(2)|(root)>>
533% %s%?id<%id|%?d1<%d(1)|(root)>> %?iy<(%iy)|> 533% %s%?id<%id|%?d1<%d(1)|(root)>> %?iy<(%iy)|>
534% 534%
535% %al%pc/%pt%ar[%pp:%pe] 535% %al%pc/%pt%ar[%pp:%pe]
536% %fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)> 536% %fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>
537% %pb 537% %pb
@@ -552,25 +552,25 @@ a \fname{car.cfg} file for the settings that you use while playing your
552jukebox in your car, and a \fname{headphones.cfg} file to store the 552jukebox in your car, and a \fname{headphones.cfg} file to store the
553settings that you use while listening to your \dap{} through headphones. 553settings that you use while listening to your \dap{} through headphones.
554 554
555See \reference{ref:cfg_specs} below for an explanation of the format 555See \reference{ref:cfg_specs} below for an explanation of the format
556for configuration files. See \reference{ref:manage_settings_menu} for an 556for configuration files. See \reference{ref:manage_settings_menu} for an
557explanation of how to create, edit and load configuration files. 557explanation of how to create, edit and load configuration files.
558 558
559\subsection{\label{ref:cfg_specs}Specifications for \fname{.cfg} Files} 559\subsection{\label{ref:cfg_specs}Specifications for \fname{.cfg} Files}
560 560
561The Rockbox configuration file is a plain text file, so once you use the 561The Rockbox configuration file is a plain text file, so once you use the
562\setting{Save .cfg file} option to create the file, you can edit the file on 562\setting{Save .cfg file} option to create the file, you can edit the file on
563your computer using any text editor program. See 563your computer using any text editor program. See
564Appendix \reference{ref:config_file_options} for available settings. Configuration 564Appendix \reference{ref:config_file_options} for available settings. Configuration
565files use the following formatting rules: % 565files use the following formatting rules: %
566 566
567\begin{enumerate} 567\begin{enumerate}
568\item Each setting must be on a separate line. 568\item Each setting must be on a separate line.
569\item Each line has the format ``setting: value''. 569\item Each line has the format ``setting: value''.
570\item Values must be within the ranges specified in this manual for each 570\item Values must be within the ranges specified in this manual for each
571 setting. 571 setting.
572\item Lines starting with \# are ignored. This lets you write comments into 572\item Lines starting with \# are ignored. This lets you write comments into
573 your configuration files. 573 your configuration files.
574\end{enumerate} 574\end{enumerate}
575 575
576Example of a configuration file: 576Example of a configuration file:
@@ -586,17 +586,17 @@ Example of a configuration file:
586 lang: /.rockbox/afrikaans.lng 586 lang: /.rockbox/afrikaans.lng
587\end{example} 587\end{example}
588 588
589\note{As you can see from the example, configuration files do not need to 589\note{As you can see from the example, configuration files do not need to
590 contain all of the Rockbox options. You can create configuration files 590 contain all of the Rockbox options. You can create configuration files
591 that change only certain settings. So, for example, suppose you 591 that change only certain settings. So, for example, suppose you
592 typically use the \dap{} at one volume in the car, and another when using 592 typically use the \dap{} at one volume in the car, and another when using
593 headphones. Further, suppose you like to use an inverse LCD when you are 593 headphones. Further, suppose you like to use an inverse LCD when you are
594 in the car, and a regular LCD setting when you are using headphones. You 594 in the car, and a regular LCD setting when you are using headphones. You
595 could create configuration files that control only the volume and LCD 595 could create configuration files that control only the volume and LCD
596 settings. Create a few different files with different settings, give 596 settings. Create a few different files with different settings, give
597 each file a different name (such as \fname{car.cfg}, 597 each file a different name (such as \fname{car.cfg},
598 \fname{headphones.cfg}, etc.), and you can then use the \setting{Browse .cfg 598 \fname{headphones.cfg}, etc.), and you can then use the \setting{Browse .cfg
599 files} option to quickly change settings.\\} 599 files} option to quickly change settings.\\}
600 600
601 A special case configuration file can be used to force a particular setting 601 A special case configuration file can be used to force a particular setting
602 or settings every time Rockbox starts up (e.g. to set the volume to a safe 602 or settings every time Rockbox starts up (e.g. to set the volume to a safe
@@ -604,35 +604,35 @@ Example of a configuration file:
604 and save it into the \fname{/.rockbox} directory with the filename 604 and save it into the \fname{/.rockbox} directory with the filename
605 \fname{fixed.cfg}. 605 \fname{fixed.cfg}.
606 606
607\subsection{\label{ref:manage_settings_menu}The \setting{Manage Settings} 607\subsection{\label{ref:manage_settings_menu}The \setting{Manage Settings}
608 menu} The \setting{Manage Settings} menu can be found in the \setting{Main 608 menu} The \setting{Manage Settings} menu can be found in the \setting{Main
609 Menu}. The \setting{Manage Settings} menu allows you to save and load 609 Menu}. The \setting{Manage Settings} menu allows you to save and load
610 \fname{.cfg} files. 610 \fname{.cfg} files.
611 611
612\begin{description} 612\begin{description}
613 613
614\item [Browse .cfg Files]Opens the \setting{File Browser} in the 614\item [Browse .cfg Files]Opens the \setting{File Browser} in the
615 \fname{/.rockbox} directory and displays all \fname{.cfg} (configuration) 615 \fname{/.rockbox} directory and displays all \fname{.cfg} (configuration)
616 files. Selecting a \fname{.cfg} file will cause Rockbox to load the settings 616 files. Selecting a \fname{.cfg} file will cause Rockbox to load the settings
617 contained in that file. Pressing \ActionStdCancel{} will exit back to the 617 contained in that file. Pressing \ActionStdCancel{} will exit back to the
618 \setting{Manage Settings} menu. See the \setting{Write .cfg files} option on 618 \setting{Manage Settings} menu. See the \setting{Write .cfg files} option on
619 the \setting{Manage Settings} menu for details of how to save and edit a 619 the \setting{Manage Settings} menu for details of how to save and edit a
620 configuration file. 620 configuration file.
621 621
622\item [Reset Settings]This wipes the saved settings 622\item [Reset Settings]This wipes the saved settings
623 in the \dap{} and resets all settings to their default values. 623 in the \dap{} and resets all settings to their default values.
624 624
625 \opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD,SANSA_E200_PAD,SANSA_C200_PAD% 625 \opt{IRIVER_H100_PAD,IRIVER_H300_PAD,IAUDIO_X5_PAD,SANSA_E200_PAD,SANSA_C200_PAD%
626 ,PBELL_VIBE500_PAD,SAMSUNG_YH92X_PAD,SAMSUNG_YH820_PAD}{ 626 ,PBELL_VIBE500_PAD,SAMSUNG_YH92X_PAD,SAMSUNG_YH820_PAD}{
627 \note{You can also reset all settings to their default 627 \note{You can also reset all settings to their default
628 values by turning off the \dap, turning it back on, and holding the 628 values by turning off the \dap, turning it back on, and holding the
629 \ButtonRec{} button immediately after the \dap{} turns on.} 629 \ButtonRec{} button immediately after the \dap{} turns on.}
630 } 630 }
631 \opt{IRIVER_H10_PAD}{\note{You can also reset all settings to 631 \opt{IRIVER_H10_PAD}{\note{You can also reset all settings to
632 their default values by turning off the \dap, and turning it back on 632 their default values by turning off the \dap, and turning it back on
633 with the \ButtonHold{} button on.} 633 with the \ButtonHold{} button on.}
634 } 634 }
635 \opt{IPOD_4G_PAD}{\note{You can also reset all settings to their default 635 \opt{IPOD_4G_PAD}{\note{You can also reset all settings to their default
636 values by turning off the \dap, turning it back on, and activating the 636 values by turning off the \dap, turning it back on, and activating the
637 \ButtonHold{} button immediately after the backlight comes on.} 637 \ButtonHold{} button immediately after the backlight comes on.}
638 } 638 }
@@ -641,23 +641,23 @@ Example of a configuration file:
641 \ButtonA{} button immediately after the \dap{} turns on.} 641 \ButtonA{} button immediately after the \dap{} turns on.}
642 } 642 }
643 643
644\item [Save .cfg File]This option writes a \fname{.cfg} file to 644\item [Save .cfg File]This option writes a \fname{.cfg} file to
645 your \daps{} disk. The configuration file has the \fname{.cfg} 645 your \daps{} disk. The configuration file has the \fname{.cfg}
646 extension and is used to store all of the user settings that are described 646 extension and is used to store all of the user settings that are described
647 throughout this manual. 647 throughout this manual.
648 648
649 Hint: Use the \setting{Save .cfg File} feature (\setting{Main Menu 649 Hint: Use the \setting{Save .cfg File} feature (\setting{Main Menu
650 $\rightarrow$ Manage Settings}) to save the current settings, then 650 $\rightarrow$ Manage Settings}) to save the current settings, then
651 use a text editor to customize the settings file. See Appendix 651 use a text editor to customize the settings file. See Appendix
652 \reference{ref:config_file_options} for the full reference of available 652 \reference{ref:config_file_options} for the full reference of available
653 options. 653 options.
654 654
655\item [Save Sound Settings]This option writes a \fname{.cfg} file to 655\item [Save Sound Settings]This option writes a \fname{.cfg} file to
656 your \daps{} disk. The configuration file has the \fname{.cfg} 656 your \daps{} disk. The configuration file has the \fname{.cfg}
657 extension and is used to store all of the sound related settings. 657 extension and is used to store all of the sound related settings.
658 658
659\item [Save Theme Settings]This option writes a \fname{.cfg} file to 659\item [Save Theme Settings]This option writes a \fname{.cfg} file to
660 your \daps{} disk. The configuration file has the \fname{.cfg} 660 your \daps{} disk. The configuration file has the \fname{.cfg}
661 extension and is used to store all of the theme related settings. 661 extension and is used to store all of the theme related settings.
662 662
663\end{description} 663\end{description}
@@ -665,16 +665,16 @@ Example of a configuration file:
665\section{\label{ref:FirmwareLoading}Firmware Loading} 665\section{\label{ref:FirmwareLoading}Firmware Loading}
666\opt{player,recorder,recorderv2fm,ondio}{ 666\opt{player,recorder,recorderv2fm,ondio}{
667 When your \dap{} powers on, it loads the Archos firmware in ROM, which 667 When your \dap{} powers on, it loads the Archos firmware in ROM, which
668 automatically checks your \daps{} root directory for a file named 668 automatically checks your \daps{} root directory for a file named
669 \firmwarefilename. Note that Archos firmware can only read the first 669 \firmwarefilename. Note that Archos firmware can only read the first
670 ten characters of each filename in this process, so do not rename your old 670 ten characters of each filename in this process, so do not rename your old
671 firmware files with names like \firmwarefilename.\fname{old} and so on, 671 firmware files with names like \firmwarefilename.\fname{old} and so on,
672 because it is possible that the \dap{} will load a file other than the one 672 because it is possible that the \dap{} will load a file other than the one
673 you intended. 673 you intended.
674} 674}
675 675
676\subsection{\label{ref:using_rolo}Using ROLO (Rockbox Loader)} 676\subsection{\label{ref:using_rolo}Using ROLO (Rockbox Loader)}
677Rockbox is able to load and start another firmware file without rebooting. 677Rockbox is able to load and start another firmware file without rebooting.
678You just ``play'' a file with the extension % 678You just ``play'' a file with the extension %
679\opt{recorder,recorderv2fm,ondio}{\fname{.ajz}.} % 679\opt{recorder,recorderv2fm,ondio}{\fname{.ajz}.} %
680\opt{player}{\fname{.mod}.} % 680\opt{player}{\fname{.mod}.} %
@@ -690,76 +690,79 @@ current version.
690\opt{archos}{\input{advanced_topics/archos-flashing.tex}} 690\opt{archos}{\input{advanced_topics/archos-flashing.tex}}
691 691
692\section{Optimising battery runtime} 692\section{Optimising battery runtime}
693 Rockbox offers a lot of settings that have high impact on the battery runtime 693 Rockbox offers a lot of settings that have high impact on the battery runtime
694 of your \dap{}. The largest power savings can be achieved through disabling 694 of your \dap{}. The largest power savings can be achieved through disabling
695 unneeded hardware components -- for some of those there are settings 695 unneeded hardware components -- for some of those there are settings
696 available. 696 available.
697
698
697\opt{swcodec}{ 699\opt{swcodec}{
698 Another area of savings is avoiding or reducing CPU boosting 700 Another area of savings is avoiding or reducing CPU boosting
699 through disabling computing intense features (e.g. sound processing) or 701 through disabling computing intense features (e.g. sound processing) or
700 using effective audio codecs. 702 using effective audio codecs.
701} The following provides a short overview of the most relevant settings and 703} The following provides a short overview of the most relevant settings and
702 rules of thumb. 704 rules of thumb.
703 705
704\nopt{ondio}{ 706\nopt{ondio}{
705\subsection{Display backlight} 707\subsection{Display backlight}
706 The active backlight consumes a lot of power. Therefore choose a setting that 708 The active backlight consumes a lot of power. Therefore choose a setting that
707 disables the backlight after timeout (for setting \setting{Backlight} see 709 disables the backlight after timeout (for setting \setting{Backlight} see
708 \reference{ref:Displayoptions}). Avoid to have the backlight enabled all the 710 \reference{ref:Displayoptions}). Avoid having the backlight enabled all the
709 time. 711 time (Activating \setting{selectivebacklight}
712 \reference{ref:selectivebacklight} can further reduce power consumption).
710} 713}
711 714
712\opt{lcd_sleep}{ 715\opt{lcd_sleep}{
713\subsection{Display power-off} 716\subsection{Display power-off}
714 Shutting down the display and the display controller saves a reasonable amount 717 Shutting down the display and the display controller saves a reasonable amount
715 of power. Choose a setting that will put the display to sleep after timeout 718 of power. Choose a setting that will put the display to sleep after timeout
716 (for setting \setting{Sleep} see \reference{ref:Displayoptions}). Avoid to 719 (for setting \setting{Sleep} see \reference{ref:Displayoptions}). Avoid to
717 have the display enabled all the time -- even, if the display is transflective 720 have the display enabled all the time -- even, if the display is transflective
718 and is readable without backlight. Depending on your \dap{} it might be 721 and is readable without backlight. Depending on your \dap{} it might be
719 significantly more efficient to re-enable the display and its backlight for a 722 significantly more efficient to re-enable the display and its backlight for a
720 glimpse a few times per hour than to keep the display enabled. 723 glimpse a few times per hour than to keep the display enabled.
721} 724}
722 725
723\opt{accessory_supply}{ 726\opt{accessory_supply}{
724\subsection{Accessory power supply} 727\subsection{Accessory power supply}
725 As default your \dap{}'s accessory power supply is always enabled to ensure 728 As default your \dap{}'s accessory power supply is always enabled to ensure
726 proper function of connected accessory devices. Disable this power supply, if 729 proper function of connected accessory devices. Disable this power supply, if
727 -- or as long as -- you do not use any accessory device with your \dap{} while 730 -- or as long as -- you do not use any accessory device with your \dap{} while
728 running Rockbox (see \reference{ref:AccessoryPowerSupply}). 731 running Rockbox (see \reference{ref:AccessoryPowerSupply}).
729} 732}
730 733
731\opt{lineout_poweroff}{ 734\opt{lineout_poweroff}{
732\subsection{Line Out} 735\subsection{Line Out}
733 Rockbox allows to switch off the line-out on your \dap{}. If you do not need 736 Rockbox allows to switch off the line-out on your \dap{}. If you do not need
734 the line-out, switch it off (see \reference{ref:LineoutOnOff}). 737 the line-out, switch it off (see \reference{ref:LineoutOnOff}).
735} 738}
736 739
737\opt{spdif_power}{ 740\opt{spdif_power}{
738\subsection{Optical Output} 741\subsection{Optical Output}
739 Rockbox allows to switch off the S/PDIF output on your \dap{}. If you do not 742 Rockbox allows to switch off the S/PDIF output on your \dap{}. If you do not
740 need this output, switch it off (see \reference{ref:SPDIF_OnOff}). 743 need this output, switch it off (see \reference{ref:SPDIF_OnOff}).
741} 744}
742 745
743\opt{disk_storage}{ 746\opt{disk_storage}{
744\subsection{Anti-Skip Buffer} 747\subsection{Anti-Skip Buffer}
745 Having a large anti-skip buffer tends to use more power, and may reduce your 748 Having a large anti-skip buffer tends to use more power, and may reduce your
746 battery life. It is recommended to always use the lowest possible setting 749 battery life. It is recommended to always use the lowest possible setting
747 that allows correct and continuous playback (see \reference{ref:AntiSkipBuf}). 750 that allows correct and continuous playback (see \reference{ref:AntiSkipBuf}).
748} 751}
749 752
750\opt{swcodec}{ 753\opt{swcodec}{
751\subsection{Replaygain} 754\subsection{Replaygain}
752 Replaygain is a post processing that equalises the playback volume of audio 755 Replaygain is a post processing that equalises the playback volume of audio
753 files to the same perceived loudness. This post processing applies a factor 756 files to the same perceived loudness. This post processing applies a factor
754 to each single PCM sample and is therefore consuming additional CPU time. If 757 to each single PCM sample and is therefore consuming additional CPU time. If
755 you want to achieve some (minor) savings in runtime, switch this feature off 758 you want to achieve some (minor) savings in runtime, switch this feature off
756 (see \reference{ref:ReplayGain}). 759 (see \reference{ref:ReplayGain}).
757} 760}
758 761
759\opt{lcd_bitmap}{ 762\opt{lcd_bitmap}{
760\subsection{Peak Meter} 763\subsection{Peak Meter}
761 The peak meter is a feature of the While Playing Screen and will be updated with a 764 The peak meter is a feature of the While Playing Screen and will be updated with a
762 high framerate. Depending on your \dap{} this might result in a high CPU load. To 765 high framerate. Depending on your \dap{} this might result in a high CPU load. To
763 save battery runtime you should switch this feature off (see \reference{ref:peak_meter}). 766 save battery runtime you should switch this feature off (see \reference{ref:peak_meter}).
764 \opt{ipodvideo}{ 767 \opt{ipodvideo}{
765 \note{Especially the \playerman{} \playertype{} suffers from an enabled peak meter.} 768 \note{Especially the \playerman{} \playertype{} suffers from an enabled peak meter.}
@@ -770,36 +773,36 @@ current version.
770\subsection{Audio format and bitrate} 773\subsection{Audio format and bitrate}
771\opt{swcodec}{ 774\opt{swcodec}{
772 In general the fastest decoding audio format will be the best in terms of 775 In general the fastest decoding audio format will be the best in terms of
773 battery runtime on your \dap{}. An overview of different codec's performance 776 battery runtime on your \dap{}. An overview of different codec's performance
774 on different \dap{}s can be found at \wikilink{CodecPerformanceComparison}. 777 on different \dap{}s can be found at \wikilink{CodecPerformanceComparison}.
775} 778}
776 779
777\opt{flash_storage}{ 780\opt{flash_storage}{
778 Your target uses flash that consumes a certain amount of power during access. 781 Your target uses flash that consumes a certain amount of power during access.
779 The less often the flash needs to be switched on for buffering and the shorter 782 The less often the flash needs to be switched on for buffering and the shorter
780 the buffering duration is, the lower is the overall power consumption. 783 the buffering duration is, the lower is the overall power consumption.
781 Therefore the bitrate of the audio files does have an impact on the battery 784 Therefore the bitrate of the audio files does have an impact on the battery
782 runtime as well. Lower bitrate audio files will result in longer battery 785 runtime as well. Lower bitrate audio files will result in longer battery
783 runtime. 786 runtime.
784} 787}
785\opt{disk_storage}{ 788\opt{disk_storage}{
786 Your target uses a hard disk which consumes a large amount of power while 789 Your target uses a hard disk which consumes a large amount of power while
787 spinning -- up to several hundred mA. The less often the hard disk needs to 790 spinning -- up to several hundred mA. The less often the hard disk needs to
788 spin up for buffering and the shorter the buffering duration is, the lower is 791 spin up for buffering and the shorter the buffering duration is, the lower is
789 the power consumption. Therefore the bitrate of the audio files does have an 792 the power consumption. Therefore the bitrate of the audio files does have an
790 impact on the battery runtime as well. Lower bitrate audio files will result 793 impact on the battery runtime as well. Lower bitrate audio files will result
791 in longer battery runtime. 794 in longer battery runtime.
792} 795}
793 796
794 Please do not re-encode any existing audio files from one lossy format to 797 Please do not re-encode any existing audio files from one lossy format to
795 another based upon the above mentioned. This will reduce the audio quality. 798 another based upon the above mentioned. This will reduce the audio quality.
796 If you have the choice, select the best suiting codec when encoding the 799 If you have the choice, select the best suiting codec when encoding the
797 original source material. 800 original source material.
798} 801}
799 802
800\opt{swcodec}{ 803\opt{swcodec}{
801\subsection{Sound settings} 804\subsection{Sound settings}
802 In general all kinds of sound processing will need more CPU time and therefore 805 In general all kinds of sound processing will need more CPU time and therefore
803 consume more power. The less sound processing you use, the better it is for 806 consume more power. The less sound processing you use, the better it is for
804 the battery runtime (for options see \reference{ref:configure_rockbox_sound}). 807 the battery runtime (for options see \reference{ref:configure_rockbox_sound}).
805} 808}
diff --git a/manual/configure_rockbox/display_options.tex b/manual/configure_rockbox/display_options.tex
index c872f08031..163b1e884c 100644..100755
--- a/manual/configure_rockbox/display_options.tex
+++ b/manual/configure_rockbox/display_options.tex
@@ -1,6 +1,6 @@
1% $Id$ % 1% $Id$ %
2\section{\label{ref:Displayoptions}Display} 2\section{\label{ref:Displayoptions}Display}
3 3
4 \begin{description} 4 \begin{description}
5 5
6 \item[LCD Settings.] 6 \item[LCD Settings.]
@@ -32,14 +32,14 @@
32 \item[Backlight Fade In.] 32 \item[Backlight Fade In.]
33 The amount of time that the backlight will take to fade from off to on 33 The amount of time that the backlight will take to fade from off to on
34 after a button is pressed. If set to \setting{Off} the backlight will 34 after a button is pressed. If set to \setting{Off} the backlight will
35 turn on immediately, with no fade in. Can also be set to 35 turn on immediately, with no fade in. Can also be set to
36 \setting{500ms}, \setting{1s} or \setting{2s}. 36 \setting{500ms}, \setting{1s} or \setting{2s}.
37 \item[Backlight Fade Out.] 37 \item[Backlight Fade Out.]
38 Like Backlight fade in, this controls the amount of time that the 38 Like Backlight fade in, this controls the amount of time that the
39 backlight will take to fade from on to off after a button is pressed. If 39 backlight will take to fade from on to off after a button is pressed. If
40 set to \setting{Off} the backlight will turn off immediately, with no 40 set to \setting{Off} the backlight will turn off immediately, with no
41 fade out. Other valid values: \setting{500ms}, \setting{1s}, 41 fade out. Other valid values: \setting{500ms}, \setting{1s},
42 \setting{2s}, \setting{3s}, \setting{4s}, \setting{5s} or 42 \setting{2s}, \setting{3s}, \setting{4s}, \setting{5s} or
43 \setting{10s}. 43 \setting{10s}.
44 } 44 }
45 \opt{backlight_fade_bool}{ 45 \opt{backlight_fade_bool}{
@@ -56,21 +56,51 @@
56 With this option enabled the first keypress while the backlight is turned 56 With this option enabled the first keypress while the backlight is turned
57 off will only turn the backlight on without having any other effect. When 57 off will only turn the backlight on without having any other effect. When
58 disabled the first keypress will \emph{also} perform its appropriate action. 58 disabled the first keypress will \emph{also} perform its appropriate action.
59 59
60 \item[\label{ref:selectivebacklight}Selective Backlight]
61 This option allows some selected actions in While Playing Screen and
62 FM screen to \emph{not} turn on the backlight in order to save power.
63 \begin{description}
64 \item[Enabled.]
65 Enables/disables the feature.
66
67 \item[Settings.]
68 Allows to select actions that will \emph{not} activate backlight.
69 \begin{itemize}
70 \item[Volume.]
71 Volume up/down.
72 \item[Play.]
73 Toggling Play/Pause.
74 \item[Seek.]
75 Seeking in a track.
76 \item[Skip.]
77 Skipping of a track.
78 \item[Disable Unmapped Keys.]
79 Buttons that have no action assigned and accidental button
80 combinations don't turn on backlight.
81 \item[Disable on External Power.]
82 When plugged goes back to regular behavior.
83 \end{itemize}
84 Selected actions are indicated by a leading +.
85 Note: If all options get de-selected, the entire feature is disabled.
86 \end{description}
87
88
89
60 \opt{lcd_sleep}{ 90 \opt{lcd_sleep}{
61 \item[Sleep (After Backlight Off).] 91 \item[Sleep (After Backlight Off).]
62 This setting controls how long rockbox will wait before turning off the 92 This setting controls how long rockbox will wait before turning off the
63 display after the backlight is turned off. Turning off the display 93 display after the backlight is turned off. Turning off the display
64 saves battery power but turning on the display takes noticeably longer 94 saves battery power but turning on the display takes noticeably longer
65 than just turning on the backlight. 95 than just turning on the backlight.
66 } 96 }
67 97
68 \opt{backlight_brightness}{ 98 \opt{backlight_brightness}{
69 \item[Brightness.] 99 \item[Brightness.]
70 Changes the brightness of your LCD display. 100 Changes the brightness of your LCD display.
71 } 101 }
72 } % \opt{HAVE_BACKLIGHT} 102 } % \opt{HAVE_BACKLIGHT}
73 103
74 \opt{lcd_contrast}{ 104 \opt{lcd_contrast}{
75 \item[Contrast.] 105 \item[Contrast.]
76 Changes the contrast of your LCD display. 106 Changes the contrast of your LCD display.
@@ -122,7 +152,7 @@
122 This setting lets you invert the whole screen, so now you get a 152 This setting lets you invert the whole screen, so now you get a
123 black background and light text and graphics. 153 black background and light text and graphics.
124 \item[Upside Down.] 154 \item[Upside Down.]
125 Displays the screen so that the top of the display is nearest 155 Displays the screen so that the top of the display is nearest
126 the buttons. This is sometimes useful when carrying the \dap\ in a 156 the buttons. This is sometimes useful when carrying the \dap\ in a
127 pocket for easy access to the headphone socket. 157 pocket for easy access to the headphone socket.
128 \opt{remote_ticking}{ 158 \opt{remote_ticking}{
@@ -138,7 +168,7 @@
138 the following parameters: 168 the following parameters:
139 \begin{description} 169 \begin{description}
140 \item[Scroll Speed.] 170 \item[Scroll Speed.]
141 Sets how many times per second the automatic horizontal scrolling text 171 Sets how many times per second the automatic horizontal scrolling text
142 will move a step. 172 will move a step.
143 \item[Scroll Start Delay.] 173 \item[Scroll Start Delay.]
144 Controls how many milliseconds Rockbox should wait before a new 174 Controls how many milliseconds Rockbox should wait before a new
@@ -184,23 +214,23 @@
184 useful on slow displays. 214 useful on slow displays.
185 \nopt{scrollwheel}{ 215 \nopt{scrollwheel}{
186 \item[List Acceleration Start Delay.] 216 \item[List Acceleration Start Delay.]
187 This setting enables the acceleration of scroll speed in lists when 217 This setting enables the acceleration of scroll speed in lists when
188 holding \ActionStdPrev{} or \ActionStdNext{}. When set to 218 holding \ActionStdPrev{} or \ActionStdNext{}. When set to
189 \setting{Off} the acceleration is disabled. When any other value is set 219 \setting{Off} the acceleration is disabled. When any other value is set
190 the acceleration will start to accelerate after holding 220 the acceleration will start to accelerate after holding
191 \ActionStdPrev{} or \ActionStdNext{} for the chosen time (in 221 \ActionStdPrev{} or \ActionStdNext{} for the chosen time (in
192 seconds). 222 seconds).
193 \item[List Acceleration Speed.] 223 \item[List Acceleration Speed.]
194 This setting controls how fast the scroll speed accelerates. The scroll 224 This setting controls how fast the scroll speed accelerates. The scroll
195 speed will increase every N seconds. For example, selecting 225 speed will increase every N seconds. For example, selecting
196 \setting{Speed up every 3s} will increase the scroll speed every 3 226 \setting{Speed up every 3s} will increase the scroll speed every 3
197 seconds while \ActionStdPrev{} or \ActionStdNext{} is held. 227 seconds while \ActionStdPrev{} or \ActionStdNext{} is held.
198 } 228 }
199 \end{description} 229 \end{description}
200% 230%
201 \opt{lcd_bitmap}{ 231 \opt{lcd_bitmap}{
202 \item[Peak Meter.] 232 \item[Peak Meter.]
203 The peak meter can be configured with a number of parameters. 233 The peak meter can be configured with a number of parameters.
204 \begin{description} 234 \begin{description}
205 \item[Peak Release.] 235 \item[Peak Release.]
206 This determines how fast the bar shrinks when the music becomes 236 This determines how fast the bar shrinks when the music becomes
@@ -216,7 +246,7 @@
216 \item[Clip Hold Time.] 246 \item[Clip Hold Time.]
217 The number of seconds that the clipping indicator will be visible 247 The number of seconds that the clipping indicator will be visible
218 after clipping is detected. 248 after clipping is detected.
219 \opt{recording}{ 249 \opt{recording}{
220 \item[Clip Counter.] 250 \item[Clip Counter.]
221 Show the number of times the clip indicator went active during 251 Show the number of times the clip indicator went active during
222 recording in front of the peak meters. 252 recording in front of the peak meters.
diff --git a/manual/configure_rockbox/system_options.tex b/manual/configure_rockbox/system_options.tex
index b505175a68..ff2967cec7 100644..100755
--- a/manual/configure_rockbox/system_options.tex
+++ b/manual/configure_rockbox/system_options.tex
@@ -167,11 +167,11 @@ this option \setting{On}. If it is not required, then turning this setting
167 167
168\opt{lineout_poweroff}{ 168\opt{lineout_poweroff}{
169\subsection{\label{ref:LineoutOnOff}Line Out} 169\subsection{\label{ref:LineoutOnOff}Line Out}
170This option turns the \dap{}'s line-out \setting{On} and \setting{Off}. On some 170This option turns the \dap{}'s line-out \setting{On} and \setting{Off}. On some
171devices an enabled line-out will consume some power even if not used. If it is 171devices an enabled line-out will consume some power even if not used. If it is
172not required, then turning this setting \setting{Off} will save battery and 172not required, then turning this setting \setting{Off} will save battery and
173therefore result in better runtime. 173therefore result in better runtime.
174} 174}
175 175
176\opt{HAVE_BUTTON_LIGHTS}{ 176\opt{HAVE_BUTTON_LIGHTS}{
177 \opt{e200,e200v2}{ 177 \opt{e200,e200v2}{
@@ -243,6 +243,61 @@ therefore result in better runtime.
243 243
244 244
245 245
246
247\nopt{HAS_BUTTON_HOLD}{
248 \subsection{Advanced Key Lock}
249 This option allows users to select actions that when within WPS or FMS will \emph{not} be
250 blocked by the key lock (software hold switch).
251
252
253 \begin{description}
254 \item[Enabled.]
255 Enables/disables the feature.
256
257 \item[Settings.]
258 Allows to select actions that will \emph{not} be blocked by the key lock.
259 \begin{itemize}
260 \item[Volume.]
261 Volume up/down.
262 \item[Play.]
263 Toggling Play/Pause.
264 \item[Seek.]
265 Seeking in a track.
266 \item[Skip.]
267 Skipping of a track.
268 \opt{HAVE_BACKLIGHT}{
269 \item[Autolock On.]
270 When the backlight turns off, softlock will lock the screen,
271 activates when you press the lock key and if you manually lock
272 again, while active it then disables autolock.
273 \begin{itemize}
274 \item
275 (Lock Button Pressed \#1) >Auto Lock On
276 (device still unlocked till backlight timeout).
277 \item
278 (Lock Button Pressed \#2) >Auto Lock Off (device locked).
279 \item
280 (Lock Button Pressed \#3) >(device unlocked).
281 \end{itemize}
282 } %\opt{HAVE_BACKLIGHT}
283 \opt{touchpad}{
284 \item[Disable Touch.]
285 Blocks touch screen buttons like the original.
286 }
287 \item[Disable Notify.]
288 Suppresses the notification 'Buttons Locked'
289 (still will if power button is pressed).
290 \note{This is a pre-requisite for \setting{selectivebacklight}
291 \reference{ref:selectivebacklight} to work also during key lock.}
292
293 \end{itemize}
294 Selected actions are indicated by a leading +.
295 Note: If all options get de-selected, the entire feature is disabled.
296
297 \end{description}
298} %\nopt{HAS_BUTTON_HOLD}
299
300
246\opt{usb_hid}{ 301\opt{usb_hid}{
247 \subsection{\label{ref:USB_HID}USB HID} 302 \subsection{\label{ref:USB_HID}USB HID}
248 This option turns the USB HID feature \setting{On} and \setting{Off}. 303 This option turns the USB HID feature \setting{On} and \setting{Off}.
@@ -550,7 +605,7 @@ therefore result in better runtime.
550 \\ 605 \\
551 \end{btnmap} 606 \end{btnmap}
552 607
553 \item [Browser.] This mode lets you control a web browser (e.g. 608 \item [Browser.] This mode lets you control a web browser (e.g.
554 Firefox). It uses the \dap{}'s keys to navigate through the web page 609 Firefox). It uses the \dap{}'s keys to navigate through the web page
555 and different tabs, navigate through history, and to control zoom. 610 and different tabs, navigate through history, and to control zoom.
556 611
@@ -592,7 +647,7 @@ therefore result in better runtime.
592 \\ 647 \\
593 } 648 }
594 649
595 % Zoom in / out 650 % Zoom in / out
596 \opt{SANSA_FUZEPLUS_PAD}{Long \ButtonBottomRight} 651 \opt{SANSA_FUZEPLUS_PAD}{Long \ButtonBottomRight}
597 \opt{SANSA_E200_PAD,SANSA_C200_PAD,SANSA_CLIP_PAD} 652 \opt{SANSA_E200_PAD,SANSA_C200_PAD,SANSA_CLIP_PAD}
598 {Long \ButtonUp / Long \ButtonDown} 653 {Long \ButtonUp / Long \ButtonDown}
@@ -707,13 +762,13 @@ therefore result in better runtime.
707 ,SANSA_CLIP_PAD,MROBE100_PAD,PBELL_VIBE500_PAD,SANSA_FUZEPLUS_PAD% 762 ,SANSA_CLIP_PAD,MROBE100_PAD,PBELL_VIBE500_PAD,SANSA_FUZEPLUS_PAD%
708 ,SAMSUNG_YH92X_PAD,SAMSUNG_YH820_PAD} 763 ,SAMSUNG_YH92X_PAD,SAMSUNG_YH820_PAD}
709 {\ButtonUp / \ButtonDown / \ButtonLeft / \ButtonRight} 764 {\ButtonUp / \ButtonDown / \ButtonLeft / \ButtonRight}
710 \opt{IRIVER_H10_PAD}{\ButtonScrollUp / \ButtonScrollDown / 765 \opt{IRIVER_H10_PAD}{\ButtonScrollUp / \ButtonScrollDown /
711 \ButtonLeft / \ButtonRight} 766 \ButtonLeft / \ButtonRight}
712 \opt{IPOD_4G_PAD,IPOD_3G_PAD,IPOD_1G2G_PAD} 767 \opt{IPOD_4G_PAD,IPOD_3G_PAD,IPOD_1G2G_PAD}
713 {\ButtonMenu / \ButtonPlay / \ButtonLeft / \ButtonRight} 768 {\ButtonMenu / \ButtonPlay / \ButtonLeft / \ButtonRight}
714 & 769 &
715 \opt{HAVEREMOTEKEYMAP}{ 770 \opt{HAVEREMOTEKEYMAP}{
716 \opt{MROBE100_RC_PAD}{\ButtonRCPlay / \ButtonRCDisplay / 771 \opt{MROBE100_RC_PAD}{\ButtonRCPlay / \ButtonRCDisplay /
717 \ButtonRCRew / \ButtonRCFF}% 772 \ButtonRCRew / \ButtonRCFF}%
718 &} 773 &}
719 Cursor move up / down / left / right, respectively 774 Cursor move up / down / left / right, respectively