Commit Graph

102 Commits

Author SHA1 Message Date
Seth Hillbrand 80c8cc0d25 Downgrade extension check to Debug
Empty projects have empty extensions, so we shouldn't show anything in
this case and even if we get a bad extension, we should just log the
debug not a warning
2026-02-16 08:58:56 -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
Seth Hillbrand 2075d1be2c Fix crash when opening PCB in standalone pcbnew
When pcbnew is started standalone (not via the project manager), the
PROJECT object exists but has no PROJECT_FILE (m_projectFile is null).
During background library enumeration, FOOTPRINT_LIBRARY_ADAPTER calls
getUri() which expands environment variables through TextVarResolver().
TextVarResolver() then calls GetTextVars() which dereferences the null
m_projectFile, causing a crash.

Guard TextVarResolver() against null m_projectFile by returning false
early, since there are no project text variables to resolve without a
project file.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/22930
2026-02-03 14:31:01 -08:00
Seth Hillbrand beaeefc445 Fix file lock dialog behavior when opening projects
Previously, clicking Cancel on the "File is already open" dialog did
not prevent the project from opening because the lock check happened
in ProjectChanged() after the project was already loaded.

This change moves the lock check to LoadProject() before any loading
occurs, so Cancel actually aborts the operation.

Additionally, when user clicks "Open Anyway" at the project level, the
decision is now propagated to child editors (eeschema, pcbnew) via a
new IsLockOverrideGranted() flag on the PROJECT class. This prevents
showing redundant lock dialogs for individual schematic and PCB files
when the user has already made their decision at the project level.
2026-01-19 16:59:19 -08:00
Jon Evans f59ae6d6f6 Clean up management of library adapters 2025-12-07 11:58:57 -05:00
jean-pierre charras d1c415523f Replace now deprecated wxPATH_NORM_ALL define by a similar define. 2025-11-27 15:25:42 +01:00
Jon Evans baa29c1a58 Port footprint library table to new system 2025-11-04 06:54:53 -05:00
Seth Hillbrand a3acf25262 Rework local history for safer backup
- Prompt before removing any files
- Check directory for additional files
2025-10-27 18:11:17 -07:00
JamesJCode 8cf74548de Synchronise access to PROJECT::DesignBlockLibs 2025-10-18 22:14:16 +01:00
Jon Evans d85fb038ba Port design blocks to new library table system
Generalize library adapter code to be shared
2025-10-15 22:18:54 -04:00
Seth Hillbrand c64f99c57a ADDED: VCSHASH and VCSSHORTHASH
Right now, git hashes only resolved by the variables ${VCSHASH} or
${VCSSHORTHASH}
2025-09-12 06:00:27 -07:00
Seth Hillbrand 4aa2047f45 Replace alg::delete and alg::delete_if with std c++20 2025-08-04 09:03:16 -07: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
Marek Roszko 42e448dbf6 Elems clear should be private 2025-02-25 18:03:26 -05:00
Jeff Young 89706aedae Resolve some variables from the project. 2025-01-16 15:59:51 +00:00
Jeff Young a7c130b82d Hook up TITLE_BLOCK resolver to jobs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19471
2025-01-12 22:31:09 +00:00
Marek Roszko 6ec00f879c Add PROJECTNAME resolution into project's resolver 2025-01-12 11:43:10 -05:00
Ian McInerney 6be3401b92 Add more global extensions and switch archiver to use them 2025-01-05 21:59:53 +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
Mike Williams 2eec2489ea design blocks: move globals behind accessor functions
Prepare for lazy loading
2024-09-10 15:50:03 -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
Marek Roszko 9eae3330ca Use std::array for rstring and elems 2024-08-18 22:04:00 -04:00
Marek Roszko b101c1a0c3 Enum class ELEM. 2024-08-18 21:09:37 -04:00
Marek Roszko 58e3c5bb6b Rename Type() to ProjectElementType() for _ELEM children 2024-08-18 20:30:45 -04: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
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
Marek Roszko 8c6899b0d3 Tear out the eeschema conditional compile of PROJECT 2023-09-27 23:05:30 -04:00
Jeff Young ef92429ac2 Implement changed notifiers for textvar, netclasses and severities.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15440
2023-09-17 17:35:15 +01:00
Marek Roszko f357e79f77 Add --define-var / -D to the cli opts for some commands
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15437
2023-08-31 21:46:37 -04:00
Marek Roszko 0ff32d20cd wxS more things 2023-01-22 09:41:42 -05:00
Marek Roszko 1edf84d756 More wxS ugh 2023-01-17 07:43:04 -05:00
Jeff Young b15913bd53 Support env variables in spice library paths.
Also removes a bunch of std::string stuff from the file handling in the
simulator.  All our file handling, env variable expansion, project path,
etc. stuff is wxString based, and jumping through std::string in between
just makes it more complex and increases the potential bug surface.

Also fixes a bug where you'd get two error messages when a spice model
library wasn't found.

Also fixes a bug where you'd get a spice model library not found error
when the text field was empty.

Also fixes a bug where we'd try to absolutize a path starting with an
unresolved text or environment variable.  If the path starts with a
variable it's probably absolute, and tacking on the project path in the
error message just obfuscates things.

Fixes https://gitlab.com/kicad/code/kicad/issues/13082
2022-12-07 15:07:25 +00:00
Jeff Young 165c9bf68b Reference assignment is not the same thing as pointer assignment.
Fixes https://gitlab.com/kicad/code/kicad/issues/12837
2022-11-06 12:01:06 +00:00
Jeff Young 4ad0eeefc6 Fix compile error on Mac. 2022-11-03 17:19:59 +00:00
Sylwester Kocjan a234d5a2c8 common,eeschema,pcbnew: path cleanup 2022-11-02 13:29:52 +00:00
jean-pierre charras bd28bd7a00 fix a few compil warnings 2022-09-23 18:30:42 +02:00
Jeff Young 8eb68ee472 Add pin/unpin context menu to Symbol Chooser and Footprint Chooser.
Also moves some more code down into common so it can be shared.

Fixes https://gitlab.com/kicad/code/kicad/issues/12384
2022-09-21 14:45:12 +01:00
Wayne Stambaugh 898ec0d094 Fix wxWidgets 3.1 and later deprecated build warnings.
wxWidgets 3.1 has deprecated wxPATH_NORM_ALL when normalizing file
paths when calling wxFileName::Normalize().  This change keeps the
existing behavior except in places where our own internal
ExpandEnvVarSubstitutions() to expand environment variables.
2022-08-15 08:00:40 -04:00
Jeff Young 6f49b57f9b Cleanup & performance enhancements. 2022-08-01 13:09:51 +01:00
Jeff Young 6aaf4413b3 Fix kicad_string.h / string.cpp mismatch.
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
2021-07-29 16:03:25 +01:00
Wayne Stambaugh bcd6bddfd4 Start expunging NULL.
Given that KiCad is a C++ project, we should really be using nullptr
instead of NULL.
2021-07-15 15:44:45 -04:00
Jeff Young 1db33c7b3a More safety (and better impl) for not sharing FP table/info stuff.
Fixes https://gitlab.com/kicad/code/kicad/issues/8657
2021-06-29 12:46:16 +01:00
Jeff Young 5c21f93803 Consistency in progress and error messages. 2021-06-26 13:23:43 +01:00
Marek Roszko d946d6e68f Cleanup some pgm_base.h includes 2021-06-08 21:56:00 -04:00
Marek Roszko cf2bb5692a Remove the wxLog calls from math/util.h for now
This was leaking windows headers and partial wx headers to 1084 compilation units......
This also means math/util.h is leaking to 1084 compilation units which seems a bit high too.
2021-06-01 18:44:22 -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
Marek Roszko 16e3e59495 Split out arrayDim and MIRROR templates from macros.h
These were not macros
2020-11-17 20:21:04 -05:00
jean-pierre charras 36bc44e6d7 more cleanup about removing useless include 2020-10-02 19:56:10 +02:00
Jon Evans 9f7bca38b3 A better way of handling standalone project files 2020-08-30 16:04:39 -04:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00