577 Commits

Author SHA1 Message Date
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
4024a15a17 Don't reference stack variables from a long-life lambda.
In particular, a lambda for conditional menus should
never capture more than `[this]`.  Even the tool's
frame pointer could change.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21615
2025-09-01 12:44:20 +01:00
Jeff Young
1309b436da Allow stitching of graphic shapes. 2025-08-31 19:32:48 +01:00
Jeff Young
c47b7459aa Set free vias to graphic net if available.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21578
2025-08-31 19:21:29 +01:00
John Beard
0f0527bd03 Pcbnew: fix sensitivity of via placement to large grids
Another case where large grids are overly "grabby" for snaps.

In this case, because the via was moved to the grid-snap first,
and then THAT position was used to look for things like pad-snaps,
the pad snaps would not be found if a coarse grid meant the cursor
was outside the pad.

Instead, use the mouse position when looking for the non-grid snaps
in VIA_PLACER::SnapItem.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18626
2025-08-26 23:34:46 +08:00
John Beard
3d8803f579 Pcbnew: use R-tree for pad checks in via place tool
Otherwise this is an O(n-pads-on-board) operation for every new
candidate via position.
2025-08-26 23:34:46 +08:00
Seth Hillbrand
4e7fa189aa Refactor gfx import cleanup
Break up monolithic function into responsibilities.  Adjust cleanup to
correctly modify each graphical pairing.  Fix drc test to properly
report gap distances that are relevant to outlines

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13090
2025-08-25 11:33:26 -07:00
Seth Hillbrand
1166cacc64 Snap point editor into place
Adds 90° support to the point editor and ensures editing is the same as
creating when it comes to point snapping

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21481
2025-08-15 12:19:06 -07:00
Jeff Young
a0e768dd0e Cleanup compiler warnings. 2025-08-13 16:22:51 +01:00
Seth Hillbrand
188ffda029 Add a 90°-only mode for polygon creation
Sometimes, you don't want those 45° corners in your nice, clean zones.
This adds an additional mode that can be selected, cycling through
free-angle, 45° angle and 90° angle constraints
2025-08-12 16:48:36 -07:00
Seth Hillbrand
dd41e2b00b Don't prompt for rule areas and no-net shapes
Highlighting and placing vias will pop up a potential net list. This
should not include things without nets

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21381
2025-07-25 16:39:59 -07:00
Jeff Young
0495828a55 Honour front/back layer types for user layer.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21284
2025-07-17 09:35:21 +01:00
Seth Hillbrand
e04c5783cf Break out of the zone tool on complete
After placing a zone, we want to be able to immediately edit the zone
points.  But in the zone tool, we have the intermediate context menu
that doesn't help, so breaking back to the selection tool simplifies
that workflow

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21319
2025-07-14 18:09:26 -07:00
Jeff Young
c758a2fbaf Don't sequence layers when order doesn't matter. 2025-07-14 19:12:44 +01:00
Jeff Young
6474913fe8 Re-entrancy guard for zones and vias (potentially KICAD-AFQ). 2025-07-12 09:14:39 +01:00
Jeff Young
b2ba9d3371 Less auto. 2025-07-11 21:26:19 +01:00
Jeff Young
18e107529a Don't force callers of GetAppSettings to implement exception processing. 2025-06-14 20:25:59 +01:00
Jeff Young
116bd924c2 Static cast safety.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20958
2025-06-08 23:21:02 +01:00
Jeff Young
af1a246e12 Nullptr safety. 2025-06-06 18:28:39 +01:00
Marek Roszko
c505e11c24 Inverse conditional to silence warning about fallthrough
[[fallthrough]] cant be inside a if statement, the next statement must be the case
2025-06-05 21:35:49 -04:00
Jeff Young
e8e7282fe1 Fix a bunch more bugs in bezier approximation. 2025-05-26 18:12:43 +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
Jeff Young
194ee9ef25 Move Use45Limit processing to VIEWER_TOOLS.
(We need it for the ruler in footprint preview
widgets.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20668
2025-04-16 18:09:56 +01:00
Jeff Young
ecb5c5e0d4 Visibility control is for *filled* shapes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20635
2025-04-13 13:12:43 +01:00
Jeff Young
159302063a Move board characteristics and stackup to PCB_TABLEs. 2025-04-12 20:41:01 +01:00
Mike Williams
40058ebe80 actions: move all basic selection operations to common actions 2025-04-02 12:02:01 -04:00
Damjan
230a976742 pcbnew: Drag-selecting while creating a Text breaks PCB editor tools
CHANGED: drawing_tool.cpp: DRAWING_TOOL::PlaceText method ignores events when mouse drag is detected.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20010
2025-02-27 16:47:21 +00:00
Jeff Young
3f15b0d75b ADDED: hatched fills for shapes. 2025-02-24 11:08:29 +00:00
Seth Hillbrand
9beca90185 Ensure that new text objects are "new"
Setting the new object flag ensures that we do not commit changes in the
dialog, before the object is placed on the canvas

Fixes https://gitlab.com/kicad/code/kicad/issues/19778
2025-01-28 23:16:46 -06:00
Damjan
c6e049df2a Pcbnew: isDrag detection in Table creation tool
Drag breaks the UI when in the create table action

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19767
2025-01-29 01:25:37 +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
Jeff Young
753d385473 Reduce dependency on dynamic_cast.
Also switches to checking __clang__ instead of __WXMAC__.
2024-12-08 21:46:54 +00:00
Jon Evans
196368eb86 CHANGED: Drawing tools can disable H/V/45 snap with Ctrl key
Also disable 45-degree snapping for rectangle shapes; it is
not very intuitive to be limited to drawing squares when this
setting is on.
2024-12-02 12:04:42 -05:00
John Beard
dad07f590a Pcbnew: bezier tool fix width on subsequent curves
This got broken by the changed start logic in a3f239ce5e.
2024-11-28 20:18:00 +08:00
John Beard
a3f239ce5e Bezier: improve double click action
Act more like the line chain tool - a doubleclick finishes
the current curve and resets into non-chained mode
to start again.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19204
2024-11-28 04:36:12 +08:00
John Beard
6bd69a3f77 Bezier/line: add delete last point to context menu
These tools support this action, so add to the menu to make it
more discoverable that the actions exist.
2024-11-28 04:36:12 +08:00
John Beard
f15c5ccfdc Pcbnew: beziers - distinguish cancelled from reset on Esc
When pressing escape, act like the line tool, with two possibilities:

* The current bezier isn't "started", in which case, cancel out of
  tool entirely.
* The current bezier is "started", in which case cancel it, but
  stay in bezier mode to draw another one from a new starting position.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19206
2024-11-28 04:36:12 +08:00
John Beard
d973fd723e Pcbnew: add an arrow change action to the menu when drawing an arrow 2024-10-30 21:22:37 +08:00
jean-pierre charras
e8d89b1327 Fix compil warnings 2024-10-13 17:28:44 +02:00
Jon Evans
2a605e4a4e Infrastructure and file format for via stacks 2024-10-06 18:45:25 -04:00
John Beard
3f131e2011 Abstract REFERENCE_IMAGE to a separate class
Break the non-PCB-specfic parts of PCB_REFERENCE_IMAGE out
to a common REFERENCE_IMAGE class, which is then composed into
the PCB_REFERENCE_IMAGE. This will make it easier to bring the
transform origin logic to eeschema without repetition.
2024-09-30 10:20:20 +01:00
John Beard
b3248095e8 Pcbnew: add bezier editing tool
Adds the initial implementation of bezier overlay
(assistant) and geometry manager. This is only
implemented in Pcbnew - the code is common, but
eeschema doesn't currently use it for any shape.

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/8828
2024-09-25 21:41:32 +01:00
Seth Hillbrand
c736904e39 Use arrow not pencil when selecting image
The arrow cursor makes better syntactic sense for placing existing items
rather than drawing as is the case for other tools

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17588
2024-09-13 16:52:18 -07: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
John Beard
9fac24fa0f Pcbnew: set mirrored when creating on back layer
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18643
2024-09-06 20:56:33 +01:00
Mike Williams
2c99bc6c6d new feature: Schematic Design Blocks
Added to advanced config, default to off.
EnableDesignBlocks=1 in kicad_advanced to test

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/2263
2024-09-05 08:35:49 -04: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
Jeff Young
535aca7a8d Remove redundant tooltips.
Also fixes grammar and capitalisation in a few tooltips.

Also standardises some terminology, such as
"Add" vs "Draw"/"Place" and "Assignment" vs "Association".

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17694
2024-08-18 17:18:07 -06:00
Jeff Young
cbfd6ec9ea CHANGED: remove single layer restriction for uvias.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18501
2024-08-15 16:42:57 -06:00
Tomasz Wlostowski
9963b9dd9f TOOL_INTERACTIVE: only create the context menu when we are running in GUI mode
TOOL_MENU::m_menu was unconditionally created by the TOOL_INTERACTIVE constructor, resulting in crashes if
we wanted to run the TOOLs in headless  mode, e.g. in unit tests. This commits makes
the creation of the menu object dependent on Pgm::IsGui().
2024-08-13 22:50:26 +02:00