Commit Graph

144 Commits

Author SHA1 Message Date
Seth Hillbrand b7826dfdc3 Fix irreflexive comparator in settings migration path sort
The version comparison lambda used >= 0, which returns true for
equal versions (compareVersions returns 0 for equal). This violates
strict weak ordering, causing undefined behavior in std::sort.
2026-02-19 07:52:37 -08:00
Jon Evans 5a21441069 Don't try to set an extension on the null project 2026-02-16 08:51:20 -05:00
Seth Hillbrand 672e62c370 Fix SETTINGS_MANAGER::Prj() crash when no project is loaded
When the project list is empty (e.g. during project unload or before
any project is opened), Prj() asserted and then dereferenced the
begin iterator of an empty list, causing undefined behavior. Return
a static empty PROJECT instead, matching the defensive pattern used
elsewhere in the settings manager.

Fixes KICAD-105T
2026-02-15 21:39:02 -08:00
Seth Hillbrand fc52a4428f Fix assertion in PROJECT::setProjectFullName for non-standard extensions
Several entry points (macOS file open, file history, project tree) can pass
paths with extensions other than .kicad_pro to the project loading pipeline.
SETTINGS_MANAGER::LoadProject only normalized .pro to .kicad_pro, leaving
other extensions like .kicad_sch or .kicad_pcb to trigger the assertion in
PROJECT::setProjectFullName.

Broaden the extension normalization in SETTINGS_MANAGER::LoadProject to
handle any non-.kicad_pro extension, and replace the assertion in
PROJECT::setProjectFullName with a warning log and forced correction as
defense-in-depth.

Fixes KICAD-NZT
2026-02-15 21:38:33 -08:00
Wayne Stambaugh 6b565612ef Do not attempt to create an existing directory.
When copying settings from a previous version, the settings sub-directories
may already exist.  The settings initial save code would attempt to create
the sub-directory without checking to see if it already existed which would
trigger a wxWidgets directory already exists warning.
2026-02-15 08:24:35 -05: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
Jon Evans 72bf9a8775 Don't unload project file too early in UnloadProject
Fixes https://gitlab.com/kicad/code/kicad/-/issues/22930
2026-02-04 19:03:27 -05:00
Seth Hillbrand 45ea5bbecd Fix project directory lock on Windows after project close
On Windows, processes hold a handle to their current working directory,
preventing it from being deleted. When LoadProject() sets the CWD to the
project directory, that handle persists even after CloseProject() is
called. This also causes handle inheritance issues when launching external
processes, such as the browser for "Report Bug".

Reset the working directory to the user settings path when unloading an
active project on GUI applications. This mirrors the wxSetWorkingDirectory
call in LoadProject and releases the directory lock.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20577
2026-01-26 17:44:50 -08:00
Seth Hillbrand 7ce777c1ba One more try at fixing standalone assertion
Need to abort the pcb editor preload task as well.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22697
2026-01-13 16:50:19 -08:00
Seth Hillbrand 5e2d8b9a98 Abort async library loads before modifying project list
When starting pcbnew in standalone mode and quickly opening a file, a race
condition could occur where background library loading threads tried to access
Prj() while the project list was being modified. This caused an assertion
failure: "no project in list".

The fix aborts any async library loads before modifying m_projects_list in
SETTINGS_MANAGER::LoadProject() and UnloadProject(). This ensures background
threads have completed before the project list becomes temporarily invalid.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22697
2026-01-13 11:11:54 -08:00
Jon Evans 266c8c8754 Refactor and consolidate startup wizard
- Add welcome page
- Add settings migration
- Add library table configuration
- Combine sentry and updates into a privacy step
- Support in single-top mode
2025-10-15 22:18:52 -04:00
Jon Evans f6e1e24fa0 Fix unit tests
Get rid of mocking of settings, instead
use actual QA test environment settings

Make sure to load null project at fixture startup

Improve XNODE attribute handling

Fix netlist detection regex for prettified output
2025-10-15 22:18:52 -04:00
Jon Evans 194091acae Switch schematic editor to using new library system
ADDED: lazy loading of symbol libraries in chooser
2025-10-15 22:18:50 -04:00
Jeff Young d5f16adde1 ADDED: maintenance page to preferences. 2025-08-15 16:57:46 +01: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 e379e91081 Store hierarchy expansion/collapse state
Defaults to fully expanded but stores the names for nodes that are
collapsed in project local settings.  Because project local settings are
generally changed by modifying views or selection filters, these should
be saved on close rather than only when the project is saved

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19276
2025-08-04 08:34:09 -07:00
Alex Shvartzkop 4a5039c2cf Remove some unused variables. 2025-07-02 16:48:26 +03:00
Jeff Young 18e107529a Don't force callers of GetAppSettings to implement exception processing. 2025-06-14 20:25:59 +01:00
Jeff Young 96fa79cef2 Minor performance optimizations. 2025-06-03 11:41:27 +01:00
Mark Roszko 9d32d208b8 Fix project lock both working and not working.
Turns out project locks would get created and only stick around for a short duration as the default move constructor was letting the og object free the lock.
But if you crashed kicad or managed something weird, you can get a lock file with no override prompt which also creates confusion as some stuff gets set read only.

So lets just fix this up.

- Implement move constructor on lockfile so that the old object will no longer free the lockfile
- Move lock ownership to the project itself, just slightly less weird to handle for the lock override
- Implement the override lock prompt
2025-06-01 20:20:49 -04:00
Wayne Stambaugh 598850b1f0 Fix project archiving.
Use simplified file extension and name checks rather than a regular
expression to determine which files to archive.

Fix incorrect use of wxFileName which generates invalid paths when the
last folder in the path contains dots.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20431
2025-04-05 15:53:59 -04:00
Ian McInerney 85810510f4 Tweak toolbar settings a bit
* Manage the settings using the settings manager for better lifetimes
* Better architect the internals and JSON to make it easier to identify
  the various tool types
2025-02-28 01:57:37 +00:00
Ian McInerney 7e2a81da15 Initial JSON work 2025-02-28 01:57:37 +00:00
Jon Evans 5426bfcdcd Don't autosave future formats of project settings
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19910

(cherry picked from commit 7d689e0c61)
2025-02-10 19:20:56 -05:00
Jon Evans a429afe4e9 Fix a few more cases where migrated project files were being saved implicitly 2025-02-04 18:37:31 -05:00
Marek Roszko 6652d3eca7 Remove the long path adjustment for now
Some bugs between archive vs backup project
2025-01-28 06:36:29 -05:00
Wayne Stambaugh e09b095533 Common folder housekeeping part 3. 2025-01-16 11:50:08 -05:00
Ian McInerney 6be3401b92 Add more global extensions and switch archiver to use them 2025-01-05 21:59:53 +00:00
Marek Roszko 9e2122d1f2 qa_api bypasses the normal pgm setup, test for gui using wxtheapp 2025-01-05 11:21:27 -05:00
Marek Roszko cb948302e2 Guard the cwd change for gui only 2025-01-04 19:25:05 -05:00
Marek Roszko 4dfedf4fb4 Set the cwd to the active project path 2025-01-04 19:22:29 -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
Marek Roszko 0e1b47427c Add a windows specific hack to make backups work past max length
Since backups are most likely to encounter max path limitations compared to other things we do in kicad
2024-12-29 19:54:11 -05:00
Jeff Young f40cb8dcb8 Remove a couple of fixed-version-number stragglers.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/18809
2024-12-26 17:53:03 +00:00
JamesJCode 95bbcaffbf Fix some compiler warnings 2024-10-03 07:11:59 +01:00
Marek Roszko d74caace0a Initial jobset creation and running within the CLI and GUI.
Incomplete, just pushing this before feature freeze, much fixing left
2024-09-30 20:04:53 -04: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
JamesJCode 84c0453ca9 Check for >= 2 filenames when comparing backup archives on close
Fixes a vector out-of-bounds error
2024-07-16 18:33:14 +01:00
Seth Hillbrand ffe496abf3 Cleanup !1322 for Project Backup
Do conservative check for time offset before making the expensive
backup.  Don't clear and re-check the file list for a single file change
2024-07-11 10:48:13 -07:00
Harry Best cc5fb60d93 CHANGED: Backup project only when different
Makes a test backup file and compares to the existing zip file backup to
see if the files have changed since it was made.  If so, the new file is
kept.  If not, we discard the new file and continue

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12453
2024-07-11 10:48:13 -07:00
Seth Hillbrand d2701323a8 Don't sort on lost references
The arraystring reference is lost when we don't keep the wxFileName
variable in scope.

This also adds removing invalid paths and checking for correct version
before sorting

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17749
2024-04-17 11:35:50 -07:00
Jon Evans 7b0bb59b37 Remove hard-coded versioned env vars in most places 2024-02-15 15:31:08 +00:00
Jon Evans febe759e49 Do not mess with KIPRJMOD when loading aux projects
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16810
2024-02-08 18:28:20 -05:00
Jon Evans 9d57637a1a Fix clobbering of common settings
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16905
2024-02-07 18:31:43 -05:00
Jon Evans 169114fd07 Fix path from ba25f881c6 2024-02-07 08:55:03 -05:00
Jon Evans ba25f881c6 Save common settings if we just created them
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16775
2024-02-06 21:33:44 -05:00
Marek Roszko 9a890cdba9 Kick the wildcards and file exts into a static class, export it from kicommon 2023-12-27 21:10:01 -05:00
Wayne Stambaugh 922aee1532 Coding policy fixes. 2023-12-20 07:17:23 -05:00
Jon Evans c6c808a7fa Support system-installed color themes
Install to ${KICAD_DATA}/colors/

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15920
2023-10-31 23:05:08 -04:00
Marek Roszko c006482feb Add SETTINGS_MANAGER::GetUserSettingsPath back because swig 2023-09-24 20:10:32 -04:00