Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AUTO_LOWERCASE_KEYBOARD #4976

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/config/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,7 @@
#define UNITS UNITS_IMPERIAL
#define CHAR_DEC_SEPARATOR CHAR_PERIOD // CHAR_PERIOD is used as a decimal separator only in the UK and the US. The rest of the world uses CHAR_COMMA.

// Naming Screen
#define AUTO_LOWERCASE_KEYBOARD GEN_LATEST // Starting in GEN_6, after entering the first uppercase character, the keyboard switches to lowercase letters.

#endif // GUARD_CONFIG_GENERAL_H
17 changes: 17 additions & 0 deletions src/naming_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,7 @@ static void NamingScreen_CreateWaldaDadIcon(void)
//--------------------------------------------------

static bool8 KeyboardKeyHandler_Character(u8);
static void SwapKeyboardToLowerAfterFirstCapitalLetter(void);
static bool8 KeyboardKeyHandler_Page(u8);
static bool8 KeyboardKeyHandler_Backspace(u8);
static bool8 KeyboardKeyHandler_OK(u8);
Expand Down Expand Up @@ -1480,6 +1481,8 @@ static bool8 KeyboardKeyHandler_Character(u8 input)
{
bool8 textFull = AddTextCharacter();

SwapKeyboardToLowerAfterFirstCapitalLetter();

SquishCursor();
if (textFull)
{
Expand All @@ -1490,6 +1493,20 @@ static bool8 KeyboardKeyHandler_Character(u8 input)
return FALSE;
}

static void SwapKeyboardToLowerAfterFirstCapitalLetter(void)
{
if (AUTO_LOWERCASE_KEYBOARD < GEN_6)
return;

if (sNamingScreen->currentPage != KBPAGE_LETTERS_UPPER)
return;

if (GetTextEntryPosition() != 1)
return;

MainState_StartPageSwap();
}

static bool8 KeyboardKeyHandler_Page(u8 input)
{
TryStartButtonFlash(BUTTON_PAGE, TRUE, FALSE);
Expand Down
Loading