169 Commits

Author SHA1 Message Date
Seth Hillbrand ee8b2bebce Store dialog geometry in DPI-independent pixels to prevent size ratcheting
On mixed-DPI multi-monitor setups, dialog sizes grow each time they are
reopened because logical pixel values change when a window moves between
monitors with different scaling factors. The std::max comparison during
restore guarantees monotonic growth since the DPI-scaled value always
exceeds the previously saved unscaled value.

Store width and height as DIP (device-independent pixels) using ToDIP()
on save and FromDIP() on restore. This makes the persisted size stable
regardless of which monitor the dialog was on when closed. A "dip" flag
in the JSON differentiates new DIP-format values from legacy logical
pixel values, which are converted in place on first load.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20120
2026-02-19 15:21:30 -08:00
Seth Hillbrand 42cfb95fe7 Fix canvas losing keyboard focus after closing properties dialog
When a dialog closes with the mouse hovering over an auxiliary panel
(e.g. the properties panel), focus would land on that panel instead
of the drawing canvas, breaking hotkey operation until the user moved
the mouse back over the canvas.

Set focus directly on the parent frame's tool canvas when closing
dialogs via Show(false) and ShowQuasiModal(), falling back to the
parent window when no canvas is available.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20926
2026-02-18 12:42:07 -08:00
Damjan Prerad 4aaf54e764 Fix segfault in DRC Rule Editor caused by stale UNIT_BINDER registrations
When overlay panels are destroyed during panel switching, their UNIT_BINDERs are freed but entries remain in DIALOG_SHIM::m_unitBinders.

Add unregisterUnitBinders() to clean up entries before panel destruction in SetContentPanel().
2026-02-15 14:01:19 -08:00
Damjan Prerad 0f63617e7a DRC Rule Editor: fix undo/redo and pass text control styles at construction
Fix undo/redo (command + Z) breaking after switching between constraint types. DIALOG_SHIM registers undo/redo handlers only on first paint, so dynamically created panels were never tracked. Solution is to add a protected resetUndoRedoForNewContent() method to DIALOG_SHIM and call it from SetContentPanel() after replacing the content panel.
2026-02-15 14:01:19 -08:00
Jeff Young 90d082d16d Don't emit page-changed events from LoadControlState().
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22265
2026-02-14 19:09:23 +00:00
Seth Hillbrand c52ab91c84 Reduce compile times by extracting headers
Break the most expensive header include chains that contaminate the
largest number of translation units

New lightweight headers for extractdded types:
font_metrics.h, mouse_drag_action.h, board_project_settings_params.h,
common_settings_internals.h, wx_infobar_message_type.h,
zone_layer_properties_grid.h
2026-02-13 17:10:45 -08:00
Seth Hillbrand 87bf452b82 Clear minimum size before computing best size in dialog restore
The previous fix added SetMinSize(GetBestSize()) after restoring saved
dialog geometry, but GetBestSize() can return a value constrained by
the current minimum size. Clear the minimum with SetMinSize(wxDefaultSize)
and invalidate the cached best size before recomputing it, matching the
pattern used by PAGED_DIALOG::onPageChanged().

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20843
2026-02-03 13:16:42 -08:00
Seth Hillbrand bb57524f07 Strip parenthetical suffixes from dialog titles for settings persistence
Dialog titles that contain dynamic content like "(1234 items loaded)"
were causing the settings file to be flooded with duplicate entries,
one for each unique title variant.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22851
2026-01-26 16:02:17 -08:00
Damjan 5be4c43f0c macOS: Fix dialogs disappearing when dragged to different monitor 2026-01-21 15:06:26 -08:00
Jeff Young 1c7e95d8f0 Select new tab when opening table.
Also, don't open same table more than once.
2026-01-19 21:41:35 +00:00
Jeff Young 3413ec5224 Save/restore control state of wxAuiNotebook (as well as wxNotebook).
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22777
2026-01-19 17:14:53 +00:00
Wayne Stambaugh d68fad564f Coding policy fixes.
Remove all wxLogDebug instances by either replacing them with wxLogTrace
calls where it was obvious what the trace flag should be or out right
remove them from the code base.
2026-01-13 11:27:18 -05:00
Jeff Young e02caf0f4a Formatting. 2026-01-13 12:43:58 +00:00
Seth Hillbrand a3a12399f2 Add graphical editor for custom design rules 2026-01-12 21:42:45 -08:00
Jeff Young 37e3394c35 Remove attempted GTK fix for ESC/focus issue. 2026-01-08 18:22:14 +00:00
Jeff Young c5425abd40 Attempt 2 at fixing ESC in Symbol Properties.
Be more direct; don't go through event loop.
2026-01-08 17:04:14 +00:00
Jeff Young eab20614ae Force ESC to be processed as a cancel in dialogs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22652
2026-01-08 12:43:22 +00:00
Seth Hillbrand 390a1da1ee Have tabs skip over hidden/disabled controls
Set an explicit tab order in the find/replace dialog

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18073
2026-01-02 13:30:50 -08:00
Jeff Young bb5a326aa6 Uniformly save WX_GRID shown columns.
Also retires some other settings that are now handled
by DIALOG_SHIM's state saving architecture.
2025-11-13 14:41:17 +00:00
Seth Hillbrand 394f6be509 Formatting 2025-08-26 14:47:04 -07:00
Seth Hillbrand fe4de09d71 Add undo/redo functionality to dialog boxes
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18986
2025-08-26 14:39:19 -07:00
Seth Hillbrand 626e9d9d1b We want to save invariant numbers also
If the number is invariant, save it below, don't prematurely exit

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21544
2025-08-24 16:16:09 -07:00
Jeff Young 29a818218a Don't fire events when loading dialog state.
(Fixes crash when opening Pin Properties dialog.)
2025-08-21 12:44:09 +01:00
Jeff Young 8e45f03bd3 Bounds checking.
Fixes KICAD-TZK
2025-08-18 21:25:14 +01:00
Jeff Young 33c73d7db4 Fix crashes when settings manager doesn't exist yet. 2025-08-14 11:33:25 +01:00
Jeff Young d27d80ab80 Don't crash in absence of settings. 2025-08-13 16:29:11 +01:00
Jeff Young c85e5c08e4 Improve quasimodal comment. 2025-08-13 16:22:51 +01:00
Jeff Young 8ed367f8cd Prevent all-radio-buttons-unset case. 2025-08-13 16:22:51 +01:00
Jeff Young 5805f67459 Save notebook page titles rather than index.
(Some notebooks have variable pages from invocation
to invocation.)

Also adds bounds-checking where appropriate.
2025-08-09 17:18:57 +01:00
Jeff Young 5a358d99bb Save notebook page titles rather than index.
(Some notebooks have variable pages from invocation
to invocation.)
2025-08-09 17:11:54 +01:00
Jeff Young 4819487ea2 Save/restore state of UNIT_BINDER and other textboxes. 2025-08-08 13:54:27 +01:00
Jeff Young ac867f6aa7 Add owner-drawn combos to control state saving.
(Also fixes LAYER_BOX_SELECTOR, etc.)

Also fixes a bug in saving wxComboBox state (we
need to save the value, not the index).
2025-08-08 13:54:26 +01:00
Jeff Young d2293ab56a Fix key generation for dialog control state.
(Previous algo overwrote className and then later
tried to use it to find siblings.)
2025-08-07 11:44:47 +01:00
Jeff Young 241d9a4c30 Separate locked & unlocked vias in global deletions.
Also allows a dialog to opt out of control-state
saving at the top level (rather than on every control).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21441
2025-08-07 11:44:47 +01:00
Seth Hillbrand 7dc83fbffd Ensure dialogs are visible on all Spaces
We never want to hide dialogs if their parent is on a different Space
(MacOS-specific terminology), so set the window property to show
everywhere when showing a dialog

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13906
2025-08-06 11:48:07 -07:00
Seth Hillbrand bf16dcfbe8 Make all windows remember their preferences
Hook into DIALOG_SHIM to remember stylistic preferences for windows such
as position, size, sash position, notebook selection, etc.

Dialogs and controls can opt out of this by setting a client data user
property "persist" to false.

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

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

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21108
2025-08-03 20:22:30 -07:00
Jeff Young 9d074c1679 See if we can't fix the ever-growing window bug.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20120

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

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10609
2025-07-21 17:24:29 +01:00
Jeff Young d0fe69bcda Formatting. 2025-07-21 16:29:50 +01:00
Marek Roszko 34be0452fd Add some additional breadcrumbs 2025-06-07 09:01:05 -04:00
Seth Hillbrand 8a0e9bef5a Do not insert newlines in single line controls
2d2f443aa4 allowed the use of shift-enter
when creating tables for newlines.  However, this should not be applied
to all text controls.  We split the ones by IsMultiLine to determine if
the shift-return is a newline or a dialog close

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20866
2025-05-14 17:13:13 -07:00
Seth Hillbrand fe0422b958 Fix infinite loop in QuasiModal
Now that we use RAII nuller, we need to avoid the case where
m_qmodal_loop is nulled before it ends

(cherry picked from commit 75fa0ab0c9)
2025-05-09 10:28:29 -07:00
Damjan 2d2f443aa4 pcbnew: Multi-line text in table cell 2025-04-14 14:07:36 +00:00
Jeff Young f951497a4f Code brevity. 2025-03-01 21:58:31 +00:00
Jeff Young b74c2791f4 Allow context menus in footprint chooser when called from Eeschema.
Also moves several RAII utility classes (some of which
were duplicated in open code) to a common header file.
2025-02-24 11:08:29 +00:00
Jeff Young 8a0bff7351 Improved naming. 2025-01-20 18:28:33 +00:00
Jeff Young 240a745aa7 Hack-fix for paste into std dialog search box.
It's hard to know how widely this fix needs to be
applied, but this should at least get most of the
cases.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19684
2025-01-20 12:58:00 +00:00
Wayne Stambaugh 5c8f4697ca Common folder housekeeping part 1. 2025-01-12 12:06:45 -05: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
Wayne Stambaugh 2e7d819b5d Fix thread deadlock when closing the footprint chooser dialog.
Fixing this required disabling the footprint/3D viewer canvas drawing
before destroying the canvas in the dialog dtor.  This in turn required
adding a virtual method to DIALOG_SHIM that can be overridden by the
derived object to allow performing actions during dialog shutdown that
can be problematic when performed in the dialog dtor.  Please note that
this only works for quasi-modal dialogs.  Modal and modeless dialogs
should use close window events.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18107
2024-12-18 08:13:15 -05:00
Andrej Valek 3ad92bc8db ShowModal: override method in DIALOG_SHIM
All DIALOG_SHIM dialogues which should be modal, has a problem on OSX
that parent could be lost. So call ReparentModal to fix this before
calling the base ShowModal method. This should fix the problem when
modal window has been hidden when windows were switched.

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

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/17460
2024-10-27 16:37:47 +00:00