Browse: Home and End move to 1st and last entry

This commit is contained in:
penfold42 2018-08-01 17:57:01 +10:00
parent b3cdf92238
commit 792c259714
3 changed files with 29 additions and 6 deletions

View file

@ -350,6 +350,7 @@ bool FileBrowser::BrowsableList::CheckBrowseNavigation()
{
dirty |= views[index].CheckBrowseNavigation(index != 0);
}
// check for keys a-z
if (inputMappings->BrowseLetter())
{
@ -389,7 +390,18 @@ bool FileBrowser::BrowsableList::CheckBrowseNavigation()
dirty |= 1;
}
}
else if (inputMappings->BrowseHome())
{
currentIndex = 0;
SetCurrent();
dirty |= 1;
}
else if (inputMappings->BrowseEnd())
{
currentIndex = numberOfEntriesMinus1;
SetCurrent();
dirty |= 1;
}
return dirty;
}

View file

@ -152,7 +152,6 @@ bool InputMappings::CheckKeyboardBrowseMode()
keyboardFlags = 0;
// TODO: add KEY_HOME and KEY_END
if (keyboard->KeyHeld(KEY_ESC))
SetKeyboardFlag(ESC_FLAG);
else if (keyboard->KeyHeld(KEY_ENTER))
@ -181,10 +180,10 @@ bool InputMappings::CheckKeyboardBrowseMode()
else
SetKeyboardFlag(PAGEDOWN_FLAG);
}
//else if (keyboard->KeyHeld(KEY_HOME))
// SetKeyboardFlag(PAGEUP_LCD_FLAG);
//else if (keyboard->KeyHeld(KEY_END))
// SetKeyboardFlag(PAGEDOWN_LCD_FLAG);
else if (keyboard->KeyHeld(KEY_HOME))
SetKeyboardFlag(HOME_FLAG);
else if (keyboard->KeyHeld(KEY_END))
SetKeyboardFlag(END_FLAG);
else if (keyboard->KeyHeld(KEY_N) && keyboard->KeyEitherAlt() )
SetKeyboardFlag(NEWD64_FLAG);
else if (keyboard->KeyHeld(KEY_A) && keyboard->KeyEitherAlt() )

View file

@ -42,6 +42,8 @@
#define FAKERESET_FLAG (1 << 16)
#define WRITEPROTECT_FLAG (1 << 17)
#define LETTER_FLAG (1 << 18)
#define HOME_FLAG (1 << 19)
#define END_FLAG (1 << 20)
// dont exceed 32!!
const unsigned NumberKeys[33] =
@ -208,6 +210,16 @@ public:
return KeyboardFlag(LETTER_FLAG);
}
inline bool BrowseHome()
{
return KeyboardFlag(HOME_FLAG);
}
inline bool BrowseEnd()
{
return KeyboardFlag(END_FLAG);
}
inline unsigned getKeyboardNumber() { return keyboardNumber; }
inline char getKeyboardLetter() { return (char) keyboardLetter; }