| 1 |
Free42 skin description (*.layout) file format: |
| 2 |
Anything from a '#' until the end of the line is a comment |
| 3 |
Non-comment lines contain the following information: |
| 4 |
|
| 5 |
(Note: the skin bitmap is assumed to have the same filename as the skin |
| 6 |
description, with the 'layout' extension replaced by 'gif'.) |
| 7 |
(Note: rectangles are given as "x,y,width,height"; points are "x,y".) |
| 8 |
|
| 9 |
Skin: the portion of the skin bitmap to be rendered as the actual faceplate |
| 10 |
Display: describes the location, size, and color of the display; arguments |
| 11 |
are: top-left corner, x magnification, y magnification, background color, |
| 12 |
foreground color. Colors are specified as 6-digit hex numbers in RRGGBB |
| 13 |
format. |
| 14 |
Key: describes a clickable key; arguments are: keycode, sensitive rectangle |
| 15 |
(i.e. the rectangle where mouse-down events will cause the key to be |
| 16 |
pressed), display rectangle (i.e. the rectangle that changes when a key is |
| 17 |
pressed or released), and the location of the top-left corner of the active- |
| 18 |
state bitmap (since the active-state bitmap must have the same size as the |
| 19 |
display rectangle, only its position, not its width and height, are |
| 20 |
specified). |
| 21 |
Keycodes in the range 1..37 correspond to actual calculator keys; keycodes |
| 22 |
38..255 can be used to define "macro" keys. For each such keycode, there must |
| 23 |
be a corresponding "Macro:" line in the layout file. |
| 24 |
You may specify two keycodes (two numbers separated by a comma); if you do, |
| 25 |
the first is used when the calculator's shift (indicated by the shift |
| 26 |
annunciator) is inactive, and the second is used when the calculator's shift |
| 27 |
is active. This feature allows you to have a key's shifted function be |
| 28 |
something different than it is on the original HP-42S keyboard. |
| 29 |
Macro: for keys with keycodes in the range 38..255, this defines the sequence |
| 30 |
of HP-42S keys (keycodes 1..37) that is to be pressed; arguments are: |
| 31 |
keycode, followed by zero or more keycodes in the range 1..37. |
| 32 |
An alternate way of describing the action to be taken when a key is pressed |
| 33 |
is direct command mapping. In this case, the action is not a sequence of |
| 34 |
HP-42S keys, but the name of a built-in function, enclosed in double quotes. |
| 35 |
By default, direct command mappings take effect in all modes, but it is |
| 36 |
possible to define alternate behaviors for ALPHA mode. The alternate may be |
| 37 |
a different built-in function, again enclosed in double quotes, or it may be |
| 38 |
a character, enclosed in single quotes, which will be typed as is. |
| 39 |
If the alternate is "" or '', the key is inactive in ALPHA mode, and pressing |
| 40 |
it will only cause an error beep. |
| 41 |
See below for examples of all types of macros. |
| 42 |
Annunciator: describes an HP-42S annunciator; arguments are: code (1=updown, |
| 43 |
2=shift, 3=print, 4=run, 5=battery, 6=g, 7=rad), display rectangle, and the |
| 44 |
location of the top-left corner of the active-state bitmap. |
| 45 |
|
| 46 |
For examples, look at the *.layout and *.gif files in this directory. |
| 47 |
|
| 48 |
Macro example: |
| 49 |
|
| 50 |
To define a key for the FIX command, using key code 38: the sequence of |
| 51 |
calculator keys for FIX is Shift (28), E (16), Σ+ (1), so... |
| 52 |
|
| 53 |
Key: 38 <sens_rect> <disp_rect> <active_pt> |
| 54 |
Macro: 38 28 16 1 |
| 55 |
|
| 56 |
Direct command mapping: |
| 57 |
|
| 58 |
To define a key that performs STO in normal mode, ASTO in ALPHA mode, and when |
| 59 |
shift is pressed, performs SQRT in normal mode, and types the √ character in |
| 60 |
ALPHA mode: |
| 61 |
|
| 62 |
Key: 38,39 <sens_rect> <disp_rect> <active_pt> |
| 63 |
Macro: 38 "STO" "ASTO" |
| 64 |
Macro: 39 "SQRT" '√' |
| 65 |
|
| 66 |
To define a key that performs GTO in all modes, and whose shifted function is |
| 67 |
1/X in normal mode and no action in ALPHA mode: |
| 68 |
|
| 69 |
Key: 40,41 <sens_rect> <disp_rect> <active_pt> |
| 70 |
Macro: 40 "GTO" |
| 71 |
Macro: 41 "1/X" '' |
| 72 |
|
| 73 |
PC Keyboard Mapping: |
| 74 |
|
| 75 |
It is also possible to define PC keyboard mappings in the *.layout file. The |
| 76 |
syntax is identical to that of the keymap file, preceded by a tag that |
| 77 |
indicates the target platform: WinKey for Windows, MacKey for Mac and iOS, |
| 78 |
DroidKey for Android, and GtkKey for Linux and other Unix-like environments. It |
| 79 |
is necessary to specify which platform each key mapping is for, since the key |
| 80 |
codes are platform-dependent. |
| 81 |
If a layout file defines a mapping for a key that is also mapped in the keymap |
| 82 |
file, the skin-specific mapping takes precedence. |
| 83 |
Note that, while Macro definitions may only contain codes 1..37, a keyboard |
| 84 |
mapping may contain codes 38..255 as well, so you could theoretically map a PC |
| 85 |
keyboard key to a sequence of macros. This is not recommended, however; for |
| 86 |
clarity, it is probably better for key mappings to consist only of one key or |
| 87 |
macro number, preceded by Shift (28) if necessary. This will also allow Free42 |
| 88 |
to match the PC keyboard key to a skin-defined key, which will be highlighted |
| 89 |
for visual feedback when the mapping is activated. |