Re: Customize shortcut/hotkeys
Posted by
LordOfBikes on
May 23, 2020; 8:53am
URL: https://forum.librecad.org/Customize-shortcut-hotkeys-tp5718912p5718960.html
@ACL, I wouldn't say duplication, because the commands have to be mapped to actions somewhere.
But the implementation is not optimal, it is error-prone. For new actions it is not obvious nor mandatory to add a command. And that's why some are missing.
So that's the way it currently works. The fastest way is to iterate trough both files and add missing commands in rs_command.cpp.
A refactoring of this implementation is a bigger task for sure.
I can imagine to use an abstract base class for actions which requires to implement a command definition method.
At least this only moves the instantiation of the command into the action class to which it belongs.
Maybe this allows a clearer mapping in rs_command.cpp by iterating over the ActionType enum somehow.
But finally, the mapping has to be done somewhere and until it runs totally transparent and automatically, it has always the issue that actions may be forgotten.
So I'm not sure from top off my head if this is possible at all. We have to check the underlying construction of classes to see if there is a chance to change it without too much effort.
If you have further questions or want to battle this challenge, don't hesitate to ask, preferred in the github issue linked above.
Armin
investing less than half an hour into Search function can save hours or days of waiting for a solution