221 Commits

Author SHA1 Message Date
John Beard
520a7cf62c GAL: ViewGetLOD should not be able to change the VIEW
Make the VIEW* parameter const. Since PCB_TEXT does a null-check,
it's not very clear if this can ever be null (and if it is,
why don't the other VIEW_ITEMs check?), so don't make them
all references too at this time.

Also dereference a few pointers a bit earlier to make non-null
promises sooner rather than later.
2025-01-02 22:59:31 +08:00
John Beard
527faddbfd GAL: provide constants for LoD HIDE/SHOW and a scale helper
Saves a mishmash of local HIDE/SHOW defs along with various literals.

Also provide a function that computes the scale at which a given
IU size becomes (notionally) a certain size on screen. While this
is a simple division, it's a bit opaque in terms of meaning.

Also it means the divide by zero case can be more universally
defended-against, which has traditionally been a bug opportunity.
2025-01-02 22:59:31 +08:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
John Beard
e9f8b2ba77 Pcbnew: apply same IPC rule in properties panel as in dialog
This means when you switch a pad to be roundable (round rect or
chamfered-with-round), you get the same behaviour as in the dialog
(and an IPC-compliant pad by default).

Also fixes the radius visibility in the properties panel for
chamfered pads (which can have radii).
2025-01-02 00:42:31 +08:00
John Beard
1f551ea0e4 Pcbnew: allow to set pad rounding size from properties panel
This can be useful when you have a defined rounding maximum
(e.g. for an IPC 0.25/0.25 rule) and makes the panel more
consistent with the properties dialog.
2025-01-02 00:42:31 +08:00
John Beard
f7aded00c7 Pcbnew: draw clearance lines on their own GAL layers
This tidies up quite a performance hit on layer change
caused by repainting vias, pads and tracks for their
clearances.

Instead, on a layer change, just disable any old clearance
layer and enable the new one (if any).

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19404
2024-12-31 00:53:10 +08:00
Jon Evans
4eb68c2840 Fix pad and via opacity handling
With new rendering style, these need unique VIEW layers per copper layer
2024-12-28 10:50:58 -05:00
Seth Hillbrand
e9bc8cfe9d Give Clipper1 a Viking funeral
Clears out the last spot where we were only using Clipper1 (how'd I
miss that?) and remove all calls to the Clipper1 structures
2024-12-23 17:12:09 -08:00
Seth Hillbrand
9dfcb6a362 Cleanup ViewGetLayers()
Old style c-array replaced with vector returns
2024-11-21 13:18:36 -08:00
Jon Evans
4ab89c1a07 API: Add pad number to serialization 2024-11-19 19:27:51 -05:00
Jon Evans
71a0a638a0 Remove unused pad layers and simplify pad colors 2024-11-16 11:27:20 -05:00
Jon Evans
5832fa0982 Remove redundant change to padstack mode 2024-11-09 15:02:19 -05:00
Jon Evans
a170e86fbd Support padstacks in annular width and edge clearance DRC 2024-11-09 10:33:23 -05:00
Jon Evans
69ddbeb43f LSET Flip needs copper layer count now 2024-10-27 22:06:50 -04:00
Jon Evans
ae045a2eea Restore pad layerset flipping
Required for SMD pads

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19002
2024-10-27 20:00:36 -04:00
Jon Evans
42b5b604e2 Implement Flip action for PADSTACK
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19002
2024-10-27 11:27:31 -04:00
Lucas Dumont
4bd0243a1e Make make PAD always return SHAPE_COMPOUND
According to PAD::GetEffectiveShape, (overriding the BOARD_ITEM one)
`This routine returns a COMPOUND shape` so make it always returning
a SHAPE_COMPOUND.

Another step should be to either differentiate GetEffectiveShape
returning SHAPE and GetEffectiveShape returning SHAPE_COMPOUND.
Or not using static cast but dynamic one in the calling function.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18909
2024-10-18 19:38:05 +00:00
jean-pierre charras
91569cf3cf PAD::FlipPrimitives(): ensure primitive parent member is up to date.
Looks like the primitive parent member (the pad handling the primitive) is
not always correct: it should be the pad.cpp.
It can create crash (for instance in DRC)
2024-10-10 08:54:13 +02:00
John Beard
4bad76825c Standardise clamp function
std::clamp and alg:clamp had different argument orders.
Since std::clamp is constexpr, we might as well just use
that now we have it.
2024-10-09 21:27:58 -06:00
John Beard
e85ababab7 Pcbnew: Disable locking of free-edited pads
This is confusing because the pads don't get a locked item shadow,
so it's hard to see what is inhibiting a footprint move if a pad got
locked.

Rather than implement the shadow, disable pad locking in pcbnew
(no locking exists in FP editor). Pad lock state isn't persisted
to the board file, so it's not a fully supported action, and it's
unlikely to be actively useful.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18862
2024-10-08 23:30:50 +08:00
Jon Evans
2a605e4a4e Infrastructure and file format for via stacks 2024-10-06 18:45:25 -04:00
Jon Evans
ed0a265aa6 Prevent setting negative pad sizes 2024-10-02 21:18:10 -04:00
Jon Evans
12ef2b8a88 Fix typos in GetSolderPasteMargin 2024-10-02 08:56:44 -04:00
Jon Evans
56e0811516 Phase 2 of padstack support
CHANGED: PCB file format now supports saving/loading complex padstacks

CHANGED: PTH pads are now rendered per copper layer in the copper color;
         the PTH pad color is no longer used.

ADDED: support for importing complex pad stacks from Altium PCBs

Enforce padstack-aware access to pad properties across KiCad

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8182
2024-10-01 19:55:03 -04:00
John Beard
215533f31a Unify flip direction handling
There was a gentle mish-mash of booleans, some with
true being left/right and some up/down, and some functions that
can flip in both axes (which is never actually done, and doesn't
really make geometric sense).

Replace all this with the FLIP_DIRECTION enum class, which makes
the intention completely unambiguous.

This also then allows a small scattering of simplifications,
because everything takes the same type and you don't have to
fiddle booleans to fit.
2024-09-27 17:13:13 +01:00
Seth Hillbrand
5e0abadb23 Reorganize layer numbering
F_Cu = 0
B_Cu = 2
Remaining internal copper layers are even and incrementing

Non-copper layers are odd and incrementing.

This means that we can no longer do things like:
for( PCB_LAYER_ID layer = F_Cu; layer <= B_Cu; ++layer)
Instead, we have the class LAYER_RANGE:
for( PCB_LAYER_ID layer : LAYER_RANGE( F_Cu, B_Cu) )

Similarly, gt/lt tests should not refer to the integer value of the
layer.  We have functions such as IsCopperLayer to test whether a layer
is copper or not.

When using the connectivity RTree, the third dimension is layer, so we
provide B_Cu with the special INT_MAX value, ensuring that elements
between F_Cu and B_Cu will be identified.  There is a new, special
function GetBoardLayer() for interfacing with CN_ITEMS

Similarly, PNS layers remain unchanged and sequential.  A set of
interface functions is provided to map PNS layers to Board layers and
back.  This allows the PNS_LAYER_RANGE to function as expected
2024-09-06 23:07:58 +00:00
Jeff Young
d2b36cc38d Remove special-case for heat-sink pads.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18453
2024-09-02 12:41:23 +01:00
hasecilu
b735d25c68
Fix typo: trapazoid -> trapezoid 2024-08-23 11:07:22 -06:00
Jon Evans
c9af2f318f Ensure constraints when changing pad hole properties
Also expose hole shape to properties system

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17575
2024-08-11 18:10:15 -04:00
Jon Evans
284a760af7 Move more properties into PADSTACK 2024-07-20 17:48:20 -04:00
Seth Hillbrand
7ecde84a94 Move LSET to new BASE_SET class
Next step in large layer refactoring.  Added multiple unit tests as well
to check behavior
2024-07-17 10:32:09 -07:00
Seth Hillbrand
c093fe1355 Simplify LSEQ
Remove unneeded operators and index
2024-07-16 14:48:33 -07:00
Jeff Young
556efd836b Fix RecombinePad when pad is rotated.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18348
2024-07-09 18:14:14 +01:00
Seth Hillbrand
e0453d9bcc Further cleanup of LSET
Remove duplicative functions.  Standardize on C++ stdlib formatting
2024-07-08 22:00:53 -07:00
Seth Hillbrand
cc850d0da0 Split out LSEQ/LSET from LAYER_ID
Separate the layer grouping classes for easier modification
2024-07-08 20:59:46 -07:00
Jeff Young
8b948e7b9c Give padstack warning violation a name.
Also regularises capitalisation & parens in some error
messages.

Also de-duplicates hole testing for PTH pads, and SMD
rationality testing.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18334
2024-07-07 14:04:34 +01:00
Jeff Young
9d03a92738 Get rid of C++20 compiler warnings. 2024-07-03 13:32:44 +01:00
Jeff Young
16340e6cf4 Support both short and long item descriptions. 2024-06-28 22:10:22 +01:00
Seth Hillbrand
7102d9f72a Altium import: handle polygons on copper
In Altium, copper polys will be connected automatically to their
associated pads.  In KiCad, we need to do the equivalent when parsing,
which is to combine the joining copper into the underlying pad.  We also
don't want to treat copper polys as proxy pads without the original
anymore.
2024-06-26 17:27:08 -07:00
Jeff Young
db9f0a0358 Report footprint parent of shape when in board editor.
While the user can't select these, we do report them
in DRC messages and the like, where it's handy to
know what they're from.
2024-06-14 23:19:26 +01:00
Alex Shvartzkop
f0e9f9f15a Optimize PAD LoD calculation. 2024-06-12 23:05:33 +03:00
Jon Evans
f5e7c705db Move custom shapes to PADSTACK; support in API 2024-06-08 14:26:36 -04:00
Jon Evans
0b0a37aaf7 Move padstack serialization to PADSTACK
Also move a few more things from pad/via
2024-06-04 09:28:24 -04:00
Jeff Young
15d4e114e0 Move pad checking to Footprint Checker.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18102
2024-05-29 15:25:49 +01:00
Jon Evans
e16130a02c Move pad and via properties into PADSTACK 2024-05-14 20:57:56 -04:00
Jon Evans
c800fb790d Start unifying padstack properties 2024-05-14 20:57:56 -04:00
Seth Hillbrand
a835ba0715 Add "Mechanical" pad property
Prevents mechanical support pads from being used to check pad types.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16747
2024-05-05 21:57:10 +00:00
Jeff Young
62d4bd7c1d Exercise more care when comparing doubles.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17249
2024-05-05 17:32:48 +01:00
Jeff Young
9a6efd43e1 Don't assume that a SMD pad has copper layers. 2024-05-01 18:16:09 +01:00
jean-pierre charras
2d614898a8 pad.cpp: fix possible incorrect layer mask in PAD::ImportSettingsFrom() after import
ImportSettingsFrom() calls SetAttribute() that can change the layer set.
2024-04-21 13:01:21 +02:00