232 Commits

Author SHA1 Message Date
John Beard c4c19018c3 Pcbnew: Restrict includes of pad.h/footprint.h
There are some headers which don't need to include pad.h (which brings
padstack.h) - they just need forward defines.

While pad.h is not an especially heavy include on the scale of things,
footprint is quite heavy. And both reduce inclusion load and
reduce the number of files needlessly sensitive to changes in headers.
2026-03-05 02:18:34 +08:00
Seth Hillbrand 3114b54f8a Fix use-after-free in BOARD_COMMIT::Revert()
When reverting CHT_ADD entries, items were deleted immediately
but their pointers remained in the bulkRemovedItems vector
passed to OnItemsCompositeUpdate. Board listeners then
dereferenced dangling pointers, causing a crash.

Additionally, items removed from the board were not removed
from connectivity data, leaving stale entries that could
crash on later interaction.

Defer deletion until after OnItemsCompositeUpdate completes
and add the missing connectivity->Remove() call.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23062
2026-02-17 08:50:11 -08:00
Seth Hillbrand 4aca084ab0 Remove heavy includes from board.h and footprint.h PCH chain
Remove component_class_manager.h and pcb_selection.h from board.h

Remove collectors.h and component_class_manager.h from footprint.h
2026-02-13 19:54:46 -08:00
Seth Hillbrand 58b44f5b50 Fix memory leak
CHT_ADD entries were never deleted when Revert() is called.  Also the
m_copy was left dangling in this case
2026-01-09 12:24:21 -08:00
Jeff Young 3dd42c0b35 Special-case firing of SelectedItemsModified in FPEditor.
(The footprint itself is never selected, but we still
use this event for the properties manager, etc.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22608
2025-12-31 17:16:46 +00:00
Jeff Young 12cf83804f Keep re-routed tracks separate from newly-routed.
The former stay in whatever group they were
in, the later go in the entered group (if
any).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22466
2025-12-09 17:38:17 +00:00
jean-pierre charras 48a82f945b add missing PCB_BARCODE_T case in Duplicate and Delete commands 2025-09-27 16:33:32 +02:00
John Beard e016dc52fd Pcbnew: Add concept of a 'point'
This is a zero-dimensional object that can be used for snapping
and documentation of useful, but non-physical features on a
board or footprint. They do not correspond to any physical
output in exports or plots.

Points do have a "size", but this is a graphical property only
and determines how large they are drawn on the board.

They also have a layer, which allows them to be selected and
made visible according to layer filters.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/4691
2025-09-01 23:44:21 +08:00
Jeff Young 6f389fd320 Tighten parent/child undo/redo architecture.
Always look for pre-existing undo/redo record.  Checking for IsNew()
is less robust and should be avoided.  Also moves the checking to a
location where it will be easier to ensure that it's uniform.

Push get-undo-level-item processing down a level so it is uniformly
called.

Make sure tables & labels are uniformly handled.

Remove incorrect usage of Get/SetGroupId() for storing lastPin
(which we don't use anyway).

Lists of deleted and changed items MUST include the screen pointer.
An item could be changed on one screen but not on another.

Also tightens handling of PCB_NETINFO_T items, which are not in the
view.

Also fixes a bug where there is no increment parameter if you assign
the base increment command to a hotkey.
(This was discovered while testing the above changes.)

Also fixes a bug where delete during a move in PCB Editor did an
undo instead of a delete.
(Again, found while testing above.)

An experiment was also run to collapse shared parts of SCH_EDIT_FRAME
and SYMBOL_EDITOR_FRAME into SCH_BASE_EDIT_FRAME.  However, sharing the
undo code actually increased complexity, and there was very little else
of value in SCH_BASE_EDIT_FRAME (other than the Increment() routines).
2025-08-18 19:20:09 +01:00
jean-pierre charras 01e67d78d6 board area fixes (jpc) 2025-06-19 18:26:39 +02:00
jean-pierre charras ea12df80be make board area colored (from Ethan Chien) 2025-06-19 18:26:39 +02:00
Jeff Young 18e107529a Don't force callers of GetAppSettings to implement exception processing. 2025-06-14 20:25:59 +01:00
Jeff Young 9f7fa4df66 There's no view when running tests. 2025-06-13 18:09:22 +01:00
Jeff Young e2cf944915 Dirty clearance lines when rule areas change.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20734
2025-06-13 16:37:10 +01:00
Jeff Young 327cca9de5 Coverity fixes. 2025-05-25 20:01:18 +01:00
Jeff Young f58fc0b952 Rewrite GROUP undo based on uuids.
This also removes the GROUP/UNGROUP-specific undo actions.

This also fixes a bunch of undo bugs when duplicating
group members, creating pins, etc.

This also fixes some undo bugs when dividing wires etc.

This also fixes some bugs with new sch items not
being created within an entered group.
2025-05-21 14:24:59 +01:00
Mike Williams 195e79ae46 commit/groups: add ability to modify membership of group
Also add warning when you've tried to modify two groups in one commit,
which isn't currently supported.
2025-05-14 12:15:22 -04:00
Jeff Young 199a7a34ea Don't leak PCB_GROUP internals into BOARD_COMMIT.
(This also fixes a potential bug where the image
group's children didn't get the image as a parent.)
2025-04-21 18:24:30 +01:00
Jeff Young c1b1c689ad Don't double-add/remove items from connectivity.
BOARD::Add()/Remove() already do this.
2025-04-21 18:20:52 +01:00
Jeff Young 519b29472f Remove temporary debugging code. 2025-04-21 17:40:28 +01:00
Jeff Young 5a3b2cc8fd Temporary debugging code. 2025-04-21 14:42:41 +01:00
Mike Williams 0c0dbc6271 groups: commonize group tool 2025-04-15 09:59:38 -04:00
Jeff Young 0659290417 Simplify hatch damage/rebuild and move it out of view.
There should be far fewer hatched objects than other
objects, so we're spending too much effort finding
all the possible damage when we probably should
just be auto-regenerating all the hatching.

This also moves it out of being done during redraw,
which was proving problematic.  Plus the refill
zones architecture does it during commit, and has
a lot more miles behind it.
2025-04-07 11:46:02 +01:00
Mike Williams 05e9772d54 groups: extract common class methods into EDA_GROUP base class 2025-04-01 14:34:20 -04:00
Mike Williams a90b8ec57a pcb: merge RunOnChildren/Descendants into one function with a mode 2025-03-27 13:16:09 -04:00
JamesJCode ede5faee72 Implement dynamic assignment of component classes 2025-03-15 14:33:47 +00:00
Jeff Young 4b38932129 Group members are still children of the board (not
the group).
2025-03-09 17:59:32 +00:00
Jeff Young 880442e8ed Propagate damage from footprint children. 2025-03-07 17:52:53 +00:00
Jeff Young 7db3ccd98a Better algorithm for knocking out footprints.
(Though anything would have been as the previous
one didn't work at all.)
2025-02-24 23:01:07 +00:00
Jeff Young 907f21e739 Hatching knockout fixes. 2025-02-24 17:35:43 +00:00
Jeff Young 3f15b0d75b ADDED: hatched fills for shapes. 2025-02-24 11:08:29 +00:00
Jeff Young 4959b480c3 Cleanup stale comments. 2025-02-19 23:43:53 +00:00
Jeff Young 9c0214afc0 Cleanup. 2025-02-19 23:43:53 +00: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
jean-pierre charras edd7f5e229 BOARD_COMMIT::Revert(): protect against null pointer.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19011
2024-10-30 17:50:23 +01:00
jean-pierre charras b2be5798cd Fix a typo probably due to a paste command. 2024-09-05 15:59:30 +02:00
Jeff Young 94f995c49e Reduce dependency on dynamic_cast.
(Especially where it is no-worky on MacOS.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17245
2024-09-04 17:24:49 +01:00
jean-pierre charras 4ce9648d34 Fix a few minor Coverity and compil warnings. 2024-08-23 09:54:29 +02:00
Tomasz Wlostowski a4936964e2 pcbnew: fix rebase issue in BOARD_COMMIT 2024-08-13 22:50:26 +02:00
Tomasz Wlostowski 048bbcb02b BOARD_COMMIT: allow to make PCB-editor specific commits outside the actual pcbnew
Useful for testing pcbnew's tools without building the actual pcbnew.
2024-08-13 22:50:26 +02:00
jean-pierre charras 8d53090581 Pcbnew: fix 2 issues after removing a track, especially ending on a teardrop
- Message panel display not always correctly updated (shows an old data)
- Incorrect updated ratsnest is some cases when removing a track ending on
a teardrop.
2024-08-13 19:54:09 +02:00
Jeff Young b8819b4636 Another reduction in asserts. 2024-07-19 22:11:56 +01: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
JamesJCode 36c33e1ad4 Call board listeners after updating connectivity
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18277
(for v9)
2024-07-07 22:46:37 +01:00
Jeff Young 9fb07d886e PCB_GENERATOR_Ts are PCB_GROUP_Ts too.
Also, an item must already be in a commit to add it to a group.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17595
2024-06-05 10:51:24 +01:00
JamesJ 951065390e Add composite update callback to BOARD_LISTENER
Required for net inspector otherwise composite operations (such
as undo / redo, and length tuning) can result in multiple add /
remove events firing which results in inconsistent length state.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17527
(for 9.0)
2024-04-04 22:29:47 +00:00
Jeff Young 4ed2a0674a Minor cleanup. 2024-03-18 22:21:01 +00:00
Seth Hillbrand 6a8d2a7eb3 Store group id rather than group
We only need the group storage id for lookup.  Storing the KIID instead
of a copy of the group avoids unneeded overhead

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17175

(cherry picked from commit 7d1adff071)
2024-02-28 13:27:38 -08:00
Jeff Young e445249720 ADDED: PCB tables. 2024-02-24 20:05:51 +00:00
Jeff Young 995c4af51d Deleted items must have their ownership changed to undo/redo. 2024-01-28 11:13:48 +00:00