os/kernelhwsrv/bsptemplate/asspandvariant/template_variant/specific/keymap.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// template\template_variant\specific\keymap.cpp
sl@0
    15
// This file is part of the Template Base port
sl@0
    16
// The keyboard lookup tables giving the function to be carried out
sl@0
    17
// and the new state of the keyboard
sl@0
    18
// 
sl@0
    19
//
sl@0
    20
sl@0
    21
sl@0
    22
#include <k32keys.h>
sl@0
    23
sl@0
    24
#define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0]))
sl@0
    25
sl@0
    26
sl@0
    27
//
sl@0
    28
// Scancode conversion tables
sl@0
    29
// --------------------------
sl@0
    30
// The scancode conversion is arranged as a tree of tables which are used to
sl@0
    31
// convert a scancode to a keycode, taking into account the modifier state
sl@0
    32
// (shift, control, fn)
sl@0
    33
//
sl@0
    34
// How the tables work:
sl@0
    35
// --------------------
sl@0
    36
// Firstly, there is a distinction between the "scancodes" used in scanning
sl@0
    37
// the keyboard, and the "scancodes" used in this files.
sl@0
    38
//
sl@0
    39
// Typically the keyboard driver already contains a table to convert hardware
sl@0
    40
// key location codes produced during keyboard scanning into EPOC "scancodes".
sl@0
    41
// EPOC scancodes are defined for "standard" keys like shift, backspace,
sl@0
    42
// escape, in the TStdScanCode enum (see E32KEYS.H), and should be ASCII codes
sl@0
    43
// for normal characters. The keyboard driver should add these EPOC scancodes
sl@0
    44
// to the event queue, not hardware-dependant key locations.
sl@0
    45
//
sl@0
    46
// For now on "scancode" refers to EPOC scancodes:
sl@0
    47
//
sl@0
    48
// The keyboard is divided into a number of "blocks" of contiguous scancodes
sl@0
    49
//
sl@0
    50
// Blocks map to keycodes in a keycode table, and several blocks can be
sl@0
    51
// grouped and map to a single keycode table. Blocks map into the keycode
sl@0
    52
// table in the order they are declared. For example, if two scancode blocks
sl@0
    53
// with a range of 5 scancodes map to a single 10-entry keycode table, scancodes
sl@0
    54
// which fall in the first block will map to the first 5 entries in the keycode
sl@0
    55
// table, scancodes falling in the second block map the the next 5 entries in
sl@0
    56
// the keycode table.
sl@0
    57
//
sl@0
    58
// In theory it is possible to have multiple [keycode,scancode blocks] groups
sl@0
    59
// but there is little point doing this - grouping all the scancode blocks
sl@0
    60
// with a single keycode table holding all possible keycode values is usually
sl@0
    61
// sufficient (and simpler). However, there are some special cases where this
sl@0
    62
// is useful - the most obvious example is handling of shift and caps lock.
sl@0
    63
// The shift key implies everything that the caps-lock key does (upper case
sl@0
    64
// letters) plus some shifted characters for other keys. This is done by 
sl@0
    65
// defining two tables - the first handles only caps-lock (upper case), the 
sl@0
    66
// second handles all other keys that are affected only by shift. If caps-
sl@0
    67
// lock is active, only the caps-lock table is used. If shift is pressed both
sl@0
    68
// the caps-lock and shift tables are scanned for the conversion. This allows
sl@0
    69
// a base table to be extended with "extras", much like deriving a class from
sl@0
    70
// base class and extending it.
sl@0
    71
//
sl@0
    72
//
sl@0
    73
// There is one or more [keycode table, scancode blocks] group for each
sl@0
    74
// modifier state - e.g. a lower-case table, upper-case, ctrl, ctrl-shift.
sl@0
    75
// This is the root of the table.
sl@0
    76
//
sl@0
    77
// When converting a scancode the key translator first obtains the correct
sl@0
    78
// conversion tables for the modifier state. It then traverses all the scancode
sl@0
    79
// blocks looking for one which contains the scancode being converted. Once
sl@0
    80
// a matching scancode range is located, the key translator maps this into
sl@0
    81
// its position in the associated keycode table to obtain the converted keycode.
sl@0
    82
//
sl@0
    83
// The key tables below appear more complicated than they really are because of
sl@0
    84
// the intermediate structures that hold pointers to other structures. The
sl@0
    85
// important structures are:
sl@0
    86
//		SScanCodeBlock - contains a "start" and "end" for a scancode range
sl@0
    87
//		SConvSubTable - groups a number of scanode blocks with a keycode table
sl@0
    88
//		SConvTableNode - points to SConvSubTables for each modifier state
sl@0
    89
//		SConvTable - the root of the translation table - points to 1..n SConvTableNode
sl@0
    90
//
sl@0
    91
// The keycode tables are just an array of TUint16.
sl@0
    92
//
sl@0
    93
sl@0
    94
sl@0
    95
//
sl@0
    96
// TO DO: (optional)
sl@0
    97
//
sl@0
    98
// Keys which are not affected by modifier state
sl@0
    99
//
sl@0
   100
sl@0
   101
//
sl@0
   102
// This is a simple example of scancode to keycode mapping. The first block
sl@0
   103
// in scanCodeBlock_unmodifiable is a range of several scancodes, so maps to
sl@0
   104
// several entries in the keycode table convKeyCodes_unmodifiable.
sl@0
   105
//		EStdKeyLeftShift -> maps to -> EKeyLeftShift
sl@0
   106
//		EStdKeyRightShift -> maps to -> EKeyRightShift
sl@0
   107
//		...
sl@0
   108
//		EStdKeyScrollLock -> maps to -> EKeyScrollLock
sl@0
   109
//
sl@0
   110
LOCAL_D const SScanCodeBlock scanCodeBlock_unmodifiable[]=
sl@0
   111
	{
sl@0
   112
	{EStdKeyLeftShift, EStdKeyScrollLock},	// range 1: left shift to scroll lock
sl@0
   113
	};
sl@0
   114
sl@0
   115
LOCAL_D const TUint16 convKeyCodes_unmodifiable[]=
sl@0
   116
	{
sl@0
   117
	EKeyLeftShift,
sl@0
   118
	EKeyRightShift,
sl@0
   119
	EKeyLeftAlt,
sl@0
   120
	EKeyRightAlt,
sl@0
   121
	EKeyLeftCtrl,
sl@0
   122
	EKeyRightCtrl,
sl@0
   123
	EKeyLeftFunc,
sl@0
   124
	EKeyRightFunc,
sl@0
   125
	EKeyCapsLock,
sl@0
   126
	EKeyNumLock,
sl@0
   127
	EKeyScrollLock
sl@0
   128
	};
sl@0
   129
sl@0
   130
sl@0
   131
sl@0
   132
//
sl@0
   133
// TO DO: (optional)
sl@0
   134
//
sl@0
   135
// Base conversion table
sl@0
   136
// this table traps all of the keyboard's scanCodes except those in
sl@0
   137
// convKeyCodes_unmodifiable. It appears last in the top-level table and
sl@0
   138
// is used to convert any scancode that is not converted by any of the
sl@0
   139
// other tables
sl@0
   140
//
sl@0
   141
LOCAL_D const SScanCodeBlock scanCodeBlock_base[]=
sl@0
   142
	{
sl@0
   143
	{EStdKeyNull, EStdKeyDownArrow},		// scancode range 1
sl@0
   144
	{'0', '9'},								// scancode range 2
sl@0
   145
	{'A', 'Z'},								// scancode range 3
sl@0
   146
	{EStdKeyF1, EStdKeyDictaphoneRecord},	// scancode range 4
sl@0
   147
	};
sl@0
   148
sl@0
   149
LOCAL_D const TUint16 convKeyCodes_base[]=
sl@0
   150
	{
sl@0
   151
	EKeyNull,				// scancode range 1 mapping starts here
sl@0
   152
	EKeyBackspace,
sl@0
   153
	EKeyTab,
sl@0
   154
	EKeyEnter,
sl@0
   155
	EKeyEscape,
sl@0
   156
	' ',
sl@0
   157
	EKeyPrintScreen,
sl@0
   158
	EKeyPause,
sl@0
   159
	EKeyHome,
sl@0
   160
	EKeyEnd,
sl@0
   161
	EKeyPageUp,
sl@0
   162
	EKeyPageDown,
sl@0
   163
	EKeyInsert,
sl@0
   164
	EKeyDelete,
sl@0
   165
	EKeyLeftArrow,
sl@0
   166
	EKeyRightArrow,
sl@0
   167
	EKeyUpArrow,
sl@0
   168
	EKeyDownArrow,
sl@0
   169
	'0',					// scancode range 2 mapping starts here
sl@0
   170
	'1',
sl@0
   171
	'2',
sl@0
   172
	'3',
sl@0
   173
	'4',
sl@0
   174
	'5',
sl@0
   175
	'6',
sl@0
   176
	'7',
sl@0
   177
	'8',
sl@0
   178
	'9',
sl@0
   179
	'a',					// scancode range 3 mapping starts here
sl@0
   180
	'b',
sl@0
   181
	'c',
sl@0
   182
	'd',
sl@0
   183
	'e',
sl@0
   184
	'f',
sl@0
   185
	'g',
sl@0
   186
	'h',
sl@0
   187
	'i',
sl@0
   188
	'j',
sl@0
   189
	'k',
sl@0
   190
	'l',
sl@0
   191
	'm',
sl@0
   192
	'n',
sl@0
   193
	'o',
sl@0
   194
	'p',
sl@0
   195
	'q',
sl@0
   196
	'r',
sl@0
   197
	's',
sl@0
   198
	't',
sl@0
   199
	'u',
sl@0
   200
	'v',
sl@0
   201
	'w',
sl@0
   202
	'x',
sl@0
   203
	'y',
sl@0
   204
	'z',
sl@0
   205
	EKeyF1,						// scancode range 4 mapping starts here
sl@0
   206
	EKeyF2,
sl@0
   207
	EKeyF3,
sl@0
   208
	EKeyF4,
sl@0
   209
	EKeyF5,
sl@0
   210
	EKeyF6,
sl@0
   211
	EKeyF7,
sl@0
   212
	EKeyF8,
sl@0
   213
	EKeyF9,
sl@0
   214
	EKeyF10,
sl@0
   215
	EKeyF11,
sl@0
   216
	EKeyF12,
sl@0
   217
	EKeyF13,
sl@0
   218
	EKeyF14,
sl@0
   219
	EKeyF15,
sl@0
   220
	EKeyF16,
sl@0
   221
	EKeyF17,
sl@0
   222
	EKeyF18,
sl@0
   223
	EKeyF19,
sl@0
   224
	EKeyF20,
sl@0
   225
	EKeyF21,
sl@0
   226
	EKeyF22,
sl@0
   227
	EKeyF23,
sl@0
   228
	EKeyF24,
sl@0
   229
	'`',
sl@0
   230
	',',
sl@0
   231
	'.',
sl@0
   232
	'/',
sl@0
   233
	'\\',
sl@0
   234
	';',
sl@0
   235
	'\'',
sl@0
   236
	'#',
sl@0
   237
	'[',
sl@0
   238
	']',
sl@0
   239
	'-',
sl@0
   240
	'=',
sl@0
   241
	'/',
sl@0
   242
	'*',
sl@0
   243
	'-',
sl@0
   244
	'+',
sl@0
   245
	EKeyEnter,
sl@0
   246
	EKeyEnd,
sl@0
   247
	EKeyDownArrow,
sl@0
   248
	EKeyPageDown,
sl@0
   249
	EKeyLeftArrow,
sl@0
   250
	EKeyNull, // numeric keypad '5'
sl@0
   251
	EKeyRightArrow,
sl@0
   252
	EKeyHome,
sl@0
   253
	EKeyUpArrow,
sl@0
   254
	EKeyPageUp,
sl@0
   255
	EKeyInsert,
sl@0
   256
	EKeyDelete,
sl@0
   257
	EKeyMenu,
sl@0
   258
	EKeyBacklightOn,
sl@0
   259
	EKeyBacklightOff,
sl@0
   260
	EKeyBacklightToggle,
sl@0
   261
	EKeyIncContrast,
sl@0
   262
	EKeyDecContrast,
sl@0
   263
	EKeySliderDown,
sl@0
   264
	EKeySliderUp,
sl@0
   265
	EKeyDictaphonePlay,
sl@0
   266
	EKeyDictaphoneStop,
sl@0
   267
	EKeyDictaphoneRecord
sl@0
   268
	};
sl@0
   269
sl@0
   270
sl@0
   271
//
sl@0
   272
// TO DO: (optional)
sl@0
   273
//	
sl@0
   274
// caps-lock: this table traps those scanCodes which are affected by caps-lock
sl@0
   275
//
sl@0
   276
LOCAL_D const SScanCodeBlock scanCodeBlock_capsLock[]=
sl@0
   277
	{
sl@0
   278
	{'A', 'Z'}			// only alpha keys are affected by caps-lock
sl@0
   279
	};
sl@0
   280
sl@0
   281
LOCAL_D const TUint16 convKeyCodes_capsLock[]=
sl@0
   282
	{
sl@0
   283
	'A',
sl@0
   284
	'B',
sl@0
   285
	'C',
sl@0
   286
	'D',
sl@0
   287
	'E',
sl@0
   288
	'F',
sl@0
   289
	'G',
sl@0
   290
	'H',
sl@0
   291
	'I',
sl@0
   292
	'J',
sl@0
   293
	'K',
sl@0
   294
	'L',
sl@0
   295
	'M',
sl@0
   296
	'N',
sl@0
   297
	'O',
sl@0
   298
	'P',
sl@0
   299
	'Q',
sl@0
   300
	'R',
sl@0
   301
	'S',
sl@0
   302
	'T',
sl@0
   303
	'U',
sl@0
   304
	'V',
sl@0
   305
	'W',
sl@0
   306
	'X',
sl@0
   307
	'Y',
sl@0
   308
	'Z'
sl@0
   309
	};
sl@0
   310
sl@0
   311
//
sl@0
   312
// TO DO: (optional)
sl@0
   313
//
sl@0
   314
// shift: this table traps those scanCodes which are affected
sl@0
   315
// by normal shift key EXCEPT for those scanCodes affected by caps-lock
sl@0
   316
//
sl@0
   317
sl@0
   318
LOCAL_D const SScanCodeBlock scanCodeBlock_shift[]=
sl@0
   319
	{
sl@0
   320
	{'0', '9'},
sl@0
   321
	{EStdKeyXXX, EStdKeyEquals},
sl@0
   322
	};
sl@0
   323
sl@0
   324
LOCAL_D const TUint16 convKeyCodes_shift[]=
sl@0
   325
	{
sl@0
   326
	')',
sl@0
   327
	'!',
sl@0
   328
	'@',/*'"',*/
sl@0
   329
	'#',			/*ELatin1Pound,*/
sl@0
   330
	'$',
sl@0
   331
	'%',
sl@0
   332
	'^',
sl@0
   333
	'&',
sl@0
   334
	'*',
sl@0
   335
	'(',
sl@0
   336
	'~',   /*ELatin1LogicNot,*/
sl@0
   337
	'<',
sl@0
   338
	'>',
sl@0
   339
	'?',
sl@0
   340
	'|',
sl@0
   341
	':',
sl@0
   342
	'"',
sl@0
   343
	'|', /*'~',*/
sl@0
   344
	'{',
sl@0
   345
	'}',
sl@0
   346
	'_',
sl@0
   347
	'+'
sl@0
   348
	};
sl@0
   349
sl@0
   350
//
sl@0
   351
// TO DO: (optional)
sl@0
   352
//
sl@0
   353
// func: this table traps those scanCodes which are affected
sl@0
   354
// by the func key but not shift
sl@0
   355
//
sl@0
   356
LOCAL_D const SScanCodeBlock scanCodeBlock_func[]=
sl@0
   357
	{
sl@0
   358
    {EStdKeyEscape, EStdKeyEscape},
sl@0
   359
    {'M', 'M'},
sl@0
   360
    {EStdKeyComma, EStdKeyComma},
sl@0
   361
    {EStdKeyLeftArrow, EStdKeyDownArrow},
sl@0
   362
	};
sl@0
   363
sl@0
   364
LOCAL_D const TUint16 convKeyCodes_func[]=
sl@0
   365
	{
sl@0
   366
    EKeyOff,
sl@0
   367
    EKeyDecContrast,
sl@0
   368
    EKeyIncContrast,
sl@0
   369
    EKeyHome,
sl@0
   370
    EKeyEnd,
sl@0
   371
    EKeyPageUp,
sl@0
   372
    EKeyPageDown,
sl@0
   373
	};
sl@0
   374
sl@0
   375
//
sl@0
   376
// TO DO: (optional)
sl@0
   377
//
sl@0
   378
// func: this table traps those scanCodes which are affected
sl@0
   379
// by func and shift - this is for func pressed, shift not pressed
sl@0
   380
//
sl@0
   381
//LOCAL_D const SScanCodeBlock scanCodeBlock_funcUnshifted[]=
sl@0
   382
//	{
sl@0
   383
//	{'E', 'E'},
sl@0
   384
//	};
sl@0
   385
sl@0
   386
//LOCAL_D const TUint16 convKeyCodes_funcUnshifted[]=
sl@0
   387
//	{
sl@0
   388
//	ELatin1LcEacute,
sl@0
   389
//	};
sl@0
   390
sl@0
   391
//
sl@0
   392
// TO DO: (optional)
sl@0
   393
//
sl@0
   394
// func: this table traps those scanCodes which are affected
sl@0
   395
// by func and shift - this is for func and shift both pressed
sl@0
   396
//
sl@0
   397
//LOCAL_D const SScanCodeBlock scanCodeBlock_funcShifted[]=
sl@0
   398
//	{
sl@0
   399
//	{'E', 'E'},
sl@0
   400
//	};
sl@0
   401
sl@0
   402
//LOCAL_D const TUint16 convKeyCodes_funcShifted[]=
sl@0
   403
//	{
sl@0
   404
//	ELatin1UcEacute,
sl@0
   405
//	};
sl@0
   406
sl@0
   407
//
sl@0
   408
// TO DO: (optional)
sl@0
   409
//
sl@0
   410
// ctrl: this table traps those scanCodes which are affected by ctrl
sl@0
   411
//
sl@0
   412
LOCAL_D const SScanCodeBlock scanCodeBlock_ctrl[]=
sl@0
   413
	{
sl@0
   414
	//
sl@0
   415
	// NOTE: The space key gets handled elsewhere, otherwise it gets
sl@0
   416
	// thrown away as a NULL key
sl@0
   417
	//	{EStdKeySpace, EStdKeySpace},
sl@0
   418
sl@0
   419
	{'A', 'Z'},
sl@0
   420
    {EStdKeyComma, EStdKeyComma},
sl@0
   421
	};
sl@0
   422
sl@0
   423
LOCAL_D const TUint16 convKeyCodes_ctrl[]=
sl@0
   424
	{
sl@0
   425
//	0,
sl@0
   426
	1,
sl@0
   427
	2,
sl@0
   428
	3,
sl@0
   429
	4,
sl@0
   430
	5,
sl@0
   431
	6,
sl@0
   432
	7,
sl@0
   433
	8,
sl@0
   434
	9,
sl@0
   435
	10,
sl@0
   436
	11,
sl@0
   437
	12,
sl@0
   438
	13,
sl@0
   439
	14,
sl@0
   440
	15,
sl@0
   441
	16,
sl@0
   442
	17,
sl@0
   443
	18,
sl@0
   444
	19,
sl@0
   445
	20,
sl@0
   446
	21,
sl@0
   447
	22,
sl@0
   448
	23,
sl@0
   449
	24,
sl@0
   450
	25,
sl@0
   451
	26,
sl@0
   452
	',',
sl@0
   453
	};
sl@0
   454
sl@0
   455
sl@0
   456
sl@0
   457
//
sl@0
   458
// TO DO: (optional)
sl@0
   459
//
sl@0
   460
// Each set of scancode+keycode tables must be grouped into a SConvSubTable.
sl@0
   461
// The lines below define a number of SConvSubTables for each of the groups
sl@0
   462
// above.
sl@0
   463
//
sl@0
   464
LOCAL_D const SConvSubTable
sl@0
   465
	convSubTable_unmodifiable=							// table for unmodifiable keys
sl@0
   466
		{
sl@0
   467
		&convKeyCodes_unmodifiable[0],					// the keycode table
sl@0
   468
			{
sl@0
   469
			ARRAY_LENGTH(scanCodeBlock_unmodifiable),	// number of scancode blocks
sl@0
   470
			&scanCodeBlock_unmodifiable[0]				// pointer to scancode blocks
sl@0
   471
			}
sl@0
   472
		},
sl@0
   473
	convSubTable_base=									// table for base keys
sl@0
   474
		{
sl@0
   475
		&convKeyCodes_base[0],							// keycode table
sl@0
   476
			{
sl@0
   477
			ARRAY_LENGTH(scanCodeBlock_base),			// number of scancode blocks
sl@0
   478
			&scanCodeBlock_base[0]						// pointer to scancode blocks
sl@0
   479
			}
sl@0
   480
		},
sl@0
   481
	convSubTable_capsLock=
sl@0
   482
		{
sl@0
   483
		&convKeyCodes_capsLock[0],
sl@0
   484
			{
sl@0
   485
			ARRAY_LENGTH(scanCodeBlock_capsLock),
sl@0
   486
			&scanCodeBlock_capsLock[0]
sl@0
   487
			}
sl@0
   488
		},
sl@0
   489
	convSubTable_shift=
sl@0
   490
		{
sl@0
   491
		&convKeyCodes_shift[0],
sl@0
   492
			{
sl@0
   493
			ARRAY_LENGTH(scanCodeBlock_shift),
sl@0
   494
			&scanCodeBlock_shift[0]
sl@0
   495
			}
sl@0
   496
		},
sl@0
   497
	convSubTable_func=
sl@0
   498
		{
sl@0
   499
		&convKeyCodes_func[0],
sl@0
   500
			{
sl@0
   501
			ARRAY_LENGTH(scanCodeBlock_func),
sl@0
   502
			&scanCodeBlock_func[0]
sl@0
   503
			}
sl@0
   504
		},
sl@0
   505
//	convSubTable_funcUnshifted=
sl@0
   506
//		{
sl@0
   507
//		&convKeyCodes_funcUnshifted[0],
sl@0
   508
//			{
sl@0
   509
//			ARRAY_LENGTH(scanCodeBlock_funcUnshifted),
sl@0
   510
//			&scanCodeBlock_funcUnshifted[0]
sl@0
   511
//			}
sl@0
   512
//		},
sl@0
   513
//	convSubTable_funcShifted=
sl@0
   514
//		{
sl@0
   515
//		&convKeyCodes_funcShifted[0],
sl@0
   516
//			{
sl@0
   517
//			ARRAY_LENGTH(scanCodeBlock_funcShifted),
sl@0
   518
//			&scanCodeBlock_funcShifted[0]
sl@0
   519
//			}
sl@0
   520
//		},
sl@0
   521
	convSubTable_ctrl=
sl@0
   522
		{
sl@0
   523
		&convKeyCodes_ctrl[0],
sl@0
   524
			{
sl@0
   525
			ARRAY_LENGTH(scanCodeBlock_ctrl),
sl@0
   526
			&scanCodeBlock_ctrl[0]
sl@0
   527
			}
sl@0
   528
		};
sl@0
   529
sl@0
   530
//
sl@0
   531
// TO DO: (optional)
sl@0
   532
//
sl@0
   533
// We need to declare arrays of SConvSubTable for each modifier state we
sl@0
   534
// are going to handle. As mentioned above, it is possible to have several
sl@0
   535
// [keycode table, scancode blocks] groups scanned for each keyboard state.
sl@0
   536
//
sl@0
   537
// Some modifier states use more than one conversion group. The simple example
sl@0
   538
// is handling of caps-lock and shift. 
sl@0
   539
//
sl@0
   540
// Caps-lock means all letters are upper-case
sl@0
   541
// shift means all letters are upper case AND some other keys return control characters
sl@0
   542
//
sl@0
   543
// Obviously the shift key means everything cpas-lock means PLUS a bit more. So
sl@0
   544
// we define two tables, the caps-lock table defines only the uppercase conversion,
sl@0
   545
// and the shift table defines all OTHER shifted keys not already handled by
sl@0
   546
// caps-lock. The caps-lock modifier state then only scans the caps-lock table, and
sl@0
   547
// the shift state scans both tables.
sl@0
   548
//
sl@0
   549
LOCAL_D const SConvSubTable
sl@0
   550
	* const convSubTableArray_unmodifiable[]={&convSubTable_unmodifiable},
sl@0
   551
	* const convSubTableArray_base[]={&convSubTable_base},
sl@0
   552
sl@0
   553
	//
sl@0
   554
	// The caps-lock state scans only the caps-lock table, to handle
sl@0
   555
	// conversion to upper case
sl@0
   556
	//
sl@0
   557
	* const convSubTableArray_capsLock[]={&convSubTable_capsLock},
sl@0
   558
	//
sl@0
   559
	// The shift table scans the caps-lock table to handle upper case, 
sl@0
   560
	// and also the shift table which handles some keys that are not affected
sl@0
   561
	// by caps lock (such as 0-9).
sl@0
   562
	//
sl@0
   563
	* const convSubTableArray_shift[]={&convSubTable_capsLock, &convSubTable_shift},
sl@0
   564
	//
sl@0
   565
	// Pressing shift with caps-lock active reverts to lower-case letters,
sl@0
   566
	// but other keys remain shifted. This time we only scan the shift table
sl@0
   567
	// so only the non-alpha keys will be shifted
sl@0
   568
	//
sl@0
   569
	* const convSubTableArray_capsLockShift[]={&convSubTable_shift},
sl@0
   570
sl@0
   571
	//
sl@0
   572
	// Like the shift/caps-lock situation, the function key has two states,
sl@0
   573
	// shifted and unshifted. Also, some keys may be independant of whether
sl@0
   574
	// the shift key is pressed. So there are three tables defined. One declares
sl@0
   575
	// all keys that are independant of shift state, the other two tables handle
sl@0
   576
	// shifted and unshifted func.
sl@0
   577
	//
sl@0
   578
	// Unshifted func uses the independant set + funcUnshifted
sl@0
   579
	//
sl@0
   580
	//	* const convSubTableArray_func[]={&convSubTable_func, &convSubTable_funcUnshifted},
sl@0
   581
	* const convSubTableArray_func[]={&convSubTable_func},
sl@0
   582
	//
sl@0
   583
	// Shifted func uses the independant set + funcShifted
sl@0
   584
	//
sl@0
   585
	//	* const convSubTableArray_funcShift[]={&convSubTable_func,&convSubTable_funcShifted},
sl@0
   586
	//
sl@0
   587
	// This keyboard table makes control independant of func and shift
sl@0
   588
	//
sl@0
   589
	* const convSubTableArray_ctrl[]={&convSubTable_ctrl};
sl@0
   590
sl@0
   591
//
sl@0
   592
// TO DO: (optional)
sl@0
   593
//
sl@0
   594
// This is the top of the scancode conversion tree. It is a set of pointers
sl@0
   595
// to the SConvSubTable arrays declared above.
sl@0
   596
//
sl@0
   597
// The order of these nodes is VITAL, as the scanCode/modifiers are
sl@0
   598
// searched for a match in this order
sl@0
   599
//
sl@0
   600
// The modifier state is matched by using a mask and a compare value. This is
sl@0
   601
// used as follows:
sl@0
   602
//
sl@0
   603
//	match is true if ( (modifierState & mask) == compareValue
sl@0
   604
//
sl@0
   605
// For example, if the mask is (EModifierFunc|EModifierShift) and the
sl@0
   606
// compare value is EModifierFunc, this will match ANY combination of
sl@0
   607
// modifiers that has func pressed and shift not pressed
sl@0
   608
//
sl@0
   609
LOCAL_D const SConvTableNode convTableNodes[]=
sl@0
   610
	{
sl@0
   611
		{
sl@0
   612
			{
sl@0
   613
			0,		// modifier mask = no modifiers
sl@0
   614
			0		// modifier compare = no modifiers
sl@0
   615
			},
sl@0
   616
		ARRAY_LENGTH(convSubTableArray_unmodifiable),	// number of SConvSubTables
sl@0
   617
		&convSubTableArray_unmodifiable[0]				// pointer to SConvSubTable array
sl@0
   618
		},
sl@0
   619
		{
sl@0
   620
			{
sl@0
   621
			EModifierCtrl,	// modifier mask = check for ctrl
sl@0
   622
			EModifierCtrl	// modifier compare = anything with ctrl pressed
sl@0
   623
			},
sl@0
   624
		ARRAY_LENGTH(convSubTableArray_ctrl),
sl@0
   625
		&convSubTableArray_ctrl[0]
sl@0
   626
		},
sl@0
   627
		{
sl@0
   628
			{
sl@0
   629
			//
sl@0
   630
			// Check for Func pressed
sl@0
   631
			//
sl@0
   632
			EModifierFunc,
sl@0
   633
			EModifierFunc
sl@0
   634
			},
sl@0
   635
		ARRAY_LENGTH(convSubTableArray_func),
sl@0
   636
		&convSubTableArray_func[0]
sl@0
   637
		},
sl@0
   638
		{
sl@0
   639
			{
sl@0
   640
			//
sl@0
   641
			// Check for caps-lock pressed, shift not pressed
sl@0
   642
			//
sl@0
   643
			EModifierCapsLock|EModifierShift,
sl@0
   644
			EModifierCapsLock
sl@0
   645
			},
sl@0
   646
		ARRAY_LENGTH(convSubTableArray_capsLock),
sl@0
   647
		&convSubTableArray_capsLock[0]
sl@0
   648
		},
sl@0
   649
		{
sl@0
   650
			{
sl@0
   651
			//
sl@0
   652
			// Check for caps-lock not pressed, shift pressed
sl@0
   653
			//
sl@0
   654
			EModifierShift|EModifierCapsLock,
sl@0
   655
			EModifierShift
sl@0
   656
			},
sl@0
   657
		ARRAY_LENGTH(convSubTableArray_shift),
sl@0
   658
		&convSubTableArray_shift[0]
sl@0
   659
		},
sl@0
   660
		{
sl@0
   661
			{
sl@0
   662
			//
sl@0
   663
			// Check for caps-lock pressed, shift pressed
sl@0
   664
			//
sl@0
   665
			EModifierCapsLock|EModifierShift,
sl@0
   666
			EModifierCapsLock|EModifierShift
sl@0
   667
			},
sl@0
   668
		ARRAY_LENGTH(convSubTableArray_capsLockShift),
sl@0
   669
		&convSubTableArray_capsLockShift[0]
sl@0
   670
		},
sl@0
   671
		{
sl@0
   672
		//
sl@0
   673
		// This is the base table. It must appear last so that it can
sl@0
   674
		// provide a default conversion for any scancodes that are not
sl@0
   675
		// handled by any of the tables above
sl@0
   676
		//
sl@0
   677
			{
sl@0
   678
			0,
sl@0
   679
			0
sl@0
   680
			},
sl@0
   681
		ARRAY_LENGTH(convSubTableArray_base),
sl@0
   682
		&convSubTableArray_base[0]
sl@0
   683
		}
sl@0
   684
	};
sl@0
   685
sl@0
   686
//
sl@0
   687
// The top-level exported data structure of all the conversion tables
sl@0
   688
// This just points to the SConvTableNodes above
sl@0
   689
//
sl@0
   690
LOCAL_D const SConvTable ConvTable=
sl@0
   691
	{
sl@0
   692
	ARRAY_LENGTH(convTableNodes),
sl@0
   693
	&convTableNodes[0]
sl@0
   694
	};
sl@0
   695
sl@0
   696
// The list of scan-codes on the numeric keypad
sl@0
   697
LOCAL_D const SScanCodeBlock keypadScanCodeBlockArray[]=
sl@0
   698
	{
sl@0
   699
	{EStdKeyNumLock, EStdKeyNumLock},
sl@0
   700
	{EStdKeyNkpForwardSlash, EStdKeyNkpFullStop}
sl@0
   701
	};
sl@0
   702
sl@0
   703
LOCAL_D const SScanCodeBlockList ConvTableKeypadScanCodes=
sl@0
   704
	{
sl@0
   705
	ARRAY_LENGTH(keypadScanCodeBlockArray),
sl@0
   706
	&keypadScanCodeBlockArray[0]
sl@0
   707
	};
sl@0
   708
sl@0
   709
//
sl@0
   710
// TO DO: (optional)
sl@0
   711
//
sl@0
   712
// List of keycodes that do not autorepeat
sl@0
   713
//
sl@0
   714
// These are usually control keys like shift, ctrl, escape
sl@0
   715
//
sl@0
   716
LOCAL_D const TUint16 nonAutorepKeyCodeArray[]=
sl@0
   717
	{
sl@0
   718
	EKeyEscape,
sl@0
   719
	EKeyPrintScreen,
sl@0
   720
	EKeyPause,
sl@0
   721
	EKeyInsert,
sl@0
   722
	EKeyLeftShift,
sl@0
   723
	EKeyRightShift,
sl@0
   724
	EKeyLeftAlt,
sl@0
   725
	EKeyRightAlt,
sl@0
   726
	EKeyLeftCtrl,
sl@0
   727
	EKeyRightCtrl,
sl@0
   728
	EKeyLeftFunc,
sl@0
   729
	EKeyRightFunc,
sl@0
   730
	EKeyCapsLock,
sl@0
   731
	EKeyNumLock,
sl@0
   732
	EKeyScrollLock,
sl@0
   733
	EKeyMenu,
sl@0
   734
	EKeyDictaphonePlay,
sl@0
   735
	EKeyDictaphoneStop,
sl@0
   736
	EKeyDictaphoneRecord
sl@0
   737
	};
sl@0
   738
sl@0
   739
//
sl@0
   740
// TO DO: (optional)
sl@0
   741
//
sl@0
   742
// Declare blocks of non-autorepeating keycodes
sl@0
   743
//
sl@0
   744
LOCAL_D const SKeyCodeList ConvTableNonAutorepKeyCodes=
sl@0
   745
	{
sl@0
   746
	ARRAY_LENGTH(nonAutorepKeyCodeArray),	// number of keycode arrays
sl@0
   747
	&nonAutorepKeyCodeArray[0]				// pointer to arrays
sl@0
   748
	};
sl@0
   749
sl@0
   750
sl@0
   751
sl@0
   752
sl@0
   753
sl@0
   754
sl@0
   755
/////////////////////////////////////////////////////////////////////
sl@0
   756
// Keyboard state tables
sl@0
   757
//
sl@0
   758
sl@0
   759
// What these tables do
sl@0
   760
// --------------------
sl@0
   761
//
sl@0
   762
// These tables control the way "special" keystrokes modify the behaviour
sl@0
   763
// of the keyboard. There are two major uses for this:
sl@0
   764
//
sl@0
   765
//	- handling modifier keys e.g. caps-lock, shift, alt, fn and defining
sl@0
   766
//		what modifier flags are affected by these keypresses
sl@0
   767
//
sl@0
   768
//	- switching the keyboard into special states (see below)
sl@0
   769
//
sl@0
   770
// Keyboard states
sl@0
   771
// ---------------
sl@0
   772
// 
sl@0
   773
// Keyboard states are used to switch the keyboard into a special mode where it
sl@0
   774
// can be used to enter unusual characters. There are two uses for this:
sl@0
   775
//
sl@0
   776
// - entering numeric codes, by pressing ctrl and typing the decimal code
sl@0
   777
// - entering accented characters by pressing a key combination which
sl@0
   778
//		enters "accented mode" then pressing a key. There can be multiple
sl@0
   779
//		accented modes.
sl@0
   780
//
sl@0
   781
// You can see an example of accented modes on a Psion Series 5 by
sl@0
   782
// pressing Fn+Z, followed by A - this will produce an a with an umlaut (ä)
sl@0
   783
//
sl@0
   784
// These tables are also used to select simpler states such as caps-lock
sl@0
   785
// and num-lock.
sl@0
   786
//
sl@0
   787
//
sl@0
   788
// The main data structure is a SFuncTableEntry. Each of these contains
sl@0
   789
// three fields:
sl@0
   790
//
sl@0
   791
// 1. modifier match - this works the same way as the scancode conversion
sl@0
   792
//     tables above, there is a mask and a compare value
sl@0
   793
//
sl@0
   794
// 2. a keycode patters - this is used to match with the keycode or keycodes
sl@0
   795
//     that the state should respond to. This is a TKeyCodePattern structure
sl@0
   796
//     which defines what sort of match should be performed.
sl@0
   797
//
sl@0
   798
// 3. a function and state change structure, SFuncAndState. This defines the
sl@0
   799
//     state to change to, the function to perform, and a parameter for the
sl@0
   800
//     function if required.
sl@0
   801
//
sl@0
   802
// TKeyCodePattern structures have two fields. The first is a keycode value
sl@0
   803
// and is only used for some match types. The second field select the type
sl@0
   804
// of match to perform:
sl@0
   805
//
sl@0
   806
//	EAnyKey - match any key
sl@0
   807
//	EAnyAlphaNumeric - match any alpha or numeric key
sl@0
   808
//	EAnyAlpha - match any alpha key
sl@0
   809
//	EAnyAlphaLowerCase - match any lower-case key
sl@0
   810
//	EAnyAlphaUpperCase - match any upper-case key
sl@0
   811
//	EAnyDecimalDigit - match any decimal digit
sl@0
   812
//	EAnyModifierKey - match any modifier key (e.g. alt, fn, ctrl)
sl@0
   813
//	EMatchKey - match if equal to keycode value in first field
sl@0
   814
//	EMatchLeftOrRight - match if equal to keycode value or (keycode value + 1)
sl@0
   815
//	EMatchKeyCaseInsens - like EMatchKey but perform case-insensitive comparison
sl@0
   816
//
sl@0
   817
//
sl@0
   818
sl@0
   819
// the "array" parameter must be a true array and not a pointer
sl@0
   820
#define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0]))
sl@0
   821
sl@0
   822
#define TABLE_ENTRY_ANOTHER_CTRL_DIGIT					\
sl@0
   823
	{  													\
sl@0
   824
		{												\
sl@0
   825
		EModifierKeyUp|EModifierFunc,					\
sl@0
   826
		0												\
sl@0
   827
		},												\
sl@0
   828
		{												\
sl@0
   829
		EKeyNull,										\
sl@0
   830
		EAnyDigitGivenRadix								\
sl@0
   831
		},												\
sl@0
   832
		{												\
sl@0
   833
		EStateCtrlDigits,								\
sl@0
   834
		EAddOnCtrlDigit,								\
sl@0
   835
		0												\
sl@0
   836
		}												\
sl@0
   837
	}
sl@0
   838
sl@0
   839
//
sl@0
   840
// TO DO: (optional)
sl@0
   841
//
sl@0
   842
// This table is searched for a match if a match has not been
sl@0
   843
// found in the current state's table
sl@0
   844
//
sl@0
   845
sl@0
   846
LOCAL_D const SFuncTableEntry defaultTable[]=
sl@0
   847
	{
sl@0
   848
		{ 
sl@0
   849
		//
sl@0
   850
		// prevent key up events generating keycodes
sl@0
   851
		//
sl@0
   852
			{
sl@0
   853
			EModifierKeyUp,		// mask = key up
sl@0
   854
			EModifierKeyUp		// match = key up - i.e. accept any key up event
sl@0
   855
			},
sl@0
   856
			{
sl@0
   857
			EKeyNull,			// dummy value, not used
sl@0
   858
			EAnyKey				// accept any key
sl@0
   859
			},
sl@0
   860
			{
sl@0
   861
			EStateUnchanged,	// state will not change
sl@0
   862
			EDoNothing,			// no action to perform
sl@0
   863
			0
sl@0
   864
			}
sl@0
   865
		},
sl@0
   866
		{ 
sl@0
   867
		//
sl@0
   868
		// prevent any modifier key (e.g. shift, ctrl) from changing state
sl@0
   869
		//
sl@0
   870
			{
sl@0
   871
			0,					// match any modifier state
sl@0
   872
			0
sl@0
   873
			},
sl@0
   874
			{
sl@0
   875
			EKeyNull,			// dummy value
sl@0
   876
			EAnyModifierKey		// match any modifier key
sl@0
   877
			},
sl@0
   878
			{
sl@0
   879
			EStateUnchanged,	// don't change state
sl@0
   880
			EDoNothing,			// nothing to do
sl@0
   881
			0
sl@0
   882
			}
sl@0
   883
		},
sl@0
   884
		{ 
sl@0
   885
		//
sl@0
   886
		// filter out any unprocessed codes
sl@0
   887
		//
sl@0
   888
			{
sl@0
   889
			0,					// match any modifier state
sl@0
   890
			0
sl@0
   891
			},
sl@0
   892
			{
sl@0
   893
			EKeyNull,			// dummy value
sl@0
   894
			EAnyKey				// match any key
sl@0
   895
			},
sl@0
   896
			{
sl@0
   897
			EStateNormal,		// switch back to normal keyboard state
sl@0
   898
			EDoNothing,			// nothing to do
sl@0
   899
			0
sl@0
   900
			}
sl@0
   901
		}
sl@0
   902
	};
sl@0
   903
sl@0
   904
//
sl@0
   905
// TO DO: (optional)
sl@0
   906
//
sl@0
   907
// This table controls which keys change which modifiers;
sl@0
   908
// NOTE: the state field in this table is ignored
sl@0
   909
//
sl@0
   910
sl@0
   911
LOCAL_D const SFuncTableEntry modifierTable[]=
sl@0
   912
	{
sl@0
   913
		{
sl@0
   914
			{
sl@0
   915
			EModifierKeyUp,		// check key-up modifier flag
sl@0
   916
			0					// make sure it's zero (i.e. ignore key-up events)
sl@0
   917
			},
sl@0
   918
			{
sl@0
   919
			//
sl@0
   920
			// Here we want to match only the caps-lock key. We specify the
sl@0
   921
			// keycode we are looking for in the first field, and EMatchKey
sl@0
   922
			// in the second field
sl@0
   923
			//
sl@0
   924
			EKeyCapsLock,		// we want to respond to caps-lock key
sl@0
   925
			EMatchKey			// match caps-lock only
sl@0
   926
			},
sl@0
   927
			{
sl@0
   928
			EStateUnchanged,	// ignored
sl@0
   929
			EToggleModifier,	// function = toggle modifier state
sl@0
   930
			EModifierCapsLock	// this is the modifier to toggle
sl@0
   931
			}
sl@0
   932
		},
sl@0
   933
		{
sl@0
   934
			{
sl@0
   935
			EModifierKeyUp,
sl@0
   936
			0
sl@0
   937
			},
sl@0
   938
			{
sl@0
   939
			EKeyNumLock,		// this one matched num-lock
sl@0
   940
			EMatchKey			// match only num-lock
sl@0
   941
			},
sl@0
   942
			{
sl@0
   943
			EStateUnchanged,	// ignored
sl@0
   944
			EToggleModifier,	// function = toggle modifier state
sl@0
   945
			EModifierNumLock	// this is the modifier to toggle
sl@0
   946
			}
sl@0
   947
		},
sl@0
   948
		{
sl@0
   949
			{
sl@0
   950
			EModifierKeyUp,
sl@0
   951
			0
sl@0
   952
			},
sl@0
   953
			{
sl@0
   954
			EKeyScrollLock,		// match scroll-lock key
sl@0
   955
			EMatchKey
sl@0
   956
			},
sl@0
   957
			{
sl@0
   958
			EStateUnchanged,
sl@0
   959
			EToggleModifier,	// function = toggle modifier
sl@0
   960
			EModifierScrollLock	// modifier to toggle
sl@0
   961
			}
sl@0
   962
		},
sl@0
   963
		{
sl@0
   964
			{
sl@0
   965
			EModifierKeyUp,
sl@0
   966
			0
sl@0
   967
			},
sl@0
   968
			{
sl@0
   969
			EKeyLeftAlt,		// match left alt key
sl@0
   970
			EMatchKey
sl@0
   971
			},
sl@0
   972
			{
sl@0
   973
			EStateUnchanged,	// ignored
sl@0
   974
			ETurnOnModifier,	// function = turn on a modifier
sl@0
   975
			EModifierAlt|EModifierLeftAlt	// alt turns on this modifier combination
sl@0
   976
			}
sl@0
   977
		},
sl@0
   978
		{
sl@0
   979
			{
sl@0
   980
			EModifierKeyUp,		// goes with previous table, this handles the alt
sl@0
   981
			EModifierKeyUp		// key being released
sl@0
   982
			},
sl@0
   983
			{
sl@0
   984
			EKeyLeftAlt,		// match left alt key again
sl@0
   985
			EMatchKey
sl@0
   986
			},
sl@0
   987
			{
sl@0
   988
			EStateUnchanged,
sl@0
   989
			ETurnOffModifier,	// function = turn off the modifier
sl@0
   990
			EModifierLeftAlt	// modifier to turn off
sl@0
   991
			}
sl@0
   992
		},
sl@0
   993
		{
sl@0
   994
			{
sl@0
   995
			EModifierKeyUp,		// key down event (key-up flag == 0)
sl@0
   996
			0
sl@0
   997
			},
sl@0
   998
			{
sl@0
   999
			EKeyLeftFunc,		// match left fn key
sl@0
  1000
			EMatchKey
sl@0
  1001
			},
sl@0
  1002
			{
sl@0
  1003
			EStateUnchanged,	// ignored
sl@0
  1004
			ETurnOnModifier,	// function = turn on modifier
sl@0
  1005
			EModifierFunc|EModifierLeftFunc	// modifier combination to turn on
sl@0
  1006
			}
sl@0
  1007
		},
sl@0
  1008
		{
sl@0
  1009
			{
sl@0
  1010
			EModifierKeyUp,		// goes with above table, this matched the
sl@0
  1011
			EModifierKeyUp		// left-fn key up event
sl@0
  1012
			},
sl@0
  1013
			{
sl@0
  1014
			EKeyLeftFunc,		// match left fn key
sl@0
  1015
			EMatchKey
sl@0
  1016
			},
sl@0
  1017
			{
sl@0
  1018
			EStateUnchanged,	// ignored
sl@0
  1019
			ETurnOffModifier,	// function = turn off modifier
sl@0
  1020
			EModifierLeftFunc	// modifier to turn off
sl@0
  1021
			}
sl@0
  1022
		},
sl@0
  1023
		{
sl@0
  1024
			{
sl@0
  1025
			EModifierKeyUp,		// key down event (key-up flag == 0)
sl@0
  1026
			0
sl@0
  1027
			},
sl@0
  1028
			{
sl@0
  1029
			EKeyLeftShift,		// match left shift key
sl@0
  1030
			EMatchKey
sl@0
  1031
			},
sl@0
  1032
			{
sl@0
  1033
			EStateUnchanged,	// ignored
sl@0
  1034
			ETurnOnModifier,	// function = turn on modifier
sl@0
  1035
			EModifierShift|EModifierLeftShift	// modifier combination to turn on
sl@0
  1036
			}
sl@0
  1037
		},
sl@0
  1038
		{
sl@0
  1039
			{
sl@0
  1040
			EModifierKeyUp,		// goes with above table, matches left shift
sl@0
  1041
			EModifierKeyUp		// key up event
sl@0
  1042
			},
sl@0
  1043
			{
sl@0
  1044
			EKeyLeftShift,		// match left shift key
sl@0
  1045
			EMatchKey
sl@0
  1046
			},
sl@0
  1047
			{
sl@0
  1048
			EStateUnchanged,	// ignored
sl@0
  1049
			ETurnOffModifier,	// turn off modifier
sl@0
  1050
			EModifierLeftShift	// modifier to turn off
sl@0
  1051
			}
sl@0
  1052
		},
sl@0
  1053
		{
sl@0
  1054
			{
sl@0
  1055
			EModifierKeyUp,		// key down event (key-up flag == 0)
sl@0
  1056
			0
sl@0
  1057
			},
sl@0
  1058
			{
sl@0
  1059
			EKeyLeftCtrl,		// match left ctrl key
sl@0
  1060
			EMatchKey
sl@0
  1061
			},
sl@0
  1062
			{
sl@0
  1063
			EStateUnchanged,	// ignored
sl@0
  1064
			ETurnOnModifier,	// function = turn on modifier
sl@0
  1065
			EModifierCtrl|EModifierLeftCtrl	// modifier combination to turn on
sl@0
  1066
			}
sl@0
  1067
		},
sl@0
  1068
		{
sl@0
  1069
			{
sl@0
  1070
			EModifierKeyUp,		// goes with above table, matches left ctrl
sl@0
  1071
			EModifierKeyUp		// key up event
sl@0
  1072
			},
sl@0
  1073
			{
sl@0
  1074
			EKeyLeftCtrl,		// match left ctrl key
sl@0
  1075
			EMatchKey
sl@0
  1076
			},
sl@0
  1077
			{
sl@0
  1078
			EStateUnchanged,	// ignored
sl@0
  1079
			ETurnOffModifier,	// function = turn off modifier
sl@0
  1080
			EModifierLeftCtrl	// modifier to turn off
sl@0
  1081
			}
sl@0
  1082
		},
sl@0
  1083
		{
sl@0
  1084
			{
sl@0
  1085
			EModifierKeyUp,		// key down event (key-up flag == 0)
sl@0
  1086
			0
sl@0
  1087
			},
sl@0
  1088
			{
sl@0
  1089
			EKeyRightAlt,		// match right alt key
sl@0
  1090
			EMatchKey
sl@0
  1091
			},
sl@0
  1092
			{
sl@0
  1093
			EStateUnchanged,	// ignored
sl@0
  1094
			ETurnOnModifier,	// function = turn on modifier
sl@0
  1095
			EModifierAlt|EModifierRightAlt	// modifier combination to turn on
sl@0
  1096
			}
sl@0
  1097
		},
sl@0
  1098
		{
sl@0
  1099
			{
sl@0
  1100
			EModifierKeyUp,		// goes with above table, matches right alt
sl@0
  1101
			EModifierKeyUp		// key up event
sl@0
  1102
			},
sl@0
  1103
			{
sl@0
  1104
			EKeyRightAlt,		// match right alt key
sl@0
  1105
			EMatchKey
sl@0
  1106
			},
sl@0
  1107
			{
sl@0
  1108
			EStateUnchanged,	// ignored
sl@0
  1109
			ETurnOffModifier,	// function = turn off modifier
sl@0
  1110
			EModifierRightAlt	// modifier to turn off
sl@0
  1111
			}
sl@0
  1112
		},
sl@0
  1113
		{
sl@0
  1114
			{
sl@0
  1115
			EModifierKeyUp,		// key down event (key-up flag == 0)
sl@0
  1116
			0
sl@0
  1117
			},
sl@0
  1118
			{
sl@0
  1119
			EKeyRightFunc,		// match right fn key
sl@0
  1120
			EMatchKey
sl@0
  1121
			},
sl@0
  1122
			{
sl@0
  1123
			EStateUnchanged,	// ignored
sl@0
  1124
			ETurnOnModifier,	// function = turn on modifier
sl@0
  1125
			EModifierFunc|EModifierRightFunc	// modifier combination to turn on
sl@0
  1126
			}
sl@0
  1127
		},
sl@0
  1128
		{
sl@0
  1129
			{
sl@0
  1130
			EModifierKeyUp,		// goes with above table, matches right fn
sl@0
  1131
			EModifierKeyUp		// key up event
sl@0
  1132
			},
sl@0
  1133
			{
sl@0
  1134
			EKeyRightFunc,		// match right fn key
sl@0
  1135
			EMatchKey
sl@0
  1136
			},
sl@0
  1137
			{
sl@0
  1138
			EStateUnchanged,	// ignored
sl@0
  1139
			ETurnOffModifier,	// function = turn off modifier
sl@0
  1140
			EModifierRightFunc	// modifier to turn off
sl@0
  1141
			}
sl@0
  1142
		},
sl@0
  1143
		{
sl@0
  1144
			{
sl@0
  1145
			EModifierKeyUp,		// key down event (key-up flag == 0)
sl@0
  1146
			0
sl@0
  1147
			},
sl@0
  1148
			{
sl@0
  1149
			EKeyRightShift,		// match right shift key
sl@0
  1150
			EMatchKey
sl@0
  1151
			},
sl@0
  1152
			{
sl@0
  1153
			EStateUnchanged,	// ignored
sl@0
  1154
			ETurnOnModifier,	// function = turn on modifier
sl@0
  1155
			EModifierShift|EModifierRightShift	// modifier combinatoin to turn on
sl@0
  1156
			}
sl@0
  1157
		},
sl@0
  1158
		{
sl@0
  1159
			{
sl@0
  1160
			EModifierKeyUp,		// goes with above table, handles right shift
sl@0
  1161
			EModifierKeyUp		// key up event
sl@0
  1162
			},
sl@0
  1163
			{
sl@0
  1164
			EKeyRightShift,		// match right shift key
sl@0
  1165
			EMatchKey
sl@0
  1166
			},
sl@0
  1167
			{
sl@0
  1168
			EStateUnchanged,	// ignored
sl@0
  1169
			ETurnOffModifier,	// function = turn off modifier
sl@0
  1170
			EModifierRightShift	// modifier to turn off
sl@0
  1171
			}
sl@0
  1172
		},
sl@0
  1173
		{
sl@0
  1174
			{
sl@0
  1175
			EModifierKeyUp,		// key down event (key-up flag == 0)
sl@0
  1176
			0
sl@0
  1177
			},
sl@0
  1178
			{
sl@0
  1179
			EKeyRightCtrl,		// match right ctrl key
sl@0
  1180
			EMatchKey
sl@0
  1181
			},
sl@0
  1182
			{
sl@0
  1183
			EStateUnchanged,	// ignored
sl@0
  1184
			ETurnOnModifier,	// function = turn on modifier
sl@0
  1185
			EModifierCtrl|EModifierRightCtrl	// modifier combination to turn on
sl@0
  1186
			}
sl@0
  1187
		},
sl@0
  1188
		{
sl@0
  1189
			{
sl@0
  1190
			EModifierKeyUp,		// goes with above table, matched right ctrl
sl@0
  1191
			EModifierKeyUp		// key up event
sl@0
  1192
			},
sl@0
  1193
			{
sl@0
  1194
			EKeyRightCtrl,		// match right ctrl key
sl@0
  1195
			EMatchKey
sl@0
  1196
			},
sl@0
  1197
			{
sl@0
  1198
			EStateUnchanged,	// ignored
sl@0
  1199
			ETurnOffModifier,	// function = turn off modifier
sl@0
  1200
			EModifierRightCtrl	// modifier to turn off
sl@0
  1201
			}
sl@0
  1202
		}
sl@0
  1203
	};
sl@0
  1204
sl@0
  1205
sl@0
  1206
//
sl@0
  1207
// TO DO: (optional)
sl@0
  1208
//
sl@0
  1209
// Tables corresponding to keyboard states.
sl@0
  1210
//
sl@0
  1211
// There are 13 keyboard states. States 0 to 9 can be used to create alternative
sl@0
  1212
// keyboard layouts for entering accented or unusual characters. Switching into
sl@0
  1213
// these states is done by a keypress. Implementation of the states is optional
sl@0
  1214
// depending on how many special state you want - you may implement 10 states,
sl@0
  1215
// you might decide not to implement any.
sl@0
  1216
//
sl@0
  1217
// State 10 is the normal state. The table for state 10 defines which keypresses
sl@0
  1218
// change to other states.
sl@0
  1219
//
sl@0
  1220
// States 11 and 12 are used when entering the numeric code of a character. State
sl@0
  1221
// 11 is for entering a specific number of digits. State 12 is for accepting
sl@0
  1222
// digits until Ctrl is released.
sl@0
  1223
//	
sl@0
  1224
//
sl@0
  1225
// As before, each SFuncTableEntry entry defines:
sl@0
  1226
//	- modifier conditions that must be matched
sl@0
  1227
//	- a keycode match pattern (typically an exact key match)
sl@0
  1228
//	- the function to perform and new state
sl@0
  1229
//
sl@0
  1230
// Switching into states 0..9,11,12 is done by entries in table10
sl@0
  1231
//
sl@0
  1232
sl@0
  1233
//LOCAL_D const SFuncTableEntry table0[]=
sl@0
  1234
//	{
sl@0
  1235
//	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  1236
//	};
sl@0
  1237
sl@0
  1238
LOCAL_D const SFuncTableEntry table1[]=
sl@0
  1239
	{
sl@0
  1240
	//
sl@0
  1241
	// Table for special keyboard state 1
sl@0
  1242
	// This state is entered by pressing Fn+q (see table10)
sl@0
  1243
	//
sl@0
  1244
	// The table makes certain keys return accented characters
sl@0
  1245
	//
sl@0
  1246
		{
sl@0
  1247
			{
sl@0
  1248
			//
sl@0
  1249
			// Function must be release, and this must be a key down event
sl@0
  1250
			//
sl@0
  1251
			EModifierFunc|EModifierKeyUp,
sl@0
  1252
			0
sl@0
  1253
			},
sl@0
  1254
			{
sl@0
  1255
			//
sl@0
  1256
			// match an 'e' keypress, convert to an ae ligature (æ)
sl@0
  1257
			//
sl@0
  1258
			'e',
sl@0
  1259
			EMatchKeyCaseInsens
sl@0
  1260
			},
sl@0
  1261
			{
sl@0
  1262
			EStateNormal,			// switch back to state normal (table10)
sl@0
  1263
			EPassSpecialKeyThru,	// turn keypress into a special character
sl@0
  1264
			ELatin1LcAe				// this is the character to pass on
sl@0
  1265
			}
sl@0
  1266
		},
sl@0
  1267
		{
sl@0
  1268
			{
sl@0
  1269
			EModifierFunc|EModifierKeyUp,
sl@0
  1270
			0
sl@0
  1271
			},
sl@0
  1272
			{
sl@0
  1273
			'c',
sl@0
  1274
			EMatchKeyCaseInsens
sl@0
  1275
			},
sl@0
  1276
			{
sl@0
  1277
			EStateNormal,
sl@0
  1278
			EPassSpecialKeyThru,
sl@0
  1279
			ELatin1LcCcedilla
sl@0
  1280
			}
sl@0
  1281
		},
sl@0
  1282
		{
sl@0
  1283
			{
sl@0
  1284
			EModifierFunc|EModifierKeyUp,
sl@0
  1285
			0
sl@0
  1286
			},
sl@0
  1287
			{
sl@0
  1288
			's',
sl@0
  1289
			EMatchKeyCaseInsens
sl@0
  1290
			},
sl@0
  1291
			{
sl@0
  1292
			EStateNormal,
sl@0
  1293
			EPassSpecialKeyThru,
sl@0
  1294
			ELatin1EsTset
sl@0
  1295
			}
sl@0
  1296
		},
sl@0
  1297
		{
sl@0
  1298
			{
sl@0
  1299
			EModifierFunc|EModifierKeyUp,
sl@0
  1300
			0
sl@0
  1301
			},
sl@0
  1302
			{
sl@0
  1303
			'o',
sl@0
  1304
			EMatchKeyCaseInsens
sl@0
  1305
			},
sl@0
  1306
			{
sl@0
  1307
			EStateNormal,
sl@0
  1308
			EPassSpecialKeyThru,
sl@0
  1309
			ELatin1LcOslash
sl@0
  1310
			}
sl@0
  1311
		},
sl@0
  1312
		{
sl@0
  1313
			{
sl@0
  1314
			EModifierFunc|EModifierKeyUp,
sl@0
  1315
			0
sl@0
  1316
			},
sl@0
  1317
			{
sl@0
  1318
			'd',
sl@0
  1319
			EMatchKeyCaseInsens
sl@0
  1320
			},
sl@0
  1321
			{
sl@0
  1322
			EStateNormal,
sl@0
  1323
			EPassSpecialKeyThru,
sl@0
  1324
			ELatin1LcThorn
sl@0
  1325
			}
sl@0
  1326
		},
sl@0
  1327
		{
sl@0
  1328
			{
sl@0
  1329
			EModifierFunc|EModifierKeyUp,
sl@0
  1330
			0
sl@0
  1331
			},
sl@0
  1332
			{
sl@0
  1333
			't',
sl@0
  1334
			EMatchKeyCaseInsens
sl@0
  1335
			},
sl@0
  1336
			{
sl@0
  1337
			EStateNormal,
sl@0
  1338
			EPassSpecialKeyThru,
sl@0
  1339
			ELatin1LcSoftTh
sl@0
  1340
			}
sl@0
  1341
		},
sl@0
  1342
		{
sl@0
  1343
			{
sl@0
  1344
			EModifierFunc|EModifierKeyUp,
sl@0
  1345
			0
sl@0
  1346
			},
sl@0
  1347
			{
sl@0
  1348
			'l',
sl@0
  1349
			EMatchKeyCaseInsens
sl@0
  1350
			},
sl@0
  1351
			{
sl@0
  1352
			EStateNormal,
sl@0
  1353
			EPassSpecialKeyThru,
sl@0
  1354
			ELatin1LeftChevron
sl@0
  1355
			}
sl@0
  1356
		},
sl@0
  1357
		{
sl@0
  1358
			{
sl@0
  1359
			EModifierFunc|EModifierKeyUp,
sl@0
  1360
			0
sl@0
  1361
			},
sl@0
  1362
			{
sl@0
  1363
			'r',
sl@0
  1364
			EMatchKeyCaseInsens
sl@0
  1365
			},
sl@0
  1366
			{
sl@0
  1367
			EStateNormal,
sl@0
  1368
			EPassSpecialKeyThru,
sl@0
  1369
			ELatin1RightChevron
sl@0
  1370
			}
sl@0
  1371
		},
sl@0
  1372
		{
sl@0
  1373
			{
sl@0
  1374
			EModifierFunc|EModifierKeyUp,
sl@0
  1375
			0
sl@0
  1376
			},
sl@0
  1377
			{
sl@0
  1378
			'x',
sl@0
  1379
			EMatchKeyCaseInsens
sl@0
  1380
			},
sl@0
  1381
			{
sl@0
  1382
			EStateNormal,
sl@0
  1383
			EPassSpecialKeyThru,
sl@0
  1384
			ELatin1InvExclam
sl@0
  1385
			}
sl@0
  1386
		},
sl@0
  1387
		{
sl@0
  1388
			{
sl@0
  1389
			EModifierFunc|EModifierKeyUp,
sl@0
  1390
			0
sl@0
  1391
			},
sl@0
  1392
			{
sl@0
  1393
			'q',
sl@0
  1394
			EMatchKeyCaseInsens
sl@0
  1395
			},
sl@0
  1396
			{
sl@0
  1397
			EStateNormal,
sl@0
  1398
			EPassSpecialKeyThru,
sl@0
  1399
			ELatin1InvQuest
sl@0
  1400
			}
sl@0
  1401
		},
sl@0
  1402
		{
sl@0
  1403
			{
sl@0
  1404
			EModifierFunc|EModifierKeyUp,
sl@0
  1405
			0
sl@0
  1406
			},
sl@0
  1407
			{
sl@0
  1408
			'a',
sl@0
  1409
			EMatchKeyCaseInsens
sl@0
  1410
			},
sl@0
  1411
			{
sl@0
  1412
			EStateNormal,
sl@0
  1413
			EPassSpecialKeyThru,
sl@0
  1414
			ELatin1LcAo
sl@0
  1415
			}
sl@0
  1416
		},
sl@0
  1417
		{
sl@0
  1418
			{
sl@0
  1419
			EModifierFunc|EModifierKeyUp,
sl@0
  1420
			0
sl@0
  1421
			},
sl@0
  1422
			{
sl@0
  1423
			'p',
sl@0
  1424
			EMatchKeyCaseInsens
sl@0
  1425
			},
sl@0
  1426
			{
sl@0
  1427
			EStateNormal,
sl@0
  1428
			EPassSpecialKeyThru,
sl@0
  1429
			ELatin1Pound
sl@0
  1430
			}
sl@0
  1431
		},
sl@0
  1432
	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  1433
	};
sl@0
  1434
sl@0
  1435
LOCAL_D const SFuncTableEntry table2[]=
sl@0
  1436
	{
sl@0
  1437
	//
sl@0
  1438
	// Table for special keyboard state 2
sl@0
  1439
	// This state is entered by pressing Fn+z (see table10)
sl@0
  1440
	//
sl@0
  1441
	// The table makes certain keys return accented characters
sl@0
  1442
	// See table1 for an explanation of the contents
sl@0
  1443
	//
sl@0
  1444
		{
sl@0
  1445
			{
sl@0
  1446
			EModifierFunc|EModifierKeyUp,
sl@0
  1447
			0
sl@0
  1448
			},
sl@0
  1449
			{
sl@0
  1450
			'a',
sl@0
  1451
			EMatchKeyCaseInsens
sl@0
  1452
			},
sl@0
  1453
			{
sl@0
  1454
			EStateNormal,
sl@0
  1455
			EPassSpecialKeyThru,
sl@0
  1456
			ELatin1LcAumlaut
sl@0
  1457
			}
sl@0
  1458
		},
sl@0
  1459
		{
sl@0
  1460
			{
sl@0
  1461
			EModifierFunc|EModifierKeyUp,
sl@0
  1462
			0
sl@0
  1463
			},
sl@0
  1464
			{
sl@0
  1465
			'e',
sl@0
  1466
			EMatchKeyCaseInsens
sl@0
  1467
			},
sl@0
  1468
			{
sl@0
  1469
			EStateNormal,
sl@0
  1470
			EPassSpecialKeyThru,
sl@0
  1471
			ELatin1LcEumlaut
sl@0
  1472
			}
sl@0
  1473
		},
sl@0
  1474
		{
sl@0
  1475
			{
sl@0
  1476
			EModifierFunc|EModifierKeyUp,
sl@0
  1477
			0
sl@0
  1478
			},
sl@0
  1479
			{
sl@0
  1480
			'i',
sl@0
  1481
			EMatchKeyCaseInsens
sl@0
  1482
			},
sl@0
  1483
			{
sl@0
  1484
			EStateNormal,
sl@0
  1485
			EPassSpecialKeyThru,
sl@0
  1486
			ELatin1LcIumlaut
sl@0
  1487
			}
sl@0
  1488
		},
sl@0
  1489
		{
sl@0
  1490
			{
sl@0
  1491
			EModifierFunc|EModifierKeyUp,
sl@0
  1492
			0
sl@0
  1493
			},
sl@0
  1494
			{
sl@0
  1495
			'o',
sl@0
  1496
			EMatchKeyCaseInsens
sl@0
  1497
			},
sl@0
  1498
			{
sl@0
  1499
			EStateNormal,
sl@0
  1500
			EPassSpecialKeyThru,
sl@0
  1501
			ELatin1LcOumlaut
sl@0
  1502
			}
sl@0
  1503
		},
sl@0
  1504
		{
sl@0
  1505
			{
sl@0
  1506
			EModifierFunc|EModifierKeyUp,
sl@0
  1507
			0
sl@0
  1508
			},
sl@0
  1509
			{
sl@0
  1510
			'u',
sl@0
  1511
			EMatchKeyCaseInsens
sl@0
  1512
			},
sl@0
  1513
			{
sl@0
  1514
			EStateNormal,
sl@0
  1515
			EPassSpecialKeyThru,
sl@0
  1516
			ELatin1LcUumlaut
sl@0
  1517
			}
sl@0
  1518
		},
sl@0
  1519
		{
sl@0
  1520
			{
sl@0
  1521
			EModifierFunc|EModifierKeyUp,
sl@0
  1522
			0
sl@0
  1523
			},
sl@0
  1524
			{
sl@0
  1525
			'y',
sl@0
  1526
			EMatchKeyCaseInsens
sl@0
  1527
			},
sl@0
  1528
			{
sl@0
  1529
			EStateNormal,
sl@0
  1530
			EPassSpecialKeyThru,
sl@0
  1531
			ELatin1LcYumlaut
sl@0
  1532
			}
sl@0
  1533
		},
sl@0
  1534
		{
sl@0
  1535
			{
sl@0
  1536
			EModifierFunc|EModifierKeyUp,
sl@0
  1537
			0
sl@0
  1538
			},
sl@0
  1539
			{
sl@0
  1540
			' ',
sl@0
  1541
			EMatchKey
sl@0
  1542
			},
sl@0
  1543
			{
sl@0
  1544
			EStateNormal,
sl@0
  1545
			EPassSpecialKeyThru,
sl@0
  1546
			ELatin1SpaceUmlaut
sl@0
  1547
			}
sl@0
  1548
		},
sl@0
  1549
	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  1550
	};
sl@0
  1551
sl@0
  1552
LOCAL_D const SFuncTableEntry table3[]=
sl@0
  1553
	{
sl@0
  1554
	//
sl@0
  1555
	// Table for special keyboard state 3
sl@0
  1556
	// This state is entered by pressing Fn+x (see table10)
sl@0
  1557
	//
sl@0
  1558
	// The table makes certain keys return accented characters
sl@0
  1559
	//
sl@0
  1560
		{
sl@0
  1561
			{
sl@0
  1562
			EModifierFunc|EModifierKeyUp,
sl@0
  1563
			0
sl@0
  1564
			},
sl@0
  1565
			{
sl@0
  1566
			'a',
sl@0
  1567
			EMatchKeyCaseInsens
sl@0
  1568
			},
sl@0
  1569
			{
sl@0
  1570
			EStateNormal,
sl@0
  1571
			EPassSpecialKeyThru,
sl@0
  1572
			ELatin1LcAgrave
sl@0
  1573
			}
sl@0
  1574
		},
sl@0
  1575
		{
sl@0
  1576
			{
sl@0
  1577
			EModifierFunc|EModifierKeyUp,
sl@0
  1578
			0
sl@0
  1579
			},
sl@0
  1580
			{
sl@0
  1581
			'e',
sl@0
  1582
			EMatchKeyCaseInsens
sl@0
  1583
			},
sl@0
  1584
			{
sl@0
  1585
			EStateNormal,
sl@0
  1586
			EPassSpecialKeyThru,
sl@0
  1587
			ELatin1LcEgrave
sl@0
  1588
			}
sl@0
  1589
		},
sl@0
  1590
		{
sl@0
  1591
			{
sl@0
  1592
			EModifierFunc|EModifierKeyUp,
sl@0
  1593
			0
sl@0
  1594
			},
sl@0
  1595
			{
sl@0
  1596
			'i',
sl@0
  1597
			EMatchKeyCaseInsens
sl@0
  1598
			},
sl@0
  1599
			{
sl@0
  1600
			EStateNormal,
sl@0
  1601
			EPassSpecialKeyThru,
sl@0
  1602
			ELatin1LcIgrave
sl@0
  1603
			}
sl@0
  1604
		},
sl@0
  1605
		{
sl@0
  1606
			{
sl@0
  1607
			EModifierFunc|EModifierKeyUp,
sl@0
  1608
			0
sl@0
  1609
			},
sl@0
  1610
			{
sl@0
  1611
			'o',
sl@0
  1612
			EMatchKeyCaseInsens
sl@0
  1613
			},
sl@0
  1614
			{
sl@0
  1615
			EStateNormal,
sl@0
  1616
			EPassSpecialKeyThru,
sl@0
  1617
			ELatin1LcOgrave
sl@0
  1618
			}
sl@0
  1619
		},
sl@0
  1620
		{
sl@0
  1621
			{
sl@0
  1622
			EModifierFunc|EModifierKeyUp,
sl@0
  1623
			0
sl@0
  1624
			},
sl@0
  1625
			{
sl@0
  1626
			'u',
sl@0
  1627
			EMatchKeyCaseInsens
sl@0
  1628
			},
sl@0
  1629
			{
sl@0
  1630
			EStateNormal,
sl@0
  1631
			EPassSpecialKeyThru,
sl@0
  1632
			ELatin1LcUgrave
sl@0
  1633
			}
sl@0
  1634
		},
sl@0
  1635
		{
sl@0
  1636
			{
sl@0
  1637
			EModifierFunc|EModifierKeyUp,
sl@0
  1638
			0
sl@0
  1639
			},
sl@0
  1640
			{
sl@0
  1641
			' ',
sl@0
  1642
			EMatchKey
sl@0
  1643
			},
sl@0
  1644
			{
sl@0
  1645
			EStateNormal,
sl@0
  1646
			EPassSpecialKeyThru,
sl@0
  1647
			ELatin1SpaceGrave
sl@0
  1648
			}
sl@0
  1649
		},
sl@0
  1650
	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  1651
	};
sl@0
  1652
sl@0
  1653
LOCAL_D const SFuncTableEntry table4[]=
sl@0
  1654
	{
sl@0
  1655
	//
sl@0
  1656
	// Table for special keyboard state 4
sl@0
  1657
	// This state is entered by pressing Fn+c (see table10)
sl@0
  1658
	//
sl@0
  1659
	// The table makes certain keys return accented characters
sl@0
  1660
	//
sl@0
  1661
		{
sl@0
  1662
			{
sl@0
  1663
			EModifierFunc|EModifierKeyUp,
sl@0
  1664
			0
sl@0
  1665
			},
sl@0
  1666
			{
sl@0
  1667
			'a',
sl@0
  1668
			EMatchKeyCaseInsens
sl@0
  1669
			},
sl@0
  1670
			{
sl@0
  1671
			EStateNormal,
sl@0
  1672
			EPassSpecialKeyThru,
sl@0
  1673
			ELatin1LcAacute
sl@0
  1674
			}
sl@0
  1675
		},
sl@0
  1676
		{
sl@0
  1677
			{
sl@0
  1678
			EModifierFunc|EModifierKeyUp,
sl@0
  1679
			0
sl@0
  1680
			},
sl@0
  1681
			{
sl@0
  1682
			'e',
sl@0
  1683
			EMatchKeyCaseInsens
sl@0
  1684
			},
sl@0
  1685
			{
sl@0
  1686
			EStateNormal,
sl@0
  1687
			EPassSpecialKeyThru,
sl@0
  1688
			ELatin1LcEacute
sl@0
  1689
			}
sl@0
  1690
		},
sl@0
  1691
		{
sl@0
  1692
			{
sl@0
  1693
			EModifierFunc|EModifierKeyUp,
sl@0
  1694
			0
sl@0
  1695
			},
sl@0
  1696
			{
sl@0
  1697
			'i',
sl@0
  1698
			EMatchKeyCaseInsens
sl@0
  1699
			},
sl@0
  1700
			{
sl@0
  1701
			EStateNormal,
sl@0
  1702
			EPassSpecialKeyThru,
sl@0
  1703
			ELatin1LcIacute
sl@0
  1704
			}
sl@0
  1705
		},
sl@0
  1706
		{
sl@0
  1707
			{
sl@0
  1708
			EModifierFunc|EModifierKeyUp,
sl@0
  1709
			0
sl@0
  1710
			},
sl@0
  1711
			{
sl@0
  1712
			'o',
sl@0
  1713
			EMatchKeyCaseInsens
sl@0
  1714
			},
sl@0
  1715
			{
sl@0
  1716
			EStateNormal,
sl@0
  1717
			EPassSpecialKeyThru,
sl@0
  1718
			ELatin1LcOacute
sl@0
  1719
			}
sl@0
  1720
		},
sl@0
  1721
		{
sl@0
  1722
			{
sl@0
  1723
			EModifierFunc|EModifierKeyUp,
sl@0
  1724
			0
sl@0
  1725
			},
sl@0
  1726
			{
sl@0
  1727
			'u',
sl@0
  1728
			EMatchKeyCaseInsens
sl@0
  1729
			},
sl@0
  1730
			{
sl@0
  1731
			EStateNormal,
sl@0
  1732
			EPassSpecialKeyThru,
sl@0
  1733
			ELatin1LcUacute
sl@0
  1734
			}
sl@0
  1735
		},
sl@0
  1736
		{
sl@0
  1737
			{
sl@0
  1738
			EModifierFunc|EModifierKeyUp,
sl@0
  1739
			0
sl@0
  1740
			},
sl@0
  1741
			{
sl@0
  1742
			'y',
sl@0
  1743
			EMatchKeyCaseInsens
sl@0
  1744
			},
sl@0
  1745
			{
sl@0
  1746
			EStateNormal,
sl@0
  1747
			EPassSpecialKeyThru,
sl@0
  1748
			ELatin1LcYacute
sl@0
  1749
			}
sl@0
  1750
		},
sl@0
  1751
		{
sl@0
  1752
			{
sl@0
  1753
			EModifierFunc|EModifierKeyUp,
sl@0
  1754
			0
sl@0
  1755
			},
sl@0
  1756
			{
sl@0
  1757
			' ',
sl@0
  1758
			EMatchKey
sl@0
  1759
			},
sl@0
  1760
			{
sl@0
  1761
			EStateNormal,
sl@0
  1762
			EPassSpecialKeyThru,
sl@0
  1763
			ELatin1LcSpaceAcute
sl@0
  1764
			}
sl@0
  1765
		},
sl@0
  1766
	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  1767
	};
sl@0
  1768
sl@0
  1769
LOCAL_D const SFuncTableEntry table5[]=
sl@0
  1770
	{
sl@0
  1771
	//
sl@0
  1772
	// Table for special keyboard state 5
sl@0
  1773
	// This state is entered by pressing Fn+v (see table10)
sl@0
  1774
	//
sl@0
  1775
	// The table makes certain keys return accented characters
sl@0
  1776
	//
sl@0
  1777
		{
sl@0
  1778
			{
sl@0
  1779
			EModifierFunc|EModifierKeyUp,
sl@0
  1780
			0
sl@0
  1781
			},
sl@0
  1782
			{
sl@0
  1783
			'a',
sl@0
  1784
			EMatchKeyCaseInsens
sl@0
  1785
			},
sl@0
  1786
			{
sl@0
  1787
			EStateNormal,
sl@0
  1788
			EPassSpecialKeyThru,
sl@0
  1789
			ELatin1LcAtilde
sl@0
  1790
			}
sl@0
  1791
		},
sl@0
  1792
		{
sl@0
  1793
			{
sl@0
  1794
			EModifierFunc|EModifierKeyUp,
sl@0
  1795
			0
sl@0
  1796
			},
sl@0
  1797
			{
sl@0
  1798
			'n',
sl@0
  1799
			EMatchKeyCaseInsens
sl@0
  1800
			},
sl@0
  1801
			{
sl@0
  1802
			EStateNormal,
sl@0
  1803
			EPassSpecialKeyThru,
sl@0
  1804
			ELatin1LcNtilde
sl@0
  1805
			}
sl@0
  1806
		},
sl@0
  1807
		{
sl@0
  1808
			{
sl@0
  1809
			EModifierFunc|EModifierKeyUp,
sl@0
  1810
			0
sl@0
  1811
			},
sl@0
  1812
			{
sl@0
  1813
			'o',
sl@0
  1814
			EMatchKeyCaseInsens
sl@0
  1815
			},
sl@0
  1816
			{
sl@0
  1817
			EStateNormal,
sl@0
  1818
			EPassSpecialKeyThru,
sl@0
  1819
			ELatin1LcOtilde
sl@0
  1820
			}
sl@0
  1821
		},
sl@0
  1822
		{
sl@0
  1823
			{
sl@0
  1824
			EModifierFunc|EModifierKeyUp,
sl@0
  1825
			0
sl@0
  1826
			},
sl@0
  1827
			{
sl@0
  1828
			' ',
sl@0
  1829
			EMatchKey
sl@0
  1830
			},
sl@0
  1831
			{
sl@0
  1832
			EStateNormal,
sl@0
  1833
			EPassSpecialKeyThru,
sl@0
  1834
			ELatin1LcSpaceTilde
sl@0
  1835
			}
sl@0
  1836
		},
sl@0
  1837
	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  1838
	};
sl@0
  1839
sl@0
  1840
LOCAL_D const SFuncTableEntry table6[]=
sl@0
  1841
	{
sl@0
  1842
	//
sl@0
  1843
	// Table for special keyboard state 6
sl@0
  1844
	// This state is entered by pressing Fn+b (see table6)
sl@0
  1845
	//
sl@0
  1846
	// The table makes certain keys return accented characters
sl@0
  1847
	//
sl@0
  1848
		{
sl@0
  1849
			{
sl@0
  1850
			EModifierFunc|EModifierKeyUp,
sl@0
  1851
			0
sl@0
  1852
			},
sl@0
  1853
			{
sl@0
  1854
			'a',
sl@0
  1855
			EMatchKeyCaseInsens
sl@0
  1856
			},
sl@0
  1857
			{
sl@0
  1858
			EStateNormal,
sl@0
  1859
			EPassSpecialKeyThru,
sl@0
  1860
			ELatin1LcAcirc
sl@0
  1861
			}
sl@0
  1862
		},
sl@0
  1863
		{
sl@0
  1864
			{
sl@0
  1865
			EModifierFunc|EModifierKeyUp,
sl@0
  1866
			0
sl@0
  1867
			},
sl@0
  1868
			{
sl@0
  1869
			'e',
sl@0
  1870
			EMatchKeyCaseInsens
sl@0
  1871
			},
sl@0
  1872
			{
sl@0
  1873
			EStateNormal,
sl@0
  1874
			EPassSpecialKeyThru,
sl@0
  1875
			ELatin1LcEcirc
sl@0
  1876
			}
sl@0
  1877
		},
sl@0
  1878
		{
sl@0
  1879
			{
sl@0
  1880
			EModifierFunc|EModifierKeyUp,
sl@0
  1881
			0
sl@0
  1882
			},
sl@0
  1883
			{
sl@0
  1884
			'i',
sl@0
  1885
			EMatchKeyCaseInsens
sl@0
  1886
			},
sl@0
  1887
			{
sl@0
  1888
			EStateNormal,
sl@0
  1889
			EPassSpecialKeyThru,
sl@0
  1890
			ELatin1LcIcirc
sl@0
  1891
			}
sl@0
  1892
		},
sl@0
  1893
		{
sl@0
  1894
			{
sl@0
  1895
			EModifierFunc|EModifierKeyUp,
sl@0
  1896
			0
sl@0
  1897
			},
sl@0
  1898
			{
sl@0
  1899
			'o',
sl@0
  1900
			EMatchKeyCaseInsens
sl@0
  1901
			},
sl@0
  1902
			{
sl@0
  1903
			EStateNormal,
sl@0
  1904
			EPassSpecialKeyThru,
sl@0
  1905
			ELatin1LcOcirc
sl@0
  1906
			}
sl@0
  1907
		},
sl@0
  1908
		{
sl@0
  1909
			{
sl@0
  1910
			EModifierFunc|EModifierKeyUp,
sl@0
  1911
			0
sl@0
  1912
			},
sl@0
  1913
			{
sl@0
  1914
			'u',
sl@0
  1915
			EMatchKeyCaseInsens
sl@0
  1916
			},
sl@0
  1917
			{
sl@0
  1918
			EStateNormal,
sl@0
  1919
			EPassSpecialKeyThru,
sl@0
  1920
			ELatin1LcUcirc
sl@0
  1921
			}
sl@0
  1922
		},
sl@0
  1923
		{
sl@0
  1924
			{
sl@0
  1925
			EModifierFunc|EModifierKeyUp,
sl@0
  1926
			0
sl@0
  1927
			},
sl@0
  1928
			{
sl@0
  1929
			' ',
sl@0
  1930
			EMatchKey
sl@0
  1931
			},
sl@0
  1932
			{
sl@0
  1933
			EStateNormal,
sl@0
  1934
			EPassSpecialKeyThru,
sl@0
  1935
			ELatin1LcSpaceCirc
sl@0
  1936
			}
sl@0
  1937
		},
sl@0
  1938
	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  1939
	};
sl@0
  1940
sl@0
  1941
//
sl@0
  1942
// TO DO: (optional)
sl@0
  1943
//
sl@0
  1944
// State 7,8,9 aren't used in this example.
sl@0
  1945
// You can implement them if you want more special states
sl@0
  1946
//
sl@0
  1947
sl@0
  1948
//LOCAL_D const SFuncTableEntry table7[]=
sl@0
  1949
//	{
sl@0
  1950
//	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  1951
//	};
sl@0
  1952
sl@0
  1953
//LOCAL_D const SFuncTableEntry table8[]=
sl@0
  1954
//	{
sl@0
  1955
//	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  1956
//	};
sl@0
  1957
sl@0
  1958
//LOCAL_D const SFuncTableEntry table9[]=
sl@0
  1959
//	{
sl@0
  1960
//	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  1961
//	};
sl@0
  1962
sl@0
  1963
sl@0
  1964
LOCAL_D const SFuncTableEntry table10[]=
sl@0
  1965
	{
sl@0
  1966
	//
sl@0
  1967
	// TO DO: (optional)
sl@0
  1968
	//
sl@0
  1969
	// Table keyboard state 10 - the normal state
sl@0
  1970
	//
sl@0
  1971
	// This table controls which keys switch into the special states
sl@0
  1972
	// 0-9, 11 and 12.
sl@0
  1973
	//
sl@0
  1974
sl@0
  1975
		{ 
sl@0
  1976
		//
sl@0
  1977
		// Make sure key-up events are ignored by handling them first and
sl@0
  1978
		// doing nothing
sl@0
  1979
		//
sl@0
  1980
			{
sl@0
  1981
			EModifierKeyUp,
sl@0
  1982
			EModifierKeyUp
sl@0
  1983
			},
sl@0
  1984
			{
sl@0
  1985
			EKeyNull,
sl@0
  1986
			EAnyKey
sl@0
  1987
			},
sl@0
  1988
			{
sl@0
  1989
			EStateUnchanged,
sl@0
  1990
			EDoNothing,
sl@0
  1991
			0
sl@0
  1992
			}
sl@0
  1993
		},
sl@0
  1994
		{ 
sl@0
  1995
		//
sl@0
  1996
		// Check for ctrl-number presses
sl@0
  1997
		// This will enter state EStateCtrlDigits (state 12) which allows
sl@0
  1998
		// entry of a numeric keycode
sl@0
  1999
		//
sl@0
  2000
			{
sl@0
  2001
			EModifierCtrl|EModifierFunc|EModifierKeyUp,
sl@0
  2002
			EModifierCtrl
sl@0
  2003
			},
sl@0
  2004
			{
sl@0
  2005
			EKeyNull,
sl@0
  2006
			EAnyDecimalDigit
sl@0
  2007
			},
sl@0
  2008
			{
sl@0
  2009
			EStateDerivedFromDigitEntered,
sl@0
  2010
			EAddOnCtrlDigit,
sl@0
  2011
			0
sl@0
  2012
			}
sl@0
  2013
		},
sl@0
  2014
		{
sl@0
  2015
		//
sl@0
  2016
		// Any other key events that have not been trapped are just
sl@0
  2017
		// passed through unchanged
sl@0
  2018
		//
sl@0
  2019
			{
sl@0
  2020
			0,
sl@0
  2021
			0
sl@0
  2022
			},
sl@0
  2023
			{
sl@0
  2024
			EKeyNull,
sl@0
  2025
			EAnyKey
sl@0
  2026
			},
sl@0
  2027
			{
sl@0
  2028
			EStateUnchanged,
sl@0
  2029
			EPassKeyThru,
sl@0
  2030
			0
sl@0
  2031
			}
sl@0
  2032
		}
sl@0
  2033
	};
sl@0
  2034
sl@0
  2035
//LOCAL_D const SFuncTableEntry table11[]=
sl@0
  2036
//	{
sl@0
  2037
//	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  2038
//	};
sl@0
  2039
sl@0
  2040
LOCAL_D const SFuncTableEntry table12[]=
sl@0
  2041
	{
sl@0
  2042
	//
sl@0
  2043
	// Table 12 handles entring digit codes. The keyboard will remain in this
sl@0
  2044
	// state until the Ctrl key is released
sl@0
  2045
	//
sl@0
  2046
		{
sl@0
  2047
			{
sl@0
  2048
			//
sl@0
  2049
			// Look for a key up event
sl@0
  2050
			//
sl@0
  2051
			EModifierKeyUp,
sl@0
  2052
			EModifierKeyUp
sl@0
  2053
			},
sl@0
  2054
			{
sl@0
  2055
			// 
sl@0
  2056
			// Match either left or right Ctrl key (i.e. this matches a Ctrl key release)
sl@0
  2057
			//
sl@0
  2058
			EKeyLeftCtrl,
sl@0
  2059
			EMatchLeftOrRight
sl@0
  2060
			},
sl@0
  2061
			{
sl@0
  2062
			EStateNormal,			// return to normal state (table10)
sl@0
  2063
			EPassCtrlDigitsThru,	// and pass through the numeric code we have accumulated
sl@0
  2064
			0
sl@0
  2065
			}
sl@0
  2066
		},
sl@0
  2067
	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
sl@0
  2068
	};
sl@0
  2069
sl@0
  2070
sl@0
  2071
//
sl@0
  2072
// TO DO: (optional)
sl@0
  2073
//
sl@0
  2074
// Array of state control tables above. If a state is not used set the array 
sl@0
  2075
// size to zero and the pointer to NULL
sl@0
  2076
//
sl@0
  2077
// The tables must be declared here in order from table 0 to table 12
sl@0
  2078
//
sl@0
  2079
LOCAL_D const SFuncTable genFuncTables[]=
sl@0
  2080
	{
sl@0
  2081
		{
sl@0
  2082
		//
sl@0
  2083
		// state 0
sl@0
  2084
		//
sl@0
  2085
		0,			// state 0 not used, size = 0
sl@0
  2086
		NULL		// state 0 not used, pointer = NULL
sl@0
  2087
		},
sl@0
  2088
		{
sl@0
  2089
		//
sl@0
  2090
		// state 1
sl@0
  2091
		//
sl@0
  2092
		ARRAY_LENGTH(table1),		// size of table 1
sl@0
  2093
		&table1[0]					// pointer to table 1
sl@0
  2094
		},
sl@0
  2095
		{
sl@0
  2096
		//
sl@0
  2097
		// state 2
sl@0
  2098
		//
sl@0
  2099
		ARRAY_LENGTH(table2),
sl@0
  2100
		&table2[0]
sl@0
  2101
		},
sl@0
  2102
		{
sl@0
  2103
		//
sl@0
  2104
		// state 3
sl@0
  2105
		//
sl@0
  2106
		ARRAY_LENGTH(table3),
sl@0
  2107
		&table3[0]
sl@0
  2108
		},
sl@0
  2109
		{
sl@0
  2110
		//
sl@0
  2111
		// state 4
sl@0
  2112
		//
sl@0
  2113
		ARRAY_LENGTH(table4),
sl@0
  2114
		&table4[0]
sl@0
  2115
		},
sl@0
  2116
		{
sl@0
  2117
		//
sl@0
  2118
		// state 5
sl@0
  2119
		//
sl@0
  2120
		ARRAY_LENGTH(table5),
sl@0
  2121
		&table5[0]
sl@0
  2122
		},
sl@0
  2123
		{
sl@0
  2124
		//
sl@0
  2125
		// state 6
sl@0
  2126
		//
sl@0
  2127
		ARRAY_LENGTH(table6),
sl@0
  2128
		&table6[0]
sl@0
  2129
		},
sl@0
  2130
		{
sl@0
  2131
		//
sl@0
  2132
		// state 7
sl@0
  2133
		//
sl@0
  2134
		0,
sl@0
  2135
		NULL
sl@0
  2136
		},
sl@0
  2137
		{
sl@0
  2138
		//
sl@0
  2139
		// state 8
sl@0
  2140
		//
sl@0
  2141
		0,
sl@0
  2142
		NULL
sl@0
  2143
		},
sl@0
  2144
		{
sl@0
  2145
		//
sl@0
  2146
		// state 9
sl@0
  2147
		//
sl@0
  2148
		0,
sl@0
  2149
		NULL
sl@0
  2150
		},
sl@0
  2151
		{
sl@0
  2152
		//
sl@0
  2153
		// state 10
sl@0
  2154
		//
sl@0
  2155
		ARRAY_LENGTH(table10),
sl@0
  2156
		&table10[0]
sl@0
  2157
		},
sl@0
  2158
		{
sl@0
  2159
		//
sl@0
  2160
		// state 11
sl@0
  2161
		//
sl@0
  2162
		0,
sl@0
  2163
		NULL
sl@0
  2164
		},
sl@0
  2165
		{
sl@0
  2166
		//
sl@0
  2167
		// state 12
sl@0
  2168
		//
sl@0
  2169
		ARRAY_LENGTH(table12),
sl@0
  2170
		&table12[0]
sl@0
  2171
		}
sl@0
  2172
	};
sl@0
  2173
sl@0
  2174
sl@0
  2175
//
sl@0
  2176
// Root of the state modifier tables
sl@0
  2177
//
sl@0
  2178
LOCAL_D const SFuncTables FuncTables=
sl@0
  2179
	{
sl@0
  2180
		{
sl@0
  2181
		//
sl@0
  2182
		// The default processing table
sl@0
  2183
		//
sl@0
  2184
		ARRAY_LENGTH(defaultTable),
sl@0
  2185
		&defaultTable[0]
sl@0
  2186
		},
sl@0
  2187
		{
sl@0
  2188
		//
sl@0
  2189
		// The modifier control table
sl@0
  2190
		//
sl@0
  2191
		ARRAY_LENGTH(modifierTable),
sl@0
  2192
		&modifierTable[0]
sl@0
  2193
		},
sl@0
  2194
	//
sl@0
  2195
	// The state control tables
sl@0
  2196
	//
sl@0
  2197
	ARRAY_LENGTH(genFuncTables),
sl@0
  2198
	&genFuncTables[0]
sl@0
  2199
	};
sl@0
  2200
sl@0
  2201
sl@0
  2202
//
sl@0
  2203
// The following exported functions give the key translator access to
sl@0
  2204
// the control tables above
sl@0
  2205
//
sl@0
  2206
EXPORT_C void KeyDataSettings(TRadix &aRadix,TCtrlDigitsTermination &aCtrlDigitsTermination,TInt &aDefaultCtrlDigitsMaxCount,
sl@0
  2207
							  TInt &aMaximumCtrlDigitsMaxCount)
sl@0
  2208
	{
sl@0
  2209
	aRadix=EDecimal;
sl@0
  2210
	aCtrlDigitsTermination=ETerminationByCtrlUp;
sl@0
  2211
	aDefaultCtrlDigitsMaxCount=3;
sl@0
  2212
	aMaximumCtrlDigitsMaxCount=10;
sl@0
  2213
	}
sl@0
  2214
sl@0
  2215
EXPORT_C void KeyDataFuncTable(SFuncTables &aFuncTables)
sl@0
  2216
	{
sl@0
  2217
	aFuncTables=FuncTables;
sl@0
  2218
	}
sl@0
  2219
sl@0
  2220
EXPORT_C void KeyDataConvTable(SConvTable &aConvTable, TUint &aConvTableFirstScanCode,TUint &aConvTableLastScanCode,
sl@0
  2221
							 SScanCodeBlockList &aKeypadScanCode,SKeyCodeList &aNonAutorepKeyCodes)
sl@0
  2222
	{
sl@0
  2223
	aConvTable=ConvTable;
sl@0
  2224
	aConvTableFirstScanCode=scanCodeBlock_base[0].firstScanCode;
sl@0
  2225
	aConvTableLastScanCode=scanCodeBlock_base[ARRAY_LENGTH(scanCodeBlock_base)-1].lastScanCode;
sl@0
  2226
	aKeypadScanCode=ConvTableKeypadScanCodes;
sl@0
  2227
	aNonAutorepKeyCodes=ConvTableNonAutorepKeyCodes;
sl@0
  2228
	}