475 Commits

Author SHA1 Message Date
Seth Hillbrand 18c025f21f Skip redundant VIEW updates and repaints
Add m_hasPendingItemUpdates to VIEW so UpdateItems() can
return immediately when no item has queued update flags.
The flag is set wherever m_requiredUpdate is modified and
cleared at the end of UpdateItems().

In DoRePaint(), check the new flag alongside IsDirty() and
cursor movement to skip both item processing and the GL
draw cycle when nothing has changed. Route onPaint through
Refresh() so the existing frame-rate throttle applies to
native paint events as well.
2026-03-03 11:33:10 -08:00
Alex Shvartzkop 21db4a0238 Avoid sorting layers after setting each layer rendering order in VIEW.
Saves 100 ms when opening Choose Symbol dialog.
2026-02-28 13:47:03 +03:00
Tomasz Wlostowski 9c771102bd WX_VIEW_CONTROLS: discard the mouse wheel event after wheel-to-zoom to trigger a redraw.
Fixes choppy zoom behaviour (dropped redraws) on certain combinations of mice and software (Pop OS 24.04/intel graphics/Gnome3/Xorg).
2026-02-20 20:32:36 +01:00
Seth Hillbrand 2fe9088fdd Fix VIEW::Remove assertion when item belongs to a different view
Replace wxCHECK_MSG assertion with a graceful early return and trace
log. Items can end up associated with a different view during teardown
or when moved between views, which is not a fatal error.

Fixes KICAD-72D
2026-02-15 21:40:37 -08:00
Seth Hillbrand 8b45d46e41 Always handle native horizontal wheel events as horizontal pan
Previously, horizontal mouse wheel events (from tilt wheels, side-button
scroll combos, or touchpads) were gated by the m_horizontalPan setting.
When this setting was false (the default), these events were silently
consumed without any visible effect. This caused mice like the Logitech
Lift that use driver-level side-button + scroll wheel remapping to
horizontal scroll to appear broken in KiCad.

The m_horizontalPan setting was originally introduced to block spurious
horizontal scroll events from certain mice, but that issue was separately
addressed by restricting zoom handling to the vertical axis only.

Native horizontal wheel events are now always processed as horizontal
panning, consistent with how other KiCad components (3D viewer, mathplot)
already handle them. The scrolling else-branch is simplified since it
now only handles vertical scroll events.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/23038
2026-02-13 15:23:16 -08:00
Seth Hillbrand 4452b4764e Allow clearing m_viewPrivData when empty
VIEW::Clear() will set the view to nullptr.  When we then remove the
items afterward, we still want to allow full removal as long as we know
the view is ours or has been released by Clear()
2026-01-19 13:57:12 -08:00
Seth Hillbrand e393654e00 GerbView: Fix viewer closing when reloading after clearing layers
VIEW::Clear() did not invalidate the viewPrivData for items before clearing
internal data structures. When a selection tool's Reset() added its m_selection
VIEW_GROUP to the view before Clear() was called, the m_selection retained a
stale m_viewPrivData->m_view pointer after clearing. Then, when reloading files
the selection tool tried to remove and re-add m_selection, leaving a stale reference

The fix invalidates viewPrivData->m_view for all items before clearing,
ensuring persistent items like selection groups won't have dangling references.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22755
2026-01-19 10:14:14 -08:00
Seth Hillbrand 86a714b45a Add missing initializations 2026-01-09 17:43:22 -08:00
Seth Hillbrand 75584340e5 Revert "Improve responsivity for selected items"
This reverts commit 205b3f560a.

Accidentally dropped move handling.  Will look for other ways
2026-01-04 07:18:23 -08:00
Seth Hillbrand 205b3f560a Improve responsivity for selected items
We don't need a full repaint for items when selected, just update
colors.  Selected mode doesn't require hiding the existing items, we
just need to repaint them in a new color.  Then we can use the cached
elements

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22591
2026-01-04 06:38:42 -08:00
Seth Hillbrand 120c788ef0 Clear the keyboard movement flag on mouse move
We detect mouse movement by checking if the screen position is not the
keyboard position and if not, we clear the
m_lastKeyboardCursorPositionValid that is used for detemining keyboard
movement in snaps

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21981
2025-10-20 16:33:39 -07: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
Seth Hillbrand a7e6fa8198 Allow panning with selectable key
Add optins to mouse dialog to allow modifier key-based mouse movement
panning

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2492
2025-08-11 13:21:22 -07:00
Seth Hillbrand 4aa2047f45 Replace alg::delete and alg::delete_if with std c++20 2025-08-04 09:03:16 -07:00
Seth Hillbrand d538f8d848 Avoid unmapped layers
ViewGetLayers returns the item layer even if it is invalid.  We filter
this out at the base and skip items that cannot be displayed in the
view.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21368
2025-07-24 13:41:09 -07:00
Jeff Young be1e79ccd8 Debugging. 2025-07-12 15:46:07 +01:00
Jeff Young 0375985d58 Debugging for removing items not in the view. 2025-07-03 20:45:11 -06:00
Jeff Young e2808846ce Formatting. 2025-06-24 11:52:29 -06:00
Jeff Young 92b9997948 Nullptr safety. 2025-06-08 16:33:05 +01:00
Jeff Young 877c6bce89 Printing is not zoom-specific.
(Some of these items don't currently get printed, but
there's no sense in leaving a latent bug around in case
we ever change our minds.)
2025-03-07 13:01:00 +00:00
Wayne Stambaugh e09b095533 Common folder housekeeping part 3. 2025-01-16 11:50:08 -05:00
Sam Schweigel 373d9c9281 Disable touch events on OSX only, allowing them on GTK and Windows
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14374
2025-01-09 23:00:53 +00: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 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
Alex Shvartzkop bc6b620b8f gerbview: Sort layer maps after reordering view layers.
Otherwise we get previous freed pointers in m_orderedLayers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19394
Fixes KICAD-P65
2024-12-30 21:29:35 +05:00
Jon Evans c77426cc12 Fix a few issues with via and pad rendering
The refactor of VIEW::SortLayers broke it, but this
was hard to notice until my recent changes.
2024-12-28 12:42:52 -05: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 ab3f597871 Fix ReorderLayerData to handle sparse maps
aReorderMap might only have a few layers needing changing, so preserve
existing map if it doesn't exist in the new map

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19185
2024-12-02 09:01:34 -08:00
jean-pierre charras e96774bc1f Pcbnew: fix not displayed filled areas of zones when selected. 2024-11-27 09:41:01 +01:00
Seth Hillbrand d7137c4a05 Cleanup VIEW class
Ununsed m_dynamic class variable
2024-11-21 18:59:48 -08:00
Seth Hillbrand 76176274cf Improve function naming
Having sortLayers and SortLayers in the same class was confusing.  Also
removed the asserting calls in view updates
2024-11-21 18:04:23 -08:00
Seth Hillbrand 9c08354485 More VIEW refactoring
Move m_layers into map, add layer existence checks.  Skip layer sorting
overhead for OpenGL display b/c we use z-level for it anyway
2024-11-21 15:41:56 -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 71a0a638a0 Remove unused pad layers and simplify pad colors 2024-11-16 11:27:20 -05:00
John Beard dbf68a80b8 GAL: also scope layer depth push/pops
This means that an early return or an exception between
a manual Push/Pop (or an omission of the Pop) cannot
corrupt the layer stack.

It also means the GAL doesn't have to maintain its own
stack (with the in-scope GAL_SCOPED_ATTRS taking that role).

Reomve the Push/PopDepth functions, as they're only ever
used in pairs, and doing it manually needs more care.
2024-11-04 20:41:44 +08:00
John Beard 9c9542deea Bind multiply-modified scroll events to the increment action
Implemented as handling un-consumed scroll events that the
WX_VIEW_CONTROLS doesn't want because it has too many mods
set. Then dispatch these as TA_MOUSE_WHEEL events.

The default action from the selection tools is to run the
'increment' ACTION, which is implemented differently in the
various tools: eeschema can increment labels, symedit
does pin names and numbers, and fpedit does pad numbers.
2024-10-26 16:00:58 +08:00
Mike Williams 53022ab347 mouse settings: add reverse zoom option
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18583
2024-09-23 17:09:44 +00:00
Seth Hillbrand b1093f1daf Fix some signed/unsigned comparisons 2024-07-08 13:38:11 -07:00
Alex Shvartzkop a866c46d3b Store VIEW_ITEM index to avoid std::find in removal.
-280 ms on https://gitlab.com/kicad/code/kicad/-/issues/18148
2024-07-03 20:32:37 +03:00
Alex Shvartzkop 340c84c54a Allow leaving nullptr values in VIEW::m_allItems, then defragmenting later when removing items.
Gives -1 s performance boost when reverting a commit.
2024-07-03 16:27:03 +00:00
Jeff Young 7fef6e8d83 Use view's RTree for redrawing netnames. 2024-06-14 00:20:37 +01:00
Jon Evans 74517856ca Make touchscreen events Windows-only
They break things on macOS and probably also on GTK
according to the wxWidgets documentation.
2024-06-09 13:18:32 -04:00
Alex Shvartzkop 7bca6cdea7 Make crosshair follow view movement when using pan/zoom gestures. 2024-06-09 18:46:42 +03:00
Alex Shvartzkop 832393b07c Remove debug line. 2024-06-08 17:25:49 +03:00
Alex Shvartzkop 8f8a68229c Handle touchscreen gesture events for zoom/pan. 2024-06-08 16:00:34 +03:00
Marek Roszko e9fde0051f Don't let CaptureCursor fight modal dialog 2024-05-24 18:57:24 -04:00
John Beard ce758adca3 Enable horizontal scroll panning
Allow a horizontal scroll event to fall through to the panning branch.

This still restricts zooming to use only the vertical axis, but it
(re-?)enables the horizontal pan function that currently doesn't work
even if the user has set "allow horizontal panning", as the horizontal
scroll doesn't have a modifier, which is the default for vertical scroll
zoom, and thus it skips over the whole panning branch.

If the user has not set horizontal panning, the earlier early return
means that there is no handling of any horizontal scroll event, so this
won't change anything for these users.
2024-05-20 19:23:23 +08:00
Alex Shvartzkop 865e3a9f3c Improvements when working closer to 32-bit integer limits.
- Changes BOX2 size to extended coordinates.
- Adds BOX2ISafe to construct a BOX2I that will fit in int32.
- Adds more checks.
- Safer computations.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17670
2024-04-23 16:34:07 +00:00