> On 10 May 2019, at 11:46, John Beard <[email protected]> wrote:
> 
> On 10/05/2019 11:08, Jeff Young wrote:
>> Once we remove PCBNew’s legacy canvas I’d like to propose that we simplify 
>> the hotkey architecture:
>> Get rid of the HotKey data-structures; have Actions specify a hotkey 
>> key-combination.
> 
> +0 (strongly support stripping legacy hotkey infrastructure, but...)
> 
> Do the tool actions actually even need to know their hotkey? I think perhaps 
> they shouldn't really care *what* the hotkey is or even if one is set, it's 
> not their problem. It's the tool framework that should be maintaining this 
> mapping.
> 
> Tools have a unique handle, the tool framework is in charge of invoking the 
> tool as needed. It's like a hammer doesn't come with a label saying how to 
> find it, it's up to you to put it in the right drawer and remember where it 
> is.

My concern with this is that the more spread out you store the info, the more 
maps you need, and the more room for error you have (when maps are missing 
keys, etc.).

That being said, certainly 1 map (hotkey to action) is better than the 3 we 
have today (hotkey to legacyID, legacyID to action, and hotkey to category).

> 
>> Down-side:
>> 1) You won’t be able to see all the key-combinations in one place in the 
>> code (but you can run Kicad to see them together).
> 
> Is there a way to load in a default action-string->hotkey mapping? So the 
> TOOL_ACTIONs have a slot for the hotkey as currently, but it's empty/0 at 
> static init. Then load that with a (e.g.) std::unordered_map<std::string, 
> int> for the defaults.

If we did have a single map (see above), then yes, this is how I’d see it 
working too.  (It doesn’t exist today, but we could write it.)

Cheers,
Jeff.

> 
> There should be an interface layer (i.e. a hotkey config model) mediating the 
> tool framework, the config file and the hotkey dialog anyway, so this is just 
> a function of that that can be called at startup.
> 
> Then it might be easier to see conflicts, which are otherwise tricky to find, 
> especially when platforms (looking at you, macOS) have different default 
> hotkeys.
> 
> Cheers,
> 
> John
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : [email protected]
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to