This breaks the following functions out to a general-purposed refdes utils
header:
* MODULE::GetReferencePrefix()
* kicad_string.h RefDesStringCompare()
This acheives:
* Slimming of MODULE interface
* Placement of refdes code in common rather than pcbnew
** Testing of this code in qa_common
* Tighter and smaller includes for code that only needed refdes functions
Note: there are failing tests commited (as expected failures). These
are the cause of lp:1813669 and will be fixed as a follow-up commit.
This is not logic specific to MODULE. Breaking it out to
kicad_string.h acheives:
* Slimming of the MODULE interface
* Enables reuse of the function
* Enables testing of the function
Also add a test under qa_common for this function.
The CONFIG_SAVE_RESTORE_WINDOW class does not need to be tied
to the array dialog, put it in common/widgets.
Also do a refactor and tidy-up of the the class, use a union for (slightly)
better type-safety and syntax (a variant would be better but that's C++17).
Also enable integral field save/restore from text boxes.
Fully initialise the CREATE_ARRAY_DIALOG_ENTRIES object,
and use these values for the dialog on first open. Currently,
the initial values aren't all initialised, and none are used, as the
valid flag is not set. This means there are poor defaults in some
fields.
Also more declarations and defintions of CREATE_ARRAY_DIALOG_ENTRIES
to the .cpp, as these do not need to be exposed in the header,
even privately.
The original item is part of the array, so give it a number
and put it in the right place (all current array tools have
a null transform for the first item, but it's not part of the
contract. For example, a circular array with an angle offset
might want to move the first point).
The numbering axis priority (h then v or v then h), and alternate
reversing are not actually numbering parameters, they are part of
the geometry of the array (the items are physically in different
orders).
So enable these options, even when numbering is disabled.
Also fix broken logic about when numbering scheme is enabled
(it still applies even if the numbering offset is fixed.)
The current module cannot be queried for existing pads as we
add them (because we never commit, until we finish the whole array).
Instead, pre-gather the names and check as we add, skipping any existing
names.
Note: this will not prevent arrays becoming "mis-ordered", but there
is not a lot we can do to prevent all possible errors.
Fixes: 1808706
* https://bugs.launchpad.net/kicad/+bug/1808706
The same principle could be used to skip existing ref-des'es on PCBs.
The geometry and numbering logic is separate to the dialog, and
can be separated for clearer logic and better testability.
Moreover, refactor it to avoid any dependency on pcbnew
classes, so it can be move to common for potential re-use in
eeschema and friends in future.
Also convert all wxPoint logic in these classes to VECTOR2I and
fix some function visibilities.
Add some unit tests of the ARRAY_OPTIONS geometry and numbering.
Snap/Grid modifier follow preferences from 05483a06c6. Brings Shift/Alt
modifiers into alignment with drawing tools. Shift modifier still
conflicts when choosing end item with the complete track click-modifier.
This will be addressed in v6 with a larger preference setting.
Snapping to item options were partially disconnected when unifying
framework. This re-attaches the options and adds the additional option
for graphical items.
Fixes: lp:1801377
* https://bugs.launchpad.net/kicad/+bug/1801377
kicad2step has a tolerance level that sets whether two points are at the
same location or not. This allows KiCad to access these levels to some
degree, permitting a looser interpretation of a closed board outline.
The selection for interactive drag uses cursor position off grid to
choose the element for dragging. We pass the same value into the start
dragging routine to choose the correct end of the element.
Fixes: lp:1813665
* https://bugs.launchpad.net/kicad/+bug/1813665
Rather than selecting an arbitrary track to snap, we select the closest
track to our point, allowing the via to be placed along the full track
length.
Fixes: lp:1813324
* https://bugs.launchpad.net/kicad/+bug/1813324
Some microwave inductor lengths cause invalid outputs
for the calculations, which causes jagged outputs.
* If the request length is such that four arcs and no straight
segments is too long
* If the length is such that an N-turn coil is too short, but
an N+1-turn coil is too long. This can happen when the coil
count is small.
This patch doesn't fix the underlying geometric issue here - fixing
the first requires a numerical method, and fixing the second probably
needs an iterative approach. Both of these could benefit from
a refactor.
However, this patch does prevent the tools producing invalid outputs,
which can sometimes be quite subtle mistakes if the "jags" are small.
Fixes: lp:1792119
* https://bugs.launchpad.net/kicad/+bug/1792119
Phoenix doesn't have the same initialization as wxpython3 and so the
namespace doesn't get the wxApp() initialized to the existing instance.
In python, this is worked around by starting a new wxApp.
Unfortunately, this appears to overwrite the existing global instance
variable. The issue _appears_ to be in Phoenix but for now we work
around it by saving and resetting the instance pointer in the main app.
The downside is that Python likely won't be able to respond to events
from C++
Fixes: lp:1809913
* https://bugs.launchpad.net/kicad/+bug/1809913
In the past, the ZONE_CONTAINER::GetPosition() member
returned a reference to a wxPoint, in accordance with the
BOARD_ITEM interface. This meant that ZONE_CONTAINER had
to reinterpret_cast a VECTOR2I (its internal position data) to wxPoint,
which was possible only due to fortunate memory layout.
This interface was changed to return wxPoints by value in
commit a4528988ca, and the normal (wxPoint) cast was used instead.
Thus, we can now also remove the dire warnings and static_asserts
used to ensure the now-unused old method was correct.
Introduce the concept of a DRC_PROVIDER which allows
to separate the various DRC functions to their own
areas. This allows, amongst other things, a slimmer core
DRC class, and allows DRC functions to be separately testable.
The courtyard DRCs (overlap, missing and malformed)
are the first victims, so instrumentation can be added to this function.
Add some unit tests on this DRC function, as well a few re-usable PCB-based
utility functions in a library (qa_pcbnew_utils) that could be shared between
unit tests and other utilities.
This separates the "newMarker" functions from the DRC class. These
are moved to a new class, DRC_MARKER_FACTORY, which is now responsible for
constructing suitable markers from BOARD_ITEMS.
The reasons for this are:
1) Allow DRC related functions to access theese functions without having
to bake these functions into the main DRC class.
2) Thereby simplify the DRC class interface
3) As DRC_MARKER is now a small class with public interfaces, it's
possible to put unit tests on these functions.
The motivation here is to allow to start to split out pieces of DRC
into separate classes.
Prior to placing the via, we check if the resulting via will pass too
close to different nets on different layers.
Fixes: lp:1718827
* https://bugs.launchpad.net/kicad/+bug/1718827
Previously, when the 3D viewer is opened, each board edition creates a 3D view refresh, that usually takes a bit of time.
Now the refresh is postponed until the 3D viewer has the focus.
When creating the zone cutout, we delete the old zone and add a new one
with each cutout. This requires resetting the source zone and clearing
our previous selection if we would like to continue using the cutout
tool on the new zone.
Fixes: lp:1812339
* https://bugs.launchpad.net/kicad/+bug/1812339
Plotting mask layers, we expand by a minimum width before performing a
boolean add of the separate regions. The boolean add has a separation
condition that includes equality. Since we are looking for the
complement of the mask, we would like the equality applied to the other
side. Removing a unit value provides the separation.
Fixes: lp:1698457
* https://bugs.launchpad.net/kicad/+bug/1698457
When loading an existing file, a missing value in the soldermask min
width value should not be interpreted as a default value but rather as a
0 value. This corrects an issue introduced by 4d709d2392
When prompting for a new footprint library, we need to treat the input
as a file for creation rather than a directory for selection.
Otherwise, users cannot specify the name of their new footprint library
independently of the existing directory names.
Fixes: lp:1812135
* https://bugs.launchpad.net/kicad/+bug/1812135
There is some odd interaction in the default copy constructor for
TOOL_EVENT using boost::optional under gcc. Avoid this by explicitly
constructing the event needed for cut
Fixes: lp:1812848
* https://bugs.launchpad.net/kicad/+bug/1812848
the stroke mode was always activated, even in fill mode. creating incorrect size shape for null length track segments.
Fixes: lp:1812532
https://bugs.launchpad.net/kicad/+bug/1812532
This issue created memory leak and not working wxComboboxes (for instance after modifying the language selection).
Now, these wxComboboxes are created only once, never recreated.
Also: minor cosmetic enhancement in footprint editor main toolbar
(the save footprint icon is modified if the footprint is saved to the board or to the library)