There are times, when TOOL_MANAGER has to force cursor position
to make tools work as expected (e.g. when popping up a menu,
so tools get the right click position instead of current position
pointing to an entry in the menu).
If another tool is invoked, VIEW_CONTROLS settings have to be stored
in the TOOL_STATE object. In such case, it is necessary to revert the
force cursor setting when saving VIEW_CONTROLS settings.
Fixes: lp:1668712
* https://bugs.launchpad.net/kicad/+bug/1668712
SELECTION now holds EDA_ITEMs not BOARD_ITEMs so various places had to
change to casting the selected items to BOARD_ITEMs.
Fixed compilation warnings on clang (Tom)
get_value_or() is considered deprecated, but still works in the newest
boost (1.63). On the other hand, value_or() is not available in some
versions that are still used by major distros.
dispatchContextMenu() stores the cursor position before displaying a
menu, so the tools use the original cursor position when processing
events (instead of the mouse position pointing to a menu entry). Later,
the previous position has to be restored, but if in the meantime the
tool was cancelled - previous settings were restored to a wrong tool.
This is used to provide menu entries that allows cancellation of
interactive drawing and routing tools without needing the keyboard.
It is provided in the drawing tools and the router tool.
The cancel event doesn't have any new functionality (e.g. track rip-up
for the PNS router - lp:1448460), this just adds it to the menu, where
it behaves the same as an Escape keypress.
Some grid/zoom tools are left in PCBNEW_CONTROL because they currently
depend on Pcbnew-specific class members. Once refactoring is done to
make it possible to use all zoom and grid controls outside of pcbnew,
these last tools can be moved to common to match their ACTIONs.
New virtual class ACTIONS is added as a member to EDA_DRAW_FRAME so
that the TOOL_DISPATCHER can have access to the appropriate derived
version of TranslateLegacyId()
The apply settings and push settings options now take account of the
validity of the global pad settings when deciding whether to show or
not.
Global pad push now requires a source pad and doesn't push from the
global pad setting when there is no selection.
The whole submenu is hidden when there are no enabled items.
Fixes: lp:1664016
* https://bugs.launchpad.net/kicad/+bug/1664016
Message type is a kind of notification, so it should be received by all
interested tools. It used to be like that in the past, but has been
broken recently.
When creating a copy of CONTEXT_MENU, always a CONTEXT_MENU instance was
constructed, whereas an inherited type should be used. Solved with
CONTEXT_MENU::create() that has to be overridden in inheriting classes.
Event & update handlers are now virtual functions, instead of setting
the handlers with Set{Event,Update}Handler().
There used to be a number of TOOL_ACTIONs that had entries both in
SetTransitions() and the event loop, which seemed redundant and
troublesome.
Now it is not necessary anymore, transitions setup is enough to execute
associated actions.