In Python3, all division operators promote integers to floats. We need
to downcast back to integer for the polygon vertices.
There was also an unhandled overflow in the QR generation that allowed
more than 512 bits to be loaded. This overflows the type of QR we
generate, so this truncates the input string to 62 bytes ( leaving 12
bits for the checksum )
Fixes: lp:1850223
* https://bugs.launchpad.net/kicad/+bug/1850223
(cherry picked from commit 9bccbaf497)
The oval clearance adds an edge on the 0-length side of a circular oval.
This is not needed and can affect the fill algorithm. Instead, we treat
round ovals as circles for pad polygons
Fixes: lp:1849846
* https://bugs.launchpad.net/kicad/+bug/1849846
The constrained draw was constraining the polygon size to fit the
existing points rather than extending the existing points to fit the
user's intent.
This adds a 90° double-joint for the completion polygon that allows the
user to complete common constrained polygons visually based on the
preview with a double-click to finish.
(cherry picked from commit bae50fab9f)
Fixes: lp:1849299
* https://bugs.launchpad.net/kicad/+bug/1849299
BLOCK elements in DXF are re-usable bits that are useful when editing
the file but should not be shown when importing the model. This skips
all references except those that exist in the default "*Model_Space".
This block is required in each DXF file and cannot be renamed.
Fixes: lp:1790821
* https://bugs.launchpad.net/kicad/+bug/1790821
(cherry picked from commit df3fabfa21)
Flipped footprint pads may report their "primary" layer as not the front
layer in high contrast. We need to check whether the board item for
snaps is visible on the active layers.
Fixes: lp:1847877
* https://bugs.launchpad.net/kicad/+bug/1847877
(cherry picked from commit 07c8596084)
The router items may not yet have a board item parent. In this case,
the reference to the parent needs to be guarded before dereferencing.
Fixes: lp:1847717
* https://bugs.launchpad.net/kicad/+bug/1847717
(cherry picked from commit 0f8a1c22ad)
that can generate the same hash for 2 different footprints.
Therefore, for some footprints, the right footprint was not associated to the component.
The hash calculation was using a XOR to combine 2 sub hash values.
This is not a reliable way to combine these hash values.
They are now added.
Looks better to identify similar and different footprints.
Fixes: lp:1847575
https://bugs.launchpad.net/kicad/+bug/1847575
Items and layers that are hidden in the view should not be used as snap
points. This happens in multiple locations:
1) Grid Helper for normal tools
2) TOOL_BASE::snapToItem for router
Resolves KiPro Issue #116
Fixes: lp:1833128
* https://bugs.launchpad.net/kicad/+bug/1833128
(cherry picked from commit cecfeea947)
Calling Init() in an action routine will reset the router
settings to the state they were in when first starting pcbnew.
The Init() function is automatically called when the tool is created.
Fixes: lp:1843810
* https://bugs.launchpad.net/kicad/+bug/1843810
* Fix wildcard display in the file selector dialog (on GTK
it would show the regex to the user)
* Move the file extension comparison into a common function
(cherry picked from commit b33c3a5ad8)
The parenthesis depth is 2 when the polygon isn't closed. This
shouldn't happen but we have the fall-through to handle odd cases
Fixes: lp:1844872
* https://bugs.launchpad.net/kicad/+bug/1844872
With pads, we should check available anchor points for each connection,
increasing probability of finding connection to match fill algorithm
Fixes: lp:1844661
* https://bugs.launchpad.net/kicad/+bug/1844661
(cherry picked from commit b7128639f8)
Doing so in the internals keeps users from being able to swap layer
names as the dialog does each layer name change individually.
Fixes: lp:1842665
* https://bugs.launchpad.net/kicad/+bug/1842665
(cherry picked from commit f491b7fff7)
Use the HTML_MESSAGE_BOX window to present the warning messages rather
than wxMessageBox which would overflow the display when there were a lot
of graphic items that could not be parsed.
Fixes lp:1839565
https://bugs.launchpad.net/kicad/+bug/1839565
(cherry picked from commit 24454f5105)
You can trigger it before this fix by running Cvpcb when a .kicad_mod file is
incorrectly set as "Legacy" in your footprint table.
(cherry picked from commit e269b5d1b9)
Setting the active layer should be tied to the events that are triggered
by the layer change and overloaded for each frame. This ties the hotkey
back to these events.
Note: In the 5.1 cherry-pick this also adds the missing hotkey to
footprint editor
Fixes: lp:1838244
* https://bugs.launchpad.net/kicad/+bug/1838244
(cherry picked from commit 494d0de9b8)
The local settings panel needs to have its children sized when shown.
Triggering a resize event on changing the pad shape accomplishes this.
This is not triggered in master due to refactor of the custom pad
connection options.
Fixes: lp:1837789
* https://bugs.launchpad.net/kicad/+bug/1837789
Adds the missing default layer to the default board setups for two
layers with parts on single side (either top or bottom)
Fixes: lp:1841294
* https://bugs.launchpad.net/kicad/+bug/1841294
We need to set the footprint local coordinates of the footprint
reference and value fields at instantiation separately from the
TEXT_DIVERS elements.
Fixes: lp:1829727
* https://bugs.launchpad.net/kicad/+bug/1829727
This modifies that logic for optimizing pad connections.
1) Custom pads now prefer the connections to their longer side. This is
particularly important to match the behavior in a rectangular pad
2) Costs for straight lines are non-zero. This favors fewer connections
3) Custom pad breakouts are at the polygon boundary rather than offset
by 0.1mm. This also matches the circular and rectangular paradigm.
4) Line Heads contained in the pad itself are not optimized. This
prevents escaping the pad unnecessarily
Fixes: lp:1824182
* https://bugs.launchpad.net/kicad/+bug/1824182
(cherry picked from commit 06cb21cc47)
TRACK::GetEndNetCode() can get called using a NULL-pointer as 'this'.
The compiler assumes this won't happen and optimizes away a NULL pointer
check at the start of the function (so we might as well remove this check.)
Fixes: lp:1840562
https://bugs.launchpad.net/kicad/+bug/1840562
The Board bounding box calculation has two modes: edges only and
everything. While the everything mode works as expected, the edges only
calculation (and everything that depends on it) was seeing only the edge
cuts on the board drawings layer and not the footprint edge cuts.
Fixes: lp:1839768
* https://bugs.launchpad.net/kicad/+bug/1839768
(cherry picked from commit 99859727e8)
When dragging, you will seldom want to snap to the original item. This
commit prevents the "size of track" snap to the original item and
replaces it with an auxilary grid origin for the snap. This means
effectively that the snap will happen to grid for the original item
unless the cursor is closer to the original item line than it is to the
grid crossing.
Fixes: lp:1820248
* https://bugs.launchpad.net/kicad/+bug/1820248
(cherry picked from commit 0de25e557b)
In rare cases, the VRML triangulator may claim to work but return empty
vectors. These cases need to be caught before we dereference the vector
elements.
Fixes: lp:1838448
* https://bugs.launchpad.net/kicad/+bug/1838448
This sets the clearance outline to a slightly better opacity to allow
viewing of items behind the routed track clearance. Future work should
include making this a configuration option.
Fixes: lp:1826719
* https://bugs.launchpad.net/kicad/+bug/1826719
1) Intermediate states might be self-intersecting, and we shouldn't
be policing our users on what order to do things in
2) The polygon might already be self-intersecting, at which point we're
preventing the user from fixing it.
Also includes better const management for SHAPE_POLY_SET API.
Fixes: lp:1833831
* https://bugs.launchpad.net/kicad/+bug/1833831
(cherry picked from commit a3c74051c2)
The returns of KiCad file extensions on GTK contain basic regex matching
case-insensitive file extensions. We need to match these in the
provider and tests
(cherry picked from commit 1956c074ba)
This adds the upper-case version of files names to the selection box for
filesystems that support case-sensitive file names.
Fixes: lp:1832853
* https://bugs.launchpad.net/kicad/+bug/1832853
(cherry picked from commit 36f70704eb)
1) Generate refreshPreview events so the modern toolset doesn't
fall behind by one event (see LP:1818667)
2) In the legacy toolset don't call unimplemented routines and don't
snap to grid on the non-movement axis.
wxWidgets sends the KillFocus event before the Cancel button event,
and it sets the receiving-focus window pointer to NULL (so you can't
even check for it being the Cancel button. Last time around (with
the UNIT_BINDER) I also tried a bunch of hacks for whether the window
pointer is NULL, etc., but they aren't discriminatory either.
Fixes: lp:1834975
* https://bugs.launchpad.net/kicad/+bug/1834975
Fixes: lp:1834966
* https://bugs.launchpad.net/kicad/+bug/1834966
(cherry picked from commit 1c30f3d9a9)
More than that just gets annoying, and there is at least one edge case
which throws us into an infinite loop if we don't have something to
break us out.
Fixes: lp:1834966
* https://bugs.launchpad.net/kicad/+bug/1834966
(cherry picked from commit 29db6152b3)
When approximating arcs for polygons, we should allow for large radius
arcs/circles without coarsening the arc beyond a limit. This is a
5.1.x-only patch to address this issue. It should not be picked to
master as this is already addressed separately by max_error
We do not allow non-copper routed tracks and they will break assumptions
elsewhere in the code. We drop them in the beginning so that they are
not saved.
Oblong holes (slots) use now a aperture attribute similar to round holes.
(The previous attribute "slot" is now deprecated)
However they have a specific aperture, and a comment is added in drill files for these apertures.
Prevent the symbol and footprint library table editors from substituting
the current project path (${KIPRJMOD}) when adding libraries to the global
library table. This will almost assuredly fail when opening a different
project. We still allow users to manually use ${KIPRJMOD} in global table
paths under the assumption that if they are typing this in then they most
likely understand environment variable substitution.
Fixes lp:1830694
https://bugs.launchpad.net/kicad/+bug/1830694
(cherry picked from commit 288982b15d)
Footprint library nicknames are case sensitive but the comparison for
the library tree control was case insensitive.
Also make the footprint name comparisons case sensitive as well. While
not strictly necessary, the plan is to start using the name defined in
the footprint file instead of the file name which will allow for case
sensitivity.
Fixes lp:1833701
https://bugs.launchpad.net/kicad/+bug/1833701
Non-copper zones do not have a fillet/chamfer option, so we need to
clear it before the zone tool uses the last-used option.
Fixes: lp:1833672
* https://bugs.launchpad.net/kicad/+bug/1833672
The previous commit missed a case where the number was so large that it
overflowed the integer invalidating the comparison. This protects
against that case by using floating point comparison.
This checks the movement against a maximum value that would place the
selection outside of the valid area for the footprint or board.
Fixes: lp:1833478
* https://bugs.launchpad.net/kicad/+bug/1833478
Custom pads are referenced to the anchor pad 0-point, so flipping the
polygon should be about 0 and not the flip point.
Fixes: lp:1831311
* https://bugs.launchpad.net/kicad/+bug/1831311
DIALOG_EXIT was not being laid out correctly after setting the dialog
message. Rather than fix our custom DIALOG_EXIT, wxMessageDialog and
wxRichMessageDialog were substituted as direct replacements for all
of the variants of DIALOG_EXIT. This make message dialogs appear more
consistent because wxMessageDialog uses the default platform message
dialog and wxRichMessageDialog uses the default platform rich message
dialog on windows.
Remove DIALOG_EXIT_BASE as it is no longer required.
Fixes lp:1832899
https://bugs.launchpad.net/kicad/+bug/1832899
(cherry picked from commit 3f665318f4ab5c02b7d3c29b5233a273fdac2e4e)
Create a new action in pcbnew, gerbview and the footprint viewer/
editor to display the help documentation. Disconnect the wxID_HELP
event from the window so that it no longer conflicts with the zoom
action.
Fixes: lp:1822041
* https://bugs.launchpad.net/kicad/+bug/1822041
Mouse capture end is called by some actions such as save board. This
resets the cursor image but doesn't change the current tool. Resetting
the cursor image during action prevents this.
This standardizes the import vector graphics file dialog to use the
sbSizer titles instead of bold+lines. Tooltip changes will be in the
next change as we don't change strings for bugfix releases and this
commit is targeted for 5.1.3
Fixes: lp:1823462
* https://bugs.launchpad.net/kicad/+bug/1823462
(cherry picked from commit f7550940ee)
We prevent the creation of invalid polygons by keeping the converging
lines from intersecting. This test doesn't make sense for triangular
polygons as they always intersect and we want to allow them to move
outside of the singular point.
Fixes: lp:1831481
* https://bugs.launchpad.net/kicad/+bug/1831481
Building custom targets that depend on custom commands such as our
keyword lexer requires two layers of indirection to pick up changes
properly and not overwrite the same file in parallel builds.
Fixes: lp:1831643
* https://bugs.launchpad.net/kicad/+bug/1831643
(cherry picked from commit c6af38477d)
Grid and ratsnest visibility are stored in the board file and should not
be changed without the user explicitly modifying them.
In the future, we'll move these settings out of the board file but we
shouldn't cause extra file-churn for flipped bits.
Fixes: lp:1828285
* https://bugs.launchpad.net/kicad/+bug/1828285
(cherry picked from commit e7e20b85b5)
Always check the return value of PyRun_SimpleString() for errors when a
Python script is run and show an error message rather than fail silently.
Enable Python interpreter I/O redirection in debug builds so that script
string errors will be shown when PyRun_SimpleString() is called.
Do not call PyErr_Print() after a PyRun_SimpleString() call failure. It
doesn't do anything useful.
Do not call Py_Finalize() after a PyRun_SimpleString() call failure. It
seems to cause Pcbnew to crash.
(cherry picked from commit 816f6db310)
KiCad does not allow references to be numeric only. This prefixes such
references with "UNK" to note that the reference designator type is
unknown.
(cherry picked from commit a62a89eac3)
Sometimes we want to inflate a polygon without adding rounded edges.
This add the option using the jtMiter setting.
This is used in the Eagle parser to expand the Eagle zones for KiCad.
Eagle Zones are drawn on the polygon edge, so they extend out from the
outline. KiCad zones are drawn inside the polygon. We need to both
increase the zone size and decrease the minimum pen width to account for
this.
Fixes: lp:1817312
* https://bugs.launchpad.net/kicad/+bug/1817312
(cherry picked from commit 490c805319)