Skip to content

Commit

Permalink
Add both QWERTY and QZERTY Italian layouts
Browse files Browse the repository at this point in the history
Created two Italian layouts one for QZERTY layouts that come with
Classic Mac OS. Also added a modern Italian QWERTY layout along
with a keyboard map for Italian QWERTY keyboards in the
`QuokkADB-supplementary-files` subdirectory in `src/firmware`.
Only tested the keyboard map file in MacOS 8.1.

Direction to install the keyboard layout
 1. Unstuff `Italian-QWERTY.sit`
 2. Close all application
 3. Copy `Italian - QWERTY` to your `System Folder`
 4. Goto `Control Panels`->`Keyboard`
 5. Under `Keyboard Layouts` select `Italian - QWERTY`
 6. Switch the QuokkADB to `Italy-QWERTY` while in a blank SimpleText
 doc using the special key-combo and `G` or `H`.

 Note: The list region layout list should read
```
...
  - Italy-QZERTY
  * Italy-QWERTY
```
 if you don't see `-` for the other options either you are on the wrong
 options or you are not using the correct keyboard layout in the
 Keyboard control panel.
  • Loading branch information
morio committed Oct 1, 2024
1 parent 1479561 commit da33a77
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 48 deletions.
Binary file not shown.
50 changes: 29 additions & 21 deletions src/firmware/lib/QuokkADB/src/platformkbdparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,37 +169,45 @@ void PlatformKbdParser::SetUSBkeyboardLEDs(bool capslock, bool numlock, bool scr
usb_set_leds = true;
}


static const char ON_STRING[] = "On";
static const char OFF_STRING[] = "Off";
static const char REGION_US_STRING[] = "USA";
static const char REGION_FR_STRING[] = "Belgium/France";
static const char REGION_DE_STRING[] = "German";
static const char REGION_CH_STRING[] = "Swiss-DE/FR";
static const char REGION_DK_STRING[] = "Denmark";
static const char REGION_UK_STRING[] = "Ireland/UK";
static const char REGION_IT_QZ_STRING[] = "Italy-QZERTY";
static const char REGION_IT_QW_STRING[] = "Italy-QWERTY";

static void region_selection_string(char* print_buf, size_t len, Region region)
{
snprintf(print_buf, len,
"Regions:\n"
" %c USA\n"
" %c Belgium/France\n"
" %c German\n"
" %c Swiss DE/FR\n"
" %c Denmark\n"
" %c Ireland/UK\n",
region == RegionUS ? '*' : '-',
region == RegionFR ? '*' : '-',
region == RegionDE ? '*' : '-',
region == RegionCH ? '*' : '-',
region == RegionDK ? '*' : '-',
region == RegionUK ? '*' : '-'
" %c %s\n"
" %c %s\n"
" %c %s\n"
" %c %s\n"
" %c %s\n"
" %c %s\n"
" %c %s\n"
" %c %s\n",
region == RegionUS ? '*' : '-', REGION_US_STRING,
region == RegionFR ? '*' : '-', REGION_FR_STRING,
region == RegionDE ? '*' : '-', REGION_DE_STRING,
region == RegionCH ? '*' : '-', REGION_CH_STRING,
region == RegionDK ? '*' : '-', REGION_DK_STRING,
region == RegionUK ? '*' : '-', REGION_UK_STRING,
region == RegionITqz ? '*' : '-', REGION_IT_QZ_STRING,
region == RegionITqw ? '*' : '-', REGION_IT_QW_STRING

);
}

bool PlatformKbdParser::SpecialKeyCombo(KBDINFO *cur_kbd_info)
{
// Special keycombo actions
static const char ON_STRING[] = "On";
static const char OFF_STRING[] = "Off";
static const char REGION_FR_STRING[] = "Belgium/France";
static const char REGION_US_STRING[] = "USA";
static const char REGION_DE_STRING[] = "German";
static const char REGION_CH_STRING[] = "Swiss-DE/FR";
static const char REGION_DK_STRING[] = "Denmark";
static const char REGION_UK_STRING[] = "Ireland/UK";

uint8_t special_key_count = 0;
uint8_t special_key = 0;
uint8_t special_keys[] = {USB_KEY_V, USB_KEY_P, USB_KEY_H, USB_KEY_G, USB_KEY_S, USB_KEY_R, USB_KEY_T,
Expand Down
4 changes: 3 additions & 1 deletion src/firmware/lib/misc/include/regions.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@

#pragma once

#define LAST_REGION RegionUK
#define LAST_REGION RegionITqw
enum Region
{
RegionUS = 0,
RegionFR,
RegionDE,
RegionCH,
RegionDK,
RegionUK,
RegionITqz,
LAST_REGION
};

99 changes: 73 additions & 26 deletions src/firmware/lib/usb/src/char2usbkeycode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,38 +55,55 @@ static uint8_t alpha_qwertz_usb_keycode(const char letter)
return USB_KEY_A + tolower(letter) - 'a';
}

static uint8_t alpha_qzerty_usb_keycode(const char letter)
{
switch (tolower(letter))
{
case 'z': return USB_KEY_W;
case 'w': return USB_KEY_Z;
case 'm': return USB_KEY_SEMICOLON;
default: // do nothing
break;
}

return USB_KEY_A + tolower(letter) - 'a';
}

usbkey_t char_to_usb_keycode(char character, Region region)
{
usbkey_t key;
if (character >= 'A' && character <= 'Z')
{
if (region == RegionUS || region == RegionDK || region == RegionUK)
if (region == RegionUS || region == RegionDK || region == RegionUK || region == RegionITqw)
key.keycode = USB_KEY_A + (character - 'A');
else if (region == RegionFR)
key.keycode = alpha_azerty_usb_keycode(character);
else if (region == RegionDE || region == RegionCH)
key.keycode = alpha_qwertz_usb_keycode(character);

else if (region == RegionITqz)
key.keycode = alpha_qzerty_usb_keycode(character);
key.shift_down = true;
return key;
}

if (character >= 'a' && character <= 'z')
{
if (region == RegionUS || region == RegionDK || region == RegionUK)
if (region == RegionUS || region == RegionDK || region == RegionUK || region == RegionITqw)
key.keycode = USB_KEY_A + (character - 'a');
else if (region == RegionFR)
key.keycode = alpha_azerty_usb_keycode(character);
else if (region == RegionDE || region == RegionCH)
key.keycode = alpha_qwertz_usb_keycode(character);
else if (region == RegionITqz)
key.keycode = alpha_qzerty_usb_keycode(character);

key.shift_down = false;
return key;
}

if (character == '.')
{
if (region == RegionFR)
if (region == RegionFR || region == RegionITqz)
{
key.keycode = USB_KEY_COMMA;
key.shift_down = true;
Expand All @@ -103,7 +120,7 @@ usbkey_t char_to_usb_keycode(char character, Region region)
if (character == '0')
{
key.keycode = USB_KEY_0;
if (region == RegionFR)
if (region == RegionFR || region == RegionITqz)
key.shift_down = true;
else
key.shift_down = false;
Expand All @@ -114,7 +131,7 @@ usbkey_t char_to_usb_keycode(char character, Region region)
if (character >= '1' && character <= '9')
{
key.keycode = USB_KEY_1 + (character - '1');
if (region == RegionFR)
if (region == RegionFR || region == RegionITqz)
key.shift_down = true;
else
key.shift_down = false;
Expand All @@ -128,12 +145,12 @@ usbkey_t char_to_usb_keycode(char character, Region region)
key.keycode = USB_KEY_SEMICOLON;
key.shift_down = true;
}
else if (region == RegionFR)
else if (region == RegionFR || region == RegionITqz)
{
key.keycode = USB_KEY_DOT;
key.shift_down = false;
}
else if (region == RegionDE || region == RegionCH || region == RegionDK)
else if (region == RegionDE || region == RegionCH || region == RegionDK || region == RegionITqw)
{
key.keycode = USB_KEY_DOT;
key.shift_down = true;
Expand All @@ -151,11 +168,11 @@ usbkey_t char_to_usb_keycode(char character, Region region)

if (character == '-')
{
if (region == RegionUS || region == RegionUK)
if (region == RegionUS || region == RegionUK || region == RegionITqz)
key.keycode = USB_KEY_MINUS;
else if (region == RegionFR)
key.keycode = USB_KEY_EQUAL;
else if (region == RegionDE || region == RegionCH || region == RegionDK)
else if (region == RegionDE || region == RegionCH || region == RegionDK || region == RegionITqw)
key.keycode = USB_KEY_SLASH;

key.shift_down = false;
Expand All @@ -166,7 +183,7 @@ usbkey_t char_to_usb_keycode(char character, Region region)
{
if (region == RegionUS || region == RegionUK)
key.keycode = USB_KEY_8;
else if (region == RegionFR || region == RegionDE)
else if (region == RegionFR || region == RegionDE || region == RegionITqw || region == RegionITqz)
key.keycode = USB_KEY_RIGHTBRACE;
else if (region == RegionCH)
key.keycode = USB_KEY_3;
Expand All @@ -187,9 +204,13 @@ usbkey_t char_to_usb_keycode(char character, Region region)
{
if (region == RegionUS || region == RegionUK)
key.keycode = USB_KEY_LEFTBRACE;
else if (region == RegionFR || region == RegionDE || region == RegionCH || region == RegionDK)
else if (region == RegionFR || region == RegionDE || region == RegionCH || region == RegionDK
|| region == RegionITqw || region == RegionITqz
)
{
// Using '<' instead
key.keycode = USB_KEY_102ND;
}
key.shift_down = false;
return key;
}
Expand All @@ -201,7 +222,9 @@ usbkey_t char_to_usb_keycode(char character, Region region)
key.keycode = USB_KEY_RIGHTBRACE;
key.shift_down = false;
}
else if (region == RegionFR || region == RegionDE || region == RegionCH || region == RegionDK)
else if (region == RegionFR || region == RegionDE || region == RegionCH || region == RegionDK
|| region == RegionITqw || region == RegionITqz
)
{
// using '>' instead
key.keycode = USB_KEY_102ND;
Expand All @@ -212,7 +235,7 @@ usbkey_t char_to_usb_keycode(char character, Region region)

if (character == '=')
{
if (region == RegionUS || region == RegionUK)
if (region == RegionUS || region == RegionUK || region == RegionITqz)
{
key.keycode = USB_KEY_EQUAL;
key.shift_down = false;
Expand All @@ -222,7 +245,9 @@ usbkey_t char_to_usb_keycode(char character, Region region)
key.keycode = USB_KEY_SLASH;
key.shift_down = false;
}
else if (region == RegionDE || region == RegionCH || region == RegionDK)
else if (region == RegionDE || region == RegionCH || region == RegionDK
|| region == RegionITqw
)
{
key.keycode = USB_KEY_0;
key.shift_down = true;
Expand All @@ -232,7 +257,7 @@ usbkey_t char_to_usb_keycode(char character, Region region)

if (character == '+')
{
if (region == RegionUS || region == RegionUK)
if (region == RegionUS || region == RegionUK || region == RegionITqz)
{
key.keycode = USB_KEY_EQUAL;
key.shift_down = true;
Expand All @@ -242,7 +267,7 @@ usbkey_t char_to_usb_keycode(char character, Region region)
key.keycode = USB_KEY_SLASH;
key.shift_down = true;
}
else if (region == RegionDE)
else if (region == RegionDE || region == RegionITqw)
{
key.keycode = USB_KEY_RIGHTBRACE;
key.shift_down = false;
Expand All @@ -252,7 +277,7 @@ usbkey_t char_to_usb_keycode(char character, Region region)
key.keycode = USB_KEY_1;
key.shift_down = true;
}
else if (region == RegionDK)
else if (region == RegionDK || region == RegionITqz)
{
key.keycode = USB_KEY_MINUS;
key.shift_down = false;
Expand All @@ -272,11 +297,18 @@ usbkey_t char_to_usb_keycode(char character, Region region)
key.keycode = USB_KEY_5;
key.shift_down = false;
}
else if (region == RegionDE || region == RegionCH || region == RegionDK)
else if (region == RegionDE || region == RegionCH || region == RegionDK
|| region == RegionITqw
)
{
key.keycode = USB_KEY_8;
key.shift_down = true;
}
else if (region == RegionITqz)
{
key.keycode = USB_KEY_4;
key.shift_down = false;
}
return key;
}

Expand All @@ -292,12 +324,18 @@ usbkey_t char_to_usb_keycode(char character, Region region)
key.keycode = USB_KEY_MINUS;
key.shift_down = false;
}
else if (region == RegionDE || region == RegionCH || region == RegionDK)
else if (region == RegionDE || region == RegionCH || region == RegionDK
|| region == RegionITqw
)
{
key.keycode = USB_KEY_9;
key.shift_down = true;
}

else if (region == RegionITqz)
{
key.keycode = USB_KEY_7;
key.shift_down = false;
}
return key;
}

Expand All @@ -308,12 +346,12 @@ usbkey_t char_to_usb_keycode(char character, Region region)
key.keycode = USB_KEY_SLASH;
key.shift_down = false;
}
else if (region == RegionFR)
else if (region == RegionFR || region == RegionITqz)
{
key.keycode = USB_KEY_DOT;
key.shift_down = true;
}
else if (region == RegionDE || region == RegionCH || region == RegionDK)
else if (region == RegionDE || region == RegionCH || region == RegionDK || region == RegionITqw)
{
key.keycode = USB_KEY_7;
key.shift_down = true;
Expand All @@ -329,7 +367,9 @@ usbkey_t char_to_usb_keycode(char character, Region region)
key.keycode = USB_KEY_COMMA;
key.shift_down = true;
}
else if (region == RegionFR || region == RegionDE || region == RegionCH || region == RegionDK)
else if (region == RegionFR || region == RegionDE || region == RegionCH || region == RegionDK
|| region == RegionITqz || region == RegionITqw
)
{
key.keycode = USB_KEY_102ND;
key.shift_down = false;
Expand All @@ -341,7 +381,9 @@ usbkey_t char_to_usb_keycode(char character, Region region)
{
if (region == RegionUS || region == RegionUK)
key.keycode = USB_KEY_DOT;
else if (region == RegionFR || region == RegionDE || region == RegionCH || region == RegionDK)
else if (region == RegionFR || region == RegionDE || region == RegionCH || region == RegionDK
|| region == RegionITqz || region == RegionITqw
)
key.keycode = USB_KEY_102ND;

key.shift_down = true;
Expand All @@ -366,11 +408,16 @@ usbkey_t char_to_usb_keycode(char character, Region region)
key.keycode = USB_KEY_2;
key.shift_down = true;
}
else if (region == RegionCH)
else if (region == RegionCH || region == RegionITqw)
{
key.keycode = USB_KEY_MINUS;
key.shift_down = false;
}
else if (region == RegionITqz)
{
key.keycode = USB_KEY_3;
key.shift_down = false;
}
return key;
}

Expand Down

0 comments on commit da33a77

Please sign in to comment.