58 Commits

Author SHA1 Message Date
Seth Hillbrand
29eee9f126 Refactor grid_helper to allow testing
Make view and tool manager optional so that we can implement QA on the
actual snapping
2025-08-05 16:10:17 -07: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
46cb3f96a0 Stale pointer safety. 2025-06-08 22:10:39 +01:00
Jeff Young
327cca9de5 Coverity fixes. 2025-05-25 20:01:18 +01:00
Mike Williams
3112a0b38b sch groups: fix grid alignment on copy/paste
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/20823
2025-05-05 10:02:03 -04:00
Jeff Young
5996cffabc EE -> SCH (no functional changes) 2025-03-13 13:15:47 +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
John Beard
ba484256c1 Symbol editor: grab by snap anchors
Previously, it always used the top left item's position.
This is inconvenient for lots of reasons in the symbol editor,
for example when moving a line, it will warp your mouse to
the other end if you try to move from the end, not the start
(you don't know which is which!). And if you're moving something
like a whole number of grid spaces, like a rectangle, it's
impossible to place it other than the start position on the grid.

Add SCH_PIN to the get anchor position function, and use the
normal GRID_HELPER logic to detect a grab point. This still
rejects graphics if connectables are selected to preserve
on grid connections.

The code in the area mentioned https://gitlab.com/kicad/code/kicad/-/issues/11151
but I'm pretty sure this only makes that better.
2024-10-23 19:46:58 +08:00
John Beard
e23b83505e Snapping: delayed activation of snap points.
This makes it easier to control what snap points you are aiming for
without accidentally activating objects just by mousing near them
on the way to somewhere else.
2024-10-01 18:06:27 +01:00
John Beard
ebef24b6b0 Debug: graphical snap anchor debug mode
When working near snap anchors, which come and go
rapidly, it's often useful to see what snaps have been
calculated. Add an advanced config to show these
(EnableSnapAnchorsDebug) on an overlay layer.

With more polish this could be a hotkey or something.
2024-09-11 22:35:35 +01:00
John Beard
b2be0d39bd Snapping: Add construction geometry snapping
This is a pretty major rework of the snapping system.
The GRID_HELPERs now have a separate CONSTRUCTION_MANAGER
which handles some of the state involving "construction
geometry".

This is fed with 'extended' geometry (e.g. "infinite" lines from
segments) for use in generating things like intersection points.
It also handles adding this geoemtry to a GAL view item
(CONSTRUCTION_GEOM) for display to the user.

The process is:

* A TOOL creates a GRID_HELPER
* Optionally, it pre-loads a "persistent" batch of construction
  geometry (e.g. for an item's original position)
* The grid helper finds useful snap 'anchors' as before, including
  those involving the construction items.
* Other items on the board can be 'activated' by snapping to one
  of their main points. Then, if it has construction geometry,
  it will be added to the display. At most 2 items of this kind of
  geometry are shown, plus the original item, to reduce avoid
  too much clutter.

The dashed snap lines state machine is also handled in the
CONSTRUCTION_MANAGER and displayed in the CONSTRUCTION_GEOM item.
2024-09-11 22:35:35 +01:00
Seth Hillbrand
094d265313 Re-enable grid snap line
This was accidentally disabled by 4039b7da6b9095b14e50eed37d76d29cee5f4111
2024-08-08 14:29:27 -07:00
James J
be8744176c Add SCH_RULE_AREA shapes to eeschema
Includes:
 - Fix GAL to draw closed polygons in eeschema
 - Add functionality to eeschema to draw arbitary polygons
 - Update polygon item previews to have customisable edge colour
 - Add new SCH_RULE_AREA class, derived from a poly SCH_SHAPE
 - Add SCH_RULE_AREA to paint and plot methods
 - Add new rule area color preference to themes
2024-04-25 14:24:46 +00:00
Jeff Young
95136494b3 RIP LIB_PIN. 2024-04-20 12:10:31 +01:00
Jeff Young
d761b4f22f RIP LIB_TEXTBOX and LIB_SHAPE. 2024-04-16 16:31:16 +01:00
Jeff Young
3efe504dcc Collapse LIB_TEXT into SCH_TEXT. 2024-04-16 16:31:16 +01:00
Jeff Young
d77eae3e7e Collapse LIB_FIELD into SCH_FIELD. 2024-04-13 15:42:13 +01:00
Jeff Young
91df43c97a ADDED: schematic tables.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6806
2024-02-24 20:05:50 +00:00
Mike Williams
91b6bb8088 Grid helpers: remove view items on destruction 2023-10-23 09:39:08 -04:00
Marek Roszko
22b733209d Fail GAL on its header leaking audit
Maybe we should rethink directly accessing GAL so much, but at least 600 files didn't need GAL leaked into them due to view_overlay.h
2023-09-18 19:52:27 -04:00
Mike Williams
b8a61719c3 Grids: make overrides use existing grids (choice box) 2023-08-30 13:33:04 -04:00
Jeff Young
4fefd95e0c Move grid definitions to Prefs and grid origin to a separate dlg.
Grid origin is document-wide, while grid definitions are app-wide.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2262
2023-08-26 13:32:24 +01:00
Mike Williams
d9c2e0ab54 PCB: start of grid overrides
Only works for moves.
2023-08-24 10:29:09 -04:00
Mike Williams
0f781f328e GRID_HELPER: push code to parent class
Prep'ing for PCB grid overrides
2023-08-24 10:29:09 -04:00
Mike Williams
a44dd4d88f Symbol Editor: support grid overrides 2023-08-23 10:12:21 -04:00
Mike Williams
4e763cd9f2 Schematic: ortho line drag bend lines should respect grid overrides 2023-08-21 10:42:44 -04:00
Mike Williams
8b79ab708a Grid Anchors: don't anchor from graphic lines when moving connectables
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/13672
2023-08-21 10:42:44 -04:00
Mike Williams
1e66129218 Schematic: Align Elements to Grid needs to respect grid overrides 2023-07-27 10:45:27 -04:00
Mike Williams
132a0ada73 Grid Overrides: support grids-per-type that override the current grid.
Schematic only at this point while we test and refine.

PCB support is a future addition.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/14756
2023-07-25 10:17:57 -04:00
Jeff Young
493828cc6b Eradicate a bunch of calls to dyn_cast.
Also deletes PAD::GetParent() which fails to look for parent footprint
through groups.
2023-06-25 11:10:07 +01:00
Marek Roszko
e6ed275c25 Repoint IU_PER_MILS 2022-09-16 21:09:26 -04:00
Seth Hillbrand
225b03d702 Move sheetpins by their connection point
Need to calculate the sheet pin anchor position in order to get it
aligned to the grid while moving

Fixes https://gitlab.com/kicad/code/kicad/issues/12134
2022-07-31 20:02:57 -07:00
Jeff Young
c6a8100d46 Schematic and symbol text boxes.
Also fixes some plot bugs with arcs.

Also moves polygonization of arcs (when required) in plotting code
from 5 degrees to calculated based on ARC_HIGH_DEF.

Fixes https://gitlab.com/kicad/code/kicad/issues/5017
2022-01-28 21:38:15 +00:00
Jeff Young
3409783d9f Break sch_text.h/.cpp into sch_text and sch_label.
Also moves SCH_NETCLASS_FLAG to SCH_DIRECTIVE_LABEL, and remaps Altium
harnesses from SCH_TEXT to SCH_DIRECTIVE_LABEL.
2022-01-28 21:38:15 +00:00
Marek Roszko
c91d3e3cf9 Remove some more wxPoint 2022-01-01 14:12:20 -05:00
Marek Roszko
c4c56de708 Neurotically update position wxPoint usages 2022-01-01 11:55:51 -05:00
Jeff Young
889970a449 SCH_NETCLASS_FLAGs and SCH_FIELDs for labels.
ADDED: a new label type for netclass flags.
ADDED: the ability to define fields on labels.
2021-12-24 16:13:27 +00:00
Jon Evans
ae24daa033 Do not include text when computing drag origin for a group
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9630
2021-11-14 11:54:04 -05:00
Roberto Fernandez Bautista
d1bab3116d eeschema: Warp to origin when moving - add missing text items
Schematic fields and text items were not being warped to origin when
moving.
2021-11-06 15:19:22 +00:00
Wayne Stambaugh
cb72da294a More NULL expunging. 2021-07-16 16:13:41 -04:00
Wayne Stambaugh
fbc135e69f Rename SCH_COMPONENT to SCH_SYMBOL. 2021-06-10 10:34:49 -04:00
Jon Evans
c04e19f9ac Include optimization: move some things from common.h to point-of-use 2021-03-20 12:09:18 -04:00
Mikolaj Wielgus
1dc0ef01b3 Fix automatic wire tool in gridless mode
The automatic wire tool was not working in the gridless mode because the
grid snapping on/off logic present in `EE_GRID_HELPER`, based on the
value of `m_enableGrid`, was not taking into account that another check,
but for the global KiCad setting, would be performed in the `Align()`
method, which is inherited from `GRID_HELPER`.

I've modified all tests of `m_enableGrid` value to also take the global
setting into account, and moved checks for it to `Align()` method, as
it's more consistent this way.

I've also removed an override of the `Align()` method in the
`PCB_GRID_HELPER` class, as it was made redundant by my changes.

Fixes https://gitlab.com/kicad/code/kicad/issues/7402
2021-02-10 22:07:49 +00:00
Seth Hillbrand
238aa2b5b0 Snap to eeschema lines
Allows easier snapping to lines when drawing in eeschema.

Fixes https://gitlab.com/kicad/code/kicad/issues/7378
2021-02-02 19:33:18 -08:00
Jeff Young
68efdb2fff Push shared parts of GRID_HELPERs into common. 2021-01-16 23:18:10 +00:00
Ian McInerney
fc20eaa083 Fix some compiler and Coverity warnings 2020-12-17 00:30:22 +00:00
Wayne Stambaugh
dd4298bb94 Coverity fixes: 280374, 313611, 313648, 313649, and 314720. 2020-12-11 13:29:52 -05:00
Jeff Young
4f90c03c7d Allow snapItem to be re-activated.
Don't clear until another snapPoint is chosen.  This allows line
snapping to re-appear when they move back in range.

Fixes https://gitlab.com/kicad/code/kicad/issues/5973
2020-12-05 23:57:33 +00:00
Jeff Young
a3406e7514 Make snapping more predictable.
In particular, allow grid positions to override line snapping if
they're a better match (and do this independently on x and y axes).
We already allow a nearer anchor to override, but that should be
based on a cartesian distance rather than independent axes.

Fixes https://gitlab.com/kicad/code/kicad/issues/6626
2020-12-04 22:50:30 +00:00
Jeff Young
a19028a396 Hook up EE_GRID_HELPER to some more tools.
Also implements EE_GRID_HELPER layers so that connectable things
snap to connectable things and graphics snap to graphics.

Fixes https://gitlab.com/kicad/code/kicad/issues/5641
2020-12-03 15:16:34 +00:00