504 Commits

Author SHA1 Message Date
Mark Roszko
5895c27f4a Rename Prj() on schematic to avoid conflict with global function 2025-08-07 23:21:41 -04:00
Seth Hillbrand
f6b599e155 Remove temporary file saving step
We implemented the intermediate temporary file in order to avoid issues
during save.  Unfortunately, this is heavily system-dependent and seems
to cause problems with unusual setups.  Now that we cache writing using
the prettifier, the errors during output will not affect the existing
file

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21330
2025-07-16 09:20:33 -07:00
Jeff Young
dc0e211e1e Can't add to parent group without a commit.
We allow this only for file import, where we don't
need to handle group membership anyway.
2025-07-11 21:26:19 +01:00
Jeff Young
382ba0629e Don't assert on autosave dir not writeable (KICAD-6ZA). 2025-06-30 20:04:12 -06:00
Jeff Young
ed8605b9c1 Nullptr safety (KICAD-78). 2025-06-26 10:01:55 -06:00
Jeff Young
e615fcfe90 Improve progress reporting for opening and importing schematics. 2025-06-01 21:05:50 +01:00
Jeff Young
30748006f7 Standardize on American English spelling of "canceled". 2025-06-01 19:38:24 +01:00
Jeff Young
06dcb64ad8 Harden progress reporter API against misuse.
Also, titles are nouns, not verbs.  (Messages
*inside* reporters are verbs.)

Also implements progress reporter for Altium
schematic import.
2025-06-01 19:38:24 +01:00
Jeff Young
59a172101b Formatting. 2025-06-01 19:38:23 +01:00
Jeff Young
327cca9de5 Coverity fixes. 2025-05-25 20:01:18 +01:00
Jeff Young
5996cffabc EE -> SCH (no functional changes) 2025-03-13 13:15:47 +00:00
Jeff Young
5c91a7fa3a Don't treat version-bumped file as modified.
But do allow Save to still work.
2025-03-06 15:37:18 +00:00
Seth Hillbrand
e81956f292 Import Altium Projects
Handle Altium project file format

Parse individual schematic files and layout files
Create top-level schematic file
Link imported UUIDs between schematic symbol and footprints based on
refdes
Create KiCad project
Map Altium layout layers between KiCad

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2117
2025-02-27 14:36:24 -08:00
Seth Hillbrand
2e93fb7a24 Prevent crash when importing over existing project
If the hierarchy navigator is open and expanded, we have references to
the existing sheets.  These need to be cleared when importing a new
sheet over top

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20004
2025-02-21 10:34:25 -08:00
Jon Evans
ab5bdd2882 Fix project settings not actually saving after migration 2025-01-10 08:26:32 -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
jean-pierre charras
d51c7372b4 Eeschema, *.kicad_pro file: Use for the root sheet the canonical name "Root"
Previously, the translated name was stored in file.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19262
2024-12-07 16:04:35 +01:00
Wayne Stambaugh
a6923b3de3 Cache full schematic sheet list sorted by sheet page number.
The sheet list is returned as a copy of the cached list rather than a
reference to prevent external code from changing the list.  While not as
performant, it eliminates the risk of the sheet list being altered in
ways that could break the schematic.  The sheet list should only be
updated by calling SCHEMATIC::RefreshHierarchy() when any appropriate
sheet changes are made.

Note to developers: there is something inherently different about how the
QA tests are loading and handling schematics versus the schematic editor.
Using the cached sheet list for the SCHEMATIC object will cause some QA
test to fail.  This is why SCHEMATIC::Hierarchy() has not replaced
SCHEMATIC::BuildSheetListSortedByPageNumbers() everywhere.
2024-10-09 09:58:50 -04:00
Wayne Stambaugh
d9d984d2c8 Warn user when template field names contain trailing/leading white space.
When loading a schematic that contains fields with trailing/leading white
space, show an infobar message.  When editing the template field names,
prompt the user to keep or remove any trailing or leading white space
characters from field names.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18601
2024-09-16 15:37:33 -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
Alex Shvartzkop
36019314e9 Make simulation reporter warnings non-fatal.
Adds REPORTER::HasMessageOfSeverity for WX_STRING_REPORTER,
which allows us to show simulation warnings and fail only if there's errors.

Also fixes a crash when SPICE_GENERATOR_KIBIS throws an IO_ERROR.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18143
2024-09-05 05:59:35 +03:00
Seth Hillbrand
7214ef1f14 Remove basic masking class map_string_utf8
This is just std::map<std::string, UTF8>, using the class just masks
what it is and adds unclear functions.
2024-08-19 11:51:13 -07:00
Marek Roszko
b101c1a0c3 Enum class ELEM. 2024-08-18 21:09:37 -04:00
Wayne Stambaugh
0cf1110367 Fix missing schematic symbol instance data.
This fix adds missing symbol instance data that defaults the instance
data to no annotation which will will trigger a annotation request on
any operations that require a fully annotated schematic.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18486
2024-08-09 18:55:23 -04:00
Jeff Young
b8819b4636 Another reduction in asserts. 2024-07-19 22:11:56 +01:00
Seth Hillbrand
77797103f7 Add ability to embed files in various elements
Schematics, symbols, boards and footprints all get the ability to store
files inside their file structures.  File lookups now have a
kicad-embed:// URI to allow various parts of KiCad to refer to files
stored in this manner.

kicad-embed://datasheet.pdf references the file named "datasheet.pdf"
embedded in the document.  Embeds are allowed in schematics, boards,
symbols and footprints.  Currently supported embeddings are Datasheets,
3D Models and drawingsheets

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

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

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17827
2024-07-15 16:06:55 -07:00
Seth Hillbrand
f2ab07c8b4 Don't spam the event processor with SelectedEvents
If we are appending a sheet, this can be hundres of new elements.  We
don't want to pass multiple selected events or we'll do the repeated
processing, slowing down our update
2024-06-28 15:02:07 -07:00
Jeff Young
a2f7edde2e Import PCB into existing project.
Or, to be more direct: don't pull the project rug
out from under EESchema when importing in non-
stand-alone mode.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18241
2024-06-25 11:49:02 +01:00
Jeff Young
14a55facf2 Clearer naming and commenting.
Also some const& hygiene and some formatting.
2024-06-25 11:07:14 +01:00
Jeff Young
26b86b3922 Don't use wxLogMessage/wxLogError for messages not meant for user.
They are particularly damaging when our event loop
gets tied up in knots with the log message window
behind a modal window -- thereby locking up KiCad.
2024-06-24 20:22:29 +01:00
dsa-t
3e480b6f6e Improve error message when trying to Open non-KiCad schematic files.
See https://gitlab.com/kicad/code/kicad/-/issues/18241


(cherry picked from commit d319cd4b890fd9c76a7ef1ba9cf572d9d7ce0833)

Co-authored-by: Alex Shvartzkop <dudesuchamazing@gmail.com>
2024-06-22 17:35:57 +00:00
jean-pierre charras
d778cb6647 Schematic editor: fix some issues that can crash the editor on closing.
- Add a test to be sure a SCHEMATIC exists before trying to use it
- Delete items in Repeat list and undo/redo list before deleting the schematic
- Delete also these items when loading a new schematic (the repeat list was
not cleaned previously)
Before these fixes I see a use after delete issue due to dangling pointers
stored in Repeat list.
2024-06-14 16:57:57 +02:00
Jeff Young
edc7603d2a Make it clear that GetSheets() is heavy.
Also removes the side-effect that SCH_SHEET_LIST's
c'tor would sort the list (and write virtual page
numbers) anytime the starting sheet was the root.

Also, definitely don't build a SHEET_LIST (sorted or
otherwise) if you're not even going to use it.

Also don't build SCH_SHEET_LISTs on idle events.  Better
to just always have the Next Sheet button enabled (we
already beep if you click it and there's no next sheet).

Also, use a SCREEN_LIST when you can.  It's much cheaper
to create.
2024-06-06 18:00:59 +01:00
Jeff Young
a6e8cfe35f Performance for large hierarchies: avoid sorting
Don't sort SCH_SHEET_LISTs if we're just scanning the doc.
2024-06-06 11:53:01 +01:00
Jeff Young
e543ff0578 Performance for large hierarchies: lookups
Don't bother to sort sheet lists when we're just looking
up a UUID, sheet count, other symbol units, etc.
2024-06-06 11:52:57 +01:00
Wayne Stambaugh
795a9eea60 Coding policy fixes.
This is primarily to change all instances of wxLogDebug with wxLogTrace
so developers do not have to sift through debugging output that is always
dumped.  The only exception is for code blocks built in debug builds and
called on demand for dumping object states.
2024-05-23 07:59:45 -04:00
Jeff Young
0e0432d194 Don't abort on failure to backup file if it was never saved.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17810
2024-05-05 14:58:23 +01:00
Jon Evans
6b145b2830 Add optional reporting of non-KiCad design issues
Also add HTML reporter to PCB side to match schematic


(cherry picked from commit b8fa10ab2b3685309639e14ad1cd6e37a6b497dd)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2024-05-04 15:27:52 +00:00
Alex Shvartzkop
16e3692e71 Build time optimizations. 2024-04-27 23:49:13 +03:00
Seth Hillbrand
ef62b01dd1 Make import/export flags explicit
IO plugins can import/export or both.  This sets an explicit boolean for
controlling which options are available.
2024-04-25 09:21:15 -07:00
Alex Shvartzkop
2babd574be Refactor autosave prefix into FILEEXT. 2024-04-22 04:06:04 +03:00
Wayne Stambaugh
d79619edd1 Minor net navigator improvements.
Ignore bus member connection subgraphs.  They do not have a valid net
name nor do they contain schematic items.  This prevents empty nodes
from being added to the tree.  They can be reintroduced in the future
if someone wants to pursue it.

Freeze the wxTreeCtrl while populating it and thaw when done to prevent
any unnecessary repainting.

Add profiling to test how long it takes to rebuild the net navigator.
The recently added populate the navigator with all nets when no net
is highlighted has exposed some potential performances issues with some
versions of wxWidgets on certain platforms.  Namely wxWidgets 3.2.4 on
Linux GTK.

Fix an issue where a sheet name change would not update the highlighted
net navigator resulting in a stale human readable sheet path.

Prevent the highlighted net navigator from being rebuilt twice when
loading a schematic.  SCH_EDIT_FRAME::RefreshNetNavigator() was being
called from both SCH_EDIT_FRAME::UpdateHierarchyNavigator() and
SCH_EDIT_FRAME::RecalculateConnectivity().

Add a new trace helper "KICAD_UI_PROFILE" to show trace output when
profiling user interface performance.  It's used in the net navigator
profiling mentioned above.

Reuse PROF_TIMER::Show() to generate string for PROF_TIMER::to_string().
2024-04-17 14:31:50 -04:00
Seth Hillbrand
a9f35ba42e Fix incremental connectivity
The connectivity routine would consider symbols, overwriting unused
subgraphs for pins that were not in the change list.  This is resolved
by updating the full connectivity to only use pins in the graph since
symbols are not connected independently.

In the process of adding QA tests for this change, additional issues
with the schematic QA were discovered.  Specifically, we were not
properly setting the root sheet UUID.  This was partially masked by a
const_cast setting of the RefDes in sch_symbol when called the RefDes
getter.  This exposed the fact that our QA ERC numbers did not match the
schematic editor stand alone ERC numbers.  So the test value for one
check needed to be updated

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17528
2024-04-10 17:25:58 -07:00
Ian McInerney
e67eae90e9 Check for read permissions before trying to import schematic file
This will display a better error message to the user, instead of saying
that no plugins to load the file are found (because the plugin tests
will also fail due to being unable to read the file).
2024-04-01 22:00:00 +01:00
Seth Hillbrand
0d03f2febc When failing to import, ensure extant screen
We need at least the root screen in order to handle any action in
Eeschema.  Because this is destroyed by starting to load the new
schematic, when failing, we need to reset to null.

This is not as good as resetting to the previous state but that will
take refactoring our file load routines in schematic editor

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16993
2024-03-01 18:48:14 +00:00
Jon Evans
2f6c9d1f3a ADDED: Selection filter for schematic editor
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14988
2024-02-25 17:44:10 -05:00
Mike Williams
c92728715d Schematic: import schematic sheet content, allow move and undo
Otherwise, the schematic is just plopped on the screen, causing
connections and junctions to be missing that should be present.
2024-02-13 12:18:46 -05:00
Jon Evans
f80094e7c5 Warn the search pane that pointers are going invalid
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16612
2024-01-18 17:50:50 -05:00
Ian McInerney
f2702b223c Introduce base IO_MGR class and unify RELEASER objects
The IO_RELEASER is a thin-wrapper around a std::unique_ptr, but done
this way to allow easier addition of a custom deleter in the future if
something needs to call back into the IO_MGR.
2023-12-29 00:37:38 +00:00
Wayne Stambaugh
482aff3f0b Prune orphaned schematic sheet instances.
Pasting from the clipboard when copying from another project can leave
sheet instance information that is not valid for the current project.
This change prunes all sheet instance information that is not relevant
to the current project.  It also prunes invalid paths created by pasting
sheets from different paths in the same project.
2023-12-28 12:19:19 -05:00