Keymaps: Difference between revisions

From vice-emu
Jump to navigation Jump to search
mNo edit summary
Line 13: Line 13:
=== resources ===
=== resources ===


* "KeymapIndex" - selects active keymap (0: symbolic, 1: positional, 2: user defined symbolic, 3: user defined positional)
* "KeymapIndex" - (integer) selects active keymap (default:0) (0: symbolic, 1: positional, 2: user defined symbolic, 3: user defined positional)
* "KeymapSymFile" - name of the keymap to use for symbolic mapping (automatically set)
* "KeymapSymFile" - (string) name of the keymap to use for symbolic mapping (default:empty) (automatically set, see below)
* "KeymapPosFile" - name of the keymap to use for positional mapping (automatically set)
* "KeymapPosFile" - (string) name of the keymap to use for positional mapping (default:empty) (automatically set, see below)
* "KeymapUserSymFile" - name of user defined symbolic keymap  
* "KeymapUserSymFile" - (string) name of user defined symbolic keymap (default:empty)
* "KeymapUserPosFile" - name of user defined positional keymap  
* "KeymapUserPosFile" - (string) name of user defined positional keymap (default:empty)


* "KeyboardType" - (Integer) emulated keyboard type. (default:0) (C128 0: International, 1: Finnish,French, 3: German, 4: Italian, 5: Norwegian, 6: Swedish - PET: 0 "bkuk" 1: "gkuk" 2: "bkde" - others: 0)
* "KeyboardMapping" - (integer) host keyboard type (default:0) (0: standard US keyboard, 1: standard german keyboard)
=== setting the keymap ===
a central function which is called if any of "KeymapIndex", "KeyboardType", "KeyboardMapping" changed handles loading the new keymap.
* if "KeymapIndex" is not 0 or 1, then load the respective user keymap and skip any further automatic actions
* else try loading a keymap with the filename constructed as below.
* if that fails, find a proper fallback:
** <todo>
** as last resort, always use <port>_sym.vkm (which MUST exist)
=== constructing the filename ===
the filename of a keymap will be constructed according to this scheme:
<port>_<type>_<idx>_<mapping>.vkm
where:
* <port> is a string constant defined in archdep code (eg "x11", "sdl", "win" etc)
* <type> is a string returned by a machine specific function. this function should return an empty string if "KeyboardType" is 0 (else eg "bkuk", "gkuk", "bkde" etc)
* <idx> is a string derived from "KeymapIndex", where 0 is "sym" and 1 is "pos"
* <mapping> is a string derived from "KeyboardMapping", where 0 is an empty string and 1 is "de" (... 2: "fi" 3: "se" etc if needed)
(this should in many cases not even require renaming any .vkm files)


----
----
Line 25: Line 55:
=== remove ===
=== remove ===


resources: KeymapSymDeFile
resources: KeymapSymDeFile, KeymapBusinessUKSymFile, KeymapBusinessUKPosFile, KeymapGraphicsSymFile, KeymapGraphicsPosFile, KeymapBusinessDESymFile, KeymapBusinessDEPosFile


options: -symdekeymap, -buksymkeymap, -bukposkeymap, -grsymkeymap, -grposkeymap, -bdesymkeymap, -bdeposkeymap
options: -symdekeymap, -buksymkeymap, -bukposkeymap, -grsymkeymap, -grposkeymap, -bdesymkeymap, -bdeposkeymap

Revision as of 01:49, 25 June 2012

this page is under construction Gpz 22:39, 24 June 2012 (UTC)

considerations

  • host (pc) keyboards have a "machine" and "locale" type. the "machine" type is defined by the port (windows, x11, sdl etc) and the "locale" type by what type of keyboard the user has connected (we currently have different maps for US and DE keyboards)
  • emulated keyboards have a "positional" and a "symbolic" type. the former referring to the actual hardware (keyboard matrix and key positions) and the later referring to what is actually written on the keycaps. (for example the localized c128 keyboards would all have the same "positional" type, but different "symbolic" types.
  • we support two fundamentally different type of keyboard mappings, "symbolic" and "positional".

implementation

resources

  • "KeymapIndex" - (integer) selects active keymap (default:0) (0: symbolic, 1: positional, 2: user defined symbolic, 3: user defined positional)
  • "KeymapSymFile" - (string) name of the keymap to use for symbolic mapping (default:empty) (automatically set, see below)
  • "KeymapPosFile" - (string) name of the keymap to use for positional mapping (default:empty) (automatically set, see below)
  • "KeymapUserSymFile" - (string) name of user defined symbolic keymap (default:empty)
  • "KeymapUserPosFile" - (string) name of user defined positional keymap (default:empty)
  • "KeyboardType" - (Integer) emulated keyboard type. (default:0) (C128 0: International, 1: Finnish,French, 3: German, 4: Italian, 5: Norwegian, 6: Swedish - PET: 0 "bkuk" 1: "gkuk" 2: "bkde" - others: 0)
  • "KeyboardMapping" - (integer) host keyboard type (default:0) (0: standard US keyboard, 1: standard german keyboard)

setting the keymap

a central function which is called if any of "KeymapIndex", "KeyboardType", "KeyboardMapping" changed handles loading the new keymap.

  • if "KeymapIndex" is not 0 or 1, then load the respective user keymap and skip any further automatic actions
  • else try loading a keymap with the filename constructed as below.
  • if that fails, find a proper fallback:
    • <todo>
    • as last resort, always use <port>_sym.vkm (which MUST exist)

constructing the filename

the filename of a keymap will be constructed according to this scheme:

<port>_<type>_<idx>_<mapping>.vkm

where:

  • <port> is a string constant defined in archdep code (eg "x11", "sdl", "win" etc)
  • <type> is a string returned by a machine specific function. this function should return an empty string if "KeyboardType" is 0 (else eg "bkuk", "gkuk", "bkde" etc)
  • <idx> is a string derived from "KeymapIndex", where 0 is "sym" and 1 is "pos"
  • <mapping> is a string derived from "KeyboardMapping", where 0 is an empty string and 1 is "de" (... 2: "fi" 3: "se" etc if needed)

(this should in many cases not even require renaming any .vkm files)



remove

resources: KeymapSymDeFile, KeymapBusinessUKSymFile, KeymapBusinessUKPosFile, KeymapGraphicsSymFile, KeymapGraphicsPosFile, KeymapBusinessDESymFile, KeymapBusinessDEPosFile

options: -symdekeymap, -buksymkeymap, -bukposkeymap, -grsymkeymap, -grposkeymap, -bdesymkeymap, -bdeposkeymap