New LCL shortcut system: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: New LCL shortcut system
| Old | New | Line | |
|---|---|---|---|
| 1 | + | This page collects ideas about improving system of shortcuts in LCL. | |
| 2 | + | ||
| 3 | + | ## Current state | |
| 4 | + | ||
| 5 | + | ``` pascal | |
| 6 | + | TShortCut = Low(Word)..High(Word); // in classes.pp unit | |
| 7 | + | ||
| 8 | + | // virtual key codes VK_* | |
| 9 | + | Key := ShortCut and $FF; | |
| 10 | + | ||
| 11 | + | // key modifiers | |
| 12 | + | Meta := ShortCut and $1000; // scMeta | |
| 13 | + | Shift := ShortCut and $2000; // scShift | |
| 14 | + | Control := ShortCut and $4000; // scControl | |
| 15 | + | Alt := ShortCut and $8000; // scAlt | |
| 16 | + | ``` | |
| 17 | + | ||
| 18 | + | Unused bits in TShortCut: \$0F00 | |
| 19 | + | ||
| 20 | + | ## Requirements | |
| 21 | + | ||
| 22 | + | 1. backward compatibility | |
| 23 | + | - accept current TShortCut format | |
| 24 | + | - new format can use only unused bits in current TShortCut format | |
| 25 | + | 2. secondary, ternary shortcuts | |
| 26 | + | 3. platform-specific shortcuts (E.g. <span class="kbd">Ctrl</span>+<span class="kbd">C</span> under Windows, <span class="kbd">Cmd</span>+<span class="kbd">C</span> under Mac OS X) | |
| 27 | + | 4. shortcuts also with characters (E.g. <span class="kbd">Cmd</span>+<span class="kbd">?</span>) | |
| 28 | + | ||
| 29 | + | ## Conclusion | |
| 30 | + | ||
| 31 | + | - create list of extra shortcut data under TApplication (TLCLShortCutList) | |
| 32 | + | - the TShortCut value would be "an index" to one item in this list, unused bits can distinguish different shortcuts with same key code (0 will be reserved for old version) | |
| 33 | + | - modify shortcut handling in TApplication, TForm, TAction and TMenuItem | |
| 34 | + | - check for character shortcuts in IntfUTF8KeyPress | |
| 35 | + | - add functions like ShortCutToText to TApplication | |
| 36 | + | - modify TShortCut component editor | |
| 37 | + | ||
| 38 | + | ### TLCLShortCut class | |
| 39 | + | ||
| 40 | + | - index - TShortCut with modified unused bits | |
| 41 | + | - priority list of TLCLShortCutItem | |
| 42 | + | - key modifiers | |
| 43 | + | - platform modifiers | |
| 44 | + | - key or UTF-8 character | |
| 45 | + | ||
| 46 | + | --- | |
| 47 | + | *From the Free Pascal wiki, page "New LCL shortcut system", as it stood on 2020-02-21 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 48 | + | Category: LCL | |
| 49 | + | Category: Proposals |
