Using a boolean argument just leads to a lot of trailing booleans in the
function calls and is not user friendly. Instead, introduce PostAction()
to send an action that runs after the coroutine (equivalent to passing
false or the default argument), and leave RunAction as the immediate
execution function.
This replaces a hack where the parameter was used to identify a custom
UI ID with a proper solution. This moves the cut/copy/paste actions to
the new system, but more like help/quit/close should also be moved over
in the future.
A function-chain constructor method allows for the long list of
parameters to the constructor to be shrunk to only the ones needed by
each action, and allow self-documenting code for what each part of a
TOOL_ACTION constructor does.
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/7617
CHANGED: Don't run the hotkey if the action's UI elements aren't enabled
This makes it so the action can't be run from either the hotkey or the
UI if its enabling conditions are not met.
This allows for the tool framework to keep track of a universal
set of conditions for the UI state (enabled/checked/shown) for
controls of actions. It removes the need for the main menubar
menus to be CONDITIONAL_MENUs and be rebuilt on each open,
and instead makes the updates of the check and enabling of
items handled in the native wxWidgets way.
This commit switchs the 3d viewer and kicad project manager window
over to this system.
Delete the copy ctor and assignment operator to start with, but
even then the separate apps each have their own statically allocated
copy of the common actions. So we need to update all of them, which
also means having the kicad manager frame's set of actions on hand).
This changelist also adds a Clear Hotkey Assignment function since
the hotkeys set is now likely to be sparse with respect to the
actions.
If user hotkeys do not map all available actions, we still want the most
recent change to be the primary value. This can happen if the defaults
load a set of hotkeys that are not completely overwritten by the updated
hotkey preferences file. We assume that the most recent hotkey is what
the user want to map.
Fixes: lp:1778408
* https://bugs.launchpad.net/kicad/+bug/1778408
wxASSERT(), contrary to assert() does not terminate the program when
triggered. As assertions in ACTION_MANAGER are not critical and should be
treated as warnings - there is no need to close the program.