Commit Graph

478 Commits

Author SHA1 Message Date
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 d319cd4b89)

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 b8fa10ab2b)

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
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
Ian McInerney f8688a922d Unify IO library descriptors 2023-12-27 16:34:59 +00:00
Ian McInerney 85f62c1fde Rename all schematic IO plugins 2023-12-24 01:22:21 +00:00
Ian McInerney d8b47d18d3 Initial rename of file plugin infrastructure components to IO 2023-12-24 01:22:21 +00:00
jean-pierre charras e5b27dbe32 Eeschema: minor fix: ensure, after loading a schematic the sheet count is updated.
Fixes #16260
https://gitlab.com/kicad/code/kicad/-/issues/16260
2023-12-05 09:58:25 +01:00
Wayne Stambaugh 764df1d107 Fix crash when saving pasted root sheet symbols.
The paste code creates invalid KIID_PATH objects with a zero length.  All
paths must include the root KIID at a minimum.  Code was added to prune
the invalid paths and some defensive code was adding to the formatter to
prevent the crash in case there are other paths where someone generates
a zero length path.

Pruning orphaned instance data does not work when loading schematics prior
to version 7 because the paths did not include the root sheet UUID.  Once
the file is saved to V7 or later, the next load will prune any orphaned or
invalid instance data for the current project.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16245
2023-12-03 08:03:31 -05:00
Wayne Stambaugh 6dc25f4775 Fix broken symbol reference designators on paste special.
It appears that in our zeal to prevent file changes when saving shared
schematics, we (I) clobbered saving relative symbol instance data paths
to the clipboard.  This has be restored along with setting the correct
symbol unit for relative clipboard paths.

Fixed a serious issue with KIID_PATH::MakeRelativeTo() where the original
path was not restored when the incremental KIID object test fails.  This
also included a minor optimization using the actual KIID object for
comparison instead of converting it to a string and then comparing the
string.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15981
2023-12-01 14:18:47 -05:00
Mike Williams 58cc0e2d1e Schematic: correctly resolve SHEETNAME for root sheet 2023-11-27 13:45:12 -05:00
jean-pierre charras b698ddc82c Eeschema: fix typo in files-io.cpp in revert command that deletes .kicad_sch file
Fixes #16114
https://gitlab.com/kicad/code/kicad/-/issues/16114
2023-11-20 08:47:33 +01:00
Jeff Young e73048bf98 Only set modified if it's an old file.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16113
2023-11-19 23:36:36 +00:00
Jeff Young 37b6cd1714 Set modified flag when loading old s-expr files.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16113
2023-11-18 20:27:24 +00:00
Jeff Young f83d60a48f Clean up autosave files when reverting.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15998
2023-11-05 12:20:31 +00:00
Alex Shvartzkop 847ab093c8 ADDED: Project chooser dialog for EasyEDA Pro import. 2023-10-30 09:35:27 +03:00
Jeff Young 8cba785375 Single warning for all locked sheets when saving schematic.
Also checks for modified before trying to save at all.

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

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15963
2023-10-27 14:58:30 +01:00
Jeff Young 46aecefb04 Re-enable import non-Kicad project, but make it clear current will be lost.
(And there's no sense in asking if they want to save changes first,
as those will be lost too.)
2023-10-25 00:11:08 +01:00
Wayne Stambaugh 5d6ef69726 Coding policy and Doxygen comment fixes. 2023-10-12 09:36:28 -04:00
Marek Roszko c5471bbe9f Gracefully handle unknown schematic formats
Fixes KICAD-400
2023-10-01 10:32:33 -04:00
Marek Roszko 8c6899b0d3 Tear out the eeschema conditional compile of PROJECT 2023-09-27 23:05:30 -04:00
Seth Hillbrand b837aa823c Disable non-KiCad import for project-mode
Adds warning if project schematic contains data

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15570
2023-09-22 09:21:56 -07:00
Seth Hillbrand d0f37ee55e Prevent double connectivity calculations
The schematic cleanup will call the connectivity calculation but we
don't want this second call, so we store the change in a dummy commit
and discard it when we're done.
2023-09-16 19:42:54 -07:00
Marek Roszko 7505fd0f37 Profile can live in core 2023-09-07 07:47:01 -04:00
Alex Shvartzkop 21ee65aa9c ADDED: Importers for EasyEDA (JLCEDA) Standard / Professional. 2023-09-07 11:02:40 +03:00
Alex Shvartzkop e128896ba6 Schematic plugins refactoring, fixes for PCB plugins.
- Move PLUGIN_FILE_DESC to common.
- SCH_PLUGIN: rename Load -> LoadSchematicFile, Save -> SaveSchematicFile.
- Use PLUGIN_FILE_DESC and CanRead* in schematic plugins.
- Return none/unknown types from Find/GuessPluginType functions.
- Iterate over file types for file wildcards.
- Clean-up header checking in IO plugins.
- Use PCB plugin list in IO_MGR::GuessPluginTypeFromLibPath.
2023-08-31 05:08:03 +03:00
Jeff Young 10ed1d1a7f Save ERC settings (including exclusions) when saving file.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15274
2023-08-28 13:27:57 +01:00
Seth Hillbrand db8e15ce88 Require wxWidgets 3.2
Removes old defines and work arounds for earlier wx versions and adds a
CMake requirement to use at least 3.2 (or the minimum matching wxPython
version)
2023-08-23 22:02:56 +00:00
Marek Roszko f341fde938 Move RecordERCExclusions and ResolveERCExclusions out of the schematic frame 2023-08-13 19:50:05 -04:00