Typing icon indicating copy to clipboard operation
Typing copied to clipboard

Adding another physical keyboard arrangement.

Open HughP opened this issue 6 years ago • 2 comments

@michaeldickens

I'm trying to add another Physical keyboard "model" to Typing. I am trying to add an ISO keyboard. Following up on #16

Directions for this are provided in README.md. Never-the-less, I still have some questions.

  1. I have been looking at the iPhone layout as a sort of model for adding another keyboard layout. The iphone layout is in the code base but seems to be undocumented in the application documentation as an option. No doubt with intent. to that end I make the following comments and observations:

tools.c @ line 61-64 seem to not list iPhone. This makes me confused in the case of step number 4 in the README.md file, where it says to add:

strcpy(keysToInclude, DEFAULT_KEYBOARD_BINARY);

but I think what I would want to add would be something more like the following, am I correct on this?

else if (fullKeyboard == K_IPHONE) strcpy(keysToInclude, DEFAULT_KEYBOARD_IPHONE); else if (fullKeyboard == K_ISO) strcpy(keysToInclude, DEFAULT_KEYBOARD_ISO);

I am also confused because it seems that the directions in step 4 suggest to add the content in the function initKeyboardData(); , but if I add my above suggested lines at about line 63 then two lines later is where initKeyboardData(); is called. Are the instructions meant to say initData() instead of initKeyboardData(); ?

  1. is it the nature of the arrays for fingerCopy, rowCopy, homeRow, handCopy, isCenterCopy, isOutsideCopy, printItCopy, indicesCopy, that they need to be of equal lengths? that is the ISO keyboard layout would ordinarily just add a key to the row above the thumb row (row A in ISO9995 parlance) and move key D13 to the C12 position. Do I need to add values to each row in the array to keep them "happy" (all the same length), or can I just add one value in each array on the row which corresponds to the row above row 3?

  2. Tools.h @ line 66-68 does not have an iPhone layout defined Why? Does this mean I do not add an ISO layout mention at this position?

  3. In Tools.c, near the end, kbdFilename is NULL for K_IPHONE: case K_IPHONE: ksize = 30; trueksize = 26; kbdFilename = NULL; break;

The instructions in the README.md don't exactly suggest what needs to be done with regards to the value of kbdFilename, or trueksize. Should I follow the pattern set forth by K_NO and K_Standard?

HughP avatar Oct 04 '18 23:10 HughP

Note that I haven't touched this program in about 5 years so I've forgotten a lot of stuff.

  1. You do want to update tools.c in the way you described, I think the reason it's not there for iPhone is because I started adding support for the iPhone keyboard but then stopped partway through. I think you need to update both initData() and initKeyboardData().
  2. Yes the arrays need to be the same length. Notice that the size is set by KSIZE_MAX. The way this is written is not super extensible. If you want to add a new keyboard that's bigger than the biggest keyboard, you need to increase KSIZE_MAX and then update all the existing keyboards accordingly, which could be tricky.
  3. iPhone keyboard is not defined here because it's only partway done. You need to define a default keyboard that gets populated when the layout optimizer initializes a new layout.
  4. Same as before, I didn't finish the implementation so iPhone is missing some stuff.

The instructions in the README.md don't exactly suggest what needs to be done with regards to the value of kbdFilename, or trueksize. Should I follow the pattern set forth by K_NO and K_Standard?

Yeah, your best bet is to look at what the existing keyboards do and try to replicate that. Ideally it would be easier to add new keyboards, but that would require refactoring a lot of stuff.

michaeldickens avatar Oct 14 '18 21:10 michaeldickens

thanks

On Sun, Oct 14, 2018 at 2:30 PM Michael Dickens [email protected] wrote:

Note that I haven't touched this program in about 5 years so I've forgotten a lot of stuff.

  1. You do want to update tools.c in the way you described, I think the reason it's not there for iPhone is because I started adding support for the iPhone keyboard but then stopped partway through. I think you need to update both initData() and initKeyboardData().
  2. Yes the arrays need to be the same length. Notice that the size is set by KSIZE_MAX. The way this is written is not super extensible. If you want to add a new keyboard that's bigger than the biggest keyboard, you need to increase KSIZE_MAX and then update all the existing keyboards accordingly, which could be tricky.
  3. iPhone keyboard is not defined here because it's only partway done. You need to define a default keyboard that gets populated when the layout optimizer initializes a new layout.
  4. Same as before, I didn't finish the implementation so iPhone is missing some stuff.

The instructions in the README.md don't exactly suggest what needs to be done with regards to the value of kbdFilename, or trueksize. Should I follow the pattern set forth by K_NO and K_Standard?

Yeah, your best bet is to look at what the existing keyboards do and try to replicate that. Ideally it would be easier to add new keyboards, but that would require refactoring a lot of stuff.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/michaeldickens/Typing/issues/23#issuecomment-429664776, or mute the thread https://github.com/notifications/unsubscribe-auth/AACdJg-DhNWAYbPmqKd4GNbDz2TZJHAIks5uk6zpgaJpZM4XJVI2 .

HughP avatar Oct 14 '18 22:10 HughP