The TOOL_ACTION_ARGS construction method is supposed to be fairly light
weight, so instead of creating/destroying strings all the time, pass
string_views to the actual string data instead.
wx doesn't currently support string_view -> wxString implicitly
currently, so we have to do the conversion ourself.
Note that "immediate" doesn't mean quite the same thing: while it will
enter the tool immediately, it won't necessarily finish the tool during
the call if the tool has an event loop. So for something like Rotate
"immediate" and "synchronous" have the same behaviour, but for something
like Move they do not.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15085
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.
The WX_COMPATIBILITY mode is always assumed now (the option was removed
previously), but the define is no longer present. So remove the old code
that checked for it and just leave the wxASSERT statements.
Using std::any from C++17 allows for proper type handling in the
parameter field, removing the need for casting to void* and then casting
the void* to the desired type.
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
The disable grid hotkey should allow the snap scale to be completely
determined by the snapSize and world scale. This prevents snapRange
from overriding in the case where grid is disabled.
Additionally, we disallow grid snapping when the grid scale is not
visible. This means that when zoomed out sufficiently to not show the
minor ticks, these minor ticks will not override a snap
Fixes https://gitlab.com/kicad/code/kicad/issues/12303
We're getting segfaults in places where this isn't checked. Also, add
some asserts so we can catch bad tool push/pop.
Removes all uses of GetCommandStr() and makes it private.
dropping files to Kicad manager :
*.kicad_pro, *.pro -> open project;
gerber and job files -> open in Gerbview editor;
Eagle and Cadstar files -> open project.
dropping file to schematic editor -> append schematic;
dropping library file to Symbol editor -> add library;
dropping board file to PCB editor -> append board;
dropping library or footprint file to Footprint editor -> add library or import footprint;
dropping ZIP file or gerber files to Gerbview editor -> open files;
dropping sheet file to Drawing Sheet editor -> open sheet.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11638
This allows them to work in places like search boxes in standard file
dialogs. If wxWidgets doesn't find the standard IDs in our menus
then it won't enable them.
These can happen when a tool is active that sends signals when exiting
(e.g. deselectEvent). These may be caught by the active loop in another
tool which might try to update the UI after it has been freed. By
marking all tools as "shutdown", the only event returned to them should
be null. As an extra precaution, we flag the shutdown globally within
the tool manager and check this flag before launching either events or
new tools
Fixes https://gitlab.com/kicad/code/kicad/issues/10698
Our menu bar code is interestingly complex. But we were throwing away newly made menu items to the void in the cases of constructed on the fly submenus
Fixes:
* Various special cases around junctions on pins and dragging.
* Some rotations of endpoints resulting in a 45 degree rotate.
* Some cases where it was possible to get a line with neither
endpoint selected, and also substractive unselecting only one of two
selected endpoints unselecting both.
* Use line midpoint for sorting. Start and endpoints aren't
consistent in the order they appear on the X or Y axis. So,
we need to use the midpoint for our position for consistent
sorting when dragging groups of parallel lines where some
have the start and end reversed.
Other:
* Rename TEMP_SELECTED TO SELECTED_BY_DRAG. This is the actual meaning
of the flag, and should reduce confusion as
to when it should be used.
* Move usage of TEMP_SELECTED as an algorithmic mark to CANDIDATE
instead.
* Fix mistaken clearing of START_POINT and ENDPOINT.
* Move endpoint setting and clearing out of narrowSelection, and into
selectPoint and selectMultiple.
* Don't show dangling end warnings on new lines
This is for the out-of-box experience for novice users. It is presumed
that folks with larger more complicated boards will turn it off.
Fixes https://gitlab.com/kicad/code/kicad/issues/6413
We need the item to be currently selected when repeating the last symbol
insert. This ensures we have a valid selection before starting the move
tool and possibly getting odd system behavior from mouse positions
Fixes https://gitlab.com/kicad/code/kicad/issues/10619
(cherry picked from commit 7642a9db79)
Also regularizes some of the other selection filtering options.
This also fixes an invalidated iterator (and subsequent segfault) in
the old code.
Fixes https://gitlab.com/kicad/code/kicad/issues/9896
Adds "UpdatePreferences" action that is called when the preferences are
updated, allowing running tools to act on changes that may affect them
Fixes https://gitlab.com/kicad/code/kicad/issues/9737
Also removes the return value from the BITMAP_STORE's themeChanged
method as it will provide the wrong answer for the second frame it's
called on.
Also hooked up ACTION_TOOLBAR, the app launcher, and the project tree
to the wx event for system color changes so they change on the fly.
Fixes https://gitlab.com/kicad/code/kicad/issues/6026
Moving points should not be overrided by disambiguation menu, so we
track where the disambiguation event started and only trigger the menu
if the mouse hasn't moved a full unit in x/y
Fixes https://gitlab.com/kicad/code/kicad/issues/9132
Previously, we were checking if the selection tool was the top of the
stack but this ignored many other "secondary" tools that might be
running such as the point editor. These still allow the selection tool
to handle events such as clicks. This change allows the selection tool
to handle clicks when it is the primary tool on the stack rather than
the top
Fixes https://gitlab.com/kicad/code/kicad/issues/9110
This standardizes selection tools in SELECTION_TOOL class to be able to
handle a long-click as asking for a non-heuristic disambiguation menu.
Fixes https://gitlab.com/kicad/code/kicad/issues/8490